VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibVideo.cpp@ 95798

最後變更 在這個檔案從95798是 95797,由 vboxsync 提交於 3 年 前

Vbgl/VbglR3RetrieveVideoMode: Replaced sscanf with manual parsing. bugref:10216

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 23.1 KB
 
1/* $Id: VBoxGuestR3LibVideo.cpp 95797 2022-07-25 12:21:58Z vboxsync $ */
2/** @file
3 * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Video.
4 */
5
6/*
7 * Copyright (C) 2007-2022 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27
28/*********************************************************************************************************************************
29* Header Files *
30*********************************************************************************************************************************/
31#include "VBoxGuestR3LibInternal.h"
32
33#include <VBox/log.h>
34#include <VBox/HostServices/GuestPropertySvc.h> /* For Save and RetrieveVideoMode */
35#include <iprt/assert.h>
36#include <iprt/mem.h>
37#include <iprt/string.h>
38
39#ifdef VBOX_VBGLR3_XFREE86
40/* Rather than try to resolve all the header file conflicts, I will just
41 prototype what we need here. */
42extern "C" void* xf86memcpy(void*,const void*,xf86size_t);
43# undef memcpy
44# define memcpy xf86memcpy
45extern "C" void* xf86memset(const void*,int,xf86size_t);
46# undef memset
47# define memset xf86memset
48#endif /* VBOX_VBGLR3_XFREE86 */
49
50
51/*********************************************************************************************************************************
52* Defined Constants And Macros *
53*********************************************************************************************************************************/
54#define VIDEO_PROP_PREFIX "/VirtualBox/GuestAdd/Vbgl/Video/"
55
56
57/**
58 * Enable or disable video acceleration.
59 *
60 * @returns VBox status code.
61 *
62 * @param fEnable Pass zero to disable, any other value to enable.
63 */
64VBGLR3DECL(int) VbglR3VideoAccelEnable(bool fEnable)
65{
66 VMMDevVideoAccelEnable Req;
67 vmmdevInitRequest(&Req.header, VMMDevReq_VideoAccelEnable);
68 Req.u32Enable = fEnable;
69 Req.cbRingBuffer = VMMDEV_VBVA_RING_BUFFER_SIZE;
70 Req.fu32Status = 0;
71 return vbglR3GRPerform(&Req.header);
72}
73
74
75/**
76 * Flush the video buffer.
77 *
78 * @returns VBox status code.
79 */
80VBGLR3DECL(int) VbglR3VideoAccelFlush(void)
81{
82 VMMDevVideoAccelFlush Req;
83 vmmdevInitRequest(&Req.header, VMMDevReq_VideoAccelFlush);
84 return vbglR3GRPerform(&Req.header);
85}
86
87
88/**
89 * Send mouse pointer shape information to the host.
90 *
91 * @returns VBox status code.
92 *
93 * @param fFlags Mouse pointer flags.
94 * @param xHot X coordinate of hot spot.
95 * @param yHot Y coordinate of hot spot.
96 * @param cx Pointer width.
97 * @param cy Pointer height.
98 * @param pvImg Pointer to the image data (can be NULL).
99 * @param cbImg Size of the image data pointed to by pvImg.
100 */
101VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
102 const void *pvImg, size_t cbImg)
103{
104 VMMDevReqMousePointer *pReq;
105 size_t cbReq = vmmdevGetMousePointerReqSize(cx, cy);
106 AssertReturn( !pvImg
107 || cbReq == RT_UOFFSETOF(VMMDevReqMousePointer, pointerData) + cbImg,
108 VERR_INVALID_PARAMETER);
109 int rc = vbglR3GRAlloc((VMMDevRequestHeader **)&pReq, cbReq, VMMDevReq_SetPointerShape);
110 if (RT_SUCCESS(rc))
111 {
112 pReq->fFlags = fFlags;
113 pReq->xHot = xHot;
114 pReq->yHot = yHot;
115 pReq->width = cx;
116 pReq->height = cy;
117 if (pvImg)
118 memcpy(pReq->pointerData, pvImg, cbImg);
119
120 rc = vbglR3GRPerform(&pReq->header);
121 if (RT_SUCCESS(rc))
122 rc = pReq->header.rc;
123 vbglR3GRFree(&pReq->header);
124 }
125 return rc;
126}
127
128
129/**
130 * Send mouse pointer shape information to the host.
131 * This version of the function accepts a request for clients that
132 * already allocate and manipulate the request structure directly.
133 *
134 * @returns VBox status code.
135 *
136 * @param pReq Pointer to the VMMDevReqMousePointer structure.
137 */
138VBGLR3DECL(int) VbglR3SetPointerShapeReq(VMMDevReqMousePointer *pReq)
139{
140 int rc = vbglR3GRPerform(&pReq->header);
141 if (RT_SUCCESS(rc))
142 rc = pReq->header.rc;
143 return rc;
144}
145
146
147/**
148 * Query the last display change request sent from the host to the guest.
149 *
150 * @returns iprt status value
151 * @param pcx Where to store the horizontal pixel resolution
152 * @param pcy Where to store the vertical pixel resolution
153 * requested (a value of zero means do not change).
154 * @param pcBits Where to store the bits per pixel requested (a value
155 * of zero means do not change).
156 * @param piDisplay Where to store the display number the request was for
157 * - 0 for the primary display, 1 for the first
158 * secondary display, etc.
159 * @param fAck whether or not to acknowledge the newest request sent by
160 * the host. If this is set, the function will return the
161 * most recent host request, otherwise it will return the
162 * last request to be acknowledged.
163 *
164 */
165static int getDisplayChangeRequest2(uint32_t *pcx, uint32_t *pcy,
166 uint32_t *pcBits, uint32_t *piDisplay,
167 bool fAck)
168{
169 VMMDevDisplayChangeRequest2 Req;
170
171 AssertPtrReturn(pcx, VERR_INVALID_PARAMETER);
172 AssertPtrReturn(pcy, VERR_INVALID_PARAMETER);
173 AssertPtrReturn(pcBits, VERR_INVALID_PARAMETER);
174 AssertPtrReturn(piDisplay, VERR_INVALID_PARAMETER);
175 RT_ZERO(Req);
176 vmmdevInitRequest(&Req.header, VMMDevReq_GetDisplayChangeRequest2);
177 if (fAck)
178 Req.eventAck = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST;
179 int rc = vbglR3GRPerform(&Req.header);
180 if (RT_SUCCESS(rc))
181 rc = Req.header.rc;
182 if (RT_SUCCESS(rc))
183 {
184 *pcx = Req.xres;
185 *pcy = Req.yres;
186 *pcBits = Req.bpp;
187 *piDisplay = Req.display;
188 }
189 return rc;
190}
191
192
193/**
194 * Query the last display change request sent from the host to the guest.
195 *
196 * @returns iprt status value
197 * @param pcx Where to store the horizontal pixel resolution
198 * requested (a value of zero means do not change).
199 * @param pcy Where to store the vertical pixel resolution
200 * requested (a value of zero means do not change).
201 * @param pcBits Where to store the bits per pixel requested (a value
202 * of zero means do not change).
203 * @param piDisplay Where to store the display number the request was for
204 * - 0 for the primary display, 1 for the first
205 * secondary display, etc.
206 * @param fAck whether or not to acknowledge the newest request sent by
207 * the host. If this is set, the function will return the
208 * most recent host request, otherwise it will return the
209 * last request to be acknowledged.
210 *
211 * @param pdx New horizontal position of the secondary monitor.
212 * Optional.
213 * @param pdy New vertical position of the secondary monitor.
214 * Optional.
215 * @param pfEnabled Secondary monitor is enabled or not. Optional.
216 * @param pfChangeOrigin Whether the mode hint retrieved included
217 * information about origin/display offset inside the
218 * frame-buffer. Optional.
219 *
220 */
221VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy,
222 uint32_t *pcBits,
223 uint32_t *piDisplay,
224 uint32_t *pdx, uint32_t *pdy,
225 bool *pfEnabled,
226 bool *pfChangeOrigin,
227 bool fAck)
228{
229 VMMDevDisplayChangeRequestEx Req;
230 int rc = VINF_SUCCESS;
231
232 AssertPtrReturn(pcx, VERR_INVALID_PARAMETER);
233 AssertPtrReturn(pcy, VERR_INVALID_PARAMETER);
234 AssertPtrReturn(pcBits, VERR_INVALID_PARAMETER);
235 AssertPtrNullReturn(pdx, VERR_INVALID_PARAMETER);
236 AssertPtrNullReturn(pdy, VERR_INVALID_PARAMETER);
237 AssertPtrReturn(piDisplay, VERR_INVALID_PARAMETER);
238 AssertPtrNullReturn(pfEnabled, VERR_INVALID_PARAMETER);
239 AssertPtrNullReturn(pfChangeOrigin, VERR_INVALID_PARAMETER);
240
241 RT_ZERO(Req);
242 rc = vmmdevInitRequest(&Req.header, VMMDevReq_GetDisplayChangeRequestEx);
243 AssertRCReturn(rc, rc);
244 if (fAck)
245 Req.eventAck = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST;
246 rc = vbglR3GRPerform(&Req.header);
247 if (RT_SUCCESS(rc))
248 rc = Req.header.rc;
249 if (RT_SUCCESS(rc))
250 {
251 *pcx = Req.xres;
252 *pcy = Req.yres;
253 *pcBits = Req.bpp;
254 *piDisplay = Req.display;
255 if (pdx)
256 *pdx = Req.cxOrigin;
257 if (pdy)
258 *pdy = Req.cyOrigin;
259 if (pfEnabled)
260 *pfEnabled = Req.fEnabled;
261 if (pfChangeOrigin)
262 *pfChangeOrigin = Req.fChangeOrigin;
263 return VINF_SUCCESS;
264 }
265
266 /* NEEDS TESTING: test below with current Additions on VBox 4.1 or older. */
267 /** @todo Can we find some standard grep-able string for "NEEDS TESTING"? */
268 if (rc == VERR_NOT_IMPLEMENTED) /* Fall back to the old API. */
269 {
270 if (pfEnabled)
271 *pfEnabled = true;
272 if (pfChangeOrigin)
273 *pfChangeOrigin = false;
274 return getDisplayChangeRequest2(pcx, pcy, pcBits, piDisplay, fAck);
275 }
276 return rc;
277}
278
279
280/**
281 * Query the last display change request sent from the host to the guest.
282 *
283 * @returns iprt status value
284 * @param cDisplaysIn How many elements in the paDisplays array.
285 * @param pcDisplaysOut How many elements were returned.
286 * @param paDisplays Display information.
287 * @param fAck Whether or not to acknowledge the newest request sent by
288 * the host. If this is set, the function will return the
289 * most recent host request, otherwise it will return the
290 * last request to be acknowledged.
291 */
292VBGLR3DECL(int) VbglR3GetDisplayChangeRequestMulti(uint32_t cDisplaysIn,
293 uint32_t *pcDisplaysOut,
294 VMMDevDisplayDef *paDisplays,
295 bool fAck)
296{
297 VMMDevDisplayChangeRequestMulti *pReq;
298 size_t cbDisplays;
299 size_t cbAlloc;
300 int rc = VINF_SUCCESS;
301
302 AssertReturn(cDisplaysIn > 0 && cDisplaysIn <= 64 /* VBOX_VIDEO_MAX_SCREENS */, VERR_INVALID_PARAMETER);
303 AssertPtrReturn(pcDisplaysOut, VERR_INVALID_PARAMETER);
304 AssertPtrReturn(paDisplays, VERR_INVALID_PARAMETER);
305
306 cbDisplays = cDisplaysIn * sizeof(VMMDevDisplayDef);
307 cbAlloc = RT_UOFFSETOF(VMMDevDisplayChangeRequestMulti, aDisplays) + cbDisplays;
308 pReq = (VMMDevDisplayChangeRequestMulti *)RTMemTmpAlloc(cbAlloc);
309 AssertPtrReturn(pReq, VERR_NO_MEMORY);
310
311 memset(pReq, 0, cbAlloc);
312 rc = vmmdevInitRequest(&pReq->header, VMMDevReq_GetDisplayChangeRequestMulti);
313 AssertRCReturnStmt(rc, RTMemTmpFree(pReq), rc);
314
315 pReq->header.size += (uint32_t)cbDisplays;
316 pReq->cDisplays = cDisplaysIn;
317 if (fAck)
318 pReq->eventAck = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST;
319
320 rc = vbglR3GRPerform(&pReq->header);
321 AssertRCReturnStmt(rc, RTMemTmpFree(pReq), rc);
322
323 rc = pReq->header.rc;
324 if (RT_SUCCESS(rc))
325 {
326 memcpy(paDisplays, pReq->aDisplays, pReq->cDisplays * sizeof(VMMDevDisplayDef));
327 *pcDisplaysOut = pReq->cDisplays;
328 }
329
330 RTMemTmpFree(pReq);
331 return rc;
332}
333
334
335/**
336 * Query the host as to whether it likes a specific video mode.
337 *
338 * @returns the result of the query
339 * @param cx the width of the mode being queried
340 * @param cy the height of the mode being queried
341 * @param cBits the bpp of the mode being queried
342 */
343VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits)
344{
345 bool fRc = true; /* If for some reason we can't contact the host then
346 * we like everything. */
347 int rc;
348 VMMDevVideoModeSupportedRequest req;
349
350 vmmdevInitRequest(&req.header, VMMDevReq_VideoModeSupported);
351 req.width = cx;
352 req.height = cy;
353 req.bpp = cBits;
354 req.fSupported = true;
355 rc = vbglR3GRPerform(&req.header);
356 if (RT_SUCCESS(rc) && RT_SUCCESS(req.header.rc))
357 fRc = req.fSupported;
358 return fRc;
359}
360
361/**
362 * Get the highest screen number for which there is a saved video mode or "0"
363 * if there are no saved modes.
364 *
365 * @returns iprt status value
366 * @returns VERR_NOT_SUPPORTED if the guest property service is not available.
367 * @param pcScreen where to store the virtual screen number
368 */
369VBGLR3DECL(int) VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen)
370{
371#if defined(VBOX_WITH_GUEST_PROPS)
372 int rc;
373 HGCMCLIENTID idClient = 0;
374 PVBGLR3GUESTPROPENUM pHandle = NULL;
375 const char *pszName = NULL;
376 unsigned cHighestScreen = 0;
377
378 /* Validate input. */
379 AssertPtrReturn(pcScreen, VERR_INVALID_POINTER);
380
381 /* Query the data. */
382 rc = VbglR3GuestPropConnect(&idClient);
383 if (RT_SUCCESS(rc))
384 {
385 const char *pszPattern = VIDEO_PROP_PREFIX"*";
386 rc = VbglR3GuestPropEnum(idClient, &pszPattern, 1, &pHandle, &pszName, NULL, NULL, NULL);
387 int rc2 = VbglR3GuestPropDisconnect(idClient);
388 if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
389 rc = rc2;
390 }
391
392 /* Process the data. */
393 while (RT_SUCCESS(rc) && pszName != NULL)
394 {
395 uint32_t cScreen;
396
397 rc = RTStrToUInt32Full(pszName + sizeof(VIDEO_PROP_PREFIX) - 1, 10, &cScreen);
398 if (RT_SUCCESS(rc)) /* There may be similar properties with text. */
399 cHighestScreen = RT_MAX(cHighestScreen, cScreen);
400 rc = VbglR3GuestPropEnumNext(pHandle, &pszName, NULL, NULL, NULL);
401 }
402
403 VbglR3GuestPropEnumFree(pHandle);
404
405 /* Return result. */
406 if (RT_SUCCESS(rc))
407 *pcScreen = cHighestScreen;
408 return rc;
409#else /* !VBOX_WITH_GUEST_PROPS */
410 RT_NOREF(pcScreen);
411 return VERR_NOT_SUPPORTED;
412#endif /* !VBOX_WITH_GUEST_PROPS */
413}
414
415/**
416 * Save video mode parameters to the guest property store.
417 *
418 * @returns iprt status value
419 * @param idScreen The virtual screen number.
420 * @param cx mode width
421 * @param cy mode height
422 * @param cBits bits per pixel for the mode
423 * @param x virtual screen X offset
424 * @param y virtual screen Y offset
425 * @param fEnabled is this virtual screen enabled?
426 */
427VBGLR3DECL(int) VbglR3SaveVideoMode(unsigned idScreen, unsigned cx, unsigned cy, unsigned cBits,
428 unsigned x, unsigned y, bool fEnabled)
429{
430#ifdef VBOX_WITH_GUEST_PROPS
431 unsigned cHighestScreen = 0;
432 int rc = VbglR3VideoModeGetHighestSavedScreen(&cHighestScreen);
433 if (RT_SUCCESS(rc))
434 {
435 HGCMCLIENTID idClient = 0;
436 rc = VbglR3GuestPropConnect(&idClient);
437 if (RT_SUCCESS(rc))
438 {
439 int rc2;
440 char szModeName[GUEST_PROP_MAX_NAME_LEN];
441 char szModeParms[GUEST_PROP_MAX_VALUE_LEN];
442 RTStrPrintf(szModeName, sizeof(szModeName), VIDEO_PROP_PREFIX "%u", idScreen);
443 RTStrPrintf(szModeParms, sizeof(szModeParms), "%ux%ux%u,%ux%u,%u", cx, cy, cBits, x, y, (unsigned) fEnabled);
444
445 rc = VbglR3GuestPropWriteValue(idClient, szModeName, szModeParms);
446 /* Write out the mode using the legacy name too, in case the user
447 * re-installs older Additions. */
448 if (idScreen == 0)
449 {
450 RTStrPrintf(szModeParms, sizeof(szModeParms), "%ux%ux%u", cx, cy, cBits);
451 VbglR3GuestPropWriteValue(idClient, VIDEO_PROP_PREFIX "SavedMode", szModeParms);
452 }
453
454 rc2 = VbglR3GuestPropDisconnect(idClient);
455 if (rc != VINF_PERMISSION_DENIED)
456 {
457 if (RT_SUCCESS(rc))
458 rc = rc2;
459 if (RT_SUCCESS(rc))
460 {
461 /* Sanity check 1. We do not try to make allowance for someone else
462 * changing saved settings at the same time as us. */
463 bool fEnabled2 = false;
464 unsigned cx2 = 0;
465 unsigned cy2 = 0;
466 unsigned cBits2 = 0;
467 unsigned x2 = 0;
468 unsigned y2 = 0;
469 rc = VbglR3RetrieveVideoMode(idScreen, &cx2, &cy2, &cBits2, &x2, &y2, &fEnabled2);
470 if ( RT_SUCCESS(rc)
471 && (cx != cx2 || cy != cy2 || cBits != cBits2 || x != x2 || y != y2 || fEnabled != fEnabled2))
472 rc = VERR_WRITE_ERROR;
473 /* Sanity check 2. Same comment. */
474 else if (RT_SUCCESS(rc))
475 {
476 unsigned cHighestScreen2 = 0;
477 rc = VbglR3VideoModeGetHighestSavedScreen(&cHighestScreen2);
478 if (RT_SUCCESS(rc))
479 if (cHighestScreen2 != RT_MAX(cHighestScreen, idScreen))
480 rc = VERR_INTERNAL_ERROR;
481 }
482 }
483 }
484 }
485 }
486 return rc;
487#else /* !VBOX_WITH_GUEST_PROPS */
488 RT_NOREF(idScreen, cx, cy, cBits, x, y, fEnabled);
489 return VERR_NOT_SUPPORTED;
490#endif /* !VBOX_WITH_GUEST_PROPS */
491}
492
493
494/**
495 * Retrieve video mode parameters from the guest property store.
496 *
497 * @returns iprt status value
498 * @param idScreen The virtual screen number.
499 * @param pcx where to store the mode width
500 * @param pcy where to store the mode height
501 * @param pcBits where to store the bits per pixel for the mode
502 * @param px where to store the virtual screen X offset
503 * @param py where to store the virtual screen Y offset
504 * @param pfEnabled where to store whether this virtual screen is enabled
505 */
506VBGLR3DECL(int) VbglR3RetrieveVideoMode(unsigned idScreen,
507 unsigned *pcx, unsigned *pcy,
508 unsigned *pcBits,
509 unsigned *px, unsigned *py,
510 bool *pfEnabled)
511{
512#ifdef VBOX_WITH_GUEST_PROPS
513 /*
514 * First we retrieve the video mode which is saved as a string in the
515 * guest property store.
516 */
517 HGCMCLIENTID idClient = 0;
518 int rc = VbglR3GuestPropConnect(&idClient);
519 if (RT_SUCCESS(rc))
520 {
521 int rc2;
522 /* The buffer for VbglR3GuestPropReadValue. If this is too small then
523 * something is wrong with the data stored in the property. */
524 char szModeParms[1024];
525 char szModeName[GUEST_PROP_MAX_NAME_LEN]; /** @todo add a VbglR3GuestPropReadValueF/FV that does the RTStrPrintf for you. */
526 RTStrPrintf(szModeName, sizeof(szModeName), VIDEO_PROP_PREFIX "%u", idScreen);
527 rc = VbglR3GuestPropReadValue(idClient, szModeName, szModeParms, sizeof(szModeParms), NULL);
528 /* Try legacy single screen name. */
529 if (rc == VERR_NOT_FOUND && idScreen == 0)
530 rc = VbglR3GuestPropReadValue(idClient,
531 VIDEO_PROP_PREFIX"SavedMode",
532 szModeParms, sizeof(szModeParms),
533 NULL);
534 rc2 = VbglR3GuestPropDisconnect(idClient);
535 if (RT_SUCCESS(rc))
536 rc = rc2;
537
538 /*
539 * Now we convert the string returned to numeric values.
540 */
541 if (RT_SUCCESS(rc))
542 {
543 /* Mandatory chunk: 640x480x32 */
544 char *pszNext;
545 uint32_t cx = 0;
546 rc = VERR_PARSE_ERROR;
547 rc2 = RTStrToUInt32Ex(szModeParms, &pszNext, 10, &cx);
548 if (rc2 == VWRN_TRAILING_CHARS && *pszNext == 'x')
549 {
550 uint32_t cy = 0;
551 rc2 = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &cy);
552 if (rc2 == VWRN_TRAILING_CHARS && *pszNext == 'x')
553 {
554 uint8_t cBits = 0;
555 rc2 = RTStrToUInt8Ex(pszNext + 1, &pszNext, 10, &cBits);
556 if (rc2 == VINF_SUCCESS || rc2 == VWRN_TRAILING_CHARS)
557 {
558 /* Optional chunk: ,32x64,1 (we fail if this is partially there) */
559 uint32_t x = 0;
560 uint32_t y = 0;
561 uint8_t fEnabled = 1;
562 if (rc2 == VINF_SUCCESS)
563 rc = VINF_SUCCESS;
564 else if (*pszNext == ',')
565 {
566 rc2 = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &x);
567 if (rc2 == VWRN_TRAILING_CHARS && *pszNext == 'x')
568 {
569 rc2 = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &y);
570 if (rc2 == VWRN_TRAILING_CHARS && *pszNext == ',')
571 {
572 rc2 = RTStrToUInt8Ex(pszNext + 1, &pszNext, 10, &fEnabled);
573 if (rc2 == VINF_SUCCESS)
574 rc = VINF_SUCCESS;
575 }
576 }
577 }
578
579 /*
580 * Set result if successful.
581 */
582 if (rc == VINF_SUCCESS)
583 {
584 if (pcx)
585 *pcx = cx;
586 if (pcy)
587 *pcy = cy;
588 if (pcBits)
589 *pcBits = cBits;
590 if (px)
591 *px = x;
592 if (py)
593 *py = y;
594 if (pfEnabled)
595 *pfEnabled = RT_BOOL(fEnabled);
596 }
597 }
598 }
599 }
600 }
601 }
602
603 return rc;
604#else /* !VBOX_WITH_GUEST_PROPS */
605 RT_NOREF(idScreen, pcx, pcy, pcBits, px, py, pfEnabled);
606 return VERR_NOT_SUPPORTED;
607#endif /* !VBOX_WITH_GUEST_PROPS */
608}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette