Detlef Riekenberg : ntdll: Implement NtGetCurrentProcessorNumber.
Alexandre Julliard
julliard at winehq.org
Mon May 21 15:31:07 CDT 2012
Module: wine
Branch: master
Commit: 02b74d3fd372ef6bb94d74590341a0b5b3f3dee8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=02b74d3fd372ef6bb94d74590341a0b5b3f3dee8
Author: Detlef Riekenberg <wine.dev at web.de>
Date: Thu May 17 19:28:31 2012 +0200
ntdll: Implement NtGetCurrentProcessorNumber.
---
dlls/kernel32/kernel32.spec | 1 +
dlls/ntdll/ntdll.spec | 1 +
dlls/ntdll/thread.c | 17 +++++++++++++++++
include/winbase.h | 2 ++
include/winnt.h | 7 +++++++
5 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 9b786a9..e5a70cf 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -498,6 +498,7 @@
@ stdcall GetCurrentDirectoryW(long ptr)
@ stdcall GetCurrentProcess()
@ stdcall GetCurrentProcessId()
+@ stdcall GetCurrentProcessorNumber() ntdll.NtGetCurrentProcessorNumber
@ stdcall GetCurrentThread()
@ stdcall GetCurrentThreadId()
@ stdcall GetDateFormatA(long long ptr str ptr long)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index bd9d41e..cff7081 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -176,6 +176,7 @@
@ stdcall NtFreeVirtualMemory(long ptr ptr long)
@ stdcall NtFsControlFile(long long long long long long long long long long)
@ stdcall NtGetContextThread(long ptr)
+@ stdcall NtGetCurrentProcessorNumber()
# @ stub NtGetDevicePowerState
@ stub NtGetPlugPlayEvent
@ stdcall NtGetTickCount()
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index e328c5f..a0d414a 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -1173,3 +1173,20 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
return STATUS_NOT_IMPLEMENTED;
}
}
+
+/******************************************************************************
+ * NtGetCurrentProcessorNumber (NTDLL.@)
+ *
+ * Return the processor, on which the thread is running
+ *
+ */
+ULONG WINAPI NtGetCurrentProcessorNumber(void)
+{
+
+ if (NtCurrentTeb()->Peb->NumberOfProcessors > 1) {
+ FIXME("need multicore support (%d processors)\n", NtCurrentTeb()->Peb->NumberOfProcessors);
+ }
+
+ /* fallback to the first processor */
+ return 0;
+}
diff --git a/include/winbase.h b/include/winbase.h
index 2cb3d1a..8b5805c 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1634,6 +1634,8 @@ WINADVAPI BOOL WINAPI GetCurrentHwProfileA(LPHW_PROFILE_INFOA);
WINADVAPI BOOL WINAPI GetCurrentHwProfileW(LPHW_PROFILE_INFOW);
#define GetCurrentHwProfile WINELIB_NAME_AW(GetCurrentHwProfile)
WINBASEAPI HANDLE WINAPI GetCurrentProcess(void);
+WINBASEAPI DWORD WINAPI GetCurrentProcessorNumber(void);
+WINBASEAPI VOID WINAPI GetCurrentProcessorNumberEx(PPROCESSOR_NUMBER);
WINBASEAPI HANDLE WINAPI GetCurrentThread(void);
#define GetCurrentTime() GetTickCount()
WINBASEAPI BOOL WINAPI GetDefaultCommConfigA(LPCSTR,LPCOMMCONFIG,LPDWORD);
diff --git a/include/winnt.h b/include/winnt.h
index 9bde031..02c92e6 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -5286,6 +5286,13 @@ typedef struct _GROUP_AFFINITY
WORD Reserved[3];
} GROUP_AFFINITY, *PGROUP_AFFINITY;
+typedef struct _PROCESSOR_NUMBER
+{
+ WORD Group;
+ BYTE Number;
+ BYTE Reserved;
+} PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
+
typedef struct _PROCESSOR_RELATIONSHIP
{
BYTE Flags;
More information about the wine-cvs
mailing list