Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
035295bb
Commit
035295bb
authored
Oct 17, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Oct 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Fix virtual memory tests compilation with __WINESRC__ defined.
parent
6774accd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
virtual.c
dlls/kernel32/tests/virtual.c
+27
-27
No files found.
dlls/kernel32/tests/virtual.c
View file @
035295bb
...
...
@@ -49,12 +49,12 @@ static HANDLE create_target_process(const char *arg)
char
cmdline
[
MAX_PATH
];
PROCESS_INFORMATION
pi
;
BOOL
ret
;
STARTUPINFO
si
=
{
0
};
STARTUPINFO
A
si
=
{
0
};
si
.
cb
=
sizeof
(
si
);
winetest_get_mainargs
(
&
argv
);
sprintf
(
cmdline
,
"%s %s %s"
,
argv
[
0
],
argv
[
1
],
arg
);
ret
=
CreateProcess
(
NULL
,
cmdline
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
);
ret
=
CreateProcess
A
(
NULL
,
cmdline
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
);
ok
(
ret
,
"error: %u
\n
"
,
GetLastError
());
ret
=
CloseHandle
(
pi
.
hThread
);
ok
(
ret
,
"error %u
\n
"
,
GetLastError
());
...
...
@@ -586,17 +586,17 @@ static void test_MapViewOfFile(void)
SetLastError
(
0xdeadbeef
);
name
=
"Local
\\
Foo"
;
file
=
CreateFileMapping
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
4096
,
name
);
file
=
CreateFileMapping
A
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
4096
,
name
);
/* nt4 doesn't have Local\\ */
if
(
!
file
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
)
{
name
=
"Foo"
;
file
=
CreateFileMapping
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
4096
,
name
);
file
=
CreateFileMapping
A
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
4096
,
name
);
}
ok
(
file
!=
0
,
"CreateFileMapping PAGE_READWRITE error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
mapping
=
OpenFileMapping
(
FILE_MAP_READ
,
FALSE
,
name
);
mapping
=
OpenFileMapping
A
(
FILE_MAP_READ
,
FALSE
,
name
);
ok
(
mapping
!=
0
,
"OpenFileMapping FILE_MAP_READ error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
...
...
@@ -623,7 +623,7 @@ static void test_MapViewOfFile(void)
CloseHandle
(
mapping
);
SetLastError
(
0xdeadbeef
);
mapping
=
OpenFileMapping
(
FILE_MAP_WRITE
,
FALSE
,
name
);
mapping
=
OpenFileMapping
A
(
FILE_MAP_WRITE
,
FALSE
,
name
);
ok
(
mapping
!=
0
,
"OpenFileMapping FILE_MAP_WRITE error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
...
...
@@ -1283,7 +1283,7 @@ static void test_write_watch(void)
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetWriteWatch
(
0
,
GetModuleHandle
(
0
),
size
,
results
,
&
count
,
&
pagesize
);
ret
=
pGetWriteWatch
(
0
,
GetModuleHandle
W
(
NULL
),
size
,
results
,
&
count
,
&
pagesize
);
if
(
ret
)
{
ok
(
ret
==
~
0u
,
"GetWriteWatch succeeded %u
\n
"
,
ret
);
...
...
@@ -1459,7 +1459,7 @@ static void test_write_watch(void)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pResetWriteWatch
(
GetModuleHandle
(
0
),
size
);
ret
=
pResetWriteWatch
(
GetModuleHandle
W
(
NULL
),
size
);
ok
(
ret
==
~
0u
,
"ResetWriteWatch succeeded %u
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
}
...
...
@@ -1486,7 +1486,7 @@ static void test_write_watch(void)
ret
=
pResetWriteWatch
(
base
,
0
);
ok
(
!
ret
,
"ResetWriteWatch failed %u
\n
"
,
ret
);
ret
=
pResetWriteWatch
(
GetModuleHandle
(
0
),
size
);
ret
=
pResetWriteWatch
(
GetModuleHandle
W
(
NULL
),
size
);
ok
(
!
ret
,
"ResetWriteWatch failed %u
\n
"
,
ret
);
}
...
...
@@ -1861,11 +1861,11 @@ static void test_CreateFileMapping_protection(void)
GetSystemInfo
(
&
si
);
trace
(
"system page size %#x
\n
"
,
si
.
dwPageSize
);
GetTempPath
(
MAX_PATH
,
temp_path
);
GetTempFileName
(
temp_path
,
"map"
,
0
,
file_name
);
GetTempPath
A
(
MAX_PATH
,
temp_path
);
GetTempFileName
A
(
temp_path
,
"map"
,
0
,
file_name
);
SetLastError
(
0xdeadbeef
);
hfile
=
CreateFile
(
file_name
,
GENERIC_READ
|
GENERIC_WRITE
|
GENERIC_EXECUTE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
hfile
=
CreateFile
A
(
file_name
,
GENERIC_READ
|
GENERIC_WRITE
|
GENERIC_EXECUTE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"CreateFile(%s) error %d
\n
"
,
file_name
,
GetLastError
());
SetFilePointer
(
hfile
,
si
.
dwPageSize
,
NULL
,
FILE_BEGIN
);
SetEndOfFile
(
hfile
);
...
...
@@ -1873,7 +1873,7 @@ static void test_CreateFileMapping_protection(void)
for
(
i
=
0
;
i
<
sizeof
(
td
)
/
sizeof
(
td
[
0
]);
i
++
)
{
SetLastError
(
0xdeadbeef
);
hmap
=
CreateFileMapping
(
hfile
,
NULL
,
td
[
i
].
prot
|
SEC_COMMIT
,
0
,
si
.
dwPageSize
,
NULL
);
hmap
=
CreateFileMapping
W
(
hfile
,
NULL
,
td
[
i
].
prot
|
SEC_COMMIT
,
0
,
si
.
dwPageSize
,
NULL
);
if
(
td
[
i
].
success
)
{
...
...
@@ -1954,7 +1954,7 @@ todo_wine
if
(
page_exec_supported
)
alloc_prot
=
PAGE_EXECUTE_READWRITE
;
else
alloc_prot
=
PAGE_READWRITE
;
SetLastError
(
0xdeadbeef
);
hmap
=
CreateFileMapping
(
hfile
,
NULL
,
alloc_prot
,
0
,
si
.
dwPageSize
,
NULL
);
hmap
=
CreateFileMapping
W
(
hfile
,
NULL
,
alloc_prot
,
0
,
si
.
dwPageSize
,
NULL
);
ok
(
hmap
!=
0
,
"%d: CreateFileMapping error %d
\n
"
,
i
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
...
...
@@ -2065,7 +2065,7 @@ todo_wine
CloseHandle
(
hmap
);
CloseHandle
(
hfile
);
DeleteFile
(
file_name
);
DeleteFile
A
(
file_name
);
}
#define ACCESS_READ 0x01
...
...
@@ -2252,11 +2252,11 @@ static void test_mapping(void)
GetSystemInfo
(
&
si
);
trace
(
"system page size %#x
\n
"
,
si
.
dwPageSize
);
GetTempPath
(
MAX_PATH
,
temp_path
);
GetTempFileName
(
temp_path
,
"map"
,
0
,
file_name
);
GetTempPath
A
(
MAX_PATH
,
temp_path
);
GetTempFileName
A
(
temp_path
,
"map"
,
0
,
file_name
);
SetLastError
(
0xdeadbeef
);
hfile
=
CreateFile
(
file_name
,
GENERIC_READ
|
GENERIC_WRITE
|
GENERIC_EXECUTE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
hfile
=
CreateFile
A
(
file_name
,
GENERIC_READ
|
GENERIC_WRITE
|
GENERIC_EXECUTE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"CreateFile(%s) error %d
\n
"
,
file_name
,
GetLastError
());
SetFilePointer
(
hfile
,
si
.
dwPageSize
,
NULL
,
FILE_BEGIN
);
SetEndOfFile
(
hfile
);
...
...
@@ -2264,7 +2264,7 @@ static void test_mapping(void)
for
(
i
=
0
;
i
<
sizeof
(
page_prot
)
/
sizeof
(
page_prot
[
0
]);
i
++
)
{
SetLastError
(
0xdeadbeef
);
hmap
=
CreateFileMapping
(
hfile
,
NULL
,
page_prot
[
i
]
|
SEC_COMMIT
,
0
,
si
.
dwPageSize
,
NULL
);
hmap
=
CreateFileMapping
W
(
hfile
,
NULL
,
page_prot
[
i
]
|
SEC_COMMIT
,
0
,
si
.
dwPageSize
,
NULL
);
if
(
page_prot
[
i
]
==
PAGE_NOACCESS
)
{
...
...
@@ -2275,7 +2275,7 @@ static void test_mapping(void)
/* A trick to create a not accessible mapping */
SetLastError
(
0xdeadbeef
);
hmap
=
CreateFileMapping
(
hfile
,
NULL
,
PAGE_READWRITE
|
SEC_COMMIT
,
0
,
si
.
dwPageSize
,
NULL
);
hmap
=
CreateFileMapping
W
(
hfile
,
NULL
,
PAGE_READWRITE
|
SEC_COMMIT
,
0
,
si
.
dwPageSize
,
NULL
);
ok
(
hmap
!=
0
,
"CreateFileMapping(PAGE_READWRITE) error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
DuplicateHandle
(
GetCurrentProcess
(),
hmap
,
GetCurrentProcess
(),
&
hmap2
,
0
,
FALSE
,
0
);
...
...
@@ -2442,7 +2442,7 @@ todo_wine
}
CloseHandle
(
hfile
);
DeleteFile
(
file_name
);
DeleteFile
A
(
file_name
);
}
static
void
test_shared_memory
(
int
is_child
)
...
...
@@ -2451,7 +2451,7 @@ static void test_shared_memory(int is_child)
LONG
*
p
;
SetLastError
(
0xdeadbef
);
mapping
=
CreateFileMapping
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
4096
,
"winetest_virtual.c"
);
mapping
=
CreateFileMapping
A
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
4096
,
"winetest_virtual.c"
);
ok
(
mapping
!=
0
,
"CreateFileMapping error %d
\n
"
,
GetLastError
());
if
(
is_child
)
ok
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"expected ERROR_ALREADY_EXISTS, got %d
\n
"
,
GetLastError
());
...
...
@@ -2469,14 +2469,14 @@ static void test_shared_memory(int is_child)
char
**
argv
;
char
cmdline
[
MAX_PATH
];
PROCESS_INFORMATION
pi
;
STARTUPINFO
si
=
{
sizeof
(
si
)
};
STARTUPINFO
A
si
=
{
sizeof
(
si
)
};
DWORD
ret
;
*
p
=
0x1a2b3c4d
;
winetest_get_mainargs
(
&
argv
);
sprintf
(
cmdline
,
"
\"
%s
\"
virtual sharedmem"
,
argv
[
0
]);
ret
=
CreateProcess
(
argv
[
0
],
cmdline
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
);
ret
=
CreateProcess
A
(
argv
[
0
],
cmdline
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
);
ok
(
ret
,
"CreateProcess(%s) error %d
\n
"
,
cmdline
,
GetLastError
());
winetest_wait_child_process
(
pi
.
hProcess
);
CloseHandle
(
pi
.
hThread
);
...
...
@@ -2525,10 +2525,10 @@ START_TEST(virtual)
pVirtualFreeEx
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"VirtualFreeEx"
);
pGetWriteWatch
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"GetWriteWatch"
);
pResetWriteWatch
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"ResetWriteWatch"
);
pNtAreMappedFilesTheSame
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"ntdll.dll"
),
pNtAreMappedFilesTheSame
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
A
(
"ntdll.dll"
),
"NtAreMappedFilesTheSame"
);
pNtMapViewOfSection
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"ntdll.dll"
),
"NtMapViewOfSection"
);
pNtUnmapViewOfSection
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"ntdll.dll"
),
"NtUnmapViewOfSection"
);
pNtMapViewOfSection
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
A
(
"ntdll.dll"
),
"NtMapViewOfSection"
);
pNtUnmapViewOfSection
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
A
(
"ntdll.dll"
),
"NtUnmapViewOfSection"
);
test_shared_memory
(
0
);
test_mapping
();
...
...
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