* autoload.cc: Replace autoload statments for ZwXXX by NtXXX.

Drop ZwQuerySystemInformation since NtQuerySystemInformation was
	already available.
	* fhandler_proc.cc (format_proc_uptime): Replace call to
	ZwQuerySystemInformation by call to NtQuerySystemInformation.
	(format_proc_stat): Ditto.
	* fhandler_process.cc (format_process_stat): Replace call to
	ZwQueryInformationProcess by call to NtQueryInformationProcess.
	(get_process_state): Ditto.
	(get_mem_values): Ditto.  Replace call to ZwQueryVirtualMemory by
	call to NtQueryVirtualMemory.
	* ntdll.h: Cleanup.  Drop ZwQuerySystemInformation since
	NtQuerySystemInformation was already available.  Replace declarations
	of ZwXXX functions by declarations of NtXXX.
	* pinfo.cc (winpids::enumNT): Replace call to ZwQuerySystemInformation
	by call to NtQuerySystemInformation.
This commit is contained in:
Corinna Vinschen 2002-05-30 07:45:30 +00:00
parent b050246c00
commit d74eced5d5
6 changed files with 45 additions and 29 deletions

View File

@ -1,3 +1,22 @@
2002-05-30 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc: Replace autoload statments for ZwXXX by NtXXX.
Drop ZwQuerySystemInformation since NtQuerySystemInformation was
already available.
* fhandler_proc.cc (format_proc_uptime): Replace call to
ZwQuerySystemInformation by call to NtQuerySystemInformation.
(format_proc_stat): Ditto.
* fhandler_process.cc (format_process_stat): Replace call to
ZwQueryInformationProcess by call to NtQueryInformationProcess.
(get_process_state): Ditto.
(get_mem_values): Ditto. Replace call to ZwQueryVirtualMemory by
call to NtQueryVirtualMemory.
* ntdll.h: Cleanup. Drop ZwQuerySystemInformation since
NtQuerySystemInformation was already available. Replace declarations
of ZwXXX functions by declarations of NtXXX.
* pinfo.cc (winpids::enumNT): Replace call to ZwQuerySystemInformation
by call to NtQuerySystemInformation.
2002-05-29 Christopher Faylor <cgf@redhat.com> 2002-05-29 Christopher Faylor <cgf@redhat.com>
* include/sys/cygwin.h (EXTERNAL_PINFO_VERSION): Reinstate. * include/sys/cygwin.h (EXTERNAL_PINFO_VERSION): Reinstate.

View File

@ -377,19 +377,18 @@ LoadDLLfunc (NetUserGetGroups, 28, netapi32)
LoadDLLfunc (NetUserGetInfo, 16, netapi32) LoadDLLfunc (NetUserGetInfo, 16, netapi32)
LoadDLLfunc (NetWkstaUserGetInfo, 12, netapi32) LoadDLLfunc (NetWkstaUserGetInfo, 12, netapi32)
LoadDLLfuncEx (NtQueryInformationFile, 20, ntdll, 1)
LoadDLLfuncEx2 (NtQueryObject, 20, ntdll, 1, 1)
LoadDLLfuncEx (NtCreateToken, 52, ntdll, 1) LoadDLLfuncEx (NtCreateToken, 52, ntdll, 1)
LoadDLLfuncEx (NtMapViewOfSection, 40, ntdll, 1) LoadDLLfuncEx (NtMapViewOfSection, 40, ntdll, 1)
LoadDLLfuncEx (NtOpenFile, 24, ntdll, 1) LoadDLLfuncEx (NtOpenFile, 24, ntdll, 1)
LoadDLLfuncEx (NtOpenSection, 12, ntdll, 1) LoadDLLfuncEx (NtOpenSection, 12, ntdll, 1)
LoadDLLfuncEx (NtQueryInformationFile, 20, ntdll, 1)
LoadDLLfuncEx (NtQueryInformationProcess, 20, ntdll, 1)
LoadDLLfuncEx2 (NtQueryObject, 20, ntdll, 1, 1)
LoadDLLfuncEx (NtQuerySystemInformation, 16, ntdll, 1) LoadDLLfuncEx (NtQuerySystemInformation, 16, ntdll, 1)
LoadDLLfuncEx (NtQueryVirtualMemory, 24, ntdll, 1)
LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1) LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1)
LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1) LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1)
LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1) LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1)
LoadDLLfuncEx (ZwQuerySystemInformation, 16, ntdll, 1)
LoadDLLfuncEx (ZwQueryInformationProcess, 20, ntdll, 1)
LoadDLLfuncEx (ZwQueryVirtualMemory, 24, ntdll, 1)
LoadDLLfuncEx (GetProcessMemoryInfo, 12, psapi, 1) LoadDLLfuncEx (GetProcessMemoryInfo, 12, psapi, 1)

