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