kernel32: Implement GetCurrentThreadStackLimits.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46179
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
André Hentschel 2018-11-25 17:03:20 +01:00 committed by Alexandre Julliard
parent 7a3f08c7a3
commit ee9f2c62d5
6 changed files with 39 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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();

View File

@ -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__

View File

@ -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