2003-06-01 Casper S. Hornstrup <chorns@users.sourceforge.net>

Changes for compiling with w32api

	* include/ntos/zwtypes.h (SYSTEM_MODULES): Rename to
	SYSTEM_MODULE_INFORMATION. Match w32api structure fieldnames.
	(SYSTEM_MODULE_INFORMATION):  Rename to SYSTEM_MODULE_INFORMATION_ENTRY.
	Match w32api structure fieldnames.
	* include/epsapi.h: Include <ntos.h>.
	(PSYSMOD_ENUM_ROUTINE, PsaCaptureSystemModules, PsaWalkSystemModules,
	PsaWalkFirstSystemModule, PsaWalkNextSystemModule): Use
	SYSTEM_MODULE_INFORMATION_ENTRY and SYSTEM_MODULE_INFORMATION structures.
	* lib/epsapi/enum/drivers.c: Use SYSTEM_MODULE_INFORMATION_ENTRY and
	SYSTEM_MODULE_INFORMATION structures.
	* lib/psapi/misc/win32.c: Ditto.
	* ntoskrnl/ldr/loader.c: Ditto.
	* lib/epsapi/enum/modules.c: Include <ntos.h>.
	* lib/ntdll/rtl/thread.c: Ditto.
	* lib/rosrtl/thread/context.c: Ditto.
	* lib/rosrtl/thread/create.c: Ditto.
	* lib/rosrtl/thread/stack.c: Ditto.
	* include/ntos.h: Include "rosrtl/thread.h".
	* include/structs.h (_BLOB_DEFINED): Rename to __BLOB_T_DEFINED.
	* include/winsock2.h: Ditto.
	* include/ntos/obtypes.h (POBJECT_TYPE): Make a pointer to struct
	_OBJECT_TYPE.
	(PHANDLE_TABLE): Make a pointer to struct _HANDLE_TABLE.
	* ntoskrnl/include/internal/mm.h (PSECTION_OBJECT): Make a pointer to
	struct _SECTION_OBJECT.
	* ntoskrnl/include/internal/i386/ps.h (PKPCR): Make a pointer to struct
	_KPCR.

svn path=/trunk/; revision=4807
This commit is contained in:
Casper Hornstrup 2003-06-01 14:59:02 +00:00
parent 17c104a163
commit 05a9cdcf10
17 changed files with 151 additions and 102 deletions

View file

@ -1,3 +1,35 @@
2003-06-01 Casper S. Hornstrup <chorns@users.sourceforge.net>
Changes for compiling with w32api
* include/ntos/zwtypes.h (SYSTEM_MODULES): Rename to
SYSTEM_MODULE_INFORMATION. Match w32api structure fieldnames.
(SYSTEM_MODULE_INFORMATION): Rename to SYSTEM_MODULE_INFORMATION_ENTRY.
Match w32api structure fieldnames.
* include/epsapi.h: Include <ntos.h>.
(PSYSMOD_ENUM_ROUTINE, PsaCaptureSystemModules, PsaWalkSystemModules,
PsaWalkFirstSystemModule, PsaWalkNextSystemModule): Use
SYSTEM_MODULE_INFORMATION_ENTRY and SYSTEM_MODULE_INFORMATION structures.
* lib/epsapi/enum/drivers.c: Use SYSTEM_MODULE_INFORMATION_ENTRY and
SYSTEM_MODULE_INFORMATION structures.
* lib/psapi/misc/win32.c: Ditto.
* ntoskrnl/ldr/loader.c: Ditto.
* lib/epsapi/enum/modules.c: Include <ntos.h>.
* lib/ntdll/rtl/thread.c: Ditto.
* lib/rosrtl/thread/context.c: Ditto.
* lib/rosrtl/thread/create.c: Ditto.
* lib/rosrtl/thread/stack.c: Ditto.
* include/ntos.h: Include "rosrtl/thread.h".
* include/structs.h (_BLOB_DEFINED): Rename to __BLOB_T_DEFINED.
* include/winsock2.h: Ditto.
* include/ntos/obtypes.h (POBJECT_TYPE): Make a pointer to struct
_OBJECT_TYPE.
(PHANDLE_TABLE): Make a pointer to struct _HANDLE_TABLE.
* ntoskrnl/include/internal/mm.h (PSECTION_OBJECT): Make a pointer to
struct _SECTION_OBJECT.
* ntoskrnl/include/internal/i386/ps.h (PKPCR): Make a pointer to struct
_KPCR.
2003-05-28 Casper S. Hornstrup <chorns@users.sourceforge.net>
* Makefile: Update bootcd target.

