From a9b14e9d165283d2caffe0ad0f1daf7dafc84f3c Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 3 Feb 2003 14:20:24 +0000 Subject: [PATCH] Implemented CancelIo() and SetThreadIdealProcessor(). svn path=/trunk/; revision=4111 --- reactos/lib/kernel32/file/iocompl.c | 19 +++++++++++++++++- reactos/lib/kernel32/misc/stubs.c | 29 +++++----------------------- reactos/lib/kernel32/thread/thread.c | 25 +++++++++++++++++++++++- 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/reactos/lib/kernel32/file/iocompl.c b/reactos/lib/kernel32/file/iocompl.c index 45fead95ede..1b406fcadbe 100644 --- a/reactos/lib/kernel32/file/iocompl.c +++ b/reactos/lib/kernel32/file/iocompl.c @@ -1,4 +1,4 @@ -/* $Id: iocompl.c,v 1.7 2003/01/15 21:24:33 chorns Exp $ +/* $Id: iocompl.c,v 1.8 2003/02/03 14:19:30 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -136,4 +136,21 @@ FileIOCompletionRoutine( } +BOOL STDCALL +CancelIo(HANDLE hFile) +{ + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; + + Status = NtCancelIoFile(hFile, + &IoStatusBlock); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return(FALSE); + } + + return(TRUE); +} + /* EOF */ diff --git a/reactos/lib/kernel32/misc/stubs.c b/reactos/lib/kernel32/misc/stubs.c index 6a7f88b8fc1..8db1ed2c275 100644 --- a/reactos/lib/kernel32/misc/stubs.c +++ b/reactos/lib/kernel32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.45 2003/02/02 16:57:30 ekohl Exp $ +/* $Id: stubs.c,v 1.46 2003/02/03 14:20:03 ekohl Exp $ * * KERNEL32.DLL stubs (unimplemented functions) * Remove from this file, if you implement them. @@ -25,14 +25,6 @@ BaseAttachCompleteThunk (VOID) } -BOOL STDCALL -CancelIo(HANDLE hFile) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - BOOL STDCALL CmdBatNotification ( @@ -575,7 +567,7 @@ GetSystemDefaultLangID (VOID) #endif -DWORD +WINBOOL STDCALL GetSystemPowerStatus ( DWORD Unknown0 @@ -871,11 +863,10 @@ SetThreadLocale ( #endif -WINBOOL -STDCALL +WINBOOL STDCALL SetSystemPowerState ( - DWORD Unknown0, - DWORD Unknown1 + IN WINBOOL fSuspend, + IN WINBOOL fForce ) { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -883,16 +874,6 @@ SetSystemPowerState ( } -WINBOOL -STDCALL -SetThreadIdealProcessor(HANDLE hThread, - DWORD dwIdealProcessor) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - - WINBOOL STDCALL SetVDMCurrentDirectories ( diff --git a/reactos/lib/kernel32/thread/thread.c b/reactos/lib/kernel32/thread/thread.c index 1167b5a58ed..73b31179432 100644 --- a/reactos/lib/kernel32/thread/thread.c +++ b/reactos/lib/kernel32/thread/thread.c @@ -1,4 +1,4 @@ -/* $Id: thread.c,v 1.34 2003/01/22 02:24:36 ekohl Exp $ +/* $Id: thread.c,v 1.35 2003/02/03 14:20:24 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -587,4 +587,27 @@ GetThreadSelectorEntry(IN HANDLE hThread, return(FALSE); } + +WINBOOL STDCALL +SetThreadIdealProcessor(HANDLE hThread, + DWORD dwIdealProcessor) +{ + ULONG IdealProcessor; + NTSTATUS Status; + + IdealProcessor = (ULONG)dwIdealProcessor; + + Status = NtSetInformationThread(hThread, + ThreadIdealProcessor, + &IdealProcessor, + sizeof(ULONG)); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return(FALSE); + } + + return(TRUE); +} + /* EOF */