From cf0892e19e0da9e81e751dca56897b38b37c2b16 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 4 Sep 2015 17:29:32 +0000 Subject: [PATCH] [SETUPAPI] Partially sync query.c with Wine Staging 1.7.47. CORE-9924 svn path=/trunk/; revision=69007 --- reactos/dll/win32/setupapi/query.c | 17 +++++++++++------ reactos/media/doc/README.WINE | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/reactos/dll/win32/setupapi/query.c b/reactos/dll/win32/setupapi/query.c index a916fafba5c..fa9e2a76538 100644 --- a/reactos/dll/win32/setupapi/query.c +++ b/reactos/dll/win32/setupapi/query.c @@ -96,8 +96,13 @@ BOOL WINAPI SetupGetInfInformationA(LPCVOID InfSpec, DWORD SearchControl, if (InfSpec && SearchControl >= INFINFO_INF_NAME_IS_ABSOLUTE) { - len = lstrlenA(InfSpec) + 1; + len = MultiByteToWideChar(CP_ACP, 0, InfSpec, -1, NULL, 0); inf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!inf) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } MultiByteToWideChar(CP_ACP, 0, InfSpec, -1, inf, len); } @@ -112,7 +117,7 @@ BOOL WINAPI SetupGetInfInformationA(LPCVOID InfSpec, DWORD SearchControl, /*********************************************************************** * SetupGetInfInformationW (SETUPAPI.@) - * + * * BUGS * Only handles the case when InfSpec is an INF handle. */ @@ -240,7 +245,7 @@ BOOL WINAPI SetupQueryInfFileInformationA(PSP_INF_INFORMATION InfInformation, */ BOOL WINAPI SetupQueryInfFileInformationW(PSP_INF_INFORMATION InfInformation, UINT InfIndex, PWSTR ReturnBuffer, - DWORD ReturnBufferSize, PDWORD RequiredSize) + DWORD ReturnBufferSize, PDWORD RequiredSize) { DWORD len; LPWSTR ptr; @@ -257,7 +262,7 @@ BOOL WINAPI SetupQueryInfFileInformationW(PSP_INF_INFORMATION InfInformation, if (InfIndex != 0) FIXME("Appended INF files are not handled\n"); - ptr = (LPWSTR)&InfInformation->VersionData[0]; + ptr = (LPWSTR)InfInformation->VersionData; len = lstrlenW(ptr); if (RequiredSize) @@ -589,7 +594,7 @@ BOOL WINAPI SetupGetTargetPathW( HINF hinf, PINFCONTEXT context, PCWSTR section, else { SetLastError( ERROR_INSUFFICIENT_BUFFER ); - HeapFree( GetProcessHeap(), 0, dir ); + if (dir != systemdir) HeapFree( GetProcessHeap(), 0, dir ); return FALSE; } } @@ -656,7 +661,7 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationW( return FALSE; } - inf_path = (LPWSTR)&InfInformation->VersionData[0]; + inf_path = (LPWSTR)InfInformation->VersionData; /* FIXME: we should get OriginalCatalogName from CatalogFile line in * the original inf file and cache it, but that would require building a diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index c52d632a73e..adbf368e631 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -333,6 +333,7 @@ secur32 - reactos/dll/win32/secur32/wrapper.c # Synced to WineStaging-1.7.37 setupapi - + reactos/dll/win32/setupapi/query.c # Partial sync to WineStaging-1.7.47 reactos/dll/win32/setupapi/setupcab.c # Synced to WineStaging-1.7.47 win32k - -- 2.17.1