diff --git a/reactos/include/ddk/exfuncs.h b/reactos/include/ddk/exfuncs.h index 09bbef63975..3dda28ba517 100644 --- a/reactos/include/ddk/exfuncs.h +++ b/reactos/include/ddk/exfuncs.h @@ -205,7 +205,7 @@ ExGetExclusiveWaiterCount ( PERESOURCE Resource ); -ULONG +KPROCESSOR_MODE STDCALL ExGetPreviousMode ( VOID diff --git a/reactos/include/ddk/iotypes.h b/reactos/include/ddk/iotypes.h index 4978a5884ac..f8f4b05a8d5 100644 --- a/reactos/include/ddk/iotypes.h +++ b/reactos/include/ddk/iotypes.h @@ -1,4 +1,4 @@ -/* $Id: iotypes.h,v 1.60 2003/12/20 16:51:05 navaraf Exp $ +/* $Id: iotypes.h,v 1.61 2003/12/30 18:34:58 fireball Exp $ * */ @@ -1285,19 +1285,19 @@ typedef struct _DMA_OPERATIONS { struct _DEVICE_DESCRIPTION; -typedef BOOLEAN STDCALL (*PTRANSLATE_BUS_ADDRESS)( +typedef BOOLEAN STDCALL_FUNC (*PTRANSLATE_BUS_ADDRESS)( IN PVOID Context, IN PHYSICAL_ADDRESS BusAddress, IN ULONG Length, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress); -typedef PDMA_ADAPTER STDCALL (*PGET_DMA_ADAPTER)( +typedef PDMA_ADAPTER STDCALL_FUNC (*PGET_DMA_ADAPTER)( IN PVOID Context, IN struct _DEVICE_DESCRIPTION *DeviceDescriptor, OUT PULONG NumberOfMapRegisters); -typedef ULONG STDCALL (*PGET_SET_DEVICE_DATA)( +typedef ULONG STDCALL_FUNC (*PGET_SET_DEVICE_DATA)( IN PVOID Context, IN ULONG DataType, IN PVOID Buffer, diff --git a/reactos/include/ddk/ntbootvid.h b/reactos/include/ddk/ntbootvid.h index 2ea41cf62d5..1dd5aaac2fb 100644 --- a/reactos/include/ddk/ntbootvid.h +++ b/reactos/include/ddk/ntbootvid.h @@ -7,5 +7,5 @@ typedef struct { - BOOL STDCALL (*ResetDisplay)(VOID); + BOOL STDCALL_FUNC (*ResetDisplay)(VOID); } NTBOOTVID_FUNCTION_TABLE; diff --git a/reactos/include/napi/core.h b/reactos/include/napi/core.h index 8548bb01fe1..e2c20d83d3f 100644 --- a/reactos/include/napi/core.h +++ b/reactos/include/napi/core.h @@ -26,10 +26,10 @@ typedef struct _MM_CORE_DUMP_HEADER typedef struct MM_CORE_DUMP_FUNCTIONS { - NTSTATUS STDCALL (*DumpPrepare)(PDEVICE_OBJECT DeviceObject, PDUMP_POINTERS DumpPointers); - NTSTATUS STDCALL (*DumpInit)(VOID); - NTSTATUS STDCALL (*DumpWrite)(LARGE_INTEGER Address, PMDL Mdl); - NTSTATUS STDCALL (*DumpFinish)(VOID); + NTSTATUS STDCALL_FUNC (*DumpPrepare)(PDEVICE_OBJECT DeviceObject, PDUMP_POINTERS DumpPointers); + NTSTATUS STDCALL_FUNC (*DumpInit)(VOID); + NTSTATUS STDCALL_FUNC (*DumpWrite)(LARGE_INTEGER Address, PMDL Mdl); + NTSTATUS STDCALL_FUNC (*DumpFinish)(VOID); } MM_CORE_DUMP_FUNCTIONS, *PMM_CORE_DUMP_FUNCTIONS; #endif /* __INCLUDE_NAPI_CORE_H */ diff --git a/reactos/include/napi/teb.h b/reactos/include/napi/teb.h index 701de835972..7ea25db9c54 100644 --- a/reactos/include/napi/teb.h +++ b/reactos/include/napi/teb.h @@ -242,6 +242,7 @@ static inline struct _TEB * NtCurrentTeb(void) { struct _TEB * pTeb; +#if defined(__GNUC__) /* FIXME: instead of hardcoded offsets, use offsetof() - if possible */ __asm__ __volatile__ ( @@ -249,6 +250,12 @@ static inline struct _TEB * NtCurrentTeb(void) : "=r" (pTeb) /* can't have two memory operands */ : /* no inputs */ ); +#elif defined(_MSC_VER) + __asm mov eax, fs:0x18 + __asm mov pTeb, eax +#else +#error Unknown compiler for inline assembler +#endif return pTeb; } @@ -287,6 +294,8 @@ static inline struct _PEB * NtCurrentPeb(void) { struct _PEB * pPeb; +#if defined(__GNUC__) + __asm__ __volatile__ ( "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */ @@ -294,6 +303,15 @@ static inline struct _PEB * NtCurrentPeb(void) : /* no inputs */ ); +#elif defined(_MSC_VER) + + __asm mov eax, fs:0x30; + __asm mov pPeb, eax + +#else +#error Unknown compiler for inline assembler +#endif + return pPeb; } diff --git a/reactos/include/ntdll/ldr.h b/reactos/include/ntdll/ldr.h index a261878787f..42e2c24e827 100644 --- a/reactos/include/ntdll/ldr.h +++ b/reactos/include/ntdll/ldr.h @@ -5,10 +5,10 @@ #include #include -typedef NTSTATUS STDCALL (*PEPFUNC)(PPEB); +typedef NTSTATUS STDCALL_FUNC (*PEPFUNC)(PPEB); /* Type for a DLL's entry point */ -typedef BOOL STDCALL +typedef BOOL STDCALL_FUNC (* PDLLMAIN_FUNC)(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved); diff --git a/reactos/include/ntdll/ntdll.h b/reactos/include/ntdll/ntdll.h index 6c96a332948..3b69a4687b1 100644 --- a/reactos/include/ntdll/ntdll.h +++ b/reactos/include/ntdll/ntdll.h @@ -14,15 +14,23 @@ #endif #ifdef NDEBUG +#if defined(__GNUC__) #define DPRINT(args...) +#else +#define DPRINT +#endif /* __GNUC__ */ #define CHECKPOINT #else -#define DPRINT(args...) do { DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0); -#define CHECKPOINT do { DbgPrint("(NTDLL:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0); +#define DPRINT(args...) do { DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0) +#define CHECKPOINT do { DbgPrint("(NTDLL:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0) #endif -#define DPRINT1(args...) do { DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0); -#define CHECKPOINT1 do { DbgPrint("(NTDLL:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0); +#if defined(__GNUC__) +#define DPRINT1(args...) do { DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0) +#else +#define DPRINT1 DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint +#endif +#define CHECKPOINT1 do { DbgPrint("(NTDLL:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0) #define ROUNDUP(a,b) ((((a)+(b)-1)/(b))*(b)) #define ROUNDDOWN(a,b) (((a)/(b))*(b)) diff --git a/reactos/include/ntos/haltypes.h b/reactos/include/ntos/haltypes.h index 5cca9fd71fb..e467fd08653 100755 --- a/reactos/include/ntos/haltypes.h +++ b/reactos/include/ntos/haltypes.h @@ -1,4 +1,4 @@ -/* $Id: haltypes.h,v 1.4 2003/10/20 06:03:29 vizzini Exp $ +/* $Id: haltypes.h,v 1.5 2003/12/30 18:34:58 fireball Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -14,9 +14,11 @@ #define __INCLUDE_NTOS_HALTYPES_H #ifdef __GNUC__ -#define STDCALL_FUNC STDCALL +#define STDCALL_FUNC STDCALL +#define FASTCALL_FUNC FASTCALL #else -#define STDCALL_FUNC(a) (__stdcall a ) +#define STDCALL_FUNC(a) (__stdcall a ) +#define FASTCALL_FUNC(a) (__fastcall a ) #endif /*__GNUC__*/ #include "types.h" @@ -393,42 +395,42 @@ typedef NTSTATUS STDCALL_FUNC IN PVOID Context, IN PDEVICE_CONTROL_COMPLETION CompletionRoutine); -typedef VOID FASTCALL +typedef VOID FASTCALL_FUNC (*pHalExamineMBR)(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG MBRTypeIdentifier, OUT PVOID *Buffer); -typedef VOID FASTCALL +typedef VOID FASTCALL_FUNC (*pHalIoAssignDriveLetters)(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PSTRING NtDeviceName, OUT PUCHAR NtSystemPath, OUT PSTRING NtSystemPathString); -typedef NTSTATUS FASTCALL +typedef NTSTATUS FASTCALL_FUNC (*pHalIoReadPartitionTable)(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN BOOLEAN ReturnRecognizedPartitions, OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer); -typedef NTSTATUS FASTCALL +typedef NTSTATUS FASTCALL_FUNC (*pHalIoSetPartitionInformation)(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG PartitionNumber, IN ULONG PartitionType); -typedef NTSTATUS FASTCALL +typedef NTSTATUS FASTCALL_FUNC (*pHalIoWritePartitionTable)(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG SectorsPerTrack, IN ULONG NumberOfHeads, IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer); -typedef PBUS_HANDLER FASTCALL +typedef PBUS_HANDLER FASTCALL_FUNC (*pHalHandlerForBus)(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber); -typedef VOID FASTCALL +typedef VOID FASTCALL_FUNC (*pHalReferenceBusHandler)(IN PBUS_HANDLER BusHandler); diff --git a/reactos/include/ntos/kdfuncs.h b/reactos/include/ntos/kdfuncs.h index 77022494c1f..7315621da7a 100755 --- a/reactos/include/ntos/kdfuncs.h +++ b/reactos/include/ntos/kdfuncs.h @@ -1,9 +1,11 @@ #ifndef __INCLUDE_DDK_KDFUNCS_H #define __INCLUDE_DDK_KDFUNCS_H -/* $Id: kdfuncs.h,v 1.1 2003/06/07 10:14:39 chorns Exp $ */ +/* $Id: kdfuncs.h,v 1.2 2003/12/30 18:34:58 fireball Exp $ */ #ifndef __USE_W32API +#ifdef __GNUC__ + #if defined(__NTOSKRNL__) extern BOOLEAN KdDebuggerEnabled __declspec(dllexport); extern BOOLEAN KdDebuggerNotPresent __declspec(dllexport); @@ -12,6 +14,19 @@ extern BOOLEAN KdDebuggerEnabled __declspec(dllimport); extern BOOLEAN KdDebuggerNotPresent __declspec(dllimport); #endif +#else /* __GNUC__ */ +/* Microsft-style */ + +#if defined(__NTOSKRNL__) +extern __declspec(dllexport) BOOLEAN KdDebuggerEnabled; +extern __declspec(dllexport) BOOLEAN KdDebuggerNotPresent; +#else +extern __declspec(dllimport) BOOLEAN KdDebuggerEnabled; +extern __declspec(dllimport) BOOLEAN KdDebuggerNotPresent; +#endif + +#endif /* __GNUC__ */ + #endif /* __USE_W32API */ BYTE diff --git a/reactos/include/ntos/ps.h b/reactos/include/ntos/ps.h index b83dea40991..da7ddd4eeb7 100644 --- a/reactos/include/ntos/ps.h +++ b/reactos/include/ntos/ps.h @@ -84,10 +84,17 @@ #endif /* !__USE_W32API */ #ifdef __NTOSKRNL__ +#ifdef __GNUC__ extern struct _EPROCESS* EXPORTED PsInitialSystemProcess; -extern POBJECT_TYPE EXPORTED PsProcessType; -extern POBJECT_TYPE EXPORTED PsThreadType; -#else +extern POBJECT_TYPE EXPORTED PsProcessType; +extern POBJECT_TYPE EXPORTED PsThreadType; +#else /* __GNUC__ */ +/* Microsft-style */ +extern EXPORTED struct _EPROCESS* PsInitialSystemProcess; +extern EXPORTED POBJECT_TYPE PsProcessType; +extern EXPORTED POBJECT_TYPE PsThreadType; +#endif /* __GNUC__ */ +#else /* __NTOSKRNL__ */ #ifdef __GNUC__ // robd extern struct _EPROCESS* IMPORTED PsInitialSystemProcess; extern POBJECT_TYPE IMPORTED PsProcessType; diff --git a/reactos/include/ntos/service.h b/reactos/include/ntos/service.h index 0be2457f5bc..1e07fcc77ed 100755 --- a/reactos/include/ntos/service.h +++ b/reactos/include/ntos/service.h @@ -36,14 +36,30 @@ typedef struct t_KeServiceDescriptorTableEntry { /* --- NTOSKRNL.EXE --- */ #if defined(__NTOSKRNL__) +#ifdef __GNUC__ extern SSDT_ENTRY KeServiceDescriptorTable[SSDT_MAX_ENTRIES] __declspec(dllexport); -#else +#else /* __GNUC__ */ +/* Microsft-style */ +extern +__declspec(dllexport) +SSDT_ENTRY +KeServiceDescriptorTable[SSDT_MAX_ENTRIES]; +#endif /* __GNUC__ */ +#else /* __NTOSKRNL__ */ +#ifdef __GNUC__ extern SSDT_ENTRY KeServiceDescriptorTable[SSDT_MAX_ENTRIES] __declspec(dllimport); -#endif +#else /* __GNUC__ */ +/* Microsft-style */ +extern +__declspec(dllimport) +SSDT_ENTRY +KeServiceDescriptorTable[SSDT_MAX_ENTRIES]; +#endif /* __GNUC__ */ +#endif /* __NTOSKRNL__ */ extern SSDT_ENTRY diff --git a/reactos/include/ntos/types.h b/reactos/include/ntos/types.h index 58e7a381bfd..8252905729e 100644 --- a/reactos/include/ntos/types.h +++ b/reactos/include/ntos/types.h @@ -51,7 +51,7 @@ typedef short SHORT; #define STDCALL __stdcall #define CDECL __cdecl #endif -#define CALLBACK WINAPI +#define CALLBACK STDCALL_FUNC #define PASCAL WINAPI #else @@ -138,42 +138,41 @@ typedef USHORT CSHORT; typedef const wchar_t *PCWSTR; typedef char* PCSZ; -#ifdef __GNUC__ -typedef DWORD STDCALL (*PTHREAD_START_ROUTINE) (LPVOID); -#else -typedef DWORD (STDCALL *PTHREAD_START_ROUTINE) (LPVOID); -#endif /*__GNUC__*/ +typedef DWORD STDCALL_FUNC (*PTHREAD_START_ROUTINE) (LPVOID); + typedef union _LARGE_INTEGER { - struct - { - DWORD LowPart; - LONG HighPart; - } u; #ifdef ANONYMOUSUNIONS struct { DWORD LowPart; LONG HighPart; }; +#else + struct + { + DWORD LowPart; + LONG HighPart; + } u; #endif /* ANONYMOUSUNIONS */ LONGLONG QuadPart; } LARGE_INTEGER, *PLARGE_INTEGER; typedef union _ULARGE_INTEGER { - struct - { - DWORD LowPart; - DWORD HighPart; - } u; #ifdef ANONYMOUSUNIONS struct { DWORD LowPart; DWORD HighPart; }; +#else + struct + { + DWORD LowPart; + DWORD HighPart; + } u; #endif /* ANONYMOUSUNIONS */ ULONGLONG QuadPart; } ULARGE_INTEGER, *PULARGE_INTEGER; @@ -460,21 +459,12 @@ typedef struct _SMALL_RECT } SMALL_RECT, *PSMALL_RECT; -#ifdef __GNUC__ -typedef VOID STDCALL +typedef VOID STDCALL_FUNC (*PTIMERAPCROUTINE)( LPVOID lpArgToCompletionRoutine, DWORD dwTimerLowValue, DWORD dwTimerHighValue ); -#else -typedef VOID -(STDCALL *PTIMERAPCROUTINE)( - LPVOID lpArgToCompletionRoutine, - DWORD dwTimerLowValue, - DWORD dwTimerHighValue - ); -#endif /*__GNUC__*/ #include "except.h" diff --git a/reactos/include/ntos/zwtypes.h b/reactos/include/ntos/zwtypes.h index 4c88efec489..91ba6faeb89 100755 --- a/reactos/include/ntos/zwtypes.h +++ b/reactos/include/ntos/zwtypes.h @@ -1124,15 +1124,22 @@ typedef struct _IO_COMPLETION_BASIC_INFORMATION { #ifndef NtCurrentThread #define NtCurrentThread() ( (HANDLE) 0xFFFFFFFE ) #endif /* NtCurrentThread */ -#if 1 -extern ULONG NtBuildNumber; -#else + +#ifdef __GNUC__ #ifdef __NTOSKRNL__ -extern ULONG NtBuildNumber; +extern ULONG EXPORTED NtBuildNumber; #else -extern ULONG NtBuildNumber; +extern ULONG IMPORTED NtBuildNumber; #endif +#else +/* Microsoft-style declarations */ +#ifdef __NTOSKRNL__ +extern EXPORTED ULONG NtBuildNumber; +#else +extern IMPORTED ULONG NtBuildNumber; #endif +#endif /* __GNUC__ */ + // event access mask