Commit 556f384a authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

msvcp120/tests: CreateSymbolicLinkA() may be missing so dynamically load it.

parent 23e8d083
...@@ -276,12 +276,14 @@ static _Pad* (__thiscall *p__Pad_op_assign)(_Pad*, const _Pad*); ...@@ -276,12 +276,14 @@ static _Pad* (__thiscall *p__Pad_op_assign)(_Pad*, const _Pad*);
static void (__thiscall *p__Pad__Launch)(_Pad*, _Thrd_t*); static void (__thiscall *p__Pad__Launch)(_Pad*, _Thrd_t*);
static void (__thiscall *p__Pad__Release)(_Pad*); static void (__thiscall *p__Pad__Release)(_Pad*);
static BOOLEAN (WINAPI *pCreateSymbolicLinkA)(LPCSTR,LPCSTR,DWORD);
static HMODULE msvcp; static HMODULE msvcp;
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
#define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0) #define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
static BOOL init(void) static BOOL init(void)
{ {
HANDLE msvcr; HANDLE hdll;
msvcp = LoadLibraryA("msvcp120.dll"); msvcp = LoadLibraryA("msvcp120.dll");
if(!msvcp) if(!msvcp)
...@@ -512,10 +514,13 @@ static BOOL init(void) ...@@ -512,10 +514,13 @@ static BOOL init(void)
SET(p__Cnd_signal, SET(p__Cnd_signal,
"_Cnd_signal"); "_Cnd_signal");
msvcr = GetModuleHandleA("msvcr120.dll"); hdll = GetModuleHandleA("msvcr120.dll");
p_setlocale = (void*)GetProcAddress(msvcr, "setlocale"); p_setlocale = (void*)GetProcAddress(hdll, "setlocale");
p__setmbcp = (void*)GetProcAddress(msvcr, "_setmbcp"); p__setmbcp = (void*)GetProcAddress(hdll, "_setmbcp");
p_isleadbyte = (void*)GetProcAddress(msvcr, "isleadbyte"); p_isleadbyte = (void*)GetProcAddress(hdll, "isleadbyte");
hdll = GetModuleHandleA("kernel32.dll");
pCreateSymbolicLinkA = (void*)GetProcAddress(hdll, "CreateSymbolicLinkA");
init_thiscall_thunk(); init_thiscall_thunk();
return TRUE; return TRUE;
...@@ -1277,13 +1282,13 @@ static void test_tr2_sys__Stat(void) ...@@ -1277,13 +1282,13 @@ static void test_tr2_sys__Stat(void)
ok(file != INVALID_HANDLE_VALUE, "create file failed: INVALID_HANDLE_VALUE\n"); ok(file != INVALID_HANDLE_VALUE, "create file failed: INVALID_HANDLE_VALUE\n");
ok(CloseHandle(file), "CloseHandle\n"); ok(CloseHandle(file), "CloseHandle\n");
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CreateSymbolicLinkA("tr2_test_dir/f1_link", "tr2_test_dir/f1", 0); ret = pCreateSymbolicLinkA ? pCreateSymbolicLinkA("tr2_test_dir/f1_link", "tr2_test_dir/f1", 0) : FALSE;
if(!ret && (GetLastError()==ERROR_PRIVILEGE_NOT_HELD||GetLastError()==ERROR_INVALID_FUNCTION)) { if(!ret && (!pCreateSymbolicLinkA || GetLastError()==ERROR_PRIVILEGE_NOT_HELD||GetLastError()==ERROR_INVALID_FUNCTION)) {
tests[5].ret = tests[6].ret = file_not_found; tests[5].ret = tests[6].ret = file_not_found;
win_skip("Privilege not held or symbolic link not supported, skipping symbolic link tests.\n"); win_skip("Privilege not held or symbolic link not supported, skipping symbolic link tests.\n");
}else { }else {
ok(ret, "CreateSymbolicLinkA failed\n"); ok(ret, "CreateSymbolicLinkA failed\n");
ok(CreateSymbolicLinkA("tr2_test_dir/dir_link", "tr2_test_dir", 1), "CreateSymbolicLinkA failed\n"); ok(pCreateSymbolicLinkA("tr2_test_dir/dir_link", "tr2_test_dir", 1), "CreateSymbolicLinkA failed\n");
} }
file = CreateNamedPipeA("\\\\.\\PiPe\\tests_pipe.c", file = CreateNamedPipeA("\\\\.\\PiPe\\tests_pipe.c",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment