VirtualBox

Ignore:
Timestamp:
Sep 14, 2010 11:35:57 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65848
Message:

VBoxGuest/win: Fixes for NT4 boot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp

    r32322 r32474  
    4141*******************************************************************************/
    4242RT_C_DECLS_BEGIN
     43NTSTATUS vboxguestwinnt4CreateDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath);
    4344static NTSTATUS vboxguestwinnt4FindPCIDevice(PULONG pBusNumber, PPCI_SLOT_NUMBER pSlotNumber);
    44 static void     vboxguestwinnt4FreeDeviceResources(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj);
    4545RT_C_DECLS_END
    4646
     
    4848#pragma alloc_text (INIT, vboxguestwinnt4CreateDevice)
    4949#pragma alloc_text (INIT, vboxguestwinnt4FindPCIDevice)
    50 #pragma alloc_text (INIT, vboxguestwinnt4FreeDeviceResources)
    5150#endif
    5251
    5352
    5453/**
    55  * Helper function to create the device object
    56  *
    57  * @returns NT status code
    58  * @param
     54 * Legacy helper function to create the device object.
     55 *
     56 * @returns NT status code.
     57 *
     58 * @param pDrvObj
     59 * @param pDevObj
     60 * @param pRegPath
    5961 */
    6062NTSTATUS vboxguestwinnt4CreateDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath)
     
    6365    NTSTATUS rc = STATUS_SUCCESS;
    6466
    65     Log(("VBoxGuest::vboxguestwinnt4CreateDevice: pDrvObj=%x, pDevObj=%x, pRegPath=%x\n",
     67    Log(("VBoxGuest::vboxguestwinnt4CreateDevice: pDrvObj=%p, pDevObj=%p, pRegPath=%p\n",
    6668         pDrvObj, pDevObj, pRegPath));
    6769
     
    7476        Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Device not found!\n"));
    7577
     78    bool fSymbolicLinkCreated = false;
     79    UNICODE_STRING szDosName;
    7680    PDEVICE_OBJECT pDeviceObject = NULL;
    7781    if (NT_SUCCESS(rc))
     
    8791            Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Device created\n"));
    8892
    89             UNICODE_STRING DosName;
    90             RtlInitUnicodeString(&DosName, VBOXGUEST_DEVICE_NAME_DOS);
    91             rc = IoCreateSymbolicLink(&DosName, &szDevName);
    92             if (NT_ERROR(rc))
     93            RtlInitUnicodeString(&szDosName, VBOXGUEST_DEVICE_NAME_DOS);
     94            rc = IoCreateSymbolicLink(&szDosName, &szDevName);
     95            if (NT_SUCCESS(rc))
    9396            {
     97                Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Symlink created\n"));
     98                fSymbolicLinkCreated = true;
     99            }
     100            else
    94101                Log(("VBoxGuest::vboxguestwinnt4CreateDevice: IoCreateSymbolicLink failed with rc = %#x\n", rc));
    95                 //IoDeleteDevice(pDeviceObject);
    96             }
    97             Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Symlink created\n"));
    98102        }
    99103        else
     
    110114
    111115        pDevExt = (PVBOXGUESTDEVEXT)pDeviceObject->DeviceExtension;
    112         Assert(pDevExt);
    113116        RtlZeroMemory(pDevExt, sizeof(VBOXGUESTDEVEXT));
    114117    }
    115118
    116     if (   NT_SUCCESS(rc)
    117         && pDevExt)
    118     {
     119    if (NT_SUCCESS(rc) && pDevExt)
     120    {
     121        Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Device extension created\n"));
     122
    119123        /* Store a reference to ourself. */
    120124        pDevExt->win.s.pDeviceObject = pDeviceObject;
     
    129133    }
    130134
     135    /* Do the actual VBox init ... */
    131136    if (NT_SUCCESS(rc))
    132     {
    133         rc = vboxguestwinInit(pDrvObj, pDevObj, pRegPath);
     137        rc = vboxguestwinInit(pDrvObj, pDeviceObject, pRegPath);
     138
     139    /* Clean up in case of errors. */
     140    if (NT_ERROR(rc))
     141    {
     142        if (fSymbolicLinkCreated && szDosName.Length > 0)
     143            IoDeleteSymbolicLink(&szDosName);
     144        if (pDeviceObject)
     145            IoDeleteDevice(pDeviceObject);
    134146    }
    135147
     
    140152
    141153/**
    142  * Helper function to handle the PCI device lookup
    143  *
    144  * @returns NT error codes
     154 * Helper function to handle the PCI device lookup.
     155 *
     156 * @returns NT status code.
     157 *
     158 * @param pBusNumber
     159 * @param pSlotNumber
     160 *
    145161 */
    146162static NTSTATUS vboxguestwinnt4FindPCIDevice(PULONG pBusNumber, PPCI_SLOT_NUMBER pSlotNumber)
Note: See TracChangeset for help on using the changeset viewer.

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