Rob Shearman : kernel32: Implement GetThreadId.
Alexandre Julliard
julliard at winehq.org
Tue Nov 13 08:34:42 CST 2007
Module: wine
Branch: master
Commit: 8296548bb51d27991960c3c79778e9570f7224c5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8296548bb51d27991960c3c79778e9570f7224c5
Author: Rob Shearman <rob at codeweavers.com>
Date: Mon Nov 12 20:09:40 2007 +0000
kernel32: Implement GetThreadId.
---
dlls/kernel32/kernel32.spec | 1 +
dlls/kernel32/thread.c | 30 ++++++++++++++++++++++++++++++
include/winbase.h | 1 +
3 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 2bf20c1..581383c 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -629,6 +629,7 @@
@ stdcall GetTempPathA(long ptr)
@ stdcall GetTempPathW(long ptr)
@ stdcall GetThreadContext(long ptr)
+@ stdcall GetThreadId(ptr)
# @ stub GetThreadIOPendingFlag
@ stdcall GetThreadLocale()
@ stdcall GetThreadPriority(long)
diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c
index e96ca2d..ee89a82 100644
--- a/dlls/kernel32/thread.c
+++ b/dlls/kernel32/thread.c
@@ -518,6 +518,36 @@ BOOL WINAPI GetThreadTimes(
return TRUE;
}
+/**********************************************************************
+ * GetThreadId [KERNEL32.@]
+ *
+ * Retrieve the identifier of a thread.
+ *
+ * PARAMS
+ * Thread [I] The thread to retrive the identifier of.
+ *
+ * RETURNS
+ * Success: Identifier of the target thread.
+ * Failure: 0
+ */
+DWORD WINAPI GetThreadId(HANDLE Thread)
+{
+ THREAD_BASIC_INFORMATION tbi;
+ NTSTATUS status;
+
+ TRACE("(%p)\n", Thread);
+
+ status = NtQueryInformationThread(Thread, ThreadBasicInformation, &tbi,
+ sizeof(tbi), NULL);
+ if (status)
+ {
+ SetLastError( RtlNtStatusToDosError(status) );
+ return 0;
+ }
+
+ return HandleToULong(tbi.ClientId.UniqueThread);
+}
+
/**********************************************************************
* VWin32_BoostThreadGroup [KERNEL.535]
diff --git a/include/winbase.h b/include/winbase.h
index 65eb62d..2c97d4b 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1682,6 +1682,7 @@ WINBASEAPI UINT WINAPI GetTempFileNameW(LPCWSTR,LPCWSTR,UINT,LPWSTR);
WINBASEAPI DWORD WINAPI GetTempPathA(DWORD,LPSTR);
WINBASEAPI DWORD WINAPI GetTempPathW(DWORD,LPWSTR);
#define GetTempPath WINELIB_NAME_AW(GetTempPath)
+WINBASEAPI DWORD WINAPI GetThreadId(HANDLE);
WINBASEAPI DWORD WINAPI GetTickCount(void);
WINBASEAPI ULONGLONG WINAPI GetTickCount64(void);
WINBASEAPI DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION);
More information about the wine-cvs
mailing list