Author: cwittich Date: Mon Apr 20 03:08:05 2009 New Revision: 40599 URL: http://svn.reactos.org/svn/reactos?rev=40599&view=rev Log: import SetupEnumInfSectionsA/W from wine fixes setupapi parser winetest crash
Modified: trunk/reactos/dll/win32/setupapi/devinst.c trunk/reactos/dll/win32/setupapi/parser.c trunk/reactos/dll/win32/setupapi/setupapi.spec Modified: trunk/reactos/dll/win32/setupapi/devinst.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devinst.c?rev=40599&r1=40598&r2=40599&view=diff ============================================================================== --- trunk/reactos/dll/win32/setupapi/devinst.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/devinst.c [iso-8859-1] Mon Apr 20 03:08:05 2009 @@ -5337,7 +5337,7 @@ DWORD KeyType, REGSAM samDesired) { - struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet; + struct DeviceInfoSet *set = DeviceInfoSet; struct DeviceInfo *devInfo; HKEY key = INVALID_HANDLE_VALUE; HKEY RootKey; Modified: trunk/reactos/dll/win32/setupapi/parser.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/parser.c?rev=40599&r1=40598&r2=40599&view=diff ============================================================================== --- trunk/reactos/dll/win32/setupapi/parser.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/parser.c [iso-8859-1] Mon Apr 20 03:08:05 2009 @@ -1359,6 +1359,75 @@ /*********************************************************************** + * SetupEnumInfSectionsA (SETUPAPI.@) + */ +BOOL WINAPI SetupEnumInfSectionsA( HINF hinf, UINT index, PSTR buffer, DWORD size, DWORD *need ) +{ + struct inf_file *file = hinf; + + for (file = hinf; file; file = file->next) + { + if (index < file->nb_sections) + { + DWORD len = WideCharToMultiByte( CP_ACP, 0, file->sections[index]->name, -1, + NULL, 0, NULL, NULL ); + if (need) *need = len; + if (!buffer) + { + if (!size) return TRUE; + SetLastError( ERROR_INVALID_USER_BUFFER ); + return FALSE; + } + if (len > size) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + WideCharToMultiByte( CP_ACP, 0, file->sections[index]->name, -1, buffer, size, NULL, NULL ); + return TRUE; + } + index -= file->nb_sections; + } + SetLastError( ERROR_NO_MORE_ITEMS ); + return FALSE; +} + + +/*********************************************************************** + * SetupEnumInfSectionsW (SETUPAPI.@) + */ +BOOL WINAPI SetupEnumInfSectionsW( HINF hinf, UINT index, PWSTR buffer, DWORD size, DWORD *need ) +{ + struct inf_file *file = hinf; + + for (file = hinf; file; file = file->next) + { + if (index < file->nb_sections) + { + DWORD len = strlenW( file->sections[index]->name ) + 1; + if (need) *need = len; + if (!buffer) + { + if (!size) return TRUE; + SetLastError( ERROR_INVALID_USER_BUFFER ); + return FALSE; + } + if (len > size) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + memcpy( buffer, file->sections[index]->name, len * sizeof(WCHAR) ); + return TRUE; + } + index -= file->nb_sections; + } + SetLastError( ERROR_NO_MORE_ITEMS ); + return FALSE; +} + + +/*********************************************************************** * SetupGetLineCountA (SETUPAPI.@) */ LONG WINAPI SetupGetLineCountA( HINF hinf, PCSTR name ) Modified: trunk/reactos/dll/win32/setupapi/setupapi.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupapi.spec?rev=40599&r1=40598&r2=40599&view=diff ============================================================================== --- trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] Mon Apr 20 03:08:05 2009 @@ -390,8 +390,8 @@ @ stdcall SetupDiUnremoveDevice(ptr ptr) @ stub SetupDuplicateDiskSpaceListA @ stub SetupDuplicateDiskSpaceListW -@ stub SetupEnumInfSectionsA -@ stub SetupEnumInfSectionsW +@ stdcall SetupEnumInfSectionsA(long long ptr long ptr) +@ stdcall SetupEnumInfSectionsW(long long ptr long ptr) @ stdcall SetupFindFirstLineA(long str str ptr) @ stdcall SetupFindFirstLineW(long wstr wstr ptr) @ stdcall SetupFindNextLine(ptr ptr)