Changeset 9920 in vbox
- Timestamp:
- Jun 25, 2008 2:19:31 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuest.h
r9918 r9920 1565 1565 VBGLR3DECL(int) VbglR3DisplayChangeWaitEvent(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay); 1566 1566 VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits); 1567 VBGLR3DECL(int) VbglR3SaveVideoMode(c har *pszName, uint32_t cx, uint32_t cy, uint32_t cBits);1568 VBGLR3DECL(int) VbglR3RetrieveVideoMode(c har *pszName, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits);1567 VBGLR3DECL(int) VbglR3SaveVideoMode(const char *pszName, uint32_t cx, uint32_t cy, uint32_t cBits); 1568 VBGLR3DECL(int) VbglR3RetrieveVideoMode(const char *pszName, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits); 1569 1569 /** @} */ 1570 1570 -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
r9830 r9920 236 236 /** 237 237 * Save video mode parameters to the registry. 238 * 238 * 239 239 * @returns iprt status value 240 240 * @param pszName the name to save the mode parameters under … … 243 243 * @param cBits bits per pixel for the mode 244 244 */ 245 VBGLR3DECL(int) VbglR3SaveVideoMode(c har *pszName, uint32_t cx, uint32_t cy, uint32_t cBits)245 VBGLR3DECL(int) VbglR3SaveVideoMode(const char *pszName, uint32_t cx, uint32_t cy, uint32_t cBits) 246 246 { 247 247 using namespace svcInfo; 248 248 249 char pcModeName[KEY_MAX_LEN];250 char pcModeParms[KEY_MAX_VALUE_LEN];249 char szModeName[KEY_MAX_LEN]; 250 char szModeParms[KEY_MAX_VALUE_LEN]; 251 251 uint32_t u32ClientId = 0; 252 RTStrPrintf( pcModeName, sizeof(pcModeName), "VideoMode/%s", pszName);253 RTStrPrintf( pcModeParms, sizeof(pcModeParms), "%dx%dx%d", cx, cy, cBits);252 RTStrPrintf(szModeName, sizeof(szModeName), "VideoMode/%s", pszName); 253 RTStrPrintf(szModeParms, sizeof(szModeParms), "%dx%dx%d", cx, cy, cBits); 254 254 int rc = VbglR3InfoSvcConnect(&u32ClientId); 255 255 if (RT_SUCCESS(rc)) 256 rc = VbglR3InfoSvcWriteKey(u32ClientId, pcModeName, pcModeParms);256 rc = VbglR3InfoSvcWriteKey(u32ClientId, szModeName, szModeParms); 257 257 if (u32ClientId != 0) 258 258 VbglR3InfoSvcDisconnect(u32ClientId); /* Return value ignored, because what can we do anyway? */ … … 263 263 /** 264 264 * Retrieve video mode parameters from the registry. 265 * 265 * 266 266 * @returns iprt status value 267 267 * @param pszName the name under which the mode parameters are saved … … 270 270 * @param pcBits where to store the bits per pixel for the mode 271 271 */ 272 VBGLR3DECL(int) VbglR3RetrieveVideoMode(c har *pszName, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits)272 VBGLR3DECL(int) VbglR3RetrieveVideoMode(const char *pszName, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits) 273 273 { 274 274 using namespace svcInfo; 275 275 276 char pcModeName[KEY_MAX_LEN]; 277 char pcModeParms[KEY_MAX_VALUE_LEN]; 276 char szModeParms[KEY_MAX_VALUE_LEN]; 278 277 char *pszNext; 279 278 uint32_t u32ClientId = 0; 280 279 uint32_t cx, cy, cBits; 281 280 282 RTStrPrintf(pcModeName, sizeof(pcModeName), "VideoMode/%s", pszName);283 281 int rc = VbglR3InfoSvcConnect(&u32ClientId); 284 282 if (RT_SUCCESS(rc)) 285 rc = VbglR3InfoSvcReadKey(u32ClientId, pcModeName, pcModeParms, 286 sizeof(pcModeParms), NULL); 283 { 284 char szModeName[KEY_MAX_LEN]; 285 RTStrPrintf(szModeName, sizeof(szModeName), "VideoMode/%s", pszName); 286 rc = VbglR3InfoSvcReadKey(u32ClientId, szModeName, szModeParms, 287 sizeof(szModeParms), NULL); /** @todo add a VbglR3InfoSvcReadKeyF/FV that does the RTStrPrintf for you. */ 288 } 289 /** @todo r=bird: this is kind of ugly. 290 * What about just fixing the format as "CXxCYxCBITS" and then split it up into three strings by searching for the 291 * two 'x'es. And then apply RTStrToUInt32Full to these in turn. 292 * Also, the use of VERR_INVALID_PARAMETER seems inappropriate and confusing here. */ 287 293 if (RT_SUCCESS(rc)) 288 294 /* Extract the width from the string */ 289 rc = RTStrToUInt32Ex( pcModeParms, &pszNext, 10, &cx);295 rc = RTStrToUInt32Ex(szModeParms, &pszNext, 10, &cx); 290 296 if ( (VWRN_NUMBER_TOO_BIG == rc) 291 297 || (VWRN_NEGATIVE_UNSIGNED == rc)
Note:
See TracChangeset
for help on using the changeset viewer.