View File

@ -419,7 +419,7 @@ format_proc_uptime (char *destbuf, size_t maxsize)
unsigned long long uptime = 0ULL, idle_time = 0ULL; unsigned long long uptime = 0ULL, idle_time = 0ULL;
SYSTEM_PROCESSOR_TIMES spt; SYSTEM_PROCESSOR_TIMES spt;
NTSTATUS ret = ZwQuerySystemInformation (SystemProcessorTimes, (PVOID) &spt, NTSTATUS ret = NtQuerySystemInformation (SystemProcessorTimes, (PVOID) &spt,
sizeof spt, NULL); sizeof spt, NULL);
if (!ret && GetLastError () == ERROR_PROC_NOT_FOUND) if (!ret && GetLastError () == ERROR_PROC_NOT_FOUND)
uptime = GetTickCount() / 10; uptime = GetTickCount() / 10;
@ -459,15 +459,15 @@ format_proc_stat (char *destbuf, size_t maxsize)
SYSTEM_PROCESSOR_TIMES spt; SYSTEM_PROCESSOR_TIMES spt;
SYSTEM_PERFORMANCE_INFORMATION spi; SYSTEM_PERFORMANCE_INFORMATION spi;
SYSTEM_TIME_OF_DAY_INFORMATION stodi; SYSTEM_TIME_OF_DAY_INFORMATION stodi;
ret = ZwQuerySystemInformation (SystemProcessorTimes, ret = NtQuerySystemInformation (SystemProcessorTimes,
(PVOID) &spt, (PVOID) &spt,
sizeof spt, NULL); sizeof spt, NULL);
if (ret == STATUS_SUCCESS) if (ret == STATUS_SUCCESS)
ret = ZwQuerySystemInformation (SystemPerformanceInformation, ret = NtQuerySystemInformation (SystemPerformanceInformation,
(PVOID) &spi, (PVOID) &spi,
sizeof spi, NULL); sizeof spi, NULL);
if (ret == STATUS_SUCCESS) if (ret == STATUS_SUCCESS)
ret = ZwQuerySystemInformation (SystemTimeOfDayInformation, ret = NtQuerySystemInformation (SystemTimeOfDayInformation,
(PVOID) &stodi, (PVOID) &stodi,
sizeof stodi, NULL); sizeof stodi, NULL);
if (ret != STATUS_SUCCESS) if (ret != STATUS_SUCCESS)

View File

