Build epsapi with NDK

svn path=/trunk/; revision=16164
This commit is contained in:
Alex Ionescu 2005-06-20 19:14:08 +00:00
parent c3151ba005
commit ae955c39ed
5 changed files with 24 additions and 18 deletions

View file

@ -26,8 +26,8 @@
#define __EPSAPI_H_INCLUDED__ #define __EPSAPI_H_INCLUDED__
/* INCLUDES */ /* INCLUDES */
#define NTOS_MODE_USER #include <ntdll/rtl.h>
#include <ntos.h> #include <ntdll/ldr.h> /* FIXME: USE LDR_DATA_TABLE_ENTRY */
/* OBJECTS */ /* OBJECTS */

View file

@ -464,7 +464,8 @@ typedef struct _SYSTEM_BASIC_INFORMATION
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION; } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
/* Class 1 */ /* Class 1 */
typedef struct _SYSTEM_PROCESSOR_INFORMATION { typedef struct _SYSTEM_PROCESSOR_INFORMATION
{
USHORT ProcessorArchitecture; USHORT ProcessorArchitecture;
USHORT ProcessorLevel; USHORT ProcessorLevel;
USHORT ProcessorRevision; USHORT ProcessorRevision;
@ -552,7 +553,8 @@ typedef struct _SYSTEM_PERFORMANCE_INFORMATION
} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION; } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
/* Class 3 */ /* Class 3 */
typedef struct _SYSTEM_TIMEOFDAY_INFORMATION { typedef struct _SYSTEM_TIMEOFDAY_INFORMATION
{
LARGE_INTEGER BootTime; LARGE_INTEGER BootTime;
LARGE_INTEGER CurrentTime; LARGE_INTEGER CurrentTime;
LARGE_INTEGER TimeZoneBias; LARGE_INTEGER TimeZoneBias;
@ -633,7 +635,8 @@ typedef struct _SYSTEM_CALL_COUNT_INFORMATION
} SYSTEM_CALL_COUNT_INFORMATION, *PSYSTEM_CALL_COUNT_INFORMATION; } SYSTEM_CALL_COUNT_INFORMATION, *PSYSTEM_CALL_COUNT_INFORMATION;
/* Class 7 */ /* Class 7 */
typedef struct _SYSTEM_DEVICE_INFORMATION { typedef struct _SYSTEM_DEVICE_INFORMATION
{
ULONG NumberOfDisks; ULONG NumberOfDisks;
ULONG NumberOfFloppies; ULONG NumberOfFloppies;
ULONG NumberOfCdRoms; ULONG NumberOfCdRoms;

View file

@ -14,9 +14,9 @@
* and improve reusability * and improve reusability
*/ */
#include <stddef.h> #include <windows.h>
#define NTOS_MODE_USER #define NTOS_MODE_USER
#include <ntos.h> #include <ndk/ntndk.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -188,8 +188,8 @@ PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL
PsaWalkNextSystemModule(IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule) PsaWalkNextSystemModule(IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule)
{ {
return (PSYSTEM_MODULE_INFORMATION_ENTRY)((ULONG_PTR)CurrentSystemModule + return (PSYSTEM_MODULE_INFORMATION_ENTRY)((ULONG_PTR)CurrentSystemModule +
(offsetof(SYSTEM_MODULE_INFORMATION, Module[1]) - (FIELD_OFFSET(SYSTEM_MODULE_INFORMATION, Module[1]) -
offsetof(SYSTEM_MODULE_INFORMATION, Module[0]))); FIELD_OFFSET(SYSTEM_MODULE_INFORMATION, Module[0])));
} }
/* EOF */ /* EOF */

View file

@ -18,9 +18,9 @@
* isolated in its own library to clear the confusion * isolated in its own library to clear the confusion
* and improve reusability * and improve reusability
*/ */
#include <windows.h>
#define NTOS_MODE_USER #define NTOS_MODE_USER
#include <ntos.h> #include <ndk/ntndk.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>

View file

@ -31,12 +31,15 @@
* and improve reusability * and improve reusability
*/ */
#include <ddk/ntddk.h> #include <windows.h>
#include <debug.h> #define NTOS_MODE_USER
#include <stddef.h> #include <ndk/ntndk.h>
#include <epsapi.h> #include <epsapi.h>
#define NDEBUG
#include <debug.h>
NTSTATUS NTAPI NTSTATUS NTAPI
PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESS_INFORMATION *ProcessesAndThreads) PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESS_INFORMATION *ProcessesAndThreads)
{ {
@ -74,7 +77,7 @@ PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESS_INFORMATION *ProcessesAndThrea
pInfoBuffer = pTmp; pInfoBuffer = pTmp;
/* query the information */ /* query the information */
Status = NtQuerySystemInformation(SystemProcessesAndThreadsInformation, Status = NtQuerySystemInformation(SystemProcessInformation,
pInfoBuffer, pInfoBuffer,
nSize, nSize,
NULL); NULL);
@ -262,7 +265,7 @@ PsaWalkFirstThread(IN PSYSTEM_PROCESS_INFORMATION CurrentProcess)
static SIZE_T nOffsetOfThreads = 0; static SIZE_T nOffsetOfThreads = 0;
/* get the offset of the Threads field */ /* get the offset of the Threads field */
nOffsetOfThreads = offsetof(SYSTEM_PROCESS_INFORMATION, TH); nOffsetOfThreads = FIELD_OFFSET(SYSTEM_PROCESS_INFORMATION, TH);
return (PSYSTEM_THREAD_INFORMATION)((ULONG_PTR)CurrentProcess + nOffsetOfThreads); return (PSYSTEM_THREAD_INFORMATION)((ULONG_PTR)CurrentProcess + nOffsetOfThreads);
} }
@ -271,8 +274,8 @@ PSYSTEM_THREAD_INFORMATION FASTCALL
PsaWalkNextThread(IN PSYSTEM_THREAD_INFORMATION CurrentThread) PsaWalkNextThread(IN PSYSTEM_THREAD_INFORMATION CurrentThread)
{ {
return (PSYSTEM_THREAD_INFORMATION)((ULONG_PTR)CurrentThread + return (PSYSTEM_THREAD_INFORMATION)((ULONG_PTR)CurrentThread +
(offsetof(SYSTEM_PROCESS_INFORMATION, TH[1]) - (FIELD_OFFSET(SYSTEM_PROCESS_INFORMATION, TH[1]) -
offsetof(SYSTEM_PROCESS_INFORMATION, TH[0]))); FIELD_OFFSET(SYSTEM_PROCESS_INFORMATION, TH[0])));
} }
/* EOF */ /* EOF */