[PATCH] ntdll/exception: Change return type to CONTEXT* of RtlLocateLegacyContext.
Biswapriyo Nath
nathbappai at gmail.com
Wed Sep 2 01:11:42 CDT 2020
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200902/fd3b9c7f/attachment.htm>
-------------- next part --------------
From e7f517891ae7ec8c67884e8fdfc1f44cd31d1b5d Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai at gmail.com>
Date: Wed, 2 Sep 2020 11:23:21 +0530
Subject: [PATCH] ntdll/exception: Change return type to CONTEXT* of RtlLocateLegacyContext.
Signed-off-by: Biswapriyo Nath <nathbappai at gmail.com>
---
dlls/ntdll/exception.c | 10 +++++-----
dlls/ntdll/tests/exception.c | 14 +++++++-------
include/ddk/wdm.h | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c
index 17bbb26..f98d2d3 100644
--- a/dlls/ntdll/exception.c
+++ b/dlls/ntdll/exception.c
@@ -873,12 +873,12 @@ void * WINAPI RtlLocateExtendedFeature( CONTEXT_EX *context_ex, ULONG feature_id
/**********************************************************************
* RtlLocateLegacyContext (NTDLL.@)
*/
-void * WINAPI RtlLocateLegacyContext( CONTEXT_EX *context_ex, ULONG *length )
+CONTEXT * WINAPI RtlLocateLegacyContext( CONTEXT_EX *context_ex, ULONG *length )
{
if (length)
*length = context_ex->Legacy.Length;
- return (BYTE *)context_ex + context_ex->Legacy.Offset;
+ return (CONTEXT *)((BYTE *)context_ex + context_ex->Legacy.Offset);
}
/**********************************************************************
@@ -913,7 +913,7 @@ NTSTATUS WINAPI RtlCopyExtendedContext( CONTEXT_EX *dst, ULONG context_flags, CO
XSTATE *dst_xs, *src_xs;
ULONG64 feature_mask;
unsigned int start;
- BYTE *d, *s;
+ CONTEXT *d, *s;
TRACE( "dst %p, context_flags %#x, src %p.\n", dst, context_flags, src );
@@ -926,7 +926,7 @@ NTSTATUS WINAPI RtlCopyExtendedContext( CONTEXT_EX *dst, ULONG context_flags, CO
d = RtlLocateLegacyContext( dst, NULL );
s = RtlLocateLegacyContext( src, NULL );
- *((ULONG *)(d + p->flags_offset)) |= context_flags;
+ *((ULONG *)((BYTE *)d + p->flags_offset)) |= context_flags;
start = 0;
range = p->copy_ranges;
@@ -939,7 +939,7 @@ NTSTATUS WINAPI RtlCopyExtendedContext( CONTEXT_EX *dst, ULONG context_flags, CO
}
else if (start)
{
- memcpy( d + start, s + start, range->start - start );
+ memcpy( (BYTE *)d + start, (BYTE *)s + start, range->start - start );
start = 0;
}
}
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index b39153f..600c2b7 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -53,7 +53,7 @@ static NTSTATUS (WINAPI *pRtlInitializeExtendedContext2)(void *context, ULONG c
ULONG64 compaction_mask);
static NTSTATUS (WINAPI *pRtlCopyExtendedContext)(CONTEXT_EX *dst, ULONG context_flags, CONTEXT_EX *src);
static void * (WINAPI *pRtlLocateExtendedFeature)(CONTEXT_EX *context_ex, ULONG feature_id, ULONG *length);
-static void * (WINAPI *pRtlLocateLegacyContext)(CONTEXT_EX *context_ex, ULONG *length);
+static CONTEXT * (WINAPI *pRtlLocateLegacyContext)(CONTEXT_EX *context_ex, ULONG *length);
static void (WINAPI *pRtlSetExtendedFeaturesMask)(CONTEXT_EX *context_ex, ULONG64 feature_mask);
static ULONG64 (WINAPI *pRtlGetExtendedFeaturesMask)(CONTEXT_EX *context_ex);
static NTSTATUS (WINAPI *pNtReadVirtualMemory)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
@@ -6199,7 +6199,7 @@ static void test_extended_context(void)
ULONG ret, ret2, length, length2, align;
CONTEXT_EX *context_ex;
ULONG flags, flags_fpx;
- CONTEXT *context;
+ CONTEXT *context, *context2;
unsigned data[8];
ULONG64 mask;
XSTATE *xs;
@@ -6320,12 +6320,12 @@ static void test_extended_context(void)
/* Crashes on Windows. */
pRtlLocateLegacyContext(NULL, NULL);
}
- p = pRtlLocateLegacyContext(context_ex, NULL);
- ok(p == context, "Got unexpected p %p, flags %#x.\n", p, flags);
+ context2 = pRtlLocateLegacyContext(context_ex, NULL);
+ ok(context2 == context, "Got unexpected context %p, flags %#x.\n", context2, flags);
length2 = 0xdeadbeef;
- p = pRtlLocateLegacyContext(context_ex, &length2);
- ok(p == context && length2 == context_ex->Legacy.Length,
- "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+ context2 = pRtlLocateLegacyContext(context_ex, &length2);
+ ok(context2 == context && length2 == context_ex->Legacy.Length,
+ "Got unexpected context %p, length %#x, flags %#x.\n", context2, length2, flags);
length2 = expected_length;
if (0)
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index 6885de1..707c0c8 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -1843,7 +1843,7 @@ NTSTATUS WINAPI RtlInitializeExtendedContext2(void*,ULONG,CONTEXT_EX**,ULONG64)
ULONG64 WINAPI RtlGetEnabledExtendedFeatures(ULONG64);
NTSTATUS WINAPI RtlGetExtendedContextLength(ULONG,ULONG*);
NTSTATUS WINAPI RtlGetExtendedContextLength2(ULONG,ULONG*,ULONG64);
-void * WINAPI RtlLocateLegacyContext(CONTEXT_EX*,ULONG*);
+CONTEXT * WINAPI RtlLocateLegacyContext(CONTEXT_EX*,ULONG*);
void * WINAPI RtlLocateExtendedFeature(CONTEXT_EX*,ULONG,ULONG*);
void * WINAPI RtlLocateExtendedFeature2(CONTEXT_EX*,ULONG,XSTATE_CONFIGURATION*,ULONG*);
ULONG64 WINAPI RtlGetExtendedFeaturesMask(CONTEXT_EX*);
--
2.28.0
More information about the wine-devel
mailing list