Fixed some warnings.

Added missing stubs.
Implemented GetThreadPriotityBoost() and SetThreadPriorityBoost().

svn path=/trunk/; revision=4052
This commit is contained in:
Eric Kohl 2003-01-22 02:24:36 +00:00
parent 1eac255e7c
commit 834dbc5fd5
4 changed files with 223 additions and 166 deletions

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.43 2003/01/21 20:50:51 robd Exp $
/* $Id: stubs.c,v 1.44 2003/01/22 02:23:48 ekohl Exp $
*
* KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them.
@ -25,6 +25,14 @@ BaseAttachCompleteThunk (VOID)
}
BOOL STDCALL
CancelIo(HANDLE hFile)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
BOOL
STDCALL
CmdBatNotification (
@ -593,32 +601,6 @@ GetThreadLocale (VOID)
#endif
WINBOOL
STDCALL
GetThreadPriorityBoost (
HANDLE hThread,
DWORD dwSelector,
LPLDT_ENTRY lpSelectorEntry
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
WINBOOL
STDCALL
GetThreadSelectorEntry (
HANDLE hThread,
DWORD dwSelector,
LPLDT_ENTRY lpSelectorEntry
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
int
STDCALL
GetTimeFormatW (
@ -870,6 +852,47 @@ SetComputerNameW (
}
#ifndef _OLE2NLS_IN_BUILD_
WINBOOL
STDCALL
SetLocaleInfoA (
LCID Locale,
LCTYPE LCType,
LPCSTR lpLCData
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
WINBOOL
STDCALL
SetLocaleInfoW (
LCID Locale,
LCTYPE LCType,
LPCWSTR lpLCData
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
WINBOOL
STDCALL
SetThreadLocale (
LCID Locale
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
#endif
WINBOOL
STDCALL
SetSystemPowerState (
@ -884,16 +907,8 @@ SetSystemPowerState (
WINBOOL
STDCALL
SetThreadIdealProcessor(VOID)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
WINBOOL
STDCALL
SetThreadPriorityBoost(VOID)
SetThreadIdealProcessor(HANDLE hThread,
DWORD dwIdealProcessor)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
@ -945,45 +960,9 @@ VDMOperationStarted (
return 0;
}
#ifndef _OLE2NLS_IN_BUILD_
WINBOOL
STDCALL
SetLocaleInfoA (
LCID Locale,
LCTYPE LCType,
LPCSTR lpLCData
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
WINBOOL
STDCALL
SetLocaleInfoW (
LCID Locale,
LCTYPE LCType,
LPCWSTR lpLCData
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
WINBOOL
STDCALL
SetThreadLocale (
LCID Locale
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
DWORD
STDCALL
VerLanguageNameA (
@ -1023,6 +1002,7 @@ VirtualBufferExceptionHandler (
return 0;
}
BOOL
STDCALL
GetFileAttributesExA(
@ -1035,6 +1015,7 @@ GetFileAttributesExA(
return 0;
}
BOOL
STDCALL
GetFileAttributesExW(
@ -1047,5 +1028,4 @@ GetFileAttributesExW(
return 0;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.60 2003/01/19 01:13:04 gvg Exp $
/* $Id: create.c,v 1.61 2003/01/22 02:24:10 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -823,13 +823,13 @@ CreateProcessW(LPCWSTR lpApplicationName,
DPRINT("Launching VDM...\n");
return CreateProcessW(L"ntvdm.exe",
lpApplicationName,
(LPWSTR)lpApplicationName,
lpProcessAttributes,
lpThreadAttributes,
bInheritHandles,
dwCreationFlags,
lpEnvironment,
lpCurrentDirectory,
dwCreationFlags,
lpEnvironment,
lpCurrentDirectory,
lpStartupInfo,
lpProcessInformation);
}

View file

@ -1,4 +1,4 @@
/* $Id: proc.c,v 1.50 2003/01/15 21:24:35 chorns Exp $
/* $Id: proc.c,v 1.51 2003/01/22 02:24:10 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -25,14 +25,14 @@ WaitForInputIdleType lpfnGlobalRegisterWaitForInputIdle;
LPSTARTUPINFO lpLocalStartupInfo = NULL;
VOID STDCALL
RegisterWaitForInputIdle (WaitForInputIdleType lpfnRegisterWaitForInputIdle);
RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle);
WINBOOL STDCALL
GetProcessId (HANDLE hProcess, LPDWORD lpProcessId);
/* FUNCTIONS ****************************************************************/
WINBOOL STDCALL
GetProcessId (HANDLE hProcess, LPDWORD lpProcessId);
WINBOOL STDCALL
GetProcessAffinityMask(HANDLE hProcess,
LPDWORD lpProcessAffinityMask,
@ -54,6 +54,14 @@ GetProcessAffinityMask(HANDLE hProcess,
}
BOOL STDCALL
SetProcessAffinityMask(HANDLE hProcess,
DWORD dwProcessAffinityMask)
{
return(FALSE);
}
WINBOOL STDCALL
GetProcessShutdownParameters(LPDWORD lpdwLevel,
LPDWORD lpdwFlags)
@ -111,8 +119,24 @@ GetProcessWorkingSetSize(HANDLE hProcess,
LPDWORD lpMinimumWorkingSetSize,
LPDWORD lpMaximumWorkingSetSize)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return(FALSE);
QUOTA_LIMITS QuotaLimits;
NTSTATUS Status;
Status = NtQueryInformationProcess(hProcess,
ProcessQuotaLimits,
&QuotaLimits,
sizeof(QUOTA_LIMITS),
NULL);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return(FALSE);
}
*lpMinimumWorkingSetSize = (DWORD)QuotaLimits.MinimumWorkingSetSize;
*lpMaximumWorkingSetSize = (DWORD)QuotaLimits.MaximumWorkingSetSize;
return(TRUE);
}
@ -147,7 +171,7 @@ GetProcessTimes(HANDLE hProcess,
return(FALSE);
}
lpCreationTime->dwLowDateTime = Kut.CreateTime.u.LowPart;
lpCreationTime->dwLowDateTime = Kut.CreateTime.u.LowPart;
lpCreationTime->dwHighDateTime = Kut.CreateTime.u.HighPart;
lpExitTime->dwLowDateTime = Kut.ExitTime.u.LowPart;
@ -213,22 +237,24 @@ WINBOOL STDCALL
GetProcessId(HANDLE hProcess,
LPDWORD lpProcessId)
{
NTSTATUS errCode;
PROCESS_BASIC_INFORMATION ProcessBasic;
ULONG BytesWritten;
PROCESS_BASIC_INFORMATION ProcessBasic;
ULONG BytesWritten;
NTSTATUS Status;
errCode = NtQueryInformationProcess(hProcess,
ProcessBasicInformation,
&ProcessBasic,
sizeof(PROCESS_BASIC_INFORMATION),
&BytesWritten);
if (!NT_SUCCESS(errCode))
{
SetLastErrorByStatus (errCode);
return FALSE;
}
memcpy( lpProcessId ,&ProcessBasic.UniqueProcessId,sizeof(DWORD));
return TRUE;
Status = NtQueryInformationProcess(hProcess,
ProcessBasicInformation,
&ProcessBasic,
sizeof(PROCESS_BASIC_INFORMATION),
&BytesWritten);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return(FALSE);
}
memcpy(lpProcessId, &ProcessBasic.UniqueProcessId, sizeof(DWORD));
return(TRUE);
}
@ -690,12 +716,4 @@ GetProcessVersion (DWORD ProcessId)
return (Version);
}
BOOL STDCALL
SetProcessAffinityMask(HANDLE hProcess, DWORD dwProcessAffinityMask)
{
return FALSE;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.33 2003/01/15 21:24:36 chorns Exp $
/* $Id: thread.c,v 1.34 2003/01/22 02:24:36 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -18,7 +18,7 @@
#include <kernel32/kernel32.h>
static VOID ThreadAttachDlls (VOID);
//static VOID ThreadAttachDlls (VOID);
/* FUNCTIONS *****************************************************************/
@ -62,13 +62,13 @@ CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes,
DWORD dwCreationFlags,
LPDWORD lpThreadId)
{
return(CreateRemoteThread(NtCurrentProcess(),
lpThreadAttributes,
dwStackSize,
lpStartAddress,
lpParameter,
dwCreationFlags,
lpThreadId));
return(CreateRemoteThread(NtCurrentProcess(),
lpThreadAttributes,
dwStackSize,
lpStartAddress,
lpParameter,
dwCreationFlags,
lpThreadId));
}
@ -258,34 +258,33 @@ GetCurrentThreadId(VOID)
VOID STDCALL
ExitThread(DWORD uExitCode)
{
NTSTATUS errCode;
BOOLEAN LastThread;
NTSTATUS Status;
BOOLEAN LastThread;
NTSTATUS Status;
/*
* Terminate process if this is the last thread
* of the current process
*/
Status = NtQueryInformationThread(NtCurrentThread(),
ThreadAmILastThread,
&LastThread,
sizeof(BOOLEAN),
NULL);
if (NT_SUCCESS(Status) && LastThread == TRUE)
{
ExitProcess (uExitCode);
}
/*
* Terminate process if this is the last thread
* of the current process
*/
Status = NtQueryInformationThread(NtCurrentThread(),
ThreadAmILastThread,
&LastThread,
sizeof(BOOLEAN),
NULL);
if (NT_SUCCESS(Status) && LastThread == TRUE)
{
ExitProcess(uExitCode);
}
/* FIXME: notify csrss of thread termination */
/* FIXME: notify csrss of thread termination */
LdrShutdownThread();
LdrShutdownThread();
errCode = NtTerminateThread(NtCurrentThread(),
uExitCode);
if (!NT_SUCCESS(errCode))
{
SetLastErrorByStatus(errCode);
}
Status = NtTerminateThread(NtCurrentThread(),
uExitCode);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
}
}
@ -296,25 +295,27 @@ GetThreadTimes(HANDLE hThread,
LPFILETIME lpKernelTime,
LPFILETIME lpUserTime)
{
NTSTATUS errCode;
KERNEL_USER_TIMES KernelUserTimes;
ULONG ReturnLength;
KERNEL_USER_TIMES KernelUserTimes;
ULONG ReturnLength;
NTSTATUS Status;
errCode = NtQueryInformationThread(hThread,
ThreadTimes,
&KernelUserTimes,
sizeof(KERNEL_USER_TIMES),
&ReturnLength);
if (!NT_SUCCESS(errCode))
{
SetLastErrorByStatus(errCode);
return FALSE;
}
memcpy(lpCreationTime, &KernelUserTimes.CreateTime, sizeof(FILETIME));
memcpy(lpExitTime, &KernelUserTimes.ExitTime, sizeof(FILETIME));
memcpy(lpKernelTime, &KernelUserTimes.KernelTime, sizeof(FILETIME));
memcpy(lpUserTime, &KernelUserTimes.UserTime, sizeof(FILETIME));
return TRUE;
Status = NtQueryInformationThread(hThread,
ThreadTimes,
&KernelUserTimes,
sizeof(KERNEL_USER_TIMES),
&ReturnLength);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return(FALSE);
}
memcpy(lpCreationTime, &KernelUserTimes.CreateTime, sizeof(FILETIME));
memcpy(lpExitTime, &KernelUserTimes.ExitTime, sizeof(FILETIME));
memcpy(lpKernelTime, &KernelUserTimes.KernelTime, sizeof(FILETIME));
memcpy(lpUserTime, &KernelUserTimes.UserTime, sizeof(FILETIME));
return(TRUE);
}
@ -528,4 +529,62 @@ GetThreadPriority(HANDLE hThread)
return(ThreadBasic.BasePriority);
}
WINBOOL STDCALL
GetThreadPriorityBoost(IN HANDLE hThread,
OUT PBOOL pDisablePriorityBoost)
{
ULONG PriorityBoost;
ULONG DataWritten;
NTSTATUS Status;
Status = NtQueryInformationThread(hThread,
ThreadPriorityBoost,
&PriorityBoost,
sizeof(ULONG),
&DataWritten);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return(FALSE);
}
*pDisablePriorityBoost = !((WINBOOL)PriorityBoost);
return(TRUE);
}
WINBOOL STDCALL
SetThreadPriorityBoost(IN HANDLE hThread,
IN WINBOOL bDisablePriorityBoost)
{
ULONG PriorityBoost;
NTSTATUS Status;
PriorityBoost = (ULONG)!bDisablePriorityBoost;
Status = NtSetInformationThread(hThread,
ThreadPriorityBoost,
&PriorityBoost,
sizeof(ULONG));
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return(FALSE);
}
return(TRUE);
}
WINBOOL STDCALL
GetThreadSelectorEntry(IN HANDLE hThread,
IN DWORD dwSelector,
OUT LPLDT_ENTRY lpSelectorEntry)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return(FALSE);
}
/* EOF */