diff --git a/reactos/ChangeLog b/reactos/ChangeLog index 56574986136..18c397f120a 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,35 @@ +2003-06-01 Casper S. Hornstrup + + 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 . + (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 . + * 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 * Makefile: Update bootcd target. diff --git a/reactos/include/epsapi.h b/reactos/include/epsapi.h index ee0aab6289b..01db5edcc42 100644 --- a/reactos/include/epsapi.h +++ b/reactos/include/epsapi.h @@ -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 -#include +#define NTOS_MODE_USER +#include /* 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 ( diff --git a/reactos/include/ntos.h b/reactos/include/ntos.h index a93d19a5c70..2f49fecf6a0 100644 --- a/reactos/include/ntos.h +++ b/reactos/include/ntos.h @@ -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 -//#include "ntos/types.h" // robd #include #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 */ diff --git a/reactos/include/ntos/obtypes.h b/reactos/include/ntos/obtypes.h index 60f9e7e1c2b..a656140afb5 100755 --- a/reactos/include/ntos/obtypes.h +++ b/reactos/include/ntos/obtypes.h @@ -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; diff --git a/reactos/include/ntos/zwtypes.h b/reactos/include/ntos/zwtypes.h index d8b8adca453..50ef6977c9d 100755 --- a/reactos/include/ntos/zwtypes.h +++ b/reactos/include/ntos/zwtypes.h @@ -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 - ULONG Unknown1; - ULONG Unknown2; - PVOID BaseAddress; - 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; +typedef struct _SYSTEM_MODULE_INFORMATION_ENTRY { + ULONG Unknown1; + ULONG Unknown2; + PVOID Base; + ULONG Size; + ULONG Flags; + 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) diff --git a/reactos/include/structs.h b/reactos/include/structs.h index 5092ea40483..e33feb2e9e0 100644 --- a/reactos/include/structs.h +++ b/reactos/include/structs.h @@ -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; diff --git a/reactos/include/winsock2.h b/reactos/include/winsock2.h index a93362b1b34..642c00e63fe 100644 --- a/reactos/include/winsock2.h +++ b/reactos/include/winsock2.h @@ -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; diff --git a/reactos/lib/epsapi/enum/drivers.c b/reactos/lib/epsapi/enum/drivers.c index 43ba4f3ac7d..bd54f85193b 100644 --- a/reactos/lib/epsapi/enum/drivers.c +++ b/reactos/lib/epsapi/enum/drivers.c @@ -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 -#include #include +#define NTOS_MODE_USER +#include + +#define NDEBUG +#include #include @@ -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]) ) ); } diff --git a/reactos/lib/epsapi/enum/modules.c b/reactos/lib/epsapi/enum/modules.c index d671de68e04..e5951390ae9 100644 --- a/reactos/lib/epsapi/enum/modules.c +++ b/reactos/lib/epsapi/enum/modules.c @@ -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 +#define NTOS_MODE_USER +#include + +#define NDEBUG #include -#include #include diff --git a/reactos/lib/ntdll/rtl/thread.c b/reactos/lib/ntdll/rtl/thread.c index fc39ff3e3f1..fbb665607df 100644 --- a/reactos/lib/ntdll/rtl/thread.c +++ b/reactos/lib/ntdll/rtl/thread.c @@ -18,10 +18,8 @@ /* INCLUDES *****************************************************************/ -#include -#include -#include -#include +#define NTOS_MODE_USER +#include #define NDEBUG #include diff --git a/reactos/lib/psapi/misc/win32.c b/reactos/lib/psapi/misc/win32.c index 95605dc5270..8ceee15ab22 100644 --- a/reactos/lib/psapi/misc/win32.c +++ b/reactos/lib/psapi/misc/win32.c @@ -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); diff --git a/reactos/lib/rosrtl/thread/context.c b/reactos/lib/rosrtl/thread/context.c index 66b9d922b75..f2eb6d7ad8c 100644 --- a/reactos/lib/rosrtl/thread/context.c +++ b/reactos/lib/rosrtl/thread/context.c @@ -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 -#include +#define NTOS_MODE_USER +#include #if defined(_M_IX86) #include diff --git a/reactos/lib/rosrtl/thread/create.c b/reactos/lib/rosrtl/thread/create.c index b0a68dddecc..fce8696ff90 100644 --- a/reactos/lib/rosrtl/thread/create.c +++ b/reactos/lib/rosrtl/thread/create.c @@ -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 -#include -#include +#define NTOS_MODE_USER +#include #define NDEBUG #include diff --git a/reactos/lib/rosrtl/thread/stack.c b/reactos/lib/rosrtl/thread/stack.c index d0a7eb1729e..f1e1de648ad 100644 --- a/reactos/lib/rosrtl/thread/stack.c +++ b/reactos/lib/rosrtl/thread/stack.c @@ -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 -#include +#define NTOS_MODE_USER +#include #define NDEBUG #include diff --git a/reactos/ntoskrnl/include/internal/i386/ps.h b/reactos/ntoskrnl/include/internal/i386/ps.h index 85de865efde..d0487b4db30 100644 --- a/reactos/ntoskrnl/include/internal/i386/ps.h +++ b/reactos/ntoskrnl/include/internal/i386/ps.h @@ -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 diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index 69d54177691..4f7037d38cd 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -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 { diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index 3c4c29c41b4..a508456c88d 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -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, ¤t->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++;