@ -418,22 +418,22 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize)
FALSE, p->dwProcessId); FALSE, p->dwProcessId);
if (hProcess != NULL) if (hProcess != NULL)
{ {
ret = ZwQueryInformationProcess (hProcess, ret = NtQueryInformationProcess (hProcess,
ProcessVmCounters, ProcessVmCounters,
(PVOID) &vmc, (PVOID) &vmc,
sizeof vmc, NULL); sizeof vmc, NULL);
if (ret == STATUS_SUCCESS) if (ret == STATUS_SUCCESS)
ret = ZwQueryInformationProcess (hProcess, ret = NtQueryInformationProcess (hProcess,
ProcessTimes, ProcessTimes,
(PVOID) &put, (PVOID) &put,
sizeof put, NULL); sizeof put, NULL);
if (ret == STATUS_SUCCESS) if (ret == STATUS_SUCCESS)
ret = ZwQueryInformationProcess (hProcess, ret = NtQueryInformationProcess (hProcess,
ProcessBasicInformation, ProcessBasicInformation,
(PVOID) &pbi, (PVOID) &pbi,
sizeof pbi, NULL); sizeof pbi, NULL);
if (ret == STATUS_SUCCESS) if (ret == STATUS_SUCCESS)
ret = ZwQueryInformationProcess (hProcess, ret = NtQueryInformationProcess (hProcess,
ProcessQuotaLimits, ProcessQuotaLimits,
(PVOID) &ql, (PVOID) &ql,
sizeof ql, NULL); sizeof ql, NULL);
@ -448,11 +448,11 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize)
return 0; return 0;
} }
if (ret == STATUS_SUCCESS) if (ret == STATUS_SUCCESS)
ret = ZwQuerySystemInformation (SystemTimeOfDayInformation, ret = NtQuerySystemInformation (SystemTimeOfDayInformation,
(PVOID) &stodi, (PVOID) &stodi,
sizeof stodi, NULL); sizeof stodi, NULL);
if (ret == STATUS_SUCCESS) if (ret == STATUS_SUCCESS)
ret = ZwQuerySystemInformation (SystemProcessorTimes, ret = NtQuerySystemInformation (SystemProcessorTimes,
(PVOID) &spt, (PVOID) &spt,
sizeof spt, NULL); sizeof spt, NULL);
if (ret != STATUS_SUCCESS) if (ret != STATUS_SUCCESS)
@ -629,7 +629,7 @@ get_process_state (DWORD dwProcessId)
PULONG p = new ULONG[n]; PULONG p = new ULONG[n];
int state =' '; int state =' ';
while (STATUS_INFO_LENGTH_MISMATCH == while (STATUS_INFO_LENGTH_MISMATCH ==
(ret = ZwQuerySystemInformation (SystemProcessesAndThreadsInformation, (ret = NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
(PVOID) p, (PVOID) p,
n * sizeof *p, NULL))) n * sizeof *p, NULL)))
delete [] p, p = new ULONG[n *= 2]; delete [] p, p = new ULONG[n *= 2];
@ -705,7 +705,7 @@ get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, u
error); error);
return false; return false;
} }
while ((ret = ZwQueryVirtualMemory (hProcess, 0, while ((ret = NtQueryVirtualMemory (hProcess, 0,
MemoryWorkingSetList, MemoryWorkingSetList,
(PVOID) p, (PVOID) p,
n * sizeof *p, &length)), n * sizeof *p, &length)),
@ -734,7 +734,7 @@ get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, u
else else
++*vmdata; ++*vmdata;
} }
ret = ZwQueryInformationProcess (hProcess, ret = NtQueryInformationProcess (hProcess,
ProcessVmCounters, ProcessVmCounters,
(PVOID) &vmc, (PVOID) &vmc,
sizeof vmc, NULL); sizeof vmc, NULL);

View File

@ -376,19 +376,17 @@ extern "C"
NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, ULONG, ULONG); PIO_STATUS_BLOCK, ULONG, ULONG);
NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES); NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtQueryInformationFile (HANDLE, IO_STATUS_BLOCK *, VOID *,
DWORD, DWORD);
NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *,
ULONG, ULONG *);
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS, NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
PVOID, ULONG, PULONG); PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID); NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR); VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS); ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
NTSTATUS NTAPI ZwQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS,
IN OUT PVOID, IN ULONG,
OUT PULONG);
NTSTATUS NTAPI ZwQueryInformationProcess (IN HANDLE, IN PROCESSINFOCLASS,
OUT PVOID, IN ULONG, OUT PULONG);
NTSTATUS NTAPI ZwQueryVirtualMemory (IN HANDLE, IN PVOID, IN MEMORY_INFORMATION_CLASS,
OUT PVOID, IN ULONG, OUT PULONG);
NTSTATUS NTAPI NtQueryInformationFile (HANDLE, IO_STATUS_BLOCK *, VOID *,
DWORD, DWORD);
NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *, ULONG, ULONG *);
} }

View File

@ -318,7 +318,7 @@ winpids::enumNT (bool winpid)
NTSTATUS res; NTSTATUS res;
for (;;) for (;;)
{ {
res = ZwQuerySystemInformation (SystemProcessesAndThreadsInformation, res = NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
procs, szprocs, NULL); procs, szprocs, NULL);
if (res == 0) if (res == 0)
break; break;