Author: tkreuzer Date: Mon Jan 9 21:55:56 2012 New Revision: 54891
URL: http://svn.reactos.org/svn/reactos?rev=54891&view=rev Log: [PSDK/DDK] - Add MAX_NATURAL_ALIGNMENT, MEMORY_ALLOCATION_ALIGNMENT and PROBE_ALIGNMENT defintions to ntdef.h - disable prefast warnings about banned api usage, dpc access and seh filter expression - annotate string types (PSTR, etc) as _Null_terminated_
Modified: trunk/reactos/include/crt/stdio.h trunk/reactos/include/ddk/ntstrsafe.h trunk/reactos/include/ddk/wdm.h trunk/reactos/include/psdk/ntdef.h trunk/reactos/include/xdk/iofuncs.h
Modified: trunk/reactos/include/crt/stdio.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/stdio.h?rev=548... ============================================================================== --- trunk/reactos/include/crt/stdio.h [iso-8859-1] (original) +++ trunk/reactos/include/crt/stdio.h [iso-8859-1] Mon Jan 9 21:55:56 2012 @@ -300,7 +300,17 @@ _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ _CRTIMP int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...); - __CRT_INLINE int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, va_list arg) { return _vsnwprintf(s,n,format,arg); } + __CRT_INLINE int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, va_list arg) + { +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:28719) /* disable banned api usage warning */ +#endif /* _MSC_VER */ + return _vsnwprintf(s,n,format,arg); +#ifdef _MSC_VER +#pragma warning(pop) +#endif /* _MSC_VER */ + } _CRTIMP int __cdecl vwscanf (const wchar_t *, va_list); _CRTIMP int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); _CRTIMP int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list);
Modified: trunk/reactos/include/ddk/ntstrsafe.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntstrsafe.h?rev... ============================================================================== --- trunk/reactos/include/ddk/ntstrsafe.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ntstrsafe.h [iso-8859-1] Mon Jan 9 21:55:56 2012 @@ -9,6 +9,11 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:28719) /* disable banned api usage warning */ +#endif /* _MSC_VER */
#ifndef C_ASSERT #ifdef _MSC_VER @@ -2062,4 +2067,11 @@ #define RtlStringLengthWorkerA RtlStringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA; #define RtlStringLengthWorkerW RtlStringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW;
-#endif +#ifdef _MSC_VER +#pragma warning(pop) +#ifdef _PREFAST_ +#pragma prefast(pop) +#endif /* _PREFAST_ */ +#endif /* _MSC_VER */ + +#endif /* _NTSTRSAFE_H_INCLUDED_ */
Modified: trunk/reactos/include/ddk/wdm.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=54891... ============================================================================== --- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Mon Jan 9 21:55:56 2012 @@ -13027,9 +13027,16 @@ IN PDEVICE_OBJECT DeviceObject, IN PIO_DPC_ROUTINE DpcRoutine) { +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:28128) +#endif KeInitializeThreadedDpc(&DeviceObject->Dpc, (PKDEFERRED_ROUTINE) DpcRoutine, DeviceObject ); +#ifdef _MSC_VER +#pragma warning(pop) +#endif } #endif
Modified: trunk/reactos/include/psdk/ntdef.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntdef.h?rev=54... ============================================================================== --- trunk/reactos/include/psdk/ntdef.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ntdef.h [iso-8859-1] Mon Jan 9 21:55:56 2012 @@ -26,6 +26,7 @@ #include <basetsd.h> #include <excpt.h> #include <sdkddkver.h> +#include <specstrings.h>
// FIXME: Shouldn't be included! #include <stdarg.h> @@ -167,12 +168,19 @@ #define UNALIGNED64 #endif
+#if defined(_WIN64) || defined(_M_ALPHA) +#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG) +#define MEMORY_ALLOCATION_ALIGNMENT 16 +#else +#define MAX_NATURAL_ALIGNMENT sizeof(ULONG) +#define MEMORY_ALLOCATION_ALIGNMENT 8 +#endif + #if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED) #define RESTRICTED_POINTER __restrict #else #define RESTRICTED_POINTER #endif -
#define ARGUMENT_PRESENT(ArgumentPointer) \ ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL) @@ -195,6 +203,14 @@ #define TYPE_ALIGNMENT(t) __alignof(t) #else #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test) +#endif + +#if defined(_AMD64_) || defined(_X86_) +#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(ULONG) +#elif defined(_IA64_) || defined(_ARM_) +#define PROBE_ALIGNMENT(_s) max((TYPE_ALIGNMENT(_s), TYPE_ALIGNMENT(ULONG)) +#else +#error "unknown architecture" #endif
/* Calling Conventions */ @@ -358,11 +374,11 @@ /* ANSI (Multi-byte Character) types */ typedef CHAR *PCHAR, *LPCH, *PCH; typedef CONST CHAR *LPCCH, *PCCH; -typedef CHAR *NPSTR, *LPSTR, *PSTR; -typedef PSTR *PZPSTR; -typedef CONST PSTR *PCZPSTR; -typedef CONST CHAR *LPCSTR, *PCSTR; -typedef PCSTR *PZPCSTR; +typedef _Null_terminated_ CHAR *NPSTR, *LPSTR, *PSTR; +typedef _Null_terminated_ PSTR *PZPSTR; +typedef _Null_terminated_ CONST PSTR *PCZPSTR; +typedef _Null_terminated_ CONST CHAR *LPCSTR, *PCSTR; +typedef _Null_terminated_ PCSTR *PZPCSTR;
/* Pointer to an Asciiz string */ typedef CHAR *PSZ; @@ -372,13 +388,13 @@ typedef wchar_t WCHAR; typedef WCHAR *PWCHAR, *LPWCH, *PWCH; typedef CONST WCHAR *LPCWCH, *PCWCH; -typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR; -typedef PWSTR *PZPWSTR; -typedef CONST PWSTR *PCZPWSTR; -typedef WCHAR UNALIGNED *LPUWSTR, *PUWSTR; -typedef CONST WCHAR *LPCWSTR, *PCWSTR; -typedef PCWSTR *PZPCWSTR; -typedef CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR; +typedef _Null_terminated_ WCHAR *NWPSTR, *LPWSTR, *PWSTR; +typedef _Null_terminated_ PWSTR *PZPWSTR; +typedef _Null_terminated_ CONST PWSTR *PCZPWSTR; +typedef _Null_terminated_ WCHAR UNALIGNED *LPUWSTR, *PUWSTR; +typedef _Null_terminated_ CONST WCHAR *LPCWSTR, *PCWSTR; +typedef _Null_terminated_ PCWSTR *PZPCWSTR; +typedef _Null_terminated_ CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
/* Cardinal Data Types */ typedef char CCHAR, *PCCHAR; @@ -488,8 +504,8 @@ USHORT Length; USHORT MaximumLength; ULONG Buffer; -} STRING32, *PSTRING32, - UNICODE_STRING32, *PUNICODE_STRING32, +} STRING32, *PSTRING32, + UNICODE_STRING32, *PUNICODE_STRING32, ANSI_STRING32, *PANSI_STRING32;
typedef struct _STRING64 { @@ -497,7 +513,7 @@ USHORT MaximumLength; ULONGLONG Buffer; } STRING64, *PSTRING64, - UNICODE_STRING64, *PUNICODE_STRING64, + UNICODE_STRING64, *PUNICODE_STRING64, ANSI_STRING64, *PANSI_STRING64;
/* LangID and NLS */
Modified: trunk/reactos/include/xdk/iofuncs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/iofuncs.h?rev=5... ============================================================================== --- trunk/reactos/include/xdk/iofuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/iofuncs.h [iso-8859-1] Mon Jan 9 21:55:56 2012 @@ -2658,10 +2658,17 @@ IN PDEVICE_OBJECT DeviceObject, IN PIO_DPC_ROUTINE DpcRoutine) { +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:28128) +#endif KeInitializeThreadedDpc(&DeviceObject->Dpc, (PKDEFERRED_ROUTINE) DpcRoutine, DeviceObject ); -} +#ifdef _MSC_VER +#pragma warning(pop) #endif +} +#endif
$endif (_WDMDDK_)