setupapi-SetupPromptForDisk: Fix warnings in tests on x86_64.

This commit is contained in:
Sebastian Lackner 2015-01-24 10:26:31 +01:00
parent 791f33b9b7
commit 0d7e53d834

View File

@ -1,4 +1,4 @@
From 9e0151529b75e31633273f08fe627f322955bf53 Mon Sep 17 00:00:00 2001
From 7e2c3085b0a0054c0bfbc8e1779dacd6b5be895a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 5 Oct 2014 23:53:39 +0200
Subject: setupapi/tests: Add test for IDF_CHECKFIRST and
@ -24,7 +24,7 @@ index 30902e7..3531381 100644
misc.c \
diff --git a/dlls/setupapi/tests/dialog.c b/dlls/setupapi/tests/dialog.c
new file mode 100644
index 0000000..4cb0bea
index 0000000..973b1fc
--- /dev/null
+++ b/dlls/setupapi/tests/dialog.c
@@ -0,0 +1,107 @@
@ -69,28 +69,28 @@ index 0000000..4cb0bea
+ DWORD length;
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, sizeof(buffer)-1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == strlen(path)+1, "Expect length %d, got %d\n", strlen(path)+1, length);
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, sizeof(buffer) - 1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
+ ok(length == strlen(path)+1, "Expect length %u, got %u\n", (DWORD)strlen(path) + 1, length);
+ ok(strcmp(path, buffer) == 0, "Expected path %s, got %s\n", path, buffer);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, 0, 0, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == strlen(path)+1, "Expect length %d, got %d\n", strlen(path)+1, length);
+ ok(length == strlen(path)+1, "Expect length %u, got %u\n", (DWORD)strlen(path) + 1, length);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, 1, &length);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %d\n", ret);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %u\n", ret);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, strlen(path), &length);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %d\n", ret);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %u\n", ret);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, strlen(path)+1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == strlen(path)+1, "Expect length %d, got %d\n", strlen(path)+1, length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
+ ok(length == strlen(path)+1, "Expect length %u, got %u\n", (DWORD)strlen(path) + 1, length);
+ ok(strcmp(path, buffer) == 0, "Expected path %s, got %s\n", path, buffer);
+}
+
@ -106,27 +106,27 @@ index 0000000..4cb0bea
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, MAX_PATH-1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %d, got %d\n", lstrlenW(path)+1, length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %u, got %u\n", lstrlenW(path)+1, length);
+ ok(lstrcmpW(path, buffer) == 0, "Expected path %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(buffer));
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, 0, 0, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %d, got %d\n", lstrlenW(path)+1, length);
+ ok(length == lstrlenW(path)+1, "Expect length %u, got %u\n", lstrlenW(path)+1, length);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, 1, &length);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %d\n", ret);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %u\n", ret);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, lstrlenW(path), &length);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %d\n", ret);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %u\n", ret);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, lstrlenW(path)+1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %d, got %d\n", lstrlenW(path)+1, length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %u, got %u\n", lstrlenW(path)+1, length);
+ ok(lstrcmpW(path, buffer) == 0, "Expected path %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(buffer));
+}
+
@ -137,5 +137,5 @@ index 0000000..4cb0bea
+}
\ No newline at end of file
--
1.9.1
2.2.1