Author: hpoussin
Date: Thu Aug 3 00:45:13 2006
New Revision: 23422
URL:
http://svn.reactos.org/svn/reactos?rev=23422&view=rev
Log:
- Implement INF_STYLE_OLDNT style in SetupOpenInfFileW
- Add some documentation in header file
Modified:
trunk/reactos/dll/win32/setupapi/parser.c
trunk/reactos/dll/win32/setupapi/setupapi_private.h
Modified: trunk/reactos/dll/win32/setupapi/parser.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/parser.…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/parser.c (original)
+++ trunk/reactos/dll/win32/setupapi/parser.c Thu Aug 3 00:45:13 2006
@@ -910,7 +910,7 @@
*
* parse an INF file.
*/
-static struct inf_file *parse_file( HANDLE handle, UINT *error_line )
+static struct inf_file *parse_file( HANDLE handle, UINT *error_line, DWORD style )
{
void *buffer;
DWORD err = 0;
@@ -962,6 +962,8 @@
if (!err) /* now check signature */
{
int version_index = find_section( file, Version );
+ if (version_index == -1 && (style & INF_STYLE_OLDNT))
+ goto done;
if (version_index != -1)
{
struct line *line = find_line( file, version_index, Signature );
@@ -1148,6 +1150,12 @@
TRACE("%s %s %lx %p\n", debugstr_w(name), debugstr_w(class), style,
error);
+ if (style & ~(INF_STYLE_OLDNT | INF_STYLE_WIN4))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return (HINF)INVALID_HANDLE_VALUE;
+ }
+
if (strchrW( name, '\\' ) || strchrW( name, '/' ))
{
if (!(len = GetFullPathNameW( name, 0, NULL, NULL ))) return
(HINF)INVALID_HANDLE_VALUE;
@@ -1185,7 +1193,7 @@
if (handle != INVALID_HANDLE_VALUE)
{
- file = parse_file( handle, error );
+ file = parse_file( handle, error, style );
CloseHandle( handle );
}
if (!file)
Modified: trunk/reactos/dll/win32/setupapi/setupapi_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupap…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupapi_private.h (original)
+++ trunk/reactos/dll/win32/setupapi/setupapi_private.h Thu Aug 3 00:45:13 2006
@@ -1,6 +1,6 @@
/*
* Copyright 2001 Andreas Mohr
- * Copyright 2005 Hervé Poussineau
+ * Copyright 2005-2006 Hervé Poussineau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -54,6 +54,7 @@
{
LIST_ENTRY ListEntry;
+ /* Link to is parent device */
struct DeviceInfoElement* DeviceInfo;
GUID InterfaceClassGuid;
@@ -64,14 +65,19 @@
*/
DWORD Flags;
- WCHAR SymbolicLink[ANYSIZE_ARRAY]; /* \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID}
*/
+ /* Contains the symbolic link of this interface, for example
+ * \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
+ WCHAR SymbolicLink[ANYSIZE_ARRAY];
};
/* We don't want to open the .inf file to read only one information in it, so keep a
handle to it once it
* has been already loaded once. Keep also a reference counter */
struct InfFileDetails
{
+ /* Handle to the .inf file */
HINF hInf;
+ /* Reference count to this object. Once it raises 0, the .inf file is
+ * automatically closed and this memory structure is deleted */
LONG References;
/* Contains the directory name of the .inf file.
@@ -81,6 +87,7 @@
* Points into szData at then end of the structure */
PCWSTR FileName;
+ /* Variable size array (contains data for DirectoryName and FileName) */
WCHAR szData[ANYSIZE_ARRAY];
};
@@ -105,9 +112,11 @@
struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */
{
LIST_ENTRY ListEntry;
- DEVINST dnDevInst; /* Used in CM_* functions */
-
- /* Reserved Field points to a struct DriverInfoElement */
+ /* Used when dealing with CM_* functions */
+ DEVINST dnDevInst;
+
+ /* Reserved Field of SP_DEVINSTALL_PARAMS_W structure
+ * points to a struct DriverInfoElement */
SP_DEVINSTALL_PARAMS_W InstallParams;
/* Information about devnode:
@@ -151,23 +160,29 @@
/* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
struct ClassInstallParams ClassInstallParams;
+ /* Variable size array (contains data for DeviceName, UniqueId, DeviceDescription) */
WCHAR Data[ANYSIZE_ARRAY];
};
struct DeviceInfoSet /* HDEVINFO */
{
DWORD magic; /* SETUP_DEV_INFO_SET_MAGIC */
- GUID ClassGuid; /* If != GUID_NULL, only devices of this class can be in the device
info set */
- HKEY HKLM; /* Local or distant HKEY_LOCAL_MACHINE registry key */
- HMACHINE hMachine; /* Used in CM_* functions */
+ /* If != GUID_NULL, only devices of this class can be in the device info set */
+ GUID ClassGuid;
+ /* Local or distant HKEY_LOCAL_MACHINE registry key */
+ HKEY HKLM;
+ /* Used when dealing with CM_* functions */
+ HMACHINE hMachine;
/* Reserved Field points to a struct DriverInfoElement */
SP_DEVINSTALL_PARAMS_W InstallParams;
- /* If the driver is not searched/detected, this list is empty */
- LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */
-
- LIST_ENTRY ListHead; /* List of struct DeviceInfoElement */
+ /* List of struct DriverInfoElement (if no driver has been
+ * searched/detected, this list is empty) */
+ LIST_ENTRY DriverListHead;
+
+ /* List of struct DeviceInfoElement */
+ LIST_ENTRY ListHead;
struct DeviceInfoElement *SelectedDevice;
/* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
@@ -177,6 +192,8 @@
* or NULL if related to local machine. Points into szData field at the
* end of the structure */
PCWSTR MachineName;
+
+ /* Variable size array (contains data for MachineName) */
WCHAR szData[ANYSIZE_ARRAY];
};
@@ -188,6 +205,8 @@
* or NULL if related to local machine. Points into szData field at the
* end of the structure */
PCWSTR MachineName;
+
+ /* Variable size array (contains data for MachineName) */
WCHAR szData[ANYSIZE_ARRAY];
};