Andrew Nguyen : kernel32/tests: Add tests to examine output file part pointer behavior for GetFullPathNameA .
Alexandre Julliard
julliard at winehq.org
Thu Jun 17 11:17:15 CDT 2010
Module: wine
Branch: master
Commit: 70099e897199ebfc5c4baf48c50fd34ccfcb7e6f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=70099e897199ebfc5c4baf48c50fd34ccfcb7e6f
Author: Andrew Nguyen <anguyen at codeweavers.com>
Date: Wed Jun 16 23:40:17 2010 -0500
kernel32/tests: Add tests to examine output file part pointer behavior for GetFullPathNameA.
---
dlls/kernel32/tests/path.c | 56 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index 8232fdf..6fa4d93 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -1569,6 +1569,61 @@ if (0)
"Expected ERROR_INVALID_PARAMETER, got %x\n", GetLastError());
}
+static void test_GetFullPathNameA(void)
+{
+ char output[MAX_PATH], *filepart;
+ DWORD ret;
+ int is_win9x, i;
+
+ const struct
+ {
+ LPCSTR name;
+ DWORD len;
+ LPSTR buffer;
+ LPSTR *lastpart;
+ int win9x_crash;
+ } invalid_parameters[] =
+ {
+ {NULL, 0, NULL, NULL, 1},
+ {NULL, MAX_PATH, NULL, NULL, 1},
+ {NULL, MAX_PATH, output, NULL, 1},
+ {NULL, MAX_PATH, output, &filepart, 1},
+ {"", 0, NULL, NULL},
+ {"", MAX_PATH, NULL, NULL},
+ {"", MAX_PATH, output, NULL},
+ {"", MAX_PATH, output, &filepart},
+ };
+
+ SetLastError(0xdeadbeef);
+ ret = GetFullPathNameW(NULL, 0, NULL, NULL);
+ is_win9x = !ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
+
+ if (is_win9x)
+ win_skip("Skipping some tests that cause GetFullPathNameA to crash on Win9x\n");
+
+ for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++)
+ {
+ if (is_win9x && invalid_parameters[i].win9x_crash)
+ continue;
+
+ SetLastError(0xdeadbeef);
+ strcpy(output, "deadbeef");
+ filepart = (char *)0xdeadbeef;
+ ret = GetFullPathNameA(invalid_parameters[i].name,
+ invalid_parameters[i].len,
+ invalid_parameters[i].buffer,
+ invalid_parameters[i].lastpart);
+ ok(!ret, "[%d] Expected GetFullPathNameA to return 0, got %u\n", i, ret);
+ ok(!strcmp(output, "deadbeef"), "[%d] Expected the output buffer to be unchanged, got \"%s\"\n", i, output);
+ ok(filepart == (char *)0xdeadbeef, "[%d] Expected output file part pointer to be untouched, got %p\n", i, filepart);
+ ok(GetLastError() == 0xdeadbeef ||
+ GetLastError() == ERROR_BAD_PATHNAME || /* Win9x */
+ GetLastError() == ERROR_INVALID_NAME, /* Win7 */
+ "[%d] Expected GetLastError() to return 0xdeadbeef, got %u\n",
+ i, GetLastError());
+ }
+}
+
static void init_pointers(void)
{
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
@@ -1610,4 +1665,5 @@ START_TEST(path)
test_drive_letter_case();
test_SearchPathA();
test_SearchPathW();
+ test_GetFullPathNameA();
}
More information about the wine-cvs
mailing list