Sample Code

Windows Driver Samples/ Toaster Sample Driver/ C++/ kmdf/ inc/ public.h/

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
/*++
Copyright (c) 1990-2000    Microsoft Corporation All Rights Reserved
 
Module Name:
 
    public.h
 
Abstract:
 
    This module contains the common declarations shared by driver
    and user applications.
 
Environment:
 
    user and kernel
 
--*/
 
//
// Define an Interface Guid for bus enumerator class.
// This GUID is used to register (IoRegisterDeviceInterface)
// an instance of an interface so that enumerator application
// can send an ioctl to the bus driver.
//
 
DEFINE_GUID (GUID_DEVINTERFACE_BUSENUM_TOASTER,
        0xD35F7840, 0x6A0C, 0x11d2, 0xB8, 0x41, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71);
//  {D35F7840-6A0C-11d2-B841-00C04FAD5171}
 
//
// Define an Interface Guid for toaster device class.
// This GUID is used to register (IoRegisterDeviceInterface)
// an instance of an interface so that user application
// can control the toaster device.
//
 
DEFINE_GUID (GUID_DEVINTERFACE_TOASTER,
        0x781EF630, 0x72B2, 0x11d2, 0xB8, 0x52, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71);
//{781EF630-72B2-11d2-B852-00C04FAD5171}
 
//
// Define a Setup Class GUID for Toaster Class. This is same
// as the TOASTSER CLASS guid in the INF files.
//
 
DEFINE_GUID (GUID_DEVCLASS_TOASTER,
        0xB85B7C50, 0x6A01, 0x11d2, 0xB8, 0x41, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71);
//{B85B7C50-6A01-11d2-B841-00C04FAD5171}
 
//
// Define a WMI GUID to get busenum info.
//
 
DEFINE_GUID (TOASTER_BUS_WMI_STD_DATA_GUID,
        0x0006A660, 0x8F12, 0x11d2, 0xB8, 0x54, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71);
//{0006A660-8F12-11d2-B854-00C04FAD5171}
 
//
// Define a WMI GUID to get toaster device info.
//
 
DEFINE_GUID (TOASTER_WMI_STD_DATA_GUID,
        0xBBA21300L, 0x6DD3, 0x11d2, 0xB8, 0x44, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71);
 
//
// Define a WMI GUID to represent device arrival notification WMIEvent class.
//
 
DEFINE_GUID (TOASTER_NOTIFY_DEVICE_ARRIVAL_EVENT,
        0x1cdaff1, 0xc901, 0x45b4, 0xb3, 0x59, 0xb5, 0x54, 0x27, 0x25, 0xe2, 0x9c);
// {01CDAFF1-C901-45b4-B359-B5542725E29C}
 
 
//
// GUID definition are required to be outside of header inclusion pragma to avoid
// error during precompiled headers.
//
 
#ifndef __PUBLIC_H
#define __PUBLIC_H
 
#define BUS_HARDWARE_IDS L"{B85B7C50-6A01-11d2-B841-00C04FAD5171}\\MsToaster\0"
#define BUS_HARDWARE_IDS_LENGTH sizeof (BUS_HARDWARE_IDS)
 
#define BUSENUM_COMPATIBLE_IDS L"{B85B7C50-6A01-11d2-B841-00C04FAD5171}\\MsCompatibleToaster\0"
#define BUSENUM_COMPATIBLE_IDS_LENGTH sizeof(BUSENUM_COMPATIBLE_IDS)
 
 
#define FILE_DEVICE_BUSENUM         FILE_DEVICE_BUS_EXTENDER
 
#define BUSENUM_IOCTL(_index_) \
    CTL_CODE (FILE_DEVICE_BUSENUM, _index_, METHOD_BUFFERED, FILE_READ_DATA)
 
#define IOCTL_BUSENUM_PLUGIN_HARDWARE               BUSENUM_IOCTL (0x0)
#define IOCTL_BUSENUM_UNPLUG_HARDWARE               BUSENUM_IOCTL (0x1)
#define IOCTL_BUSENUM_EJECT_HARDWARE                BUSENUM_IOCTL (0x2)
#define IOCTL_TOASTER_DONT_DISPLAY_IN_UI_DEVICE     BUSENUM_IOCTL (0x3)
 
//
//  Data structure used in PlugIn and UnPlug ioctls
//
 
typedef struct _BUSENUM_PLUGIN_HARDWARE
{
    //
    // sizeof (struct _BUSENUM_HARDWARE)
    //
    IN ULONG Size;
 
    //
    // Unique serial number of the device to be enumerated.
    // Enumeration will be failed if another device on the
    // bus has the same serail number.
    //
 
    IN ULONG SerialNo;
 
    //
    // An array of (zero terminated wide character strings). The array itself
    //  also null terminated (ie, MULTI_SZ)
    //
    #pragma warning(disable:4200)  // nonstandard extension used
 
    IN  WCHAR   HardwareIDs[];
 
    #pragma warning(default:4200)
 
} BUSENUM_PLUGIN_HARDWARE, *PBUSENUM_PLUGIN_HARDWARE;
 
typedef struct _BUSENUM_UNPLUG_HARDWARE
{
    //
    // sizeof (struct _REMOVE_HARDWARE)
    //
 
    IN ULONG Size;
 
    //
    // Serial number of the device to be plugged out
    //
 
    ULONG   SerialNo;
 
    ULONG Reserved[2];
 
} BUSENUM_UNPLUG_HARDWARE, *PBUSENUM_UNPLUG_HARDWARE;
 
typedef struct _BUSENUM_EJECT_HARDWARE
{
    //
    // sizeof (struct _EJECT_HARDWARE)
    //
 
    IN ULONG Size;
 
    //
    // Serial number of the device to be ejected
    //
 
    ULONG   SerialNo;
 
    ULONG Reserved[2];
 
} BUSENUM_EJECT_HARDWARE, *PBUSENUM_EJECT_HARDWARE;
 
#endif

Our Services

  • What our customers say about us?

© 2011-2025 All Rights Reserved. Joya Systems. 4425 South Mopac Building II Suite 101 Austin, TX 78735 Tel: 800-DEV-KERNEL

Privacy Policy. Terms of use. Valid XHTML & CSS