View file

@ -1,4 +1,4 @@
/* $Id: epsapi.h,v 1.2 2003/04/13 03:57:41 hyperion Exp $
/* $Id: epsapi.h,v 1.3 2003/06/01 14:59:01 chorns Exp $
*/
/*
* epsapi.h
@ -26,8 +26,8 @@
#define __INTERNAL_PSAPI_H_INCLUDED__
/* INCLUDES */
#include <ddk/ntddk.h>
#include <ntdll/ldr.h>
#define NTOS_MODE_USER
#include <ntos.h>
/* OBJECTS */
@ -46,7 +46,7 @@ typedef NTSTATUS NTAPI (*PTHREAD_ENUM_ROUTINE)
typedef NTSTATUS NTAPI (*PSYSMOD_ENUM_ROUTINE)
(
IN PSYSTEM_MODULE_INFORMATION CurrentModule,
IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule,
IN OUT PVOID CallbackContext
);
@ -169,26 +169,26 @@ NTSTATUS
NTAPI
PsaCaptureSystemModules
(
OUT PSYSTEM_MODULES * SystemModules
OUT PSYSTEM_MODULE_INFORMATION * SystemModules
);
NTSTATUS
NTAPI
PsaWalkSystemModules
(
IN PSYSTEM_MODULES SystemModules,
IN PSYSTEM_MODULE_INFORMATION SystemModules,
IN PSYSMOD_ENUM_ROUTINE Callback,
IN OUT PVOID CallbackContext
);
PSYSTEM_MODULE_INFORMATION
PSYSTEM_MODULE_INFORMATION_ENTRY
FASTCALL
PsaWalkFirstSystemModule
(
IN PSYSTEM_MODULES SystemModules
IN PSYSTEM_MODULE_INFORMATION SystemModules
);
PSYSTEM_MODULE_INFORMATION
PSYSTEM_MODULE_INFORMATION_ENTRY
FASTCALL
PsaWalkNextSystemModule
(

View file

@ -1,6 +1,6 @@
#ifndef _NTOS_H
#define _NTOS_H
/* $Id: ntos.h,v 1.9 2003/05/28 18:09:09 chorns Exp $ */
/* $Id: ntos.h,v 1.10 2003/06/01 14:59:01 chorns Exp $ */
#if defined(NTOS_MODE_USER)
// include windows.h before ntddk.h to get user mode prototype for InterlockedXxx functions
@ -44,10 +44,10 @@
#include "ntdll/registry.h"
#include "ntdll/rtl.h"
#include "ntdll/trace.h"
#include "rosrtl/thread.h"
#include "kernel32/error.h"
#else // Assume kernel mode
#include <ddk/ntddk.h>
//#include "ntos/types.h" // robd
#include <ddk/ntifs.h>
#include "ntos/types.h"
#include "ntos/cdrom.h"
@ -83,6 +83,7 @@
#include "ntos/haltypes.h"
#include "ntos/obtypes.h"
#include "ntos/tss.h"
#include "rosrtl/thread.h"
#endif
#endif /* ndef _NTOS_H */

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_OBTYPES_H
#define _INCLUDE_DDK_OBTYPES_H
/* $Id: obtypes.h,v 1.1 2003/05/28 18:35:35 chorns Exp $ */
/* $Id: obtypes.h,v 1.2 2003/06/01 14:59:01 chorns Exp $ */
struct _DIRECTORY_OBJECT;
struct _OBJECT_ATTRIBUTES;
@ -128,7 +128,13 @@ typedef struct _OBJECT_TYPE
VOID STDCALL_FUNC (*DuplicationNotify)(PEPROCESS DuplicateTo,
PEPROCESS DuplicateFrom,
PVOID Object);
} OBJECT_TYPE, *POBJECT_TYPE;
} OBJECT_TYPE;
#ifndef __USE_W32API
typedef struct _OBJECT_TYPE *POBJECT_TYPE;
#endif /* __USE_W32API */
typedef struct _OBJECT_HEADER
@ -178,7 +184,13 @@ typedef struct _HANDLE_TABLE
{
LIST_ENTRY ListHead;
KSPIN_LOCK ListLock;
} HANDLE_TABLE, *PHANDLE_TABLE;
} HANDLE_TABLE;
#ifndef __USE_W32API
typedef struct _HANDLE_TABLE *PHANDLE_TABLE;
#endif /* __USE_W32API */
extern POBJECT_TYPE ObDirectoryType;

View file

@ -311,37 +311,25 @@ struct _SYSTEM_PERFORMANCE_INFORMATION
} SYSTEM_PERFORMANCE_INFO, *PSYSTEM_PERFORMANCE_INFO;
// SystemModuleInformation (11)
typedef
struct _SYSTEM_MODULE_INFORMATION
{
ULONG Reserved[2];
PVOID Base;
SIZE_T Size;
ULONG Flags;
USHORT Index;
USHORT Unknown;
USHORT LoadCount;
USHORT ModuleNameOffset;
CHAR ImageName[256];
#if 0
typedef struct _SYSTEM_MODULE_INFORMATION_ENTRY {
ULONG Unknown1;
ULONG Unknown2;
PVOID BaseAddress;
PVOID Base;
ULONG Size;
ULONG Flags;
ULONG EntryIndex;
USHORT NameLength; /* Length of module name not including the path, this field contains valid value only for NTOSKRNL module*/
USHORT PathLength; /* Length of 'directory path' part of modulename*/
CHAR Name [256];
#endif
} SYSTEM_MODULE_INFORMATION, * PSYSTEM_MODULE_INFORMATION;
USHORT Index;
/* Length of module name not including the path, this
field contains valid value only for NTOSKRNL module */
USHORT NameLength;
USHORT LoadCount;
USHORT PathLength;
CHAR ImageName[256];
} SYSTEM_MODULE_INFORMATION_ENTRY, *PSYSTEM_MODULE_INFORMATION_ENTRY;
typedef
struct _SYSTEM_MODULES
{
SIZE_T Count;
SYSTEM_MODULE_INFORMATION Modules[ANYSIZE_ARRAY];
} SYSTEM_MODULES, *PSYSTEM_MODULES;
typedef struct _SYSTEM_MODULE_INFORMATION {
ULONG Count;
SYSTEM_MODULE_INFORMATION_ENTRY Module[1];
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
// SystemHandleInformation (16)
// (see ontypes.h)

View file

@ -282,8 +282,8 @@ typedef struct {
DWORD bV4GammaBlue;
} BITMAPV4HEADER, *LPBITMAPV4HEADER, *PBITMAPV4HEADER;
#ifndef _BLOB_DEFINED
#define _BLOB_DEFINED
#ifndef __BLOB_T_DEFINED
#define __BLOB_T_DEFINED
typedef struct _BLOB {
ULONG cbSize;
BYTE *pBlobData;

View file

@ -650,8 +650,8 @@ typedef struct WSAData {
CHAR FAR* lpVendorInfo;
} WSADATA, FAR* LPWSADATA;
#ifndef _BLOB_DEFINED
#define _BLOB_DEFINED
#ifndef __BLOB_T_DEFINED
#define __BLOB_T_DEFINED
typedef struct _BLOB {
ULONG cbSize;
BYTE *pBlobData;

View file

@ -1,4 +1,4 @@
/* $Id: drivers.c,v 1.1 2003/04/13 03:24:27 hyperion Exp $
/* $Id: drivers.c,v 1.2 2003/06/01 14:59:01 chorns Exp $
*/
/*
* COPYRIGHT: See COPYING in the top level directory
@ -14,9 +14,12 @@
* and improve reusability
*/
#include <ddk/ntddk.h>
#include <debug.h>
#include <stddef.h>
#define NTOS_MODE_USER
#include <ntos.h>
#define NDEBUG
#include <debug.h>
#include <epsapi.h>
@ -29,7 +32,7 @@ PsaEnumerateSystemModules
)
{
register NTSTATUS nErrCode = STATUS_SUCCESS;
PSYSTEM_MODULES psmModules = NULL;
PSYSTEM_MODULE_INFORMATION psmModules = NULL;
#if 0
__try
@ -67,12 +70,12 @@ NTSTATUS
NTAPI
PsaCaptureSystemModules
(
OUT PSYSTEM_MODULES * SystemModules
OUT PSYSTEM_MODULE_INFORMATION * SystemModules
)
{
SIZE_T nSize = 0;
register NTSTATUS nErrCode;
register PSYSTEM_MODULES psmModules = (PSYSTEM_MODULES)&nSize;
register PSYSTEM_MODULE_INFORMATION psmModules = (PSYSTEM_MODULE_INFORMATION)&nSize;
#if 0
__try
@ -174,7 +177,7 @@ NTSTATUS
NTAPI
PsaWalkSystemModules
(
IN PSYSTEM_MODULES SystemModules,
IN PSYSTEM_MODULE_INFORMATION SystemModules,
IN PSYSMOD_ENUM_ROUTINE Callback,
IN OUT PVOID CallbackContext
)
@ -186,7 +189,7 @@ PsaWalkSystemModules
for(i = 0; i < SystemModules->Count; ++ i)
{
/* return current module to the callback */
nErrCode = Callback(&(SystemModules->Modules[i]), CallbackContext);
nErrCode = Callback(&(SystemModules->Module[i]), CallbackContext);
if(!NT_SUCCESS(nErrCode))
/* failure */
@ -197,29 +200,29 @@ PsaWalkSystemModules
return STATUS_SUCCESS;
}
PSYSTEM_MODULE_INFORMATION
PSYSTEM_MODULE_INFORMATION_ENTRY
FASTCALL
PsaWalkFirstSystemModule
(
IN PSYSTEM_MODULES SystemModules
IN PSYSTEM_MODULE_INFORMATION SystemModules
)
{
return &(SystemModules->Modules[0]);
return &(SystemModules->Module[0]);
}
PSYSTEM_MODULE_INFORMATION
PSYSTEM_MODULE_INFORMATION_ENTRY
FASTCALL
PsaWalkNextSystemModule
(
IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule
)
{
return (PSYSTEM_MODULE_INFORMATION)
return (PSYSTEM_MODULE_INFORMATION_ENTRY)
(
(ULONG_PTR)CurrentSystemModule +
(
offsetof(SYSTEM_MODULES, Modules[1]) -
offsetof(SYSTEM_MODULES, Modules[0])
offsetof(SYSTEM_MODULE_INFORMATION, Module[1]) -
offsetof(SYSTEM_MODULE_INFORMATION, Module[0])
)
);
}

View file

@ -1,4 +1,4 @@
/* $Id: modules.c,v 1.1 2003/04/13 03:24:27 hyperion Exp $
/* $Id: modules.c,v 1.2 2003/06/01 14:59:01 chorns Exp $
*/
/*
* COPYRIGHT: See COPYING in the top level directory
@ -19,9 +19,11 @@
* and improve reusability
*/
#include <ddk/ntddk.h>
#define NTOS_MODE_USER
#include <ntos.h>
#define NDEBUG
#include <debug.h>
#include <ntdll/ldr.h>
#include <epsapi.h>

View file

@ -18,10 +18,8 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <napi/teb.h>
#include <ntdll/rtl.h>
#include <rosrtl/thread.h>
#define NTOS_MODE_USER
#include <ntos.h>
#define NDEBUG
#include <ntdll/ntdll.h>

View file

@ -1,4 +1,4 @@
/* $Id: win32.c,v 1.8 2003/04/13 03:24:26 hyperion Exp $
/* $Id: win32.c,v 1.9 2003/06/01 14:59:02 chorns Exp $
*/
/*
* COPYRIGHT: See COPYING in the top level directory
@ -73,7 +73,7 @@ typedef struct _ENUM_DEVICE_DRIVERS_CONTEXT
/* callback routine */
NTSTATUS STDCALL EnumDeviceDriversCallback
(
IN PSYSTEM_MODULE_INFORMATION CurrentModule,
IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule,
IN OUT PVOID CallbackContext
)
{
@ -308,7 +308,7 @@ typedef struct _GET_DEVICE_DRIVER_NAME_CONTEXT
/* common callback routine */
NTSTATUS STDCALL GetDeviceDriverNameCallback
(
IN PSYSTEM_MODULE_INFORMATION CurrentModule,
IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule,
IN OUT PVOID CallbackContext
)
{
@ -325,7 +325,7 @@ NTSTATUS STDCALL GetDeviceDriverNameCallback
if(pgddncContext->bFullName)
pcModuleName = &CurrentModule->ImageName[0];
else
pcModuleName = &CurrentModule->ImageName[CurrentModule->ModuleNameOffset];
pcModuleName = &CurrentModule->ImageName[CurrentModule->PathLength];
/* get the length of the name */
l = strlen(pcModuleName);

View file

@ -1,10 +1,10 @@
/* $Id: context.c,v 1.2 2003/05/29 00:36:41 hyperion Exp $
/* $Id: context.c,v 1.3 2003/06/01 14:59:02 chorns Exp $
*/
/*
*/
#include <ddk/ntddk.h>
#include <rosrtl/thread.h>
#define NTOS_MODE_USER
#include <ntos.h>
#if defined(_M_IX86)
#include <napi/i386/segment.h>

View file

@ -1,11 +1,11 @@
/* $Id: create.c,v 1.2 2003/05/29 00:36:41 hyperion Exp $
/* $Id: create.c,v 1.3 2003/06/01 14:59:02 chorns Exp $
*/
/*
*/
#include <stdarg.h>
#include <ddk/ntddk.h>
#include <rosrtl/thread.h>
#define NTOS_MODE_USER
#include <ntos.h>
#define NDEBUG
#include <ntdll/ntdll.h>

View file

@ -1,10 +1,10 @@
/* $Id: stack.c,v 1.1 2003/05/29 00:36:41 hyperion Exp $
/* $Id: stack.c,v 1.2 2003/06/01 14:59:02 chorns Exp $
*/
/*
*/
#include <ddk/ntddk.h>
#include <rosrtl/thread.h>
#define NTOS_MODE_USER
#include <ntos.h>
#define NDEBUG
#include <ntdll/ntdll.h>

View file

@ -63,7 +63,14 @@ typedef struct _KPCR
KTSS* TSS; /* 28 */
UCHAR Reserved3[0xF8]; /* 2C */
struct _KTHREAD* CurrentThread; /* 124 */
} __attribute__((packed)) KPCR, *PKPCR;
} __attribute__((packed)) KPCR;
#ifndef __USE_W32API
typedef struct _KPCR *PKPCR;
#endif /* __USE_W32API */
#ifndef __USE_W32API

View file

@ -88,7 +88,7 @@ typedef struct _MM_SECTION_SEGMENT
BOOLEAN WriteCopy;
} MM_SECTION_SEGMENT, *PMM_SECTION_SEGMENT;
typedef struct
typedef struct _SECTION_OBJECT
{
CSHORT Type;
CSHORT Size;
@ -111,7 +111,13 @@ typedef struct
ULONG ImageCharacteristics;
USHORT Machine;
BOOLEAN Executable;
} SECTION_OBJECT, *PSECTION_OBJECT;
} SECTION_OBJECT;
#ifndef __USE_W32API
typedef struct _SECTION_OBJECT *PSECTION_OBJECT;
#endif /* __USE_W32API */
typedef struct
{

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.130 2003/04/26 23:13:31 hyperion Exp $
/* $Id: loader.c,v 1.131 2003/06/01 14:59:02 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -594,7 +594,7 @@ LdrpQueryModuleInformation(PVOID Buffer,
PLIST_ENTRY current_entry;
PMODULE_OBJECT current;
ULONG ModuleCount = 0;
PSYSTEM_MODULES Smi;
PSYSTEM_MODULE_INFORMATION Smi;
ANSI_STRING AnsiName;
PCHAR p;
KIRQL Irql;
@ -609,8 +609,8 @@ LdrpQueryModuleInformation(PVOID Buffer,
current_entry = current_entry->Flink;
}
*ReqSize = sizeof(SYSTEM_MODULES)+
(ModuleCount - 1) * sizeof(SYSTEM_MODULE_INFORMATION);
*ReqSize = sizeof(SYSTEM_MODULE_INFORMATION)+
(ModuleCount - 1) * sizeof(SYSTEM_MODULE_INFORMATION_ENTRY);
if (Size < *ReqSize)
{
@ -621,7 +621,7 @@ LdrpQueryModuleInformation(PVOID Buffer,
/* fill the buffer */
memset(Buffer, '=', Size);
Smi = (PSYSTEM_MODULES)Buffer;
Smi = (PSYSTEM_MODULE_INFORMATION)Buffer;
Smi->Count = ModuleCount;
ModuleCount = 0;
@ -630,18 +630,18 @@ LdrpQueryModuleInformation(PVOID Buffer,
{
current = CONTAINING_RECORD(current_entry,MODULE_OBJECT,ListEntry);
Smi->Modules[ModuleCount].Reserved[0] = 0; /* Always 0 */
Smi->Modules[ModuleCount].Reserved[1] = 0; /* Always 0 */
Smi->Modules[ModuleCount].Base = current->Base;
Smi->Modules[ModuleCount].Size = current->Length;
Smi->Modules[ModuleCount].Flags = 0; /* Flags ??? (GN) */
Smi->Modules[ModuleCount].Index = ModuleCount;
Smi->Modules[ModuleCount].Unknown = 0;
Smi->Modules[ModuleCount].LoadCount = 0; /* FIXME */
Smi->Module[ModuleCount].Unknown1 = 0; /* Always 0 */
Smi->Module[ModuleCount].Unknown2 = 0; /* Always 0 */
Smi->Module[ModuleCount].Base = current->Base;
Smi->Module[ModuleCount].Size = current->Length;
Smi->Module[ModuleCount].Flags = 0; /* Flags ??? (GN) */
Smi->Module[ModuleCount].Index = ModuleCount;
Smi->Module[ModuleCount].NameLength = 0;
Smi->Module[ModuleCount].LoadCount = 0; /* FIXME */
AnsiName.Length = 0;
AnsiName.MaximumLength = 256;
AnsiName.Buffer = Smi->Modules[ModuleCount].ImageName;
AnsiName.Buffer = Smi->Module[ModuleCount].ImageName;
RtlUnicodeStringToAnsiString(&AnsiName,
&current->FullName,
FALSE);
@ -649,12 +649,12 @@ LdrpQueryModuleInformation(PVOID Buffer,
p = strrchr(AnsiName.Buffer, '\\');
if (p == NULL)
{
Smi->Modules[ModuleCount].ModuleNameOffset = 0;
Smi->Module[ModuleCount].PathLength = 0;
}
else
{
p++;
Smi->Modules[ModuleCount].ModuleNameOffset = p - AnsiName.Buffer;
Smi->Module[ModuleCount].PathLength = p - AnsiName.Buffer;
}
ModuleCount++;