summaryrefslogtreecommitdiffstats
path: root/private/ntos/inc/pnp.h
blob: 956af84a29a80f2de118060ff77e9be835d16f61 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/*++ BUILD Version: 0001    // Increment this if a change has global effects

Copyright (c) 1995  Microsoft Corporation

Module Name:

    pnp.h

Abstract:

    This module contains the internal structure definitions and APIs used by
    the kernel-mode Plug and Play manager.

    This file is included by including "ntos.h".

Author:

    Lonny McMichael (lonnym) 02/09/95


Revision History:


--*/

#ifndef _PNP_
#define _PNP_

//
// The following global variables provide/control access to PnP Manager data.
//
// NOTE: If both registry AND bus list resources are required, then the
// bus list resource (PpBusResource) must be acquired FIRST.
//

extern ERESOURCE  PpRegistryDeviceResource;

// begin_ntddk begin_nthal begin_ntifs

//
// Define Device Instance Flags (used by IoQueryDeviceConfiguration apis)
//

#define DEVINSTANCE_FLAG_HWPROFILE_DISABLED 0x1
#define DEVINSTANCE_FLAG_PNP_ENUMERATED 0x2

//
// The following definitions are used in IoOpenDeviceInstanceKey
//

#define PLUGPLAY_REGKEY_DEVICE  1
#define PLUGPLAY_REGKEY_DRIVER  2
#define PLUGPLAY_REGKEY_CURRENT_HWPROFILE 4

// end_ntddk end_nthal end_ntifs

#if _PNP_POWER_

//
// The following global variables provide/control access to PnP Manager data.
//
// NOTE: If both registry AND bus list resources are required, then the
// bus list resource (PpBusResource) must be acquired FIRST.
//
extern LIST_ENTRY PpBusListHead;
extern ERESOURCE  PpBusResource;
extern ERESOURCE  PpRegistryDeviceResource;

//
// Define PnP Manager bus instance full descriptor node that contains all necessary
// information about a particular bus instance.
//

typedef struct _PLUGPLAY_BUS_INSTANCE_FULL_DESCRIPTOR {
    PLUGPLAY_BUS_INSTANCE BusInstanceInformation;
    BUS_DATA_TYPE AssociatedConfigurationSpace;
    UNICODE_STRING DeviceInstancePath;
    ULONG ServiceInstanceOrdinal;
    BOOLEAN RootBus;
    BOOLEAN Processed;
    LIST_ENTRY BusInstanceListEntry;
} PLUGPLAY_BUS_INSTANCE_FULL_DESCRIPTOR, *PPLUGPLAY_BUS_INSTANCE_FULL_DESCRIPTOR;

//
// Define PnP Manager bus type node that contains all necessary information about
// a particular bus enumerator, including a list of all bus instances of that type.
//

typedef struct _PLUGPLAY_BUS_ENUMERATOR {
    UNICODE_STRING ServiceName;
    LIST_ENTRY BusInstanceListEntry;
    LIST_ENTRY BusEnumeratorListEntry;
    PUNICODE_STRING PlugPlayIDs;
    ULONG PlugPlayIDCount;
    UNICODE_STRING DriverName;
} PLUGPLAY_BUS_ENUMERATOR, *PPLUGPLAY_BUS_ENUMERATOR;

#endif // _PNP_POWER_

// begin_ntddk begin_nthal begin_ntifs

#if _PNP_POWER_STUB_ENABLED_

#define MAX_CLASS_NAME_LEN 32       // defined by WIndows 95 in inc16\setupx.h

//
// Define Device Status for IoReportDeviceStatus
// 0 - 0x7fffffff are for private use and 0x80000000 -
// 0xffffffff are reserved for system.
//

#define DEVICE_STATUS_OK            0x80000000
#define DEVICE_STATUS_MALFUNCTIONED 0x80000001
#define DEVICE_STATUS_REMOVED       0x80000002
#define DEVICE_STATUS_DISABLED      0x80000003

//
// Define PnP Device Property for IoGet/SetDeviceProperty
//

typedef enum {
   DeviceDescription,
   Configuration,
   ConfigurationVector,
   ClassGuid,
   FriendlyName
} DEVICE_REGISTRY_PROPERTY;

//
// Defines PnP notification event category
//

typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
    EventCategoryHardwareProfileChange,
    EventCategoryDeviceArrival,
    EventCategoryDeviceRemoval
} IO_NOTIFICATION_EVENT_CATEGORY;

//
// Defines PnP notification event ids
//

