Changeset 70146 in vbox for trunk/src/VBox
- Timestamp:
- Dec 15, 2017 2:06:56 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119706
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
r70133 r70146 255 255 256 256 ifeq ($(KBUILD_TARGET),win) 257 #258 # VBoxGuestInst - The installer.259 #260 #PROGRAMS += VBoxGuestInst 261 VBoxGuestInst_TEMPLATE= VBoxGuestR3Exe262 VBoxGuestInst_SOURCES= win/VBoxGuestInst.cpp257 # 258 # VBoxGuestInst - The installer. 259 # 260 PROGRAMS.win.x86 += VBoxGuestInstNT 261 VBoxGuestInstNT_TEMPLATE = VBoxGuestR3Exe 262 VBoxGuestInstNT_SOURCES = win/VBoxGuestInst.cpp 263 263 endif 264 264 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
r70128 r70146 38 38 #include <iprt/asm.h> 39 39 #include <iprt/asm-amd64-x86.h> 40 #include <iprt/dbg.h> 40 41 #include <iprt/memobj.h> 41 42 #include <iprt/spinlock.h> … … 177 178 RT_C_DECLS_BEGIN 178 179 #ifdef TARGET_NT4 180 static NTSTATUS vgdrvNt4CreateDevice(PDRIVER_OBJECT pDrvObj, PUNICODE_STRING pRegPath); 179 181 static NTSTATUS vgdrvNt4FindPciDevice(PULONG puluBusNumber, PPCI_SLOT_NUMBER puSlotNumber); 180 static NTSTATUS vgdrvNt4CreateDevice(PDRIVER_OBJECT pDrvObj, PUNICODE_STRING pRegPath); 181 #else 182 #endif 182 183 static NTSTATUS vgdrvNtNt5PlusAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj); 183 184 static NTSTATUS vgdrvNtNt5PlusPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp); 184 185 static NTSTATUS vgdrvNtNt5PlusPower(PDEVICE_OBJECT pDevObj, PIRP pIrp); 185 186 static NTSTATUS vgdrvNtNt5PlusSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp); 186 #endif187 187 static void vgdrvNtUnmapVMMDevMemory(PVBOXGUESTDEVEXTWIN pDevExt); 188 188 static NTSTATUS vgdrvNtCleanup(PDEVICE_OBJECT pDevObj); … … 229 229 /** The detected NT (windows) version. */ 230 230 VGDRVNTVER g_enmVGDrvNtVer = VGDRVNTVER_INVALID; 231 /** Pointer to the PoStartNextPowerIrp routine (in the NT kernel). 232 * Introduced in Windows 2000. */ 233 static decltype(PoStartNextPowerIrp) *g_pfnPoStartNextPowerIrp = NULL; 234 /** Pointer to the PoCallDriver routine (in the NT kernel). 235 * Introduced in Windows 2000. */ 236 static decltype(PoCallDriver) *g_pfnPoCallDriver = NULL; 231 237 232 238 … … 261 267 vgdrvNtDoTests(); 262 268 #endif 263 NTSTATUS rc = STATUS_SUCCESS;269 NTSTATUS rcNt = STATUS_SUCCESS; 264 270 switch (ulMajorVer) 265 271 { … … 328 334 else 329 335 LogRelFunc(("Unknown version %u.%u!\n", ulMajorVer, ulMinorVer)); 330 rc = STATUS_DRIVER_UNABLE_TO_LOAD;336 rcNt = STATUS_DRIVER_UNABLE_TO_LOAD; 331 337 } 332 338 break; 333 339 } 334 335 if (NT_SUCCESS(rc)) 340 if (NT_SUCCESS(rcNt)) 336 341 { 337 342 /* 338 * Setup the driver entry points in pDrvObj.343 * Dynamically resolve symbols not present in NT4. 339 344 */ 340 pDrvObj->DriverUnload = vgdrvNtUnload; 341 pDrvObj->MajorFunction[IRP_MJ_CREATE] = vgdrvNtCreate; 342 pDrvObj->MajorFunction[IRP_MJ_CLOSE] = vgdrvNtClose; 343 pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = vgdrvNtDeviceControl; 344 pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = vgdrvNtInternalIOCtl; 345 pDrvObj->MajorFunction[IRP_MJ_SHUTDOWN] = vgdrvNtShutdown; 346 pDrvObj->MajorFunction[IRP_MJ_READ] = vgdrvNtNotSupportedStub; 347 pDrvObj->MajorFunction[IRP_MJ_WRITE] = vgdrvNtNotSupportedStub; 345 int rc; 348 346 #ifdef TARGET_NT4 349 rc = vgdrvNt4CreateDevice(pDrvObj, pRegPath); 350 #else 351 pDrvObj->MajorFunction[IRP_MJ_PNP] = vgdrvNtNt5PlusPnP; 352 pDrvObj->MajorFunction[IRP_MJ_POWER] = vgdrvNtNt5PlusPower; 353 pDrvObj->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = vgdrvNtNt5PlusSystemControl; 354 pDrvObj->DriverExtension->AddDevice = (PDRIVER_ADD_DEVICE)vgdrvNtNt5PlusAddDevice; 347 if (g_enmVGDrvNtVer <= VGDRVNTVER_WINNT4) 348 rc = VINF_SUCCESS; 349 else 355 350 #endif 356 } 357 358 LogFlowFunc(("Returning %#x\n", rc)); 359 return rc; 351 { 352 RTDBGKRNLINFO hKrnlInfo; 353 rc = RTR0DbgKrnlInfoOpen(&hKrnlInfo, 0 /*fFlags*/); 354 if (RT_SUCCESS(rc)) 355 { 356 int rc1 = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, "PoCallDriver", (void **)&g_pfnPoCallDriver); 357 int rc2 = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, "PoStartNextPowerIrp", (void **)&g_pfnPoStartNextPowerIrp); 358 if (g_enmVGDrvNtVer > VGDRVNTVER_WINNT4 && RT_FAILURE(rc1)) 359 rc = rc1; 360 if (g_enmVGDrvNtVer > VGDRVNTVER_WINNT4 && RT_FAILURE(rc2)) 361 rc = rc2; 362 RTR0DbgKrnlInfoRelease(hKrnlInfo); 363 } 364 } 365 if (RT_SUCCESS(rc)) 366 { 367 /* 368 * Setup the driver entry points in pDrvObj. 369 */ 370 pDrvObj->DriverUnload = vgdrvNtUnload; 371 pDrvObj->MajorFunction[IRP_MJ_CREATE] = vgdrvNtCreate; 372 pDrvObj->MajorFunction[IRP_MJ_CLOSE] = vgdrvNtClose; 373 pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = vgdrvNtDeviceControl; 374 pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = vgdrvNtInternalIOCtl; 375 pDrvObj->MajorFunction[IRP_MJ_SHUTDOWN] = vgdrvNtShutdown; 376 pDrvObj->MajorFunction[IRP_MJ_READ] = vgdrvNtNotSupportedStub; 377 pDrvObj->MajorFunction[IRP_MJ_WRITE] = vgdrvNtNotSupportedStub; 378 #ifdef TARGET_NT4 379 if (g_enmVGDrvNtVer <= VGDRVNTVER_WINNT4) 380 rcNt = vgdrvNt4CreateDevice(pDrvObj, pRegPath); 381 else 382 #endif 383 { 384 pDrvObj->MajorFunction[IRP_MJ_PNP] = vgdrvNtNt5PlusPnP; 385 pDrvObj->MajorFunction[IRP_MJ_POWER] = vgdrvNtNt5PlusPower; 386 pDrvObj->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = vgdrvNtNt5PlusSystemControl; 387 pDrvObj->DriverExtension->AddDevice = (PDRIVER_ADD_DEVICE)vgdrvNtNt5PlusAddDevice; 388 } 389 } 390 } 391 392 LogFlowFunc(("Returning %#x\n", rcNt)); 393 return rcNt; 360 394 } 361 395 … … 518 552 if (!pIrp) 519 553 { 520 #if ARCH_BITS == 32554 #ifdef TARGET_NT4 521 555 /* 522 556 * NT4: Let's have a look at what our PCI adapter offers. … … 536 570 if (NT_SUCCESS(rcNt)) 537 571 rcNt = vgdrvNtScanPCIResourceList(pResourceList, pDevExt); 538 # else /* ARCH_BITS != 32 */ 572 # else /* !TARGET_NT4 */ 573 AssertFailed(); 539 574 RT_NOREF(pDevObj, pDrvObj, pRegPath); 540 575 rcNt = STATUS_INTERNAL_ERROR; 541 # endif /* ARCH_BITS != 32*/576 # endif /* !TARGET_NT4 */ 542 577 } 543 578 else … … 609 644 ULONG uInterruptVector = pDevExt->uInterruptVector; 610 645 KIRQL uHandlerIrql = (KIRQL)pDevExt->uInterruptLevel; 646 #ifdef TARGET_NT4 611 647 if (!pIrp) 612 648 { 613 #if ARCH_BITS == 32614 649 /* NT4: Get an interrupt vector. Only proceed if the device provides an interrupt. */ 615 650 if ( uInterruptVector … … 628 663 else 629 664 LogFunc(("Device does not provide an interrupt!\n")); 665 } 630 666 #endif 631 }632 667 if (uInterruptVector) 633 668 { … … 825 860 } 826 861 827 #e lse /* !TARGET_NT4 */862 #endif /* TARGET_NT4 */ 828 863 829 864 /** … … 877 912 * so continue to init our own things. 878 913 */ 879 # 914 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 880 915 vgdrvNtBugCheckCallback(pDevExt); /* Ignore failure! */ 881 # 916 #endif 882 917 if (NT_SUCCESS(rc)) 883 918 { … … 976 1011 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp); 977 1012 978 # 1013 #ifdef LOG_ENABLED 979 1014 static char const * const s_apszFnctName[] = 980 1015 { … … 1006 1041 Log(("vgdrvNtNt5PlusPnP: MinorFunction: %s\n", 1007 1042 pStack->MinorFunction < RT_ELEMENTS(s_apszFnctName) ? s_apszFnctName[pStack->MinorFunction] : "Unknown")); 1008 # 1043 #endif 1009 1044 1010 1045 NTSTATUS rc = STATUS_SUCCESS; … … 1088 1123 Log(("vgdrvNtNt5PlusPnP: QUERY_REMOVE_DEVICE\n")); 1089 1124 1090 # 1125 #ifdef VBOX_REBOOT_ON_UNINSTALL 1091 1126 Log(("vgdrvNtNt5PlusPnP: QUERY_REMOVE_DEVICE: Device cannot be removed without a reboot.\n")); 1092 1127 rc = STATUS_UNSUCCESSFUL; 1093 # 1128 #endif 1094 1129 1095 1130 if (NT_SUCCESS(rc)) … … 1184 1219 Log(("vgdrvNtNt5PlusPnP: QUERY_STOP_DEVICE\n")); 1185 1220 1186 # 1221 #ifdef VBOX_REBOOT_ON_UNINSTALL /** @todo r=bird: this code and log msg is pointless as rc = success and status will be overwritten below. */ 1187 1222 Log(("vgdrvNtNt5PlusPnP: QUERY_STOP_DEVICE: Device cannot be stopped without a reboot!\n")); 1188 1223 pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL; 1189 # 1224 #endif 1190 1225 1191 1226 if (NT_SUCCESS(rc)) … … 1260 1295 static NTSTATUS vgdrvNtNt5PlusPowerComplete(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp, IN PVOID pContext) 1261 1296 { 1262 # 1297 #ifdef VBOX_STRICT 1263 1298 RT_NOREF1(pDevObj); 1264 1299 PVBOXGUESTDEVEXTWIN pDevExt = (PVBOXGUESTDEVEXTWIN)pContext; … … 1293 1328 } 1294 1329 } 1295 # 1330 #else 1296 1331 RT_NOREF3(pDevObj, pIrp, pContext); 1297 # 1332 #endif 1298 1333 1299 1334 return STATUS_SUCCESS; … … 1356 1391 VMMDevReqMouseStatus *pReq = NULL; 1357 1392 int vrc = VbglR0GRAlloc((VMMDevRequestHeader **)&pReq, sizeof (VMMDevReqMouseStatus), 1358 VMMDevReq_SetMouseStatus);1393 VMMDevReq_SetMouseStatus); 1359 1394 if (RT_SUCCESS(vrc)) 1360 1395 { … … 1404 1439 1405 1440 case PowerActionHibernate: 1406 1407 1441 Log(("vgdrvNtNt5PlusPower: Power action hibernate!\n")); 1408 1442 break; … … 1439 1473 * we must call PoStartNextPowerIrp. 1440 1474 */ 1441 PoStartNextPowerIrp(pIrp);1475 g_pfnPoStartNextPowerIrp(pIrp); 1442 1476 1443 1477 /* … … 1452 1486 TRUE, 1453 1487 TRUE); 1454 return PoCallDriver(pDevExt->pNextLowerDriver, pIrp);1488 return g_pfnPoCallDriver(pDevExt->pNextLowerDriver, pIrp); 1455 1489 } 1456 1490 … … 1475 1509 } 1476 1510 1477 #endif /* !TARGET_NT4 */1478 1511 1479 1512
Note:
See TracChangeset
for help on using the changeset viewer.