kernel32/tests/module: Enable compilation with long types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-03-04 09:24:31 +01:00 committed by Alexandre Julliard
parent c56cf9dad2
commit 65f36a9695

View file

@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include <stdio.h>
#include "ntstatus.h"
@ -134,7 +135,7 @@ static void create_test_dll( const char *name )
DWORD dummy;
HANDLE handle = CreateFileA( name, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, 0 );
ok( handle != INVALID_HANDLE_VALUE, "failed to create file err %u\n", GetLastError() );
ok( handle != INVALID_HANDLE_VALUE, "failed to create file err %lu\n", GetLastError() );
WriteFile( handle, &dll_image, sizeof(dll_image), &dummy, NULL );
SetFilePointer( handle, dll_image.nt.OptionalHeader.SizeOfImage, NULL, FILE_BEGIN );
SetEndOfFile( handle );
@ -156,7 +157,7 @@ static void testGetModuleFileName(const char* name)
len1A = GetModuleFileNameA(hMod, bufA, sizeof(bufA));
ok(GetLastError() == ERROR_SUCCESS ||
broken(GetLastError() == 0xdeadbeef), /* <= XP SP3 */
"LastError was not reset: %u\n", GetLastError());
"LastError was not reset: %lu\n", GetLastError());
ok(len1A > 0, "Getting module filename for handle %p\n", hMod);
if (is_unicode_enabled)
@ -166,15 +167,15 @@ static void testGetModuleFileName(const char* name)
len1W = GetModuleFileNameW(hMod, bufW, ARRAY_SIZE(bufW));
ok(GetLastError() == ERROR_SUCCESS ||
broken(GetLastError() == 0xdeadbeef), /* <= XP SP3 */
"LastError was not reset: %u\n", GetLastError());
"LastError was not reset: %lu\n", GetLastError());
ok(len1W > 0, "Getting module filename for handle %p\n", hMod);
}
ok(len1A == strlen(bufA), "Unexpected length of GetModuleFilenameA (%d/%d)\n", len1A, lstrlenA(bufA));
ok(len1A == strlen(bufA), "Unexpected length of GetModuleFilenameA (%ld/%d)\n", len1A, lstrlenA(bufA));
if (is_unicode_enabled)
{
ok(len1W == lstrlenW(bufW), "Unexpected length of GetModuleFilenameW (%d/%d)\n", len1W, lstrlenW(bufW));
ok(len1W == lstrlenW(bufW), "Unexpected length of GetModuleFilenameW (%ld/%d)\n", len1W, lstrlenW(bufW));
ok(cmpStrAW(bufA, bufW, len1A, len1W), "Comparing GetModuleFilenameAW results\n");
}
@ -189,11 +190,11 @@ static void testGetModuleFileName(const char* name)
len2W = GetModuleFileNameW(hMod, bufW, len1W / 2);
ok(len2W > 0, "Getting module filename for handle %p\n", hMod);
ok(cmpStrAW(bufA, bufW, len2A, len2W), "Comparing GetModuleFilenameAW results with buffer too small\n" );
ok(len1W / 2 == len2W, "Correct length in GetModuleFilenameW with buffer too small (%d/%d)\n", len1W / 2, len2W);
ok(len1W / 2 == len2W, "Correct length in GetModuleFilenameW with buffer too small (%ld/%ld)\n", len1W / 2, len2W);
}
ok(len1A / 2 == len2A,
"Correct length in GetModuleFilenameA with buffer too small (%d/%d)\n", len1A / 2, len2A);
"Correct length in GetModuleFilenameA with buffer too small (%ld/%ld)\n", len1A / 2, len2A);
len1A = GetModuleFileNameA(hMod, bufA, 0x10000);
ok(len1A > 0, "Getting module filename for handle %p\n", hMod);
@ -228,16 +229,16 @@ static void testLoadLibraryA(void)
SetLastError(0xdeadbeef);
hModule = LoadLibraryA("kernel32.dll");
ok( hModule != NULL, "kernel32.dll should be loadable\n");
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %d\n", GetLastError());
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %ld\n", GetLastError());
fp = GetProcAddress(hModule, "CreateFileA");
ok( fp != NULL, "CreateFileA should be there\n");
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %d\n", GetLastError());
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %ld\n", GetLastError());
SetLastError(0xdeadbeef);
hModule1 = LoadLibraryA("kernel32 ");
ok( hModule1 != NULL, "\"kernel32 \" should be loadable\n" );
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %d\n", GetLastError() );
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %ld\n", GetLastError() );
ok( hModule == hModule1, "Loaded wrong module\n" );
FreeLibrary(hModule1);
FreeLibrary(hModule);
@ -302,7 +303,7 @@ static void testLoadLibraryA_Wrong(void)
SetLastError(0xdeadbeef);
hModule = LoadLibraryA("non_ex_pv.dll");
ok( !hModule, "non_ex_pv.dll should be not loadable\n");
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "Expected ERROR_MOD_NOT_FOUND, got %d\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "Expected ERROR_MOD_NOT_FOUND, got %ld\n", GetLastError() );
/* Just in case */
FreeLibrary(hModule);
@ -315,12 +316,12 @@ static void testGetProcAddress_Wrong(void)
SetLastError(0xdeadbeef);
fp = GetProcAddress(NULL, "non_ex_call");
ok( !fp, "non_ex_call should not be found\n");
ok( GetLastError() == ERROR_PROC_NOT_FOUND, "Expected ERROR_PROC_NOT_FOUND, got %d\n", GetLastError() );
ok( GetLastError() == ERROR_PROC_NOT_FOUND, "Expected ERROR_PROC_NOT_FOUND, got %ld\n", GetLastError() );
SetLastError(0xdeadbeef);
fp = GetProcAddress((HMODULE)0xdeadbeef, "non_ex_call");
ok( !fp, "non_ex_call should not be found\n");
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "Expected ERROR_MOD_NOT_FOUND, got %d\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "Expected ERROR_MOD_NOT_FOUND, got %ld\n", GetLastError() );
}
static void testLoadLibraryEx(void)
@ -341,7 +342,7 @@ static void testLoadLibraryEx(void)
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_MOD_NOT_FOUND ||
GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_MOD_NOT_FOUND or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
"Expected ERROR_MOD_NOT_FOUND or ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
/* empty lpFileName */
SetLastError(0xdeadbeef);
@ -349,7 +350,7 @@ static void testLoadLibraryEx(void)
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_MOD_NOT_FOUND ||
GetLastError() == ERROR_INVALID_PARAMETER /* win8 */,
"Expected ERROR_MOD_NOT_FOUND or ERROR_DLL_NOT_FOUND, got %d\n", GetLastError());
"Expected ERROR_MOD_NOT_FOUND or ERROR_DLL_NOT_FOUND, got %ld\n", GetLastError());
/* hFile is non-NULL */
SetLastError(0xdeadbeef);
@ -357,21 +358,21 @@ static void testLoadLibraryEx(void)
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_SHARING_VIOLATION ||
GetLastError() == ERROR_INVALID_PARAMETER, /* win2k3 */
"Unexpected last error, got %d\n", GetLastError());
"Unexpected last error, got %ld\n", GetLastError());
SetLastError(0xdeadbeef);
hmodule = LoadLibraryExA("testfile.dll", (HANDLE)0xdeadbeef, 0);
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_SHARING_VIOLATION ||
GetLastError() == ERROR_INVALID_PARAMETER, /* win2k3 */
"Unexpected last error, got %d\n", GetLastError());
"Unexpected last error, got %ld\n", GetLastError());
/* try to open a file that is locked */
SetLastError(0xdeadbeef);
hmodule = LoadLibraryExA("testfile.dll", NULL, 0);
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_SHARING_VIOLATION,
"Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
"Expected ERROR_SHARING_VIOLATION, got %ld\n", GetLastError());
/* lpFileName does not matter */
if (is_unicode_enabled)
@ -381,7 +382,7 @@ static void testLoadLibraryEx(void)
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_MOD_NOT_FOUND ||
GetLastError() == ERROR_INVALID_PARAMETER, /* win2k3 */
"Expected ERROR_MOD_NOT_FOUND or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
"Expected ERROR_MOD_NOT_FOUND or ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
}
CloseHandle(hfile);
@ -390,7 +391,7 @@ static void testLoadLibraryEx(void)
SetLastError(0xdeadbeef);
hmodule = LoadLibraryExA("testfile.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_FILE_INVALID, "Expected ERROR_FILE_INVALID, got %d\n", GetLastError());
ok(GetLastError() == ERROR_FILE_INVALID, "Expected ERROR_FILE_INVALID, got %ld\n", GetLastError());
DeleteFileA("testfile.dll");
@ -405,13 +406,13 @@ static void testLoadLibraryEx(void)
ok(hmodule != 0, "Expected valid module handle\n");
ok(GetLastError() == 0xdeadbeef ||
GetLastError() == ERROR_SUCCESS,
"Expected 0xdeadbeef or ERROR_SUCCESS, got %d\n", GetLastError());
"Expected 0xdeadbeef or ERROR_SUCCESS, got %ld\n", GetLastError());
/* try invalid file handle */
SetLastError(0xdeadbeef);
hmodule = LoadLibraryExA(path, (HANDLE)0xdeadbeef, 0);
if (!hmodule) /* succeeds on xp and older */
ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError());
ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError());
FreeLibrary(hmodule);
@ -419,7 +420,7 @@ static void testLoadLibraryEx(void)
SetLastError(0xdeadbeef);
hmodule = LoadLibraryExA("kernel32.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
ok(hmodule != 0, "Expected valid module handle\n");
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
FreeLibrary(hmodule);
@ -433,7 +434,7 @@ static void testLoadLibraryEx(void)
hmodule = LoadLibraryExA(path, NULL, LOAD_LIBRARY_AS_DATAFILE);
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
/* Free the loaded dll when it's the first time this dll is loaded
in process - First time should pass, second fail */
@ -444,14 +445,14 @@ static void testLoadLibraryEx(void)
SetLastError(0xdeadbeef);
ret = FreeLibrary( (HMODULE)((ULONG_PTR)hmodule + 0x1230));
ok(!ret, "Free succeeded on wrong handle\n");
ok(GetLastError() == ERROR_BAD_EXE_FORMAT, "wrong error %u\n", GetLastError());
ok(GetLastError() == ERROR_BAD_EXE_FORMAT, "wrong error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
ret = FreeLibrary(hmodule);
ok(ret, "Expected to be able to free the module, failed with %d\n", GetLastError());
ok(ret, "Expected to be able to free the module, failed with %ld\n", GetLastError());
SetLastError(0xdeadbeef);
ret = FreeLibrary(hmodule);
ok(!ret, "Unexpected ability to free the module, failed with %d\n", GetLastError());
ok(!ret, "Unexpected ability to free the module, failed with %ld\n", GetLastError());
/* load with full path, name without extension */
GetSystemDirectoryA(path, MAX_PATH);
@ -499,13 +500,13 @@ static void test_LoadLibraryEx_search_flags(void)
GetTempFileNameA( path, "tmp", 0, buf );
DeleteFileA( buf );
ret = CreateDirectoryA( buf, NULL );
ok( ret, "CreateDirectory failed err %u\n", GetLastError() );
ok( ret, "CreateDirectory failed err %lu\n", GetLastError() );
p = buf + strlen( buf );
for (i = 1; i <= 6; i++)
{
sprintf( p, "\\%u", i );
ret = CreateDirectoryA( buf, NULL );
ok( ret, "CreateDirectory failed err %u\n", GetLastError() );
ok( ret, "CreateDirectory failed err %lu\n", GetLastError() );
if (i >= 5) continue; /* dirs 5 and 6 are left empty */
sprintf( p, "\\%u\\winetestdll.dll", i );
create_test_dll( buf );
@ -517,13 +518,13 @@ static void test_LoadLibraryEx_search_flags(void)
SetLastError( 0xdeadbeef );
mod = LoadLibraryA( "1\\winetestdll.dll" );
ok( mod != NULL, "LoadLibrary failed err %u\n", GetLastError() );
ok( mod != NULL, "LoadLibrary failed err %lu\n", GetLastError() );
FreeLibrary( mod );
SetLastError( 0xdeadbeef );
sprintf( path, "%c:1\\winetestdll.dll", buf[0] );
mod = LoadLibraryA( path );
ok( mod != NULL, "LoadLibrary failed err %u\n", GetLastError() );
ok( mod != NULL, "LoadLibrary failed err %lu\n", GetLastError() );
FreeLibrary( mod );
if (pAddDllDirectory)
@ -531,11 +532,11 @@ static void test_LoadLibraryEx_search_flags(void)
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "1\\winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( path, 0, LOAD_LIBRARY_SEARCH_SYSTEM32 );
ok( mod != NULL, "LoadLibrary failed err %u\n", GetLastError() );
ok( mod != NULL, "LoadLibrary failed err %lu\n", GetLastError() );
FreeLibrary( mod );
}
@ -544,21 +545,21 @@ static void test_LoadLibraryEx_search_flags(void)
SetLastError( 0xdeadbeef );
mod = LoadLibraryA( "winetestdll.dll" );
ok( mod != NULL, "LoadLibrary failed err %u\n", GetLastError() );
ok( mod != NULL, "LoadLibrary failed err %lu\n", GetLastError() );
FreeLibrary( mod );
SetLastError( 0xdeadbeef );
sprintf( path, "%c:winetestdll.dll", buf[0] );
mod = LoadLibraryA( path );
ok( mod != NULL || broken(!mod), /* win10 disallows this but allows c:1\\winetestdll.dll */
"LoadLibrary failed err %u\n", GetLastError() );
if (!mod) ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
"LoadLibrary failed err %lu\n", GetLastError() );
if (!mod) ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
else FreeLibrary( mod );
SetLastError( 0xdeadbeef );
sprintf( path, "%s\\winetestdll.dll", buf + 2 );
mod = LoadLibraryA( path );
ok( mod != NULL, "LoadLibrary failed err %u\n", GetLastError() );
ok( mod != NULL, "LoadLibrary failed err %lu\n", GetLastError() );
FreeLibrary( mod );
if (pAddDllDirectory)
@ -566,43 +567,43 @@ static void test_LoadLibraryEx_search_flags(void)
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( path, 0, LOAD_LIBRARY_SEARCH_SYSTEM32 );
ok( mod != NULL, "LoadLibrary failed err %u\n", GetLastError() );
ok( mod != NULL, "LoadLibrary failed err %lu\n", GetLastError() );
FreeLibrary( mod );
SetLastError( 0xdeadbeef );
sprintf( path, "%s\\winetestdll.dll", buf + 2 );
mod = LoadLibraryExA( path, 0, LOAD_LIBRARY_SEARCH_SYSTEM32 );
ok( mod != NULL, "LoadLibrary failed err %u\n", GetLastError() );
ok( mod != NULL, "LoadLibrary failed err %lu\n", GetLastError() );
FreeLibrary( mod );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_WITH_ALTERED_SEARCH_PATH );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_WITH_ALTERED_SEARCH_PATH );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_WITH_ALTERED_SEARCH_PATH );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_WITH_ALTERED_SEARCH_PATH );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_WITH_ALTERED_SEARCH_PATH );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
}
SetCurrentDirectoryA( curdir );
@ -612,7 +613,7 @@ static void test_LoadLibraryEx_search_flags(void)
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
if (0) /* crashes on win10 */
{
@ -620,38 +621,38 @@ static void test_LoadLibraryEx_search_flags(void)
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_USER_DIRS );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_MOD_NOT_FOUND || broken(GetLastError() == ERROR_NOT_ENOUGH_MEMORY),
"wrong error %u\n", GetLastError() );
"wrong error %lu\n", GetLastError() );
}
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32 );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "foo\\winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "\\windows\\winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryA( "1\\winetestdll.dll" );
ok( !mod, "LoadLibrary succeeded\n" );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
for (j = 0; j < ARRAY_SIZE(tests); j++)
{
@ -673,7 +674,7 @@ static void test_LoadLibraryEx_search_flags(void)
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_USER_DIRS );
if (tests[j].expect)
{
ok( mod != NULL, "%u: LoadLibrary failed err %u\n", j, GetLastError() );
ok( mod != NULL, "%u: LoadLibrary failed err %lu\n", j, GetLastError() );
GetModuleFileNameA( mod, path, MAX_PATH );
sprintf( p, "\\%u\\winetestdll.dll", tests[j].expect );
ok( !lstrcmpiA( path, buf ), "%u: wrong module %s expected %s\n", j, path, buf );
@ -682,7 +683,7 @@ static void test_LoadLibraryEx_search_flags(void)
{
ok( !mod, "%u: LoadLibrary succeeded\n", j );
ok( GetLastError() == ERROR_MOD_NOT_FOUND || broken(GetLastError() == ERROR_NOT_ENOUGH_MEMORY),
"%u: wrong error %u\n", j, GetLastError() );
"%u: wrong error %lu\n", j, GetLastError() );
}
FreeLibrary( mod );
@ -705,12 +706,12 @@ static void test_LoadLibraryEx_search_flags(void)
FreeLibrary(mod);
mod = LoadLibraryExA( apiset_dll, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR );
ok( !!mod, "Got NULL module, error %u.\n", GetLastError() );
ok( !!mod, "Got NULL module, error %lu.\n", GetLastError() );
ok( !!GetModuleHandleA( apiset_dll ), "Got NULL handle.\n" );
shcore = GetModuleHandleA( "shcore.dll" );
ok( mod == shcore, "wrong module %p/%p\n", mod, shcore );
ret = FreeLibrary( mod );
ok( ret, "FreeLibrary failed, error %u.\n", GetLastError() );
ok( ret, "FreeLibrary failed, error %lu.\n", GetLastError() );
shcore = GetModuleHandleA( "shcore.dll" );
ok( !shcore, "shcore not unloaded\n" );
@ -718,12 +719,12 @@ static void test_LoadLibraryEx_search_flags(void)
strcpy( buffer, apiset_dll );
buffer[strlen(buffer) - 4] = 0;
mod = LoadLibraryExA( buffer, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR );
ok( !!mod, "Got NULL module, error %u.\n", GetLastError() );
ok( !!mod, "Got NULL module, error %lu.\n", GetLastError() );
ok( !!GetModuleHandleA( apiset_dll ), "Got NULL handle.\n" );
shcore = GetModuleHandleA( "shcore.dll" );
ok( mod == shcore, "wrong module %p/%p\n", mod, shcore );
ret = FreeLibrary( mod );
ok( ret, "FreeLibrary failed, error %u.\n", GetLastError() );
ok( ret, "FreeLibrary failed, error %lu.\n", GetLastError() );
shcore = GetModuleHandleA( "shcore.dll" );
ok( !shcore, "shcore not unloaded\n" );
@ -731,14 +732,14 @@ static void test_LoadLibraryEx_search_flags(void)
strcpy( buffer, apiset_dll );
buffer[strlen(buffer) - 5] = '9';
mod = LoadLibraryExA( buffer, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR );
ok( !!mod || broken(!mod) /* win8 */, "Got NULL module, error %u.\n", GetLastError() );
ok( !!mod || broken(!mod) /* win8 */, "Got NULL module, error %lu.\n", GetLastError() );
if (mod)
{
ok( !!GetModuleHandleA( apiset_dll ), "Got NULL handle.\n" );
shcore = GetModuleHandleA( "shcore.dll" );
ok( mod == shcore, "wrong module %p/%p\n", mod, shcore );
ret = FreeLibrary( mod );
ok( ret, "FreeLibrary failed, error %u.\n", GetLastError() );
ok( ret, "FreeLibrary failed, error %lu.\n", GetLastError() );
}
shcore = GetModuleHandleA( "shcore.dll" );
ok( !shcore, "shcore not unloaded\n" );
@ -750,11 +751,11 @@ static void test_LoadLibraryEx_search_flags(void)
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( buffer, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR );
ok( !mod, "Loaded %s\n", debugstr_a(buffer) );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryA( buffer );
ok( !mod, "Loaded %s\n", debugstr_a(buffer) );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
}
else
{
@ -765,20 +766,20 @@ static void test_LoadLibraryEx_search_flags(void)
mod = GetModuleHandleA( "rasapi32.dll" );
ok( !mod, "rasapi32 already loaded\n" );
mod = LoadLibraryA( "rasapi32.dll" );
ok( !!mod, "rasapi32 not found %u\n", GetLastError() );
ok( !!mod, "rasapi32 not found %lu\n", GetLastError() );
FreeLibrary( mod );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "rasapi32.dll", NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR );
ok( !mod, "rasapi32 loaded\n" );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
mod = LoadLibraryExA( "ext-ms-win-ras-rasapi32-l1-1-0.dll", NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR );
todo_wine /* rasapi32 doesn't have interesting dependencies on wine */
ok( !mod, "rasapi32 loaded\n" );
if (mod) FreeLibrary( mod );
else ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %u\n", GetLastError() );
else ok( GetLastError() == ERROR_MOD_NOT_FOUND, "wrong error %lu\n", GetLastError() );
mod = LoadLibraryA( "ext-ms-win-ras-rasapi32-l1-1-0.dll" );
ok( !!mod || broken(!mod) /* win7 */, "rasapi32 not found %u\n", GetLastError() );
ok( !!mod || broken(!mod) /* win7 */, "rasapi32 not found %lu\n", GetLastError() );
if (mod) FreeLibrary( mod );
mod = GetModuleHandleA( "rasapi32.dll" );
ok( !mod, "rasapi32 still loaded\n" );
@ -832,24 +833,24 @@ static void testGetDllDirectory(void)
/* no buffer, determine length */
ret = pGetDllDirectoryA(0, NULL);
ok(ret == length + 1, "Expected %u, got %u\n", length + 1, ret);
ok(ret == length + 1, "Expected %lu, got %lu\n", length + 1, ret);
ret = pGetDllDirectoryW(0, NULL);
ok(ret == length + 1, "Expected %u, got %u\n", length + 1, ret);
ok(ret == length + 1, "Expected %lu, got %lu\n", length + 1, ret);
/* buffer of exactly the right size */
bufferA[length] = 'A';
bufferA[length + 1] = 'A';
ret = pGetDllDirectoryA(length + 1, bufferA);
ok(ret == length || broken(ret + 1 == length) /* win8 */,
"i=%d, Expected %u(+1), got %u\n", i, length, ret);
"i=%d, Expected %lu(+1), got %lu\n", i, length, ret);
ok(bufferA[length + 1] == 'A', "i=%d, Buffer overflow\n", i);
ok(strcmp(bufferA, dll_directories[i]) == 0, "i=%d, Wrong path returned: '%s'\n", i, bufferA);
bufferW[length] = 'A';
bufferW[length + 1] = 'A';
ret = pGetDllDirectoryW(length + 1, bufferW);
ok(ret == length, "i=%d, Expected %u, got %u\n", i, length, ret);
ok(ret == length, "i=%d, Expected %lu, got %lu\n", i, length, ret);
ok(bufferW[length + 1] == 'A', "i=%d, Buffer overflow\n", i);
ok(cmpStrAW(dll_directories[i], bufferW, length, length),
"i=%d, Wrong path returned: %s\n", i, wine_dbgstr_w(bufferW));
@ -858,24 +859,24 @@ static void testGetDllDirectory(void)
* on the Windows version and whether the A or W API is called. */
bufferA[0] = 'A';
ret = pGetDllDirectoryA(0, bufferA);
ok(ret == length + 1, "i=%d, Expected %u, got %u\n", i, length + 1, ret);
ok(ret == length + 1, "i=%d, Expected %lu, got %lu\n", i, length + 1, ret);
bufferW[0] = 'A';
ret = pGetDllDirectoryW(0, bufferW);
ok(ret == length + 1, "i=%d, Expected %u, got %u\n", i, length + 1, ret);
ok(ret == length + 1, "i=%d, Expected %lu, got %lu\n", i, length + 1, ret);
ok(bufferW[0] == 'A' || broken(bufferW[0] == 0), /* XP, 2003 */
"i=%d, Buffer overflow\n", i);
/* buffer just one too short */
bufferA[0] = 'A';
ret = pGetDllDirectoryA(length, bufferA);
ok(ret == length + 1, "i=%d, Expected %u, got %u\n", i, length + 1, ret);
ok(ret == length + 1, "i=%d, Expected %lu, got %lu\n", i, length + 1, ret);
if (length != 0)
ok(bufferA[0] == 0, "i=%d, Buffer not null terminated\n", i);
bufferW[0] = 'A';
ret = pGetDllDirectoryW(length, bufferW);
ok(ret == length + 1, "i=%d, Expected %u, got %u\n", i, length + 1, ret);
ok(ret == length + 1, "i=%d, Expected %lu, got %lu\n", i, length + 1, ret);
if (length != 0)
ok(bufferW[0] == 0, "i=%d, Buffer overflow\n", i);
@ -884,10 +885,10 @@ static void testGetDllDirectory(void)
/* crashes on win8 */
/* no buffer, but too short length */
ret = pGetDllDirectoryA(length, NULL);
ok(ret == length + 1, "i=%d, Expected %u, got %u\n", i, length + 1, ret);
ok(ret == length + 1, "i=%d, Expected %lu, got %lu\n", i, length + 1, ret);
ret = pGetDllDirectoryW(length, NULL);
ok(ret == length + 1, "i=%d, Expected %u, got %u\n", i, length + 1, ret);
ok(ret == length + 1, "i=%d, Expected %lu, got %lu\n", i, length + 1, ret);
}
if (pLdrGetDllDirectory)
@ -897,7 +898,7 @@ static void testGetDllDirectory(void)
str.Buffer = bufferW;
str.MaximumLength = sizeof(bufferW);
status = pLdrGetDllDirectory( &str );
ok( !status, "LdrGetDllDirectory failed %x\n", status );
ok( !status, "LdrGetDllDirectory failed %lx\n", status );
ok( cmpStrAW( dll_directories[i], bufferW, strlen(dll_directories[i]),
str.Length / sizeof(WCHAR) ), "%u: got %s instead of %s\n",
i, wine_dbgstr_w(bufferW), dll_directories[i] );
@ -906,11 +907,11 @@ static void testGetDllDirectory(void)
memset( bufferW, 0xcc, sizeof(bufferW) );
str.MaximumLength = (strlen( dll_directories[i] ) - 1) * sizeof(WCHAR);
status = pLdrGetDllDirectory( &str );
ok( status == STATUS_BUFFER_TOO_SMALL, "%u: LdrGetDllDirectory failed %x\n", i, status );
ok( status == STATUS_BUFFER_TOO_SMALL, "%u: LdrGetDllDirectory failed %lx\n", i, status );
ok( bufferW[0] == 0 && bufferW[1] == 0xcccc,
"%u: buffer %x %x\n", i, bufferW[0], bufferW[1] );
length = (strlen( dll_directories[i] ) + 1) * sizeof(WCHAR);
ok( str.Length == length, "%u: wrong len %u / %u\n", i, str.Length, length );
ok( str.Length == length, "%u: wrong len %u / %lu\n", i, str.Length, length );
}
}
}
@ -963,18 +964,18 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExA( 0, NULL, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExA( 0, "kernel32", NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
mod = (HMODULE)0xdeadbeef;
ret = GetModuleHandleExA( 0, "kernel32", &mod );
ok( ret, "unexpected failure %u\n", GetLastError() );
ok( ret, "unexpected failure %lu\n", GetLastError() );
ok( mod != (HMODULE)0xdeadbeef, "got %p\n", mod );
FreeLibrary( mod );
@ -983,25 +984,25 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExA( 0, "nosuchmod", &mod );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
ok( error == ERROR_MOD_NOT_FOUND, "got %lu\n", error );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExW( 0, NULL, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExW( 0, kernel32W, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
mod = (HMODULE)0xdeadbeef;
ret = GetModuleHandleExW( 0, kernel32W, &mod );
ok( ret, "unexpected failure %u\n", GetLastError() );
ok( ret, "unexpected failure %lu\n", GetLastError() );
ok( mod != (HMODULE)0xdeadbeef, "got %p\n", mod );
FreeLibrary( mod );
@ -1010,25 +1011,25 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExW( 0, nosuchmodW, &mod );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
ok( error == ERROR_MOD_NOT_FOUND, "got %lu\n", error );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, NULL, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, "kernel32", NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
mod = (HMODULE)0xdeadbeef;
ret = GetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, "kernel32", &mod );
ok( ret, "unexpected failure %u\n", GetLastError() );
ok( ret, "unexpected failure %lu\n", GetLastError() );
ok( mod != (HMODULE)0xdeadbeef, "got %p\n", mod );
SetLastError( 0xdeadbeef );
@ -1036,25 +1037,25 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, "nosuchmod", &mod );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
ok( error == ERROR_MOD_NOT_FOUND, "got %lu\n", error );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, NULL, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, kernel32W, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
mod = (HMODULE)0xdeadbeef;
ret = GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, kernel32W, &mod );
ok( ret, "unexpected failure %u\n", GetLastError() );
ok( ret, "unexpected failure %lu\n", GetLastError() );
ok( mod != (HMODULE)0xdeadbeef, "got %p\n", mod );
SetLastError( 0xdeadbeef );
@ -1062,7 +1063,7 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, nosuchmodW, &mod );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
ok( error == ERROR_MOD_NOT_FOUND, "got %lu\n", error );
ok( mod == NULL, "got %p\n", mod );
mod_kernel32 = LoadLibraryA( "kernel32" );
@ -1071,18 +1072,18 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, NULL, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)mod_kernel32, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
mod = (HMODULE)0xdeadbeef;
ret = GetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)mod_kernel32, &mod );
ok( ret, "unexpected failure %u\n", GetLastError() );
ok( ret, "unexpected failure %lu\n", GetLastError() );
ok( mod == mod_kernel32, "got %p\n", mod );
FreeLibrary( mod );
@ -1091,25 +1092,25 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)0xbeefdead, &mod );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
ok( error == ERROR_MOD_NOT_FOUND, "got %lu\n", error );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, NULL, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
ret = GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)mod_kernel32, NULL );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
SetLastError( 0xdeadbeef );
mod = (HMODULE)0xdeadbeef;
ret = GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)mod_kernel32, &mod );
ok( ret, "unexpected failure %u\n", GetLastError() );
ok( ret, "unexpected failure %lu\n", GetLastError() );
ok( mod == mod_kernel32, "got %p\n", mod );
FreeLibrary( mod );
@ -1118,7 +1119,7 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)0xbeefdead, &mod );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
ok( error == ERROR_MOD_NOT_FOUND, "got %lu\n", error );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
@ -1127,7 +1128,7 @@ static void testGetModuleHandleEx(void)
| GET_MODULE_HANDLE_EX_FLAG_PIN, (LPCWSTR)mod_kernel32, &mod );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
@ -1135,7 +1136,7 @@ static void testGetModuleHandleEx(void)
ret = GetModuleHandleExW( 8, kernel32W, &mod );
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( error == ERROR_INVALID_PARAMETER, "got %lu\n", error );
ok( mod == NULL, "got %p\n", mod );
FreeLibrary( mod_kernel32 );
@ -1180,32 +1181,32 @@ static void test_AddDllDirectory(void)
buf[0] = '\0';
GetTempPathW(ARRAY_SIZE(path), path );
ret = GetTempFileNameW( path, tmpW, 0, buf );
ok( ret, "GetTempFileName failed err %u\n", GetLastError() );
ok( ret, "GetTempFileName failed err %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
cookie = pAddDllDirectory( buf );
ok( cookie != NULL, "AddDllDirectory failed err %u\n", GetLastError() );
ok( cookie != NULL, "AddDllDirectory failed err %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pRemoveDllDirectory( cookie );
ok( ret, "RemoveDllDirectory failed err %u\n", GetLastError() );
ok( ret, "RemoveDllDirectory failed err %lu\n", GetLastError() );
DeleteFileW( buf );
SetLastError( 0xdeadbeef );
cookie = pAddDllDirectory( buf );
ok( !cookie, "AddDllDirectory succeeded\n" );
ok( GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError() );
cookie = pAddDllDirectory( dotW );
ok( !cookie, "AddDllDirectory succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
cookie = pAddDllDirectory( rootW );
ok( cookie != NULL, "AddDllDirectory failed err %u\n", GetLastError() );
ok( cookie != NULL, "AddDllDirectory failed err %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pRemoveDllDirectory( cookie );
ok( ret, "RemoveDllDirectory failed err %u\n", GetLastError() );
ok( ret, "RemoveDllDirectory failed err %lu\n", GetLastError() );
GetWindowsDirectoryW( buf, MAX_PATH );
lstrcpyW( buf + 2, tmpW );
cookie = pAddDllDirectory( buf );
ok( !cookie, "AddDllDirectory succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
}
static void test_SetDefaultDllDirectories(void)
@ -1223,12 +1224,12 @@ static void test_SetDefaultDllDirectories(void)
ok( mod != NULL, "loading authz failed\n" );
FreeLibrary( mod );
ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_USER_DIRS );
ok( ret, "SetDefaultDllDirectories failed err %u\n", GetLastError() );
ok( ret, "SetDefaultDllDirectories failed err %lu\n", GetLastError() );
mod = LoadLibraryA( "authz.dll" );
ok( !mod, "loading authz succeeded\n" );
FreeLibrary( mod );
ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_SYSTEM32 );
ok( ret, "SetDefaultDllDirectories failed err %u\n", GetLastError() );
ok( ret, "SetDefaultDllDirectories failed err %lu\n", GetLastError() );
mod = LoadLibraryA( "authz.dll" );
ok( mod != NULL, "loading authz failed\n" );
FreeLibrary( mod );
@ -1236,12 +1237,12 @@ static void test_SetDefaultDllDirectories(void)
ok( !mod, "loading authz succeeded\n" );
FreeLibrary( mod );
ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_APPLICATION_DIR );
ok( ret, "SetDefaultDllDirectories failed err %u\n", GetLastError() );
ok( ret, "SetDefaultDllDirectories failed err %lu\n", GetLastError() );
mod = LoadLibraryA( "authz.dll" );
ok( !mod, "loading authz succeeded\n" );
FreeLibrary( mod );
ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_DEFAULT_DIRS );
ok( ret, "SetDefaultDllDirectories failed err %u\n", GetLastError() );
ok( ret, "SetDefaultDllDirectories failed err %lu\n", GetLastError() );
mod = LoadLibraryA( "authz.dll" );
ok( mod != NULL, "loading authz failed\n" );
FreeLibrary( mod );
@ -1249,27 +1250,27 @@ static void test_SetDefaultDllDirectories(void)
SetLastError( 0xdeadbeef );
ret = pSetDefaultDllDirectories( 0 );
ok( !ret, "SetDefaultDllDirectories succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pSetDefaultDllDirectories( 3 );
ok( !ret, "SetDefaultDllDirectories succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_APPLICATION_DIR | 0x8000 );
ok( !ret, "SetDefaultDllDirectories succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR );
ok( !ret || broken(ret) /* win7 */, "SetDefaultDllDirectories succeeded\n" );
if (!ret) ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
if (!ret) ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_USER_DIRS );
ok( !ret || broken(ret) /* win7 */, "SetDefaultDllDirectories succeeded\n" );
if (!ret) ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
if (!ret) ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
/* restore some sane defaults */
pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_DEFAULT_DIRS );
@ -1284,13 +1285,13 @@ static void check_refcount( HMODULE mod, unsigned int refcount )
{
ret = FreeLibrary( mod );
ok( ret || broken( refcount == ~0u && GetLastError() == ERROR_MOD_NOT_FOUND && i == 2 ) /* Win8 */,
"Refcount test failed, i %u, error %u.\n", i, GetLastError() );
"Refcount test failed, i %u, error %lu.\n", i, GetLastError() );
if (!ret) return;
}
if (refcount != ~0u)
{
ret = FreeLibrary( mod );
ok( !ret && GetLastError() == ERROR_MOD_NOT_FOUND, "Refcount test failed, ret %d, error %u.\n",
ok( !ret && GetLastError() == ERROR_MOD_NOT_FOUND, "Refcount test failed, ret %d, error %lu.\n",
ret, GetLastError() );
}
}
@ -1310,13 +1311,13 @@ static void test_LdrGetDllHandleEx(void)
RtlInitUnicodeString( &name, L"unknown.dll" );
status = pLdrGetDllHandleEx( 0, NULL, NULL, &name, &mod );
ok( status == STATUS_DLL_NOT_FOUND, "Got unexpected status %#x.\n", status );
ok( status == STATUS_DLL_NOT_FOUND, "Got unexpected status %#lx.\n", status );
RtlInitUnicodeString( &name, L"authz.dll" );
loaded_mod = LoadLibraryW( name.Buffer );
ok( !!loaded_mod, "Failed to load module.\n" );
status = pLdrGetDllHandleEx( 0, NULL, NULL, &name, &mod );
ok( !status, "Got unexpected status %#x.\n", status );
ok( !status, "Got unexpected status %#lx.\n", status );
ok( mod == loaded_mod, "got %p\n", mod );
winetest_push_context( "Flags 0" );
check_refcount( loaded_mod, 2 );
@ -1326,7 +1327,7 @@ static void test_LdrGetDllHandleEx(void)
ok( !!loaded_mod, "Failed to load module.\n" );
status = pLdrGetDllHandleEx( LDR_GET_DLL_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, NULL,
NULL, &name, &mod );
ok( !status, "Got unexpected status %#x.\n", status );
ok( !status, "Got unexpected status %#lx.\n", status );
ok( mod == loaded_mod, "got %p\n", mod );
winetest_push_context( "LDR_GET_DLL_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT" );
check_refcount( loaded_mod, 1 );
@ -1335,7 +1336,7 @@ static void test_LdrGetDllHandleEx(void)
loaded_mod = LoadLibraryW( name.Buffer );
ok( !!loaded_mod, "Failed to load module.\n" );
status = pLdrGetDllHandle( NULL, ~0u, &name, &mod );
ok( !status, "Got unexpected status %#x.\n", status );
ok( !status, "Got unexpected status %#lx.\n", status );
ok( mod == loaded_mod, "got %p\n", mod );
winetest_push_context( "LdrGetDllHandle" );
check_refcount( loaded_mod, 1 );
@ -1344,7 +1345,7 @@ static void test_LdrGetDllHandleEx(void)
loaded_mod = LoadLibraryW( name.Buffer );
ok( !!loaded_mod, "Failed to load module.\n" );
status = pLdrGetDllHandleEx( 4, NULL, NULL, (void *)&name, &mod );
ok( !status, "Got unexpected status %#x.\n", status );
ok( !status, "Got unexpected status %#lx.\n", status );
ok( mod == loaded_mod, "got %p\n", mod );
winetest_push_context( "Flag 4" );
check_refcount( loaded_mod, 2 );
@ -1355,7 +1356,7 @@ static void test_LdrGetDllHandleEx(void)
loaded_mod = LoadLibraryW( name.Buffer );
ok( !!loaded_mod, "Failed to load module.\n" );
status = pLdrGetDllHandleEx( 1 << i, NULL, NULL, &name, &mod );
ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status );
ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status );
winetest_push_context( "Invalid flags, i %u", i );
check_refcount( loaded_mod, 1 );
winetest_pop_context();
@ -1363,13 +1364,13 @@ static void test_LdrGetDllHandleEx(void)
status = pLdrGetDllHandleEx( LDR_GET_DLL_HANDLE_EX_FLAG_PIN | LDR_GET_DLL_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
NULL, NULL, &name, &mod );
ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status );
ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status );
loaded_mod = LoadLibraryW( name.Buffer );
ok( !!loaded_mod, "Failed to load module.\n" );
status = pLdrGetDllHandleEx( LDR_GET_DLL_HANDLE_EX_FLAG_PIN, NULL,
NULL, &name, &mod );
ok( !status, "Got unexpected status %#x.\n", status );
ok( !status, "Got unexpected status %#lx.\n", status );
ok( mod == loaded_mod, "got %p\n", mod );
winetest_push_context( "LDR_GET_DLL_HANDLE_EX_FLAG_PIN" );
check_refcount( loaded_mod, ~0u );
@ -1398,7 +1399,7 @@ static void test_LdrGetDllFullName(void)
memset( path_buffer, 0x23, sizeof(path_buffer) );
status = pLdrGetDllFullName( ntdll, &path );
ok( status == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#x.\n", status );
ok( status == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#lx.\n", status );
ok( path.Length == 0, "Expected length 0, got %d.\n", path.Length );
ok( path_buffer[0] == 0x2323, "Expected 0x2323, got 0x%x.\n", path_buffer[0] );
@ -1406,7 +1407,7 @@ static void test_LdrGetDllFullName(void)
path.MaximumLength = 5; /* odd numbers produce partially copied characters */
status = pLdrGetDllFullName( ntdll, &path );
ok( status == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#x.\n", status );
ok( status == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#lx.\n", status );
ok( path.Length == path.MaximumLength, "Expected length %u, got %u.\n", path.MaximumLength, path.Length );
expected_terminator = 0x2300 | (expected_path[path.MaximumLength / sizeof(WCHAR)] & 0xFF);
ok( path_buffer[path.MaximumLength / sizeof(WCHAR)] == expected_terminator,
@ -1421,12 +1422,12 @@ static void test_LdrGetDllFullName(void)
path.MaximumLength = sizeof(path_buffer);
status = pLdrGetDllFullName( ntdll, &path );
ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
ok( !lstrcmpiW(path_buffer, expected_path), "Expected %s, got %s\n",
wine_dbgstr_w(expected_path), wine_dbgstr_w(path_buffer) );
status = pLdrGetDllFullName( NULL, &path );
ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
GetModuleFileNameW( NULL, expected_path, ARRAY_SIZE(expected_path) );
ok( !lstrcmpiW(path_buffer, expected_path), "Expected %s, got %s.\n",
wine_dbgstr_w(expected_path), wine_dbgstr_w(path_buffer) );
@ -1478,14 +1479,14 @@ static void test_apisets(void)
winetest_push_context( "%u:%s", i, tests[i].name );
present = 0xff;
status = pApiSetQueryApiSetPresence( &name, &present );
ok( status == STATUS_SUCCESS, "wrong ret %x\n", status );
ok( status == STATUS_SUCCESS, "wrong ret %lx\n", status );
ok( present == tests[i].present || broken(!present && tests[i].broken) /* win8 */,
"wrong present %u\n", present );
if (pApiSetQueryApiSetPresenceEx)
{
present = in_schema = 0xff;
status = pApiSetQueryApiSetPresenceEx( &name, &in_schema, &present );
ok( status == tests[i].status, "wrong ret %x\n", status );
ok( status == tests[i].status, "wrong ret %lx\n", status );
if (!status)
{
ok( in_schema == tests[i].in_schema, "wrong in_schema %u\n", in_schema );
@ -1532,7 +1533,7 @@ static void test_ddag_node(void)
ok( !!hexe, "Got NULL exe handle.\n" );
status = LdrFindEntryForAddress( hexe, &mod );
ok( !status, "Got unexpected status %#x.\n", status );
ok( !status, "Got unexpected status %#lx.\n", status );
if (!(node = mod->DdagNode))
{
@ -1561,7 +1562,7 @@ static void test_ddag_node(void)
win_skip( "Empty dependencies list.\n" );
return;
}
todo_wine ok( node->LoadCount == -1, "Got unexpected LoadCount %d.\n", node->LoadCount );
todo_wine ok( node->LoadCount == -1, "Got unexpected LoadCount %ld.\n", node->LoadCount );
prev_node = NULL;
se = node->Dependencies.Tail;
@ -1601,7 +1602,7 @@ static void test_ddag_node(void)
ok( dep2 == dep, "Dependency not found in incoming deps list.\n" );
todo_wine ok( dep_node->LoadCount > 0 || broken(!dep_node->LoadCount) /* Win8 */,
"Got unexpected LoadCount %d.\n", dep_node->LoadCount );
"Got unexpected LoadCount %ld.\n", dep_node->LoadCount );
winetest_pop_context();
prev_node = dep_node;