/* $Id$ */
/** @file
* VBoxGuest-win-legacy - Windows NT4 specifics.
*/
/*
* Copyright (C) 2010-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "VBoxGuest-win.h"
#include "VBoxGuestInternal.h"
#include <VBox/VBoxGuestLib.h>
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
#ifndef PCI_MAX_BUSES
#endif
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
#ifdef ALLOC_PRAGMA
#endif
/**
* Legacy helper function to create the device object.
*
* @returns NT status code.
*
* @param pDrvObj The driver object.
* @param pDevObj Unused. NULL. Dunno why it's here, makes no sense.
* @param pRegPath The driver registry path.
*/
NTSTATUS vbgdNt4CreateDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath)
{
Log(("VBoxGuest::vbgdNt4CreateDevice: pDrvObj=%p, pDevObj=%p, pRegPath=%p\n", pDrvObj, pDevObj, pRegPath));
/*
* Find our virtual PCI device
*/
{
Log(("VBoxGuest::vbgdNt4CreateDevice: Device not found!\n"));
return rc;
}
/*
* Create device.
*/
rc = IoCreateDevice(pDrvObj, sizeof(VBOXGUESTDEVEXTWIN), &szDevName, FILE_DEVICE_UNKNOWN, 0, FALSE, &pDeviceObject);
if (NT_SUCCESS(rc))
{
Log(("VBoxGuest::vbgdNt4CreateDevice: Device created\n"));
if (NT_SUCCESS(rc))
{
Log(("VBoxGuest::vbgdNt4CreateDevice: Symlink created\n"));
/*
* Setup the device extension.
*/
Log(("VBoxGuest::vbgdNt4CreateDevice: Setting up device extension ...\n"));
Log(("VBoxGuest::vbgdNt4CreateDevice: Device extension created\n"));
/* Store a reference to ourself. */
/* Store bus and slot number we've queried before. */
#endif
/* Do the actual VBox init ... */
if (NT_SUCCESS(rc))
{
if (NT_SUCCESS(rc))
{
return rc;
}
/* bail out */
}
}
else
}
else
return rc;
}
/**
* Helper function to handle the PCI device lookup.
*
* @returns NT status code.
*
* @param pulBusNumber Where to return the bus number on success.
* @param pSlotNumber Where to return the slot number on success.
*/
{
Log(("VBoxGuest::vbgdNt4FindPciDevice\n"));
SlotNumber.u.AsULONG = 0;
/* Scan each bus. */
{
/* Scan each device. */
{
/* Scan each function (not really required...). */
{
/* Have a look at what's in this slot. */
{
/* No such bus, we're done with it. */
break;
}
/* We have to proceed to the next function. */
continue;
/* Check if it's another device. */
continue;
/* Hooray, we've found it! */
Log(("VBoxGuest::vbgdNt4FindPciDevice: Device found!\n"));
return STATUS_SUCCESS;
}
}
}
return STATUS_DEVICE_DOES_NOT_EXIST;
}