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
40 #include <wine/unicode.h>
41 #define NTOS_MODE_USER
42 #include <ndk/rtlfuncs.h>
44 #include <wine/debug.h>
45 WINE_DEFAULT_DEBUG_CHANNEL(setupapi
);
51 #define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057
52 #define SETUP_CLASS_IMAGE_LIST_MAGIC 0xd00ff058
54 #define CMP_MAGIC 0x01234567
56 struct DeviceInterface
/* Element of DeviceInfo.InterfaceListHead */
60 /* Link to is parent device */
61 struct DeviceInfo
*DeviceInfo
;
62 GUID InterfaceClassGuid
;
65 /* SPINT_ACTIVE : the interface is active/enabled
66 * SPINT_DEFAULT: the interface is the default interface for the device class
67 * SPINT_REMOVED: the interface is removed
71 /* Contains the symbolic link of this interface, for example
72 * \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
73 WCHAR SymbolicLink
[ANYSIZE_ARRAY
];
76 /* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it
77 * has been already loaded once. Keep also a reference counter */
80 /* Handle to the .inf file */
82 /* Reference count to this object. Once it raises 0, the .inf file is
83 * automatically closed and this memory structure is deleted */
86 /* Contains the directory name of the .inf file.
87 * Points into szData at then end of the structure */
89 /* Contains the .inf file name (without directory name).
90 * Points into szData at then end of the structure */
93 /* Variable size array (contains data for DirectoryName and FileName) */
94 WCHAR szData
[ANYSIZE_ARRAY
];
97 struct DriverInfoElement
/* Element of DeviceInfoSet.DriverListHead and DeviceInfo.DriverListHead */
101 SP_DRVINSTALL_PARAMS Params
;
102 ULARGE_INTEGER DriverDate
;
103 SP_DRVINFO_DATA_V2_W Info
;
104 SP_DRVINFO_DETAIL_DATA_W Details
;
107 struct InfFileDetails
*InfFileDetails
;
110 struct ClassInstallParams
112 PSP_PROPCHANGE_PARAMS PropChangeParams
;
113 PSP_ADDPROPERTYPAGE_DATA AddPropertyPageData
;
116 struct DeviceInfo
/* Element of DeviceInfoSet.ListHead */
118 LIST_ENTRY ListEntry
;
119 /* Used when dealing with CM_* functions */
122 /* Link to parent DeviceInfoSet */
123 struct DeviceInfoSet
*set
;
125 /* Reserved Field of SP_DEVINSTALL_PARAMS_W structure
126 * points to a struct DriverInfoElement */
127 SP_DEVINSTALL_PARAMS_W InstallParams
;
129 /* Information about devnode:
131 * "Root\*PNP0501" for example.
132 * It doesn't contain the unique ID for the device
133 * (points into the Data field at the end of the structure)
134 * WARNING: no NULL char exist between instanceId and UniqueId
137 * "5&1be2108e&0" or "0000"
138 * If DICD_GENERATE_ID is specified in creation flags,
139 * this unique ID is autogenerated using 4 digits, base 10
140 * (points into the Data field at the end of the structure)
141 * - DeviceDescription
142 * String which identifies the device. Can be NULL. If not NULL,
143 * points into the Data field at the end of the structure
145 * Identifies the class of this device. It is GUID_NULL if the
146 * device has not been installed
148 * Is a combination of:
150 * the unique ID needs to be generated
151 * - DICD_INHERIT_CLASSDRVS
152 * inherit driver of the device info set (== same pointer)
156 PCWSTR DeviceDescription
;
160 /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */
161 /* If the driver is not searched/detected, this list is empty */
162 LIST_ENTRY DriverListHead
; /* List of struct DriverInfoElement */
164 /* List of interfaces implemented by this device */
165 LIST_ENTRY InterfaceListHead
; /* List of struct DeviceInterface */
167 /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
168 struct ClassInstallParams ClassInstallParams
;
170 /* Variable size array (contains data for instanceId, UniqueId, DeviceDescription) */
171 WCHAR Data
[ANYSIZE_ARRAY
];
174 struct DeviceInfoSet
/* HDEVINFO */
176 DWORD magic
; /* SETUP_DEVICE_INFO_SET_MAGIC */
177 /* If != GUID_NULL, only devices of this class can be in the device info set */
179 /* Local or distant HKEY_LOCAL_MACHINE registry key */
181 /* Used when dealing with CM_* functions */
184 /* Reserved Field points to a struct DriverInfoElement */
185 SP_DEVINSTALL_PARAMS_W InstallParams
;
187 /* List of struct DriverInfoElement (if no driver has been
188 * searched/detected, this list is empty) */
189 LIST_ENTRY DriverListHead
;
191 /* List of struct DeviceInfo */
193 struct DeviceInfo
*SelectedDevice
;
195 /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
196 struct ClassInstallParams ClassInstallParams
;
198 /* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
199 * or NULL if related to local machine. Points into szData field at the
200 * end of the structure */
203 /* Variable size array (contains data for MachineName) */
204 WCHAR szData
[ANYSIZE_ARRAY
];
207 struct ClassImageList
209 DWORD magic
; /* SETUP_CLASS_IMAGE_LIST_MAGIC */
211 /* Number of GUIDs contained in Guids and IconIndexes arrays */
213 /* Array of GUIDs associated to icons of the image list. Its size
214 * is NumberOfGuids and is pointing after the end this structure */
216 /* Array of corresponding icons index in the image list. Its size
217 * is NumberOfGuids and is pointing after the end this structure */
221 struct FileLog
/* HSPFILELOG */
228 extern HINSTANCE hInstance
;
229 #define RC_STRING_MAX_SIZE 256
231 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
232 #define REGPART_RENAME "\\Rename"
233 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
235 inline static WCHAR
*strdupAtoW( const char *str
)
240 DWORD len
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, NULL
, 0 );
241 if ((ret
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) )))
242 MultiByteToWideChar( CP_ACP
, 0, str
, -1, ret
, len
);
247 /* string substitutions */
250 extern const WCHAR
*DIRID_get_string( int dirid
);
251 extern unsigned int PARSER_string_substA( const struct inf_file
*file
, const WCHAR
*text
,
252 char *buffer
, unsigned int size
);
253 extern unsigned int PARSER_string_substW( const struct inf_file
*file
, const WCHAR
*text
,
254 WCHAR
*buffer
, unsigned int size
);
255 extern const WCHAR
*PARSER_get_inf_filename( HINF hinf
);
256 extern WCHAR
*PARSER_get_src_root( HINF hinf
);
257 extern WCHAR
*PARSER_get_dest_dir( INFCONTEXT
*context
);
259 /* support for Ascii queue callback functions */
261 struct callback_WtoA_context
264 PSP_FILE_CALLBACK_A orig_handler
;
267 UINT CALLBACK
QUEUE_callback_WtoA( void *context
, UINT notification
, UINT_PTR
, UINT_PTR
);
269 /* from msvcrt/sys/stat.h */
270 #define _S_IWRITE 0x0080
271 #define _S_IREAD 0x0100
273 extern HINSTANCE hInstance
;
274 extern OSVERSIONINFOW OsVersionInfo
;
280 IN
struct DeviceInfoSet
*list
,
281 IN LPCWSTR InstancePath
,
282 IN LPCGUID pClassGuid
,
283 OUT
struct DeviceInfo
**pDeviceInfo
);
286 SETUP_CreateDevicesList(
287 IN OUT
struct DeviceInfoSet
*list
,
288 IN PCWSTR MachineName OPTIONAL
,
289 IN CONST GUID
*Class OPTIONAL
,
290 IN PCWSTR Enumerator OPTIONAL
);
294 struct InfFileDetails
*
295 CreateInfFileDetails(
296 IN LPCWSTR FullInfFileName
);
299 DereferenceInfFile(struct InfFileDetails
* infFile
);
302 DestroyDriverInfoElement(struct DriverInfoElement
* driverInfo
);
307 GetStringField( PINFCONTEXT context
, DWORD index
, PWSTR
*value
);
312 DestroyDeviceInterface(
313 struct DeviceInterface
* deviceInterface
);
316 SETUP_CreateInterfaceList(
317 struct DeviceInfoSet
*list
,
319 CONST GUID
*InterfaceGuid
,
320 PCWSTR DeviceInstanceW
/* OPTIONAL */,
321 BOOL OnlyPresentInterfaces
);
327 IN PWSTR InstallerName
,
328 OUT HMODULE
* ModulePointer
,
329 OUT PVOID
* FunctionPointer
);
333 IN HMODULE ModulePointer
,
334 IN PVOID FunctionPointer
);
338 pSetupStringFromGuid(LPGUID lpGUID
, PWSTR pString
, DWORD dwStringLen
);
340 DWORD WINAPI
CaptureAndConvertAnsiArg(LPCSTR pSrc
, LPWSTR
*pDst
);
342 VOID WINAPI
MyFree(LPVOID lpMem
);
343 LPVOID WINAPI
MyMalloc(DWORD dwSize
);
344 LPVOID WINAPI
MyRealloc(LPVOID lpSrc
, DWORD dwSize
);
345 LPWSTR WINAPI
DuplicateString(LPCWSTR lpSrc
);
346 BOOL WINAPI
IsUserAdmin(VOID
);
347 LPWSTR WINAPI
MultiByteToUnicode(LPCSTR lpMultiByteStr
, UINT uCodePage
);
348 LPSTR WINAPI
UnicodeToMultiByte(LPCWSTR lpUnicodeStr
, UINT uCodePage
);
352 typedef BOOL (*FIND_CALLBACK
)(LPCWSTR SectionName
, PVOID Context
);
353 BOOL
EnumerateSectionsStartingWith(HINF hInf
, LPCWSTR pStr
, FIND_CALLBACK Callback
, PVOID Context
);
355 #endif /* __SETUPAPI_PRIVATE_H */