Changeset 31364 in vbox
- Timestamp:
- Aug 4, 2010 4:44:20 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuestLib.h
r31355 r31364 379 379 380 380 DECLVBGL(int) VbglQueryVMMDevMemory (VMMDevMemory **ppVMMDevMemory); 381 DECLR0VBGL(bool) VbglR0CanUsePhysPageList(void); 381 DECLR0VBGL(bool) VbglR0CanUsePhysPageList(void); 382 383 DECLR0VBGL(int) VbglR0MiscReportGuestInfo(VBOXOSTYPE enmOSType); 382 384 383 385 #endif /* IN_RING0 && !IN_RING0_AGNOSTIC */ -
trunk/src/VBox/Additions/WINNT/VBoxGuest/Helper.cpp
r31241 r31364 191 191 } 192 192 193 /** @todo Maybe we should drop this routine entirely later because we detecting 194 * the running OS via VBoxService in ring 3 using guest properties since a while. 195 * 196 * @todo Consider of using vboxGuestInitReportGuestInfo in the ..\common\Helper.cpp 197 * module to have a common base and less redundant code. 198 */ 199 NTSTATUS hlpVBoxReportGuestInfo (PVBOXGUESTDEVEXT pDevExt) 200 { 201 VMMDevReportGuestInfo *pReq = NULL; 202 int rc = VbglGRAlloc ((VMMDevRequestHeader **)&pReq, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo); 203 dprintf(("hlpVBoxReportGuestInfo: VbglGRAlloc rc = %d\n", rc)); 204 if (RT_SUCCESS(rc)) 205 { 206 pReq->guestInfo.interfaceVersion = VMMDEV_VERSION; 207 208 /* we've already determined the Windows product before */ 209 switch (winVersion) 210 { 211 case WINNT4: 212 pReq->guestInfo.osType = VBOXOSTYPE_WinNT4; 213 break; 214 case WIN2K: 215 pReq->guestInfo.osType = VBOXOSTYPE_Win2k; 216 break; 217 case WINXP: 218 pReq->guestInfo.osType = VBOXOSTYPE_WinXP; 219 break; 220 case WIN2K3: 221 pReq->guestInfo.osType = VBOXOSTYPE_Win2k3; 222 break; 223 case WINVISTA: 224 pReq->guestInfo.osType = VBOXOSTYPE_WinVista; 225 break; 226 case WIN7: 227 pReq->guestInfo.osType = VBOXOSTYPE_Win7; 228 break; 229 default: 230 /* we don't know, therefore NT family */ 231 pReq->guestInfo.osType = VBOXOSTYPE_WinNT; 232 break; 233 } 234 235 /** @todo registry lookup for additional information */ 236 237 rc = VbglGRPerform (&pReq->header); 238 if (RT_FAILURE(rc)) 239 { 240 dprintf(("VBoxGuest::hlpVBoxReportGuestInfo: Error reporting guest info to VMMDev. " 241 "rc = %Rrc\n", rc)); 242 } 243 244 VbglGRFree (&pReq->header); 245 } 246 247 VMMDevReportGuestInfo2 *pReq2 = NULL; 248 if (RT_SUCCESS(rc)) 249 rc = VbglGRAlloc ((VMMDevRequestHeader **)&pReq2, sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2); 250 dprintf(("hlpVBoxReportGuestInfo2: VbglGRAlloc rc = %d\n", rc)); 251 252 if (RT_SUCCESS(rc)) 253 { 254 pReq2->guestInfo.additionsMajor = VBOX_VERSION_MAJOR; 255 pReq2->guestInfo.additionsMinor = VBOX_VERSION_MINOR; 256 pReq2->guestInfo.additionsBuild = VBOX_VERSION_BUILD; 257 pReq2->guestInfo.additionsRevision = VBOX_SVN_REV; 258 pReq2->guestInfo.additionsFeatures = 0; 259 RTStrCopy(pReq2->guestInfo.szName, sizeof(pReq2->guestInfo.szName), VBOX_VERSION_STRING); 260 261 rc = VbglGRPerform (&pReq2->header); 262 if (RT_FAILURE(rc)) 263 { 264 dprintf(("VBoxGuest::hlpVBoxReportGuestInfo: Error reporting guest info to VMMDev. " 265 "rc = %Rrc\n", rc)); 266 } 267 if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */ 268 rc = VINF_SUCCESS; 269 VbglGRFree (&pReq2->header); 270 } 271 272 /* 273 * Report guest status to host. Because the host set the "Guest Additions active" flag as soon 274 * as he received the VMMDevReportGuestInfo above to make sure all is compatible with older Guest 275 * Additions we now have to disable that flag again here (too early, VBoxService and friends need 276 * to start up first). 277 */ 278 VMMDevReportGuestStatus *pReq3; 279 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq3, sizeof(*pReq3), VMMDevReq_ReportGuestStatus); 280 if (RT_SUCCESS(rc)) 281 { 282 pReq3->guestStatus.facility = VBoxGuestStatusFacility_VBoxGuestDriver; 283 pReq3->guestStatus.status = VBoxGuestStatusCurrent_Active; /** @todo Are we actually *really* active at this point? */ 284 pReq3->guestStatus.flags = 0; 285 rc = VbglGRPerform(&pReq3->header); 286 if (RT_FAILURE(rc)) 287 dprintf(("VBoxGuest::hlpVBoxReportGuestInfo: Reporting guest status failed with rc=%Rrc\n", rc)); 288 if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */ 289 rc = VINF_SUCCESS; 290 VbglGRFree(&pReq3->header); 291 } 292 293 return RT_FAILURE(rc) ? STATUS_UNSUCCESSFUL : STATUS_SUCCESS; 294 } 295 193 VBOXOSTYPE hlpVBoxWinVersionToOSType (winVersion_t winVer) 194 { 195 switch (winVer) 196 { 197 case WINNT4: 198 return VBOXOSTYPE_WinNT4; 199 200 case WIN2K: 201 return VBOXOSTYPE_Win2k; 202 203 case WINXP: 204 return VBOXOSTYPE_WinXP; 205 206 case WIN2K3: 207 return VBOXOSTYPE_Win2k3; 208 209 case WINVISTA: 210 return VBOXOSTYPE_WinVista; 211 212 case WIN7: 213 return VBOXOSTYPE_Win7; 214 215 default: 216 break; 217 } 218 219 /* We don't know, therefore NT family. */ 220 return VBOXOSTYPE_WinNT; 221 } 222 -
trunk/src/VBox/Additions/WINNT/VBoxGuest/Helper.h
r28800 r31364 3 3 * VBoxGuest -- VirtualBox Win32 guest support driver 4 4 * 5 * Copyright (C) 2006-20 07Oracle Corporation5 * Copyright (C) 2006-2010 Oracle Corporation 6 6 * 7 7 * This file is part of VirtualBox Open Source Edition (OSE), as … … 44 44 45 45 /** 46 * Helper to report the guest information tohost.46 * Helper for mapping the Windows version to the OS type understood by the host. 47 47 * 48 * @ param pDevExt VMMDev device extension49 * @ return NT status code48 * @return The OS type. 49 * @param winVer Windows version to translate. 50 50 */ 51 NTSTATUS hlpVBoxReportGuestInfo (PVBOXGUESTDEVEXT pDevExt);51 VBOXOSTYPE hlpVBoxWinVersionToOSType (winVersion_t winVer); 52 52 53 53 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION -
trunk/src/VBox/Additions/WINNT/VBoxGuest/NTLegacy.cpp
r28800 r31364 54 54 { 55 55 ULONG busNumber, slotNumber; 56 int vrc = VINF_SUCCESS; 56 57 NTSTATUS rc = STATUS_SUCCESS; 57 58 … … 271 272 } 272 273 273 rc = hlpVBoxReportGuestInfo (pDevExt); 274 if (!NT_SUCCESS(rc)) 275 { 276 dprintf(("VBoxGuest::AddDevice: could not report information to host, rc = %d, exiting!\n", rc)); 274 /** @todo Cleanup on failure. */ 275 276 /** @todo Don't mix up IPRT rc and NTSTATUS rc above! */ 277 278 vrc = VBoxInitMemBalloon(pDevExt); 279 if (RT_SUCCESS(vrc)) 280 { 281 vrc = VbglR0MiscReportGuestInfo(hlpVBoxWinVersionToOSType(winVersion)); 282 if (RT_FAILURE(vrc)) 283 dprintf(("VBoxGuest::ntCreateDevice: could not report information to host, rc = %d, exiting!\n", rc)); 284 } 285 286 if ( NT_ERROR(rc) 287 || RT_FAILURE(vrc)) 288 { 277 289 freeDeviceResources(pDrvObj, pDevObj); 278 290 return STATUS_UNSUCCESSFUL; 279 291 } 280 292 281 /** @todo cleanup on failure */282 283 VBoxInitMemBalloon(pDevExt);284 285 293 // ready to rumble! 286 294 pDevExt->devState = WORKING; 287 dprintf(("returning from createDevice with rc = 0x%x\n",rc));295 dprintf(("returning from ntCreateDevice with rc = 0x%x\n, vrc = %Rrc", rc, vrc)); 288 296 return rc; 289 297 } -
trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest.cpp
r30758 r31364 774 774 #endif 775 775 776 voidVBoxInitMemBalloon(PVBOXGUESTDEVEXT pDevExt)776 int VBoxInitMemBalloon(PVBOXGUESTDEVEXT pDevExt) 777 777 { 778 778 #ifdef VBOX_WITH_MANAGEMENT … … 783 783 pDevExt->MemBalloon.paMdlMemBalloon = NULL; 784 784 785 VBoxGuestQueryMemoryBalloon(pDevExt, &dummy); 785 return VBoxGuestQueryMemoryBalloon(pDevExt, &dummy); 786 #else 787 return VINF_SUCCESS; 786 788 #endif 787 789 } -
trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuestPnP.cpp
r30201 r31364 111 111 NTSTATUS VBoxGuestPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp) 112 112 { 113 PVBOXGUESTDEVEXT 113 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension; 114 114 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp); 115 115 NTSTATUS rc = STATUS_SUCCESS; … … 208 208 if (NT_SUCCESS(rc)) 209 209 { 210 rc = hlpVBoxReportGuestInfo (pDevExt);211 if (!NT_SUCCESS(rc))212 {213 dprintf(("VBoxGuest::START_DEVICE: could not report information to host, rc = %d\n", rc));214 }215 }216 217 if (NT_SUCCESS(rc))218 {219 210 // register DPC and ISR 220 211 dprintf(("VBoxGuest::VBoxGuestPnp: initializing DPC...\n")); … … 250 241 pDevExt->HGCMWaitTimeout.QuadPart *= -10000; /* relative in 100ns units */ 251 242 252 VBoxInitMemBalloon(pDevExt); 243 int vrc = VBoxInitMemBalloon(pDevExt); 244 if (RT_SUCCESS(vrc)) 245 { 246 vrc = VbglR0MiscReportGuestInfo(hlpVBoxWinVersionToOSType(winVersion)); 247 if (RT_FAILURE(vrc)) 248 dprintf(("VBoxGuest::VBoxGuestPnp::IRP_MN_START_DEVICE: could not report information to host, rc = %d\n", rc)); 249 } 253 250 254 251 // ready to rumble! -
trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest_Internal.h
r28800 r31364 262 262 NTSTATUS createThreads(PVBOXGUESTDEVEXT pDevExt); 263 263 VOID unreserveHypervisorMemory(PVBOXGUESTDEVEXT pDevExt); 264 voidVBoxInitMemBalloon(PVBOXGUESTDEVEXT pDevExt);264 int VBoxInitMemBalloon(PVBOXGUESTDEVEXT pDevExt); 265 265 void VBoxCleanupMemBalloon(PVBOXGUESTDEVEXT pDevExt); 266 266 } -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r31241 r31364 255 255 256 256 /** 257 * Report guest information to the VMMDev.258 *259 * @returns VBox status code.260 * @param pDevExt The device extension.261 * @param enmOSType The OS type to report.262 */263 static int vboxGuestInitReportGuestInfo(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType)264 {265 /*266 * Report general info + capabilities to host.267 */268 VMMDevReportGuestInfo *pReq;269 int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_ReportGuestInfo);270 if (RT_SUCCESS(rc))271 {272 pReq->guestInfo.interfaceVersion = VMMDEV_VERSION;273 pReq->guestInfo.osType = enmOSType;274 rc = VbglGRPerform(&pReq->header);275 if (RT_FAILURE(rc))276 LogRel(("vboxGuestInitReportGuestInfo: 1st part failed with rc=%Rrc\n", rc));277 VbglGRFree(&pReq->header);278 }279 VMMDevReportGuestInfo2 *pReq2;280 if (RT_SUCCESS(rc))281 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq2, sizeof(*pReq2), VMMDevReq_ReportGuestInfo2);282 if (RT_SUCCESS(rc))283 {284 pReq2->guestInfo.additionsMajor = VBOX_VERSION_MAJOR;285 pReq2->guestInfo.additionsMinor = VBOX_VERSION_MINOR;286 pReq2->guestInfo.additionsBuild = VBOX_VERSION_BUILD;287 pReq2->guestInfo.additionsRevision = VBOX_SVN_REV;288 pReq2->guestInfo.additionsFeatures = 0;289 RTStrCopy(pReq2->guestInfo.szName, sizeof(pReq2->guestInfo.szName), VBOX_VERSION_STRING);290 rc = VbglGRPerform(&pReq2->header);291 if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */292 rc = VINF_SUCCESS;293 if (RT_FAILURE(rc))294 LogRel(("vboxGuestInitReportGuestInfo: 2nd part failed with rc=%Rrc\n", rc));295 VbglGRFree(&pReq2->header);296 }297 298 /*299 * Report guest status to host. Because the host set the "Guest Additions active" flag as soon300 * as he received the VMMDevReportGuestInfo above to make sure all is compatible with older Guest301 * Additions we now have to disable that flag again here (too early, VBoxService and friends need302 * to start up first).303 */304 VMMDevReportGuestStatus *pReq3;305 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq3, sizeof(*pReq3), VMMDevReq_ReportGuestStatus);306 if (RT_SUCCESS(rc))307 {308 pReq3->guestStatus.facility = VBoxGuestStatusFacility_VBoxGuestDriver;309 pReq3->guestStatus.status = VBoxGuestStatusCurrent_Active; /** @todo Are we actually *really* active at this point? */310 pReq3->guestStatus.flags = 0;311 rc = VbglGRPerform(&pReq3->header);312 if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */313 rc = VINF_SUCCESS;314 if (RT_FAILURE(rc))315 LogRel(("vboxGuestInitReportGuestInfo: reporting status failed with rc=%Rrc\n", rc));316 VbglGRFree(&pReq3->header);317 }318 return rc;319 }320 321 322 /**323 257 * Inflate the balloon by one chunk represented by an R0 memory object. 324 258 * … … 799 733 Assert(pDevExt->PhysIrqAckEvents != 0); 800 734 801 rc = vboxGuest InitReportGuestInfo(pDevExt, enmOSType);735 rc = vboxGuestSetFilterMask(pDevExt, fFixedEvents); 802 736 if (RT_SUCCESS(rc)) 803 737 { 804 rc = vboxGuestSetFilterMask(pDevExt, fFixedEvents); 738 /* 739 * Disable guest graphics capability by default. The guest specific 740 * graphics driver will re-enable this when it is necessary. 741 */ 742 rc = VBoxGuestSetGuestCapabilities(0, VMMDEV_GUEST_SUPPORTS_GRAPHICS); 805 743 if (RT_SUCCESS(rc)) 806 744 { 807 /* 808 * Disable guest graphics capability by default. The guest specific 809 * graphics driver will re-enable this when it is necessary. 810 */ 811 rc = VBoxGuestSetGuestCapabilities(0, VMMDEV_GUEST_SUPPORTS_GRAPHICS); 812 if (RT_SUCCESS(rc)) 813 { 814 vboxGuestInitFixateGuestMappings(pDevExt); 815 Log(("VBoxGuestInitDevExt: returns success\n")); 816 return VINF_SUCCESS; 817 } 818 819 LogRel(("VBoxGuestInitDevExt: VBoxGuestSetGuestCapabilities failed, rc=%Rrc\n", rc)); 745 vboxGuestInitFixateGuestMappings(pDevExt); 746 747 rc = VbglR0MiscReportGuestInfo(enmOSType); 748 if (RT_FAILURE(rc)) 749 LogRel(("VBoxGuestInitDevExt: VbglR0MiscReportGuestInfo failed, rc=%Rrc\n", rc)); 750 751 Log(("VBoxGuestInitDevExt: returns success\n")); 752 return VINF_SUCCESS; 820 753 } 821 else 822 LogRel(("VBoxGuestInitDevExt: vboxGuestSetFilterMaskfailed, rc=%Rrc\n", rc));754 755 LogRel(("VBoxGuestInitDevExt: VBoxGuestSetGuestCapabilities failed, rc=%Rrc\n", rc)); 823 756 } 824 757 else 825 LogRel(("VBoxGuestInitDevExt: vboxGuestInitReportGuestInfo failed, rc=%Rrc\n", rc)); 826 758 LogRel(("VBoxGuestInitDevExt: vboxGuestSetFilterMask failed, rc=%Rrc\n", rc)); 827 759 VbglGRFree((VMMDevRequestHeader *)pDevExt->pIrqAckEvents); 828 760 } -
trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
r31002 r31364 61 61 VMMDev.cpp \ 62 62 HGCM.cpp \ 63 VBoxGuestR0LibMisc.c \ 63 64 VBoxGuestR0LibSharedFolders.c \ 64 65 VbglR0CanUsePhysPageList.cpp 66 67 VBoxGuestR0LibMisc.c_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) 65 68 66 69 … … 79 82 VMMDev.cpp \ 80 83 HGCMInternal.cpp \ 81 VbglR0CanUsePhysPageList.cpp 84 VbglR0CanUsePhysPageList.cpp \ 85 VBoxGuestR0LibMisc.c 82 86 83 87 # -
trunk/src/VBox/Main/GuestImpl.cpp
r31282 r31364 1441 1441 /** 1442 1442 * Sets the general Guest Additions information like 1443 * API (interface) version and OS type. 1443 * API (interface) version and OS type. Gets called by 1444 * vmmdevUpdateGuestInfo. 1444 1445 * 1445 1446 * @param aInterfaceVersion … … 1460 1461 /* 1461 1462 * Older Additions rely on the Additions API version whether they 1462 * are assumed to be active or not. Newer additions will disable 1463 * this immediately. 1463 * are assumed to be active or not. Since newer Additions do report 1464 * the Additions version *before* calling this function (by calling 1465 * VMMDevReportGuestInfo2, VMMDevReportGuestStatus, VMMDevReportGuestInfo, 1466 * in that order) we can tell apart old and new Additions here. Old 1467 * Additions never would set VMMDevReportGuestInfo2 (which set mData.mAdditionsVersion) 1468 * so they just rely on the aInterfaceVersion string (which gets set by 1469 * VMMDevReportGuestInfo). 1470 * 1471 * So only mark the Additions as being active when we don't have the Additions 1472 * version set. 1464 1473 */ 1465 mData.mAdditionsActive = !aInterfaceVersion.isEmpty(); 1474 if (mData.mAdditionsVersion.isEmpty()) 1475 mData.mAdditionsActive = !aInterfaceVersion.isEmpty(); 1466 1476 /* 1467 1477 * Older Additions didn't have this finer grained capability bit, … … 1482 1492 /** 1483 1493 * Sets the Guest Additions version information details. 1494 * Gets called by vmmdevUpdateGuestInfo2. 1484 1495 * 1485 1496 * @param aAdditionsVersion … … 1501 1512 /** 1502 1513 * Sets the status of a certain Guest Additions facility. 1514 * Gets called by vmmdevUpdateGuestStatus. 1503 1515 * 1504 1516 * @param Facility -
trunk/src/VBox/Main/VMMDevInterface.cpp
r31241 r31364 229 229 guest->setAdditionsInfo(Bstr(), guestInfo->osType); /* Clear interface version + OS type. */ 230 230 guest->setAdditionsInfo2(Bstr(), Bstr()); /* Clear Guest Additions version. */ 231 guest->setAdditionsStatus(VBoxGuestStatusFacility_ Unknown,231 guest->setAdditionsStatus(VBoxGuestStatusFacility_All, 232 232 VBoxGuestStatusCurrent_Disabled, 233 233 0); /* Flags; not used. */ … … 269 269 270 270 /* 271 * Tell the console interface about the event 272 * so that it can notify its consumers. 271 * No need to tell the console interface about the update; 272 * vmmdevUpdateGuestInfo takes care of that when called as the 273 * last event in the chain. 273 274 */ 274 pDrv->pVMMDev->getParent()->onAdditionsStateChange();275 }276 else277 {278 /*279 * The guest additions was disabled because of a reset280 * or driver unload.281 */282 guest->setAdditionsInfo2(Bstr(), Bstr());283 pDrv->pVMMDev->getParent()->onAdditionsStateChange();284 275 } 285 276 } … … 314 305 */ 315 306 pDrv->pVMMDev->getParent()->onAdditionsStateChange(); 316 317 307 } 318 308 … … 340 330 } 341 331 } 342 343 332 344 333 /**
Note:
See TracChangeset
for help on using the changeset viewer.