From ac35e87724c6aef8f779017d0bba14fca1fb50e0 Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Sun, 16 Aug 2009 20:08:48 +0000 Subject: [PATCH] - Revert 32309 -- instead of removing FORCEINLINE to make GCC happy (it can't inline functions using va_list), use __inline to merely hint that the function should be inlined. This lets you use RtlStringCbPrintfA and RtlStringCbPrintfExA in multiple source files as the functions aren't static. - Moreover, there is no reason to forceinline all the RtlString* routines -- they are quite big and the compiler should be allowed to optimize here as it likes, so just use __inline. Also add RtlStringCchCopyA and re-enable ASSERTMSG and use it for the stubs. - Add missing GUID_CLASS_COMPORT and GUID_SERENUM_BUS_ENUMERATOR to ntddser.h - Add driverspecs.h to stub out Driver Verifier annotations - The WDK serenum source sample now compiles with our header set. svn path=/trunk/; revision=42744 --- reactos/include/ddk/driverspecs.h | 29 ++++++++++++++++++ reactos/include/ddk/ntddser.h | 4 +++ reactos/include/ddk/ntstrsafe.h | 49 ++++++++++++++++++------------- reactos/ntoskrnl/mm/sysldr.c | 1 + 4 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 reactos/include/ddk/driverspecs.h diff --git a/reactos/include/ddk/driverspecs.h b/reactos/include/ddk/driverspecs.h new file mode 100644 index 00000000000..abbf042ac41 --- /dev/null +++ b/reactos/include/ddk/driverspecs.h @@ -0,0 +1,29 @@ +/* + * PROJECT: ReactOS DDK + * COPYRIGHT: This file is in the Public Domain. + * FILE: driverspecs.h + * ABSTRACT: This header stubs out Driver Verifier annotations to + * allow drivers using them to compile with our header set. + */ + +// +// Stubs +// +#define __drv_dispatchType(x) +#define __drv_dispatchType_other + +// +// FIXME: These annotations are not driver-only and does not belong here +// +#define __in +#define __in_bcount(Size) +#define __in_ecount(Size) + +#define __out +#define __out_bcount(Size) +#define __out_bcount_part(Size, Length) +#define __out_ecount(Size) + +#define __inout + +#define __deref_out_ecount(Size) \ No newline at end of file diff --git a/reactos/include/ddk/ntddser.h b/reactos/include/ddk/ntddser.h index 39493ed33ea..c83147341f7 100644 --- a/reactos/include/ddk/ntddser.h +++ b/reactos/include/ddk/ntddser.h @@ -32,9 +32,13 @@ extern "C" { DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73); +#define GUID_CLASS_COMPORT GUID_DEVINTERFACE_COMPORT + DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18); +#define GUID_SERENUM_BUS_ENUMERATOR GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR + #define IOCTL_SERIAL_CLEAR_STATS \ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 36, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_SERIAL_CLR_DTR \ diff --git a/reactos/include/ddk/ntstrsafe.h b/reactos/include/ddk/ntstrsafe.h index 8bb4d141235..e7a2653a020 100644 --- a/reactos/include/ddk/ntstrsafe.h +++ b/reactos/include/ddk/ntstrsafe.h @@ -31,13 +31,9 @@ // typedef unsigned long DWORD; -#ifndef UNIMPLEMENTED -#define UNIMPLEMENTED DbgPrint("WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__); -#endif - /* PRIVATE FUNCTIONS *********************************************************/ -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringLengthWorkerA(IN PCHAR String, @@ -70,7 +66,7 @@ RtlStringLengthWorkerA(IN PCHAR String, return Status; } -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringValidateDestA(IN PCHAR Destination, @@ -99,7 +95,7 @@ RtlStringValidateDestA(IN PCHAR Destination, return Status; } -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringExValidateDestA(IN OUT PCHAR *Destination, @@ -108,14 +104,14 @@ RtlStringExValidateDestA(IN OUT PCHAR *Destination, IN SIZE_T MaxLength, IN DWORD Flags) { - //ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); + ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); return RtlStringValidateDestA(*Destination, *DestinationLength, ReturnLength, MaxLength); } -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringExValidateSrcA(IN OUT PCCHAR *Source OPTIONAL, @@ -124,7 +120,7 @@ RtlStringExValidateSrcA(IN OUT PCCHAR *Source OPTIONAL, IN DWORD Flags) { NTSTATUS Status = STATUS_SUCCESS; - //ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); + ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); if ((ReturnLength) && (*ReturnLength >= MaxLength)) { @@ -134,7 +130,7 @@ RtlStringExValidateSrcA(IN OUT PCCHAR *Source OPTIONAL, return Status; } -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringVPrintfWorkerA(OUT PCHAR Destination, @@ -175,7 +171,7 @@ RtlStringVPrintfWorkerA(OUT PCHAR Destination, return Status; } -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringCopyWorkerA(OUT PCHAR Destination, @@ -212,6 +208,18 @@ RtlStringCopyWorkerA(OUT PCHAR Destination, /* PUBLIC FUNCTIONS **********************************************************/ +__inline +NTSTATUS +NTAPI +RtlStringCchCopyA(IN PCHAR Destination, + IN SIZE_T cchDest, + IN PCCHAR pszSrc) +{ + ASSERTMSG("RtlStringCchCopyA is UNIMPLEMENTED!\n", FALSE); + return STATUS_NOT_IMPLEMENTED; +} + +__inline NTSTATUS NTAPI RtlStringCbPrintfA(OUT PCHAR Destination, @@ -241,6 +249,7 @@ RtlStringCbPrintfA(OUT PCHAR Destination, return Status; } +__inline NTSTATUS NTAPI RtlStringCbPrintfExA(OUT PCHAR Destination, @@ -255,7 +264,7 @@ RtlStringCbPrintfExA(OUT PCHAR Destination, SIZE_T CharLength = Length / sizeof(CHAR), Remaining, LocalNewLength = 0; PCHAR LocalDestinationEnd; va_list argList; - //ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); + ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); Status = RtlStringExValidateDestA(&Destination, &CharLength, @@ -321,7 +330,7 @@ RtlStringCbPrintfExA(OUT PCHAR Destination, return Status; } -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringCbCopyExA(OUT PCHAR Destination, @@ -334,7 +343,7 @@ RtlStringCbCopyExA(OUT PCHAR Destination, NTSTATUS Status; SIZE_T CharLength = Length / sizeof(CHAR), Copied = 0, Remaining; PCHAR LocalDestinationEnd; - //ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); + ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); Status = RtlStringExValidateDestA(&Destination, &Length, @@ -398,7 +407,7 @@ RtlStringCbCopyExA(OUT PCHAR Destination, return Status; } - +__inline NTSTATUS NTAPI RtlStringCbPrintfW( @@ -407,11 +416,11 @@ RtlStringCbPrintfW( IN LPCWSTR pszFormat, ...) { - UNIMPLEMENTED + ASSERTMSG("RtlStringCbPrintfW is UNIMPLEMENTED!\n", FALSE); return STATUS_NOT_IMPLEMENTED; } -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringCbCatExA(IN OUT PCHAR Destination, @@ -425,7 +434,7 @@ RtlStringCbCatExA(IN OUT PCHAR Destination, SIZE_T CharLength = Length / sizeof(CHAR); SIZE_T DestinationLength, Remaining, Copied = 0; PCHAR LocalDestinationEnd; - //ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); + ASSERTMSG("We don't support Extended Flags yet!\n", Flags == 0); Status = RtlStringExValidateDestA(&Destination, &CharLength, @@ -485,7 +494,7 @@ RtlStringCbCatExA(IN OUT PCHAR Destination, return Status; } -FORCEINLINE +__inline NTSTATUS NTAPI RtlStringCbCopyA(OUT PCHAR Destination, diff --git a/reactos/ntoskrnl/mm/sysldr.c b/reactos/ntoskrnl/mm/sysldr.c index 4649b6e56bf..04a37b1ec9b 100644 --- a/reactos/ntoskrnl/mm/sysldr.c +++ b/reactos/ntoskrnl/mm/sysldr.c @@ -13,6 +13,7 @@ #include /* GCC's incompetence strikes again */ +__inline VOID sprintf_nt(IN PCHAR Buffer, IN PCHAR Format, -- 2.17.1