Helper.cpp revision a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fc
/** @file
*
* VBoxGuest -- VirtualBox Win32 guest support driver
*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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.
*/
//#define LOG_ENABLED
#include "VBoxGuest_Internal.h"
#include "Helper.h"
#include <VBox/VBoxGuestLib.h>
#ifdef ALLOC_PRAGMA
#endif
/* CM_RESOURCE_MEMORY_* flags which were used on XP or earlier. */
#define VBOX_CM_PRE_VISTA_MASK (0x3f)
/**
* Helper to scan the PCI resource list and remember stuff.
*
* @param pResList Resource list
* @param pDevExt Device extension
*/
{
// enumerate the resource list
ULONG rangeCount = 0;
{
switch (partialData->Type)
{
case CmResourceTypePort:
{
// overflow protection
if (rangeCount < PCI_TYPE0_ADDRESSES)
{
dprintf(("I/O range: Base = %08x : %08x Length = %08x \n",
//@todo not so gut
dprintf(("I got all I want, my dear port, oh!\n"));
// save resource information
// next item
rangeCount++; baseAddress++;
}
break;
}
case CmResourceTypeInterrupt:
{
dprintf(("Interrupt: Level = %x Vector = %x Mode = %x \n",
partialData->Flags));
// save information
// check interrupt mode
{
}
else
{
}
break;
}
case CmResourceTypeMemory:
{
// overflow protection
if (rangeCount < PCI_TYPE0_ADDRESSES)
{
dprintf(("Memory range: Base = %08x : %08x Length = %08x \n",
/** @todo reconsider memory type */
{
// save resource information
// next item
rangeCount++; baseAddress++;
} else
{
}
}
break;
}
case CmResourceTypeDma:
{
dprintf(("DMA resource found. Hmm...\n"));
break;
}
default:
{
break;
}
}
}
// memorize the number of resources found
return rc;
}
{
if (pDevExt->memoryLength != 0)
{
pDevExt->pVMMDevMemory = (VMMDevMemory *)MmMapIoSpace (pDevExt->memoryAddress, pDevExt->memoryLength, MmNonCached);
if (pDevExt->pVMMDevMemory)
{
dprintf(("VBoxGuest::VBoxGuestPnp: VMMDevMemory: version = 0x%x, size = %d\n", pDevExt->pVMMDevMemory->u32Version, pDevExt->pVMMDevMemory->u32Size));
/* Check version of the structure */
{
/* Not our version, refuse operation and unmap the memory */
}
}
else
{
}
}
return rc;
}
{
if (pDevExt->pVMMDevMemory)
{
}
pDevExt->memoryLength = 0;
}
{
int rc = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo);
if (VBOX_SUCCESS(rc))
{
/* we've already determined the Windows product before */
switch (winVersion)
{
case WINNT4:
break;
case WIN2K:
break;
case WINXP:
break;
case WIN2K3:
break;
case WINVISTA:
break;
default:
/* we don't know, therefore NT family */
break;
}
/** @todo registry lookup for additional information */
{
dprintf(("VBoxGuest::hlpVBoxReportGuestInfo: error reporting guest info to VMMDev."
}
}
}