From: Gisle V. <gv...@br...> - 2003-07-31 22:04:53
|
Isn't there anybody using MingW for device-drivers or low-level programming? I guess not, since <ddk/winddk.h> contains some errors; missing '()' around some macros and extra ';'. E.g. the BYTE_OFFSET() macro cannot be used as an argument because of the extra ';' at the end. I have come up with this patch: ---------------------------------------------------------------------- --- include/ddk/winddk.h.orig Thu Mar 27 00:25:40 2003 +++ include/ddk/winddk.h Thu Jul 31 22:45:56 2003 @@ -1152,8 +1152,8 @@ #define EISA_HAS_MEMORY_ENTRY 0x02 #define EISA_HAS_TYPE_ENTRY 0x01 #define EISA_HAS_INFORMATION \ - EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \ - + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY + (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \ + + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY) typedef struct _CM_EISA_SLOT_INFORMATION { UCHAR ReturnCode; @@ -3816,7 +3816,7 @@ * IN PVOID Value) */ #define InterlockedExchangePointer(Target, Value) \ - (PVOID) InterlockedExchange((PLONG) Target, (LONG) Value); + ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value)) /* * PVOID @@ -3826,7 +3826,7 @@ * IN PVOID Comparand) */ #define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \ - (PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand); + ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand)) #endif /* !__INTERLOCKED_DECLARED */ @@ -3858,7 +3858,7 @@ */ #define ARGUMENT_PRESENT(ArgumentPointer) \ - (BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL); + ((BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL)) /* * ULONG @@ -3866,7 +3866,7 @@ * IN PVOID Va) */ #define BYTE_OFFSET(Va) \ - (ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)); + ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1))) /* * ULONG @@ -3874,7 +3874,7 @@ * IN ULONG Size) */ #define BYTES_TO_PAGES(Size) \ - (ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0); + ((ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0)) /* * PCHAR @@ -3904,7 +3904,7 @@ * IN PVOID Va) */ #define PAGE_ALIGN(Va) \ - (PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)); + ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1))) /* * ULONG_PTR @@ -3912,7 +3912,7 @@ * IN ULONG_PTR Size) */ #define ROUND_TO_PAGES(Size) \ - (ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)); + (ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) NTOSAPI VOID @@ -4412,7 +4412,7 @@ */ #ifndef RtlFillMemory #define RtlFillMemory(Destination, Length, Fill) \ - memset(Destination, Fill, Length); + memset(Destination, Fill, Length) #endif #ifndef RtlFillBytes @@ -4974,7 +4974,7 @@ */ #ifndef RtlZeroMemory #define RtlZeroMemory(Destination, Length) \ - memset(Destination, 0, Length); + memset(Destination, 0, Length) #endif #ifndef RtlZeroBytes @@ -5268,7 +5268,7 @@ * IN PSLIST_HEADER SListHead) */ #define InitializeSListHead(_SListHead) \ - (_SListHead)->Alignment = 0; + (_SListHead)->Alignment = 0 #define ExInitializeSListHead InitializeSListHead @@ -5791,7 +5791,7 @@ */ #define IoAcquireRemoveLock(_RemoveLock, \ _Tag) \ - IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK)); + IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK)) /* * VOID @@ -6328,7 +6328,7 @@ * IN ULONG ControlCode) */ #define IoGetFunctionCodeFromCtlCode(_ControlCode) \ - (((_ControlCode) >> 2) & 0x00000FFF); + (((_ControlCode) >> 2) & 0x00000FFF) NTOSAPI PVOID @@ -6373,7 +6373,7 @@ _DpcRoutine) \ KeInitializeDpc(&(_DeviceObject)->Dpc, \ (PKDEFERRED_ROUTINE) (_DpcRoutine), \ - _DeviceObject); + _DeviceObject) NTOSAPI VOID @@ -6403,7 +6403,7 @@ #define IoInitializeRemoveLock( \ Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \ IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \ - HighWatermark, sizeof(IO_REMOVE_LOCK)); + HighWatermark, sizeof(IO_REMOVE_LOCK)) NTOSAPI NTSTATUS @@ -6619,7 +6619,7 @@ */ #define IoReleaseRemoveLockAndWait(_RemoveLock, \ _Tag) \ - IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK)); + IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK)) NTOSAPI VOID @@ -6715,7 +6715,7 @@ #define IoSetCancelRoutine(_Irp, \ _CancelRoutine) \ (PDRIVER_CANCEL) InterlockedExchangePointer( \ - (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine)); + (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine)) /* * VOID @@ -7821,7 +7821,7 @@ | MDL_SOURCE_IS_NONPAGED_POOL)) ? \ (_Mdl)->MappedSystemVa : \ (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \ - KernelMode, MmCached, NULL, FALSE, _Priority); + KernelMode, MmCached, NULL, FALSE, _Priority) NTOSAPI PVOID ---------------------------------------------------------------------- Gisle V. |