[PATCH] Explicitly link all tests to IL* calls by ordinals
Nikolay Sivov
nsivov at codeweavers.com
Tue May 25 17:55:21 CDT 2010
---
dlls/shell32/tests/shfldr_special.c | 25 ++++++++++++++++++++-----
dlls/shell32/tests/shlfileop.c | 30 +++++++++++++++++++-----------
dlls/shell32/tests/shlfolder.c | 2 +-
3 files changed, 40 insertions(+), 17 deletions(-)
diff --git a/dlls/shell32/tests/shfldr_special.c b/dlls/shell32/tests/shfldr_special.c
index 24374bc..59eb350 100644
--- a/dlls/shell32/tests/shfldr_special.c
+++ b/dlls/shell32/tests/shfldr_special.c
@@ -33,6 +33,8 @@
#include "wine/test.h"
+static void (WINAPI *pILFree)(LPITEMIDLIST);
+
static inline BOOL SHELL_OsIsUnicode(void)
{
return !(GetVersion() & 0x80000000);
@@ -70,7 +72,7 @@ static void test_parse_for_entire_network(void)
(attr == (expected_attr | SFGAO_CANDELETE | SFGAO_NONENUMERATED)), /* Vista */
"Unexpected attributes : %08x\n", attr);
- ILFree(pidl);
+ pILFree(pidl);
/* Start clean again */
eaten = 0xdeadbeef;
@@ -94,7 +96,7 @@ static void test_parse_for_entire_network(void)
attr == (expected_attr | SFGAO_STORAGEANCESTOR), /* others */
"attr should be 0x%x, not 0x%x\n", expected_attr, attr);
- ILFree(pidl);
+ pILFree(pidl);
}
/* Tests for Control Panel */
@@ -124,7 +126,7 @@ static void test_parse_for_control_panel(void)
(attr == SFGAO_CANLINK), /* Vista, W2K8 */
"Unexpected attributes : %08x\n", attr);
- ILFree(pidl);
+ pILFree(pidl);
}
static void test_printers_folder(void)
@@ -212,15 +214,28 @@ if (0)
ok(ILIsEqual(pidl1, pidl2), "expected same PIDL\n");
IPersistFolder2_Release(pf);
- ILFree(pidl1);
- ILFree(pidl2);
+ pILFree(pidl1);
+ pILFree(pidl2);
IShellFolder2_Release(folder);
CoUninitialize();
}
+static void init_function_pointers(void)
+{
+ HMODULE hmod;
+
+ hmod = GetModuleHandleA("shell32.dll");
+
+#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
+ MAKEFUNC_ORD(ILFree, 155);
+#undef MAKEFUNC_ORD
+}
+
START_TEST(shfldr_special)
{
+ init_function_pointers();
+
test_parse_for_entire_network();
test_parse_for_control_panel();
test_printers_folder();
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c
index 08867c8..a6fc79e 100644
--- a/dlls/shell32/tests/shlfileop.c
+++ b/dlls/shell32/tests/shlfileop.c
@@ -54,23 +54,30 @@ static const WCHAR UNICODE_PATH[] = {'c',':','\\',0x00ae,'\0','\0'};
/* "c:\®" can be used in all codepages */
/* Double-null termination needed for pFrom field of SHFILEOPSTRUCT */
-static HMODULE hshell32;
static int (WINAPI *pSHCreateDirectoryExA)(HWND, LPCSTR, LPSECURITY_ATTRIBUTES);
static int (WINAPI *pSHCreateDirectoryExW)(HWND, LPCWSTR, LPSECURITY_ATTRIBUTES);
static int (WINAPI *pSHFileOperationW)(LPSHFILEOPSTRUCTW);
static DWORD_PTR (WINAPI *pSHGetFileInfoW)(LPCWSTR, DWORD , SHFILEINFOW*, UINT, UINT);
static int (WINAPI *pSHPathPrepareForWriteA)(HWND, IUnknown*, LPCSTR, DWORD);
static int (WINAPI *pSHPathPrepareForWriteW)(HWND, IUnknown*, LPCWSTR, DWORD);
+static void (WINAPI *pILFree)(LPITEMIDLIST);
static void InitFunctionPointers(void)
{
- hshell32 = GetModuleHandleA("shell32.dll");
- pSHCreateDirectoryExA = (void*)GetProcAddress(hshell32, "SHCreateDirectoryExA");
- pSHCreateDirectoryExW = (void*)GetProcAddress(hshell32, "SHCreateDirectoryExW");
- pSHFileOperationW = (void*)GetProcAddress(hshell32, "SHFileOperationW");
- pSHGetFileInfoW = (void*)GetProcAddress(hshell32, "SHGetFileInfoW");
- pSHPathPrepareForWriteA = (void*)GetProcAddress(hshell32, "SHPathPrepareForWriteA");
- pSHPathPrepareForWriteW = (void*)GetProcAddress(hshell32, "SHPathPrepareForWriteW");
+ HMODULE hmod = GetModuleHandleA("shell32.dll");
+
+#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f))
+ MAKEFUNC(SHCreateDirectoryExA);
+ MAKEFUNC(SHCreateDirectoryExW);
+ MAKEFUNC(SHFileOperationW);
+ MAKEFUNC(SHGetFileInfoW);
+ MAKEFUNC(SHPathPrepareForWriteA);
+ MAKEFUNC(SHPathPrepareForWriteW);
+#undef MAKEFUNC
+
+#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
+ MAKEFUNC_ORD(ILFree, 155);
+#undef MAKEFUNC_ORD
}
/* creates a file with the specified name for tests */
@@ -346,7 +353,7 @@ static void test_get_file_info_iconlist(void)
if (!pSHGetFileInfoW)
{
win_skip("SHGetFileInfoW is not available\n");
- ILFree(pidList);
+ pILFree(pidList);
return;
}
@@ -489,7 +496,7 @@ static void test_get_file_info_iconlist(void)
todo_wine ok(shInfow.iIcon==0xcfcfcfcf, "Icon Index Modified\n");
ok(shInfow.dwAttributes!=0xcfcfcfcf,"dwAttributes not set\n");
- ILFree(pidList);
+ pILFree(pidList);
}
@@ -2191,10 +2198,11 @@ static void test_sh_new_link_info(void)
/* source file does not exist */
set_curr_dir_path(linkto, "nosuchfile.txt\0");
set_curr_dir_path(destdir, "testdir2\0");
+ result[0] = 0;
ret = SHGetNewLinkInfoA(linkto, destdir, result, &mustcopy, 0);
ok(ret == FALSE ||
broken(ret == lstrlenA(result) + 1), /* NT4 */
- "SHGetNewLinkInfoA succeeded\n");
+ "SHGetNewLinkInfoA succeeded, got %d, %s\n", ret, result);
ok(mustcopy == FALSE, "mustcopy should be FALSE\n");
/* dest dir does not exist */
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index f63bf6e..897e9d8 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -626,7 +626,7 @@ static void test_GetDisplayName(void)
ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
}
- ILFree(pidlTestFile);
+ pILFree(pidlTestFile);
IShellFolder_Release(psfDesktop);
IShellFolder_Release(psfPersonal);
}
--
1.5.6.5
--------------090306080309070905030300--
More information about the wine-patches
mailing list