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
54e2211d
Commit
54e2211d
authored
Apr 12, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Apr 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Add a shared memory test.
parent
87278835
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
virtual.c
dlls/kernel32/tests/virtual.c
+48
-0
No files found.
dlls/kernel32/tests/virtual.c
View file @
54e2211d
...
...
@@ -2386,6 +2386,48 @@ static void test_mapping(void)
DeleteFile
(
file_name
);
}
static
void
test_shared_memory
(
int
is_child
)
{
HANDLE
mapping
;
LONG
*
p
;
SetLastError
(
0xdeadbef
);
mapping
=
CreateFileMapping
(
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
());
SetLastError
(
0xdeadbef
);
p
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
|
FILE_MAP_WRITE
,
0
,
0
,
4096
);
ok
(
p
!=
NULL
,
"MapViewOfFile error %d
\n
"
,
GetLastError
());
if
(
is_child
)
{
ok
(
*
p
==
0x1a2b3c4d
,
"expected 0x1a2b3c4d in child, got %#x
\n
"
,
*
p
);
}
else
{
char
**
argv
;
char
cmdline
[
MAX_PATH
];
PROCESS_INFORMATION
pi
;
STARTUPINFO
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
);
ok
(
ret
,
"CreateProcess(%s) error %d
\n
"
,
cmdline
,
GetLastError
());
winetest_wait_child_process
(
pi
.
hProcess
);
CloseHandle
(
pi
.
hThread
);
CloseHandle
(
pi
.
hProcess
);
}
UnmapViewOfFile
(
p
);
CloseHandle
(
mapping
);
}
START_TEST
(
virtual
)
{
int
argc
;
...
...
@@ -2399,6 +2441,11 @@ START_TEST(virtual)
Sleep
(
5000
);
/* spawned process runs for at most 5 seconds */
return
;
}
if
(
!
strcmp
(
argv
[
2
],
"sharedmem"
))
{
test_shared_memory
(
1
);
return
;
}
while
(
1
)
{
void
*
mem
;
...
...
@@ -2424,6 +2471,7 @@ START_TEST(virtual)
pNtMapViewOfSection
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"ntdll.dll"
),
"NtMapViewOfSection"
);
pNtUnmapViewOfSection
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"ntdll.dll"
),
"NtUnmapViewOfSection"
);
test_shared_memory
(
0
);
test_mapping
();
test_CreateFileMapping_protection
();
test_VirtualAlloc_protection
();
...
...
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