VirtualBox

Changeset 51947 in vbox


Ignore:
Timestamp:
Jul 9, 2014 8:55:34 AM (10 years ago)
Author:
vboxsync
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    {
Note: See TracChangeset for help on using the changeset viewer.

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