VirtualBox

儲存庫 vbox 的更動 51947


忽略:
時間撮記:
2014-7-9 上午08:55:34 (10 年 以前)
作者:
vboxsync
訊息:

SUPDrv-win.cpp: Drop the DOS/Windows symlinks.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r51941 r51947  
    6161#define SUPDRV_NT_POOL_TAG  'xoBV'
    6262
    63 /** Win32 device name for system access. */
    64 #define DEVICE_NAME_SYS         "\\\\.\\VBoxDrv"
    6563/** NT device name for system access. */
    6664#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"
    7265/** NT device name for user access. */
    7366#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 
    7767#ifdef VBOX_WITH_HARDENING
    78 /** Win32 device name for hardened stub access. */
    79 # define DEVICE_NAME_STUB       "\\\\.\\VBoxDrvStub"
    8068/** NT device name for hardened stub access. */
    8169# 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"
    8470
    8571/** Macro for checking for deflecting calls to the stub device. */
     
    370356    if (NT_SUCCESS(rcNt))
    371357    {
    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);
    375363        if (NT_SUCCESS(rcNt))
    376364        {
     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
    377370            /*
    378              * User device.
     371             * Hardened stub device.
    379372             */
    380             RtlInitUnicodeString(&DevName, DEVICE_NAME_NT_USR);
    381             rcNt = IoCreateDevice(pDrvObj, sizeof(SUPDRVDEVEXTUSR), &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);
    382375            if (NT_SUCCESS(rcNt))
    383376            {
    384                 UNICODE_STRING DosNameUsr;
    385                 RtlInitUnicodeString(&DosNameUsr, DEVICE_NAME_DOS_USR);
    386                 rcNt = IoCreateSymbolicLink(&DosNameUsr, &DevName);
    387377                if (NT_SUCCESS(rcNt))
    388378                {
    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;
    393386#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            }
    409393#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;
    427396        }
    428397        IoDeleteDevice(g_pDevObjSys);
     
    437406static void vboxdrvNtDestroyDevices(void)
    438407{
    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_HARDENING
    447     //RtlInitUnicodeString(&DosName, DEVICE_NAME_DOS_STUB);
    448     //rcNt = IoDeleteSymbolicLink(&DosName);
    449 #endif
    450 
    451408    if (g_pDevObjUsr)
    452409    {
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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