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