儲存庫 vbox 的更動 51947
- 時間撮記:
- 2014-7-9 上午08:55:34 (10 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r51941 r51947 61 61 #define SUPDRV_NT_POOL_TAG 'xoBV' 62 62 63 /** Win32 device name for system access. */64 #define DEVICE_NAME_SYS "\\\\.\\VBoxDrv"65 63 /** NT device name for system access. */ 66 64 #define DEVICE_NAME_NT_SYS L"\\Device\\VBoxDrv" 67 /** Win Symlink name for system access. */68 #define DEVICE_NAME_DOS_SYS L"\\DosDevices\\VBoxDrv"69 70 /** Win32 device name for user access. */71 #define DEVICE_NAME_USR "\\\\.\\VBoxDrvU"72 65 /** NT device name for user access. */ 73 66 #define DEVICE_NAME_NT_USR L"\\Device\\VBoxDrvU" 74 /** Win Symlink name for user access. */75 #define DEVICE_NAME_DOS_USR L"\\DosDevices\\VBoxDrvU"76 77 67 #ifdef VBOX_WITH_HARDENING 78 /** Win32 device name for hardened stub access. */79 # define DEVICE_NAME_STUB "\\\\.\\VBoxDrvStub"80 68 /** NT device name for hardened stub access. */ 81 69 # define DEVICE_NAME_NT_STUB L"\\Device\\VBoxDrvStub" 82 ///** Win Symlink name for hardened stub access. */83 //# define DEVICE_NAME_DOS_STUB L"\\DosDevices\\VBoxDrvStub"84 70 85 71 /** Macro for checking for deflecting calls to the stub device. */ … … 370 356 if (NT_SUCCESS(rcNt)) 371 357 { 372 UNICODE_STRING DosNameSys; 373 RtlInitUnicodeString(&DosNameSys, DEVICE_NAME_DOS_SYS); 374 rcNt = IoCreateSymbolicLink(&DosNameSys, &DevName); 358 /* 359 * User device. 360 */ 361 RtlInitUnicodeString(&DevName, DEVICE_NAME_NT_USR); 362 rcNt = IoCreateDevice(pDrvObj, sizeof(SUPDRVDEVEXTUSR), &DevName, FILE_DEVICE_UNKNOWN, 0, FALSE, &g_pDevObjUsr); 375 363 if (NT_SUCCESS(rcNt)) 376 364 { 365 PSUPDRVDEVEXTUSR pDevExtUsr = (PSUPDRVDEVEXTUSR)g_pDevObjUsr->DeviceExtension; 366 pDevExtUsr->pMainDrvExt = (PSUPDRVDEVEXT)g_pDevObjSys->DeviceExtension; 367 pDevExtUsr->u32Cookie = SUPDRVDEVEXTUSR_COOKIE; 368 369 #ifdef VBOX_WITH_HARDENING 377 370 /* 378 * Userdevice.371 * Hardened stub device. 379 372 */ 380 RtlInitUnicodeString(&DevName, DEVICE_NAME_NT_ USR);381 rcNt = IoCreateDevice(pDrvObj, sizeof(SUPDRVDEVEXT USR), &DevName, FILE_DEVICE_UNKNOWN, 0, FALSE, &g_pDevObjUsr);373 RtlInitUnicodeString(&DevName, DEVICE_NAME_NT_STUB); 374 rcNt = IoCreateDevice(pDrvObj, sizeof(SUPDRVDEVEXTSTUB), &DevName, FILE_DEVICE_UNKNOWN, 0, FALSE, &g_pDevObjStub); 382 375 if (NT_SUCCESS(rcNt)) 383 376 { 384 UNICODE_STRING DosNameUsr;385 RtlInitUnicodeString(&DosNameUsr, DEVICE_NAME_DOS_USR);386 rcNt = IoCreateSymbolicLink(&DosNameUsr, &DevName);387 377 if (NT_SUCCESS(rcNt)) 388 378 { 389 PSUPDRVDEVEXTUSR pDevExtUsr = (PSUPDRVDEVEXTUSR)g_pDevObjUsr->DeviceExtension; 390 pDevExtUsr->pMainDrvExt = (PSUPDRVDEVEXT)g_pDevObjSys->DeviceExtension; 391 pDevExtUsr->u32Cookie = SUPDRVDEVEXTUSR_COOKIE; 392 379 PSUPDRVDEVEXTSTUB pDevExtStub = (PSUPDRVDEVEXTSTUB)g_pDevObjStub->DeviceExtension; 380 pDevExtStub->Common.pMainDrvExt = (PSUPDRVDEVEXT)g_pDevObjSys->DeviceExtension; 381 pDevExtStub->Common.u32Cookie = SUPDRVDEVEXTSTUB_COOKIE; 382 #endif 383 384 /* Done. */ 385 return rcNt; 393 386 #ifdef VBOX_WITH_HARDENING 394 /* 395 * Hardened stub device. 396 */ 397 RtlInitUnicodeString(&DevName, DEVICE_NAME_NT_STUB); 398 rcNt = IoCreateDevice(pDrvObj, sizeof(SUPDRVDEVEXTSTUB), &DevName, FILE_DEVICE_UNKNOWN, 0, FALSE, &g_pDevObjStub); 399 if (NT_SUCCESS(rcNt)) 400 { 401 //UNICODE_STRING DosNameStub; 402 //RtlInitUnicodeString(&DosNameStub, DEVICE_NAME_DOS_STUB); 403 //rcNt = IoCreateSymbolicLink(&DosNameStub, &DevName); 404 if (NT_SUCCESS(rcNt)) 405 { 406 PSUPDRVDEVEXTSTUB pDevExtStub = (PSUPDRVDEVEXTSTUB)g_pDevObjStub->DeviceExtension; 407 pDevExtStub->Common.pMainDrvExt = (PSUPDRVDEVEXT)g_pDevObjSys->DeviceExtension; 408 pDevExtStub->Common.u32Cookie = SUPDRVDEVEXTSTUB_COOKIE; 387 } 388 389 /* Bail out. */ 390 IoDeleteDevice(g_pDevObjStub); 391 g_pDevObjUsr = NULL; 392 } 409 393 #endif 410 411 /* Done. */ 412 return rcNt; 413 #ifdef VBOX_WITH_HARDENING 414 } 415 416 /* Bail out. */ 417 IoDeleteDevice(g_pDevObjStub); 418 g_pDevObjUsr = NULL; 419 } 420 IoDeleteSymbolicLink(&DosNameUsr); 421 #endif 422 } 423 IoDeleteDevice(g_pDevObjUsr); 424 g_pDevObjUsr = NULL; 425 } 426 IoDeleteSymbolicLink(&DosNameSys); 394 IoDeleteDevice(g_pDevObjUsr); 395 g_pDevObjUsr = NULL; 427 396 } 428 397 IoDeleteDevice(g_pDevObjSys); … … 437 406 static void vboxdrvNtDestroyDevices(void) 438 407 { 439 UNICODE_STRING DosName;440 RtlInitUnicodeString(&DosName, DEVICE_NAME_DOS_SYS);441 NTSTATUS rcNt = IoDeleteSymbolicLink(&DosName);442 443 RtlInitUnicodeString(&DosName, DEVICE_NAME_DOS_USR);444 rcNt = IoDeleteSymbolicLink(&DosName);445 446 #ifdef VBOX_WITH_HARDENING447 //RtlInitUnicodeString(&DosName, DEVICE_NAME_DOS_STUB);448 //rcNt = IoDeleteSymbolicLink(&DosName);449 #endif450 451 408 if (g_pDevObjUsr) 452 409 {
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器