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
a98319d0
Commit
a98319d0
authored
Jan 11, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
Jan 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Do not use extended context in RtlCopyContext() if extended state is not copied.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54289
parent
4679b556
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
exception.c
dlls/ntdll/exception.c
+8
-0
exception.c
dlls/ntdll/tests/exception.c
+20
-0
No files found.
dlls/ntdll/exception.c
View file @
a98319d0
...
@@ -994,6 +994,7 @@ NTSTATUS WINAPI RtlCopyContext( CONTEXT *dst, DWORD context_flags, CONTEXT *src
...
@@ -994,6 +994,7 @@ NTSTATUS WINAPI RtlCopyContext( CONTEXT *dst, DWORD context_flags, CONTEXT *src
{
{
DWORD
context_size
,
arch_flag
,
flags_offset
,
dst_flags
,
src_flags
;
DWORD
context_size
,
arch_flag
,
flags_offset
,
dst_flags
,
src_flags
;
static
const
DWORD
arch_mask
=
CONTEXT_i386
|
CONTEXT_AMD64
;
static
const
DWORD
arch_mask
=
CONTEXT_i386
|
CONTEXT_AMD64
;
const
struct
context_parameters
*
p
;
BYTE
*
d
,
*
s
;
BYTE
*
d
,
*
s
;
TRACE
(
"dst %p, context_flags %#lx, src %p.
\n
"
,
dst
,
context_flags
,
src
);
TRACE
(
"dst %p, context_flags %#lx, src %p.
\n
"
,
dst
,
context_flags
,
src
);
...
@@ -1026,8 +1027,15 @@ NTSTATUS WINAPI RtlCopyContext( CONTEXT *dst, DWORD context_flags, CONTEXT *src
...
@@ -1026,8 +1027,15 @@ NTSTATUS WINAPI RtlCopyContext( CONTEXT *dst, DWORD context_flags, CONTEXT *src
context_flags
&=
src_flags
;
context_flags
&=
src_flags
;
if
(
context_flags
&
~
dst_flags
&
0x40
)
return
STATUS_BUFFER_OVERFLOW
;
if
(
context_flags
&
~
dst_flags
&
0x40
)
return
STATUS_BUFFER_OVERFLOW
;
if
(
context_flags
&
0x40
)
return
RtlCopyExtendedContext
(
(
CONTEXT_EX
*
)(
d
+
context_size
),
context_flags
,
return
RtlCopyExtendedContext
(
(
CONTEXT_EX
*
)(
d
+
context_size
),
context_flags
,
(
CONTEXT_EX
*
)(
s
+
context_size
)
);
(
CONTEXT_EX
*
)(
s
+
context_size
)
);
if
(
!
(
p
=
context_get_parameters
(
context_flags
)))
return
STATUS_INVALID_PARAMETER
;
context_copy_ranges
(
d
,
context_flags
,
s
,
p
);
return
STATUS_SUCCESS
;
}
}
...
...
dlls/ntdll/tests/exception.c
View file @
a98319d0
...
@@ -10499,6 +10499,26 @@ static void test_copy_context(void)
...
@@ -10499,6 +10499,26 @@ static void test_copy_context(void)
enabled_features
=
pRtlGetEnabledExtendedFeatures
(
~
(
ULONG64
)
0
);
enabled_features
=
pRtlGetEnabledExtendedFeatures
(
~
(
ULONG64
)
0
);
memset
(
dst_context_buffer
,
0xdd
,
sizeof
(
dst_context_buffer
));
memset
(
src_context_buffer
,
0xcc
,
sizeof
(
src_context_buffer
));
status
=
pRtlInitializeExtendedContext
(
src_context_buffer
,
CONTEXT_ALL
|
CONTEXT_XSTATE
,
&
src_ex
);
if
(
!
status
)
{
src
=
pRtlLocateLegacyContext
(
src_ex
,
NULL
);
dst
=
(
CONTEXT
*
)
dst_context_buffer
;
dst
->
ContextFlags
=
CONTEXT_ALL
;
status
=
pRtlCopyContext
(
dst
,
dst
->
ContextFlags
,
src
);
ok
(
!
status
,
"Got status %#lx.
\n
"
,
status
);
check_changes_in_range
((
BYTE
*
)
dst
,
CONTEXT_ALL
&
CONTEXT_AMD64
?
&
ranges_amd64
[
0
]
:
&
ranges_x86
[
0
],
CONTEXT_ALL
,
sizeof
(
CONTEXT
));
}
else
{
ok
(
status
==
STATUS_NOT_SUPPORTED
,
"Got status %#lx.
\n
"
,
status
);
skip
(
"Extended context is not supported.
\n
"
);
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
++
i
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
++
i
)
{
{
flags
=
tests
[
i
];
flags
=
tests
[
i
];
...
...
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