Commit ee9f2c62 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

kernel32: Implement GetCurrentThreadStackLimits.

parent 7a3f08c7
......@@ -15,7 +15,7 @@
@ stdcall GetCurrentProcessorNumberEx(ptr) kernel32.GetCurrentProcessorNumberEx
@ stdcall -norelay GetCurrentThread() kernel32.GetCurrentThread
@ stdcall -norelay GetCurrentThreadId() kernel32.GetCurrentThreadId
@ stub GetCurrentThreadStackLimits
@ stdcall GetCurrentThreadStackLimits(ptr ptr) kernel32.GetCurrentThreadStackLimits
@ stdcall GetExitCodeProcess(long ptr) kernel32.GetExitCodeProcess
@ stdcall GetExitCodeThread(long ptr) kernel32.GetExitCodeThread
@ stdcall GetPriorityClass(long) kernel32.GetPriorityClass
......
......@@ -15,7 +15,7 @@
@ stdcall GetCurrentProcessorNumberEx(ptr) kernel32.GetCurrentProcessorNumberEx
@ stdcall -norelay GetCurrentThread() kernel32.GetCurrentThread
@ stdcall -norelay GetCurrentThreadId() kernel32.GetCurrentThreadId
@ stub GetCurrentThreadStackLimits
@ stdcall GetCurrentThreadStackLimits(ptr ptr) kernel32.GetCurrentThreadStackLimits
@ stdcall GetExitCodeProcess(long ptr) kernel32.GetExitCodeProcess
@ stdcall GetExitCodeThread(long ptr) kernel32.GetExitCodeThread
@ stdcall GetPriorityClass(long) kernel32.GetPriorityClass
......
......@@ -635,6 +635,7 @@
@ stdcall GetCurrentProcessorNumberEx(ptr) ntdll.RtlGetCurrentProcessorNumberEx
@ stdcall -norelay GetCurrentThread()
@ stdcall -norelay GetCurrentThreadId()
@ stdcall GetCurrentThreadStackLimits(ptr ptr)
@ stdcall -arch=x86_64 GetCurrentUmsThread()
@ stdcall GetDateFormatA(long long ptr str ptr long)
@ stdcall GetDateFormatEx(wstr long ptr wstr ptr long wstr)
......
......@@ -76,6 +76,7 @@
#define ARCH "none"
#endif
static void (WINAPI *pGetCurrentThreadStackLimits)(PULONG_PTR,PULONG_PTR);
static BOOL (WINAPI *pGetThreadPriorityBoost)(HANDLE,PBOOL);
static HANDLE (WINAPI *pOpenThread)(DWORD,BOOL,DWORD);
static BOOL (WINAPI *pQueueUserWorkItem)(LPTHREAD_START_ROUTINE,PVOID,ULONG);
......@@ -992,6 +993,29 @@ static VOID test_thread_processor(void)
win_skip("Get/SetThreadGroupAffinity not available\n");
}
static VOID test_GetCurrentThreadStackLimits(void)
{
ULONG_PTR low = 0, high = 0;
if (!pGetCurrentThreadStackLimits)
{
win_skip("GetCurrentThreadStackLimits not available.\n");
return;
}
if (0)
{
/* crashes on native */
pGetCurrentThreadStackLimits(NULL, NULL);
pGetCurrentThreadStackLimits(NULL, &high);
pGetCurrentThreadStackLimits(&low, NULL);
}
pGetCurrentThreadStackLimits(&low, &high);
ok(low == (ULONG_PTR)NtCurrentTeb()->DeallocationStack, "exptected %p, got %lx\n", NtCurrentTeb()->DeallocationStack, low);
ok(high == (ULONG_PTR)NtCurrentTeb()->Tib.StackBase, "exptected %p, got %lx\n", NtCurrentTeb()->Tib.StackBase, high);
}
static VOID test_GetThreadExitCode(void)
{
DWORD exitCode, threadid;
......@@ -1999,6 +2023,7 @@ static void init_funcs(void)
so that the compile passes */
#define X(f) p##f = (void*)GetProcAddress(hKernel32, #f)
X(GetCurrentThreadStackLimits);
X(GetThreadPriorityBoost);
X(OpenThread);
X(QueueUserWorkItem);
......@@ -2084,6 +2109,7 @@ START_TEST(thread)
test_TerminateThread();
test_CreateThread_stack();
test_thread_priority();
test_GetCurrentThreadStackLimits();
test_GetThreadTimes();
test_thread_processor();
test_GetThreadExitCode();
......
......@@ -701,6 +701,15 @@ HANDLE WINAPI GetCurrentThread(void)
return (HANDLE)~(ULONG_PTR)1;
}
/***********************************************************************
* GetCurrentThreadStackLimits (KERNEL32.@)
*/
void WINAPI GetCurrentThreadStackLimits(ULONG_PTR *low, ULONG_PTR *high)
{
*low = (ULONG_PTR)NtCurrentTeb()->DeallocationStack;
*high = (ULONG_PTR)NtCurrentTeb()->Tib.StackBase;
}
#ifdef __i386__
......
......@@ -471,7 +471,7 @@
# @ stub GetCurrentTargetPlatformContext
@ stdcall -norelay GetCurrentThread() kernel32.GetCurrentThread
@ stdcall -norelay GetCurrentThreadId() kernel32.GetCurrentThreadId
# @ stub GetCurrentThreadStackLimits
@ stdcall GetCurrentThreadStackLimits(ptr ptr) kernel32.GetCurrentThreadStackLimits
@ stdcall GetDateFormatA(long long ptr str ptr long) kernel32.GetDateFormatA
@ stdcall GetDateFormatEx(wstr long ptr wstr ptr long wstr) kernel32.GetDateFormatEx
@ stdcall GetDateFormatW(long long ptr wstr ptr long) kernel32.GetDateFormatW
......
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