fec4b81543b88a191cffe7c924f53022be53a06a
[reactos.git] / reactos / lib / setupapi / setupapi_private.h
1 /*
2 * Copyright 2001 Andreas Mohr
3 * Copyright 2005 Hervé Poussineau
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 #ifndef __SETUPAPI_PRIVATE_H
21 #define __SETUPAPI_PRIVATE_H
22
23 #include <assert.h>
24 #include <fcntl.h>
25 #include <share.h>
26
27 #include <windows.h>
28 #include <cfgmgr32.h>
29 #include <fdi.h>
30 #include <setupapi.h>
31 #include <shlobj.h>
32 #include <wine/debug.h>
33 #include <wine/unicode.h>
34 #define NTOS_MODE_USER
35 #include <ndk/ntndk.h>
36
37 #include <pnp_c.h>
38 #include "rpc_private.h"
39 #include "resource.h"
40
41 #define SETUP_DEV_INFO_SET_MAGIC 0xd00ff057
42
43 struct DeviceInterface /* Element of DeviceInfoElement.InterfaceListHead */
44 {
45 LIST_ENTRY ListEntry;
46
47 struct DeviceInfoElement* DeviceInfo;
48 GUID InterfaceClassGuid;
49
50
51 /* SPINT_ACTIVE : the interface is active/enabled
52 * SPINT_DEFAULT: the interface is the default interface for the device class FIXME???
53 * SPINT_REMOVED: the interface is removed
54 */
55 DWORD Flags;
56
57 WCHAR SymbolicLink[0]; /* \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
58 };
59
60 /* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it
61 * has been already loaded once. Keep also a reference counter */
62 struct InfFileDetails
63 {
64 HINF hInf;
65 LONG References;
66
67 /* May contain no directory if the file is already in %SYSTEMROOT%\Inf */
68 WCHAR FullInfFileName[0];
69 };
70
71 struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfoElement.DriverListHead */
72 {
73 LIST_ENTRY ListEntry;
74
75 DWORD DriverRank;
76 SP_DRVINFO_DATA_V2_W Info;
77 SP_DRVINFO_DETAIL_DATA_W Details;
78 GUID ClassGuid;
79 LPWSTR MatchingId;
80 struct InfFileDetails *InfFileDetails;
81 };
82
83 struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */
84 {
85 LIST_ENTRY ListEntry;
86
87 /* Reserved Field points to a struct DriverInfoElement */
88 SP_DEVINSTALL_PARAMS_W InstallParams;
89
90 /* Information about devnode:
91 * - DeviceName:
92 * "Root\*PNP0501" for example.
93 * It doesn't contain the unique ID for the device
94 * (points into the Data field at the end of the structure)
95 * WARNING: no NULL char exist between DeviceName and UniqueId
96 * in Data field!
97 * - UniqueId
98 * "5&1be2108e&0" or "0000"
99 * If DICD_GENERATE_ID is specified in creation flags,
100 * this unique ID is autogenerated using 4 digits, base 10
101 * (points into the Data field at the end of the structure)
102 * - DeviceDescription
103 * String which identifies the device. Can be NULL. If not NULL,
104 * points into the Data field at the end of the structure
105 * - ClassGuid
106 * Identifies the class of this device. It is GUID_NULL if the
107 * device has not been installed
108 * - CreationFlags
109 * Is a combination of:
110 * - DICD_GENERATE_ID
111 * the unique ID needs to be generated
112 * - DICD_INHERIT_CLASSDRVS
113 * inherit driver of the device info set (== same pointer)
114 */
115 PCWSTR DeviceName;
116 PCWSTR UniqueId;
117 PCWSTR DeviceDescription;
118 GUID ClassGuid;
119 DWORD CreationFlags;
120
121 /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */
122 /* If the driver is not searched/detected, this list is empty */
123 LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */
124
125 /* List of interfaces implemented by this device */
126 LIST_ENTRY InterfaceListHead; /* List of struct DeviceInterface */
127
128 WCHAR Data[0];
129 };
130
131 struct DeviceInfoSet /* HDEVINFO */
132 {
133 DWORD magic; /* SETUP_DEV_INFO_SET_MAGIC */
134 GUID ClassGuid; /* If != GUID_NULL, only devices of this class can be in the device info set */
135 HKEY HKLM; /* Local or distant HKEY_LOCAL_MACHINE registry key */
136 HMACHINE hMachine; /* Used in CM_* functions */
137
138 /* Reserved Field points to a struct DriverInfoElement */
139 SP_DEVINSTALL_PARAMS_W InstallParams;
140
141 /* If the driver is not searched/detected, this list is empty */
142 LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */
143
144 LIST_ENTRY ListHead; /* List of struct DeviceInfoElement */
145 };
146
147 extern HINSTANCE hInstance;
148 #define RC_STRING_MAX_SIZE 256
149
150 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
151 #define REGPART_RENAME "\\Rename"
152 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
153
154 /* string substitutions */
155
156 struct inf_file;
157 extern const WCHAR *DIRID_get_string( HINF hinf, int dirid );
158 extern unsigned int PARSER_string_substA( struct inf_file *file, const WCHAR *text,
159 char *buffer, unsigned int size );
160 extern unsigned int PARSER_string_substW( struct inf_file *file, const WCHAR *text,
161 WCHAR *buffer, unsigned int size );
162 extern const WCHAR *PARSER_get_src_root( HINF hinf );
163 extern WCHAR *PARSER_get_dest_dir( INFCONTEXT *context );
164
165 /* support for Ascii queue callback functions */
166
167 struct callback_WtoA_context
168 {
169 void *orig_context;
170 PSP_FILE_CALLBACK_A orig_handler;
171 };
172
173 UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, UINT_PTR, UINT_PTR );
174
175 /* from msvcrt/sys/stat.h */
176 #define _S_IWRITE 0x0080
177 #define _S_IREAD 0x0100
178
179 extern HINSTANCE hInstance;
180 extern OSVERSIONINFOW OsVersionInfo;
181
182 DWORD WINAPI CaptureAndConvertAnsiArg(LPCSTR pSrc, LPWSTR *pDst);
183
184 #endif /* __SETUPAPI_PRIVATE_H */