Implement DICS_FLAG_CONFIGSPECIFIC and DIREG_DEV cases in SetupDiCreateDevRegKeyW
[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 #include <wchar.h>
27
28 #define WIN32_NO_STATUS
29 #include <windows.h>
30 #include <cfgmgr32.h>
31 #include <fdi.h>
32 #include <regstr.h>
33 #include <setupapi.h>
34 #include <shlobj.h>
35 #include <wine/debug.h>
36 #include <wine/unicode.h>
37 #define NTOS_MODE_USER
38 #include <ndk/ntndk.h>
39
40 #include <pnp_c.h>
41 #include "rpc_private.h"
42 #include "resource.h"
43
44 #define SETUP_DEV_INFO_SET_MAGIC 0xd00ff057
45 #define SETUP_CLASS_IMAGE_LIST_MAGIC 0xd00ff058
46
47 struct DeviceInterface /* Element of DeviceInfoElement.InterfaceListHead */
48 {
49 LIST_ENTRY ListEntry;
50
51 struct DeviceInfoElement* DeviceInfo;
52 GUID InterfaceClassGuid;
53
54
55 /* SPINT_ACTIVE : the interface is active/enabled
56 * SPINT_DEFAULT: the interface is the default interface for the device class FIXME???
57 * SPINT_REMOVED: the interface is removed
58 */
59 DWORD Flags;
60
61 WCHAR SymbolicLink[ANYSIZE_ARRAY]; /* \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
62 };
63
64 /* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it
65 * has been already loaded once. Keep also a reference counter */
66 struct InfFileDetails
67 {
68 HINF hInf;
69 LONG References;
70
71 /* May contain no directory if the file is already in %SYSTEMROOT%\Inf */
72 WCHAR FullInfFileName[ANYSIZE_ARRAY];
73 };
74
75 struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfoElement.DriverListHead */
76 {
77 LIST_ENTRY ListEntry;
78
79 DWORD DriverRank;
80 ULARGE_INTEGER DriverDate;
81 SP_DRVINFO_DATA_V2_W Info;
82 SP_DRVINFO_DETAIL_DATA_W Details;
83 GUID ClassGuid;
84 LPWSTR MatchingId;
85 struct InfFileDetails *InfFileDetails;
86 };
87
88 struct ClassInstallParams
89 {
90 PSP_PROPCHANGE_PARAMS PropChange;
91 };
92
93 struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */
94 {
95 LIST_ENTRY ListEntry;
96 DEVINST dnDevInst; /* Used in CM_* functions */
97
98 /* Reserved Field points to a struct DriverInfoElement */
99 SP_DEVINSTALL_PARAMS_W InstallParams;
100
101 /* Information about devnode:
102 * - DeviceName:
103 * "Root\*PNP0501" for example.
104 * It doesn't contain the unique ID for the device
105 * (points into the Data field at the end of the structure)
106 * WARNING: no NULL char exist between DeviceName and UniqueId
107 * in Data field!
108 * - UniqueId
109 * "5&1be2108e&0" or "0000"
110 * If DICD_GENERATE_ID is specified in creation flags,
111 * this unique ID is autogenerated using 4 digits, base 10
112 * (points into the Data field at the end of the structure)
113 * - DeviceDescription
114 * String which identifies the device. Can be NULL. If not NULL,
115 * points into the Data field at the end of the structure
116 * - ClassGuid
117 * Identifies the class of this device. It is GUID_NULL if the
118 * device has not been installed
119 * - CreationFlags
120 * Is a combination of:
121 * - DICD_GENERATE_ID
122 * the unique ID needs to be generated
123 * - DICD_INHERIT_CLASSDRVS
124 * inherit driver of the device info set (== same pointer)
125 */
126 PCWSTR DeviceName;
127 PCWSTR UniqueId;
128 PCWSTR DeviceDescription;
129 GUID ClassGuid;
130 DWORD CreationFlags;
131
132 /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */
133 /* If the driver is not searched/detected, this list is empty */
134 LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */
135
136 /* List of interfaces implemented by this device */
137 LIST_ENTRY InterfaceListHead; /* List of struct DeviceInterface */
138
139 /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
140 struct ClassInstallParams ClassInstallParams;
141
142 WCHAR Data[ANYSIZE_ARRAY];
143 };
144
145 struct DeviceInfoSet /* HDEVINFO */
146 {
147 DWORD magic; /* SETUP_DEV_INFO_SET_MAGIC */
148 GUID ClassGuid; /* If != GUID_NULL, only devices of this class can be in the device info set */
149 HKEY HKLM; /* Local or distant HKEY_LOCAL_MACHINE registry key */
150 HMACHINE hMachine; /* Used in CM_* functions */
151
152 /* Reserved Field points to a struct DriverInfoElement */
153 SP_DEVINSTALL_PARAMS_W InstallParams;
154
155 /* If the driver is not searched/detected, this list is empty */
156 LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */
157
158 LIST_ENTRY ListHead; /* List of struct DeviceInfoElement */
159
160 /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
161 struct ClassInstallParams ClassInstallParams;
162
163 /* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
164 * or NULL if related to local machine. Points into szData field at the
165 * end of the structure */
166 PCWSTR MachineName;
167 WCHAR szData[ANYSIZE_ARRAY];
168 };
169
170 struct ClassImageList
171 {
172 DWORD magic; /* SETUP_CLASS_IMAGE_LIST_MAGIC */
173
174 /* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
175 * or NULL if related to local machine. Points into szData field at the
176 * end of the structure */
177 PCWSTR MachineName;
178 WCHAR szData[ANYSIZE_ARRAY];
179 };
180
181 extern HINSTANCE hInstance;
182 #define RC_STRING_MAX_SIZE 256
183
184 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
185 #define REGPART_RENAME "\\Rename"
186 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
187
188 /* string substitutions */
189
190 struct inf_file;
191 extern const WCHAR *DIRID_get_string( HINF hinf, int dirid );
192 extern unsigned int PARSER_string_substA( struct inf_file *file, const WCHAR *text,
193 char *buffer, unsigned int size );
194 extern unsigned int PARSER_string_substW( struct inf_file *file, const WCHAR *text,
195 WCHAR *buffer, unsigned int size );
196 extern const WCHAR *PARSER_get_src_root( HINF hinf );
197 extern WCHAR *PARSER_get_dest_dir( INFCONTEXT *context );
198
199 /* support for Ascii queue callback functions */
200
201 struct callback_WtoA_context
202 {
203 void *orig_context;
204 PSP_FILE_CALLBACK_A orig_handler;
205 };
206
207 UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, UINT_PTR, UINT_PTR );
208
209 /* from msvcrt/sys/stat.h */
210 #define _S_IWRITE 0x0080
211 #define _S_IREAD 0x0100
212
213 extern HINSTANCE hInstance;
214 extern OSVERSIONINFOW OsVersionInfo;
215
216 DWORD WINAPI CaptureAndConvertAnsiArg(LPCSTR pSrc, LPWSTR *pDst);
217
218 #endif /* __SETUPAPI_PRIVATE_H */