Use the CP_ACP and NULL macros instead of numeric literals when converting strings between ANSI and Unicode.
This commit is contained in:
parent
5844105223
commit
709a0b764d
|
@ -208,7 +208,7 @@ static NTSTATUS WINAPI QueryRoutine (IN PCWSTR ValueName, IN ULONG ValueType, IN
|
||||||
|
|
||||||
ValName = pRtlAllocateHeap(GetProcessHeap(), 0, ValueNameLength);
|
ValName = pRtlAllocateHeap(GetProcessHeap(), 0, ValueNameLength);
|
||||||
|
|
||||||
WideCharToMultiByte(0, 0, ValueName, ValueNameLength+1,ValName, ValueNameLength, 0, 0);
|
WideCharToMultiByte(CP_ACP, 0, ValueName, ValueNameLength+1, ValName, ValueNameLength, NULL, NULL);
|
||||||
|
|
||||||
trace("ValueName: %s\n", ValName);
|
trace("ValueName: %s\n", ValName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
||||||
CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
||||||
to->cbSize = sizeof(CHARFORMAT2W);
|
to->cbSize = sizeof(CHARFORMAT2W);
|
||||||
if (f->dwMask & CFM_FACE) {
|
if (f->dwMask & CFM_FACE) {
|
||||||
MultiByteToWideChar(0, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR));
|
||||||
}
|
}
|
||||||
return to;
|
return to;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
||||||
CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
||||||
/* convert face name */
|
/* convert face name */
|
||||||
if (f->dwMask & CFM_FACE)
|
if (f->dwMask & CFM_FACE)
|
||||||
MultiByteToWideChar(0, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR));
|
||||||
/* copy the rest of the 2A structure to 2W */
|
/* copy the rest of the 2A structure to 2W */
|
||||||
CopyMemory(&to->wWeight, &f->wWeight, sizeof(CHARFORMAT2A)-FIELD_OFFSET(CHARFORMAT2A, wWeight));
|
CopyMemory(&to->wWeight, &f->wWeight, sizeof(CHARFORMAT2A)-FIELD_OFFSET(CHARFORMAT2A, wWeight));
|
||||||
to->cbSize = sizeof(CHARFORMAT2W);
|
to->cbSize = sizeof(CHARFORMAT2W);
|
||||||
|
@ -78,7 +78,7 @@ static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
||||||
{
|
{
|
||||||
CHARFORMATA *t = (CHARFORMATA *)to;
|
CHARFORMATA *t = (CHARFORMATA *)to;
|
||||||
CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
||||||
WideCharToMultiByte(0, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), 0, 0);
|
WideCharToMultiByte(CP_ACP, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), NULL, NULL);
|
||||||
if (from->dwMask & CFM_UNDERLINETYPE)
|
if (from->dwMask & CFM_UNDERLINETYPE)
|
||||||
{
|
{
|
||||||
switch (from->bUnderlineType)
|
switch (from->bUnderlineType)
|
||||||
|
@ -123,7 +123,7 @@ static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
||||||
/* copy the A structure without face name */
|
/* copy the A structure without face name */
|
||||||
CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
||||||
/* convert face name */
|
/* convert face name */
|
||||||
WideCharToMultiByte(0, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), 0, 0);
|
WideCharToMultiByte(CP_ACP, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), NULL, NULL);
|
||||||
/* copy the rest of the 2A structure to 2W */
|
/* copy the rest of the 2A structure to 2W */
|
||||||
CopyMemory(&t->wWeight, &from->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W,wWeight));
|
CopyMemory(&t->wWeight, &from->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W,wWeight));
|
||||||
t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
|
t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
|
||||||
|
|
|
@ -147,7 +147,7 @@ static int StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
|
||||||
TRACE("(%p, %p %s)\n",
|
TRACE("(%p, %p %s)\n",
|
||||||
lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));
|
lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));
|
||||||
|
|
||||||
return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
|
return MultiByteToWideChar(CP_ACP, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
|
||||||
|
|
||||||
}
|
}
|
||||||
static int StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
|
static int StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
|
||||||
|
@ -174,7 +174,7 @@ BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
|
||||||
static BOOL StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
|
static BOOL StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
|
||||||
{
|
{
|
||||||
TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);
|
TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);
|
||||||
return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
|
return MultiByteToWideChar (CP_ACP, 0, lpStrA, nStr, lpWide, nWide);
|
||||||
}
|
}
|
||||||
static BOOL StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
|
static BOOL StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
|
||||||
{
|
{
|
||||||
|
@ -199,7 +199,7 @@ BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)
|
||||||
static BOOL OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
|
static BOOL OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
|
||||||
{
|
{
|
||||||
TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle);
|
TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle);
|
||||||
return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
|
return WideCharToMultiByte (CP_ACP, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
|
static BOOL OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
|
||||||
|
|
|
@ -527,7 +527,7 @@ HRESULT WINAPI SHCreateStreamOnFileA(LPCSTR lpszPath, DWORD dwMode,
|
||||||
if (!lpszPath)
|
if (!lpszPath)
|
||||||
return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
|
return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
|
||||||
|
|
||||||
MultiByteToWideChar(0, 0, lpszPath, -1, szPath, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, szPath, MAX_PATH);
|
||||||
return SHCreateStreamOnFileW(szPath, dwMode, lppStream);
|
return SHCreateStreamOnFileW(szPath, dwMode, lppStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2228,7 +2228,7 @@ DWORD WINAPI SHCopyKeyA(HKEY hKeySrc, LPCSTR lpszSrcSubKey, HKEY hKeyDst, DWORD
|
||||||
TRACE("(hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_a(lpszSrcSubKey), hKeyDst, dwReserved);
|
TRACE("(hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_a(lpszSrcSubKey), hKeyDst, dwReserved);
|
||||||
|
|
||||||
if (lpszSrcSubKey)
|
if (lpszSrcSubKey)
|
||||||
MultiByteToWideChar(0, 0, lpszSrcSubKey, -1, szSubKeyW, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, 0, lpszSrcSubKey, -1, szSubKeyW, MAX_PATH);
|
||||||
|
|
||||||
return SHCopyKeyW(hKeySrc, lpszSrcSubKey ? szSubKeyW : NULL, hKeyDst, dwReserved);
|
return SHCopyKeyW(hKeySrc, lpszSrcSubKey ? szSubKeyW : NULL, hKeyDst, dwReserved);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1887,7 +1887,7 @@ HRESULT WINAPI SHStrDupA(LPCSTR lpszStr, LPWSTR * lppszDest)
|
||||||
|
|
||||||
if (lpszStr)
|
if (lpszStr)
|
||||||
{
|
{
|
||||||
len = MultiByteToWideChar(0, 0, lpszStr, -1, 0, 0) * sizeof(WCHAR);
|
len = MultiByteToWideChar(CP_ACP, 0, lpszStr, -1, NULL, 0) * sizeof(WCHAR);
|
||||||
*lppszDest = CoTaskMemAlloc(len);
|
*lppszDest = CoTaskMemAlloc(len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1895,7 +1895,7 @@ HRESULT WINAPI SHStrDupA(LPCSTR lpszStr, LPWSTR * lppszDest)
|
||||||
|
|
||||||
if (*lppszDest)
|
if (*lppszDest)
|
||||||
{
|
{
|
||||||
MultiByteToWideChar(0, 0, lpszStr, -1, *lppszDest, len/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP, 0, lpszStr, -1, *lppszDest, len/sizeof(WCHAR));
|
||||||
hRet = S_OK;
|
hRet = S_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -128,7 +128,7 @@ static LPWSTR GetWideString(const char* szString)
|
||||||
{
|
{
|
||||||
LPWSTR wszString = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
LPWSTR wszString = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
||||||
|
|
||||||
MultiByteToWideChar(0, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);
|
MultiByteToWideChar(CP_ACP, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);
|
||||||
|
|
||||||
return wszString;
|
return wszString;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ static void test_PathCreateFromUrl(void)
|
||||||
pathW = GetWideString(TEST_PATHFROMURL[i].path);
|
pathW = GetWideString(TEST_PATHFROMURL[i].path);
|
||||||
urlW = GetWideString(TEST_PATHFROMURL[i].url);
|
urlW = GetWideString(TEST_PATHFROMURL[i].url);
|
||||||
ret = pPathCreateFromUrlW(urlW, ret_pathW, &len, 0);
|
ret = pPathCreateFromUrlW(urlW, ret_pathW, &len, 0);
|
||||||
WideCharToMultiByte(CP_ACP, 0, ret_pathW, -1, ret_path, sizeof(ret_path),0,0);
|
WideCharToMultiByte(CP_ACP, 0, ret_pathW, -1, ret_path, sizeof(ret_path),NULL,NULL);
|
||||||
ok(ret == TEST_PATHFROMURL[i].ret, "ret %08x from url L\"%s\"\n", ret, TEST_PATHFROMURL[i].url);
|
ok(ret == TEST_PATHFROMURL[i].ret, "ret %08x from url L\"%s\"\n", ret, TEST_PATHFROMURL[i].url);
|
||||||
if(TEST_PATHFROMURL[i].path) {
|
if(TEST_PATHFROMURL[i].path) {
|
||||||
ok(!lstrcmpiW(ret_pathW, pathW), "got %s expected %s from url L\"%s\"\n",
|
ok(!lstrcmpiW(ret_pathW, pathW), "got %s expected %s from url L\"%s\"\n",
|
||||||
|
|
|
@ -411,7 +411,7 @@ static void test_StrCpyW(void)
|
||||||
|
|
||||||
while(result->value)
|
while(result->value)
|
||||||
{
|
{
|
||||||
MultiByteToWideChar(0,0,result->byte_size_64,-1,szSrc,sizeof(szSrc)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP,0,result->byte_size_64,-1,szSrc,sizeof(szSrc)/sizeof(WCHAR));
|
||||||
|
|
||||||
lpRes = StrCpyW(szBuff, szSrc);
|
lpRes = StrCpyW(szBuff, szSrc);
|
||||||
ok(!StrCmpW(szSrc, szBuff) && lpRes == szBuff, "Copied string %s wrong\n", result->byte_size_64);
|
ok(!StrCmpW(szSrc, szBuff) && lpRes == szBuff, "Copied string %s wrong\n", result->byte_size_64);
|
||||||
|
@ -475,7 +475,7 @@ static void test_StrToIntW(void)
|
||||||
|
|
||||||
while (result->string)
|
while (result->string)
|
||||||
{
|
{
|
||||||
MultiByteToWideChar(0,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
||||||
return_val = StrToIntW(szBuff);
|
return_val = StrToIntW(szBuff);
|
||||||
ok(return_val == result->str_to_int, "converted '%s' wrong (%d)\n",
|
ok(return_val == result->str_to_int, "converted '%s' wrong (%d)\n",
|
||||||
result->string, return_val);
|
result->string, return_val);
|
||||||
|
@ -525,7 +525,7 @@ static void test_StrToIntExW(void)
|
||||||
while (result->string)
|
while (result->string)
|
||||||
{
|
{
|
||||||
return_val = -1;
|
return_val = -1;
|
||||||
MultiByteToWideChar(0,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
||||||
bRet = StrToIntExW(szBuff, 0, &return_val);
|
bRet = StrToIntExW(szBuff, 0, &return_val);
|
||||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||||
result->string);
|
result->string);
|
||||||
|
@ -539,7 +539,7 @@ static void test_StrToIntExW(void)
|
||||||
while (result->string)
|
while (result->string)
|
||||||
{
|
{
|
||||||
return_val = -1;
|
return_val = -1;
|
||||||
MultiByteToWideChar(0,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
||||||
bRet = StrToIntExW(szBuff, STIF_SUPPORT_HEX, &return_val);
|
bRet = StrToIntExW(szBuff, STIF_SUPPORT_HEX, &return_val);
|
||||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||||
result->string);
|
result->string);
|
||||||
|
@ -604,7 +604,7 @@ static void test_StrToInt64ExW(void)
|
||||||
while (result->string)
|
while (result->string)
|
||||||
{
|
{
|
||||||
return_val = -1;
|
return_val = -1;
|
||||||
MultiByteToWideChar(0,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
||||||
bRet = pStrToInt64ExW(szBuff, 0, &return_val);
|
bRet = pStrToInt64ExW(szBuff, 0, &return_val);
|
||||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||||
result->string);
|
result->string);
|
||||||
|
@ -618,7 +618,7 @@ static void test_StrToInt64ExW(void)
|
||||||
while (result->string)
|
while (result->string)
|
||||||
{
|
{
|
||||||
return_val = -1;
|
return_val = -1;
|
||||||
MultiByteToWideChar(0,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
|
||||||
bRet = pStrToInt64ExW(szBuff, STIF_SUPPORT_HEX, &return_val);
|
bRet = pStrToInt64ExW(szBuff, STIF_SUPPORT_HEX, &return_val);
|
||||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||||
result->string);
|
result->string);
|
||||||
|
@ -693,7 +693,7 @@ static void test_StrFormatKBSizeW(void)
|
||||||
while(result->value)
|
while(result->value)
|
||||||
{
|
{
|
||||||
pStrFormatKBSizeW(result->value, szBuffW, 256);
|
pStrFormatKBSizeW(result->value, szBuffW, 256);
|
||||||
WideCharToMultiByte(0,0,szBuffW,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR),0,0);
|
WideCharToMultiByte(CP_ACP,0,szBuffW,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR),NULL,NULL);
|
||||||
|
|
||||||
ok(!strcmp(result->kb_size, szBuff), "Formatted %x%08x wrong: got %s, expected %s\n",
|
ok(!strcmp(result->kb_size, szBuff), "Formatted %x%08x wrong: got %s, expected %s\n",
|
||||||
(LONG)(result->value >> 32), (LONG)result->value, szBuff, result->kb_size);
|
(LONG)(result->value >> 32), (LONG)result->value, szBuff, result->kb_size);
|
||||||
|
|
|
@ -459,7 +459,7 @@ static LPWSTR GetWideString(const char* szString)
|
||||||
{
|
{
|
||||||
LPWSTR wszString = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
LPWSTR wszString = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
||||||
|
|
||||||
MultiByteToWideChar(0, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);
|
MultiByteToWideChar(CP_ACP, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);
|
||||||
|
|
||||||
return wszString;
|
return wszString;
|
||||||
}
|
}
|
||||||
|
@ -1062,7 +1062,7 @@ static void test_UrlCanonicalizeW(void)
|
||||||
BOOL choped;
|
BOOL choped;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, "http://www.winehq.org/X", -1, szUrl, 128);
|
MultiByteToWideChar(CP_ACP, 0, "http://www.winehq.org/X", -1, szUrl, sizeof(szUrl));
|
||||||
pos = lstrlenW(szUrl) - 1;
|
pos = lstrlenW(szUrl) - 1;
|
||||||
szUrl[pos] = i;
|
szUrl[pos] = i;
|
||||||
urllen = INTERNET_MAX_URL_LENGTH;
|
urllen = INTERNET_MAX_URL_LENGTH;
|
||||||
|
@ -1219,7 +1219,7 @@ static void test_UrlIs(void)
|
||||||
test_UrlIs_null(URLIS_URL);
|
test_UrlIs_null(URLIS_URL);
|
||||||
|
|
||||||
for(i = 0; i < sizeof(TEST_PATH_IS_URL) / sizeof(TEST_PATH_IS_URL[0]); i++) {
|
for(i = 0; i < sizeof(TEST_PATH_IS_URL) / sizeof(TEST_PATH_IS_URL[0]); i++) {
|
||||||
MultiByteToWideChar(CP_ACP, 0, TEST_PATH_IS_URL[i].path, -1, wurl, 80);
|
MultiByteToWideChar(CP_ACP, 0, TEST_PATH_IS_URL[i].path, -1, wurl, sizeof(wurl)/sizeof(*wurl));
|
||||||
|
|
||||||
ret = pUrlIsA( TEST_PATH_IS_URL[i].path, URLIS_URL );
|
ret = pUrlIsA( TEST_PATH_IS_URL[i].path, URLIS_URL );
|
||||||
ok( ret == TEST_PATH_IS_URL[i].expect,
|
ok( ret == TEST_PATH_IS_URL[i].expect,
|
||||||
|
@ -1234,7 +1234,7 @@ static void test_UrlIs(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i = 0; i < sizeof(TEST_URLIS_ATTRIBS) / sizeof(TEST_URLIS_ATTRIBS[0]); i++) {
|
for(i = 0; i < sizeof(TEST_URLIS_ATTRIBS) / sizeof(TEST_URLIS_ATTRIBS[0]); i++) {
|
||||||
MultiByteToWideChar(CP_ACP, 0, TEST_URLIS_ATTRIBS[i].url, -1, wurl, 80);
|
MultiByteToWideChar(CP_ACP, 0, TEST_URLIS_ATTRIBS[i].url, -1, wurl, sizeof(wurl)/sizeof(*wurl));
|
||||||
|
|
||||||
ret = pUrlIsA( TEST_URLIS_ATTRIBS[i].url, URLIS_OPAQUE);
|
ret = pUrlIsA( TEST_URLIS_ATTRIBS[i].url, URLIS_OPAQUE);
|
||||||
ok( ret == TEST_URLIS_ATTRIBS[i].expectOpaque,
|
ok( ret == TEST_URLIS_ATTRIBS[i].expectOpaque,
|
||||||
|
|
|
@ -530,7 +530,7 @@ HANDLE WINAPI SHGlobalCounterCreateNamedA(LPCSTR lpszName, DWORD iInitial)
|
||||||
TRACE("(%s,%d)\n", debugstr_a(lpszName), iInitial);
|
TRACE("(%s,%d)\n", debugstr_a(lpszName), iInitial);
|
||||||
|
|
||||||
if (lpszName)
|
if (lpszName)
|
||||||
MultiByteToWideChar(0, 0, lpszName, -1, szBuff, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, 0, lpszName, -1, szBuff, MAX_PATH);
|
||||||
return SHGlobalCounterCreateNamedW(lpszName ? szBuff : NULL, iInitial);
|
return SHGlobalCounterCreateNamedW(lpszName ? szBuff : NULL, iInitial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,8 +266,8 @@ HRESULT WINAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized,
|
||||||
|
|
||||||
ret = UrlCanonicalizeW(url, canonical, pcchCanonicalized, dwFlags);
|
ret = UrlCanonicalizeW(url, canonical, pcchCanonicalized, dwFlags);
|
||||||
if(ret == S_OK)
|
if(ret == S_OK)
|
||||||
WideCharToMultiByte(0, 0, canonical, -1, pszCanonicalized,
|
WideCharToMultiByte(CP_ACP, 0, canonical, -1, pszCanonicalized,
|
||||||
*pcchCanonicalized+1, 0, 0);
|
*pcchCanonicalized+1, NULL, NULL);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, url);
|
HeapFree(GetProcessHeap(), 0, url);
|
||||||
HeapFree(GetProcessHeap(), 0, canonical);
|
HeapFree(GetProcessHeap(), 0, canonical);
|
||||||
|
@ -627,8 +627,8 @@ HRESULT WINAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative,
|
||||||
relative = base + INTERNET_MAX_URL_LENGTH;
|
relative = base + INTERNET_MAX_URL_LENGTH;
|
||||||
combined = relative + INTERNET_MAX_URL_LENGTH;
|
combined = relative + INTERNET_MAX_URL_LENGTH;
|
||||||
|
|
||||||
MultiByteToWideChar(0, 0, pszBase, -1, base, INTERNET_MAX_URL_LENGTH);
|
MultiByteToWideChar(CP_ACP, 0, pszBase, -1, base, INTERNET_MAX_URL_LENGTH);
|
||||||
MultiByteToWideChar(0, 0, pszRelative, -1, relative, INTERNET_MAX_URL_LENGTH);
|
MultiByteToWideChar(CP_ACP, 0, pszRelative, -1, relative, INTERNET_MAX_URL_LENGTH);
|
||||||
len = *pcchCombined;
|
len = *pcchCombined;
|
||||||
|
|
||||||
ret = UrlCombineW(base, relative, pszCombined?combined:NULL, &len, dwFlags);
|
ret = UrlCombineW(base, relative, pszCombined?combined:NULL, &len, dwFlags);
|
||||||
|
@ -638,14 +638,14 @@ HRESULT WINAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
len2 = WideCharToMultiByte(0, 0, combined, len, 0, 0, 0, 0);
|
len2 = WideCharToMultiByte(CP_ACP, 0, combined, len, NULL, 0, NULL, NULL);
|
||||||
if (len2 > *pcchCombined) {
|
if (len2 > *pcchCombined) {
|
||||||
*pcchCombined = len2;
|
*pcchCombined = len2;
|
||||||
HeapFree(GetProcessHeap(), 0, base);
|
HeapFree(GetProcessHeap(), 0, base);
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
}
|
}
|
||||||
WideCharToMultiByte(0, 0, combined, len+1, pszCombined, (*pcchCombined)+1,
|
WideCharToMultiByte(CP_ACP, 0, combined, len+1, pszCombined, (*pcchCombined)+1,
|
||||||
0, 0);
|
NULL, NULL);
|
||||||
*pcchCombined = len2;
|
*pcchCombined = len2;
|
||||||
HeapFree(GetProcessHeap(), 0, base);
|
HeapFree(GetProcessHeap(), 0, base);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -1597,7 +1597,7 @@ HRESULT WINAPI UrlHashW(LPCWSTR pszUrl, unsigned char *lpDest, DWORD nDestLen)
|
||||||
/* Win32 hashes the data as an ASCII string, presumably so that both A+W
|
/* Win32 hashes the data as an ASCII string, presumably so that both A+W
|
||||||
* return the same digests for the same URL.
|
* return the same digests for the same URL.
|
||||||
*/
|
*/
|
||||||
WideCharToMultiByte(0, 0, pszUrl, -1, szUrl, MAX_PATH, 0, 0);
|
WideCharToMultiByte(CP_ACP, 0, pszUrl, -1, szUrl, MAX_PATH, NULL, NULL);
|
||||||
HashData((const BYTE*)szUrl, (int)strlen(szUrl), lpDest, nDestLen);
|
HashData((const BYTE*)szUrl, (int)strlen(szUrl), lpDest, nDestLen);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1666,7 +1666,7 @@ static HRESULT URL_GuessScheme(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut)
|
||||||
WCHAR value[MAX_PATH], data[MAX_PATH];
|
WCHAR value[MAX_PATH], data[MAX_PATH];
|
||||||
WCHAR Wxx, Wyy;
|
WCHAR Wxx, Wyy;
|
||||||
|
|
||||||
MultiByteToWideChar(0, 0,
|
MultiByteToWideChar(CP_ACP, 0,
|
||||||
"Software\\Microsoft\\Windows\\CurrentVersion\\URL\\Prefixes",
|
"Software\\Microsoft\\Windows\\CurrentVersion\\URL\\Prefixes",
|
||||||
-1, reg_path, MAX_PATH);
|
-1, reg_path, MAX_PATH);
|
||||||
RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, 1, &newkey);
|
RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, 1, &newkey);
|
||||||
|
@ -2195,7 +2195,7 @@ HRESULT WINAPI UrlGetPartA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut,
|
||||||
(2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
(2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
||||||
out = in + INTERNET_MAX_URL_LENGTH;
|
out = in + INTERNET_MAX_URL_LENGTH;
|
||||||
|
|
||||||
MultiByteToWideChar(0, 0, pszIn, -1, in, INTERNET_MAX_URL_LENGTH);
|
MultiByteToWideChar(CP_ACP, 0, pszIn, -1, in, INTERNET_MAX_URL_LENGTH);
|
||||||
|
|
||||||
len = INTERNET_MAX_URL_LENGTH;
|
len = INTERNET_MAX_URL_LENGTH;
|
||||||
ret = UrlGetPartW(in, out, &len, dwPart, dwFlags);
|
ret = UrlGetPartW(in, out, &len, dwPart, dwFlags);
|
||||||
|
@ -2205,13 +2205,13 @@ HRESULT WINAPI UrlGetPartA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
len2 = WideCharToMultiByte(0, 0, out, len, 0, 0, 0, 0);
|
len2 = WideCharToMultiByte(CP_ACP, 0, out, len, NULL, 0, NULL, NULL);
|
||||||
if (len2 > *pcchOut) {
|
if (len2 > *pcchOut) {
|
||||||
*pcchOut = len2+1;
|
*pcchOut = len2+1;
|
||||||
HeapFree(GetProcessHeap(), 0, in);
|
HeapFree(GetProcessHeap(), 0, in);
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
}
|
}
|
||||||
len2 = WideCharToMultiByte(0, 0, out, len+1, pszOut, *pcchOut, 0, 0);
|
len2 = WideCharToMultiByte(CP_ACP, 0, out, len+1, pszOut, *pcchOut, NULL, NULL);
|
||||||
*pcchOut = len2-1;
|
*pcchOut = len2-1;
|
||||||
HeapFree(GetProcessHeap(), 0, in);
|
HeapFree(GetProcessHeap(), 0, in);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2525,7 +2525,7 @@ HRESULT WINAPI MLBuildResURLA(LPCSTR lpszLibName, HMODULE hMod, DWORD dwFlags,
|
||||||
hRet = MLBuildResURLW(lpszLibName ? szLibName : NULL, hMod, dwFlags,
|
hRet = MLBuildResURLW(lpszLibName ? szLibName : NULL, hMod, dwFlags,
|
||||||
lpszRes ? szRes : NULL, lpszDest ? szDest : NULL, dwDestLen);
|
lpszRes ? szRes : NULL, lpszDest ? szDest : NULL, dwDestLen);
|
||||||
if (SUCCEEDED(hRet) && lpszDest)
|
if (SUCCEEDED(hRet) && lpszDest)
|
||||||
WideCharToMultiByte(CP_ACP, 0, szDest, -1, lpszDest, dwDestLen, 0, 0);
|
WideCharToMultiByte(CP_ACP, 0, szDest, -1, lpszDest, dwDestLen, NULL, NULL);
|
||||||
|
|
||||||
return hRet;
|
return hRet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,7 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||||
ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
|
ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
|
||||||
ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", GetLastError());
|
ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", GetLastError());
|
||||||
|
|
||||||
MultiByteToWideChar(0, 0, tmpfile, -1, tmpfileW, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, 0, tmpfile, -1, tmpfileW, MAX_PATH);
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0);
|
hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0);
|
||||||
|
@ -573,10 +573,10 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||||
ok(ret, "CryptCATCatalogInfoFromContext failed %u\n", GetLastError());
|
ok(ret, "CryptCATCatalogInfoFromContext failed %u\n", GetLastError());
|
||||||
ok(info.wszCatalogFile[0] != 0, "Expected a filename\n");
|
ok(info.wszCatalogFile[0] != 0, "Expected a filename\n");
|
||||||
}
|
}
|
||||||
WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, 0, 0);
|
WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, NULL, NULL);
|
||||||
if ((p = strrchr(catfile, '\\'))) p++;
|
if ((p = strrchr(catfile, '\\'))) p++;
|
||||||
memset(catfileW, 0, sizeof(catfileW));
|
memset(catfileW, 0, sizeof(catfileW));
|
||||||
MultiByteToWideChar(0, 0, p, -1, catfileW, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, 0, p, -1, catfileW, MAX_PATH);
|
||||||
|
|
||||||
/* Set the file attributes so we can check what happens with them during the 'copy' */
|
/* Set the file attributes so we can check what happens with them during the 'copy' */
|
||||||
attrs = FILE_ATTRIBUTE_READONLY;
|
attrs = FILE_ATTRIBUTE_READONLY;
|
||||||
|
@ -601,7 +601,7 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||||
ret = pCryptCATCatalogInfoFromContext(hcatinfo, &info, 0);
|
ret = pCryptCATCatalogInfoFromContext(hcatinfo, &info, 0);
|
||||||
ok(ret, "CryptCATCatalogInfoFromContext failed %u\n", GetLastError());
|
ok(ret, "CryptCATCatalogInfoFromContext failed %u\n", GetLastError());
|
||||||
ok(info.wszCatalogFile[0] != 0, "Expected a filename\n");
|
ok(info.wszCatalogFile[0] != 0, "Expected a filename\n");
|
||||||
WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, 0, 0);
|
WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, NULL, NULL);
|
||||||
if ((p = strrchr(catfile, '\\'))) p++;
|
if ((p = strrchr(catfile, '\\'))) p++;
|
||||||
ok(!lstrcmpA(basename, p), "Expected %s, got %s\n", basename, p);
|
ok(!lstrcmpA(basename, p), "Expected %s, got %s\n", basename, p);
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ static void getNotepadPath(WCHAR *notepadPathW, DWORD size)
|
||||||
/* Workaround missing W-functions for win9x */
|
/* Workaround missing W-functions for win9x */
|
||||||
GetWindowsDirectoryA(notepadPath, MAX_PATH);
|
GetWindowsDirectoryA(notepadPath, MAX_PATH);
|
||||||
lstrcatA(notepadPath, notepad);
|
lstrcatA(notepadPath, notepad);
|
||||||
MultiByteToWideChar(0, 0, notepadPath, -1, notepadPathW, size);
|
MultiByteToWideChar(CP_ACP, 0, notepadPath, -1, notepadPathW, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creates a test file and returns a handle to it. The file's path is returned
|
/* Creates a test file and returns a handle to it. The file's path is returned
|
||||||
|
|
Loading…
Reference in New Issue