typedef enum _IO_NOTIFICATION_EVENT_ID {
    QueryHardwareProfileChange,
    HardwareProfileChanged,
    HardwareProfileChangeCancelled,
    DeviceArrival,
    DeviceQueryRemove,
    DeviceQueryRemoveFailed,
    DeviceRemoveComplete
} IO_NOTIFICATION_EVENT_ID;

typedef
NTSTATUS
(*PDRIVER_NOTIFICATION_ENTRY) (
    IN PVOID Context,
    IN IO_NOTIFICATION_EVENT_ID EventId,
    IN PVOID NotificationStructure
    );

//
// The following definitions are used in IoQuerySystemInformation
//

#define OS_WINDOWS_NT 0x0001
#define OS_WINDOWS_9X 0x0002

typedef struct _IO_SYSTEM_INFORMATION {
    USHORT Size;
    USHORT OS;
    USHORT OSVersion;
    USHORT NumberProcessors;
    USHORT ProcessorArchitecture;
    USHORT ProcessorLevel;
} IO_SYSTEM_INFORMATION, *PIO_SYSTEM_INFORMATION;

#endif // _PNP_POWER_STUB_ENABLED_

// end_ntddk end_nthal end_ntifs

NTKERNELAPI
BOOLEAN
PpInitSystem (
    VOID
    );

NTKERNELAPI
NTSTATUS
PpEnumerateBus(
    IN PPLUGPLAY_BUS_INSTANCE BusInstance OPTIONAL,
    IN PUNICODE_STRING BusDeviceInstanceName OPTIONAL
    );

NTKERNELAPI
NTSTATUS
PpDeviceRegistration(
    IN PUNICODE_STRING DeviceInstancePath,
    IN BOOLEAN Add
    );

#if _PNP_POWER_

NTKERNELAPI
NTSTATUS
PpPerformFullEnumeration(
    IN BOOLEAN DetectRootBuses
    );

#endif // _PNP_POWER_

// begin_nthal

#if _PNP_POWER_

struct _HAL_BUS_INFORMATION;

#endif

// end_nthal

// begin_ntddk begin_nthal begin_ntifs

NTKERNELAPI
NTSTATUS
IoQueryDeviceEnumInfo(
    IN PUNICODE_STRING ServiceKeyName,
    OUT PULONG Count
    );

NTKERNELAPI
NTSTATUS
IoOpenDeviceInstanceKey(
    IN PUNICODE_STRING ServiceKeyName,
    IN ULONG InstanceNumber,
    IN ULONG DevInstKeyType,
    IN ACCESS_MASK DesiredAccess,
    OUT PHANDLE DevInstRegKey
    );

#if _PNP_POWER_STUB_ENABLED_

NTSTATUS
IoQuerySystemInformation(
    IN OUT PIO_SYSTEM_INFORMATION SystemInformation
    );

NTKERNELAPI
NTSTATUS
IoRegisterPlugPlayNotification(
    IN IO_NOTIFICATION_EVENT_CATEGORY  Event,
    IN LPGUID  ResourceType            OPTIONAL,
    IN PVOID ResourceDescription       OPTIONAL,
    IN PDEVICE_OBJECT DeviceObject,
    IN PDRIVER_NOTIFICATION_ENTRY NotificationEntry,
    IN PVOID Context
    );

NTKERNELAPI
NTSTATUS
IoUnregisterPlugPlayNotification(
    IN IO_NOTIFICATION_EVENT_CATEGORY  Event,
    IN LPGUID  ResourceType            OPTIONAL,
    IN PVOID ResourceDescription       OPTIONAL,
    IN PDEVICE_OBJECT DeviceObject,
    IN PDRIVER_NOTIFICATION_ENTRY NotificationEntry
    );

NTKERNELAPI
NTSTATUS
IoGetDeviceProperty(
    IN PDEVICE_OBJECT DeviceObject,
    IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
    IN ULONG BufferLength,
    IN PVOID PropertyBuffer,
    OUT PULONG ResultLength
    );

NTKERNELAPI
NTSTATUS
IoSetDeviceProperty(
    IN PDEVICE_OBJECT DeviceObject,
    IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
    IN PVOID PropertyBuffer,
    IN ULONG BufferLength
    );

NTKERNELAPI
NTSTATUS
IoReportDeviceStatus(
    IN PDEVICE_OBJECT DeviceObject,
    IN ULONG DeviceStatus
    );

#endif // _PNP_POWER_STUB_ENABLED_

// end_ntddk end_nthal end_ntifs

#endif // _PNP_