kernel32/tests: Link to more functions directly.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-09-22 13:24:19 +03:00 committed by Alexandre Julliard
parent 7e564c4304
commit bce9cdcc98
8 changed files with 71 additions and 178 deletions

View File

@ -29,7 +29,6 @@
#include "oaidl.h"
#include "initguid.h"
static BOOL (WINAPI *pIsDebuggerPresent)(void);
static BOOL (WINAPI *pQueryActCtxSettingsW)(DWORD,HANDLE,LPCWSTR,LPCWSTR,LPWSTR,SIZE_T,SIZE_T*);
static NTSTATUS(NTAPI *pRtlFindActivationContextSectionString)(DWORD,const GUID *,ULONG,PUNICODE_STRING,PACTCTX_SECTION_KEYED_DATA);
@ -2016,7 +2015,7 @@ static void test_actctx(void)
test_detailed_info(handle, &detailed_info1, __LINE__);
test_info_in_assembly(handle, 1, &manifest1_info, __LINE__);
if (pIsDebuggerPresent && !pIsDebuggerPresent())
if (!IsDebuggerPresent())
{
/* CloseHandle will generate an exception if a debugger is present */
b = CloseHandle(handle);
@ -2714,7 +2713,6 @@ static BOOL init_funcs(void)
HMODULE hLibrary = GetModuleHandleA("kernel32.dll");
#define X(f) if (!(p##f = (void*)GetProcAddress(hLibrary, #f))) return FALSE;
X(IsDebuggerPresent);
pQueryActCtxSettingsW = (void *)GetProcAddress( hLibrary, "QueryActCtxSettingsW" );
hLibrary = GetModuleHandleA("ntdll.dll");

View File

@ -34,20 +34,17 @@ static CHAR string[MAX_PATH];
static BOOL (WINAPI *pGetComputerNameExA)(COMPUTER_NAME_FORMAT,LPSTR,LPDWORD);
static BOOL (WINAPI *pGetComputerNameExW)(COMPUTER_NAME_FORMAT,LPWSTR,LPDWORD);
static BOOL (WINAPI *pOpenProcessToken)(HANDLE,DWORD,PHANDLE);
static BOOL (WINAPI *pGetUserProfileDirectoryA)(HANDLE,LPSTR,LPDWORD);
static BOOL (WINAPI *pSetEnvironmentStringsW)(WCHAR *);
static void init_functionpointers(void)
{
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE huserenv = LoadLibraryA("userenv.dll");
pGetComputerNameExA = (void *)GetProcAddress(hkernel32, "GetComputerNameExA");
pGetComputerNameExW = (void *)GetProcAddress(hkernel32, "GetComputerNameExW");
pSetEnvironmentStringsW = (void *)GetProcAddress(hkernel32, "SetEnvironmentStringsW");
pOpenProcessToken = (void *)GetProcAddress(hadvapi32, "OpenProcessToken");
pGetUserProfileDirectoryA = (void *)GetProcAddress(huserenv,
"GetUserProfileDirectoryA");
}
@ -65,12 +62,12 @@ static void test_Predefined(void)
* Check value of %USERPROFILE%, should be same as GetUserProfileDirectory()
* If this fails, your test environment is probably not set up
*/
if (pOpenProcessToken == NULL || pGetUserProfileDirectoryA == NULL)
if (pGetUserProfileDirectoryA == NULL)
{
skip("Skipping USERPROFILE check\n");
return;
}
NoErr = pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &Token);
NoErr = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &Token);
ok(NoErr, "Failed to open token, error %u\n", GetLastError());
DataSize = sizeof(Data);
NoErr = pGetUserProfileDirectoryA(Token, Data, &DataSize);

View File

