From e0d5dbaeb86a39ef6d54f00935bbe4ddbe32eaad Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 17 May 2007 09:49:28 +0200 Subject: [PATCH] ntoskrnl.exe: Implemented PsGetVersion and added stubs for a couple of other Ps functions. --- dlls/ntoskrnl.exe/ntoskrnl.c | 54 +++++++++++++++++++++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 8 ++--- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index b14fca505a3..33804343942 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -51,6 +51,7 @@ typedef struct _KSERVICE_TABLE_DESCRIPTOR KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTable[4]; +typedef void (WINAPI *PCREATE_PROCESS_NOTIFY_ROUTINE)(HANDLE,HANDLE,BOOLEAN); #ifdef __i386__ #define DEFINE_FASTCALL1_ENTRYPOINT( name ) \ @@ -416,6 +417,59 @@ void WINAPI MmFreeNonCachedMemory( void *addr, SIZE_T size ) } +/*********************************************************************** + * PsGetCurrentProcessId (NTOSKRNL.EXE.@) + */ +HANDLE WINAPI PsGetCurrentProcessId(void) +{ + return (HANDLE)GetCurrentProcessId(); /* FIXME: not quite right... */ +} + + +/*********************************************************************** + * PsGetCurrentThreadId (NTOSKRNL.EXE.@) + */ +HANDLE WINAPI PsGetCurrentThreadId(void) +{ + return (HANDLE)GetCurrentThreadId(); /* FIXME: not quite right... */ +} + + +/*********************************************************************** + * PsGetVersion (NTOSKRNL.EXE.@) + */ +BOOLEAN WINAPI PsGetVersion(ULONG *major, ULONG *minor, ULONG *build, UNICODE_STRING *version ) +{ + RTL_OSVERSIONINFOEXW info; + + RtlGetVersion( &info ); + if (major) *major = info.dwMajorVersion; + if (minor) *minor = info.dwMinorVersion; + if (build) *build = info.dwBuildNumber; + + if (version) + { +#if 0 /* FIXME: GameGuard passes an uninitialized pointer in version->Buffer */ + size_t len = min( strlenW(info.szCSDVersion)*sizeof(WCHAR), version->MaximumLength ); + memcpy( version->Buffer, info.szCSDVersion, len ); + if (len < version->MaximumLength) version->Buffer[len / sizeof(WCHAR)] = 0; + version->Length = len; +#endif + } + return TRUE; +} + + +/*********************************************************************** + * PsSetCreateProcessNotifyRoutine (NTOSKRNL.EXE.@) + */ +NTSTATUS WINAPI PsSetCreateProcessNotifyRoutine( PCREATE_PROCESS_NOTIFY_ROUTINE callback, BOOLEAN remove ) +{ + FIXME( "stub: %p %d\n", callback, remove ); + return STATUS_SUCCESS; +} + + /***************************************************** * DllMain */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 9aaa01e196d..2a89b33640b 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -850,10 +850,10 @@ @ stub PsEstablishWin32Callouts @ stub PsGetContextThread @ stub PsGetCurrentProcess -@ stub PsGetCurrentProcessId +@ stdcall PsGetCurrentProcessId() @ stub PsGetCurrentProcessSessionId @ stub PsGetCurrentThread -@ stub PsGetCurrentThreadId +@ stdcall PsGetCurrentThreadId() @ stub PsGetCurrentThreadPreviousMode @ stub PsGetCurrentThreadStackBase @ stub PsGetCurrentThreadStackLimit @@ -884,7 +884,7 @@ @ stub PsGetThreadSessionId @ stub PsGetThreadTeb @ stub PsGetThreadWin32Thread -@ stub PsGetVersion +@ stdcall PsGetVersion(ptr ptr ptr ptr) @ stub PsImpersonateClient @ stub PsInitialSystemProcess @ stub PsIsProcessBeingDebugged @@ -907,7 +907,7 @@ @ stub PsRevertThreadToSelf @ stub PsRevertToSelf @ stub PsSetContextThread -@ stub PsSetCreateProcessNotifyRoutine +@ stdcall PsSetCreateProcessNotifyRoutine(ptr long) @ stub PsSetCreateThreadNotifyRoutine @ stub PsSetJobUIRestrictionsClass @ stub PsSetLegoNotifyRoutine