A+ -- Eric Pouech
Name: iocnt ChangeLog: Implemented kernel32.GetIoProcessCounters and stubbed ntdll.NtQueryProcessInformation(ProcessIoCounters) License: X11 GenDate: 2003/09/18 20:03:23 UTC ModifiedFiles: dlls/kernel/kernel32.spec dlls/kernel/process.c dlls/ntdll/Makefile.in dlls/ntdll/nt.c include/winnt.h AddedFiles: dlls/ntdll/process.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/kernel/kernel32.spec,v retrieving revision 1.107 diff -u -u -r1.107 kernel32.spec --- dlls/kernel/kernel32.spec 15 Sep 2003 22:07:50 -0000 1.107 +++ dlls/kernel/kernel32.spec 16 Sep 2003 19:24:43 -0000 @@ -452,7 +452,7 @@ @ stdcall GetProcessFlags(long) @ stdcall GetProcessHeap() @ stdcall GetProcessHeaps(long ptr) -@ stub GetProcessIoCounters +@ stdcall GetProcessIoCounters(long ptr) @ stdcall GetProcessShutdownParameters(ptr ptr) @ stdcall GetProcessTimes(long ptr ptr ptr ptr) @ stdcall GetProcessVersion(long) Index: dlls/kernel/process.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/kernel/process.c,v retrieving revision 1.5 diff -u -u -r1.5 process.c --- dlls/kernel/process.c 17 Sep 2003 05:31:33 -0000 1.5 +++ dlls/kernel/process.c 18 Sep 2003 19:45:30 -0000 @@ -2018,6 +2028,20 @@ return !status; } +/****************************************************************** + * GetProcessIoCounters (KERNEL32.@) + * + * + */ +BOOL WINAPI GetProcessIoCounters(HANDLE hProcess, PIO_COUNTERS ioc) +{ + NTSTATUS status; + + status = NtQueryInformationProcess(hProcess, ProcessIoCounters, + ioc, sizeof(*ioc), NULL); + if (status) SetLastError( RtlNtStatusToDosError(status) ); + return !status; +} /*********************************************************************** * ProcessIdToSessionId (KERNEL32.@) Index: dlls/ntdll/Makefile.in =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/Makefile.in,v retrieving revision 1.80 diff -u -u -r1.80 Makefile.in --- dlls/ntdll/Makefile.in 18 Sep 2003 04:39:13 -0000 1.80 +++ dlls/ntdll/Makefile.in 18 Sep 2003 19:31:31 -0000 @@ -54,6 +55,7 @@ nt.c \ om.c \ path.c \ + process.c \ reg.c \ resource.c \ rtl.c \ Index: dlls/ntdll/nt.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/nt.c,v retrieving revision 1.57 diff -u -u -r1.57 nt.c --- dlls/ntdll/nt.c 16 Sep 2003 01:07:22 -0000 1.57 +++ dlls/ntdll/nt.c 18 Sep 2003 19:30:51 -0000 @@ -73,98 +73,6 @@ } LPCMESSAGE, *PLPCMESSAGE; /* - * Process object - */ - -/****************************************************************************** - * NtTerminateProcess [NTDLL.@] - * - * Native applications must kill themselves when done - */ -NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) -{ - NTSTATUS ret; - BOOL self; - SERVER_START_REQ( terminate_process ) - { - req->handle = handle; - req->exit_code = exit_code; - ret = wine_server_call( req ); - self = !ret && reply->self; - } - SERVER_END_REQ; - if (self) exit( exit_code ); - return ret; -} - -/****************************************************************************** -* NtQueryInformationProcess [NTDLL.@] -* ZwQueryInformationProcess [NTDLL.@] -* -*/ -NTSTATUS WINAPI NtQueryInformationProcess( - IN HANDLE ProcessHandle, - IN PROCESSINFOCLASS ProcessInformationClass, - OUT PVOID ProcessInformation, - IN ULONG ProcessInformationLength, - OUT PULONG ReturnLength) -{ - NTSTATUS ret = STATUS_SUCCESS; - ULONG len = 0; - - switch (ProcessInformationClass) { - case ProcessDebugPort: - /* "These are not the debuggers you are looking for." */ - /* set it to 0 aka "no debugger" to satisfy copy protections */ - if (ProcessInformationLength == 4) - { - memset(ProcessInformation,0,ProcessInformationLength); - len = 4; - } - else - ret = STATUS_INFO_LENGTH_MISMATCH; - break; - case ProcessWow64Information: - if (ProcessInformationLength == 4) - { - memset(ProcessInformation,0,ProcessInformationLength); - len = 4; - } - else - ret = STATUS_INFO_LENGTH_MISMATCH; - break; - default: - FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n", - ProcessHandle,ProcessInformationClass, - ProcessInformation,ProcessInformationLength, - ReturnLength - ); - ret = STATUS_NOT_IMPLEMENTED; - break; - } - - if (ReturnLength) - *ReturnLength = len; - - return ret; -} - -/****************************************************************************** - * NtSetInformationProcess [NTDLL.@] - * ZwSetInformationProcess [NTDLL.@] - */ -NTSTATUS WINAPI NtSetInformationProcess( - IN HANDLE ProcessHandle, - IN PROCESSINFOCLASS ProcessInformationClass, - IN PVOID ProcessInformation, - IN ULONG ProcessInformationLength) -{ - FIXME("(%p,0x%08x,%p,0x%08lx) stub\n", - ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength); - return 0; -} - -/* * Token */ Index: include/winnt.h =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/include/winnt.h,v retrieving revision 1.169 diff -u -u -r1.169 winnt.h --- include/winnt.h 16 Sep 2003 20:26:28 -0000 1.169 +++ include/winnt.h 17 Sep 2003 20:51:21 -0000 @@ -3600,4 +3600,13 @@ typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN ); +typedef struct _IO_COUNTERS { + ULONGLONG ReadOperationCount; + ULONGLONG WriteOperationCount; + ULONGLONG OtherOperationCount; + ULONGLONG ReadTransferCount; + ULONGLONG WriteTransferCount; + ULONGLONG OtherTransferCount; +} IO_COUNTERS; +typedef IO_COUNTERS *PIO_COUNTERS; #endif /* __WINE_WINNT_H */ --- /dev/null 1970-01-01 01:00:00.000000000 +0100 +++ dlls/ntdll/process.c 2003-09-18 22:00:29.000000000 +0200 @@ -0,0 +1,136 @@ +/* + * NT basis DLL + * + * This file contains the Nt* API functions of NTDLL.DLL. + * In the original ntdll.dll they all seem to just call int 0x2e (down to the NTOSKRNL) + * + * Copyright 1996-1998 Marcus Meissner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include "wine/debug.h" + +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winternl.h" +#include "ntdll_misc.h" +#include "wine/server.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ntdll); + +/* + * Process object + */ + +/****************************************************************************** + * NtTerminateProcess [NTDLL.@] + * + * Native applications must kill themselves when done + */ +NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) +{ + NTSTATUS ret; + BOOL self; + SERVER_START_REQ( terminate_process ) + { + req->handle = handle; + req->exit_code = exit_code; + ret = wine_server_call( req ); + self = !ret && reply->self; + } + SERVER_END_REQ; + if (self) exit( exit_code ); + return ret; +} + +/****************************************************************************** +* NtQueryInformationProcess [NTDLL.@] +* ZwQueryInformationProcess [NTDLL.@] +* +*/ +NTSTATUS WINAPI NtQueryInformationProcess( + IN HANDLE ProcessHandle, + IN PROCESSINFOCLASS ProcessInformationClass, + OUT PVOID ProcessInformation, + IN ULONG ProcessInformationLength, + OUT PULONG ReturnLength) +{ + NTSTATUS ret = STATUS_SUCCESS; + ULONG len = 0; + + switch (ProcessInformationClass) + { + case ProcessIoCounters: + if (ProcessInformationLength == sizeof(IO_COUNTERS)) + { + memset(ProcessInformation, 0, ProcessInformationLength); + len = sizeof(IO_COUNTERS); + } + else ret = STATUS_INFO_LENGTH_MISMATCH; + break; + case ProcessDebugPort: + /* "These are not the debuggers you are looking for." * + * set it to 0 aka "no debugger" to satisfy copy protections */ + if (ProcessInformationLength == 4) + { + memset(ProcessInformation, 0 ,ProcessInformationLength); + len = 4; + } + else ret = STATUS_INFO_LENGTH_MISMATCH; + break; + case ProcessWow64Information: + if (ProcessInformationLength == 4) + { + memset(ProcessInformation, 0, ProcessInformationLength); + len = 4; + } + else ret = STATUS_INFO_LENGTH_MISMATCH; + break; + default: + FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n", + ProcessHandle,ProcessInformationClass, + ProcessInformation,ProcessInformationLength, + ReturnLength); + ret = STATUS_NOT_IMPLEMENTED; + break; + } + + if (ReturnLength) *ReturnLength = len; + + return ret; +} + +/****************************************************************************** + * NtSetInformationProcess [NTDLL.@] + * ZwSetInformationProcess [NTDLL.@] + */ +NTSTATUS WINAPI NtSetInformationProcess( + IN HANDLE ProcessHandle, + IN PROCESSINFOCLASS ProcessInformationClass, + IN PVOID ProcessInformation, + IN ULONG ProcessInformationLength) +{ + FIXME("(%p,0x%08x,%p,0x%08lx) stub\n", + ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength); + return 0; +} +