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
1026bddf
Commit
1026bddf
authored
Dec 20, 2011
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Dec 20, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Add a test for MapViewOfFile called on a not accessible mapping.
parent
b5b9184d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
virtual.c
dlls/kernel32/tests/virtual.c
+19
-6
No files found.
dlls/kernel32/tests/virtual.c
View file @
1026bddf
...
...
@@ -1939,6 +1939,7 @@ static DWORD map_prot_to_access(DWORD prot)
static
BOOL
is_compatible_access
(
DWORD
map_prot
,
DWORD
view_prot
)
{
DWORD
access
=
map_prot_to_access
(
map_prot
);
if
(
!
access
)
return
FALSE
;
return
(
view_prot
&
access
)
==
view_prot
;
}
...
...
@@ -2012,16 +2013,28 @@ static void test_mapping(void)
SetLastError
(
0xdeadbeef
);
hmap
=
CreateFileMapping
(
hfile
,
NULL
,
page_prot
[
i
]
|
SEC_COMMIT
,
0
,
si
.
dwPageSize
,
NULL
);
if
(
page_prot
[
i
]
==
PAGE_NOACCESS
)
{
HANDLE
hmap2
;
ok
(
!
hmap
,
"CreateFileMapping(PAGE_NOACCESS) should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
/* A trick to create a not accessible mapping */
SetLastError
(
0xdeadbeef
);
hmap
=
CreateFileMapping
(
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
);
ok
(
ret
,
"DuplicateHandle error %d
\n
"
,
GetLastError
());
CloseHandle
(
hmap
);
hmap
=
hmap2
;
}
if
(
!
hmap
)
{
trace
(
"%d: CreateFileMapping(%04x) failed: %d
\n
"
,
i
,
page_prot
[
i
],
GetLastError
());
if
(
page_prot
[
i
]
==
PAGE_NOACCESS
)
{
ok
(
!
hmap
,
"%d: CreateFileMapping(%04x) should fail
\n
"
,
i
,
page_prot
[
i
]);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d: expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
i
,
GetLastError
());
continue
;
}
/* NT4 and win2k don't support EXEC on file mappings */
if
(
page_prot
[
i
]
==
PAGE_EXECUTE_READ
||
page_prot
[
i
]
==
PAGE_EXECUTE_READWRITE
)
{
...
...
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