kernelbase/tests: Enable compilation with long types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-02-28 08:27:35 +01:00 committed by Alexandre Julliard
parent 510542bdef
commit c0096afdb7
4 changed files with 161 additions and 162 deletions

View file

@ -1,4 +1,3 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = kernelbase.dll
C_SRCS = \

View file

@ -368,25 +368,25 @@ static void test_PathAllocCanonicalize(void)
if (0)
{
hr = pPathAllocCanonicalize(NULL, 0, &path_outW);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
}
MultiByteToWideChar(CP_ACP, 0, "C:\\", -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathAllocCanonicalize(path_inW, 0, NULL);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
/* Test longest path */
for (i = 0; i < ARRAY_SIZE(path_maxW) - 1; i++) path_maxW[i] = 'a';
path_maxW[PATHCCH_MAX_CCH] = '\0';
path_outW = (WCHAR *)0xdeadbeef;
hr = pPathAllocCanonicalize(path_maxW, PATHCCH_ALLOW_LONG_PATHS, &path_outW);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#x, got %#x\n",
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#lx, got %#lx\n",
HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), hr);
ok(path_outW == NULL, "expect path_outW null, got %p\n", path_outW);
path_maxW[PATHCCH_MAX_CCH - 1] = '\0';
hr = pPathAllocCanonicalize(path_maxW, PATHCCH_ALLOW_LONG_PATHS, &path_outW);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
LocalFree(path_outW);
/* Check if flags added after Windows 10 1709 are supported */
@ -410,7 +410,7 @@ static void test_PathAllocCanonicalize(void)
MultiByteToWideChar(CP_ACP, 0, t->path_in, -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathAllocCanonicalize(path_inW, t->flags, &path_outW);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path_in, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path_in, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -515,25 +515,25 @@ static void test_PathAllocCombine(void)
resultW = (WCHAR *)0xdeadbeef;
hr = pPathAllocCombine(NULL, NULL, 0, &resultW);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(resultW == NULL, "expect resultW null, got %p\n", resultW);
MultiByteToWideChar(CP_ACP, 0, "\\a", -1, path1W, ARRAY_SIZE(path1W));
hr = pPathAllocCombine(path1W, NULL, 0, &resultW);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
WideCharToMultiByte(CP_ACP, 0, resultW, -1, resultA, ARRAY_SIZE(resultA), NULL, NULL);
ok(!lstrcmpA(resultA, "\\a"), "expect \\a, got %s\n", resultA);
LocalFree(resultW);
MultiByteToWideChar(CP_ACP, 0, "\\b", -1, path2W, ARRAY_SIZE(path2W));
hr = pPathAllocCombine(NULL, path2W, 0, &resultW);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
WideCharToMultiByte(CP_ACP, 0, resultW, -1, resultA, ARRAY_SIZE(resultA), NULL, NULL);
ok(!lstrcmpA(resultA, "\\b"), "expect \\b, got %s\n", resultA);
LocalFree(resultW);
hr = pPathAllocCombine(path1W, path2W, 0, NULL);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
for (i = 0; i < ARRAY_SIZE(combine_tests); i++)
{
@ -542,7 +542,7 @@ static void test_PathAllocCombine(void)
MultiByteToWideChar(CP_ACP, 0, t->path1, -1, path1W, ARRAY_SIZE(path1W));
MultiByteToWideChar(CP_ACP, 0, t->path2, -1, path2W, ARRAY_SIZE(path2W));
hr = pPathAllocCombine(path1W, path2W, 0, &resultW);
ok(hr == S_OK, "combine %s %s expect hr %#x, got %#x\n", t->path1, t->path2, S_OK, hr);
ok(hr == S_OK, "combine %s %s expect hr %#lx, got %#lx\n", t->path1, t->path2, S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, resultW, -1, resultA, ARRAY_SIZE(resultA), NULL, NULL);
@ -569,37 +569,37 @@ static void test_PathCchCombine(void)
}
hr = pPathCchCombine(output, 5, NULL, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
hr = pPathCchCombine(NULL, 2, p1, p2);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
memset(output, 0xff, sizeof(output));
hr = pPathCchCombine(output, 0, p1, p2);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
ok(output[0] == 0xffff, "Expected output buffer to be unchanged\n");
memset(output, 0xff, sizeof(output));
hr = pPathCchCombine(output, 1, p1, p2);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x\n", hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08lx\n", hr);
ok(output[0] == 0, "Expected output buffer to contain NULL string\n");
memset(output, 0xff, sizeof(output));
hr = pPathCchCombine(output, 4, p1, p2);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x\n", hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08lx\n", hr);
ok(output[0] == 0x0, "Expected output buffer to contain NULL string\n");
memset(output, 0xff, sizeof(output));
hr = pPathCchCombine(output, 5, p1, p2);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!lstrcmpW(output, expected), "Combination of %s + %s returned %s, expected %s\n", wine_dbgstr_w(p1),
wine_dbgstr_w(p2), wine_dbgstr_w(output), wine_dbgstr_w(expected));
hr = pPathCchCombine(output, PATHCCH_MAX_CCH + 1, p1, p2);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
hr = pPathCchCombine(output, PATHCCH_MAX_CCH, p1, p2);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
for (i = 0; i < ARRAY_SIZE(combine_tests); i++)
{
@ -608,7 +608,7 @@ static void test_PathCchCombine(void)
MultiByteToWideChar(CP_ACP, 0, combine_tests[i].result, -1, expected, ARRAY_SIZE(expected));
hr = pPathCchCombine(output, ARRAY_SIZE(output), p1, p2);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!lstrcmpW(output, expected), "Combining %s with %s returned %s, expected %s\n", wine_dbgstr_w(p1),
wine_dbgstr_w(p2), wine_dbgstr_w(output), wine_dbgstr_w(expected));
}
@ -631,40 +631,40 @@ static void test_PathCchCombineEx(void)
output[0] = 0xff;
hr = pPathCchCombineEx(output, 5, NULL, NULL, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
ok(output[0] == 0, "Expected output buffer to be empty\n");
output[0] = 0xff;
hr = pPathCchCombineEx(NULL, 2, p1, p2, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
ok(output[0] == 0xff, "Expected output buffer to be unchanged\n");
memset(output, 0xff, sizeof(output));
hr = pPathCchCombineEx(output, 0, p1, p2, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
ok(output[0] == 0xffff, "Expected output buffer to be unchanged\n");
memset(output, 0xff, sizeof(output));
hr = pPathCchCombineEx(output, 1, p1, p2, 0);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x\n", hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08lx\n", hr);
ok(output[0] == 0, "Expected output buffer to contain NULL string\n");
memset(output, 0xff, sizeof(output));
hr = pPathCchCombineEx(output, 4, p1, p2, 0);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x\n", hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08lx\n", hr);
ok(output[0] == 0x0, "Expected output buffer to contain NULL string\n");
output[0] = 0xff;
hr = pPathCchCombineEx(output, PATHCCH_MAX_CCH + 1, p1, p2, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
ok(output[0] == 0xff, "Expected output buffer to be 0xff\n");
hr = pPathCchCombineEx(output, PATHCCH_MAX_CCH, p1, p2, 0);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
memset(output, 0xff, sizeof(output));
hr = pPathCchCombineEx(output, 5, p1, p2, 0);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!lstrcmpW(output, expected),
"Combination of %s + %s returned %s, expected %s\n",
wine_dbgstr_w(p1), wine_dbgstr_w(p2), wine_dbgstr_w(output), wine_dbgstr_w(expected));
@ -676,7 +676,7 @@ static void test_PathCchCombineEx(void)
MultiByteToWideChar(CP_ACP, 0, combine_tests[i].result, -1, expected, MAX_PATH);
hr = pPathCchCombineEx(output, MAX_PATH, p1, p2, 0);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!lstrcmpW(output, expected), "Combining %s with %s returned %s, expected %s\n",
wine_dbgstr_w(p1), wine_dbgstr_w(p2), wine_dbgstr_w(output), wine_dbgstr_w(expected));
}
@ -722,17 +722,17 @@ static void test_PathCchAddBackslash(void)
pathW[0] = 0;
hr = pPathCchAddBackslash(pathW, 0);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Unexpected hr %#x.\n", hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Unexpected hr %#lx.\n", hr);
ok(pathW[0] == 0, "Unexpected path.\n");
pathW[0] = 0;
hr = pPathCchAddBackslash(pathW, 1);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(pathW[0] == 0, "Unexpected path.\n");
pathW[0] = 0;
hr = pPathCchAddBackslash(pathW, 2);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(pathW[0] == 0, "Unexpected path.\n");
for (i = 0; i < ARRAY_SIZE(addbackslash_tests); i++)
@ -742,7 +742,7 @@ static void test_PathCchAddBackslash(void)
MultiByteToWideChar(CP_ACP, 0, test->path, -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchAddBackslash(pathW, test->size);
ok(hr == test->hr, "%u: unexpected return value %#x.\n", i, hr);
ok(hr == test->hr, "%u: unexpected return value %#lx.\n", i, hr);
WideCharToMultiByte(CP_ACP, 0, pathW, -1, path, ARRAY_SIZE(path), NULL, NULL);
ok(!strcmp(path, test->result), "%u: unexpected resulting path %s.\n", i, path);
@ -765,21 +765,21 @@ static void test_PathCchAddBackslashEx(void)
pathW[0] = 0;
hr = pPathCchAddBackslashEx(pathW, 0, NULL, NULL);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Unexpected hr %#x.\n", hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Unexpected hr %#lx.\n", hr);
ok(pathW[0] == 0, "Unexpected path.\n");
pathW[0] = 0;
ptrW = (void *)0xdeadbeef;
remaining = 123;
hr = pPathCchAddBackslashEx(pathW, 1, &ptrW, &remaining);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(pathW[0] == 0, "Unexpected path.\n");
ok(ptrW == pathW, "Unexpected endptr %p.\n", ptrW);
ok(remaining == 1, "Unexpected remaining size.\n");
pathW[0] = 0;
hr = pPathCchAddBackslashEx(pathW, 2, NULL, NULL);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(pathW[0] == 0, "Unexpected path.\n");
for (i = 0; i < ARRAY_SIZE(addbackslash_tests); i++)
@ -789,7 +789,7 @@ static void test_PathCchAddBackslashEx(void)
MultiByteToWideChar(CP_ACP, 0, test->path, -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchAddBackslashEx(pathW, test->size, NULL, NULL);
ok(hr == test->hr, "%u: unexpected return value %#x.\n", i, hr);
ok(hr == test->hr, "%u: unexpected return value %#lx.\n", i, hr);
WideCharToMultiByte(CP_ACP, 0, pathW, -1, path, ARRAY_SIZE(path), NULL, NULL);
ok(!strcmp(path, test->result), "%u: unexpected resulting path %s.\n", i, path);
@ -798,7 +798,7 @@ static void test_PathCchAddBackslashEx(void)
remaining = 123;
MultiByteToWideChar(CP_ACP, 0, test->path, -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchAddBackslashEx(pathW, test->size, &ptrW, &remaining);
ok(hr == test->hr, "%u: unexpected return value %#x.\n", i, hr);
ok(hr == test->hr, "%u: unexpected return value %#lx.\n", i, hr);
if (SUCCEEDED(hr))
{
ok(ptrW == (pathW + lstrlenW(pathW)), "%u: unexpected end pointer.\n", i);
@ -949,16 +949,16 @@ static void test_PathCchAppend(void)
MultiByteToWideChar(CP_ACP, 0, "\\a", -1, path1W, ARRAY_SIZE(path1W));
MultiByteToWideChar(CP_ACP, 0, "\\b", -1, path2W, ARRAY_SIZE(path2W));
hr = pPathCchAppend(NULL, PATHCCH_MAX_CCH, path2W);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchAppend(path1W, 0, path2W);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchAppend(path1W, PATHCCH_MAX_CCH + 1, path2W);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchAppend(path1W, PATHCCH_MAX_CCH, NULL);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
WideCharToMultiByte(CP_ACP, 0, path1W, -1, path1A, ARRAY_SIZE(path1A), NULL, NULL);
ok(!lstrcmpA(path1A, "\\a"), "expect \\a, got %s\n", path1A);
@ -969,7 +969,7 @@ static void test_PathCchAppend(void)
MultiByteToWideChar(CP_ACP, 0, t->path1, -1, path1W, ARRAY_SIZE(path1W));
MultiByteToWideChar(CP_ACP, 0, t->path2, -1, path2W, ARRAY_SIZE(path2W));
hr = pPathCchAppend(path1W, PATHCCH_MAX_CCH, path2W);
ok(hr == S_OK, "append \"%s\" \"%s\" expect hr %#x, got %#x\n", t->path1, t->path2, S_OK, hr);
ok(hr == S_OK, "append \"%s\" \"%s\" expect hr %#lx, got %#lx\n", t->path1, t->path2, S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path1W, -1, path1A, ARRAY_SIZE(path1A), NULL, NULL);
@ -996,23 +996,23 @@ static void test_PathCchAppendEx(void)
MultiByteToWideChar(CP_ACP, 0, "\\a", -1, path1W, ARRAY_SIZE(path1W));
MultiByteToWideChar(CP_ACP, 0, "\\b", -1, path2W, ARRAY_SIZE(path2W));
hr = pPathCchAppendEx(NULL, ARRAY_SIZE(path1W), path2W, 0);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchAppendEx(path1W, 0, path2W, 0);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(path1W[0] == '\\', "expect path1 unchanged\n");
hr = pPathCchAppendEx(path1W, PATHCCH_MAX_CCH + 1, path2W, 0);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(path1W[0] == '\\', "expect path1 unchanged\n");
hr = pPathCchAppendEx(path1W, ARRAY_SIZE(path1W), NULL, 0);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
WideCharToMultiByte(CP_ACP, 0, path1W, -1, path1A, ARRAY_SIZE(path1A), NULL, NULL);
ok(!lstrcmpA(path1A, "\\a"), "expect \\a, got %s\n", path1A);
hr = pPathCchAppendEx(path1W, PATHCCH_MAX_CCH, path2W, 0);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
for (i = 0; i < ARRAY_SIZE(append_tests); i++)
{
@ -1021,7 +1021,7 @@ static void test_PathCchAppendEx(void)
MultiByteToWideChar(CP_ACP, 0, t->path1, -1, path1W, ARRAY_SIZE(path1W));
MultiByteToWideChar(CP_ACP, 0, t->path2, -1, path2W, ARRAY_SIZE(path2W));
hr = pPathCchAppendEx(path1W, PATHCCH_MAX_CCH, path2W, 0);
ok(hr == S_OK, "append \"%s\" \"%s\" expect hr %#x, got %#x\n", t->path1, t->path2, S_OK, hr);
ok(hr == S_OK, "append \"%s\" \"%s\" expect hr %#lx, got %#lx\n", t->path1, t->path2, S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path1W, -1, path1A, ARRAY_SIZE(path1A), NULL, NULL);
@ -1050,23 +1050,23 @@ static void test_PathCchAddExtension(void)
MultiByteToWideChar(CP_ACP, 0, ".exe", -1, extensionW, ARRAY_SIZE(extensionW));
hr = pPathCchAddExtension(NULL, PATHCCH_MAX_CCH, extensionW);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchAddExtension(pathW, 0, extensionW);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchAddExtension(pathW, PATHCCH_MAX_CCH, NULL);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
/* Path length check */
hr = pPathCchAddExtension(pathW, ARRAY_SIZE("C:\\.exe") - 1, extensionW);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect result %#x, got %#x\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect result %#lx, got %#lx\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
hr = pPathCchAddExtension(pathW, PATHCCH_MAX_CCH + 1, extensionW);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchAddExtension(pathW, PATHCCH_MAX_CCH, extensionW);
ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect result %#lx, got %#lx\n", S_OK, hr);
for (i = 0; i < ARRAY_SIZE(addextension_tests); i++)
{
@ -1074,7 +1074,7 @@ static void test_PathCchAddExtension(void)
MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW));
MultiByteToWideChar(CP_ACP, 0, t->extension, -1, extensionW, ARRAY_SIZE(extensionW));
hr = pPathCchAddExtension(pathW, PATHCCH_MAX_CCH, extensionW);
ok(hr == t->hr, "path %s extension %s expect result %#x, got %#x\n", t->path, t->extension, t->hr, hr);
ok(hr == t->hr, "path %s extension %s expect result %#lx, got %#lx\n", t->path, t->extension, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, pathW, -1, pathA, ARRAY_SIZE(pathA), NULL, NULL);
@ -1101,23 +1101,23 @@ static void test_PathCchCanonicalize(void)
if (0)
{
hr = pPathCchCanonicalize(NULL, ARRAY_SIZE(path_outW), path_inW);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
/* MSDN says NULL path_in result in a backslash added to path_out, but the fact is that it would crash */
hr = pPathCchCanonicalize(path_outW, ARRAY_SIZE(path_outW), NULL);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
}
path_inW[0] = 0;
hr = pPathCchCanonicalize(path_outW, 0, path_inW);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
/* Test path length */
for (i = 0; i < MAX_PATH - 3; i++) path_inW[i] = 'a';
path_inW[MAX_PATH - 3] = '\0';
memset(path_outW, 0, sizeof(path_outW));
hr = pPathCchCanonicalize(path_outW, ARRAY_SIZE(path_outW), path_inW);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#x, got %#x %s\n",
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#lx, got %#lx %s\n",
HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), hr, wine_dbgstr_w(path_outW));
ok(!*path_outW, "got %d\n", lstrlenW(path_outW));
@ -1125,15 +1125,15 @@ static void test_PathCchCanonicalize(void)
path_inW[1] = ':';
path_inW[2] = '\\';
hr = pPathCchCanonicalize(path_outW, ARRAY_SIZE(path_outW), path_inW);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
path_inW[MAX_PATH - 4] = '\0';
hr = pPathCchCanonicalize(path_outW, ARRAY_SIZE(path_outW), path_inW);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
/* Insufficient buffer size handling */
hr = pPathCchCanonicalize(path_outW, 1, path_inW);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#x, got %#x\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#lx, got %#lx\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
for (i = 0; i < ARRAY_SIZE(alloccanonicalize_tests); i++)
{
@ -1145,7 +1145,7 @@ static void test_PathCchCanonicalize(void)
MultiByteToWideChar(CP_ACP, 0, t->path_in, -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathCchCanonicalize(path_outW, ARRAY_SIZE(path_outW), path_inW);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path_in, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path_in, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -1158,7 +1158,7 @@ static void test_PathCchCanonicalize(void)
/* Fill a \ at the end of X: if there is enough space */
MultiByteToWideChar(CP_ACP, 0, "C:", -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathCchCanonicalize(path_outW, ARRAY_SIZE(path_outW), path_inW);
ok(hr == S_OK, "path %s expect result %#x, got %#x\n", "C:", S_OK, hr);
ok(hr == S_OK, "path %s expect result %#lx, got %#lx\n", "C:", S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -1169,7 +1169,7 @@ static void test_PathCchCanonicalize(void)
/* Don't fill a \ at the end of X: if there isn't enough space */
MultiByteToWideChar(CP_ACP, 0, "C:", -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathCchCanonicalize(path_outW, 3, path_inW);
ok(hr == S_OK, "path %s expect result %#x, got %#x\n", "C:", S_OK, hr);
ok(hr == S_OK, "path %s expect result %#lx, got %#lx\n", "C:", S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -1179,7 +1179,7 @@ static void test_PathCchCanonicalize(void)
/* Don't fill a \ at the end of X: if there is character following X: */
MultiByteToWideChar(CP_ACP, 0, "C:a", -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathCchCanonicalize(path_outW, ARRAY_SIZE(path_outW), path_inW);
ok(hr == S_OK, "path %s expect result %#x, got %#x\n", "C:a", S_OK, hr);
ok(hr == S_OK, "path %s expect result %#lx, got %#lx\n", "C:a", S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -1205,37 +1205,37 @@ static void test_PathCchCanonicalizeEx(void)
if (0)
{
hr = pPathCchCanonicalizeEx(NULL, ARRAY_SIZE(path_outW), path_inW, 0);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
/* MSDN says NULL path_in result in a backslash added to path_out, but the fact is that it would crash */
hr = pPathCchCanonicalizeEx(path_outW, ARRAY_SIZE(path_outW), NULL, 0);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
}
path_outW[0] = 0xff;
hr = pPathCchCanonicalizeEx(path_outW, 0, path_inW, 0);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(path_outW[0] = 0xff, "expect path_outW unchanged\n");
/* Test path length */
for (i = 0; i < ARRAY_SIZE(path_inW) - 1; i++) path_inW[i] = 'a';
path_inW[PATHCCH_MAX_CCH] = '\0';
hr = pPathCchCanonicalizeEx(path_outW, ARRAY_SIZE(path_outW), path_inW, PATHCCH_ALLOW_LONG_PATHS);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#x, got %#x\n",
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#lx, got %#lx\n",
HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), hr);
path_inW[PATHCCH_MAX_CCH - 1] = '\0';
hr = pPathCchCanonicalizeEx(path_outW, ARRAY_SIZE(path_outW), path_inW, PATHCCH_ALLOW_LONG_PATHS);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
hr = pPathCchCanonicalizeEx(path_outW, 1, path_inW, PATHCCH_ALLOW_LONG_PATHS);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#x, got %#x\n",
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#lx, got %#lx\n",
HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), hr);
/* No root and path > MAX_PATH - 4, return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) */
path_inW[MAX_PATH - 3] = '\0';
hr = pPathCchCanonicalizeEx(path_outW, 1, path_inW, 0);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#x, got %#x\n",
ok(hr == HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), "expect hr %#lx, got %#lx\n",
HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), hr);
/* Has root and path > MAX_PATH - 4 */
@ -1243,23 +1243,23 @@ static void test_PathCchCanonicalizeEx(void)
path_inW[1] = ':';
path_inW[2] = '\\';
hr = pPathCchCanonicalizeEx(path_outW, 1, path_inW, 0);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#x, got %#x\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#lx, got %#lx\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
path_inW[0] = '\\';
path_inW[1] = path_inW[2] = 'a';
hr = pPathCchCanonicalizeEx(path_outW, 1, path_inW, 0);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#x, got %#x\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#lx, got %#lx\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
path_inW[0] = path_inW[1] = '\\';
path_inW[2] = 'a';
hr = pPathCchCanonicalizeEx(path_outW, 1, path_inW, 0);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#x, got %#x\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#lx, got %#lx\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
/* path <= MAX_PATH - 4 */
path_inW[0] = path_inW[1] = path_inW[2] = 'a';
path_inW[MAX_PATH - 4] = '\0';
hr = pPathCchCanonicalizeEx(path_outW, 1, path_inW, 0);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#x, got %#x\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect hr %#lx, got %#lx\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr);
/* Check if flags added after Windows 10 1709 are supported */
MultiByteToWideChar(CP_ACP, 0, "C:\\", -1, path_inW, ARRAY_SIZE(path_inW));
@ -1285,7 +1285,7 @@ static void test_PathCchCanonicalizeEx(void)
MultiByteToWideChar(CP_ACP, 0, t->path_in, -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathCchCanonicalizeEx(path_outW, ARRAY_SIZE(path_outW), path_inW, t->flags);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path_in, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path_in, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -1298,7 +1298,7 @@ static void test_PathCchCanonicalizeEx(void)
/* Fill a \ at the end of X: if there is enough space */
MultiByteToWideChar(CP_ACP, 0, "C:", -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathCchCanonicalizeEx(path_outW, ARRAY_SIZE(path_outW), path_inW, 0);
ok(hr == S_OK, "path %s expect result %#x, got %#x\n", "C:", S_OK, hr);
ok(hr == S_OK, "path %s expect result %#lx, got %#lx\n", "C:", S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -1309,7 +1309,7 @@ static void test_PathCchCanonicalizeEx(void)
/* Don't fill a \ at the end of X: if there isn't enough space */
MultiByteToWideChar(CP_ACP, 0, "C:", -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathCchCanonicalizeEx(path_outW, 3, path_inW, 0);
ok(hr == S_OK, "path %s expect result %#x, got %#x\n", "C:", S_OK, hr);
ok(hr == S_OK, "path %s expect result %#lx, got %#lx\n", "C:", S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -1319,7 +1319,7 @@ static void test_PathCchCanonicalizeEx(void)
/* Don't fill a \ at the end of X: if there is character following X: */
MultiByteToWideChar(CP_ACP, 0, "C:a", -1, path_inW, ARRAY_SIZE(path_inW));
hr = pPathCchCanonicalizeEx(path_outW, ARRAY_SIZE(path_outW), path_inW, 0);
ok(hr == S_OK, "path %s expect result %#x, got %#x\n", "C:a", S_OK, hr);
ok(hr == S_OK, "path %s expect result %#lx, got %#lx\n", "C:a", S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, path_outW, -1, path_outA, ARRAY_SIZE(path_outA), NULL, NULL);
@ -1386,61 +1386,61 @@ static void test_PathCchFindExtension(void)
/* Arguments check */
extension = (const WCHAR *)0xdeadbeef;
hr = pPathCchFindExtension(NULL, PATHCCH_MAX_CCH, &extension);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(extension == NULL, "Expect extension null, got %p\n", extension);
extension = (const WCHAR *)0xdeadbeef;
hr = pPathCchFindExtension(pathW, 0, &extension);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(extension == NULL, "Expect extension null, got %p\n", extension);
/* Crashed on Windows */
if (0)
{
hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, NULL);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
}
/* Path length check */
/* size == PATHCCH_MAX_CCH + 1 */
MultiByteToWideChar(CP_ACP, 0, "C:\\1.exe", -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH + 1, &extension);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
/* Size == path length + 1*/
hr = pPathCchFindExtension(pathW, ARRAY_SIZE("C:\\1.exe"), &extension);
ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect result %#lx, got %#lx\n", S_OK, hr);
ok(*extension == '.', "wrong extension value\n");
/* Size < path length + 1 */
extension = (const WCHAR *)0xdeadbeef;
hr = pPathCchFindExtension(pathW, ARRAY_SIZE("C:\\1.exe") - 1, &extension);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(extension == NULL, "Expect extension null, got %p\n", extension);
/* Size == PATHCCH_MAX_CCH */
hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, &extension);
ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect result %#lx, got %#lx\n", S_OK, hr);
/* Path length + 1 > PATHCCH_MAX_CCH */
for (i = 0; i < ARRAY_SIZE(pathW) - 1; i++) pathW[i] = 'a';
pathW[PATHCCH_MAX_CCH] = 0;
hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, &extension);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
/* Path length + 1 == PATHCCH_MAX_CCH */
pathW[PATHCCH_MAX_CCH - 1] = 0;
hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, &extension);
ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect result %#lx, got %#lx\n", S_OK, hr);
for (i = 0; i < ARRAY_SIZE(findextension_tests); i++)
{
const struct findextension_test *t = findextension_tests + i;
MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, &extension);
ok(hr == S_OK, "path %s expect result %#x, got %#x\n", t->path, S_OK, hr);
ok(hr == S_OK, "path %s expect result %#lx, got %#lx\n", t->path, S_OK, hr);
if (SUCCEEDED(hr))
ok(extension - pathW == t->extension_offset, "path %s expect extension offset %d, got %ld\n", t->path,
ok(extension - pathW == t->extension_offset, "path %s expect extension offset %d, got %Id\n", t->path,
t->extension_offset, (UINT_PTR)(extension - pathW));
}
}
@ -1577,25 +1577,25 @@ static void test_PathCchRemoveBackslash(void)
if (0)
{
hr = pPathCchRemoveBackslash(NULL, PATHCCH_MAX_CCH);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
}
MultiByteToWideChar(CP_ACP, 0, "C:\\a\\", -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchRemoveBackslash(pathW, 0);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRemoveBackslash(pathW, PATHCCH_MAX_CCH + 1);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
hr = pPathCchRemoveBackslash(pathW, PATHCCH_MAX_CCH);
ok(hr == S_FALSE, "expect hr %#x, got %#x\n", S_FALSE, hr);
ok(hr == S_FALSE, "expect hr %#lx, got %#lx\n", S_FALSE, hr);
for (i = 0; i < ARRAY_SIZE(removebackslashex_tests); i++)
{
const struct removebackslashex_test *t = removebackslashex_tests + i;
path_size = MultiByteToWideChar(CP_ACP, 0, t->path_in, -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchRemoveBackslash(pathW, path_size);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path_in, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path_in, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, pathW, -1, pathA, ARRAY_SIZE(pathA), NULL, NULL);
@ -1624,45 +1624,45 @@ static void test_PathCchRemoveBackslashEx(void)
if (0)
{
hr = pPathCchRemoveBackslashEx(NULL, 0, &path_end, &path_size);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
}
path_size = MultiByteToWideChar(CP_ACP, 0, "C:\\a\\", -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchRemoveBackslashEx(pathW, 0, &path_end, &path_size);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
free_size = 0xdeadbeef;
hr = pPathCchRemoveBackslashEx(pathW, path_size, NULL, &free_size);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(free_size == 0, "expect %d, got %lu\n", 0, free_size);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(free_size == 0, "expect %d, got %Iu\n", 0, free_size);
path_end = (WCHAR *)0xdeadbeef;
hr = pPathCchRemoveBackslashEx(pathW, path_size, &path_end, NULL);
ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect hr %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(path_end == NULL, "expect null, got %p\n", path_end);
hr = pPathCchRemoveBackslashEx(pathW, PATHCCH_MAX_CCH + 1, &path_end, &free_size);
ok(hr == S_OK, "expect hr %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect hr %#lx, got %#lx\n", S_OK, hr);
hr = pPathCchRemoveBackslashEx(pathW, PATHCCH_MAX_CCH, &path_end, &free_size);
ok(hr == S_FALSE, "expect hr %#x, got %#x\n", S_FALSE, hr);
ok(hr == S_FALSE, "expect hr %#lx, got %#lx\n", S_FALSE, hr);
/* Size < original path length + 1, don't read beyond size */
MultiByteToWideChar(CP_ACP, 0, "C:\\a", -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchRemoveBackslashEx(pathW, ARRAY_SIZE("C:\\a") - 1, &path_end, &free_size);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
for (i = 0; i < ARRAY_SIZE(removebackslashex_tests); i++)
{
const struct removebackslashex_test *t = removebackslashex_tests + i;
path_size = MultiByteToWideChar(CP_ACP, 0, t->path_in, -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchRemoveBackslashEx(pathW, path_size, &path_end, &free_size);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path_in, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path_in, t->hr, hr);
if (SUCCEEDED(hr))
{
ok(path_end - pathW == t->end_offset, "path %s expect end offset %d, got %ld\n", t->path_in, t->end_offset,
ok(path_end - pathW == t->end_offset, "path %s expect end offset %d, got %Id\n", t->path_in, t->end_offset,
(INT_PTR)(path_end - pathW));
ok(free_size == t->free_size, "path %s expect free size %lu, got %lu\n", t->path_in, t->free_size, free_size);
ok(free_size == t->free_size, "path %s expect free size %Iu, got %Iu\n", t->path_in, t->free_size, free_size);
WideCharToMultiByte(CP_ACP, 0, pathW, -1, pathA, ARRAY_SIZE(pathA), NULL, NULL);
ok(!lstrcmpA(pathA, t->path_out), "path %s expect output path %s, got %s\n", t->path_in, t->path_out,
pathA);
@ -1721,21 +1721,21 @@ static void test_PathCchRemoveExtension(void)
/* Arguments check */
hr = pPathCchRemoveExtension(NULL, PATHCCH_MAX_CCH);
ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRemoveExtension(pathW, 0);
ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRemoveExtension(pathW, PATHCCH_MAX_CCH + 1);
ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRemoveExtension(pathW, PATHCCH_MAX_CCH);
ok(hr == S_FALSE, "expect %#x, got %#x\n", S_FALSE, hr);
ok(hr == S_FALSE, "expect %#lx, got %#lx\n", S_FALSE, hr);
/* Size < original path length + 1 */
MultiByteToWideChar(CP_ACP, 0, "C:\\1.exe", -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchRemoveExtension(pathW, ARRAY_SIZE("C:\\1.exe") - 1);
ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect %#lx, got %#lx\n", E_INVALIDARG, hr);
for (i = 0; i < ARRAY_SIZE(removeextension_tests); i++)
{
@ -1743,7 +1743,7 @@ static void test_PathCchRemoveExtension(void)
MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchRemoveExtension(pathW, ARRAY_SIZE(pathW));
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, pathW, -1, pathA, ARRAY_SIZE(pathA), NULL, NULL);
@ -1854,10 +1854,10 @@ static void test_PathCchRemoveFileSpec(void)
/* Null arguments */
hr = pPathCchRemoveFileSpec(NULL, ARRAY_SIZE(pathW));
ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRemoveFileSpec(pathW, 0);
ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect %#lx, got %#lx\n", E_INVALIDARG, hr);
for (i = 0; i < ARRAY_SIZE(removefilespec_tests); i++)
{
@ -1866,7 +1866,7 @@ static void test_PathCchRemoveFileSpec(void)
MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW));
size = t->size ? t->size : ARRAY_SIZE(pathW);
hr = pPathCchRemoveFileSpec(pathW, size);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, pathW, -1, pathA, ARRAY_SIZE(pathA), NULL, NULL);
@ -1918,23 +1918,23 @@ static void test_PathCchRenameExtension(void)
MultiByteToWideChar(CP_ACP, 0, ".exe", -1, extensionW, ARRAY_SIZE(extensionW));
hr = pPathCchRenameExtension(NULL, PATHCCH_MAX_CCH, extensionW);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRenameExtension(pathW, 0, extensionW);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRenameExtension(pathW, PATHCCH_MAX_CCH, NULL);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
/* Path length */
hr = pPathCchRenameExtension(pathW, ARRAY_SIZE("C:\\1.exe") - 1, extensionW);
ok(E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRenameExtension(pathW, PATHCCH_MAX_CCH + 1, extensionW);
ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchRenameExtension(pathW, PATHCCH_MAX_CCH, extensionW);
ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr);
ok(hr == S_OK, "expect result %#lx, got %#lx\n", S_OK, hr);
for (i = 0; i < ARRAY_SIZE(renameextension_tests); i++)
{
@ -1942,7 +1942,7 @@ static void test_PathCchRenameExtension(void)
MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW));
MultiByteToWideChar(CP_ACP, 0, t->extension, -1, extensionW, ARRAY_SIZE(extensionW));
hr = pPathCchRenameExtension(pathW, PATHCCH_MAX_CCH, extensionW);
ok(hr == S_OK, "path %s extension %s expect result %#x, got %#x\n", t->path, t->extension, S_OK, hr);
ok(hr == S_OK, "path %s extension %s expect result %#lx, got %#lx\n", t->path, t->extension, S_OK, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, pathW, -1, pathA, ARRAY_SIZE(pathA), NULL, NULL);
@ -2058,21 +2058,21 @@ static void test_PathCchSkipRoot(void)
root_end = (const WCHAR *)0xdeadbeef;
hr = pPathCchSkipRoot(NULL, &root_end);
ok(hr == E_INVALIDARG, "Expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "Expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
ok(root_end == (const WCHAR *)0xdeadbeef, "Expect root_end 0xdeadbeef, got %p\n", root_end);
MultiByteToWideChar(CP_ACP, 0, "C:\\", -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchSkipRoot(pathW, NULL);
ok(hr == E_INVALIDARG, "Expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "Expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
for (i = 0; i < ARRAY_SIZE(skiproot_tests); i++)
{
const struct skiproot_test *t = skiproot_tests + i;
MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchSkipRoot(pathW, &root_end);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path, t->hr, hr);
if (SUCCEEDED(hr))
ok(root_end - pathW == t->root_offset, "path %s expect root offset %d, got %ld\n", t->path, t->root_offset,
ok(root_end - pathW == t->root_offset, "path %s expect root offset %d, got %Id\n", t->path, t->root_offset,
(INT_PTR)(root_end - pathW));
}
}
@ -2130,10 +2130,10 @@ static void test_PathCchStripPrefix(void)
/* Null arguments */
hr = pPathCchStripPrefix(NULL, PATHCCH_MAX_CCH);
ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect %#lx, got %#lx\n", E_INVALIDARG, hr);
hr = pPathCchStripPrefix(pathW, 0);
ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "expect %#lx, got %#lx\n", E_INVALIDARG, hr);
for (i = 0; i < ARRAY_SIZE(stripprefix_tests); i++)
{
@ -2142,7 +2142,7 @@ static void test_PathCchStripPrefix(void)
MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW));
size = t->size ? t->size : PATHCCH_MAX_CCH;
hr = pPathCchStripPrefix(pathW, size);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, pathW, -1, stripped_pathA, ARRAY_SIZE(stripped_pathA), NULL, NULL);
@ -2256,11 +2256,11 @@ static void test_PathCchStripToRoot(void)
/* Null arguments */
hr = pPathCchStripToRoot(NULL, ARRAY_SIZE(pathW));
ok(hr == E_INVALIDARG, "Expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "Expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
MultiByteToWideChar(CP_ACP, 0, "C:\\a", -1, pathW, ARRAY_SIZE(pathW));
hr = pPathCchStripToRoot(pathW, 0);
ok(hr == E_INVALIDARG, "Expect result %#x, got %#x\n", E_INVALIDARG, hr);
ok(hr == E_INVALIDARG, "Expect result %#lx, got %#lx\n", E_INVALIDARG, hr);
for (i = 0; i < ARRAY_SIZE(striptoroot_tests); i++)
{
@ -2268,7 +2268,7 @@ static void test_PathCchStripToRoot(void)
MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW));
size = t->size ? t->size : ARRAY_SIZE(pathW);
hr = pPathCchStripToRoot(pathW, size);
ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path, t->hr, hr);
ok(hr == t->hr, "path %s expect result %#lx, got %#lx\n", t->path, t->hr, hr);
if (SUCCEEDED(hr))
{
WideCharToMultiByte(CP_ACP, 0, pathW, -1, rootA, ARRAY_SIZE(rootA), NULL, NULL);
@ -2339,7 +2339,7 @@ static void test_PathIsUNCEx(void)
ret = pPathIsUNCEx(pathW, &server);
ok(ret == t->ret, "path \"%s\" expect return %d, got %d\n", t->path, t->ret, ret);
if (ret)
ok(server == pathW + t->server_offset, "path \"%s\" expect server offset %d, got %ld\n", t->path,
ok(server == pathW + t->server_offset, "path \"%s\" expect server offset %d, got %Id\n", t->path,
t->server_offset, (INT_PTR)(server - pathW));
else
ok(!server, "expect server is null, got %p\n", server);
@ -2356,10 +2356,10 @@ static void test_actctx(void)
BOOL b;
b = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, L"testdll.dll", &data);
ok(b, "FindActCtxSectionString failed: %u\n", GetLastError());
ok(b, "FindActCtxSectionString failed: %lu\n", GetLastError());
b = QueryActCtxW(0, data.hActCtx, &data.ulAssemblyRosterIndex, AssemblyDetailedInformationInActivationContext, buf, sizeof(buf), &size);
ok(b, "QueryActCtx failed: %u\n", GetLastError());
ok(b, "QueryActCtx failed: %lu\n", GetLastError());
GetModuleFileNameW(NULL, exe_path, ARRAY_SIZE(exe_path));
ok(!lstrcmpW(info->lpAssemblyManifestPath, exe_path), "lpAssemblyManifestPath = %s expected %s\n", debugstr_w(info->lpAssemblyManifestPath), debugstr_w(exe_path));

View file

@ -44,46 +44,46 @@ static void test_CompareObjectHandles(void)
}
ret = pCompareObjectHandles( GetCurrentProcess(), GetCurrentProcess() );
ok( ret, "comparing GetCurrentProcess() to self failed with %u\n", GetLastError() );
ok( ret, "comparing GetCurrentProcess() to self failed with %lu\n", GetLastError() );
ret = pCompareObjectHandles( GetCurrentThread(), GetCurrentThread() );
ok( ret, "comparing GetCurrentThread() to self failed with %u\n", GetLastError() );
ok( ret, "comparing GetCurrentThread() to self failed with %lu\n", GetLastError() );
SetLastError(0);
ret = pCompareObjectHandles( GetCurrentProcess(), GetCurrentThread() );
ok( !ret && GetLastError() == ERROR_NOT_SAME_OBJECT,
"comparing GetCurrentProcess() to GetCurrentThread() returned %u\n", GetLastError() );
"comparing GetCurrentProcess() to GetCurrentThread() returned %lu\n", GetLastError() );
h1 = NULL;
ret = DuplicateHandle( GetCurrentProcess(), GetCurrentProcess(), GetCurrentProcess(),
&h1, 0, FALSE, DUPLICATE_SAME_ACCESS );
ok( ret, "failed to duplicate current process handle: %u\n", GetLastError() );
ok( ret, "failed to duplicate current process handle: %lu\n", GetLastError() );
ret = pCompareObjectHandles( GetCurrentProcess(), h1 );
ok( ret, "comparing GetCurrentProcess() with %p failed with %u\n", h1, GetLastError() );
ok( ret, "comparing GetCurrentProcess() with %p failed with %lu\n", h1, GetLastError() );
CloseHandle( h1 );
h1 = CreateFileA( "\\\\.\\NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0 );
ok( h1 != INVALID_HANDLE_VALUE, "CreateFile failed (%d)\n", GetLastError() );
ok( h1 != INVALID_HANDLE_VALUE, "CreateFile failed (%ld)\n", GetLastError() );
h2 = NULL;
ret = DuplicateHandle( GetCurrentProcess(), h1, GetCurrentProcess(),
&h2, 0, FALSE, DUPLICATE_SAME_ACCESS );
ok( ret, "failed to duplicate handle %p: %u\n", h1, GetLastError() );
ok( ret, "failed to duplicate handle %p: %lu\n", h1, GetLastError() );
ret = pCompareObjectHandles( h1, h2 );
ok( ret, "comparing %p with %p failed with %u\n", h1, h2, GetLastError() );
ok( ret, "comparing %p with %p failed with %lu\n", h1, h2, GetLastError() );
CloseHandle( h2 );
h2 = CreateFileA( "\\\\.\\NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0 );
ok( h2 != INVALID_HANDLE_VALUE, "CreateFile failed (%d)\n", GetLastError() );
ok( h2 != INVALID_HANDLE_VALUE, "CreateFile failed (%ld)\n", GetLastError() );
SetLastError(0);
ret = pCompareObjectHandles( h1, h2 );
ok( !ret && GetLastError() == ERROR_NOT_SAME_OBJECT,
"comparing %p with %p returned %u\n", h1, h2, GetLastError() );
"comparing %p with %p returned %lu\n", h1, h2, GetLastError() );
CloseHandle( h2 );
CloseHandle( h1 );

View file

@ -48,7 +48,7 @@ static DWORD WINAPI test_WaitOnAddress_func(void *arg)
ret = pWaitOnAddress(&address, &compare, sizeof(compare), INFINITE);
ok(ret, "wait failed\n");
ok(GetLastError() == 0xdeadbeef || broken(GetLastError() == ERROR_SUCCESS) /* Win 8 */,
"got error %d\n", GetLastError());
"got error %ld\n", GetLastError());
}
} while (InterlockedCompareExchange(&address, compare - 1, compare) != compare);
@ -81,17 +81,17 @@ static void test_WaitOnAddress(void)
SetLastError(0xdeadbeef);
pWakeByAddressSingle(NULL);
gle = GetLastError();
ok(gle == 0xdeadbeef, "got %d\n", gle);
ok(gle == 0xdeadbeef, "got %ld\n", gle);
SetLastError(0xdeadbeef);
pWakeByAddressAll(NULL);
gle = GetLastError();
ok(gle == 0xdeadbeef, "got %d\n", gle);
ok(gle == 0xdeadbeef, "got %ld\n", gle);
SetLastError(0xdeadbeef);
ret = pWaitOnAddress(NULL, NULL, 0, 0);
gle = GetLastError();
ok(gle == ERROR_INVALID_PARAMETER, "got %d\n", gle);
ok(gle == ERROR_INVALID_PARAMETER, "got %ld\n", gle);
ok(!ret, "got %d\n", ret);
address = 0;
@ -99,7 +99,7 @@ static void test_WaitOnAddress(void)
SetLastError(0xdeadbeef);
ret = pWaitOnAddress(&address, &compare, 5, 0);
gle = GetLastError();
ok(gle == ERROR_INVALID_PARAMETER, "got %d\n", gle);
ok(gle == ERROR_INVALID_PARAMETER, "got %ld\n", gle);
ok(!ret, "got %d\n", ret);
ok(address == 0, "got %s\n", wine_dbgstr_longlong(address));
ok(compare == 0, "got %s\n", wine_dbgstr_longlong(compare));
@ -109,13 +109,13 @@ static void test_WaitOnAddress(void)
SetLastError(0xdeadbeef);
pWakeByAddressSingle(&address);
gle = GetLastError();
ok(gle == 0xdeadbeef, "got %d\n", gle);
ok(gle == 0xdeadbeef, "got %ld\n", gle);
ok(address == 0, "got %s\n", wine_dbgstr_longlong(address));
SetLastError(0xdeadbeef);
pWakeByAddressAll(&address);
gle = GetLastError();
ok(gle == 0xdeadbeef, "got %d\n", gle);
ok(gle == 0xdeadbeef, "got %ld\n", gle);
ok(address == 0, "got %s\n", wine_dbgstr_longlong(address));
/* different address size */
@ -124,13 +124,13 @@ static void test_WaitOnAddress(void)
SetLastError(0xdeadbeef);
ret = pWaitOnAddress(&address, &compare, 2, 0);
gle = GetLastError();
ok(gle == 0xdeadbeef || broken(gle == ERROR_SUCCESS) /* Win 8 */, "got %d\n", gle);
ok(gle == 0xdeadbeef || broken(gle == ERROR_SUCCESS) /* Win 8 */, "got %ld\n", gle);
ok(ret, "got %d\n", ret);
SetLastError(0xdeadbeef);
ret = pWaitOnAddress(&address, &compare, 1, 0);
gle = GetLastError();
ok(gle == ERROR_TIMEOUT, "got %d\n", gle);
ok(gle == ERROR_TIMEOUT, "got %ld\n", gle);
ok(!ret, "got %d\n", ret);
/* simple wait case */
@ -139,7 +139,7 @@ static void test_WaitOnAddress(void)
SetLastError(0xdeadbeef);
ret = pWaitOnAddress(&address, &compare, 4, 0);
gle = GetLastError();
ok(gle == 0xdeadbeef || broken(gle == ERROR_SUCCESS) /* Win 8 */, "got %d\n", gle);
ok(gle == 0xdeadbeef || broken(gle == ERROR_SUCCESS) /* Win 8 */, "got %ld\n", gle);
ok(ret, "got %d\n", ret);
/* WakeByAddressAll */
@ -151,7 +151,7 @@ static void test_WaitOnAddress(void)
address = ARRAY_SIZE(threads);
pWakeByAddressAll(&address);
val = WaitForMultipleObjects(ARRAY_SIZE(threads), threads, TRUE, 5000);
ok(val == WAIT_OBJECT_0, "got %d\n", val);
ok(val == WAIT_OBJECT_0, "got %ld\n", val);
for (i = 0; i < ARRAY_SIZE(threads); i++)
CloseHandle(threads[i]);
ok(!address, "got unexpected value %s\n", wine_dbgstr_longlong(address));
@ -168,7 +168,7 @@ static void test_WaitOnAddress(void)
{
pWakeByAddressSingle(&address);
val = WaitForMultipleObjects(nthreads, threads, FALSE, 2000);
ok(val < WAIT_OBJECT_0 + nthreads, "got %u\n", val);
ok(val < WAIT_OBJECT_0 + nthreads, "got %lu\n", val);
CloseHandle(threads[val]);
memmove(&threads[val], &threads[val+1], (nthreads - val - 1) * sizeof(threads[0]));
nthreads--;
@ -195,7 +195,7 @@ static void test_Sleep(void)
/* Get the timer resolution before... */
r1 = 156250;
status = NtQueryTimerResolution(&dummy, &dummy, &r1);
ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%lx)\n", status);
for (i = 0; i < 50; i++) {
Sleep(1);
@ -207,7 +207,7 @@ static void test_Sleep(void)
/* ...and after in case some other process changes it during this test */
r2 = 156250;
status = NtQueryTimerResolution(&dummy, &dummy, &r2);
ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%lx)\n", status);
elapsed_time = (t2.QuadPart - t1.QuadPart) / (double)frequency.QuadPart;
min = 50.0 * (r1 < r2 ? r1 : r2) / 10000000.0;