Commit 38039973 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Implement RtlLocateLegacyContext().

parent ff88ed8b
......@@ -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
......@@ -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;
}
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment