2 * Copyright 2001 Andreas Mohr
3 * Copyright 2005-2006 Hervé Poussineau
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.
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.
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
20 #ifndef __SETUPAPI_PRIVATE_H
21 #define __SETUPAPI_PRIVATE_H
25 #define WIN32_NO_STATUS
27 #define COM_NO_WINDOWS_H
41 #include <wine/unicode.h>
42 #define NTOS_MODE_USER
43 #include <ndk/rtlfuncs.h>
45 #include <wine/debug.h>
46 WINE_DEFAULT_DEBUG_CHANNEL(setupapi
);
52 #define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057
53 #define SETUP_CLASS_IMAGE_LIST_MAGIC 0xd00ff058
55 #define CMP_MAGIC 0x01234567
57 struct DeviceInterface
/* Element of DeviceInfo.InterfaceListHead */
61 /* Link to is parent device */
62 struct DeviceInfo
*DeviceInfo
;
63 GUID InterfaceClassGuid
;
66 /* SPINT_ACTIVE : the interface is active/enabled
67 * SPINT_DEFAULT: the interface is the default interface for the device class
68 * SPINT_REMOVED: the interface is removed
72 /* Contains the symbolic link of this interface, for example
73 * \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
74 WCHAR SymbolicLink
[ANYSIZE_ARRAY
];
77 /* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it
78 * has been already loaded once. Keep also a reference counter */
81 /* Handle to the .inf file */
83 /* Reference count to this object. Once it raises 0, the .inf file is
84 * automatically closed and this memory structure is deleted */
87 /* Contains the directory name of the .inf file.
88 * Points into szData at then end of the structure */
90 /* Contains the .inf file name (without directory name).
91 * Points into szData at then end of the structure */
94 /* Variable size array (contains data for DirectoryName and FileName) */
95 WCHAR szData
[ANYSIZE_ARRAY
];
98 struct DriverInfoElement
/* Element of DeviceInfoSet.DriverListHead and DeviceInfo.DriverListHead */
100 LIST_ENTRY ListEntry
;
102 SP_DRVINSTALL_PARAMS Params
;
103 ULARGE_INTEGER DriverDate
;
104 SP_DRVINFO_DATA_V2_W Info
;
105 SP_DRVINFO_DETAIL_DATA_W Details
;
108 struct InfFileDetails
*InfFileDetails
;
111 struct ClassInstallParams
113 PSP_PROPCHANGE_PARAMS PropChangeParams
;
114 PSP_ADDPROPERTYPAGE_DATA AddPropertyPageData
;
117 struct DeviceInfo
/* Element of DeviceInfoSet.ListHead */
119 LIST_ENTRY ListEntry
;
120 /* Used when dealing with CM_* functions */
123 /* Link to parent DeviceInfoSet */
124 struct DeviceInfoSet
*set
;
126 /* Reserved Field of SP_DEVINSTALL_PARAMS_W structure
127 * points to a struct DriverInfoElement */
128 SP_DEVINSTALL_PARAMS_W InstallParams
;
130 /* Information about devnode:
132 * "Root\*PNP0501" for example.
133 * It doesn't contain the unique ID for the device
134 * (points into the Data field at the end of the structure)
135 * WARNING: no NULL char exist between instanceId and UniqueId
138 * "5&1be2108e&0" or "0000"
139 * If DICD_GENERATE_ID is specified in creation flags,
140 * this unique ID is autogenerated using 4 digits, base 10
141 * (points into the Data field at the end of the structure)
142 * - DeviceDescription
143 * String which identifies the device. Can be NULL. If not NULL,
144 * points into the Data field at the end of the structure
146 * Identifies the class of this device. It is GUID_NULL if the
147 * device has not been installed
149 * Is a combination of:
151 * the unique ID needs to be generated
152 * - DICD_INHERIT_CLASSDRVS
153 * inherit driver of the device info set (== same pointer)
157 PCWSTR DeviceDescription
;
161 /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */
162 /* If the driver is not searched/detected, this list is empty */
163 LIST_ENTRY DriverListHead
; /* List of struct DriverInfoElement */
165 /* List of interfaces implemented by this device */
166 LIST_ENTRY InterfaceListHead
; /* List of struct DeviceInterface */
168 /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
169 struct ClassInstallParams ClassInstallParams
;
171 /* Variable size array (contains data for instanceId, UniqueId, DeviceDescription) */
172 WCHAR Data
[ANYSIZE_ARRAY
];
175 struct DeviceInfoSet
/* HDEVINFO */
177 DWORD magic
; /* SETUP_DEVICE_INFO_SET_MAGIC */
178 /* If != GUID_NULL, only devices of this class can be in the device info set */
180 /* Local or distant HKEY_LOCAL_MACHINE registry key */
182 /* Used when dealing with CM_* functions */
185 /* Reserved Field points to a struct DriverInfoElement */
186 SP_DEVINSTALL_PARAMS_W InstallParams
;
188 /* List of struct DriverInfoElement (if no driver has been
189 * searched/detected, this list is empty) */
190 LIST_ENTRY DriverListHead
;
192 /* List of struct DeviceInfo */
194 struct DeviceInfo
*SelectedDevice
;
196 /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
197 struct ClassInstallParams ClassInstallParams
;
199 /* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
200 * or NULL if related to local machine. Points into szData field at the
201 * end of the structure */
204 /* Variable size array (contains data for MachineName) */
205 WCHAR szData
[ANYSIZE_ARRAY
];
208 struct ClassImageList
210 DWORD magic
; /* SETUP_CLASS_IMAGE_LIST_MAGIC */
212 /* Number of GUIDs contained in Guids and IconIndexes arrays */
214 /* Array of GUIDs associated to icons of the image list. Its size
215 * is NumberOfGuids and is pointing after the end this structure */
217 /* Array of corresponding icons index in the image list. Its size
218 * is NumberOfGuids and is pointing after the end this structure */
222 struct FileLog
/* HSPFILELOG */
229 extern HINSTANCE hInstance
;
230 #define RC_STRING_MAX_SIZE 256
232 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
233 #define REGPART_RENAME "\\Rename"
234 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
236 inline static WCHAR
*strdupAtoW( const char *str
)
241 DWORD len
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, NULL
, 0 );
242 if ((ret
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) )))
243 MultiByteToWideChar( CP_ACP
, 0, str
, -1, ret
, len
);
248 /* string substitutions */
251 extern const WCHAR
*DIRID_get_string( int dirid
);
252 extern unsigned int PARSER_string_substA( const struct inf_file
*file
, const WCHAR
*text
,
253 char *buffer
, unsigned int size
);
254 extern unsigned int PARSER_string_substW( const struct inf_file
*file
, const WCHAR
*text
,
255 WCHAR
*buffer
, unsigned int size
);
256 extern const WCHAR
*PARSER_get_inf_filename( HINF hinf
);
257 extern WCHAR
*PARSER_get_src_root( HINF hinf
);
258 extern WCHAR
*PARSER_get_dest_dir( INFCONTEXT
*context
);
260 /* support for Ascii queue callback functions */
262 struct callback_WtoA_context
265 PSP_FILE_CALLBACK_A orig_handler
;
268 UINT CALLBACK
QUEUE_callback_WtoA( void *context
, UINT notification
, UINT_PTR
, UINT_PTR
);
270 /* from msvcrt/sys/stat.h */
271 #define _S_IWRITE 0x0080
272 #define _S_IREAD 0x0100
274 extern HINSTANCE hInstance
;
275 extern OSVERSIONINFOW OsVersionInfo
;
281 IN
struct DeviceInfoSet
*list
,
282 IN LPCWSTR InstancePath
,
283 IN LPCGUID pClassGuid
,
284 OUT
struct DeviceInfo
**pDeviceInfo
);
287 SETUP_CreateDevicesList(
288 IN OUT
struct DeviceInfoSet
*list
,
289 IN PCWSTR MachineName OPTIONAL
,
290 IN CONST GUID
*Class OPTIONAL
,
291 IN PCWSTR Enumerator OPTIONAL
);
295 struct InfFileDetails
*
296 CreateInfFileDetails(
297 IN LPCWSTR FullInfFileName
);
300 DereferenceInfFile(struct InfFileDetails
* infFile
);
303 DestroyDriverInfoElement(struct DriverInfoElement
* driverInfo
);
308 GetStringField( PINFCONTEXT context
, DWORD index
, PWSTR
*value
);
313 DestroyDeviceInterface(
314 struct DeviceInterface
* deviceInterface
);
317 SETUP_CreateInterfaceList(
318 struct DeviceInfoSet
*list
,
320 CONST GUID
*InterfaceGuid
,
321 PCWSTR DeviceInstanceW
/* OPTIONAL */,
322 BOOL OnlyPresentInterfaces
);
328 IN PWSTR InstallerName
,
329 OUT HMODULE
* ModulePointer
,
330 OUT PVOID
* FunctionPointer
);
334 IN HMODULE ModulePointer
,
335 IN PVOID FunctionPointer
);
339 pSetupStringFromGuid(LPGUID lpGUID
, PWSTR pString
, DWORD dwStringLen
);
341 DWORD WINAPI
CaptureAndConvertAnsiArg(LPCSTR pSrc
, LPWSTR
*pDst
);
343 VOID WINAPI
MyFree(LPVOID lpMem
);
344 LPVOID WINAPI
MyMalloc(DWORD dwSize
);
345 LPVOID WINAPI
MyRealloc(LPVOID lpSrc
, DWORD dwSize
);
346 LPWSTR WINAPI
DuplicateString(LPCWSTR lpSrc
);
347 BOOL WINAPI
IsUserAdmin(VOID
);
348 LPWSTR WINAPI
MultiByteToUnicode(LPCSTR lpMultiByteStr
, UINT uCodePage
);
349 LPSTR WINAPI
UnicodeToMultiByte(LPCWSTR lpUnicodeStr
, UINT uCodePage
);
353 typedef BOOL (*FIND_CALLBACK
)(LPCWSTR SectionName
, PVOID Context
);
354 BOOL
EnumerateSectionsStartingWith(HINF hInf
, LPCWSTR pStr
, FIND_CALLBACK Callback
, PVOID Context
);
356 #endif /* __SETUPAPI_PRIVATE_H */