ReactOS  0.4.14-dev-606-g14ebc0b
setupapi_private.h
Go to the documentation of this file.
1 /*
2  * Copyright 2001 Andreas Mohr
3  * Copyright 2005-2006 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #ifndef __SETUPAPI_PRIVATE_H
21 #define __SETUPAPI_PRIVATE_H
22 
23 #include <wchar.h>
24 
25 #define WIN32_NO_STATUS
26 #define _INC_WINDOWS
27 #define COM_NO_WINDOWS_H
28 
29 #define COBJMACROS
30 
31 #include <windef.h>
32 #include <winbase.h>
33 #include <winuser.h>
34 #include <wingdi.h>
35 #include <winreg.h>
36 #include <winspool.h>
37 #include <wincon.h>
38 
39 #include <commdlg.h>
40 
41 #include <objbase.h>
42 #include <cfgmgr32.h>
43 #include <regstr.h>
44 #include <sddl.h>
45 #include <setupapi.h>
46 #include <softpub.h>
47 #include <mscat.h>
48 #include <lzexpand.h>
49 #include <shlobj.h>
50 #include <wine/unicode.h>
51 #define NTOS_MODE_USER
52 #include <ndk/rtlfuncs.h>
53 
54 #include <wine/debug.h>
56 
57 #ifdef __REACTOS__
58 #undef __WINESRC__
59 #endif
60 
61 #include "resource.h"
62 
63 #define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057
64 #define SETUP_CLASS_IMAGE_LIST_MAGIC 0xd00ff058
65 
66 #define CMP_MAGIC 0x01234567
67 
68 struct DeviceInterface /* Element of DeviceInfo.InterfaceListHead */
69 {
71 
72  /* Link to is parent device */
75 
76 
77  /* SPINT_ACTIVE : the interface is active/enabled
78  * SPINT_DEFAULT: the interface is the default interface for the device class
79  * SPINT_REMOVED: the interface is removed
80  */
82 
83  /* Contains the symbolic link of this interface, for example
84  * \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
86 };
87 
88 /* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it
89  * has been already loaded once. Keep also a reference counter */
91 {
92  /* Handle to the .inf file */
94  /* Reference count to this object. Once it raises 0, the .inf file is
95  * automatically closed and this memory structure is deleted */
97 
98  /* Contains the directory name of the .inf file.
99  * Points into szData at then end of the structure */
101  /* Contains the .inf file name (without directory name).
102  * Points into szData at then end of the structure */
104 
105  /* Variable size array (contains data for DirectoryName and FileName) */
107 };
108 
109 struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfo.DriverListHead */
110 {
112 
120 };
121 
123 {
126 };
127 
128 struct DeviceInfo /* Element of DeviceInfoSet.ListHead */
129 {
131  /* Used when dealing with CM_* functions */
133 
134  /* Link to parent DeviceInfoSet */
136 
137  /* Reserved Field of SP_DEVINSTALL_PARAMS_W structure
138  * points to a struct DriverInfoElement */
140 
141  /* Information about devnode:
142  * - instanceId:
143  * "Root\*PNP0501" for example.
144  * It doesn't contain the unique ID for the device
145  * (points into the Data field at the end of the structure)
146  * WARNING: no NULL char exist between instanceId and UniqueId
147  * in Data field!
148  * - UniqueId
149  * "5&1be2108e&0" or "0000"
150  * If DICD_GENERATE_ID is specified in creation flags,
151  * this unique ID is autogenerated using 4 digits, base 10
152  * (points into the Data field at the end of the structure)
153  * - DeviceDescription
154  * String which identifies the device. Can be NULL. If not NULL,
155  * points into the Data field at the end of the structure
156  * - ClassGuid
157  * Identifies the class of this device. It is GUID_NULL if the
158  * device has not been installed
159  * - CreationFlags
160  * Is a combination of:
161  * - DICD_GENERATE_ID
162  * the unique ID needs to be generated
163  * - DICD_INHERIT_CLASSDRVS
164  * inherit driver of the device info set (== same pointer)
165  */
171 
172  /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */
173  /* If the driver is not searched/detected, this list is empty */
174  LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */
175 
176  /* List of interfaces implemented by this device */
177  LIST_ENTRY InterfaceListHead; /* List of struct DeviceInterface */
178 
179  /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
181 
182  /* Device property page provider data */
185 
186  /* Variable size array (contains data for instanceId, UniqueId, DeviceDescription) */
188 };
189 
190 struct DeviceInfoSet /* HDEVINFO */
191 {
192  DWORD magic; /* SETUP_DEVICE_INFO_SET_MAGIC */
193  /* If != GUID_NULL, only devices of this class can be in the device info set */
195  /* Local or distant HKEY_LOCAL_MACHINE registry key */
197  /* Used when dealing with CM_* functions */
199 
200  /* Reserved Field points to a struct DriverInfoElement */
202 
203  /* List of struct DriverInfoElement (if no driver has been
204  * searched/detected, this list is empty) */
206 
207  /* List of struct DeviceInfo */
210 
211  /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
213 
214  /* Class property page provider data */
217 
218  /* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
219  * or NULL if related to local machine. Points into szData field at the
220  * end of the structure */
222 
223  /* Variable size array (contains data for MachineName) */
225 };
226 
228 {
229  DWORD magic; /* SETUP_CLASS_IMAGE_LIST_MAGIC */
230 
231  /* Number of GUIDs contained in Guids and IconIndexes arrays */
233  /* Array of GUIDs associated to icons of the image list. Its size
234  * is NumberOfGuids and is pointing after the end this structure */
236  /* Array of corresponding icons index in the image list. Its size
237  * is NumberOfGuids and is pointing after the end this structure */
239 };
240 
241 struct FileLog /* HSPFILELOG */
242 {
246 };
247 
248 extern HINSTANCE hInstance;
250 
251 /*
252  * See: https://msdn.microsoft.com/en-us/library/bb432397(v=vs.85).aspx
253  * for more information.
254  */
255 extern DWORD GlobalSetupFlags;
256 #define PSPGF_NO_BACKUP 0x0002
257 #define PSPGF_NONINTERACTIVE 0x0004
258 
259 #define RC_STRING_MAX_SIZE 256
260 
261 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
262 #define REGPART_RENAME "\\Rename"
263 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
264 
265 inline static WCHAR *strdupAtoW( const char *str )
266 {
267  WCHAR *ret = NULL;
268  if (str)
269  {
270  DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
271  if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
272  MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
273  }
274  return ret;
275 }
276 
277 /* string substitutions */
278 
279 struct inf_file;
280 extern const WCHAR *DIRID_get_string( int dirid );
281 extern const WCHAR *PARSER_get_inf_filename( HINF hinf ) DECLSPEC_HIDDEN;
284 
285 /* support for Ascii queue callback functions */
286 
288 {
291 };
292 
294 
295 /* from msvcrt/sys/stat.h */
296 #define _S_IWRITE 0x0080
297 #define _S_IREAD 0x0100
298 
299 /* devinst.c */
300 
301 BOOL
303  IN struct DeviceInfoSet *list,
304  IN LPCWSTR InstancePath,
305  IN LPCGUID pClassGuid,
306  OUT struct DeviceInfo **pDeviceInfo);
307 
308 LONG
310  IN OUT struct DeviceInfoSet *list,
313  IN PCWSTR Enumerator OPTIONAL);
314 
315 HKEY SETUPDI_CreateDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired);
316 HKEY SETUPDI_CreateDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, UUID *ClassGuid, REGSAM samDesired);
317 HKEY SETUPDI_OpenDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired);
318 HKEY SETUPDI_OpenDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired);
319 
320 /* driver.c */
321 
322 struct InfFileDetails *
324  IN LPCWSTR FullInfFileName);
325 
326 VOID
327 DereferenceInfFile(struct InfFileDetails* infFile);
328 
329 BOOL
330 DestroyDriverInfoElement(struct DriverInfoElement* driverInfo);
331 
332 /* install.c */
333 
334 BOOL
336 
337 /* interface.c */
338 
339 BOOL
341  struct DeviceInterface* deviceInterface);
342 
343 LONG
345  struct DeviceInfoSet *list,
348  PCWSTR DeviceInstanceW /* OPTIONAL */,
349  BOOL OnlyPresentInterfaces);
350 
351 /* misc.c */
352 
353 DWORD
355  IN PWSTR InstallerName,
356  OUT HMODULE* ModulePointer,
357  OUT PVOID* FunctionPointer);
358 
359 DWORD
361  IN HMODULE ModulePointer,
362  IN PVOID FunctionPointer);
363 
364 DWORD
365 WINAPI
366 pSetupStringFromGuid(LPGUID lpGUID, PWSTR pString, DWORD dwStringLen);
367 
369 
370 VOID WINAPI MyFree(LPVOID lpMem);
375 LPWSTR WINAPI MultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage);
376 LPSTR WINAPI UnicodeToMultiByte(LPCWSTR lpUnicodeStr, UINT uCodePage);
377 
378 /* parser.c */
379 
380 typedef BOOL (*FIND_CALLBACK)(LPCWSTR SectionName, PVOID Context);
382 
383 #endif /* __SETUPAPI_PRIVATE_H */
HKEY SETUPDI_OpenDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5842
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
PSP_FILE_CALLBACK_A orig_handler
HKEY SETUPDI_CreateDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5656
SP_DRVINSTALL_PARAMS Params
static PMEMKEY RootKey
Definition: registry.c:55
const WCHAR * DIRID_get_string(int dirid)
Definition: dirid.c:159
LIST_ENTRY ListHead
BOOL WINAPI IsUserAdmin(VOID)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HKEY SETUPDI_OpenDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5826
DWORD GlobalSetupFlags
Definition: misc.c:845
Definition: http.c:7098
#define ANYSIZE_ARRAY
Definition: typedefs.h:45
DWORD WINAPI pSetupStringFromGuid(LPGUID lpGUID, PWSTR pString, DWORD dwStringLen)
Definition: misc.c:1775
DWORD ReadOnly
LPWSTR WINAPI MultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
uint16_t * PWSTR
Definition: typedefs.h:54
#define CP_ACP
Definition: compat.h:99
WINE_DEFAULT_DEBUG_CHANNEL(setupapi)
BOOL(* FIND_CALLBACK)(LPCWSTR SectionName, PVOID Context)
DWORD FreeFunctionPointer(IN HMODULE ModulePointer, IN PVOID FunctionPointer)
Definition: misc.c:105
#define CALLBACK
Definition: compat.h:27
LIST_ENTRY InterfaceListHead
WCHAR * PARSER_get_src_root(HINF hinf) DECLSPEC_HIDDEN
Definition: parser.c:1096
struct DeviceInfo * DeviceInfo
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
UINT(CALLBACK * PSP_FILE_CALLBACK_A)(PVOID, UINT, UINT_PTR, UINT_PTR)
Definition: setupapi.h:871
static WCHAR * strdupAtoW(const char *str)
HMODULE hmodClassPropPageProvider
SP_DEVINSTALL_PARAMS_W InstallParams
SP_DEVINSTALL_PARAMS_W InstallParams
char * LPSTR
Definition: xmlstorage.h:182
#define BOOL
Definition: nt_native.h:43
int32_t INT
Definition: typedefs.h:56
struct InfFileDetails * CreateInfFileDetails(IN LPCWSTR FullInfFileName)
Definition: driver.c:55
struct InfFileDetails * InfFileDetails
HKEY SETUPDI_CreateDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, UUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:5672
LPWSTR LogName
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
PVOID pClassPropPageProvider
DWORD SystemLog
BOOL GetStringField(PINFCONTEXT context, DWORD index, PWSTR *value)
Definition: install.c:1700
SP_DRVINFO_DATA_V2_W Info
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE hInstance
Definition: charmap.c:20
PCWSTR DeviceDescription
PVOID pDevicePropPageProvider
GLuint index
Definition: glext.h:6031
HMODULE hmodDevicePropPageProvider
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL EnumerateSectionsStartingWith(HINF hInf, LPCWSTR pStr, FIND_CALLBACK Callback, PVOID Context)
UINT CALLBACK QUEUE_callback_WtoA(void *context, UINT notification, UINT_PTR, UINT_PTR)
Definition: queue.c:187
struct DeviceInfoSet * set
PSP_ADDPROPERTYPAGE_DATA AddPropertyPageData
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL DestroyDriverInfoElement(struct DriverInfoElement *driverInfo)
Definition: driver.c:94
OSVERSIONINFOEXW OsVersionInfo
Definition: setupcab.c:33
DWORD GetFunctionPointer(IN PWSTR InstallerName, OUT HMODULE *ModulePointer, OUT PVOID *FunctionPointer)
Definition: misc.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD WINAPI CaptureAndConvertAnsiArg(LPCSTR pSrc, LPWSTR *pDst)
LIST_ENTRY DriverListHead
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
LPWSTR WINAPI DuplicateString(LPCWSTR lpSrc)
WCHAR SymbolicLink[ANYSIZE_ARRAY]
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
BOOL CreateDeviceInfo(IN struct DeviceInfoSet *list, IN LPCWSTR InstancePath, IN LPCGUID pClassGuid, OUT struct DeviceInfo **pDeviceInfo)
Definition: devinst.c:526
LIST_ENTRY DriverListHead
const WCHAR * PARSER_get_inf_filename(HINF hinf) DECLSPEC_HIDDEN
Definition: parser.c:1084
VOID DereferenceInfFile(struct InfFileDetails *infFile)
Definition: driver.c:45
DEVINST dnDevInst
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
LPSTR WINAPI UnicodeToMultiByte(LPCWSTR lpUnicodeStr, UINT uCodePage)
Definition: typedefs.h:117
LONG SETUP_CreateDevicesList(IN OUT struct DeviceInfoSet *list, IN PCWSTR MachineName OPTIONAL, IN CONST GUID *Class OPTIONAL, IN PCWSTR Enumerator OPTIONAL)
Definition: devclass.c:254
LONG SETUP_CreateInterfaceList(struct DeviceInfoSet *list, PCWSTR MachineName, CONST GUID *InterfaceGuid, PCWSTR DeviceInstanceW, BOOL OnlyPresentInterfaces)
Definition: interface.c:68
ULARGE_INTEGER DriverDate
WCHAR * PARSER_get_dest_dir(INFCONTEXT *context) DECLSPEC_HIDDEN
Definition: parser.c:1116
LPVOID WINAPI MyRealloc(LPVOID lpSrc, DWORD dwSize)
Definition: misc.c:172
LIST_ENTRY ListEntry
DWORD DEVINST
Definition: cfgmgr32.h:76
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
BOOL DestroyDeviceInterface(struct DeviceInterface *deviceInterface)
Definition: interface.c:61
ACCESS_MASK REGSAM
Definition: winreg.h:69
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR szData[ANYSIZE_ARRAY]
LIST_ENTRY ListEntry
PSP_PROPCHANGE_PARAMS PropChangeParams
#define OUT
Definition: typedefs.h:39
SP_DRVINFO_DETAIL_DATA_W Details
struct tagContext Context
Definition: acpixf.h:1030
WCHAR * LPWSTR
Definition: xmlstorage.h:184
WCHAR szData[ANYSIZE_ARRAY]
struct DeviceInfo * SelectedDevice
LPFNPSPCALLBACK Callback
Definition: desk.c:111
#define CONST
Definition: pedump.c:81
Definition: inf.c:48
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68