Changeset 32187 in vbox for trunk/src/VBox/Additions/common/VBoxGuest
- Timestamp:
- Sep 2, 2010 8:34:18 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp
r32180 r32187 38 38 { 39 39 /* 40 * Important: VMMDev *awaits* a VMMDevReportGuestInfo or VMMDevReportGuestInfo2 message 41 * first in order to accept all other VMMDev messages! Otherwise you'd get 42 * a VERR_NOT_SUPPORTED error. 43 * 44 * VBox version <= 3.2: VMMDevReportGuestInfo must always come first. 40 * Allocate and fill in the two guest info reports. 45 41 */ 46 VMMDevReportGuestInfo2 *pReq = NULL;47 VMMDevReportGuestInfo *pReq3= NULL;48 int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq , sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2);42 VMMDevReportGuestInfo2 *pReqInfo2 = NULL; 43 VMMDevReportGuestInfo *pReqInfo1 = NULL; 44 int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo2, sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2); 49 45 Log(("VBoxGuestReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc)); 50 46 if (RT_SUCCESS(rc)) 51 47 { 52 pReq ->guestInfo.additionsMajor= VBOX_VERSION_MAJOR;53 pReq ->guestInfo.additionsMinor= VBOX_VERSION_MINOR;54 pReq ->guestInfo.additionsBuild= VBOX_VERSION_BUILD;55 pReq ->guestInfo.additionsRevision = VBOX_SVN_REV;56 pReq ->guestInfo.additionsFeatures = 0; /* Not (never?) used.*/57 RTStrCopy(pReq ->guestInfo.szName, sizeof(pReq->guestInfo.szName), VBOX_VERSION_STRING);58 59 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq 3, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo);48 pReqInfo2->guestInfo.additionsMajor = VBOX_VERSION_MAJOR; 49 pReqInfo2->guestInfo.additionsMinor = VBOX_VERSION_MINOR; 50 pReqInfo2->guestInfo.additionsBuild = VBOX_VERSION_BUILD; 51 pReqInfo2->guestInfo.additionsRevision = VBOX_SVN_REV; 52 pReqInfo2->guestInfo.additionsFeatures = 0; /* (no features defined yet) */ 53 RTStrCopy(pReqInfo2->guestInfo.szName, sizeof(pReqInfo2->guestInfo.szName), VBOX_VERSION_STRING); 54 55 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo1, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo); 60 56 Log(("VBoxGuestReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo completed with rc=%Rrc\n", rc)); 61 57 if (RT_SUCCESS(rc)) 62 58 { 63 pReq 3->guestInfo.interfaceVersion = VMMDEV_VERSION;64 pReq 3->guestInfo.osType= enmOSType;59 pReqInfo1->guestInfo.interfaceVersion = VMMDEV_VERSION; 60 pReqInfo1->guestInfo.osType = enmOSType; 65 61 66 rc = VbglGRPerform(&pReq->header); 62 /* 63 * There are two protocols here: 64 * 1. Info2 + Info1. Supported by >=3.2.51. 65 * 2. Info1 and optionally Info2. The old protocol. 66 * 67 * We try protocol 1 first. It will fail with VERR_NOT_SUPPORTED 68 * if not supported by the VMMDev (message ordering requirement). 69 */ 70 rc = VbglGRPerform(&pReqInfo2->header); 67 71 Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc)); 68 if ( rc == VERR_NOT_IMPLEMENTED)72 if (RT_SUCCESS(rc)) 69 73 { 70 /* Compatibility with pre VBox-3.2 hosts -- VMMDevReportGuestInfo2 not implemented. */ 71 rc = VINF_SUCCESS; 72 } 73 if (rc == VERR_NOT_SUPPORTED) 74 { 75 /* Compatibility with VBox 3.2 hosts: 76 * They rely on sending VMMDevReportGuestInfo as the very first request */ 77 rc = VbglGRPerform(&pReq3->header); 78 Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc)); 79 rc = VbglGRPerform(&pReq->header); 80 Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc)); 81 } 82 else 83 { 84 /* 85 * Hosts newer than VBox 3.2: 86 * VMMDevReportGuestInfo acts as a beacon and signals the host that all 87 * guest information is now complete. So always send this report last! 88 */ 89 rc = VbglGRPerform(&pReq3->header); 74 rc = VbglGRPerform(&pReqInfo1->header); 90 75 Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc)); 91 76 } 92 VbglGRFree(&pReq3->header); 77 else if ( rc == VERR_NOT_SUPPORTED 78 || rc == VERR_NOT_IMPLEMENTED) 79 { 80 rc = VbglGRPerform(&pReqInfo1->header); 81 Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc)); 82 if (RT_SUCCESS(rc)) 83 { 84 rc = VbglGRPerform(&pReqInfo2->header); 85 Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc)); 86 if (rc == VERR_NOT_IMPLEMENTED) 87 rc = VINF_SUCCESS; 88 } 89 } 90 VbglGRFree(&pReqInfo1->header); 93 91 } 94 VbglGRFree(&pReq ->header);92 VbglGRFree(&pReqInfo2->header); 95 93 } 96 94
Note:
See TracChangeset
for help on using the changeset viewer.