VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h@ 35263

Last change on this file since 35263 was 32475, checked in by vboxsync, 14 years ago

VBoxGuest/win: Not needed.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/** @file
2 *
3 * VBoxGuest - Windows specifics.
4 *
5 * Copyright (C) 2010 Oracle Corporation
6 *
7 * This file is part of VirtualBox Open Source Edition (OSE), as
8 * available from http://www.virtualbox.org. This file is free software;
9 * you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License (GPL) as published by the Free Software
11 * Foundation, in version 2 as it comes in the "COPYING" file of the
12 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14 */
15
16#ifndef ___VBoxGuest_win_h
17#define ___VBoxGuest_win_h
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22
23#include <iprt/cdefs.h>
24
25RT_C_DECLS_BEGIN
26#include <ntddk.h>
27RT_C_DECLS_END
28
29#include <iprt/spinlock.h>
30#include <iprt/memobj.h>
31
32#include <VBox/VMMDev.h>
33#include <VBox/VBoxGuest.h>
34
35
36/*******************************************************************************
37* Structures and Typedefs *
38*******************************************************************************/
39
40/** Pointer to the VBoxGuest per session data. */
41typedef struct VBOXGUESTSESSION *PVBOXGUESTSESSION;
42
43/** Possible device states for our state machine. */
44enum DEVSTATE
45{
46 STOPPED,
47 WORKING,
48 PENDINGSTOP,
49 PENDINGREMOVE,
50 SURPRISEREMOVED,
51 REMOVED
52};
53
54typedef struct VBOXGUESTWINBASEADDRESS
55{
56 /** Original device physical address. */
57 PHYSICAL_ADDRESS RangeStart;
58 /** Length of I/O or memory range. */
59 ULONG RangeLength;
60 /** Flag: Unmapped range is I/O or memory range. */
61 BOOLEAN RangeInMemory;
62 /** Mapped I/O or memory range. */
63 PVOID MappedRangeStart;
64 /** Flag: mapped range is I/O or memory range. */
65 BOOLEAN MappedRangeInMemory;
66 /** Flag: resource is mapped (i.e. MmMapIoSpace called). */
67 BOOLEAN ResourceMapped;
68} VBOXGUESTWINBASEADDRESS, *PVBOXGUESTWINBASEADDRESS;
69
70
71/** Windows-specific device extension bits. */
72typedef struct VBOXGUESTDEVEXTWIN
73{
74 /** Our functional driver object. */
75 PDEVICE_OBJECT pDeviceObject;
76 /** Top of the stack. */
77 PDEVICE_OBJECT pNextLowerDriver;
78 /** Currently active Irp. */
79 IRP *pCurrentIrp;
80 /** Interrupt object pointer. */
81 PKINTERRUPT pInterruptObject;
82
83 /** Bus number where the device is located. */
84 ULONG busNumber;
85 /** Slot number where the device is located. */
86 ULONG slotNumber;
87 /** Device interrupt level. */
88 ULONG interruptLevel;
89 /** Device interrupt vector. */
90 ULONG interruptVector;
91 /** Affinity mask. */
92 KAFFINITY interruptAffinity;
93 /** LevelSensitive or Latched. */
94 KINTERRUPT_MODE interruptMode;
95
96 /** PCI base address information. */
97 ULONG pciAddressCount;
98 VBOXGUESTWINBASEADDRESS pciBaseAddress[PCI_TYPE0_ADDRESSES];
99
100 /** Physical address and length of VMMDev memory. */
101 PHYSICAL_ADDRESS vmmDevPhysMemoryAddress;
102 ULONG vmmDevPhysMemoryLength;
103
104 /** Device state. */
105 DEVSTATE devState;
106
107 /** Last system power action set (see VBoxGuestPower). */
108 POWER_ACTION LastSystemPowerAction;
109 /** Preallocated generic request for shutdown. */
110 VMMDevPowerStateRequest *pPowerStateRequest;
111 /** Preallocated VMMDevEvents for IRQ handler. */
112 VMMDevEvents *pIrqAckEvents;
113
114 /** Pre-allocated kernel session data. This is needed
115 * for handling kernel IOCtls. */
116 PVBOXGUESTSESSION pKernelSession;
117} VBOXGUESTDEVEXTWIN, *PVBOXGUESTDEVEXTWIN;
118
119
120/*******************************************************************************
121* Defined Constants And Macros *
122*******************************************************************************/
123
124/** CM_RESOURCE_MEMORY_* flags which were used on XP or earlier. */
125#define VBOX_CM_PRE_VISTA_MASK (0x3f)
126
127/** Windows version identifier. */
128typedef enum
129{
130 WINNT4 = 1,
131 WIN2K = 2,
132 WINXP = 3,
133 WIN2K3 = 4,
134 WINVISTA = 5,
135 WIN7 = 6
136} winVersion_t;
137extern winVersion_t winVersion;
138
139
140/*******************************************************************************
141* Declared prototypes for helper routines used in both (PnP and legacy) *
142* driver versions. *
143*******************************************************************************/
144#include "VBoxGuestInternal.h"
145
146RT_C_DECLS_BEGIN
147#ifdef TARGET_NT4
148NTSTATUS vboxguestwinnt4CreateDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath);
149NTSTATUS vboxguestwinInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath);
150#else
151NTSTATUS vboxguestwinInit(PDEVICE_OBJECT pDevObj, PIRP pIrp);
152#endif
153NTSTATUS vboxguestwinCleanup(PDEVICE_OBJECT pDevObj);
154NTSTATUS vboxguestwinPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp);
155VOID vboxguestwinDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext);
156BOOLEAN vboxguestwinIsrHandler(PKINTERRUPT interrupt, PVOID serviceContext);
157NTSTATUS vboxguestwinScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt);
158NTSTATUS vboxguestwinMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength,
159 void **ppvMMIOBase, uint32_t *pcbMMIO);
160void vboxguestwinUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt);
161VBOXOSTYPE vboxguestwinVersionToOSType(winVersion_t winVer);
162NTSTATUS vboxguestwinPower(PDEVICE_OBJECT pDevObj, PIRP pIrp);
163RT_C_DECLS_END
164
165#ifdef TARGET_NT4
166/*
167 * XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist
168 * on NT4, so... The same for ExAllocatePool.
169 */
170#undef ExAllocatePool
171#undef ExFreePool
172#endif
173
174#endif /* ___VBoxGuest_win_h */
175
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use