[APPHELP][ACLAYER][APPSHIM_APITEST] Fix some WCHAR hack constructions that VS 2010 didn't like, as pointed out by Hermès

svn path=/trunk/; revision=71477
This commit is contained in:
Mark Jansen 2016-05-31 18:02:54 +00:00
parent 487956500e
commit d37cb8f5ad
3 changed files with 8 additions and 4 deletions

View file

@ -443,18 +443,19 @@ void WINAPI SdbCloseDatabase(PDB db)
BOOL WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size) BOOL WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size)
{ {
static WCHAR* default_dir = NULL; static WCHAR* default_dir = NULL;
static CONST WCHAR szAppPatch[] = {'\\','A','p','p','P','a','t','c','h',0};
if(!default_dir) if(!default_dir)
{ {
WCHAR* tmp = NULL; 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)); tmp = SdbAlloc((len + 1)* sizeof(WCHAR));
if(tmp) if(tmp)
{ {
UINT r = GetSystemWindowsDirectoryW(tmp, len+1); UINT r = GetSystemWindowsDirectoryW(tmp, len+1);
if (r && r < len) 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) if(InterlockedCompareExchangePointer((void**)&default_dir, tmp, NULL) == NULL)
tmp = NULL; tmp = NULL;

View file

@ -47,12 +47,13 @@ BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason)
{ {
if (fdwReason == SHIM_REASON_ATTACH && VERSION_INFO.wServicePackMajor) 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), HRESULT hr = StringCbPrintfA(VERSION_INFO.szCSDVersionA, sizeof(VERSION_INFO.szCSDVersionA),
"Service Pack %u", VERSION_INFO.wServicePackMajor); "Service Pack %u", VERSION_INFO.wServicePackMajor);
if (FAILED(hr)) if (FAILED(hr))
return FALSE; return FALSE;
StringCbPrintfW(VERSION_INFO.szCSDVersionW, sizeof(VERSION_INFO.szCSDVersionW), 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)) if (FAILED(hr))
return FALSE; return FALSE;
} }
@ -71,3 +72,4 @@ BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason)
#include <implement_shim.inl> #include <implement_shim.inl>
#undef VERSION_INFO #undef VERSION_INFO

View file

@ -161,6 +161,7 @@ static void verify_shimw_imp(PHOOKAPI hook, const VersionLieInfo* info, PCSTR sh
} }
if (ok1 && ok2) if (ok1 && ok2)
{ {
static const WCHAR szCSDFMT[] = {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','%','u',0};
WCHAR szCSDVersion[128] = { 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(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); 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); 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) 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); 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)) if (v1.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW))