mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
kernel32-GetFinalPathNameByHandle: Fix warnings in tests on x86_64.
This commit is contained in:
parent
be82b0f592
commit
8cf7585f01
@ -1,4 +1,4 @@
|
||||
From 071454e8a76f0b26cc097434d780c12e472d5c6e Mon Sep 17 00:00:00 2001
|
||||
From 1186a3a107bd3476248f396ba23f46cf35a9286d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 12 Aug 2014 20:25:18 +0200
|
||||
Subject: kernel32/tests: Add tests for GetFinalPathNameByHandle
|
||||
@ -8,7 +8,7 @@ Subject: kernel32/tests: Add tests for GetFinalPathNameByHandle
|
||||
1 file changed, 204 insertions(+)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
|
||||
index 8849eb3..bd92162 100644
|
||||
index 8849eb3..3a94b8d 100644
|
||||
--- a/dlls/kernel32/tests/file.c
|
||||
+++ b/dlls/kernel32/tests/file.c
|
||||
@@ -34,6 +34,7 @@
|
||||
@ -63,23 +63,23 @@ index 8849eb3..bd92162 100644
|
||||
+ SetLastError(0xdeadbeaf);
|
||||
+ count = pGetFinalPathNameByHandleA(INVALID_HANDLE_VALUE, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == 0, "Expected length 0, got %d\n", count);
|
||||
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
|
||||
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %x\n", GetLastError());
|
||||
+
|
||||
+ count = GetTempPathA(MAX_PATH, temp_path);
|
||||
+ ok(count, "Failed to get temp path, error %d\n", GetLastError());
|
||||
+ ok(count, "Failed to get temp path, error %x\n", GetLastError());
|
||||
+ if (!count) return;
|
||||
+
|
||||
+ ret = GetTempFileNameA(temp_path, prefix, 0, test_path);
|
||||
+ ok(ret != 0, "GetTempFileNameA error %d\n", GetLastError());
|
||||
+ ok(ret != 0, "GetTempFileNameA error %x\n", GetLastError());
|
||||
+ if (!ret) return;
|
||||
+
|
||||
+ ret = GetLongPathNameA(test_path, long_path, MAX_PATH);
|
||||
+ ok(ret != 0, "GetLongPathNameA error %d\n", GetLastError());
|
||||
+ ok(ret != 0, "GetLongPathNameA error %x\n", GetLastError());
|
||||
+ if (!ret) return;
|
||||
+
|
||||
+ hFile = CreateFileA(test_path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||
+ CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0);
|
||||
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %d\n", GetLastError());
|
||||
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %x\n", GetLastError());
|
||||
+ if (hFile == INVALID_HANDLE_VALUE) return;
|
||||
+
|
||||
+ dos_path[0] = 0;
|
||||
@ -89,29 +89,29 @@ index 8849eb3..bd92162 100644
|
||||
+ /* Test VOLUME_NAME_DOS with sufficient buffer size */
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %d, got %d\n", strlen(dos_path), count);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ if (count && count <= MAX_PATH)
|
||||
+ ok(lstrcmpiA(dos_path, result_path) == 0, "Expected %s, got %s\n", dos_path, result_path);
|
||||
+
|
||||
+ /* Test VOLUME_NAME_DOS with insufficient buffer size */
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, strlen(dos_path)-2, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %d, got %d\n", strlen(dos_path), count);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ ok(result_path[0] == 0x11, "Result path was modified\n");
|
||||
+
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, strlen(dos_path)-1, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %d, got %d\n", strlen(dos_path), count);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ ok(result_path[0] == 0x11, "Result path was modified\n");
|
||||
+
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, strlen(dos_path), FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %d, got %d\n", strlen(dos_path), count);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ ok(result_path[0] == 0x11, "Result path was modified\n");
|
||||
+
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, strlen(dos_path)+1, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %d, got %d\n", strlen(dos_path), count);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ ok(result_path[0] != 0x11, "Result path was not modified\n");
|
||||
+ ok(result_path[strlen(dos_path)+1] == 0x11, "Buffer overflow\n");
|
||||
+
|
||||
@ -249,5 +249,5 @@ index 8849eb3..bd92162 100644
|
||||
+ test_GetFinalPathNameByHandleW();
|
||||
}
|
||||
--
|
||||
2.1.3
|
||||
2.2.1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user