From d37cb8f5ad85e88201f4800da3adf9d3003a0d1e Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Tue, 31 May 2016 18:02:54 +0000 Subject: [PATCH] =?UTF-8?q?[APPHELP][ACLAYER][APPSHIM=5FAPITEST]=20Fix=20s?= =?UTF-8?q?ome=20WCHAR=20hack=20constructions=20that=20VS=202010=20didn't?= =?UTF-8?q?=20like,=20as=20pointed=20out=20by=20Herm=C3=A8s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=71477 --- reactos/dll/appcompat/apphelp/sdbapi.c | 5 +++-- reactos/dll/appcompat/shims/layer/versionlie.inl | 4 +++- rostests/apitests/appshim/versionlie.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/reactos/dll/appcompat/apphelp/sdbapi.c b/reactos/dll/appcompat/apphelp/sdbapi.c index 4dc1cf6ced8..5d7b0a4dd7a 100644 --- a/reactos/dll/appcompat/apphelp/sdbapi.c +++ b/reactos/dll/appcompat/apphelp/sdbapi.c @@ -443,18 +443,19 @@ void WINAPI SdbCloseDatabase(PDB db) BOOL WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size) { static WCHAR* default_dir = NULL; + static CONST WCHAR szAppPatch[] = {'\\','A','p','p','P','a','t','c','h',0}; if(!default_dir) { WCHAR* tmp = NULL; - UINT len = GetSystemWindowsDirectoryW(NULL, 0) + lstrlenW((CONST WCHAR[]){'\\','A','p','p','P','a','t','c','h',0}); + UINT len = GetSystemWindowsDirectoryW(NULL, 0) + lstrlenW(szAppPatch); tmp = SdbAlloc((len + 1)* sizeof(WCHAR)); if(tmp) { UINT r = GetSystemWindowsDirectoryW(tmp, len+1); if (r && r < len) { - if (SUCCEEDED(StringCchCatW(tmp, len+1, (CONST WCHAR[]){'\\','A','p','p','P','a','t','c','h',0}))) + if (SUCCEEDED(StringCchCatW(tmp, len+1, szAppPatch))) { if(InterlockedCompareExchangePointer((void**)&default_dir, tmp, NULL) == NULL) tmp = NULL; diff --git a/reactos/dll/appcompat/shims/layer/versionlie.inl b/reactos/dll/appcompat/shims/layer/versionlie.inl index 368cf66546b..99970be4ef8 100644 --- a/reactos/dll/appcompat/shims/layer/versionlie.inl +++ b/reactos/dll/appcompat/shims/layer/versionlie.inl @@ -47,12 +47,13 @@ BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason) { if (fdwReason == SHIM_REASON_ATTACH && VERSION_INFO.wServicePackMajor) { + static CONST WCHAR szServicePack[] = {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','%','u',0}; HRESULT hr = StringCbPrintfA(VERSION_INFO.szCSDVersionA, sizeof(VERSION_INFO.szCSDVersionA), "Service Pack %u", VERSION_INFO.wServicePackMajor); if (FAILED(hr)) return FALSE; StringCbPrintfW(VERSION_INFO.szCSDVersionW, sizeof(VERSION_INFO.szCSDVersionW), - (CONST WCHAR[]){'S','e','r','v','i','c','e',' ','P','a','c','k',' ','%','u',0}, VERSION_INFO.wServicePackMajor); + szServicePack, VERSION_INFO.wServicePackMajor); if (FAILED(hr)) return FALSE; } @@ -71,3 +72,4 @@ BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason) #include #undef VERSION_INFO + diff --git a/rostests/apitests/appshim/versionlie.c b/rostests/apitests/appshim/versionlie.c index 6f65947bf3f..be8ca833ac8 100644 --- a/rostests/apitests/appshim/versionlie.c +++ b/rostests/apitests/appshim/versionlie.c @@ -161,6 +161,7 @@ static void verify_shimw_imp(PHOOKAPI hook, const VersionLieInfo* info, PCSTR sh } if (ok1 && ok2) { + static const WCHAR szCSDFMT[] = {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','%','u',0}; WCHAR szCSDVersion[128] = { 0 }; winetest_ok(v1.dwOSVersionInfoSize == v2.dwOSVersionInfoSize, "Expected dwOSVersionInfoSize to be equal, was: %u, %u for %s\n", v1.dwOSVersionInfoSize, v2.dwOSVersionInfoSize, shim); winetest_ok(info->dwMajorVersion == v2.dwMajorVersion, "Expected dwMajorVersion to be equal, was: %u, %u for %s\n", info->dwMajorVersion, v2.dwMajorVersion, shim); @@ -169,7 +170,7 @@ static void verify_shimw_imp(PHOOKAPI hook, const VersionLieInfo* info, PCSTR sh winetest_ok(info->dwPlatformId == v2.dwPlatformId, "Expected dwPlatformId to be equal, was: %u, %u for %s\n", info->dwPlatformId, v2.dwPlatformId, shim); if (info->wServicePackMajor) - swprintf(szCSDVersion, (const WCHAR[]){'S','e','r','v','i','c','e',' ','P','a','c','k',' ','%','u',0}, info->wServicePackMajor); + swprintf(szCSDVersion, szCSDFMT, info->wServicePackMajor); winetest_ok(lstrcmpW(szCSDVersion, v2.szCSDVersion) == 0, "Expected szCSDVersion to be equal, was: %s, %s for %s\n", wine_dbgstr_w(szCSDVersion), wine_dbgstr_w(v2.szCSDVersion), shim); if (v1.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW))