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
503269a4
Commit
503269a4
authored
Nov 04, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add a few more tests, fix some failures on Windows.
parent
fdf2e7a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
41 deletions
+62
-41
virtual.c
dlls/kernel32/tests/virtual.c
+62
-41
No files found.
dlls/kernel32/tests/virtual.c
View file @
503269a4
...
@@ -466,20 +466,23 @@ static void test_MapViewOfFile(void)
...
@@ -466,20 +466,23 @@ static void test_MapViewOfFile(void)
ok
(
mapping
!=
0
,
"OpenFileMapping FILE_MAP_READ error %u
\n
"
,
GetLastError
()
);
ok
(
mapping
!=
0
,
"OpenFileMapping FILE_MAP_READ error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
todo_wine
ok
(
!
ptr
,
"MapViewOfFile FILE_MAP_WRITE should fail
\n
"
);
if
(
!
ptr
)
todo_wine
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Wrong error %d
\n
"
,
GetLastError
()
);
{
SetLastError
(
0xdeadbeef
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Wrong error %d
\n
"
,
GetLastError
()
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
SetLastError
(
0xdeadbeef
);
ok
(
ptr
!=
NULL
,
"MapViewOfFile FILE_MAP_READ error %u
\n
"
,
GetLastError
()
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
SetLastError
(
0xdeadbeef
);
ok
(
ptr
!=
NULL
,
"MapViewOfFile FILE_MAP_READ error %u
\n
"
,
GetLastError
()
);
ok
(
VirtualQuery
(
ptr
,
&
info
,
sizeof
(
info
)
)
==
sizeof
(
info
),
SetLastError
(
0xdeadbeef
);
"VirtualQuery error %u
\n
"
,
GetLastError
()
);
ok
(
VirtualQuery
(
ptr
,
&
info
,
sizeof
(
info
)
)
==
sizeof
(
info
),
ok
(
info
.
BaseAddress
==
ptr
,
"%p != %p
\n
"
,
info
.
BaseAddress
,
ptr
);
"VirtualQuery error %u
\n
"
,
GetLastError
()
);
ok
(
info
.
AllocationBase
==
ptr
,
"%p != %p
\n
"
,
info
.
AllocationBase
,
ptr
);
ok
(
info
.
BaseAddress
==
ptr
,
"%p != %p
\n
"
,
info
.
BaseAddress
,
ptr
);
todo_wine
ok
(
info
.
AllocationProtect
==
PAGE_READONLY
,
"%x != PAGE_READONLY
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
AllocationBase
==
ptr
,
"%p != %p
\n
"
,
info
.
AllocationBase
,
ptr
);
ok
(
info
.
RegionSize
==
4096
,
"%lx != 4096
\n
"
,
info
.
RegionSize
);
ok
(
info
.
AllocationProtect
==
PAGE_READONLY
,
"%x != PAGE_READONLY
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
State
==
MEM_COMMIT
,
"%x != MEM_COMMIT
\n
"
,
info
.
State
);
ok
(
info
.
RegionSize
==
4096
,
"%lx != 4096
\n
"
,
info
.
RegionSize
);
todo_wine
ok
(
info
.
Protect
==
PAGE_READONLY
,
"%x != PAGE_READONLY
\n
"
,
info
.
Protect
);
ok
(
info
.
State
==
MEM_COMMIT
,
"%x != MEM_COMMIT
\n
"
,
info
.
State
);
ok
(
info
.
Protect
==
PAGE_READONLY
,
"%x != PAGE_READONLY
\n
"
,
info
.
Protect
);
}
else
todo_wine
win_skip
(
"no access checks on win9x
\n
"
);
UnmapViewOfFile
(
ptr
);
UnmapViewOfFile
(
ptr
);
CloseHandle
(
mapping
);
CloseHandle
(
mapping
);
...
@@ -488,20 +491,23 @@ todo_wine ok( info.Protect == PAGE_READONLY, "%x != PAGE_READONLY\n", info.Prote
...
@@ -488,20 +491,23 @@ todo_wine ok( info.Protect == PAGE_READONLY, "%x != PAGE_READONLY\n", info.Prote
ok
(
mapping
!=
0
,
"OpenFileMapping FILE_MAP_WRITE error %u
\n
"
,
GetLastError
()
);
ok
(
mapping
!=
0
,
"OpenFileMapping FILE_MAP_WRITE error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
todo_wine
ok
(
!
ptr
,
"MapViewOfFile FILE_MAP_READ should fail
\n
"
);
if
(
!
ptr
)
todo_wine
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Wrong error %d
\n
"
,
GetLastError
()
);
{
SetLastError
(
0xdeadbeef
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Wrong error %d
\n
"
,
GetLastError
()
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
SetLastError
(
0xdeadbeef
);
ok
(
ptr
!=
NULL
,
"MapViewOfFile FILE_MAP_WRITE error %u
\n
"
,
GetLastError
()
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
SetLastError
(
0xdeadbeef
);
ok
(
ptr
!=
NULL
,
"MapViewOfFile FILE_MAP_WRITE error %u
\n
"
,
GetLastError
()
);
ok
(
VirtualQuery
(
ptr
,
&
info
,
sizeof
(
info
)
)
==
sizeof
(
info
),
SetLastError
(
0xdeadbeef
);
"VirtualQuery error %u
\n
"
,
GetLastError
()
);
ok
(
VirtualQuery
(
ptr
,
&
info
,
sizeof
(
info
)
)
==
sizeof
(
info
),
ok
(
info
.
BaseAddress
==
ptr
,
"%p != %p
\n
"
,
info
.
BaseAddress
,
ptr
);
"VirtualQuery error %u
\n
"
,
GetLastError
()
);
ok
(
info
.
AllocationBase
==
ptr
,
"%p != %p
\n
"
,
info
.
AllocationBase
,
ptr
);
ok
(
info
.
BaseAddress
==
ptr
,
"%p != %p
\n
"
,
info
.
BaseAddress
,
ptr
);
ok
(
info
.
AllocationProtect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
AllocationBase
==
ptr
,
"%p != %p
\n
"
,
info
.
AllocationBase
,
ptr
);
ok
(
info
.
RegionSize
==
4096
,
"%lx != 4096
\n
"
,
info
.
RegionSize
);
ok
(
info
.
AllocationProtect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
State
==
MEM_COMMIT
,
"%x != MEM_COMMIT
\n
"
,
info
.
State
);
ok
(
info
.
RegionSize
==
4096
,
"%lx != 4096
\n
"
,
info
.
RegionSize
);
ok
(
info
.
Protect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
Protect
);
ok
(
info
.
State
==
MEM_COMMIT
,
"%x != MEM_COMMIT
\n
"
,
info
.
State
);
ok
(
info
.
Protect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
Protect
);
}
else
todo_wine
win_skip
(
"no access checks on win9x
\n
"
);
UnmapViewOfFile
(
ptr
);
UnmapViewOfFile
(
ptr
);
CloseHandle
(
mapping
);
CloseHandle
(
mapping
);
...
@@ -514,6 +520,11 @@ todo_wine ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLast
...
@@ -514,6 +520,11 @@ todo_wine ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLast
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
ok
(
ptr
!=
NULL
,
"MapViewOfFile failed with error %d
\n
"
,
GetLastError
());
ok
(
ptr
!=
NULL
,
"MapViewOfFile failed with error %d
\n
"
,
GetLastError
());
ptr2
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
/* on NT ptr != ptr2 but on Win9x ptr == ptr2 */
ok
(
ptr2
!=
NULL
,
"MapViewOfFile failed with error %d
\n
"
,
GetLastError
());
trace
(
"mapping same section resulted in views %p and %p
\n
"
,
ptr
,
ptr2
);
ret
=
VirtualQuery
(
ptr
,
&
info
,
sizeof
(
info
));
ret
=
VirtualQuery
(
ptr
,
&
info
,
sizeof
(
info
));
ok
(
ret
,
"VirtualQuery failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
,
"VirtualQuery failed with error %d
\n
"
,
GetLastError
());
ok
(
info
.
BaseAddress
==
ptr
,
"BaseAddress should have been %p but was %p instead
\n
"
,
ptr
,
info
.
BaseAddress
);
ok
(
info
.
BaseAddress
==
ptr
,
"BaseAddress should have been %p but was %p instead
\n
"
,
ptr
,
info
.
BaseAddress
);
...
@@ -526,7 +537,19 @@ todo_wine
...
@@ -526,7 +537,19 @@ todo_wine
ok
(
info
.
Protect
==
0
,
"Protect should have been 0 instead of 0x%x
\n
"
,
info
.
Protect
);
ok
(
info
.
Protect
==
0
,
"Protect should have been 0 instead of 0x%x
\n
"
,
info
.
Protect
);
ok
(
info
.
Type
==
MEM_MAPPED
,
"Type should have been MEM_MAPPED instead of 0x%x
\n
"
,
info
.
Type
);
ok
(
info
.
Type
==
MEM_MAPPED
,
"Type should have been MEM_MAPPED instead of 0x%x
\n
"
,
info
.
Type
);
ptr
=
VirtualAlloc
(
ptr
,
0x10000
,
MEM_COMMIT
,
PAGE_READWRITE
);
ret
=
VirtualQuery
(
ptr2
,
&
info
,
sizeof
(
info
));
ok
(
ret
,
"VirtualQuery failed with error %d
\n
"
,
GetLastError
());
ok
(
info
.
BaseAddress
==
ptr2
,
"BaseAddress should have been %p but was %p instead
\n
"
,
ptr2
,
info
.
BaseAddress
);
ok
(
info
.
AllocationBase
==
ptr2
,
"AllocationBase should have been %p but was %p instead
\n
"
,
ptr2
,
info
.
AllocationBase
);
ok
(
info
.
AllocationProtect
==
PAGE_READWRITE
,
"AllocationProtect should have been PAGE_READWRITE but was 0x%x
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
RegionSize
==
MAPPING_SIZE
,
"RegionSize should have been 0x%x but was 0x%x
\n
"
,
MAPPING_SIZE
,
(
unsigned
int
)
info
.
RegionSize
);
todo_wine
ok
(
info
.
State
==
MEM_RESERVE
,
"State should have been MEM_RESERVE instead of 0x%x
\n
"
,
info
.
State
);
todo_wine
ok
(
info
.
Protect
==
0
,
"Protect should have been 0 instead of 0x%x
\n
"
,
info
.
Protect
);
ok
(
info
.
Type
==
MEM_MAPPED
,
"Type should have been MEM_MAPPED instead of 0x%x
\n
"
,
info
.
Type
);
ptr
=
VirtualAlloc
(
ptr
,
0x10000
,
MEM_COMMIT
,
PAGE_READONLY
);
ok
(
ptr
!=
NULL
,
"VirtualAlloc failed with error %d
\n
"
,
GetLastError
());
ok
(
ptr
!=
NULL
,
"VirtualAlloc failed with error %d
\n
"
,
GetLastError
());
ret
=
VirtualQuery
(
ptr
,
&
info
,
sizeof
(
info
));
ret
=
VirtualQuery
(
ptr
,
&
info
,
sizeof
(
info
));
...
@@ -534,17 +557,11 @@ todo_wine
...
@@ -534,17 +557,11 @@ todo_wine
ok
(
info
.
BaseAddress
==
ptr
,
"BaseAddress should have been %p but was %p instead
\n
"
,
ptr
,
info
.
BaseAddress
);
ok
(
info
.
BaseAddress
==
ptr
,
"BaseAddress should have been %p but was %p instead
\n
"
,
ptr
,
info
.
BaseAddress
);
ok
(
info
.
AllocationBase
==
ptr
,
"AllocationBase should have been %p but was %p instead
\n
"
,
ptr
,
info
.
AllocationBase
);
ok
(
info
.
AllocationBase
==
ptr
,
"AllocationBase should have been %p but was %p instead
\n
"
,
ptr
,
info
.
AllocationBase
);
ok
(
info
.
AllocationProtect
==
PAGE_READWRITE
,
"AllocationProtect should have been PAGE_READWRITE but was 0x%x
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
AllocationProtect
==
PAGE_READWRITE
,
"AllocationProtect should have been PAGE_READWRITE but was 0x%x
\n
"
,
info
.
AllocationProtect
);
todo_wine
ok
(
info
.
RegionSize
==
0x10000
,
"RegionSize should have been 0x10000 but was 0x%x
\n
"
,
(
unsigned
int
)
info
.
RegionSize
);
ok
(
info
.
RegionSize
==
0x10000
,
"RegionSize should have been 0x10000 but was 0x%x
\n
"
,
(
unsigned
int
)
info
.
RegionSize
);
ok
(
info
.
State
==
MEM_COMMIT
,
"State should have been MEM_RESERVE instead of 0x%x
\n
"
,
info
.
State
);
ok
(
info
.
State
==
MEM_COMMIT
,
"State should have been MEM_RESERVE instead of 0x%x
\n
"
,
info
.
State
);
ok
(
info
.
Protect
==
PAGE_READ
WRITE
,
"Protect should have been 0 instead of 0x%x
\n
"
,
info
.
Protect
);
ok
(
info
.
Protect
==
PAGE_READ
ONLY
,
"Protect should have been 0 instead of 0x%x
\n
"
,
info
.
Protect
);
ok
(
info
.
Type
==
MEM_MAPPED
,
"Type should have been MEM_MAPPED instead of 0x%x
\n
"
,
info
.
Type
);
ok
(
info
.
Type
==
MEM_MAPPED
,
"Type should have been MEM_MAPPED instead of 0x%x
\n
"
,
info
.
Type
);
ptr2
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
/* on NT ptr != ptr2 but on Win9x ptr == ptr2 */
ok
(
ptr2
!=
NULL
,
"MapViewOfFile failed with error %d
\n
"
,
GetLastError
());
trace
(
"mapping same section resulted in views %p and %p
\n
"
,
ptr
,
ptr2
);
/* shows that the VirtualAlloc above affects the mapping, not just the
/* shows that the VirtualAlloc above affects the mapping, not just the
* virtual memory in this process - it also affects all other processes
* virtual memory in this process - it also affects all other processes
* with a view of the mapping, but that isn't tested here */
* with a view of the mapping, but that isn't tested here */
...
@@ -559,6 +576,10 @@ todo_wine
...
@@ -559,6 +576,10 @@ todo_wine
ok
(
info
.
Protect
==
PAGE_READWRITE
,
"Protect should have been 0 instead of 0x%x
\n
"
,
info
.
Protect
);
ok
(
info
.
Protect
==
PAGE_READWRITE
,
"Protect should have been 0 instead of 0x%x
\n
"
,
info
.
Protect
);
ok
(
info
.
Type
==
MEM_MAPPED
,
"Type should have been MEM_MAPPED instead of 0x%x
\n
"
,
info
.
Type
);
ok
(
info
.
Type
==
MEM_MAPPED
,
"Type should have been MEM_MAPPED instead of 0x%x
\n
"
,
info
.
Type
);
ret
=
VirtualFree
(
ptr
,
0x10000
,
MEM_DECOMMIT
);
ok
(
!
ret
,
"VirtualFree succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"VirtualFree failed with %u
\n
"
,
GetLastError
()
);
ret
=
UnmapViewOfFile
(
ptr2
);
ret
=
UnmapViewOfFile
(
ptr2
);
ok
(
ret
,
"UnmapViewOfFile failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
,
"UnmapViewOfFile failed with error %d
\n
"
,
GetLastError
());
ret
=
UnmapViewOfFile
(
ptr
);
ret
=
UnmapViewOfFile
(
ptr
);
...
@@ -638,31 +659,31 @@ static void test_CreateFileMapping(void)
...
@@ -638,31 +659,31 @@ static void test_CreateFileMapping(void)
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
handle
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
SEC_COMMIT
|
PAGE_READWRITE
,
0
,
0x1000
,
handle
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
SEC_COMMIT
|
PAGE_READWRITE
,
0
,
0x1000
,
__FILE__
":
Test Mapping"
);
"Wine
Test Mapping"
);
ok
(
handle
!=
NULL
,
"CreateFileMapping failed with error %u
\n
"
,
GetLastError
());
ok
(
handle
!=
NULL
,
"CreateFileMapping failed with error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0
,
"wrong error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0
,
"wrong error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
handle2
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
SEC_COMMIT
|
PAGE_READWRITE
,
0
,
0x1000
,
handle2
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
SEC_COMMIT
|
PAGE_READWRITE
,
0
,
0x1000
,
__FILE__
":
Test Mapping"
);
"Wine
Test Mapping"
);
ok
(
handle2
!=
NULL
,
"CreateFileMapping failed with error %d
\n
"
,
GetLastError
());
ok
(
handle2
!=
NULL
,
"CreateFileMapping failed with error %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"wrong error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"wrong error %u
\n
"
,
GetLastError
());
CloseHandle
(
handle2
);
CloseHandle
(
handle2
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
handle2
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
SEC_COMMIT
|
PAGE_READWRITE
,
0
,
0x1000
,
handle2
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
SEC_COMMIT
|
PAGE_READWRITE
,
0
,
0x1000
,
__FILE__
":
TEST MAPPING"
);
"WINE
TEST MAPPING"
);
ok
(
handle2
!=
NULL
,
"CreateFileMapping failed with error %d
\n
"
,
GetLastError
());
ok
(
handle2
!=
NULL
,
"CreateFileMapping failed with error %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0
,
"wrong error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0
,
"wrong error %u
\n
"
,
GetLastError
());
CloseHandle
(
handle2
);
CloseHandle
(
handle2
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
handle2
=
OpenFileMappingA
(
FILE_MAP_ALL_ACCESS
,
FALSE
,
__FILE__
":
Test Mapping"
);
handle2
=
OpenFileMappingA
(
FILE_MAP_ALL_ACCESS
,
FALSE
,
"Wine
Test Mapping"
);
ok
(
handle2
!=
NULL
,
"OpenFileMapping failed with error %d
\n
"
,
GetLastError
());
ok
(
handle2
!=
NULL
,
"OpenFileMapping failed with error %d
\n
"
,
GetLastError
());
CloseHandle
(
handle2
);
CloseHandle
(
handle2
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
handle2
=
OpenFileMappingA
(
FILE_MAP_ALL_ACCESS
,
FALSE
,
__FILE__
":
TEST MAPPING"
);
handle2
=
OpenFileMappingA
(
FILE_MAP_ALL_ACCESS
,
FALSE
,
"WINE
TEST MAPPING"
);
ok
(
!
handle2
,
"OpenFileMapping succeeded
\n
"
);
ok
(
!
handle2
,
"OpenFileMapping succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
());
...
...
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