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
e625e86e
Commit
e625e86e
authored
Mar 11, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Don't set unconditionally SECTION_QUERY flag in OpenFileMapping.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0cb983f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
security.c
dlls/advapi32/tests/security.c
+30
-2
virtual.c
dlls/kernel32/virtual.c
+0
-1
No files found.
dlls/advapi32/tests/security.c
View file @
e625e86e
...
@@ -5560,17 +5560,23 @@ static void test_filemap_security(void)
...
@@ -5560,17 +5560,23 @@ static void test_filemap_security(void)
char
temp_path
[
MAX_PATH
];
char
temp_path
[
MAX_PATH
];
char
file_name
[
MAX_PATH
];
char
file_name
[
MAX_PATH
];
DWORD
ret
,
i
,
access
;
DWORD
ret
,
i
,
access
;
HANDLE
file
,
mapping
,
dup
;
HANDLE
file
,
mapping
,
dup
,
created_mapping
;
static
const
struct
static
const
struct
{
{
int
generic
,
mapped
;
int
generic
,
mapped
;
BOOL
open_only
;
}
map
[]
=
}
map
[]
=
{
{
{
0
,
0
},
{
0
,
0
},
{
GENERIC_READ
,
STANDARD_RIGHTS_READ
|
SECTION_QUERY
|
SECTION_MAP_READ
},
{
GENERIC_READ
,
STANDARD_RIGHTS_READ
|
SECTION_QUERY
|
SECTION_MAP_READ
},
{
GENERIC_WRITE
,
STANDARD_RIGHTS_WRITE
|
SECTION_MAP_WRITE
},
{
GENERIC_WRITE
,
STANDARD_RIGHTS_WRITE
|
SECTION_MAP_WRITE
},
{
GENERIC_EXECUTE
,
STANDARD_RIGHTS_EXECUTE
|
SECTION_MAP_EXECUTE
},
{
GENERIC_EXECUTE
,
STANDARD_RIGHTS_EXECUTE
|
SECTION_MAP_EXECUTE
},
{
GENERIC_ALL
,
STANDARD_RIGHTS_REQUIRED
|
SECTION_ALL_ACCESS
}
{
GENERIC_ALL
,
STANDARD_RIGHTS_REQUIRED
|
SECTION_ALL_ACCESS
},
{
SECTION_MAP_READ
|
SECTION_MAP_WRITE
,
SECTION_MAP_READ
|
SECTION_MAP_WRITE
},
{
SECTION_MAP_WRITE
,
SECTION_MAP_WRITE
},
{
SECTION_MAP_READ
|
SECTION_QUERY
,
SECTION_MAP_READ
|
SECTION_QUERY
},
{
SECTION_QUERY
,
SECTION_MAP_READ
,
TRUE
},
{
SECTION_QUERY
|
SECTION_MAP_READ
,
SECTION_QUERY
|
SECTION_MAP_READ
}
};
};
static
const
struct
static
const
struct
{
{
...
@@ -5599,6 +5605,8 @@ static void test_filemap_security(void)
...
@@ -5599,6 +5605,8 @@ static void test_filemap_security(void)
for
(
i
=
0
;
i
<
sizeof
(
prot_map
)
/
sizeof
(
prot_map
[
0
]);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
prot_map
)
/
sizeof
(
prot_map
[
0
]);
i
++
)
{
{
if
(
map
[
i
].
open_only
)
continue
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
mapping
=
CreateFileMappingW
(
file
,
NULL
,
prot_map
[
i
].
prot
,
0
,
4096
,
NULL
);
mapping
=
CreateFileMappingW
(
file
,
NULL
,
prot_map
[
i
].
prot
,
0
,
4096
,
NULL
);
if
(
prot_map
[
i
].
mapped
)
if
(
prot_map
[
i
].
mapped
)
...
@@ -5645,6 +5653,8 @@ static void test_filemap_security(void)
...
@@ -5645,6 +5653,8 @@ static void test_filemap_security(void)
for
(
i
=
0
;
i
<
sizeof
(
map
)
/
sizeof
(
map
[
0
]);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
map
)
/
sizeof
(
map
[
0
]);
i
++
)
{
{
if
(
map
[
i
].
open_only
)
continue
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
DuplicateHandle
(
GetCurrentProcess
(),
mapping
,
GetCurrentProcess
(),
&
dup
,
ret
=
DuplicateHandle
(
GetCurrentProcess
(),
mapping
,
GetCurrentProcess
(),
&
dup
,
map
[
i
].
generic
,
FALSE
,
0
);
map
[
i
].
generic
,
FALSE
,
0
);
...
@@ -5659,6 +5669,24 @@ static void test_filemap_security(void)
...
@@ -5659,6 +5669,24 @@ static void test_filemap_security(void)
CloseHandle
(
mapping
);
CloseHandle
(
mapping
);
CloseHandle
(
file
);
CloseHandle
(
file
);
DeleteFileA
(
file_name
);
DeleteFileA
(
file_name
);
created_mapping
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
0x1000
,
"Wine Test Open Mapping"
);
ok
(
created_mapping
!=
NULL
,
"CreateFileMapping failed with error %u
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
sizeof
(
map
)
/
sizeof
(
map
[
0
]);
i
++
)
{
if
(
!
map
[
i
].
generic
)
continue
;
mapping
=
OpenFileMappingA
(
map
[
i
].
generic
,
FALSE
,
"Wine Test Open Mapping"
);
ok
(
mapping
!=
NULL
,
"OpenFileMapping failed with error %d
\n
"
,
GetLastError
());
access
=
get_obj_access
(
mapping
);
ok
(
access
==
map
[
i
].
mapped
,
"%d: unexpected access flags %#x, expected %#x
\n
"
,
i
,
access
,
map
[
i
].
mapped
);
CloseHandle
(
mapping
);
}
CloseHandle
(
created_mapping
);
}
}
static
void
test_thread_security
(
void
)
static
void
test_thread_security
(
void
)
...
...
dlls/kernel32/virtual.c
View file @
e625e86e
...
@@ -472,7 +472,6 @@ HANDLE WINAPI OpenFileMappingW( DWORD access, BOOL inherit, LPCWSTR name)
...
@@ -472,7 +472,6 @@ HANDLE WINAPI OpenFileMappingW( DWORD access, BOOL inherit, LPCWSTR name)
RtlInitUnicodeString
(
&
nameW
,
name
);
RtlInitUnicodeString
(
&
nameW
,
name
);
if
(
access
==
FILE_MAP_COPY
)
access
=
SECTION_MAP_READ
;
if
(
access
==
FILE_MAP_COPY
)
access
=
SECTION_MAP_READ
;
access
|=
SECTION_QUERY
;
if
(
GetVersion
()
&
0x80000000
)
if
(
GetVersion
()
&
0x80000000
)
{
{
...
...
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