ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

setupapi_private.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2001 Andreas Mohr
00003  * Copyright 2005-2006 Hervé Poussineau
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00018  */
00019 
00020 #ifndef __SETUPAPI_PRIVATE_H
00021 #define __SETUPAPI_PRIVATE_H
00022 
00023 #include <assert.h>
00024 #include <errno.h>
00025 #include <fcntl.h>
00026 #include <limits.h>
00027 #include <share.h>
00028 #include <wchar.h>
00029 
00030 #define WIN32_NO_STATUS
00031 #define COBJMACROS
00032 #include <windows.h>
00033 #include <aclapi.h>
00034 #include <cfgmgr32.h>
00035 #include <fdi.h>
00036 #include <reason.h>
00037 #include <regstr.h>
00038 #include <sddl.h>
00039 #include <setupapi.h>
00040 #include <shlobj.h>
00041 #include <wine/debug.h>
00042 #include <wine/unicode.h>
00043 #define NTOS_MODE_USER
00044 #include <ndk/cmfuncs.h>
00045 #include <ndk/obfuncs.h>
00046 #include <ndk/rtlfuncs.h>
00047 
00048 #include <pseh/pseh2.h>
00049 
00050 #include <pnp_c.h>
00051 #include "rpc_private.h"
00052 #include "resource.h"
00053 
00054 #ifdef __REACTOS__
00055 #undef __WINESRC__
00056 #endif
00057 
00058 #define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057
00059 #define SETUP_CLASS_IMAGE_LIST_MAGIC 0xd00ff058
00060 
00061 #define CMP_MAGIC  0x01234567
00062 
00063 struct DeviceInterface /* Element of DeviceInfo.InterfaceListHead */
00064 {
00065     LIST_ENTRY ListEntry;
00066 
00067     /* Link to is parent device */
00068     struct DeviceInfo *DeviceInfo;
00069     GUID InterfaceClassGuid;
00070 
00071 
00072     /* SPINT_ACTIVE : the interface is active/enabled
00073      * SPINT_DEFAULT: the interface is the default interface for the device class
00074      * SPINT_REMOVED: the interface is removed
00075      */
00076     DWORD Flags;
00077 
00078     /* Contains the symbolic link of this interface, for example
00079      * \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
00080     WCHAR SymbolicLink[ANYSIZE_ARRAY];
00081 };
00082 
00083 /* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it
00084  * has been already loaded once. Keep also a reference counter */
00085 struct InfFileDetails
00086 {
00087     /* Handle to the .inf file */
00088     HINF hInf;
00089     /* Reference count to this object. Once it raises 0, the .inf file is
00090      * automatically closed and this memory structure is deleted */
00091     LONG References;
00092 
00093     /* Contains the directory name of the .inf file.
00094      * Points into szData at then end of the structure */
00095     PCWSTR DirectoryName;
00096     /* Contains the .inf file name (without directory name).
00097      * Points into szData at then end of the structure */
00098     PCWSTR FileName;
00099 
00100     /* Variable size array (contains data for DirectoryName and FileName) */
00101     WCHAR szData[ANYSIZE_ARRAY];
00102 };
00103 
00104 struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfo.DriverListHead */
00105 {
00106     LIST_ENTRY ListEntry;
00107 
00108     SP_DRVINSTALL_PARAMS Params;
00109     ULARGE_INTEGER DriverDate;
00110     SP_DRVINFO_DATA_V2_W Info;
00111     SP_DRVINFO_DETAIL_DATA_W Details;
00112     GUID ClassGuid;
00113     LPWSTR MatchingId;
00114     struct InfFileDetails *InfFileDetails;
00115 };
00116 
00117 struct ClassInstallParams
00118 {
00119     PSP_PROPCHANGE_PARAMS PropChangeParams;
00120     PSP_ADDPROPERTYPAGE_DATA AddPropertyPageData;
00121 };
00122 
00123 struct DeviceInfo /* Element of DeviceInfoSet.ListHead */
00124 {
00125     LIST_ENTRY ListEntry;
00126     /* Used when dealing with CM_* functions */
00127     DEVINST dnDevInst;
00128 
00129     /* Link to parent DeviceInfoSet */
00130     struct DeviceInfoSet *set;
00131 
00132     /* Reserved Field of SP_DEVINSTALL_PARAMS_W structure
00133      * points to a struct DriverInfoElement */
00134     SP_DEVINSTALL_PARAMS_W InstallParams;
00135 
00136     /* Information about devnode:
00137      * - instanceId:
00138      *       "Root\*PNP0501" for example.
00139      *       It doesn't contain the unique ID for the device
00140      *       (points into the Data field at the end of the structure)
00141      *       WARNING: no NULL char exist between instanceId and UniqueId
00142      *       in Data field!
00143      * - UniqueId
00144      *       "5&1be2108e&0" or "0000"
00145      *       If DICD_GENERATE_ID is specified in creation flags,
00146      *       this unique ID is autogenerated using 4 digits, base 10
00147      *       (points into the Data field at the end of the structure)
00148      * - DeviceDescription
00149      *       String which identifies the device. Can be NULL. If not NULL,
00150      *       points into the Data field at the end of the structure
00151      * - ClassGuid
00152      *       Identifies the class of this device. It is GUID_NULL if the
00153      *       device has not been installed
00154      * - CreationFlags
00155      *       Is a combination of:
00156      *       - DICD_GENERATE_ID
00157      *              the unique ID needs to be generated
00158      *       - DICD_INHERIT_CLASSDRVS
00159      *              inherit driver of the device info set (== same pointer)
00160      */
00161     PCWSTR instanceId;
00162     PCWSTR UniqueId;
00163     PCWSTR DeviceDescription;
00164     GUID ClassGuid;
00165     DWORD CreationFlags;
00166 
00167     /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */
00168     /* If the driver is not searched/detected, this list is empty */
00169     LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */
00170 
00171     /* List of interfaces implemented by this device */
00172     LIST_ENTRY InterfaceListHead; /* List of struct DeviceInterface */
00173 
00174     /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
00175     struct ClassInstallParams ClassInstallParams;
00176 
00177     /* Variable size array (contains data for instanceId, UniqueId, DeviceDescription) */
00178     WCHAR Data[ANYSIZE_ARRAY];
00179 };
00180 
00181 struct DeviceInfoSet /* HDEVINFO */
00182 {
00183     DWORD magic; /* SETUP_DEVICE_INFO_SET_MAGIC */
00184     /* If != GUID_NULL, only devices of this class can be in the device info set */
00185     GUID ClassGuid;
00186     /* Local or distant HKEY_LOCAL_MACHINE registry key */
00187     HKEY HKLM;
00188     /* Used when dealing with CM_* functions */
00189     HMACHINE hMachine;
00190 
00191     /* Reserved Field points to a struct DriverInfoElement */
00192     SP_DEVINSTALL_PARAMS_W InstallParams;
00193 
00194     /* List of struct DriverInfoElement (if no driver has been
00195      * searched/detected, this list is empty) */
00196     LIST_ENTRY DriverListHead;
00197 
00198     /* List of struct DeviceInfo */
00199     LIST_ENTRY ListHead;
00200     struct DeviceInfo *SelectedDevice;
00201 
00202     /* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
00203     struct ClassInstallParams ClassInstallParams;
00204 
00205     /* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
00206      * or NULL if related to local machine. Points into szData field at the
00207      * end of the structure */
00208     PCWSTR MachineName;
00209 
00210     /* Variable size array (contains data for MachineName) */
00211     WCHAR szData[ANYSIZE_ARRAY];
00212 };
00213 
00214 struct ClassImageList
00215 {
00216     DWORD magic; /* SETUP_CLASS_IMAGE_LIST_MAGIC */
00217 
00218     /* Number of GUIDs contained in Guids and IconIndexes arrays */
00219     DWORD NumberOfGuids;
00220     /* Array of GUIDs associated to icons of the image list. Its size
00221      * is NumberOfGuids and is pointing after the end this structure */
00222     GUID* Guids;
00223     /* Array of corresponding icons index in the image list. Its size
00224      * is NumberOfGuids and is pointing after the end this structure */
00225     INT* IconIndexes;
00226 };
00227 
00228 struct FileLog /* HSPFILELOG */
00229 {
00230     DWORD ReadOnly;
00231     DWORD SystemLog;
00232     LPWSTR LogName;
00233 };
00234 
00235 extern HINSTANCE hInstance;
00236 #define RC_STRING_MAX_SIZE 256
00237 
00238 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
00239 #define REGPART_RENAME "\\Rename"
00240 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
00241 
00242 inline static WCHAR *strdupAtoW( const char *str )
00243 {
00244     WCHAR *ret = NULL;
00245     if (str)
00246     {
00247         DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
00248         if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
00249             MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
00250     }
00251     return ret;
00252 }
00253 
00254 /* string substitutions */
00255 
00256 struct inf_file;
00257 extern const WCHAR *DIRID_get_string( int dirid );
00258 extern unsigned int PARSER_string_substA( const struct inf_file *file, const WCHAR *text,
00259                                           char *buffer, unsigned int size );
00260 extern unsigned int PARSER_string_substW( const struct inf_file *file, const WCHAR *text,
00261                                           WCHAR *buffer, unsigned int size );
00262 extern const WCHAR *PARSER_get_inf_filename( HINF hinf );
00263 extern WCHAR *PARSER_get_src_root( HINF hinf );
00264 extern WCHAR *PARSER_get_dest_dir( INFCONTEXT *context );
00265 
00266 /* support for Ascii queue callback functions */
00267 
00268 struct callback_WtoA_context
00269 {
00270     void               *orig_context;
00271     PSP_FILE_CALLBACK_A orig_handler;
00272 };
00273 
00274 UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, UINT_PTR, UINT_PTR );
00275 
00276 /* from msvcrt/sys/stat.h */
00277 #define _S_IWRITE 0x0080
00278 #define _S_IREAD  0x0100
00279 
00280 extern HINSTANCE hInstance;
00281 extern OSVERSIONINFOW OsVersionInfo;
00282 
00283 /* devinst.c */
00284 
00285 BOOL
00286 CreateDeviceInfo(
00287     IN struct DeviceInfoSet *list,
00288     IN LPCWSTR InstancePath,
00289     IN LPCGUID pClassGuid,
00290     OUT struct DeviceInfo **pDeviceInfo);
00291 
00292 LONG
00293 SETUP_CreateDevicesList(
00294     IN OUT struct DeviceInfoSet *list,
00295     IN PCWSTR MachineName OPTIONAL,
00296     IN CONST GUID *Class OPTIONAL,
00297     IN PCWSTR Enumerator OPTIONAL);
00298 
00299 /* driver.c */
00300 
00301 struct InfFileDetails *
00302 CreateInfFileDetails(
00303     IN LPCWSTR FullInfFileName);
00304 
00305 VOID
00306 DereferenceInfFile(struct InfFileDetails* infFile);
00307 
00308 BOOL
00309 DestroyDriverInfoElement(struct DriverInfoElement* driverInfo);
00310 
00311 /* install.c */
00312 
00313 BOOL
00314 GetStringField( PINFCONTEXT context, DWORD index, PWSTR *value);
00315 
00316 /* interface.c */
00317 
00318 BOOL
00319 DestroyDeviceInterface(
00320     struct DeviceInterface* deviceInterface);
00321 
00322 LONG
00323 SETUP_CreateInterfaceList(
00324     struct DeviceInfoSet *list,
00325     PCWSTR MachineName,
00326     CONST GUID *InterfaceGuid,
00327     PCWSTR DeviceInstanceW /* OPTIONAL */,
00328     BOOL OnlyPresentInterfaces);
00329 
00330 /* misc.c */
00331 
00332 DWORD
00333 GetFunctionPointer(
00334     IN PWSTR InstallerName,
00335     OUT HMODULE* ModulePointer,
00336     OUT PVOID* FunctionPointer);
00337 
00338 DWORD
00339 FreeFunctionPointer(
00340     IN HMODULE ModulePointer,
00341     IN PVOID FunctionPointer);
00342 
00343 DWORD
00344 WINAPI
00345 pSetupStringFromGuid(LPGUID lpGUID, PWSTR pString, DWORD dwStringLen);
00346 
00347 DWORD WINAPI CaptureAndConvertAnsiArg(LPCSTR pSrc, LPWSTR *pDst);
00348 
00349 VOID WINAPI MyFree(LPVOID lpMem);
00350 LPVOID WINAPI MyMalloc(DWORD dwSize);
00351 LPVOID WINAPI MyRealloc(LPVOID lpSrc, DWORD dwSize);
00352 LPWSTR WINAPI DuplicateString(LPCWSTR lpSrc);
00353 BOOL WINAPI IsUserAdmin(VOID);
00354 LPWSTR WINAPI MultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage);
00355 LPSTR WINAPI UnicodeToMultiByte(LPCWSTR lpUnicodeStr, UINT uCodePage);
00356 
00357 /* parser.c */
00358 
00359 typedef BOOL (*FIND_CALLBACK)(LPCWSTR SectionName, PVOID Context);
00360 BOOL EnumerateSectionsStartingWith(HINF hInf, LPCWSTR pStr, FIND_CALLBACK Callback, PVOID Context);
00361 
00362 #endif /* __SETUPAPI_PRIVATE_H */

Generated on Mon May 28 2012 04:25:51 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.