@ -38,11 +38,9 @@
#undef DeleteFile /* needed for FILE_DISPOSITION_INFO */
static HANDLE (WINAPI *pFindFirstFileExA)(LPCSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
static BOOL (WINAPI *pReplaceFileA)(LPCSTR, LPCSTR, LPCSTR, DWORD, LPVOID, LPVOID);
static BOOL (WINAPI *pReplaceFileW)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPVOID, LPVOID);
static UINT (WINAPI *pGetSystemWindowsDirectoryA)(LPSTR, UINT);
static BOOL (WINAPI *pGetVolumeNameForVolumeMountPointA)(LPCSTR, LPSTR, DWORD);
static DWORD (WINAPI *pQueueUserAPC)(PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData);
static BOOL (WINAPI *pGetFileInformationByHandleEx)(HANDLE, FILE_INFO_BY_HANDLE_CLASS, LPVOID, DWORD);
static HANDLE (WINAPI *pOpenFileById)(HANDLE, LPFILE_ID_DESCRIPTOR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD);
static BOOL (WINAPI *pSetFileValidData)(HANDLE, LONGLONG);
@ -95,11 +93,9 @@ static void InitFunctionPointers(void)
pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
pFindFirstFileExA=(void*)GetProcAddress(hkernel32, "FindFirstFileExA");
pReplaceFileA=(void*)GetProcAddress(hkernel32, "ReplaceFileA");
pReplaceFileW=(void*)GetProcAddress(hkernel32, "ReplaceFileW");
pGetSystemWindowsDirectoryA=(void*)GetProcAddress(hkernel32, "GetSystemWindowsDirectoryA");
pGetVolumeNameForVolumeMountPointA = (void *) GetProcAddress(hkernel32, "GetVolumeNameForVolumeMountPointA");
pQueueUserAPC = (void *) GetProcAddress(hkernel32, "QueueUserAPC");
pGetFileInformationByHandleEx = (void *) GetProcAddress(hkernel32, "GetFileInformationByHandleEx");
pOpenFileById = (void *) GetProcAddress(hkernel32, "OpenFileById");
pSetFileValidData = (void *) GetProcAddress(hkernel32, "SetFileValidData");
@ -3149,11 +3145,8 @@ static void test_read_write(void)
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA: error %d\n", GetLastError());
user_apc_ran = FALSE;
if (pQueueUserAPC) {
trace("Queueing an user APC\n"); /* verify the file is non alerable */
ret = pQueueUserAPC(&user_apc, GetCurrentThread(), 0);
ok(ret, "QueueUserAPC failed: %d\n", GetLastError());
}
ret = QueueUserAPC(&user_apc, GetCurrentThread(), 0);
ok(ret, "QueueUserAPC failed: %d\n", GetLastError());
SetLastError(12345678);
bytes = 12345678;
@ -3192,8 +3185,7 @@ static void test_read_write(void)
ok(!bytes, "bytes = %d\n", bytes);
ok(user_apc_ran == FALSE, "UserAPC ran, file using alertable io mode\n");
if (pQueueUserAPC)
SleepEx(0, TRUE); /* get rid of apc */
SleepEx(0, TRUE); /* get rid of apc */
/* test passing protected memory as buffer */
@ -3593,12 +3585,6 @@ static void test_ReplaceFileA(void)
BOOL retok, removeBackup = FALSE;
char **argv;
if (!pReplaceFileA)
{
win_skip("ReplaceFileA() is missing\n");
return;
}
ret = GetTempPathA(MAX_PATH, temp_path);
ok(ret != 0, "GetTempPathA error %d\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
@ -3664,7 +3650,7 @@ static void test_ReplaceFileA(void)
* TODO: flags are not implemented
*/
SetLastError(0xdeadbeef);
ret = pReplaceFileA(replaced, replacement, backup, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, backup, 0, 0, 0);
ok(ret, "ReplaceFileA: unexpected error %d\n", GetLastError());
/* make sure that the backup has the size of the old "replaced" file */
hBackupFile = CreateFileA(backup, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
@ -3710,7 +3696,7 @@ static void test_ReplaceFileA(void)
* TODO: flags are not implemented
*/
SetLastError(0xdeadbeef);
ret = pReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ok(ret || GetLastError() == ERROR_ACCESS_DENIED,
"ReplaceFileA: unexpected error %d\n", GetLastError());
@ -3724,7 +3710,7 @@ static void test_ReplaceFileA(void)
* TODO: flags are not implemented
*/
SetLastError(0xdeadbeef);
ret = pReplaceFileA(replaced, replacement, backup, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, backup, 0, 0, 0);
ok(ret || GetLastError() == ERROR_ACCESS_DENIED,
"ReplaceFileA: unexpected error %d\n", GetLastError());
if (ret)
@ -3741,7 +3727,7 @@ static void test_ReplaceFileA(void)
* TODO: flags are not implemented
*/
SetLastError(0xdeadbeef);
ret = pReplaceFileA(replaced, replacement, backup, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, backup, 0, 0, 0);
ok(ret == 0 && GetLastError() == ERROR_ACCESS_DENIED, "ReplaceFileA: unexpected error %d\n", GetLastError());
/* make sure that the replacement file still exists */
hReplacementFile = CreateFileA(replacement, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
@ -3759,7 +3745,7 @@ static void test_ReplaceFileA(void)
ok(ret != 0, "GetTempFileNameA error (replacement) %#x\n", GetLastError());
ret = SetFileAttributesA(replacement, FILE_ATTRIBUTE_READONLY);
ok(ret, "SetFileAttributesA: error setting to readonly %#x\n", GetLastError());
ret = pReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ok(GetLastError() == ERROR_ACCESS_DENIED, "ReplaceFileA: unexpected error %#x\n", GetLastError());
ret = SetFileAttributesA(replacement, FILE_ATTRIBUTE_NORMAL);
ok(ret, "SetFileAttributesA: error setting to normal %#x\n", GetLastError());
@ -3777,7 +3763,7 @@ static void test_ReplaceFileA(void)
ok(hReplacedFile != INVALID_HANDLE_VALUE,
"unexpected error, replaced file should be able to be opened %d\n", GetLastError());
/*Calling ReplaceFileA on an exe should succeed*/
ret = pReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ok(ret, "ReplaceFileA: unexpected error %d\n", GetLastError());
CloseHandle(hReplacedFile);
@ -3787,7 +3773,7 @@ static void test_ReplaceFileA(void)
hReplacementFile = CreateFileA(replacement, GENERIC_READ | SYNCHRONIZE, FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, 0);
ok(hReplacementFile != INVALID_HANDLE_VALUE, "unexpected error, replacement file should be able to be opened %d\n",
GetLastError());
ret = pReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ok(!ret, "expect failure\n");
ok(GetLastError() == ERROR_SHARING_VIOLATION, "expect ERROR_SHARING_VIOLATION, got %#x.\n", GetLastError());
CloseHandle(hReplacementFile);
@ -3800,7 +3786,7 @@ static void test_ReplaceFileA(void)
* TODO: flags are not implemented
*/
SetLastError(0xdeadbeef);
ret = pReplaceFileA(replaced, replacement, backup, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, backup, 0, 0, 0);
ok(!ret && (GetLastError() == ERROR_FILE_NOT_FOUND ||
GetLastError() == ERROR_ACCESS_DENIED),
"ReplaceFileA: unexpected error %d\n", GetLastError());
@ -3809,7 +3795,7 @@ static void test_ReplaceFileA(void)
* TODO: flags are not implemented
*/
SetLastError(0xdeadbeef);
ret = pReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ret = ReplaceFileA(replaced, replacement, NULL, 0, 0, 0);
ok(!ret && (GetLastError() == ERROR_FILE_NOT_FOUND ||
GetLastError() == ERROR_ACCESS_DENIED),
"ReplaceFileA: unexpected error %d\n", GetLastError());

View File

@ -36,7 +36,6 @@
static HANDLE alarm_event;
static BOOL (WINAPI *pDuplicateTokenEx)(HANDLE,DWORD,LPSECURITY_ATTRIBUTES,
SECURITY_IMPERSONATION_LEVEL,TOKEN_TYPE,PHANDLE);
static DWORD (WINAPI *pQueueUserAPC)(PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData);
static BOOL (WINAPI *pCancelIoEx)(HANDLE handle, LPOVERLAPPED lpOverlapped);
static BOOL (WINAPI *pGetNamedPipeClientProcessId)(HANDLE,ULONG*);
static BOOL (WINAPI *pGetNamedPipeServerProcessId)(HANDLE,ULONG*);
@ -908,9 +907,10 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
user_apc_ran = FALSE;
if (i == 0 && pQueueUserAPC) {
if (i == 0)
{
if (winetest_debug > 1) trace("Queueing an user APC\n"); /* verify the pipe is non alerable */
ret = pQueueUserAPC(&user_apc, GetCurrentThread(), 0);
ret = QueueUserAPC(&user_apc, GetCurrentThread(), 0);
ok(ret, "QueueUserAPC failed: %d\n", GetLastError());
}
@ -939,7 +939,7 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
ok(user_apc_ran == FALSE, "UserAPC ran, pipe using alertable io mode\n");
if (i == 0 && pQueueUserAPC)
if (i == 0)
SleepEx(0, TRUE); /* get rid of apc */
/* Set up next echo server */
@ -1530,8 +1530,7 @@ static void test_CreatePipe(void)
char readbuf[32];
user_apc_ran = FALSE;
if (pQueueUserAPC)
ok(pQueueUserAPC(user_apc, GetCurrentThread(), 0), "couldn't create user apc\n");
ok(QueueUserAPC(user_apc, GetCurrentThread(), 0), "couldn't create user apc\n");
pipe_attr.nLength = sizeof(SECURITY_ATTRIBUTES);
pipe_attr.bInheritHandle = TRUE;
@ -4126,7 +4125,6 @@ START_TEST(pipe)
hmod = GetModuleHandleA("advapi32.dll");
pDuplicateTokenEx = (void *) GetProcAddress(hmod, "DuplicateTokenEx");
hmod = GetModuleHandleA("kernel32.dll");
pQueueUserAPC = (void *) GetProcAddress(hmod, "QueueUserAPC");
pCancelIoEx = (void *) GetProcAddress(hmod, "CancelIoEx");
pGetNamedPipeClientProcessId = (void *) GetProcAddress(hmod, "GetNamedPipeClientProcessId");
pGetNamedPipeServerProcessId = (void *) GetProcAddress(hmod, "GetNamedPipeServerProcessId");

View File

@ -67,8 +67,6 @@ static void (WINAPI *pGetNativeSystemInfo)(LPSYSTEM_INFO);
static BOOL (WINAPI *pGetSystemRegistryQuota)(PDWORD, PDWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE,PBOOL);
static BOOL (WINAPI *pIsWow64Process2)(HANDLE, USHORT *, USHORT *);
static LPVOID (WINAPI *pVirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD);
static BOOL (WINAPI *pVirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD);
static BOOL (WINAPI *pQueryFullProcessImageNameA)(HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD lpdwSize);
static BOOL (WINAPI *pQueryFullProcessImageNameW)(HANDLE hProcess, DWORD dwFlags, LPWSTR lpExeName, PDWORD lpdwSize);
static DWORD (WINAPI *pK32GetProcessImageFileNameA)(HANDLE,LPSTR,DWORD);
@ -81,7 +79,6 @@ static BOOL (WINAPI *pSetInformationJobObject)(HANDLE job, JOBOBJECTINFOCLASS
static HANDLE (WINAPI *pCreateIoCompletionPort)(HANDLE file, HANDLE existing_port, ULONG_PTR key, DWORD threads);
static BOOL (WINAPI *pGetNumaProcessorNode)(UCHAR, PUCHAR);
static NTSTATUS (WINAPI *pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
static BOOL (WINAPI *pProcessIdToSessionId)(DWORD,DWORD*);
static DWORD (WINAPI *pWTSGetActiveConsoleSessionId)(void);
static HANDLE (WINAPI *pCreateToolhelp32Snapshot)(DWORD, DWORD);
static BOOL (WINAPI *pProcess32First)(HANDLE, PROCESSENTRY32*);
@ -251,8 +248,6 @@ static BOOL init(void)
pGetSystemRegistryQuota = (void *) GetProcAddress(hkernel32, "GetSystemRegistryQuota");
pIsWow64Process = (void *) GetProcAddress(hkernel32, "IsWow64Process");
pIsWow64Process2 = (void *) GetProcAddress(hkernel32, "IsWow64Process2");
pVirtualAllocEx = (void *) GetProcAddress(hkernel32, "VirtualAllocEx");
pVirtualFreeEx = (void *) GetProcAddress(hkernel32, "VirtualFreeEx");
pQueryFullProcessImageNameA = (void *) GetProcAddress(hkernel32, "QueryFullProcessImageNameA");
pQueryFullProcessImageNameW = (void *) GetProcAddress(hkernel32, "QueryFullProcessImageNameW");
pK32GetProcessImageFileNameA = (void *) GetProcAddress(hkernel32, "K32GetProcessImageFileNameA");
@ -264,7 +259,6 @@ static BOOL init(void)
pSetInformationJobObject = (void *)GetProcAddress(hkernel32, "SetInformationJobObject");
pCreateIoCompletionPort = (void *)GetProcAddress(hkernel32, "CreateIoCompletionPort");
pGetNumaProcessorNode = (void *)GetProcAddress(hkernel32, "GetNumaProcessorNode");
pProcessIdToSessionId = (void *)GetProcAddress(hkernel32, "ProcessIdToSessionId");
pWTSGetActiveConsoleSessionId = (void *)GetProcAddress(hkernel32, "WTSGetActiveConsoleSessionId");
pCreateToolhelp32Snapshot = (void *)GetProcAddress(hkernel32, "CreateToolhelp32Snapshot");
pProcess32First = (void *)GetProcAddress(hkernel32, "Process32First");
@ -1714,18 +1708,12 @@ static void test_OpenProcess(void)
SIZE_T dummy, read_bytes;
BOOL ret;
/* not exported in all windows versions */
if ((!pVirtualAllocEx) || (!pVirtualFreeEx)) {
win_skip("VirtualAllocEx not found\n");
return;
}
/* without PROCESS_VM_OPERATION */
hproc = OpenProcess(PROCESS_ALL_ACCESS_NT4 & ~PROCESS_VM_OPERATION, FALSE, GetCurrentProcessId());
ok(hproc != NULL, "OpenProcess error %d\n", GetLastError());
SetLastError(0xdeadbeef);
addr1 = pVirtualAllocEx(hproc, 0, 0xFFFC, MEM_RESERVE, PAGE_NOACCESS);
addr1 = VirtualAllocEx(hproc, 0, 0xFFFC, MEM_RESERVE, PAGE_NOACCESS);
ok(!addr1, "VirtualAllocEx should fail\n");
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{ /* Win9x */
@ -1746,7 +1734,7 @@ static void test_OpenProcess(void)
hproc = OpenProcess(PROCESS_VM_OPERATION, FALSE, GetCurrentProcessId());
ok(hproc != NULL, "OpenProcess error %d\n", GetLastError());
addr1 = pVirtualAllocEx(hproc, 0, 0xFFFC, MEM_RESERVE, PAGE_NOACCESS);
addr1 = VirtualAllocEx(hproc, 0, 0xFFFC, MEM_RESERVE, PAGE_NOACCESS);
ok(addr1 != NULL, "VirtualAllocEx error %d\n", GetLastError());
/* without PROCESS_QUERY_INFORMATION */
@ -1783,7 +1771,7 @@ static void test_OpenProcess(void)
ok(info.Type == MEM_PRIVATE, "%x != MEM_PRIVATE\n", info.Type);
SetLastError(0xdeadbeef);
ok(!pVirtualFreeEx(hproc, addr1, 0, MEM_RELEASE),
ok(!VirtualFreeEx(hproc, addr1, 0, MEM_RELEASE),
"VirtualFreeEx without PROCESS_VM_OPERATION rights should fail\n");
ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %d\n", GetLastError());
@ -1810,7 +1798,7 @@ static void test_OpenProcess(void)
ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ok(!pVirtualFreeEx(hproc, addr1, 0, MEM_RELEASE),
ok(!VirtualFreeEx(hproc, addr1, 0, MEM_RELEASE),
"VirtualFreeEx without PROCESS_VM_OPERATION rights should fail\n");
ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %d\n", GetLastError());
@ -3564,13 +3552,7 @@ static void test_session_info(void)
DWORD session_id, active_session;
BOOL r;
if (!pProcessIdToSessionId)
{
win_skip("ProcessIdToSessionId is missing\n");
return;
}
r = pProcessIdToSessionId(GetCurrentProcessId(), &session_id);
r = ProcessIdToSessionId(GetCurrentProcessId(), &session_id);
ok(r, "ProcessIdToSessionId failed: %u\n", GetLastError());
trace("session_id = %x\n", session_id);

View File

@ -26,43 +26,26 @@
static void test_timer(void)
{
HANDLE (WINAPI *pCreateWaitableTimerA)( SECURITY_ATTRIBUTES*, BOOL, LPSTR );
BOOL (WINAPI *pSetWaitableTimer)(HANDLE, LARGE_INTEGER*, LONG, PTIMERAPCROUTINE, LPVOID, BOOL);
HMODULE hker = GetModuleHandleA("kernel32.dll");
HANDLE handle;
BOOL r;
LARGE_INTEGER due;
pCreateWaitableTimerA = (void*)GetProcAddress( hker, "CreateWaitableTimerA");
if( !pCreateWaitableTimerA )
{
win_skip("CreateWaitableTimerA is not available\n");
return;
}
pSetWaitableTimer = (void*)GetProcAddress( hker, "SetWaitableTimer");
if( !pSetWaitableTimer )
{
win_skip("SetWaitableTimer is not available\n");
return;
}
/* try once with a positive number */
handle = pCreateWaitableTimerA( NULL, 0, NULL );
handle = CreateWaitableTimerA( NULL, 0, NULL );
ok( handle != NULL, "failed to create waitable timer with no name\n" );
due.QuadPart = 10000;
r = pSetWaitableTimer( handle, &due, 0x1f4, NULL, NULL, FALSE );
r = SetWaitableTimer( handle, &due, 0x1f4, NULL, NULL, FALSE );
ok( r, "failed to set timer\n");
CloseHandle( handle );
/* try once with a negative number */
handle = pCreateWaitableTimerA( NULL, 0, NULL );
handle = CreateWaitableTimerA( NULL, 0, NULL );
ok( handle != NULL, "failed to create waitable timer with no name\n" );
due.QuadPart = -10000;
r = pSetWaitableTimer( handle, &due, 0x1f4, NULL, NULL, FALSE );
r = SetWaitableTimer( handle, &due, 0x1f4, NULL, NULL, FALSE );
ok( r, "failed to set timer\n");
CloseHandle( handle );

View File

@ -37,8 +37,6 @@
static HINSTANCE hkernel32, hntdll;
static SYSTEM_INFO si;
static LPVOID (WINAPI *pVirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD);
static BOOL (WINAPI *pVirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD);
static UINT (WINAPI *pGetWriteWatch)(DWORD,LPVOID,SIZE_T,LPVOID*,ULONG_PTR*,ULONG*);
static UINT (WINAPI *pResetWriteWatch)(LPVOID,SIZE_T);
static NTSTATUS (WINAPI *pNtAreMappedFilesTheSame)(PVOID,PVOID);
@ -84,17 +82,11 @@ static void test_VirtualAllocEx(void)
MEMORY_BASIC_INFORMATION info;
HANDLE hProcess;
/* not exported in all windows-versions */
if ((!pVirtualAllocEx) || (!pVirtualFreeEx)) {
win_skip("Virtual{Alloc,Free}Ex not available\n");
return;
}
hProcess = create_target_process("sleep");
ok(hProcess != NULL, "Can't start process\n");
SetLastError(0xdeadbeef);
addr1 = pVirtualAllocEx(hProcess, NULL, alloc_size, MEM_COMMIT,
addr1 = VirtualAllocEx(hProcess, NULL, alloc_size, MEM_COMMIT,
PAGE_EXECUTE_READWRITE);
ok(addr1 != NULL, "VirtualAllocEx error %u\n", GetLastError());
@ -144,7 +136,7 @@ static void test_VirtualAllocEx(void)
if (GetLastError() == ERROR_NOACCESS)
ok( bytes_read == 0, "%lu bytes written\n", bytes_read );
b = pVirtualFreeEx(hProcess, addr1, 0, MEM_RELEASE);
b = VirtualFreeEx(hProcess, addr1, 0, MEM_RELEASE);
ok(b != 0, "VirtualFreeEx, error %u\n", GetLastError());
VirtualFree( src, 0, MEM_RELEASE );
@ -155,12 +147,12 @@ static void test_VirtualAllocEx(void)
*/
SetLastError(0xdeadbeef);
addr1 = pVirtualAllocEx(hProcess, 0, 0, MEM_RESERVE, PAGE_NOACCESS);
addr1 = VirtualAllocEx(hProcess, 0, 0, MEM_RESERVE, PAGE_NOACCESS);
ok(addr1 == NULL, "VirtualAllocEx should fail on zero-sized allocation\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"got %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
addr1 = pVirtualAllocEx(hProcess, 0, 0xFFFC, MEM_RESERVE, PAGE_NOACCESS);
addr1 = VirtualAllocEx(hProcess, 0, 0xFFFC, MEM_RESERVE, PAGE_NOACCESS);
ok(addr1 != NULL, "VirtualAllocEx failed\n");
/* test a not committed memory */
@ -180,7 +172,7 @@ static void test_VirtualAllocEx(void)
ok(GetLastError() == ERROR_INVALID_ADDRESS,
"got %u, expected ERROR_INVALID_ADDRESS\n", GetLastError());
addr2 = pVirtualAllocEx(hProcess, addr1, 0x1000, MEM_COMMIT, PAGE_NOACCESS);
addr2 = VirtualAllocEx(hProcess, addr1, 0x1000, MEM_COMMIT, PAGE_NOACCESS);
ok(addr1 == addr2, "VirtualAllocEx failed\n");
/* test a committed memory */
@ -210,20 +202,20 @@ static void test_VirtualAllocEx(void)
ok(VirtualProtectEx(hProcess, addr1, 0x1000, PAGE_READWRITE, &old_prot), "VirtualProtectEx failed\n");
ok(old_prot == PAGE_READONLY, "wrong old protection: got %04x instead of PAGE_READONLY\n", old_prot);
ok(!pVirtualFreeEx(hProcess, addr1, 0x10000, 0),
ok(!VirtualFreeEx(hProcess, addr1, 0x10000, 0),
"VirtualFreeEx should fail with type 0\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"got %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
ok(pVirtualFreeEx(hProcess, addr1, 0x10000, MEM_DECOMMIT), "VirtualFreeEx failed\n");
ok(VirtualFreeEx(hProcess, addr1, 0x10000, MEM_DECOMMIT), "VirtualFreeEx failed\n");
/* if the type is MEM_RELEASE, size must be 0 */
ok(!pVirtualFreeEx(hProcess, addr1, 1, MEM_RELEASE),
ok(!VirtualFreeEx(hProcess, addr1, 1, MEM_RELEASE),
"VirtualFreeEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"got %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
ok(pVirtualFreeEx(hProcess, addr1, 0, MEM_RELEASE), "VirtualFreeEx failed\n");
ok(VirtualFreeEx(hProcess, addr1, 0, MEM_RELEASE), "VirtualFreeEx failed\n");
TerminateProcess(hProcess, 0);
CloseHandle(hProcess);
@ -4249,8 +4241,6 @@ START_TEST(virtual)
hkernel32 = GetModuleHandleA("kernel32.dll");
hntdll = GetModuleHandleA("ntdll.dll");
pVirtualAllocEx = (void *) GetProcAddress(hkernel32, "VirtualAllocEx");
pVirtualFreeEx = (void *) GetProcAddress(hkernel32, "VirtualFreeEx");
pGetWriteWatch = (void *) GetProcAddress(hkernel32, "GetWriteWatch");
pResetWriteWatch = (void *) GetProcAddress(hkernel32, "ResetWriteWatch");
pGetProcessDEPPolicy = (void *)GetProcAddress( hkernel32, "GetProcessDEPPolicy" );

View File

@ -48,15 +48,11 @@ struct COMPLETE_DVD_MANUFACTURER_DESCRIPTOR
C_ASSERT(sizeof(struct COMPLETE_DVD_MANUFACTURER_DESCRIPTOR) == 2053);
static HINSTANCE hdll;
static BOOL (WINAPI * pGetVolumeNameForVolumeMountPointA)(LPCSTR, LPSTR, DWORD);
static BOOL (WINAPI * pGetVolumeNameForVolumeMountPointW)(LPCWSTR, LPWSTR, DWORD);
static HANDLE (WINAPI *pFindFirstVolumeA)(LPSTR,DWORD);
static BOOL (WINAPI *pFindNextVolumeA)(HANDLE,LPSTR,DWORD);
static BOOL (WINAPI *pFindVolumeClose)(HANDLE);
static UINT (WINAPI *pGetLogicalDriveStringsA)(UINT,LPSTR);
static UINT (WINAPI *pGetLogicalDriveStringsW)(UINT,LPWSTR);
static BOOL (WINAPI *pGetVolumeInformationA)(LPCSTR, LPSTR, DWORD, LPDWORD, LPDWORD, LPDWORD, LPSTR, DWORD);
static BOOL (WINAPI *pGetVolumePathNameA)(LPCSTR, LPSTR, DWORD);
static BOOL (WINAPI *pGetVolumePathNamesForVolumeNameA)(LPCSTR, LPSTR, DWORD, LPDWORD);
static BOOL (WINAPI *pGetVolumePathNamesForVolumeNameW)(LPCWSTR, LPWSTR, DWORD, LPDWORD);
static BOOL (WINAPI *pCreateSymbolicLinkA)(const char *, const char *, DWORD);
@ -229,38 +225,32 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
DWORD len = sizeof(volume), reti;
char temp_path[MAX_PATH];
/* not present before w2k */
if (!pGetVolumeNameForVolumeMountPointA) {
win_skip("GetVolumeNameForVolumeMountPointA not found\n");
return;
}
reti = GetTempPathA(MAX_PATH, temp_path);
ok(reti != 0, "GetTempPathA error %d\n", GetLastError());
ok(reti < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = pGetVolumeNameForVolumeMountPointA(path, volume, 0);
ret = GetVolumeNameForVolumeMountPointA(path, volume, 0);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE ||
GetLastError() == ERROR_INVALID_PARAMETER, /* Vista */
"wrong error, last=%d\n", GetLastError());
if (0) { /* these crash on XP */
ret = pGetVolumeNameForVolumeMountPointA(path, NULL, len);
ret = GetVolumeNameForVolumeMountPointA(path, NULL, len);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
ret = pGetVolumeNameForVolumeMountPointA(NULL, volume, len);
ret = GetVolumeNameForVolumeMountPointA(NULL, volume, len);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
}
ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
ret = GetVolumeNameForVolumeMountPointA(path, volume, len);
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
ok(!strncmp( volume, "\\\\?\\Volume{", 11),
"GetVolumeNameForVolumeMountPointA failed to return valid string <%s>\n",
volume);
/* test with too small buffer */
ret = pGetVolumeNameForVolumeMountPointA(path, volume, 10);
ret = GetVolumeNameForVolumeMountPointA(path, volume, 10);
ok(ret == FALSE && GetLastError() == ERROR_FILENAME_EXCED_RANGE,
"GetVolumeNameForVolumeMountPointA failed, wrong error returned, was %d, should be ERROR_FILENAME_EXCED_RANGE\n",
GetLastError());
@ -268,7 +258,7 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
/* Try on an arbitrary directory */
/* On FAT filesystems it seems that GetLastError() is set to
ERROR_INVALID_FUNCTION. */
ret = pGetVolumeNameForVolumeMountPointA(temp_path, volume, len);
ret = GetVolumeNameForVolumeMountPointA(temp_path, volume, len);
ok(ret == FALSE && (GetLastError() == ERROR_NOT_A_REPARSE_POINT ||
GetLastError() == ERROR_INVALID_FUNCTION),
"GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
@ -283,14 +273,14 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
if (path[0] <= 'z')
{
path[2] = '\\';
ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
ret = GetVolumeNameForVolumeMountPointA(path, volume, len);
ok(ret == FALSE && GetLastError() == ERROR_FILE_NOT_FOUND,
"GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
path, GetLastError());
/* Try without trailing \ and on a nonexistent dos drive */
path[2] = 0;
ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
ret = GetVolumeNameForVolumeMountPointA(path, volume, len);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
path, GetLastError());
@ -303,27 +293,21 @@ static void test_GetVolumeNameForVolumeMountPointW(void)
WCHAR volume[MAX_PATH], path[] = {'c',':','\\',0};
DWORD len = ARRAY_SIZE(volume);
/* not present before w2k */
if (!pGetVolumeNameForVolumeMountPointW) {
win_skip("GetVolumeNameForVolumeMountPointW not found\n");
return;
}
ret = pGetVolumeNameForVolumeMountPointW(path, volume, 0);
ret = GetVolumeNameForVolumeMountPointW(path, volume, 0);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE ||
GetLastError() == ERROR_INVALID_PARAMETER, /* Vista */
"wrong error, last=%d\n", GetLastError());
if (0) { /* these crash on XP */
ret = pGetVolumeNameForVolumeMountPointW(path, NULL, len);
ret = GetVolumeNameForVolumeMountPointW(path, NULL, len);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
ret = pGetVolumeNameForVolumeMountPointW(NULL, volume, len);
ret = GetVolumeNameForVolumeMountPointW(NULL, volume, len);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
}
ret = pGetVolumeNameForVolumeMountPointW(path, volume, len);
ret = GetVolumeNameForVolumeMountPointW(path, volume, len);
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointW failed\n");
}
@ -413,11 +397,6 @@ static void test_GetVolumeInformationA(void)
char windowsdir[MAX_PATH+10];
char currentdir[MAX_PATH+1];
ok( pGetVolumeInformationA != NULL, "GetVolumeInformationA not found\n");
if(!pGetVolumeInformationA) {
return;
}
/* get windows drive letter and update strings for testing */
result = GetWindowsDirectoryA(windowsdir, sizeof(windowsdir));
ok(result < sizeof(windowsdir), "windowsdir is abnormally long!\n");
@ -433,7 +412,7 @@ static void test_GetVolumeInformationA(void)
/* check for NO error on no trailing \ when current dir is root dir */
ret = SetCurrentDirectoryA(Root_Slash);
ok(ret, "SetCurrentDirectory: error %d\n", GetLastError());
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA root failed, last error %u\n", GetLastError());
@ -441,7 +420,7 @@ static void test_GetVolumeInformationA(void)
ret = SetCurrentDirectoryA(windowsdir);
ok(ret, "SetCurrentDirectory: error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError() == ERROR_INVALID_NAME),
"GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError());
@ -469,13 +448,13 @@ static void test_GetVolumeInformationA(void)
/* windows dir is current on the root drive, call fails */
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError() == ERROR_INVALID_NAME),
"GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError());
/* Try normal drive letter with trailing \ */
ret = pGetVolumeInformationA(Root_Slash, vol_name_buf, vol_name_size, NULL,
ret = GetVolumeInformationA(Root_Slash, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA with \\ failed, last error %u\n", GetLastError());
@ -487,7 +466,7 @@ static void test_GetVolumeInformationA(void)
/* windows dir is STILL CURRENT on root drive; the call fails as before, */
/* proving that SetCurrentDir did not remember the other drive's directory */
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError() == ERROR_INVALID_NAME),
"GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError());
@ -497,7 +476,7 @@ static void test_GetVolumeInformationA(void)
ok(ret, "SetEnvironmentVariable %s failed\n", Root_Env);
/* \ is current on root drive, call succeeds */
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA failed, last error %u\n", GetLastError());
@ -508,59 +487,55 @@ static void test_GetVolumeInformationA(void)
ok(ret, "SetCurrentDirectory: error %d\n", GetLastError());
/* \ is current on root drive, call succeeds */
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA failed, last error %u\n", GetLastError());
}
/* try null root directory to return "root of the current directory" */
ret = pGetVolumeInformationA(NULL, vol_name_buf, vol_name_size, NULL,
ret = GetVolumeInformationA(NULL, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA failed on null root dir, last error %u\n", GetLastError());
/* Try normal drive letter with trailing \ */
ret = pGetVolumeInformationA(Root_Slash, vol_name_buf, vol_name_size,
ret = GetVolumeInformationA(Root_Slash, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA failed, root=%s, last error=%u\n", Root_Slash, GetLastError());
/* try again with drive letter and the "disable parsing" prefix */
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size,
ret = GetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", Root_UNC, GetLastError());
/* try again with device name space */
Root_UNC[2] = '.';
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size,
ret = GetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", Root_UNC, GetLastError());
/* try again with a directory off the root - should generate error */
if (windowsdir[strlen(windowsdir)-1] != '\\') strcat(windowsdir, "\\");
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
ret = GetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError()==ERROR_DIR_NOT_ROOT),
"GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", windowsdir, GetLastError());
/* A subdir with trailing \ yields DIR_NOT_ROOT instead of INVALID_NAME */
if (windowsdir[strlen(windowsdir)-1] == '\\') windowsdir[strlen(windowsdir)-1] = 0;
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
ret = GetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError()==ERROR_INVALID_NAME),
"GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", windowsdir, GetLastError());
if (!pGetVolumeNameForVolumeMountPointA) {
win_skip("GetVolumeNameForVolumeMountPointA not found\n");
return;
}
/* get the unique volume name for the windows drive */
ret = pGetVolumeNameForVolumeMountPointA(Root_Slash, volume, MAX_PATH);
ret = GetVolumeNameForVolumeMountPointA(Root_Slash, volume, MAX_PATH);
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
/* try again with unique volume name */
ret = pGetVolumeInformationA(volume, vol_name_buf, vol_name_size,
ret = GetVolumeInformationA(volume, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(ret, "GetVolumeInformationA failed, root=%s, last error=%u\n", volume, GetLastError());
}
@ -578,11 +553,6 @@ static void test_enum_vols(void)
BOOL found = FALSE;
char windowsdir[MAX_PATH];
if (!pGetVolumeNameForVolumeMountPointA) {
win_skip("GetVolumeNameForVolumeMountPointA not found\n");
return;
}
/*get windows drive letter and update strings for testing */
ret = GetWindowsDirectoryA( windowsdir, sizeof(windowsdir) );
ok(ret < sizeof(windowsdir), "windowsdir is abnormally long!\n");
@ -590,7 +560,7 @@ static void test_enum_vols(void)
path[0] = windowsdir[0];
/* get the unique volume name for the windows drive */
ret = pGetVolumeNameForVolumeMountPointA( path, Volume_1, MAX_PATH );
ret = GetVolumeNameForVolumeMountPointA( path, Volume_1, MAX_PATH );
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
ok(strlen(Volume_1) == 49, "GetVolumeNameForVolumeMountPointA returned wrong length name %s\n", Volume_1);
@ -843,13 +813,6 @@ static void test_GetVolumePathNameA(void)
DWORD error;
UINT i;
/* GetVolumePathNameA is not present before w2k */
if (!pGetVolumePathNameA)
{
win_skip("required functions not found\n");
return;
}
for (i=0; i<ARRAY_SIZE(test_paths); i++)
{
BOOL broken_ret = test_paths[i].broken_error == NO_ERROR;
@ -861,7 +824,7 @@ static void test_GetVolumePathNameA(void)
volume_path[ test_paths[i].path_len ] = 0x11;
SetLastError( 0xdeadbeef );
ret = pGetVolumePathNameA( test_paths[i].file_name, output, test_paths[i].path_len );
ret = GetVolumePathNameA( test_paths[i].file_name, output, test_paths[i].path_len );
error = GetLastError();
ok(ret == expected_ret || broken(ret == broken_ret),
"GetVolumePathName test %d %s unexpectedly.\n",
@ -973,13 +936,13 @@ static void test_GetVolumePathNamesForVolumeNameA(void)
char volume[MAX_PATH], buffer[MAX_PATH];
DWORD len, error;
if (!pGetVolumePathNamesForVolumeNameA || !pGetVolumeNameForVolumeMountPointA)
if (!pGetVolumePathNamesForVolumeNameA)
{
win_skip("required functions not found\n");
return;
}
ret = pGetVolumeNameForVolumeMountPointA( "c:\\", volume, sizeof(volume) );
ret = GetVolumeNameForVolumeMountPointA( "c:\\", volume, sizeof(volume) );
ok(ret, "failed to get volume name %u\n", GetLastError());
trace("c:\\ -> %s\n", volume);
@ -1061,13 +1024,13 @@ static void test_GetVolumePathNamesForVolumeNameW(void)
WCHAR volume[MAX_PATH], buffer[MAX_PATH];
DWORD len, error;
if (!pGetVolumePathNamesForVolumeNameW || !pGetVolumeNameForVolumeMountPointW)
if (!pGetVolumePathNamesForVolumeNameW)
{
win_skip("required functions not found\n");
return;
}
ret = pGetVolumeNameForVolumeMountPointW( drive_c, volume, ARRAY_SIZE(volume) );
ret = GetVolumeNameForVolumeMountPointW( drive_c, volume, ARRAY_SIZE(volume) );
ok(ret, "failed to get volume name %u\n", GetLastError());
SetLastError( 0xdeadbeef );
@ -1589,15 +1552,11 @@ static void test_GetVolumeInformationByHandle(void)
START_TEST(volume)
{
hdll = GetModuleHandleA("kernel32.dll");
pGetVolumeNameForVolumeMountPointA = (void *) GetProcAddress(hdll, "GetVolumeNameForVolumeMountPointA");
pGetVolumeNameForVolumeMountPointW = (void *) GetProcAddress(hdll, "GetVolumeNameForVolumeMountPointW");
pFindFirstVolumeA = (void *) GetProcAddress(hdll, "FindFirstVolumeA");
pFindNextVolumeA = (void *) GetProcAddress(hdll, "FindNextVolumeA");
pFindVolumeClose = (void *) GetProcAddress(hdll, "FindVolumeClose");
pGetLogicalDriveStringsA = (void *) GetProcAddress(hdll, "GetLogicalDriveStringsA");
pGetLogicalDriveStringsW = (void *) GetProcAddress(hdll, "GetLogicalDriveStringsW");
pGetVolumeInformationA = (void *) GetProcAddress(hdll, "GetVolumeInformationA");
pGetVolumePathNameA = (void *) GetProcAddress(hdll, "GetVolumePathNameA");
pGetVolumePathNamesForVolumeNameA = (void *) GetProcAddress(hdll, "GetVolumePathNamesForVolumeNameA");
pGetVolumePathNamesForVolumeNameW = (void *) GetProcAddress(hdll, "GetVolumePathNamesForVolumeNameW");
pCreateSymbolicLinkA = (void *) GetProcAddress(hdll, "CreateSymbolicLinkA");