ntdll: Implement RtlLocateLegacyContext().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2020-08-31 12:31:59 +03:00 committed by Alexandre Julliard
parent ff88ed8b06
commit 3803997349
6 changed files with 29 additions and 1 deletions

View file

@ -4,5 +4,5 @@
@ stub RtlGetExtendedFeaturesMask
@ stdcall RtlInitializeExtendedContext(ptr long ptr) ntdll.RtlInitializeExtendedContext
@ stdcall RtlLocateExtendedFeature(ptr long ptr) ntdll.RtlLocateExtendedFeature
@ stub RtlLocateLegacyContext
@ stdcall RtlLocateLegacyContext(ptr ptr) ntdll.RtlLocateLegacyContext
@ stub RtlSetExtendedFeaturesMask

View file

@ -850,3 +850,14 @@ void * WINAPI RtlLocateExtendedFeature( CONTEXT_EX *context_ex, ULONG feature_id
{
return RtlLocateExtendedFeature2( context_ex, feature_id, &user_shared_data->XState, length );
}
/**********************************************************************
* RtlLocateLegacyContext (NTDLL.@)
*/
void * WINAPI RtlLocateLegacyContext( CONTEXT_EX *context_ex, ULONG *length )
{
if (length)
*length = context_ex->Legacy.Length;
return (BYTE *)context_ex + context_ex->Legacy.Offset;
}

View file

@ -828,6 +828,7 @@
@ stdcall RtlLocaleNameToLcid(wstr ptr long)
@ stdcall RtlLocateExtendedFeature(ptr long ptr)
@ stdcall RtlLocateExtendedFeature2(ptr long ptr ptr)
@ stdcall RtlLocateLegacyContext(ptr ptr)
# @ stub RtlLockBootStatusData
@ stdcall RtlLockHeap(long)
# @ stub RtlLockMemoryStreamRegion

View file

@ -52,6 +52,7 @@ static NTSTATUS (WINAPI *pRtlInitializeExtendedContext)(void *context, ULONG co
static NTSTATUS (WINAPI *pRtlInitializeExtendedContext2)(void *context, ULONG context_flags, CONTEXT_EX **context_ex,
ULONG64 compaction_mask);
static void * (WINAPI *pRtlLocateExtendedFeature)(CONTEXT_EX *context_ex, ULONG feature_id, ULONG *length);
static void * (WINAPI *pRtlLocateLegacyContext)(CONTEXT_EX *context_ex, ULONG *length);
static NTSTATUS (WINAPI *pNtReadVirtualMemory)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
static NTSTATUS (WINAPI *pNtTerminateProcess)(HANDLE handle, LONG exit_code);
static NTSTATUS (WINAPI *pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
@ -6307,6 +6308,18 @@ static void test_extended_context(void)
ok(!context_ex->XState.Length,
"Got unexpected Length %#x, flags %#x.\n", context_ex->XState.Length, flags);
if (0)
{
/* Crashes on Windows. */
pRtlLocateLegacyContext(NULL, NULL);
}
p = pRtlLocateLegacyContext(context_ex, NULL);
ok(p == context, "Got unexpected p %p, flags %#x.\n", p, 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);
length2 = expected_length;
for (j = 0; j < context_arch[test].flags_offset; ++j)
{
@ -6738,6 +6751,7 @@ START_TEST(exception)
X(RtlInitializeExtendedContext);
X(RtlInitializeExtendedContext2);
X(RtlLocateExtendedFeature);
X(RtlLocateLegacyContext);
#undef X
#define X(f) p##f = (void*)GetProcAddress(hkernel32, #f)

View file

@ -1176,6 +1176,7 @@
@ stdcall RtlLocalTimeToSystemTime(ptr ptr)
@ stdcall RtlLocateExtendedFeature(ptr long ptr)
@ stdcall RtlLocateExtendedFeature2(ptr long ptr ptr)
@ stdcall RtlLocateLegacyContext(ptr ptr)
@ stub RtlLockBootStatusData
@ stdcall RtlLookupAtomInAtomTable(ptr wstr ptr)
@ stub RtlLookupElementGenericTable

View file

@ -1842,6 +1842,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*);
void * WINAPI RtlLocateExtendedFeature(CONTEXT_EX*,ULONG,ULONG*);
void * WINAPI RtlLocateExtendedFeature2(CONTEXT_EX*,ULONG,XSTATE_CONFIGURATION*,ULONG*);
#endif