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
45 #include <wine/unicode.h>
46 #define NTOS_MODE_USER
47 #include <ndk/rtlfuncs.h>
49 #include <wine/debug.h>
50 WINE_DEFAULT_DEBUG_CHANNEL(setupapi
);
56 #define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057
57 #define SETUP_CLASS_IMAGE_LIST_MAGIC 0xd00ff058
59 #define CMP_MAGIC 0x01234567
61 struct DeviceInterface
/* Element of DeviceInfo.InterfaceListHead */
65 /* Link to is parent device */
66 struct DeviceInfo
*DeviceInfo
;
67 GUID InterfaceClassGuid
;
70 /* SPINT_ACTIVE : the interface is active/enabled
71 * SPINT_DEFAULT: the interface is the default interface for the device class
72 * SPINT_REMOVED: the interface is removed
76 /* Contains the symbolic link of this interface, for example
77 * \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
78 WCHAR SymbolicLink
[ANYSIZE_ARRAY
];
81 /* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it
82 * has been already loaded once. Keep also a reference counter */
85 /* Handle to the .inf file */
87 /* Reference count to this object. Once it raises 0, the .inf file is
88 * automatically closed and this memory structure is deleted */
91 /* Contains the directory name of the .inf file.
92 * Points into szData at then end of the structure */
94 /* Contains the .inf file name (without directory name).
95 * Points into szData at then end of the structure */
98 /* Variable size array (contains data for DirectoryName and FileName) */
99 WCHAR szData
[ANYSIZE_ARRAY
];
102 struct DriverInfoElement
/* Element of DeviceInfoSet.DriverListHead and DeviceInfo.DriverListHead */
104 LIST_ENTRY ListEntry
;
106 SP_DRVINSTALL_PARAMS Params
;
107 ULARGE_INTEGER DriverDate
;
108 SP_DRVINFO_DATA_V2_W Info
;
109 SP_DRVINFO_DETAIL_DATA_W Details
;
112 struct InfFileDetails
*InfFileDetails
;
115 struct ClassInstallParams
117 PSP_PROPCHANGE_PARAMS PropChangeParams
;
118 PSP_ADDPROPERTYPAGE_DATA AddPropertyPageData
;
121 struct DeviceInfo
/* Element of DeviceInfoSet.ListHead */
123 LIST_ENTRY ListEntry
;
124 /* Used when dealing with CM_* functions */
127 /* Link to parent DeviceInfoSet */
128 struct DeviceInfoSet
*set
;
130 /* Reserved Field of SP_DEVINSTALL_PARAMS_W structure
131 * points to a struct DriverInfoElement */
132 SP_DEVINSTALL_PARAMS_W InstallParams
;
134 /* Information about devnode:
136 * "Root\*PNP0501" for example.
137 * It doesn't contain the unique ID for the device
138 * (points into the Data field at the end of the structure)
139 * WARNING: no NULL char exist between instanceId and UniqueId
142 * "5&1be2108e&0" or "0000"
143 * If DICD_GENERATE_ID is specified in creation flags,
144 * this unique ID is autogenerated using 4 digits, base 10
145 * (points into the Data field at the end of the structure)
146 * - DeviceDescription
147 * String which identifies the device. Can be NULL. If not NULL,
148 * points into the Data field at the end of the structure
150 * Identifies the class of this device. It is GUID_NULL if the
151 * device has not been installed
153 * Is a combination of:
155 * the unique ID needs to be generated
156 * - DICD_INHERIT_CLASSDRVS
157 * inherit driver of the device info set (== same pointer)
161 PCWSTR DeviceDescription
;
165 /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */
166 /* If the driver is not searched/detected, this list is empty */
167 LIST_ENTRY DriverListHead
; /* List of struct DriverInfoElement */
169 /* List of interfaces implemented by this device */
170 LIST_ENTRY InterfaceListHead
; /* List of struct DeviceInterface */
172 /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
173 struct ClassInstallParams ClassInstallParams
;
175 /* Device property page provider data */
176 HMODULE hmodDevicePropPageProvider
;
177 PVOID pDevicePropPageProvider
;
179 /* Variable size array (contains data for instanceId, UniqueId, DeviceDescription) */
180 WCHAR Data
[ANYSIZE_ARRAY
];
183 struct DeviceInfoSet
/* HDEVINFO */
185 DWORD magic
; /* SETUP_DEVICE_INFO_SET_MAGIC */
186 /* If != GUID_NULL, only devices of this class can be in the device info set */
188 /* Local or distant HKEY_LOCAL_MACHINE registry key */
190 /* Used when dealing with CM_* functions */
193 /* Reserved Field points to a struct DriverInfoElement */
194 SP_DEVINSTALL_PARAMS_W InstallParams
;
196 /* List of struct DriverInfoElement (if no driver has been
197 * searched/detected, this list is empty) */
198 LIST_ENTRY DriverListHead
;
200 /* List of struct DeviceInfo */
202 struct DeviceInfo
*SelectedDevice
;
204 /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
205 struct ClassInstallParams ClassInstallParams
;
207 /* Class property page provider data */
208 HMODULE hmodClassPropPageProvider
;
209 PVOID pClassPropPageProvider
;
211 /* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
212 * or NULL if related to local machine. Points into szData field at the
213 * end of the structure */
216 /* Variable size array (contains data for MachineName) */
217 WCHAR szData
[ANYSIZE_ARRAY
];
220 struct ClassImageList
222 DWORD magic
; /* SETUP_CLASS_IMAGE_LIST_MAGIC */
224 /* Number of GUIDs contained in Guids and IconIndexes arrays */
226 /* Array of GUIDs associated to icons of the image list. Its size
227 * is NumberOfGuids and is pointing after the end this structure */
229 /* Array of corresponding icons index in the image list. Its size
230 * is NumberOfGuids and is pointing after the end this structure */
234 struct FileLog
/* HSPFILELOG */
241 extern HINSTANCE hInstance
;
242 #define RC_STRING_MAX_SIZE 256
244 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
245 #define REGPART_RENAME "\\Rename"
246 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
248 inline static WCHAR
*strdupAtoW( const char *str
)
253 DWORD len
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, NULL
, 0 );
254 if ((ret
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) )))
255 MultiByteToWideChar( CP_ACP
, 0, str
, -1, ret
, len
);
260 /* string substitutions */
263 extern const WCHAR
*DIRID_get_string( int dirid
);
264 extern unsigned int PARSER_string_substA( const struct inf_file
*file
, const WCHAR
*text
,
265 char *buffer
, unsigned int size
);
266 extern unsigned int PARSER_string_substW( const struct inf_file
*file
, const WCHAR
*text
,
267 WCHAR
*buffer
, unsigned int size
);
268 extern const WCHAR
*PARSER_get_inf_filename( HINF hinf
);
269 extern WCHAR
*PARSER_get_src_root( HINF hinf
);
270 extern WCHAR
*PARSER_get_dest_dir( INFCONTEXT
*context
);
272 /* support for Ascii queue callback functions */
274 struct callback_WtoA_context
277 PSP_FILE_CALLBACK_A orig_handler
;
280 UINT CALLBACK
QUEUE_callback_WtoA( void *context
, UINT notification
, UINT_PTR
, UINT_PTR
);
282 /* from msvcrt/sys/stat.h */
283 #define _S_IWRITE 0x0080
284 #define _S_IREAD 0x0100
286 extern HINSTANCE hInstance
;
287 extern OSVERSIONINFOW OsVersionInfo
;
293 IN
struct DeviceInfoSet
*list
,
294 IN LPCWSTR InstancePath
,
295 IN LPCGUID pClassGuid
,
296 OUT
struct DeviceInfo
**pDeviceInfo
);
299 SETUP_CreateDevicesList(
300 IN OUT
struct DeviceInfoSet
*list
,
301 IN PCWSTR MachineName OPTIONAL
,
302 IN CONST GUID
*Class OPTIONAL
,
303 IN PCWSTR Enumerator OPTIONAL
);
307 struct InfFileDetails
*
308 CreateInfFileDetails(
309 IN LPCWSTR FullInfFileName
);
312 DereferenceInfFile(struct InfFileDetails
* infFile
);
315 DestroyDriverInfoElement(struct DriverInfoElement
* driverInfo
);
320 GetStringField( PINFCONTEXT context
, DWORD index
, PWSTR
*value
);
325 DestroyDeviceInterface(
326 struct DeviceInterface
* deviceInterface
);
329 SETUP_CreateInterfaceList(
330 struct DeviceInfoSet
*list
,
332 CONST GUID
*InterfaceGuid
,
333 PCWSTR DeviceInstanceW
/* OPTIONAL */,
334 BOOL OnlyPresentInterfaces
);
340 IN PWSTR InstallerName
,
341 OUT HMODULE
* ModulePointer
,
342 OUT PVOID
* FunctionPointer
);
346 IN HMODULE ModulePointer
,
347 IN PVOID FunctionPointer
);
351 pSetupStringFromGuid(LPGUID lpGUID
, PWSTR pString
, DWORD dwStringLen
);
353 DWORD WINAPI
CaptureAndConvertAnsiArg(LPCSTR pSrc
, LPWSTR
*pDst
);
355 VOID WINAPI
MyFree(LPVOID lpMem
);
356 LPVOID WINAPI
MyMalloc(DWORD dwSize
);
357 LPVOID WINAPI
MyRealloc(LPVOID lpSrc
, DWORD dwSize
);
358 LPWSTR WINAPI
DuplicateString(LPCWSTR lpSrc
);
359 BOOL WINAPI
IsUserAdmin(VOID
);
360 LPWSTR WINAPI
MultiByteToUnicode(LPCSTR lpMultiByteStr
, UINT uCodePage
);
361 LPSTR WINAPI
UnicodeToMultiByte(LPCWSTR lpUnicodeStr
, UINT uCodePage
);
365 typedef BOOL (*FIND_CALLBACK
)(LPCWSTR SectionName
, PVOID Context
);
366 BOOL
EnumerateSectionsStartingWith(HINF hInf
, LPCWSTR pStr
, FIND_CALLBACK Callback
, PVOID Context
);
368 #endif /* __SETUPAPI_PRIVATE_H */