From 0e5a4d5afe38aeae6145c2ddcef766baf66863a2 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 24 Oct 2020 14:18:09 +0200 Subject: [PATCH] [PSDK] Import some SAL headers from MS Taken from https://github.com/microsoft/ChakraCore/tree/master/pal/inc/rt * Move _Check_return_opt_ and _Check_return_wat_ to crtdefs.h * Update sal.h from https://github.com/microsoft/ChakraCore/blob/master/pal/inc/rt/sal.h * Import no_sal2.h from MS and remove the one in NDK * Import specstrings.h from MS * Import specstrings_strict.h from MS * Add specstrings_undef.h (based on defines in specstrings_strict.h) * Remove __REACTOS__ hacks from cdfs --- drivers/filesystems/cdfs/cdstruc.h | 6 - sdk/include/crt/crtdefs.h | 12 + sdk/include/ndk/no_sal2.h | 707 --------------- sdk/include/psdk/no_sal2.h | 544 +++++++++++ sdk/include/psdk/sal.h | 13 +- sdk/include/psdk/specstrings.h | 580 ++++++++++-- sdk/include/psdk/specstrings_strict.h | 1198 +++++++++++++++++++++++++ sdk/include/psdk/specstrings_undef.h | 491 ++++++++++ 8 files changed, 2771 insertions(+), 780 deletions(-) delete mode 100644 sdk/include/ndk/no_sal2.h create mode 100644 sdk/include/psdk/no_sal2.h create mode 100644 sdk/include/psdk/specstrings_strict.h create mode 100644 sdk/include/psdk/specstrings_undef.h diff --git a/drivers/filesystems/cdfs/cdstruc.h b/drivers/filesystems/cdfs/cdstruc.h index 270cf9cf596..78143456d37 100644 --- a/drivers/filesystems/cdfs/cdstruc.h +++ b/drivers/filesystems/cdfs/cdstruc.h @@ -170,12 +170,6 @@ typedef PVOID PBCB; //**** Bcb's are now part of the cache module #define BYTE_COUNT_EMBEDDED_NAME (32) -#ifdef __REACTOS__ -#define __volatile volatile -#define _Unreferenced_parameter_ -#define __field_range(a,b) -#define __analysis_assert(x) -#endif // // The CD_MCB is used to store the mapping of logical file offset to diff --git a/sdk/include/crt/crtdefs.h b/sdk/include/crt/crtdefs.h index 7a2d728638f..0162e7a46de 100644 --- a/sdk/include/crt/crtdefs.h +++ b/sdk/include/crt/crtdefs.h @@ -426,6 +426,18 @@ typedef struct localeinfo_struct { } #endif +#if defined(_PREFAST_) && defined(_PFT_SHOULD_CHECK_RETURN) +#define _Check_return_opt_ _Check_return_ +#else +#define _Check_return_opt_ +#endif + +#if defined(_PREFAST_) && defined(_PFT_SHOULD_CHECK_RETURN_WAT) +#define _Check_return_wat_ _Check_return_ +#else +#define _Check_return_wat_ +#endif + #pragma pack(pop) #endif /* !_INC_CRTDEFS */ diff --git a/sdk/include/ndk/no_sal2.h b/sdk/include/ndk/no_sal2.h deleted file mode 100644 index f106e1b3231..00000000000 --- a/sdk/include/ndk/no_sal2.h +++ /dev/null @@ -1,707 +0,0 @@ - -#pragma once - -#define _NO_SAL_2_H_ - -/* From sal.h */ -#define _Always_(annos) -#define _Analysis_mode_(mode) -#define _Analysis_noreturn_ -#define _Analysis_assume_(expr) __analysis_assume(expr) -#define _At_(target, annos) -#define _At_buffer_(target, iter, bound, annos) -#define _Check_return_ -#define _COM_Outptr_ -#define _COM_Outptr_opt_ -#define _COM_Outptr_opt_result_maybenull_ -#define _COM_Outptr_result_maybenull_ -#define _Const_ -#define _Deref_in_bound_ -#define _Deref_in_range_(lb,ub) -#define _Deref_inout_bound_ -#define _Deref_inout_z_ -#define _Deref_inout_z_bytecap_c_(size) -#define _Deref_inout_z_cap_c_(size) -#define _Deref_opt_out_ -#define _Deref_opt_out_opt_ -#define _Deref_opt_out_opt_z_ -#define _Deref_opt_out_z_ -#define _Deref_out_ -#define _Deref_out_bound_ -#define _Deref_out_opt_ -#define _Deref_out_opt_z_ -#define _Deref_out_range_(lb,ub) -#define _Deref_out_z_ -#define _Deref_out_z_bytecap_c_(size) -#define _Deref_out_z_cap_c_(size) -#define _Deref_post_bytecap_(size) -#define _Deref_post_bytecap_c_(size) -#define _Deref_post_bytecap_x_(size) -#define _Deref_post_bytecount_(size) -#define _Deref_post_bytecount_c_(size) -#define _Deref_post_bytecount_x_(size) -#define _Deref_post_cap_(size) -#define _Deref_post_cap_c_(size) -#define _Deref_post_cap_x_(size) -#define _Deref_post_count_(size) -#define _Deref_post_count_c_(size) -#define _Deref_post_count_x_(size) -#define _Deref_post_maybenull_ -#define _Deref_post_notnull_ -#define _Deref_post_null_ -#define _Deref_post_opt_bytecap_(size) -#define _Deref_post_opt_bytecap_c_(size) -#define _Deref_post_opt_bytecap_x_(size) -#define _Deref_post_opt_bytecount_(size) -#define _Deref_post_opt_bytecount_c_(size) -#define _Deref_post_opt_bytecount_x_(size) -#define _Deref_post_opt_cap_(size) -#define _Deref_post_opt_cap_c_(size) -#define _Deref_post_opt_cap_x_(size) -#define _Deref_post_opt_count_(size) -#define _Deref_post_opt_count_c_(size) -#define _Deref_post_opt_count_x_(size) -#define _Deref_post_opt_valid_ -#define _Deref_post_opt_valid_bytecap_(size) -#define _Deref_post_opt_valid_bytecap_c_(size) -#define _Deref_post_opt_valid_bytecap_x_(size) -#define _Deref_post_opt_valid_cap_(size) -#define _Deref_post_opt_valid_cap_c_(size) -#define _Deref_post_opt_valid_cap_x_(size) -#define _Deref_post_opt_z_ -#define _Deref_post_opt_z_bytecap_(size) -#define _Deref_post_opt_z_bytecap_c_(size) -#define _Deref_post_opt_z_bytecap_x_(size) -#define _Deref_post_opt_z_cap_(size) -#define _Deref_post_opt_z_cap_c_(size) -#define _Deref_post_opt_z_cap_x_(size) -#define _Deref_post_valid_ -#define _Deref_post_valid_bytecap_(size) -#define _Deref_post_valid_bytecap_c_(size) -#define _Deref_post_valid_bytecap_x_(size) -#define _Deref_post_valid_cap_(size) -#define _Deref_post_valid_cap_c_(size) -#define _Deref_post_valid_cap_x_(size) -#define _Deref_post_z_ -#define _Deref_post_z_bytecap_(size) -#define _Deref_post_z_bytecap_c_(size) -#define _Deref_post_z_bytecap_x_(size) -#define _Deref_post_z_cap_(size) -#define _Deref_post_z_cap_c_(size) -#define _Deref_post_z_cap_x_(size) -#define _Deref_pre_bytecap_(size) -#define _Deref_pre_bytecap_c_(size) -#define _Deref_pre_bytecap_x_(size) -#define _Deref_pre_bytecount_(size) -#define _Deref_pre_bytecount_c_(size) -#define _Deref_pre_bytecount_x_(size) -#define _Deref_pre_cap_(size) -#define _Deref_pre_cap_c_(size) -#define _Deref_pre_cap_x_(size) -#define _Deref_pre_count_(size) -#define _Deref_pre_count_c_(size) -#define _Deref_pre_count_x_(size) -#define _Deref_pre_invalid_ -#define _Deref_pre_maybenull_ -#define _Deref_pre_notnull_ -#define _Deref_pre_null_ -#define _Deref_pre_opt_bytecap_(size) -#define _Deref_pre_opt_bytecap_c_(size) -#define _Deref_pre_opt_bytecap_x_(size) -#define _Deref_pre_opt_bytecount_(size) -#define _Deref_pre_opt_bytecount_c_(size) -#define _Deref_pre_opt_bytecount_x_(size) -#define _Deref_pre_opt_cap_(size) -#define _Deref_pre_opt_cap_c_(size) -#define _Deref_pre_opt_cap_x_(size) -#define _Deref_pre_opt_count_(size) -#define _Deref_pre_opt_count_c_(size) -#define _Deref_pre_opt_count_x_(size) -#define _Deref_pre_opt_valid_ -#define _Deref_pre_opt_valid_bytecap_(size) -#define _Deref_pre_opt_valid_bytecap_c_(size) -#define _Deref_pre_opt_valid_bytecap_x_(size) -#define _Deref_pre_opt_valid_cap_(size) -#define _Deref_pre_opt_valid_cap_c_(size) -#define _Deref_pre_opt_valid_cap_x_(size) -#define _Deref_pre_opt_z_ -#define _Deref_pre_opt_z_bytecap_(size) -#define _Deref_pre_opt_z_bytecap_c_(size) -#define _Deref_pre_opt_z_bytecap_x_(size) -#define _Deref_pre_opt_z_cap_(size) -#define _Deref_pre_opt_z_cap_c_(size) -#define _Deref_pre_opt_z_cap_x_(size) -#define _Deref_pre_readonly_ -#define _Deref_pre_valid_ -#define _Deref_pre_valid_bytecap_(size) -#define _Deref_pre_valid_bytecap_c_(size) -#define _Deref_pre_valid_bytecap_x_(size) -#define _Deref_pre_valid_cap_(size) -#define _Deref_pre_valid_cap_c_(size) -#define _Deref_pre_valid_cap_x_(size) -#define _Deref_pre_writeonly_ -#define _Deref_pre_z_ -#define _Deref_pre_z_bytecap_(size) -#define _Deref_pre_z_bytecap_c_(size) -#define _Deref_pre_z_bytecap_x_(size) -#define _Deref_pre_z_cap_(size) -#define _Deref_pre_z_cap_c_(size) -#define _Deref_pre_z_cap_x_(size) -#define _Deref_prepost_bytecap_(size) -#define _Deref_prepost_bytecap_x_(size) -#define _Deref_prepost_bytecount_(size) -#define _Deref_prepost_bytecount_x_(size) -#define _Deref_prepost_cap_(size) -#define _Deref_prepost_cap_x_(size) -#define _Deref_prepost_count_(size) -#define _Deref_prepost_count_x_(size) -#define _Deref_prepost_opt_bytecap_(size) -#define _Deref_prepost_opt_bytecap_x_(size) -#define _Deref_prepost_opt_bytecount_(size) -#define _Deref_prepost_opt_bytecount_x_(size) -#define _Deref_prepost_opt_cap_(size) -#define _Deref_prepost_opt_cap_x_(size) -#define _Deref_prepost_opt_count_(size) -#define _Deref_prepost_opt_count_x_(size) -#define _Deref_prepost_opt_valid_ -#define _Deref_prepost_opt_valid_bytecap_(size) -#define _Deref_prepost_opt_valid_bytecap_x_(size) -#define _Deref_prepost_opt_valid_cap_(size) -#define _Deref_prepost_opt_valid_cap_x_(size) -#define _Deref_prepost_opt_z_ -#define _Deref_prepost_opt_z_bytecap_(size) -#define _Deref_prepost_opt_z_cap_(size) -#define _Deref_prepost_valid_ -#define _Deref_prepost_valid_bytecap_(size) -#define _Deref_prepost_valid_bytecap_x_(size) -#define _Deref_prepost_valid_cap_(size) -#define _Deref_prepost_valid_cap_x_(size) -#define _Deref_prepost_z_ -#define _Deref_prepost_z_bytecap_(size) -#define _Deref_prepost_z_cap_(size) -#define _Deref_ret_bound_ -#define _Deref_ret_opt_z_ -#define _Deref_ret_range_(lb,ub) -#define _Deref_ret_z_ -#define _Deref2_pre_readonly_ -#define _Enum_is_bitflag_ -#define _Field_range_(min,max) -#define _Field_size_(size) -#define _Field_size_bytes_(size) -#define _Field_size_bytes_full_(size) -#define _Field_size_bytes_full_opt_(size) -#define _Field_size_bytes_opt_(size) -#define _Field_size_bytes_part_(size, count) -#define _Field_size_bytes_part_opt_(size, count) -#define _Field_size_full_(size) -#define _Field_size_full_opt_(size) -#define _Field_size_opt_(size) -#define _Field_size_part_(size, count) -#define _Field_size_part_opt_(size, count) -#define _Field_z_ -#define _Function_class_(x) -#define _Group_(annos) -#define _In_ -#define _In_bound_ -#define _In_bytecount_(size) -#define _In_bytecount_c_(size) -#define _In_bytecount_x_(size) -#define _In_count_(size) -#define _In_count_c_(size) -#define _In_count_x_(size) -#define _In_defensive_(annotes) -#define _In_opt_ -#define _In_opt_bytecount_(size) -#define _In_opt_bytecount_c_(size) -#define _In_opt_bytecount_x_(size) -#define _In_opt_count_(size) -#define _In_opt_count_c_(size) -#define _In_opt_count_x_(size) -#define _In_opt_ptrdiff_count_(size) -#define _In_opt_z_ -#define _In_opt_z_bytecount_(size) -#define _In_opt_z_bytecount_c_(size) -#define _In_opt_z_count_(size) -#define _In_opt_z_count_c_(size) -#define _In_ptrdiff_count_(size) -#define _In_range_(lb,ub) -#define _In_reads_(size) -#define _In_reads_bytes_(size) -#define _In_reads_bytes_opt_(size) -#define _In_reads_opt_(size) -#define _In_reads_opt_z_(size) -#define _In_reads_or_z_(size) -#define _In_reads_to_ptr_(ptr) -#define _In_reads_to_ptr_opt_(ptr) -#define _In_reads_to_ptr_opt_z_(ptr) -#define _In_reads_to_ptr_z_(ptr) -#define _In_reads_z_(size) -#define _In_z_ -#define _In_z_bytecount_(size) -#define _In_z_bytecount_c_(size) -#define _In_z_count_(size) -#define _In_z_count_c_(size) -#define _Inout_ -#define _Inout_bytecap_(size) -#define _Inout_bytecap_c_(size) -#define _Inout_bytecap_x_(size) -#define _Inout_bytecount_(size) -#define _Inout_bytecount_c_(size) -#define _Inout_bytecount_x_(size) -#define _Inout_cap_(size) -#define _Inout_cap_c_(size) -#define _Inout_cap_x_(size) -#define _Inout_count_(size) -#define _Inout_count_c_(size) -#define _Inout_count_x_(size) -#define _Inout_defensive_(annotes) -#define _Inout_opt_ -#define _Inout_opt_bytecap_(size) -#define _Inout_opt_bytecap_c_(size) -#define _Inout_opt_bytecap_x_(size) -#define _Inout_opt_bytecount_(size) -#define _Inout_opt_bytecount_c_(size) -#define _Inout_opt_bytecount_x_(size) -#define _Inout_opt_cap_(size) -#define _Inout_opt_cap_c_(size) -#define _Inout_opt_cap_x_(size) -#define _Inout_opt_count_(size) -#define _Inout_opt_count_c_(size) -#define _Inout_opt_count_x_(size) -#define _Inout_opt_ptrdiff_count_(size) -#define _Inout_opt_z_ -#define _Inout_opt_z_bytecap_(size) -#define _Inout_opt_z_bytecap_c_(size) -#define _Inout_opt_z_bytecap_x_(size) -#define _Inout_opt_z_bytecount_(size) -#define _Inout_opt_z_bytecount_c_(size) -#define _Inout_opt_z_cap_(size) -#define _Inout_opt_z_cap_c_(size) -#define _Inout_opt_z_cap_x_(size) -#define _Inout_opt_z_count_(size) -#define _Inout_opt_z_count_c_(size) -#define _Inout_ptrdiff_count_(size) -#define _Inout_updates_(size) -#define _Inout_updates_all_(size) -#define _Inout_updates_all_opt_(size) -#define _Inout_updates_bytes_(size) -#define _Inout_updates_bytes_all_(size) -#define _Inout_updates_bytes_all_opt_(size) -#define _Inout_updates_bytes_opt_(size) -#define _Inout_updates_bytes_to_(size,count) -#define _Inout_updates_bytes_to_opt_(size,count) -#define _Inout_updates_opt_(size) -#define _Inout_updates_opt_z_(size) -#define _Inout_updates_to_(size,count) -#define _Inout_updates_to_opt_(size,count) -#define _Inout_updates_z_(size) -#define _Inout_z_ -#define _Inout_z_bytecap_(size) -#define _Inout_z_bytecap_c_(size) -#define _Inout_z_bytecap_x_(size) -#define _Inout_z_bytecount_(size) -#define _Inout_z_bytecount_c_(size) -#define _Inout_z_cap_(size) -#define _Inout_z_cap_c_(size) -#define _Inout_z_cap_x_(size) -#define _Inout_z_count_(size) -#define _Inout_z_count_c_(size) -#define _Interlocked_operand_ -#define _Literal_ -#define _Maybenull_ -#define _Maybevalid_ -#define _Maybe_raises_SEH_exception_ -#define _Must_inspect_result_ -#define _Notliteral_ -#define _Notnull_ -#define _Notref_ -#define _Notvalid_ -#define _Null_ -#define _Null_terminated_ -#define _NullNull_terminated_ -#define _On_failure_(annos) -#define _Out_ -#define _Out_bound_ -#define _Out_bytecap_(size) -#define _Out_bytecap_c_(size) -#define _Out_bytecap_post_bytecount_(cap,count) -#define _Out_bytecap_x_(size) -#define _Out_bytecapcount_(capcount) -#define _Out_bytecapcount_x_(capcount) -#define _Out_cap_(size) -#define _Out_cap_c_(size) -#define _Out_cap_m_(mult,size) -#define _Out_cap_post_count_(cap,count) -#define _Out_cap_x_(size) -#define _Out_capcount_(capcount) -#define _Out_capcount_x_(capcount) -#define _Out_defensive_(annotes) -#define _Out_opt_ -#define _Out_opt_bytecap_(size) -#define _Out_opt_bytecap_c_(size) -#define _Out_opt_bytecap_post_bytecount_(cap,count) -#define _Out_opt_bytecap_x_(size) -#define _Out_opt_bytecapcount_(capcount) -#define _Out_opt_bytecapcount_x_(capcount) -#define _Out_opt_cap_(size) -#define _Out_opt_cap_c_(size) -#define _Out_opt_cap_m_(mult,size) -#define _Out_opt_cap_post_count_(cap,count) -#define _Out_opt_cap_x_(size) -#define _Out_opt_capcount_(capcount) -#define _Out_opt_capcount_x_(capcount) -#define _Out_opt_ptrdiff_cap_(size) -#define _Out_opt_z_bytecap_(size) -#define _Out_opt_z_bytecap_c_(size) -#define _Out_opt_z_bytecap_post_bytecount_(cap,count) -#define _Out_opt_z_bytecap_x_(size) -#define _Out_opt_z_bytecapcount_(capcount) -#define _Out_opt_z_cap_(size) -#define _Out_opt_z_cap_c_(size) -#define _Out_opt_z_cap_m_(mult,size) -#define _Out_opt_z_cap_post_count_(cap,count) -#define _Out_opt_z_cap_x_(size) -#define _Out_opt_z_capcount_(capcount) -#define _Out_ptrdiff_cap_(size) -#define _Out_range_(lb,ub) -#define _Out_writes_(size) -#define _Out_writes_all_(size) -#define _Out_writes_all_opt_(size) -#define _Out_writes_bytes_(size) -#define _Out_writes_bytes_all_(size) -#define _Out_writes_bytes_all_opt_(size) -#define _Out_writes_bytes_opt_(size) -#define _Out_writes_bytes_to_(size,count) -#define _Out_writes_bytes_to_opt_(size,count) -#define _Out_writes_opt_(size) -#define _Out_writes_opt_z_(size) -#define _Out_writes_to_(size,count) -#define _Out_writes_to_opt_(size,count) -#define _Out_writes_to_ptr_(ptr) -#define _Out_writes_to_ptr_opt_(ptr) -#define _Out_writes_to_ptr_opt_z_(ptr) -#define _Out_writes_to_ptr_z_(ptr) -#define _Out_writes_z_(size) -#define _Out_z_bytecap_(size) -#define _Out_z_bytecap_c_(size) -#define _Out_z_bytecap_post_bytecount_(cap,count) -#define _Out_z_bytecap_x_(size) -#define _Out_z_bytecapcount_(capcount) -#define _Out_z_cap_(size) -#define _Out_z_cap_c_(size) -#define _Out_z_cap_m_(mult,size) -#define _Out_z_cap_post_count_(cap,count) -#define _Out_z_cap_x_(size) -#define _Out_z_capcount_(capcount) -#define _Outptr_ -#define _Outptr_opt_ -#define _Outptr_opt_result_buffer_(size) -#define _Outptr_opt_result_buffer_all_(size) -#define _Outptr_opt_result_buffer_all_maybenull_(size) -#define _Outptr_opt_result_buffer_maybenull_(size) -#define _Outptr_opt_result_buffer_to_(size, count) -#define _Outptr_opt_result_buffer_to_maybenull_(size, count) -#define _Outptr_opt_result_bytebuffer_(size) -#define _Outptr_opt_result_bytebuffer_all_(size) -#define _Outptr_opt_result_bytebuffer_all_maybenull_(size) -#define _Outptr_opt_result_bytebuffer_maybenull_(size) -#define _Outptr_opt_result_bytebuffer_to_(size, count) -#define _Outptr_opt_result_bytebuffer_to_maybenull_(size, count) -#define _Outptr_opt_result_maybenull_ -#define _Outptr_opt_result_maybenull_z_ -#define _Outptr_opt_result_nullonfailure_ -#define _Outptr_opt_result_z_ -#define _Outptr_result_buffer_(size) -#define _Outptr_result_buffer_all_(size) -#define _Outptr_result_buffer_all_maybenull_(size) -#define _Outptr_result_buffer_maybenull_(size) -#define _Outptr_result_buffer_to_(size, count) -#define _Outptr_result_buffer_to_maybenull_(size, count) -#define _Outptr_result_bytebuffer_(size) -#define _Outptr_result_bytebuffer_all_(size) -#define _Outptr_result_bytebuffer_all_maybenull_(size) -#define _Outptr_result_bytebuffer_maybenull_(size) -#define _Outptr_result_bytebuffer_to_(size, count) -#define _Outptr_result_bytebuffer_to_maybenull_(size, count) -#define _Outptr_result_maybenull_ -#define _Outptr_result_maybenull_z_ -#define _Outptr_result_nullonfailure_ -#define _Outptr_result_z_ -#define _Outref_ -#define _Outref_result_buffer_(size) -#define _Outref_result_buffer_all_(size) -#define _Outref_result_buffer_all_maybenull_(size) -#define _Outref_result_buffer_maybenull_(size) -#define _Outref_result_buffer_to_(size, count) -#define _Outref_result_buffer_to_maybenull_(size, count) -#define _Outref_result_bytebuffer_(size) -#define _Outref_result_bytebuffer_all_(size) -#define _Outref_result_bytebuffer_all_maybenull_(size) -#define _Outref_result_bytebuffer_maybenull_(size) -#define _Outref_result_bytebuffer_to_(size, count) -#define _Outref_result_bytebuffer_to_maybenull_(size, count) -#define _Outref_result_maybenull_ -#define _Outref_result_nullonfailure_ -#define _Points_to_data_ -#define _Post_ -#define _Post_bytecap_(size) -#define _Post_bytecount_(size) -#define _Post_bytecount_c_(size) -#define _Post_bytecount_x_(size) -#define _Post_cap_(size) -#define _Post_count_(size) -#define _Post_count_c_(size) -#define _Post_count_x_(size) -#define _Post_defensive_ -#define _Post_equal_to_(expr) -#define _Post_invalid_ -#define _Post_maybenull_ -#define _Post_maybez_ -#define _Post_notnull_ -#define _Post_null_ -#define _Post_ptr_invalid_ -#define _Post_readable_byte_size_(size) -#define _Post_readable_size_(size) -#define _Post_satisfies_(cond) -#define _Post_valid_ -#define _Post_writable_byte_size_(size) -#define _Post_writable_size_(size) -#define _Post_z_ -#define _Post_z_bytecount_(size) -#define _Post_z_bytecount_c_(size) -#define _Post_z_bytecount_x_(size) -#define _Post_z_count_(size) -#define _Post_z_count_c_(size) -#define _Post_z_count_x_(size) -#define _Pre_ -#define _Pre_bytecap_(size) -#define _Pre_bytecap_c_(size) -#define _Pre_bytecap_x_(size) -#define _Pre_bytecount_(size) -#define _Pre_bytecount_c_(size) -#define _Pre_bytecount_x_(size) -#define _Pre_cap_(size) -#define _Pre_cap_c_(size) -#define _Pre_cap_c_one_ -#define _Pre_cap_for_(param) -#define _Pre_cap_m_(mult,size) -#define _Pre_cap_x_(size) -#define _Pre_count_(size) -#define _Pre_count_c_(size) -#define _Pre_count_x_(size) -#define _Pre_defensive_ -#define _Pre_equal_to_(expr) -#define _Pre_invalid_ -#define _Pre_maybenull_ -#define _Pre_notnull_ -#define _Pre_null_ -#define _Pre_opt_bytecap_(size) -#define _Pre_opt_bytecap_c_(size) -#define _Pre_opt_bytecap_x_(size) -#define _Pre_opt_bytecount_(size) -#define _Pre_opt_bytecount_c_(size) -#define _Pre_opt_bytecount_x_(size) -#define _Pre_opt_cap_(size) -#define _Pre_opt_cap_c_(size) -#define _Pre_opt_cap_c_one_ -#define _Pre_opt_cap_for_(param) -#define _Pre_opt_cap_m_(mult,size) -#define _Pre_opt_cap_x_(size) -#define _Pre_opt_count_(size) -#define _Pre_opt_count_c_(size) -#define _Pre_opt_count_x_(size) -#define _Pre_opt_ptrdiff_cap_(ptr) -#define _Pre_opt_ptrdiff_count_(ptr) -#define _Pre_opt_valid_ -#define _Pre_opt_valid_bytecap_(size) -#define _Pre_opt_valid_bytecap_c_(size) -#define _Pre_opt_valid_bytecap_x_(size) -#define _Pre_opt_valid_cap_(size) -#define _Pre_opt_valid_cap_c_(size) -#define _Pre_opt_valid_cap_x_(size) -#define _Pre_opt_z_ -#define _Pre_opt_z_bytecap_(size) -#define _Pre_opt_z_bytecap_c_(size) -#define _Pre_opt_z_bytecap_x_(size) -#define _Pre_opt_z_cap_(size) -#define _Pre_opt_z_cap_c_(size) -#define _Pre_opt_z_cap_x_(size) -#define _Pre_ptrdiff_cap_(ptr) -#define _Pre_ptrdiff_count_(ptr) -#define _Pre_readable_byte_size_(size) -#define _Pre_readable_size_(size) -#define _Pre_readonly_ -#define _Pre_satisfies_(cond) -#define _Pre_unknown_ -#define _Pre_valid_ -#define _Pre_valid_bytecap_(size) -#define _Pre_valid_bytecap_c_(size) -#define _Pre_valid_bytecap_x_(size) -#define _Pre_valid_cap_(size) -#define _Pre_valid_cap_c_(size) -#define _Pre_valid_cap_x_(size) -#define _Pre_writable_byte_size_(size) -#define _Pre_writable_size_(size) -#define _Pre_writeonly_ -#define _Pre_z_ -#define _Pre_z_bytecap_(size) -#define _Pre_z_bytecap_c_(size) -#define _Pre_z_bytecap_x_(size) -#define _Pre_z_cap_(size) -#define _Pre_z_cap_c_(size) -#define _Pre_z_cap_x_(size) -#define _Prepost_bytecount_(size) -#define _Prepost_bytecount_c_(size) -#define _Prepost_bytecount_x_(size) -#define _Prepost_count_(size) -#define _Prepost_count_c_(size) -#define _Prepost_count_x_(size) -#define _Prepost_opt_bytecount_(size) -#define _Prepost_opt_bytecount_c_(size) -#define _Prepost_opt_bytecount_x_(size) -#define _Prepost_opt_count_(size) -#define _Prepost_opt_count_c_(size) -#define _Prepost_opt_count_x_(size) -#define _Prepost_opt_valid_ -#define _Prepost_opt_z_ -#define _Prepost_valid_ -#define _Prepost_z_ -#define _Printf_format_string_ -#define _Raises_SEH_exception_ -#define _Readable_bytes_(size) -#define _Readable_elements_(size) -#define _Reserved_ -#define _Result_nullonfailure_ -#define _Result_zeroonfailure_ -#define _Ret_ -#define _Ret_bound_ -#define _Ret_bytecap_(size) -#define _Ret_bytecap_c_(size) -#define _Ret_bytecap_x_(size) -#define _Ret_bytecount_(size) -#define _Ret_bytecount_c_(size) -#define _Ret_bytecount_x_(size) -#define _Ret_cap_(size) -#define _Ret_cap_c_(size) -#define _Ret_cap_x_(size) -#define _Ret_count_(size) -#define _Ret_count_c_(size) -#define _Ret_count_x_(size) -#define _Ret_maybenull_ -#define _Ret_maybenull_z_ -#define _Ret_notnull_ -#define _Ret_null_ -#define _Ret_opt_ -#define _Ret_opt_bytecap_(size) -#define _Ret_opt_bytecap_c_(size) -#define _Ret_opt_bytecap_x_(size) -#define _Ret_opt_bytecount_(size) -#define _Ret_opt_bytecount_c_(size) -#define _Ret_opt_bytecount_x_(size) -#define _Ret_opt_cap_(size) -#define _Ret_opt_cap_c_(size) -#define _Ret_opt_cap_x_(size) -#define _Ret_opt_count_(size) -#define _Ret_opt_count_c_(size) -#define _Ret_opt_count_x_(size) -#define _Ret_opt_valid_ -#define _Ret_opt_z_ -#define _Ret_opt_z_bytecap_(size) -#define _Ret_opt_z_bytecount_(size) -#define _Ret_opt_z_cap_(size) -#define _Ret_opt_z_count_(size) -#define _Ret_range_(lb,ub) -#define _Ret_valid_ -#define _Ret_writes_(size) -#define _Ret_writes_bytes_(size) -#define _Ret_writes_bytes_maybenull_(size) -#define _Ret_writes_bytes_to_(size,count) -#define _Ret_writes_bytes_to_maybenull_(size,count) -#define _Ret_writes_maybenull_(size) -#define _Ret_writes_maybenull_z_(size) -#define _Ret_writes_to_(size,count) -#define _Ret_writes_to_maybenull_(size,count) -#define _Ret_writes_z_(size) -#define _Ret_z_ -#define _Ret_z_bytecap_(size) -#define _Ret_z_bytecount_(size) -#define _Ret_z_cap_(size) -#define _Ret_z_count_(size) -#define _Return_type_success_(expr) -#define _Scanf_format_string_ -#define _Scanf_s_format_string_ -#define _Strict_type_match_ -#define _Struct_size_bytes_(size) -#define _Success_(expr) -#define _Unchanged_(e) -#define _Use_decl_annotations_ -#define _Valid_ -#define _When_(expr, annos) -#define _Writable_bytes_(size) -#define _Writable_elements_(size) - -/* driverspecs.h */ -#define _Dispatch_type_(type) -#define _IRQL_always_function_max_(irql) -#define _IRQL_always_function_min_(irql) -#define _IRQL_is_cancel_ -#define _IRQL_raises_(irql) -#define _IRQL_requires_(irql) -#define _IRQL_requires_max_(irql) -#define _IRQL_requires_min_(irql) -#define _IRQL_requires_same_ -#define _IRQL_restores_ -#define _IRQL_restores_global_(kind,param) -#define _IRQL_saves_ -#define _IRQL_saves_global_(kind,param) -#define _IRQL_uses_cancel_ -#define _Kernel_clear_do_init_(yesNo) -#define _Kernel_float_restored_ -#define _Kernel_float_saved_ -#define _Kernel_float_used_ -#define _Kernel_IoGetDmaAdapter_ -#define _Kernel_releases_resource_(kind) -#define _Kernel_requires_resource_held_(kind) -#define _Kernel_requires_resource_not_held_(kind) -#define _Kernel_acquires_resource_(kind) -#define _Landmark_(name) -#define __prefast_operator_new_null -#define __prefast_operator_new_throws - -/* concurrencysal.h */ -#define _Benign_race_begin_ __pragma(warning(push)) -#define _Benign_race_end_ __pragma(warning(pop)) -#define _No_competing_thread_begin_ __pragma(warning(push)) -#define _No_competing_thread_end_ __pragma(warning(pop)) -#define _Acquires_exclusive_lock_(lock) -#define _Acquires_lock_(lock) -#define _Acquires_nonreentrant_lock_(lock) -#define _Acquires_shared_lock_(lock) -#define _Analysis_assume_lock_acquired_(lock) -#define _Analysis_assume_lock_released_(lock) -#define _Analysis_assume_lock_held_(lock) -#define _Analysis_assume_lock_not_held_(lock) -#define _Analysis_assume_same_lock_(lock1, lock2) -#define _Analysis_suppress_lock_checking_(lock) -#define _Create_lock_level_(level) -#define _Csalcat1_(x,y) -#define _Csalcat2_(x,y) -#define _Function_ignore_lock_checking_(lock) -#define _Guarded_by_(lock) -#define _Has_lock_kind_(kind) -#define _Has_lock_level_(level) -#define _Interlocked_ -#define _Internal_lock_level_order_(a,b) -#define _Lock_level_order_(a,b) -#define _No_competing_thread_ -#define _Post_same_lock_(lock1,lock2) -#define _Releases_exclusive_lock_(lock) -#define _Releases_lock_(lock) -#define _Releases_nonreentrant_lock_(lock) -#define _Releases_shared_lock_(lock) -#define _Requires_exclusive_lock_held_(lock) -#define _Requires_shared_lock_held_(lock) -#define _Requires_lock_held_(lock) -#define _Requires_lock_not_held_(lock) -#define _Requires_no_locks_held_ -#define _Write_guarded_by_(lock) diff --git a/sdk/include/psdk/no_sal2.h b/sdk/include/psdk/no_sal2.h new file mode 100644 index 00000000000..a652717bdcf --- /dev/null +++ b/sdk/include/psdk/no_sal2.h @@ -0,0 +1,544 @@ +/* + * PROJECT: ReactOS PSDK + * LICENSE: MIT (https://spdx.org/licenses/MIT) + * PURPOSE: Renders the SAL annotations for documenting APIs harmless. + * COPYRIGHT: Microsoft Corporation. + * SOURCE: https://github.com/microsoft/ChakraCore/blob/master/pal/inc/rt/no_sal2.h + */ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + + +/*** +* no_sal2.h - renders the SAL annotations for documenting APIs harmless. +* + +* +*Purpose: +* sal.h provides a set of SAL2 annotations to describe how a function uses its +* parameters - the assumptions it makes about them, and the guarantees it makes +* upon finishing. This file redefines all those annotation macros to be harmless. +* It is designed for use in down-level build environments where the tooling may +* be unhappy with the standard SAL2 macro definitions. +* +* [Public] +* + +* +****/ + +#ifndef _NO_SAL_2_H_ +#define _NO_SAL_2_H_ + +#undef __notnull +#define __notnull +#undef _When_ +#define _When_(c,a) +#undef _At_ +#define _At_(t,a) +#undef _At_buffer_ +#define _At_buffer_(t,i,c,a) +#undef _Group_ +#define _Group_(a) +#undef _Pre_ +#define _Pre_ +#undef _Post_ +#define _Post_ +#undef _Deref_ +#define _Deref_ +#undef _Null_ +#define _Null_ +#undef _Notnull_ +#define _Notnull_ +#undef _Maybenull_ +#define _Maybenull_ +#undef _Const_ +#define _Const_ +#undef _Check_return_ +#define _Check_return_ +#undef _Must_inspect_result_ +#define _Must_inspect_result_ +#undef _Pre_satisfies_ +#define _Pre_satisfies_(e) +#undef _Post_satisfies_ +#define _Post_satisfies_(e) +#undef _Writable_elements_ +#define _Writable_elements_(s) +#undef _Writable_bytes_ +#define _Writable_bytes_(s) +#undef _Readable_elements_ +#define _Readable_elements_(s) +#undef _Readable_bytes_ +#define _Readable_bytes_(s) +#undef _Null_terminated_ +#define _Null_terminated_ +#undef _NullNull_terminated_ +#define _NullNull_terminated_ +#undef _Valid_ +#define _Valid_ +#undef _Notvalid_ +#define _Notvalid_ +#undef _Success_ +#define _Success_(c) +#undef _Return_type_success_ +#define _Return_type_success_(c) +#undef _On_failure_ +#define _On_failure_(a) +#undef _Always_ +#define _Always_(a) +#undef _Use_decl_annotations_ +#define _Use_decl_annotations_ +#undef _Pre_defensive_ +#define _Pre_defensive_ +#undef _Post_defensive_ +#define _Post_defensive_ +#undef _Pre_unknown_ +#define _Pre_unknown_ +#undef _Acquires_lock_ +#define _Acquires_lock_(e) +#undef _Releases_lock_ +#define _Releases_lock_(e) +#undef _Requires_lock_held_ +#define _Requires_lock_held_(e) +#undef _Requires_lock_not_held_ +#define _Requires_lock_not_held_(e) +#undef _Requires_no_locks_held_ +#define _Requires_no_locks_held_ +#undef _Guarded_by_ +#define _Guarded_by_(e) +#undef _Write_guarded_by_ +#define _Write_guarded_by_(e) +#undef _Interlocked_ +#define _Interlocked_ +#undef _Post_same_lock_ +#define _Post_same_lock_(e1,e2) +#undef _Benign_race_begin_ +#define _Benign_race_begin_ +#undef _Benign_race_end_ +#define _Benign_race_end_ +#undef _No_competing_thread_ +#define _No_competing_thread_ +#undef _No_competing_thread_begin_ +#define _No_competing_thread_begin_ +#undef _No_competing_thread_end_ +#define _No_competing_thread_end_ +#undef _Acquires_shared_lock_ +#define _Acquires_shared_lock_(e) +#undef _Releases_shared_lock_ +#define _Releases_shared_lock_(e) +#undef _Requires_shared_lock_held_ +#define _Requires_shared_lock_held_(e) +#undef _Acquires_exclusive_lock_ +#define _Acquires_exclusive_lock_(e) +#undef _Releases_exclusive_lock_ +#define _Releases_exclusive_lock_(e) +#undef _Requires_exclusive_lock_held_ +#define _Requires_exclusive_lock_held_(e) +#undef _Has_lock_kind_ +#define _Has_lock_kind_(n) +#undef _Create_lock_level_ +#define _Create_lock_level_(n) +#undef _Has_lock_level_ +#define _Has_lock_level_(n) +#undef _Lock_level_order_ +#define _Lock_level_order_(n1,n2) +#undef _Analysis_assume_lock_acquired_ +#define _Analysis_assume_lock_acquired_(e) +#undef _Analysis_assume_lock_released_ +#define _Analysis_assume_lock_released_(e) +#undef _Analysis_assume_lock_held_ +#define _Analysis_assume_lock_held_(e) +#undef _Analysis_assume_lock_not_held_ +#define _Analysis_assume_lock_not_held_(e) +#undef _Analysis_assume_same_lock_ +#define _Analysis_assume_same_lock_(e) +#undef _In_ +#define _In_ +#undef _Out_ +#define _Out_ +#undef _Inout_ +#define _Inout_ +#undef _In_z_ +#define _In_z_ +#undef _Inout_z_ +#define _Inout_z_ +#undef _In_reads_ +#define _In_reads_(s) +#undef _In_reads_bytes_ +#define _In_reads_bytes_(s) +#undef _In_reads_z_ +#define _In_reads_z_(s) +#undef _In_reads_or_z_ +#define _In_reads_or_z_(s) +#undef _Out_writes_ +#define _Out_writes_(s) +#undef _Out_writes_bytes_ +#define _Out_writes_bytes_(s) +#undef _Out_writes_z_ +#define _Out_writes_z_(s) +#undef _Inout_updates_ +#define _Inout_updates_(s) +#undef _Inout_updates_bytes_ +#define _Inout_updates_bytes_(s) +#undef _Inout_updates_z_ +#define _Inout_updates_z_(s) +#undef _Out_writes_to_ +#define _Out_writes_to_(s,c) +#undef _Out_writes_bytes_to_ +#define _Out_writes_bytes_to_(s,c) +#undef _Out_writes_all_ +#define _Out_writes_all_(s) +#undef _Out_writes_bytes_all_ +#define _Out_writes_bytes_all_(s) +#undef _Inout_updates_to_ +#define _Inout_updates_to_(s,c) +#undef _Inout_updates_bytes_to_ +#define _Inout_updates_bytes_to_(s,c) +#undef _Inout_updates_all_ +#define _Inout_updates_all_(s) +#undef _Inout_updates_bytes_all_ +#define _Inout_updates_bytes_all_(s) +#undef _In_reads_to_ptr_ +#define _In_reads_to_ptr_(p) +#undef _In_reads_to_ptr_z_ +#define _In_reads_to_ptr_z_(p) +#undef _Out_writes_to_ptr_ +#define _Out_writes_to_ptr_(p) +#undef _Out_writes_to_ptr_z_ +#define _Out_writes_to_ptr_z_(p) +#undef _In_opt_ +#define _In_opt_ +#undef _Out_opt_ +#define _Out_opt_ +#undef _Inout_opt_ +#define _Inout_opt_ +#undef _In_opt_z_ +#define _In_opt_z_ +#undef _Inout_opt_z_ +#define _Inout_opt_z_ +#undef _In_reads_opt_ +#define _In_reads_opt_(s) +#undef _In_reads_bytes_opt_ +#define _In_reads_bytes_opt_(s) +#undef _Out_writes_opt_ +#define _Out_writes_opt_(s) +#undef _Out_writes_bytes_opt_ +#define _Out_writes_bytes_opt_(s) +#undef _Out_writes_opt_z_ +#define _Out_writes_opt_z_(s) +#undef _Inout_updates_opt_ +#define _Inout_updates_opt_(s) +#undef _Inout_updates_bytes_opt_ +#define _Inout_updates_bytes_opt_(s) +#undef _Inout_updates_opt_z_ +#define _Inout_updates_opt_z_(s) +#undef _Out_writes_to_opt_ +#define _Out_writes_to_opt_(s,c) +#undef _Out_writes_bytes_to_opt_ +#define _Out_writes_bytes_to_opt_(s,c) +#undef _Out_writes_all_opt_ +#define _Out_writes_all_opt_(s) +#undef _Out_writes_bytes_all_opt_ +#define _Out_writes_bytes_all_opt_(s) +#undef _Inout_updates_to_opt_ +#define _Inout_updates_to_opt_(s,c) +#undef _Inout_updates_bytes_to_opt_ +#define _Inout_updates_bytes_to_opt_(s,c) +#undef _Inout_updates_all_opt_ +#define _Inout_updates_all_opt_(s) +#undef _Inout_updates_bytes_all_opt_ +#define _Inout_updates_bytes_all_opt_(s) +#undef _In_reads_to_ptr_opt_ +#define _In_reads_to_ptr_opt_(p) +#undef _In_reads_to_ptr_opt_z_ +#define _In_reads_to_ptr_opt_z_(p) +#undef _Out_writes_to_ptr_opt_ +#define _Out_writes_to_ptr_opt_(p) +#undef _Out_writes_to_ptr_opt_z_ +#define _Out_writes_to_ptr_opt_z_(p) +#undef _Outptr_ +#define _Outptr_ +#undef _Outptr_opt_ +#define _Outptr_opt_ +#undef _Outptr_result_maybenull_ +#define _Outptr_result_maybenull_ +#undef _Outptr_opt_result_maybenull_ +#define _Outptr_opt_result_maybenull_ +#undef _Outptr_z_ +#define _Outptr_z_ +#undef _Outptr_opt_z_ +#define _Outptr_opt_z_ +#undef _Outptr_result_maybenull_z_ +#define _Outptr_result_maybenull_z_ +#undef _Outptr_opt_result_maybenull_z_ +#define _Outptr_opt_result_maybenull_z_ +#undef _COM_Outptr_ +#define _COM_Outptr_ +#undef _COM_Outptr_opt_ +#define _COM_Outptr_opt_ +#undef _COM_Outptr_result_maybenull_ +#define _COM_Outptr_result_maybenull_ +#undef _COM_Outptr_opt_result_maybenull_ +#define _COM_Outptr_opt_result_maybenull_ +#undef _Outptr_result_buffer_ +#define _Outptr_result_buffer_(s) +#undef _Outptr_result_bytebuffer_ +#define _Outptr_result_bytebuffer_(s) +#undef _Outptr_opt_result_buffer_ +#define _Outptr_opt_result_buffer_(s) +#undef _Outptr_opt_result_bytebuffer_ +#define _Outptr_opt_result_bytebuffer_(s) +#undef _Outptr_result_buffer_to_ +#define _Outptr_result_buffer_to_(s,c) +#undef _Outptr_result_bytebuffer_to_ +#define _Outptr_result_bytebuffer_to_(s,c) +#undef _Outptr_opt_result_buffer_to_ +#define _Outptr_opt_result_buffer_to_(s,c) +#undef _Outptr_opt_result_bytebuffer_to_ +#define _Outptr_opt_result_bytebuffer_to_(s,c) +#undef _Ret_ +#define _Ret_ +#undef _Ret_valid_ +#define _Ret_valid_ +#undef _Ret_z_ +#define _Ret_z_ +#undef _Ret_writes_ +#define _Ret_writes_(s) +#undef _Ret_writes_bytes_ +#define _Ret_writes_bytes_(s) +#undef _Ret_writes_z_ +#define _Ret_writes_z_(s) +#undef _Ret_writes_to_ +#define _Ret_writes_to_(s,c) +#undef _Ret_writes_bytes_to_ +#define _Ret_writes_bytes_to_(s,c) +#undef _Ret_writes_maybenull_ +#define _Ret_writes_maybenull_(s) +#undef _Ret_writes_bytes_maybenull_ +#define _Ret_writes_bytes_maybenull_(s) +#undef _Ret_writes_to_maybenull_ +#define _Ret_writes_to_maybenull_(s,c) +#undef _Ret_writes_bytes_to_maybenull_ +#define _Ret_writes_bytes_to_maybenull_(s,c) +#undef _Ret_writes_maybenull_z_ +#define _Ret_writes_maybenull_z_(s) +#undef _Ret_maybenull_ +#define _Ret_maybenull_ +#undef _Ret_maybenull_z_ +#define _Ret_maybenull_z_ +#undef _Field_size_ +#define _Field_size_(s) +#undef _Field_size_opt_ +#define _Field_size_opt_(s) +#undef _Field_size_bytes_ +#define _Field_size_bytes_(s) +#undef _Field_size_bytes_opt_ +#define _Field_size_bytes_opt_(s) +#undef _Field_size_part_ +#define _Field_size_part_(s,c) +#undef _Field_size_part_opt_ +#define _Field_size_part_opt_(s,c) +#undef _Field_size_bytes_part_ +#define _Field_size_bytes_part_(s,c) +#undef _Field_size_bytes_part_opt_ +#define _Field_size_bytes_part_opt_(s,c) +#undef _Field_size_full_ +#define _Field_size_full_(s) +#undef _Field_size_full_opt_ +#define _Field_size_full_opt_(s) +#undef _Field_size_bytes_full_ +#define _Field_size_bytes_full_(s) +#undef _Field_size_bytes_full_opt_ +#define _Field_size_bytes_full_opt_(s) +#undef _Printf_format_string_ +#define _Printf_format_string_ +#undef _Scanf_format_string_ +#define _Scanf_format_string_ +#undef _Scanf_s_format_string_ +#define _Scanf_s_format_string_ +#undef _Printf_format_string_params_ +#define _Printf_format_string_params_(x) +#undef _Scanf_format_string_params_ +#define _Scanf_format_string_params_(x) +#undef _Scanf_s_format_string_params_ +#define _Scanf_s_format_string_params_(x) +#undef _In_range_ +#define _In_range_(l,h) +#undef _Out_range_ +#define _Out_range_(l,h) +#undef _Ret_range_ +#define _Ret_range_(l,h) +#undef _Deref_in_range_ +#define _Deref_in_range_(l,h) +#undef _Deref_out_range_ +#define _Deref_out_range_(l,h) +#undef _Deref_inout_range_ +#define _Deref_inout_range_(l,h) +#undef _Field_range_ +#define _Field_range_(l,h) +#undef _Pre_equal_to_ +#define _Pre_equal_to_(e) +#undef _Post_equal_to_ +#define _Post_equal_to_(e) +#undef _Struct_size_bytes_ +#define _Struct_size_bytes_(s) +#undef _Analysis_assume_ +#define _Analysis_assume_ +#undef _Analysis_mode_ +#define _Analysis_mode_(m) +#undef _Analysis_noreturn_ +#define _Analysis_noreturn_ +#undef _Raises_SEH_exception_ +#define _Raises_SEH_exception_ +#undef _Maybe_raises_SEH_exception_ +#define _Maybe_raises_SEH_exception_ +#undef _Function_class_ +#define _Function_class_(n) +#undef _Literal_ +#define _Literal_ +#undef _Notliteral_ +#define _Notliteral_ +#undef _Enum_is_bitflag_ +#define _Enum_is_bitflag_ +#undef _Strict_type_match_ +#define _Strict_type_match_ +#undef _Points_to_data_ +#define _Points_to_data_ +#undef _Interlocked_operand_ +#define _Interlocked_operand_ +#undef _IRQL_raises_ +#define _IRQL_raises_(i) +#undef _IRQL_requires_ +#define _IRQL_requires_(i) +#undef _IRQL_requires_max_ +#define _IRQL_requires_max_(i) +#undef _IRQL_requires_min_ +#define _IRQL_requires_min_(i) +#undef _IRQL_saves_ +#define _IRQL_saves_ +#undef _IRQL_saves_global_ +#define _IRQL_saves_global_(k,s) +#undef _IRQL_restores_ +#define _IRQL_restores_ +#undef _IRQL_restores_global_ +#define _IRQL_restores_global_(k,s) +#undef _IRQL_always_function_min_ +#define _IRQL_always_function_min_(i) +#undef _IRQL_always_function_max_ +#define _IRQL_always_function_max_(i) +#undef _IRQL_requires_same_ +#define _IRQL_requires_same_ +#undef _IRQL_uses_cancel_ +#define _IRQL_uses_cancel_ +#undef _IRQL_is_cancel_ +#define _IRQL_is_cancel_ +#undef _Kernel_float_saved_ +#define _Kernel_float_saved_ +#undef _Kernel_float_restored_ +#define _Kernel_float_restored_ +#undef _Kernel_float_used_ +#define _Kernel_float_used_ +#undef _Kernel_acquires_resource_ +#define _Kernel_acquires_resource_(k) +#undef _Kernel_releases_resource_ +#define _Kernel_releases_resource_(k) +#undef _Kernel_requires_resource_held_ +#define _Kernel_requires_resource_held_(k) +#undef _Kernel_requires_resource_not_held_ +#define _Kernel_requires_resource_not_held_(k) +#undef _Kernel_clear_do_init_ +#define _Kernel_clear_do_init_(yn) +#undef _Kernel_IoGetDmaAdapter_ +#define _Kernel_IoGetDmaAdapter_ +#undef _Outref_ +#define _Outref_ +#undef _Outref_result_maybenull_ +#define _Outref_result_maybenull_ +#undef _Outref_result_buffer_ +#define _Outref_result_buffer_(s) +#undef _Outref_result_bytebuffer_ +#define _Outref_result_bytebuffer_(s) +#undef _Outref_result_buffer_to_ +#define _Outref_result_buffer_to_(s,c) +#undef _Outref_result_bytebuffer_to_ +#define _Outref_result_bytebuffer_to_(s,c) +#undef _Outref_result_buffer_all_ +#define _Outref_result_buffer_all_(s) +#undef _Outref_result_bytebuffer_all_ +#define _Outref_result_bytebuffer_all_(s) +#undef _Outref_result_buffer_maybenull_ +#define _Outref_result_buffer_maybenull_(s) +#undef _Outref_result_bytebuffer_maybenull_ +#define _Outref_result_bytebuffer_maybenull_(s) +#undef _Outref_result_buffer_to_maybenull_ +#define _Outref_result_buffer_to_maybenull_(s,c) +#undef _Outref_result_bytebuffer_to_maybenull_ +#define _Outref_result_bytebuffer_to_maybenull_(s,c) +#undef _Outref_result_buffer_all_maybenull_ +#define _Outref_result_buffer_all_maybenull_(s) +#undef _Outref_result_bytebuffer_all_maybenull_ +#define _Outref_result_bytebuffer_all_maybenull_(s) +#undef _In_defensive_ +#define _In_defensive_(a) +#undef _Out_defensive_ +#define _Out_defensive_(a) +#undef _Inout_defensive_ +#define _Inout_defensive_(a) +#undef _Outptr_result_nullonfailure_ +#define _Outptr_result_nullonfailure_ +#undef _Outptr_opt_result_nullonfailure_ +#define _Outptr_opt_result_nullonfailure_ +#undef _Outref_result_nullonfailure_ +#define _Outref_result_nullonfailure_ +#undef _Result_nullonfailure_ +#define _Result_nullonfailure_ +#undef _Result_zeroonfailure_ +#define _Result_zeroonfailure_ +#undef _Acquires_nonreentrant_lock_ +#define _Acquires_nonreentrant_lock_(e) +#undef _Releases_nonreentrant_lock_ +#define _Releases_nonreentrant_lock_(e) +#undef _Reserved_ +#define _Reserved_ _Pre_equal_to_(0) _Pre_ _Null_ +#undef _Pre_z_ +#define _Pre_z_ _Pre_ _Null_terminated_ +#undef _Post_z_ +#define _Post_z_ _Post_ _Null_terminated_ +#undef _Prepost_z_ +#define _Prepost_z_ _Pre_z_ _Post_z_ +#undef _Pre_null_ +#define _Pre_null_ _Pre_ _Null_ +#undef _Pre_maybenull_ +#define _Pre_maybenull_ _Pre_ _Maybenull_ +#undef _Pre_notnull_ +#define _Pre_notnull_ _Pre_ _Notnull_ +#undef _Pre_valid_ +#define _Pre_valid_ _Pre_notnull_ _Pre_ _Valid_ +#undef _Pre_opt_valid_ +#define _Pre_opt_valid_ _Pre_maybenull_ _Pre_ _Valid_ +#undef _Post_valid_ +#define _Post_valid_ _Post_ _Valid_ +#undef _Post_invalid_ +#define _Post_invalid_ _Post_ _Deref_ _Notvalid_ +#undef _Post_ptr_invalid_ +#define _Post_ptr_invalid_ _Post_ _Notvalid_ +#undef _Pre_readable_size_ +#define _Pre_readable_size_(s) _Pre_ _Readable_elements_(s) _Pre_ _Valid_ +#undef _Pre_writable_size_ +#define _Pre_writable_size_(s) _Pre_ _Writable_elements_(s) +#undef _Pre_readable_byte_size_ +#define _Pre_readable_byte_size_(s) _Pre_ _Readable_bytes_(s) _Pre_ _Valid_ +#undef _Pre_writable_byte_size_ +#define _Pre_writable_byte_size_(s) _Pre_ _Writable_bytes_(s) +#undef _Post_readable_size_ +#define _Post_readable_size_(s) _Post_ _Readable_elements_(s) _Post_ _Valid_ +#undef _Post_writable_size_ +#define _Post_writable_size_(s) _Post_ _Writable_elements_(s) +#undef _Post_readable_byte_size_ +#define _Post_readable_byte_size_(s) _Post_ _Readable_bytes_(s) _Post_ _Valid_ +#undef _Post_writable_byte_size_ +#define _Post_writable_byte_size_(s) _Post_ _Writable_bytes_(s) + +#endif /* _NO_SAL_2_H_ */ diff --git a/sdk/include/psdk/sal.h b/sdk/include/psdk/sal.h index 6b865345224..96cc8eab228 100644 --- a/sdk/include/psdk/sal.h +++ b/sdk/include/psdk/sal.h @@ -3,7 +3,7 @@ * LICENSE: MIT (https://spdx.org/licenses/MIT) * PURPOSE: Standard Annotation Language (SAL) definitions * COPYRIGHT: Microsoft Corporation. - * SOURCE: https://github.com/microsoft/service-fabric/blob/master/src/prod/src/pal/src/internal/rt/sal.h + * SOURCE: https://github.com/microsoft/ChakraCore/blob/master/pal/inc/rt/sal.h */ // ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. @@ -26,7 +26,7 @@ The comments in this file are intended to give basic understanding of the usage of SAL, the Microsoft Source Code Annotation Language. - For more details, please see http://go.microsoft.com/fwlink/?LinkID=242134 + For more details, please see https://go.microsoft.com/fwlink/?LinkID=242134 The macros are defined in 3 layers, plus the structural set: @@ -2611,8 +2611,8 @@ extern "C" { #else // ][ #ifndef PAL_STDCPP_COMPAT #define __null -#endif // !PAL_STDCPP_COMPAT #define __notnull +#endif // !PAL_STDCPP_COMPAT #define __maybenull #define __readonly #define __notreadonly @@ -2667,10 +2667,6 @@ buffer, use the table in the buffer annotations section. #define __out _SAL1_Source_(__out, (), _Out_) #endif // !PAL_STDCPP_COMPAT -#define __in_xcount(size) _SAL1_Source_(__in_xcount, (size), __in _Pre_ __inexpressible_readableTo(size)) -#define __in_xcount_opt(size) _SAL1_Source_(__in_xcount_opt, (size), __in_xcount(size) __exceptthat __maybenull) -#define __out_xcount(size) _SAL1_Source_(__out_xcount, (size), __xcount(size) _Post_ __valid __refparam) - #define __ecount(size) _SAL1_Source_(__ecount, (size), __notnull __elem_writableTo(size)) #define __bcount(size) _SAL1_Source_(__bcount, (size), __notnull __byte_writableTo(size)) #define __in_ecount(size) _SAL1_Source_(__in_ecount, (size), _In_reads_(size)) @@ -2873,7 +2869,7 @@ of each annotation, see the advanced annotations section. #define __success(expr) _Success_(expr) #define __nullterminated _Null_terminated_ #define __nullnullterminated -#define __clr_reserved _SAL1_Source_(__reserved, (), _Reserved_) +#define __reserved _SAL1_Source_(__reserved, (), _Reserved_) #define __checkReturn _SAL1_Source_(__checkReturn, (), _Check_return_) #define __typefix(ctype) _SAL1_Source_(__typefix, (ctype), __inner_typefix(ctype)) #define __override __inner_override @@ -2966,3 +2962,4 @@ __PRIMOP(int, _In_function_class_(__In_impl_ char*);) // Rotor doesn't need concurrency sal. // #include + diff --git a/sdk/include/psdk/specstrings.h b/sdk/include/psdk/specstrings.h index 33a13e340f1..e2d4cc31538 100644 --- a/sdk/include/psdk/specstrings.h +++ b/sdk/include/psdk/specstrings.h @@ -1,82 +1,544 @@ /* - * specstrings.h - * - * Standard Annotation Language (SAL) definitions - * - * This file is part of the ReactOS PSDK package. - * - * Contributors: - * Timo Kreuzer (timo.kreuzer@reactos.org) - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * + * PROJECT: ReactOS PSDK + * LICENSE: MIT (https://spdx.org/licenses/MIT) + * PURPOSE: Support for markers for documenting the semantics of APIs + * COPYRIGHT: Microsoft Corporation. + * SOURCE: https://github.com/microsoft/ChakraCore/blob/master/pal/inc/rt/specstrings.h */ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// -#pragma once + +// +#ifndef SPECSTRINGS_H #define SPECSTRINGS_H +/*** +*specstrings.h - support for markers for documenting the semantics of APIs +* + +* +* [Public] +****/ + +/************************************************************************* +* See specstrings_strict.h for documentation of all user visible macros. +*************************************************************************/ + +#if _MSC_VER +#pragma once +#endif + +#if !defined(_SAL_VERSION_SAL2) + + #if defined(__BUILDMACHINE__) || defined(_USE_SAL2_ONLY) + #define _SAL_VERSION_SAL2(_A) SAL_2_Clean_Violation_using ## _A + #else + #define _SAL_VERSION_SAL2(_A) + #endif + + #ifdef _USE_SAL2_ONLY + #define _SAL2_STRICT + #define _SAL_VERSION_CHECK(_A) _SAL_VERSION_SAL2(_A) + #else + #define _SAL_VERSION_CHECK(_A) + #endif + + #ifndef SAL_VERSION_CHECK + #define SAL_VERSION_CHECK(_A) _SAL_VERSION_CHECK(_A) + #define SAL_VERSION_SAL2(_A) _SAL_VERSION_SAL2(_A) + #endif + +#endif + #include -#include -#define __field_bcount(size) __notnull __byte_writableTo(size) -#define __field_bcount_full(size) __notnull __byte_writableTo(size) __byte_readableTo(size) -#define __field_ecount(size) __notnull __elem_writableTo(size) -#define __post_invalid _Post_ __notvalid +#ifndef __SAL_H_FULL_VER +#define __SAL_H_FULL_VER 140050727 +#endif -#define __deref_in -#define __deref_in_ecount(size) -#define __deref_in_bcount(size) -#define __deref_in_opt -#define __deref_in_ecount_opt(size) -#define __deref_in_bcount_opt(size) -#define __deref_opt_in -#define __deref_opt_in_ecount(size) -#define __deref_opt_in_bcount(size) -#define __deref_opt_in_opt -#define __deref_opt_in_ecount_opt(size) -#define __deref_opt_in_bcount_opt(size) -#define __out_awcount(expr,size) -#define __in_awcount(expr,size) -#define __nullnullterminated -#define __in_data_source(src_sym) -#define __kernel_entry -#define __range(lb,ub) -#define __in_bound -#define __out_bound -#define __in_range(lb,ub) -#define __out_range(lb,ub) -#define __deref_in_range(lb,ub) -#define __deref_out_range(lb,ub) +#ifdef __cplusplus +extern "C" { +#endif + +/* version specific fixes to bring sal.h upto date */ +#if __SAL_H_FULL_VER <= 140050727 + +#if !defined(__midl) && defined(_PREFAST_) && _MSC_VER >= 1000 // [ + +/* Missing from RTM sal.h */ +#define __inner_bound _SA_annotes0(SAL_bound) +#define __inner_range(lb,ub) _SA_annotes2(SAL_range,lb,ub) +#define __inner_assume_bound_dec __inline __nothrow void __AssumeBoundInt(_Post_ __inner_bound int i) {i;} +#define __inner_assume_bound(i) __AssumeBoundInt(i); +#define __inner_allocator _SA_annotes0(SAL_allocator) + +#define __static_context(ctx, annotes) \ + _SA_annotes1(SAL_context,ctx) _Group_(__nop_impl(annotes)) + +#define __failure(x) __static_context(SAL_return_convention, \ + _SA_annotes1(SAL_failure,x)) + +__ANNOTATION(SAL_valueUndefined()); +#define __valueUndefined _SA_annotes0(SAL_valueUndefined) + +enum __SAL_failureKind{__failureUnspecified = 0, __failureUndefined = 1}; + +__ANNOTATION(SAL_failureDefault(enum __SAL_failureKind)); +#define __failureDefault(kind) __static_context(SAL_return_convention, \ + _SA_annotes1(SAL_failureDefault,kind)) + +#else // ][ + +#define __inner_bound +#define __inner_range(lb,ub) +#define __inner_assume_bound_dec +#define __inner_assume_bound(i) +#define __inner_allocator + +#define __static_context(ctx, annotes) +#define __failure(x) +#define __valueUndefined +#define __failureDefault(x) + +#endif // ] + +#define __xcount(size) __notnull __inexpressible_writableTo(size) +#define __in_xcount(size) __in _Pre_ __inexpressible_readableTo(size) +#define __out_xcount(size) __xcount(size) _Post_ __valid __refparam +#define __out_xcount_part(size,length) __out_xcount(size) _Post_ __inexpressible_readableTo(length) +#define __out_xcount_full(size) __out_xcount_part(size,size) +#define __inout_xcount(size) __out_xcount(size) _Pre_ __valid +#define __inout_xcount_part(size,length) __out_xcount_part(size,length) _Pre_ __valid _Pre_ __inexpressible_readableTo(length) +#define __inout_xcount_full(size) __inout_xcount_part(size,size) +#define __xcount_opt(size) __xcount(size) __exceptthat __maybenull +#define __in_xcount_opt(size) __in_xcount(size) __exceptthat __maybenull +#define __out_xcount_opt(size) __out_xcount(size) __exceptthat __maybenull +#define __out_xcount_part_opt(size,length) __out_xcount_part(size,length) __exceptthat __maybenull +#define __out_xcount_full_opt(size) __out_xcount_full(size) __exceptthat __maybenull +#define __inout_xcount_opt(size) __inout_xcount(size) __exceptthat __maybenull +#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull +#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull +#define __deref_xcount(size) __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size) +#define __deref_in __in _Pre_ __deref __deref __readonly +#define __deref_in_ecount(size) __deref_in _Pre_ __deref __elem_readableTo(size) +#define __deref_in_bcount(size) __deref_in _Pre_ __deref __byte_readableTo(size) +#define __deref_in_xcount(size) __deref_in _Pre_ __deref __inexpressible_readableTo(size) +#define __deref_out_xcount(size) __deref_xcount(size) _Post_ __deref __valid __refparam +#define __deref_out_xcount_part(size,length) __deref_out_xcount(size) _Post_ __deref __inexpressible_readableTo(length) +#define __deref_out_xcount_full(size) __deref_out_xcount_part(size,size) +#define __deref_out_xcount(size) __deref_xcount(size) _Post_ __deref __valid __refparam +#define __inout_xcount_opt(size) __inout_xcount(size) __exceptthat __maybenull +#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull +#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull +#define __deref_xcount(size) __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size) +#define __deref_in __in _Pre_ __deref __deref __readonly +#define __deref_in_ecount(size) __deref_in _Pre_ __deref __elem_readableTo(size) +#define __deref_in_bcount(size) __deref_in _Pre_ __deref __byte_readableTo(size) +#define __deref_in_xcount(size) __deref_in _Pre_ __deref __inexpressible_readableTo(size) +#define __deref_out_xcount(size) __deref_xcount(size) _Post_ __deref __valid __refparam +#define __deref_out_xcount_part(size,length) __deref_out_xcount(size) _Post_ __deref __inexpressible_readableTo(length) +#define __deref_out_xcount_full(size) __deref_out_xcount_part(size,size) +#define __deref_out_xcount(size) __deref_xcount(size) _Post_ __deref __valid __refparam +#define __deref_inout_xcount(size) __deref_inout _Pre_ __deref __inexpressible_writableTo(size) _Post_ __deref __inexpressible_writableTo(size) +#define __deref_inout_xcount_part(size,length) __deref_inout_xcount(size) _Pre_ __deref __inexpressible_readableTo(length) _Post_ __deref __inexpressible_readableTo(length) +#define __deref_inout_xcount_full(size) __deref_inout_xcount_part(size,size) +#define __deref_xcount_opt(size) __deref_xcount(size) _Post_ __deref __exceptthat __maybenull +#define __deref_in_opt __deref_in _Pre_ __deref __exceptthat __maybenull +#define __deref_in_opt_out __deref_inout _Pre_ __deref __exceptthat __maybenull _Post_ __deref __notnull +#define __deref_in_ecount_opt(size) __deref_in_ecount(size) _Pre_ __deref __exceptthat __maybenull +#define __deref_in_bcount_opt(size) __deref_in_bcount(size) _Pre_ __deref __exceptthat __maybenull +#define __deref_in_xcount_opt(size) __deref_in_xcount(size) _Pre_ __deref __exceptthat __maybenull +#define __deref_out_xcount_opt(size) __deref_out_xcount(size) _Post_ __deref __exceptthat __maybenull +#define __deref_out_xcount_part_opt(size,length) __deref_out_xcount_part(size,length) _Post_ __deref __exceptthat __maybenull +#define __deref_out_xcount_full_opt(size) __deref_out_xcount_full(size) _Post_ __deref __exceptthat __maybenull +#define __deref_inout_xcount_opt(size) __deref_inout_xcount(size) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull +#define __deref_inout_xcount_part_opt(size,length) __deref_inout_xcount_part(size,length) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull +#define __deref_inout_xcount_full_opt(size) __deref_inout_xcount_full(size) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull +#define __deref_opt_xcount(size) __deref_xcount(size) __exceptthat __maybenull +#define __deref_opt_in __deref_in __exceptthat __maybenull +#define __deref_opt_in_ecount(size) __deref_in_ecount(size) __exceptthat __maybenull +#define __deref_opt_in_bcount(size) __deref_in_bcount(size) __exceptthat __maybenull +#define __deref_opt_in_xcount(size) __deref_in_xcount(size) __exceptthat __maybenull +#define __deref_opt_out_xcount(size) __deref_out_xcount(size) __exceptthat __maybenull +#define __deref_opt_out_xcount_part(size,length) __deref_out_xcount_part(size,length) __exceptthat __maybenull +#define __deref_opt_out_xcount_full(size) __deref_out_xcount_full(size) __exceptthat __maybenull +#define __deref_opt_inout_xcount(size) __deref_inout_xcount(size) __exceptthat __maybenull +#define __deref_opt_inout_xcount_part(size,length) __deref_inout_xcount_part(size,length) __exceptthat __maybenull +#define __deref_opt_inout_xcount_full(size) __deref_inout_xcount_full(size) __exceptthat __maybenull +#define __deref_opt_xcount_opt(size) __deref_xcount_opt(size) __exceptthat __maybenull +#define __deref_opt_in_opt __deref_in_opt __exceptthat __maybenull +#define __deref_opt_in_ecount_opt(size) __deref_in_ecount_opt(size) __exceptthat __maybenull +#define __deref_opt_in_bcount_opt(size) __deref_in_bcount_opt(size) __exceptthat __maybenull +#define __deref_opt_in_xcount_opt(size) __deref_in_xcount_opt(size) __exceptthat __maybenull +#define __deref_opt_out_xcount_opt(size) __deref_out_xcount_opt(size) __exceptthat __maybenull +#define __deref_opt_out_xcount_part_opt(size,length) __deref_out_xcount_part_opt(size,length) __exceptthat __maybenull +#define __deref_opt_out_xcount_full_opt(size) __deref_out_xcount_full_opt(size) __exceptthat __maybenull +#define __deref_opt_inout_xcount_opt(size) __deref_inout_xcount_opt(size) __exceptthat __maybenull +#define __deref_opt_inout_xcount_part_opt(size,length) __deref_inout_xcount_part_opt(size,length) __exceptthat __maybenull +#define __deref_opt_inout_xcount_full_opt(size) __deref_inout_xcount_full_opt(size) __exceptthat __maybenull + +#define __deref_in_ecount_iterator(size, incr) __inout _Pre_ __deref __elem_readableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr) +#define __deref_out_ecount_iterator(size, incr) __inout _Pre_ __deref __elem_writableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr) +#define __deref_inout_ecount_iterator(size, incr) __inout _Pre_ __deref __elem_readableTo(size) _Pre_ __deref __elem_writableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr) + +#define __post_bcount(size) _Post_ __byte_writableTo(size) +#define __post_ecount(size) _Post_ __elem_writableTo(size) + +#define __deref_realloc_bcount(insize, outsize) __inout _Pre_ __deref __byte_readableTo(insize) _Post_ __deref __byte_writableTo(outsize) + +/* __in_ecount_or_z(c) specifies semantics like strncmp, where a string + * parameter is either null terminated, or valid up to c elements. + */ +#define __in_ecount_or_z(c) _When_(_String_length_(_Curr_) < (c), __in_z) \ + _When_(_String_length_(_Curr_) >= (c), __in_ecount(c)) + + +/* Provide default definition to be overridden when needed */ +#define __post_nullnullterminated + +/* Must protect redfinitions of macros to workaround rc.exe issues. */ +#ifndef RC_INVOKED + +#undef __nullnullterminated +#define __nullnullterminated __inexpressible_readableTo("string terminated by two nulls") __nullterminated + +#undef __post_nullnullterminated +#define __post_nullnullterminated _Post_ __inexpressible_readableTo("string terminated by two nulls") _Post_ __nullterminated + +#endif +#endif //__SAL_H_FULL_VER <= 140050727 + +/************************************************************************ + New extensions to sal.h follow here. +*************************************************************************/ #if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) +#define __file_parser(typ) _SA_annotes2(SAL_file_parser,"function",typ) +#define __file_parser_class(typ) _SA_annotes2(SAL_file_parser,"class",typ) +#define __file_parser_library(typ) extern int _SA_annotes2(SAL_file_parser, "library", typ) __iSALFileParserLibrary##typ; +#define __source_code_content(typ) extern int _SA_annotes1(SAL_source_code_content, typ) __iSAL_Source_Code_Content##typ; +#define __class_code_content(typ) _SA_annotes1(SAL_class_code_content, typ) +#define __analysis_assert(e) __assume(e) +#define __analysis_hint(hint) _SA_annotes1(SAL_analysisHint, hint) +// For "breakpoint": doesn't return as far as analysis is concerned. +#define __analysis_noreturn __declspec(noreturn) +/* Internal defintions */ #define __inner_data_source(src_raw) _SA_annotes1(SAL_untrusted_data_source,src_raw) -#define __out_data_source(src_sym) _Post_ __inner_data_source(#src_sym) -#define __analysis_noreturn __declspec(noreturn) +#define __inner_this_data_source(src_raw) _SA_annotes1(SAL_untrusted_data_source_this,src_raw) +#define __inner_out_validated(typ_raw) _Post_ _SA_annotes1(SAL_validated,typ_raw) +#define __inner_this_out_validated(typ_raw) _SA_annotes1(SAL_validated_this,typ_raw) +#define __inner_assume_validated_dec __inline __nothrow void __AssumeValidated(__inner_out_validated("BY_DESIGN") const void *p) {p;} +#define __inner_assume_validated(p) __AssumeValidated(p) +#define __inner_transfer(formal) _SA_annotes1(SAL_transfer_adt_property_from,formal) +#define __inner_encoded _SA_annotes0(SAL_encoded) + +#if defined(_MSC_EXTENSIONS) || defined(_PREFAST_) || defined(OACR) +#define __inner_adt_prop(adt,prop) _SA_annotes2(SAL_adt, adt,prop) +#define __inner_adt_add_prop(adt,prop) _SA_annotes2(SAL_add_adt_property,adt,prop) +#define __inner_adt_remove_prop(adt,prop) _SA_annotes2(SAL_remove_adt_property,adt,prop) +#define __inner_adt_transfer_prop(arg) _SA_annotes1(SAL_transfer_adt_property_from,arg) +#define __inner_adt_type_props(typ) _SA_annotes1(SAL_post_type,typ) +#define __inner_volatile _SA_annotes0(SAL_volatile) +#define __inner_nonvolatile _SA_annotes0(SAL_nonvolatile) +#define __inner_possibly_notnullterminated _SA_annotes1(SAL_nullTerminated,__maybe) +#define __inner_analysis_assume_nullterminated_dec __inline __nothrow void __AnalysisAssumeNullterminated(_Post_ __nullterminated void *p) {*(char*)p=0;} +#define __inner_analysis_assume_nullterminated(x) __AnalysisAssumeNullterminated(x); +#endif #else -#define __out_data_source(src_sym) +#define __file_parser(typ) +#define __file_parser_class(typ) +#define __file_parser_library(typ) +#define __source_code_content(typ) +#define __class_code_content(typ) +#define __analysis_assert(e) +#define __analysis_hint(hint) #define __analysis_noreturn +/* Internal defintions */ +#define __inner_data_source(src_raw) +#define __inner_this_data_source(src_raw) +#define __inner_out_validated(typ_raw) +#define __inner_this_out_validated(typ_raw) +#define __inner_assume_validated_dec +#define __inner_assume_validated(p) +#define __inner_transfer(formal) +#define __inner_encoded +#define __inner_adt_prop(adt,prop) +#define __inner_adt_add_prop(adt,prop) +#define __inner_adt_remove_prop(adt,prop) +#define __inner_adt_transfer_prop(arg) +#define __inner_adt_type_props(typ) +#define __inner_volatile +#define __inner_nonvolatile +#define __inner_possibly_notnullterminated +#define __inner_analysis_assume_nullterminated_dec +#define __inner_analysis_assume_nullterminated(x) +#endif // #if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) + +#define __field_ecount(size) __notnull __elem_writableTo(size) +#define __field_bcount(size) __notnull __byte_writableTo(size) +#define __field_xcount(size) __notnull __inexpressible_writableTo(size) + +#define __field_ecount_opt(size) __maybenull __elem_writableTo(size) +#define __field_bcount_opt(size) __maybenull __byte_writableTo(size) +#define __field_xcount_opt(size) __maybenull __inexpressible_writableTo(size) + +#define __field_ecount_part(size,init) __notnull __elem_writableTo(size) __elem_readableTo(init) +#define __field_bcount_part(size,init) __notnull __byte_writableTo(size) __byte_readableTo(init) +#define __field_xcount_part(size,init) __notnull __inexpressible_writableTo(size) __inexpressible_readableTo(init) + +#define __field_ecount_part_opt(size,init) __maybenull __elem_writableTo(size) __elem_readableTo(init) +#define __field_bcount_part_opt(size,init) __maybenull __byte_writableTo(size) __byte_readableTo(init) +#define __field_xcount_part_opt(size,init) __maybenull __inexpressible_writableTo(size) __inexpressible_readableTo(init) + +#define __field_ecount_full(size) __field_ecount_part(size,size) +#define __field_bcount_full(size) __field_bcount_part(size,size) +#define __field_xcount_full(size) __field_xcount_part(size,size) + +#define __field_ecount_full_opt(size) __field_ecount_part_opt(size,size) +#define __field_bcount_full_opt(size) __field_bcount_part_opt(size,size) +#define __field_xcount_full_opt(size) __field_xcount_part_opt(size,size) + +#define __field_nullterminated __nullterminated + +#define __struct_bcount(size) __byte_writableTo(size) +#define __struct_xcount(size) __inexpressible_writableTo(size) + +#define __out_awcount(expr,size) _Pre_ __notnull \ + __byte_writableTo((expr) ? (size) : (size) * 2) \ + _Post_ __valid __refparam +#define __in_awcount(expr,size) _Pre_ __valid \ + _Pre_ _Notref_ __deref __readonly \ + __byte_readableTo((expr) ? (size) : (size) * 2) +#define __post_invalid _Post_ __notvalid +/* integer related macros */ +#define __allocator __inner_allocator +#ifndef PAL_STDCPP_COMPAT +#define __deallocate(kind) _Pre_ __notnull __post_invalid +#define __deallocate_opt(kind) _Pre_ __maybenull __post_invalid #endif +#define __bound __inner_bound +#define __range(lb,ub) __inner_range(lb,ub) +#define __in_bound _Pre_ __inner_bound +#define __out_bound _Post_ __inner_bound +#define __deref_out_bound _Post_ __deref __inner_bound +#define __in_range(lb,ub) _Pre_ __inner_range(lb,ub) +#define __out_range(lb,ub) _Post_ __inner_range(lb,ub) +#define __deref_in_range(lb,ub) _Pre_ __deref __inner_range(lb,ub) +#define __deref_out_range(lb,ub) _Post_ __deref __inner_range(lb,ub) +#define __deref_inout_range(lb,ub) __deref_in_range(lb,ub) __deref_out_range(lb,ub) +#define __field_range(lb,ub) __range(lb,ub) +#define __field_data_source(src_sym) __inner_data_source(#src_sym) -#if defined(_PREFAST_) && defined(_PFT_SHOULD_CHECK_RETURN) -#define _Check_return_opt_ _Check_return_ +#define __range_max(a,b) __range(==, a > b ? a : b) +#define __range_min(a,b) __range(==, a < b ? a : b) + + +/* Penetration review macros */ +#define __in_data_source(src_sym) _Pre_ __inner_data_source(#src_sym) +#define __out_data_source(src_sym) _Post_ __inner_data_source(#src_sym) +#define __out_validated(typ_sym) __inner_out_validated(#typ_sym) +#define __this_out_data_source(src_sym) __inner_this_data_source(#src_sym) +#define __this_out_validated(typ_sym) __inner_this_out_validated(#typ_sym) +#define __transfer(formal) _Post_ __inner_transfer(formal) +#define __rpc_entry __inner_control_entrypoint(RPC) +#define __kernel_entry __inner_control_entrypoint(UserToKernel) +#define __gdi_entry __inner_control_entrypoint(GDI) +#define __encoded_pointer __inner_encoded +#define __encoded_array __inner_encoded +#define __field_encoded_pointer __inner_encoded +#define __field_encoded_array __inner_encoded +#if defined(_MSC_EXTENSIONS) || defined(_PREFAST_) || defined(OACR) +#define __type_has_adt_prop(adt,prop) __inner_adt_prop(adt,prop) +#define __out_has_adt_prop(adt,prop) _Post_ __inner_adt_add_prop(adt,prop) +#define __out_not_has_adt_prop(adt,prop) _Post_ __inner_adt_remove_prop(adt,prop) +#define __out_transfer_adt_prop(arg) _Post_ __inner_adt_transfer_prop(arg) +#define __out_has_type_adt_props(typ) _Post_ __inner_adt_type_props(typ) + +/* useful PFD related macros */ +#define __possibly_notnullterminated __inner_possibly_notnullterminated + +/* Windows Internal */ +#define __volatile __inner_volatile +#define __nonvolatile __inner_nonvolatile #else -#define _Check_return_opt_ +#define __out_has_type_adt_props(typ) /* nothing */ +#endif +#define __deref_volatile __deref __volatile +#define __deref_nonvolatile __deref __nonvolatile + +/* declare stub functions for macros */ +__inner_assume_validated_dec +__inner_assume_bound_dec +__inner_analysis_assume_nullterminated_dec +#define __analysis_assume_nullterminated(x) __inner_analysis_assume_nullterminated(x) +#define __assume_validated(p) __inner_assume_validated(p) +#define __assume_bound(i) __inner_assume_bound(i) + + +/************************************************************************** +* SAL 2 extensions for Windows-specific APIs. +***************************************************************************/ + +// Annotation for parameters that are not used in any way by the function. +// Unlike _Reserved_, an _Unreferenced_parameter_ pointer need not be NULL. +#ifndef _Unreferenced_parameter_ +#define _Unreferenced_parameter_ _Const_ #endif -#if defined(_PREFAST_) && defined(_PFT_SHOULD_CHECK_RETURN_WAT) -#define _Check_return_wat_ _Check_return_ -#else -#define _Check_return_wat_ +// Pointer parameters that are freed by the function, and thus the pointed-to +// memory should not be used after return. +#ifndef _Frees_ptr_ +#define _Frees_ptr_ _Pre_notnull_ _Post_ptr_invalid_ #endif +#ifndef _Frees_ptr_opt_ +#define _Frees_ptr_opt_ _Pre_maybenull_ _Post_ptr_invalid_ +#endif + +// NLS APIs allow strings to be specified either by an element count or +// null termination. Unlike _In_reads_or_z_, this is not whichever comes +// first, but based on whether the size is negative or not. +#define _In_NLS_string_(size) _When_((size) < 0, _In_z_) \ + _When_((size) >= 0, _In_reads_(size)) + + +// Minifilter CompletionContext parameters on the pre-operation callback +// default to NULL. For return type FLT_PREOP_SUCCESS_WITH_CALLBACK or +// FLT_PREOP_SYNCHRONIZE, it may be set to NULL or a valid pointer. For all +// other returns, it must be NULL. +#define _Flt_CompletionContext_Outptr_ \ + _Outptr_result_maybenull_ _Pre_valid_ \ + _At_(*_Curr_, _Pre_null_ \ + _When_(return != FLT_PREOP_SUCCESS_WITH_CALLBACK && return != FLT_PREOP_SYNCHRONIZE, _Post_null_)) + +// Minifilter ConnectionCookie parameters on the port connect notify callback +// default to NULL. On successful return, it may be set to NULL or non-NULL, +// but it must be NULL on failure. +#define _Flt_ConnectionCookie_Outptr_ \ + _Outptr_result_maybenull_ _Pre_valid_ \ + _At_(*_Curr_, _Pre_null_ _On_failure_(_Post_null_)) + + +// +// A common pattern is to pass an "_Inout_ PCHAR* ppBuf" of size "_Inout_ DWORD* pSize" +// to a function that writes to **pBuf, incrementing *ppBuf to point to one +// past the last written byte. Thus the length of the write is +// (*ppBuf - Old(*ppBuf)). The size of the remaining unwritten capacity +// is written to *pSize. +// +// This pattern is frequently used when progressively filling a +// large buffer in chunks +// (e.g. when reading from a network interface in a driver). +// +// It is expected that these supplementary annotations would be used inside an +// _At_, like so: +// +// _At_(*ppBuf, _Writes_and_advances_ptr_(*pBufSize)) +// HRESULT WriteChunkOfData(_Inout_ PCHAR* ppBuf, _Inout_ DWORD* pBufSize); +// +#ifndef _Writes_and_advances_ptr_ +#define _Writes_and_advances_ptr_(size) \ + _At_((void*)_Curr_, _Inout_) \ + _At_(_Curr_, \ + _Pre_writable_size_(size) \ + _Post_writable_size_(size) \ + _Post_satisfies_(_Curr_ - _Old_(_Curr_) == size)) \ + _At_(_Old_(_Curr_), \ + _Post_readable_size_(_Old_(size) - size)) +#endif + +#ifndef _Writes_bytes_and_advances_ptr_ +#define _Writes_bytes_and_advances_ptr_(size) \ + _At_((void*)_Curr_, _Inout_) \ + _At_(_Curr_, \ + _Pre_writable_byte_size_(size) \ + _Post_writable_byte_size_(size) \ + _Post_satisfies_(((char*)_Curr_) - ((void*)_Old_(_Curr_)) == size)) \ + _At_(_Old_(_Curr_), \ + _Post_readable_byte_size_(_Old_(size) - size)) +#endif + +// +// Gets the current error code (as returned by GetLastError()), and stores +// in _Curr_ as a postcondition. This is currently approximated by assuming +// that GetLastError() always returns a failed error code. This is not a +// completely accurate approximation, but reasonable. +// +#define _Post_equals_last_error_ _Post_satisfies_(_Curr_ != 0) + +#ifdef __cplusplus +} +#endif + +#ifdef _PREFIX_ +/************************************************************************** +* Defintion of __pfx_assume and __pfx_assert. Thse should be the only +* defintions of these functions. +***************************************************************************/ +#if __cplusplus +extern "C" void __pfx_assert(bool, const char *); +extern "C" void __pfx_assume(bool, const char *); +#else +void __pfx_assert(int, const char *); +void __pfx_assume(int, const char *); +#endif +/************************************************************************** +* Redefintion of __analysis_assume and __analysis_assert for PREFIX build +**************************************************************************/ +#undef __analysis_assume +#undef __analysis_assert +#define __analysis_assume(e) (__pfx_assume(e,"pfx_assume"),__assume(e)); +#define __analysis_assert(e) (__pfx_assert(e,"pfx_assert"),__assume(e)); +#endif /* ifdef _PREFIX_ */ + +/************************************************************************** +* This include should always be the last thing in this file. +* Must avoid redfinitions of macros to workaround rc.exe issues. +***************************************************************************/ +#if !(defined(RC_INVOKED) || defined(SORTPP_PASS)) +#include +#endif /* if !(defined(RC_INVOKED) || defined(SORTPP_PASS)) */ + +/* + If no SAL 2 appears to have been defined (_Outptr_ is a representative choice) + then we must be operating in a downlevel build environment (such as VS10). + We also test against the compiler version to identify a downlevel environment, + as VS11 is the minimum required for SAL 2 support. + + If we are operating in a downlevel build environment (such as VS10) + we need to undefine the following symbols before including driverspecs.h + or we will end up referencing SAL 2 implementation symbols and cause + build failures. +*/ +#if (!defined(_Outptr_) || _MSC_VER <= 1600) && !( defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) ) /*IFSTRIP=IGN*/ +#undef __ANNOTATION +#define __ANNOTATION(fun) /* fun */ +#undef __PRIMOP +#define __PRIMOP(type, fun) +#endif /* !defined(_Outptr_) || _MSC_VER <= 1600 */ + +// ROTOR doesn't need driverspecs.h +// #include + +/* + If no SAL 2 appears to have been defined (_Outptr_ is a representative choice) + then we must be operating in a downlevel build environment (such as VS10). + We also test against the compiler version to identify a downlevel environment, + as VS11 is the minimum required for SAL 2 support. + + If we are in a downlevel environment, we can go ahead and include no_sal2.h + to make all of SAL 2 no-ops to ensure no build failures. +*/ +#if (!defined(_Outptr_) /* || _MSC_VER <= 1600 */) && !( defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) ) && !( defined( _SDV_ ) ) /*IFSTRIP=IGN*/ +#include +#endif /* !defined(_Outptr_) || _MSC_VER <= 1600 */ + +#endif /* #ifndef SPECSTRINGS_H */ + + diff --git a/sdk/include/psdk/specstrings_strict.h b/sdk/include/psdk/specstrings_strict.h new file mode 100644 index 00000000000..a458a0d98fd --- /dev/null +++ b/sdk/include/psdk/specstrings_strict.h @@ -0,0 +1,1198 @@ +/* + * PROJECT: ReactOS PSDK + * LICENSE: MIT (https://spdx.org/licenses/MIT) + * PURPOSE: Documents all the macros approved for use in windows source + * COPYRIGHT: Microsoft Corporation. + * SOURCE: https://github.com/microsoft/ChakraCore/blob/master/pal/inc/rt/specstrings_strict.h + */ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +/************************************************************************* +* This file documents all the macros approved for use in windows source +* code. It includes some experimental macros which should only be used by +* experts. +* +* DO NOT include this file directly. This file is include after +* specstrings.h. So we can undefine every possible old definition including +* private internal macros people should not be using, as well as macros from +* sal.h. Macros are redefined here in a way to cause syntax errors when used +* incorrectly during a normal build when specstrings.h is included and +* __SPECSTRINGS_STRICT_LEVEL is defined. +* +* There are several levels of strictness, each level includes the behavior of +* all previous levels. +* +* 0 - Disable strict checking +* 1 - Break on unapproved macros and misuse of statement +* macros such as __fallthrough (default) +* 2 - Deprecated some old macros that should not be used +* 3 - Use VS 2005 Source Annotation to make sure every macro +* is used in the right context. For example placing __in on a return +* parameter will result in an error. +* + +* +************************************************************************/ +#ifndef __SPECSTRINGS_STRICT_LEVEL +#define __SPECSTRINGS_STRICT_LEVEL 1 +#endif +/************************************************************************ +* Introduction +* +* specstrings.h provides a set of annotations to describe how a function uses +* its parameters - the assumptions it makes about them, and the guarantees it +* makes upon finishing. +* +* Annotations must be placed before a function parameter's type or its return +* type. There are two basic classes of common annotations buffer annotations +* and advanced annotations. Buffer annotations describe how functions use +* their pointer parameters, and advanced annotations either describe +* complex/unusual buffer behavior, or provide additional information about a +* parameter that is not otherwise expressible. +* +* Buffer Annotations +* +* The most important annotations in SpecStrings.h provide a consistent way to +* annotate buffer parameters or return values for a function. Each of these +* annotations describes a single buffer (which could be a string, a +* fixed-length or variable-length array, or just a pointer) that the function +* interacts with: where it is, how large it is, how much is initialized, and +* what the function does with it. +* +* The appropriate macro for a given buffer can be constructed using the table +* below. Just pick the appropriate values from each category, and combine +* them together with a leading underscore. Some combinations of values do not +* make sense as buffer annotations. Only meaningful annotations can be added +* to your code; for a list of these, see the buffer annotation definitions +* section. +* +* Only a single buffer annotation should be used for each parameter. +* +* |------------|------------|---------|--------|----------|---------------| +* | Level | Usage | Size | Output | Optional | Parameters | +* |------------|------------|---------|--------|----------|---------------| +* | <> | <> | <> | <> | <> | <> | +* | _deref | _in | _ecount | _full | _opt | (size) | +* | _deref_opt | _out | _bcount | _part | | (size,length) | +* | | _inout | | | | | +* | | | | | | | +* |------------|------------|---------|--------|----------|---------------| +* +* Note: "<>" represents the empty string. +* +* Level: Describes the buffer pointer's level of indirection from the +* parameter or return value 'p'. +* +* <> : p is the buffer pointer. +* _deref : *p is the buffer pointer. p must not be NULL. +* _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the +* rest of the annotation is ignored. +* +* Usage: Describes how the function uses the buffer. +* +* <> : The buffer is not accessed. If used on the return value or with +* _deref, the function will provide the buffer, and it will be uninitialized +* at exit. Otherwise, the caller must provide the buffer. This should only +* be used for alloc and free functions. +* +* _in : The function will only read from the buffer. The caller must provide +* the buffer and initialize it. +* +* _out : The function will only write to the buffer. If used on the return +* value or with _deref, the function will provide the buffer and initialize +* it. Otherwise, the caller must provide the buffer, and the function will +* initialize it. +* +* _inout : The function may freely read from and write to the buffer. The +* caller must provide the buffer and initialize it. If used with _deref, the +* buffer may be reallocated by the function. +* +* Size: Describes the total size of the buffer. This may be less than the +* space actually allocated for the buffer, in which case it describes the +* accessible amount. +* +* <> : No buffer size is given. If the type specifies the buffer size (such +* as with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is +* one element long. Must be used with _in, _out, or _inout. +* +* _ecount : The buffer size is an explicit element count. +* +* _bcount : The buffer size is an explicit byte count. +* +* Output: Describes how much of the buffer will be initialized by the +* function. For _inout buffers, this also describes how much is initialized +* at entry. Omit this category for _in buffers; they must be fully +* initialized by the caller. +* +* <> : The type specifies how much is initialized. For instance, a function +* initializing an LPWSTR must NULL-terminate the string. +* +* _full : The function initializes the entire buffer. +* +* _part : The function initializes part of the buffer, and explicitly +* indicates how much. +* +* Optional: Describes if the buffer itself is optional. +* +* <> : The pointer to the buffer must not be NULL. +* +* _opt : The pointer to the buffer might be NULL. It will be checked before +* being dereferenced. +* +* Parameters: Gives explicit counts for the size and length of the buffer. +* +* <> : There is no explicit count. Use when neither _ecount nor _bcount is +* used. +* +* (size) : Only the buffer's total size is given. Use with _ecount or _bcount +* but not _part. +* +* (size,length) : The buffer's total size and initialized length are +* given. Use with _ecount_part and _bcount_part. +* +* ---------------------------------------------------------------------------- +* Buffer Annotation Examples +* +* LWSTDAPI_(BOOL) StrToIntExA( +* LPCSTR pszString, // No annotation required, const implies __in. +* DWORD dwFlags, +* __out int *piRet // A pointer whose dereference will be filled in. +* ); +* +* void MyPaintingFunction( +* __in HWND hwndControl, // An initialized read-only parameter. +* __in_opt HDC hdcOptional, // An initialized read-only parameter that +* // might be NULL. +* __inout IPropertyStore *ppsStore // An initialized parameter that +* // may be freely used and modified. +* ); +* +* LWSTDAPI_(BOOL) PathCompactPathExA( +* __out_ecount(cchMax) LPSTR pszOut, // A string buffer with cch elements +* // that will be '\0' terminated +* // on exit. +* LPCSTR pszSrc, // No annotation required, +* // const implies __in. +* UINT cchMax, +* DWORD dwFlags +* ); +* +* HRESULT SHLocalAllocBytes( +* size_t cb, +* __deref_bcount(cb) T **ppv // A pointer whose dereference will be set +* // to an uninitialized buffer with cb bytes. +* ); +* +* __inout_bcount_full(cb) : A buffer with cb elements that is fully +* initialized at entry and exit, and may be written to by this function. +* +* __out_ecount_part(count, *countOut) : A buffer with count elements that +* will be partially initialized by this function. The function indicates how +* much it initialized by setting *countOut. +* +************************************************************************/ + +#if (_MSC_VER >= 1400) && !defined(__midl) && !defined(_PREFAST_) && (__SPECSTRINGS_STRICT_LEVEL > 0) +#pragma once +#include +#define __ecount(size) _SAL_VERSION_CHECK(__ecount) +#define __bcount(size) _SAL_VERSION_CHECK(__bcount) +#define __xcount(size) _SAL_VERSION_CHECK(__xcount) +#define __in _SAL_VERSION_CHECK(__in) +#define __in_ecount(size) _SAL_VERSION_CHECK(__in_ecount) +#define __in_bcount(size) _SAL_VERSION_CHECK(__in_bcount) +#define __in_xcount(size) _SAL_VERSION_CHECK(__in_xcount) +#define __in_z _SAL_VERSION_CHECK(__in_z) +#define __in_ecount_z(size) _SAL_VERSION_CHECK(__in_ecount_z) +#define __in_bcount_z(size) _SAL_VERSION_CHECK(__in_bcount_z) +#define __out _SAL_VERSION_CHECK(__out) +#define __out_ecount(size) _SAL_VERSION_CHECK(__out_ecount) +#define __out_bcount(size) _SAL_VERSION_CHECK(__out_bcount) +#define __out_xcount(size) _SAL_VERSION_CHECK(__out_xcount) +#define __out_ecount_part(size,len) _SAL_VERSION_CHECK(__out_ecount_part) +#define __out_bcount_part(size,len) _SAL_VERSION_CHECK(__out_bcount_part) +#define __out_xcount_part(size,len) _SAL_VERSION_CHECK(__out_xcount_part) +#define __out_ecount_full(size) _SAL_VERSION_CHECK(__out_ecount_full) +#define __out_bcount_full(size) _SAL_VERSION_CHECK(__out_bcount_full) +#define __out_xcount_full(size) _SAL_VERSION_CHECK(__out_xcount_full) +#define __out_z _SAL_VERSION_CHECK(__out_z) +#define __out_ecount_z(size) _SAL_VERSION_CHECK(__out_ecount_z) +#define __out_bcount_z(size) _SAL_VERSION_CHECK(__out_bcount_z) +#define __inout _SAL_VERSION_CHECK(__inout) +#define __inout_ecount(size) _SAL_VERSION_CHECK(__inout_ecount) +#define __inout_bcount(size) _SAL_VERSION_CHECK(__inout_bcount) +#define __inout_xcount(size) _SAL_VERSION_CHECK(__inout_xcount) +#define __inout_ecount_part(size,len) _SAL_VERSION_CHECK(__inout_ecount_part) +#define __inout_bcount_part(size,len) _SAL_VERSION_CHECK(__inout_bcount_part) +#define __inout_xcount_part(size,len) _SAL_VERSION_CHECK(__inout_xcount_part) +#define __inout_ecount_full(size) _SAL_VERSION_CHECK(__inout_ecount_full) +#define __inout_bcount_full(size) _SAL_VERSION_CHECK(__inout_bcount_full) +#define __inout_xcount_full(size) _SAL_VERSION_CHECK(__inout_xcount_full) +#define __inout_z __allowed(on_parameter) +#define __inout_ecount_z(size) __allowed(on_parameter) +#define __inout_bcount_z(size) __allowed(on_parameter) +#define __ecount_opt(size) __allowed(on_parameter) +#define __bcount_opt(size) __allowed(on_parameter) +#define __xcount_opt(size) __allowed(on_parameter) +#define __in_opt _SAL_VERSION_CHECK(__in_opt) +#define __in_ecount_opt(size) _SAL_VERSION_CHECK(__in_ecount_opt) +#define __in_bcount_opt(size) _SAL_VERSION_CHECK(__in_bcount_opt) +#define __in_z_opt __allowed(on_parameter) +#define __in_ecount_z_opt(size) __allowed(on_parameter) +#define __in_bcount_z_opt(size) __allowed(on_parameter) +#define __in_xcount_opt(size) __allowed(on_parameter) +#define __out_opt _SAL_VERSION_CHECK(__out_opt) +#define __out_ecount_opt(size) _SAL_VERSION_CHECK(__out_ecount_opt) +#define __out_bcount_opt(size) _SAL_VERSION_CHECK(__out_bcount_opt) +#define __out_xcount_opt(size) __allowed(on_parameter) +#define __out_ecount_part_opt(size,len) __allowed(on_parameter) +#define __out_bcount_part_opt(size,len) __allowed(on_parameter) +#define __out_xcount_part_opt(size,len) __allowed(on_parameter) +#define __out_ecount_full_opt(size) __allowed(on_parameter) +#define __out_bcount_full_opt(size) __allowed(on_parameter) +#define __out_xcount_full_opt(size) __allowed(on_parameter) +#define __out_ecount_z_opt(size) __allowed(on_parameter) +#define __out_bcount_z_opt(size) __allowed(on_parameter) +#define __inout_opt _SAL_VERSION_CHECK(__inout_opt) +#define __inout_ecount_opt(size) _SAL_VERSION_CHECK(__inout_ecount_opt) +#define __inout_bcount_opt(size) _SAL_VERSION_CHECK(__inout_bcount_opt) +#define __inout_xcount_opt(size) _SAL_VERSION_CHECK(__inout_xcount_opt) +#define __inout_ecount_part_opt(size,len) _SAL_VERSION_CHECK(__inout_ecount_part_opt) +#define __inout_bcount_part_opt(size,len) _SAL_VERSION_CHECK(__inout_bcount_part_opt) +#define __inout_xcount_part_opt(size,len) _SAL_VERSION_CHECK(__inout_xcount_part_opt) +#define __inout_ecount_full_opt(size) _SAL_VERSION_CHECK(__inout_ecount_full_opt) +#define __inout_bcount_full_opt(size) _SAL_VERSION_CHECK(__inout_bcount_full_opt) +#define __inout_xcount_full_opt(size) _SAL_VERSION_CHECK(__inout_xcount_full_opt) +#define __inout_z_opt __allowed(on_parameter) +#define __inout_ecount_z_opt(size) __allowed(on_parameter) +#define __inout_ecount_z_opt(size) __allowed(on_parameter) +#define __inout_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_ecount(size) __allowed(on_parameter) +#define __deref_bcount(size) __allowed(on_parameter) +#define __deref_xcount(size) __allowed(on_parameter) +#define __deref_in _SAL_VERSION_CHECK(__deref_in) +#define __deref_in_ecount(size) _SAL_VERSION_CHECK(__deref_in_ecount) +#define __deref_in_bcount(size) _SAL_VERSION_CHECK(__deref_in_bcount) +#define __deref_in_xcount(size) _SAL_VERSION_CHECK(__deref_in_xcount) +#define __deref_out _SAL_VERSION_CHECK(__deref_out) +#define __deref_out_ecount(size) _SAL_VERSION_CHECK(__deref_out_ecount) +#define __deref_out_bcount(size) _SAL_VERSION_CHECK(__deref_out_bcount) +#define __deref_out_xcount(size) _SAL_VERSION_CHECK(__deref_out_xcount) +#define __deref_out_ecount_part(size,len) _SAL_VERSION_CHECK(__deref_out_ecount_part) +#define __deref_out_bcount_part(size,len) _SAL_VERSION_CHECK(__deref_out_bcount_part) +#define __deref_out_xcount_part(size,len) _SAL_VERSION_CHECK(__deref_out_xcount_part) +#define __deref_out_ecount_full(size) _SAL_VERSION_CHECK(__deref_out_ecount_full) +#define __deref_out_bcount_full(size) _SAL_VERSION_CHECK(__deref_out_bcount_full) +#define __deref_out_xcount_full(size) _SAL_VERSION_CHECK(__deref_out_xcount_full) +#define __deref_out_z __allowed(on_parameter) +#define __deref_out_ecount_z(size) __allowed(on_parameter) +#define __deref_out_bcount_z(size) __allowed(on_parameter) +#define __deref_inout _SAL_VERSION_CHECK(__deref_inout) +#define __deref_inout_ecount(size) _SAL_VERSION_CHECK(__deref_inout_ecount) +#define __deref_inout_bcount(size) _SAL_VERSION_CHECK(__deref_inout_bcount) +#define __deref_inout_xcount(size) _SAL_VERSION_CHECK(__deref_inout_xcount) +#define __deref_inout_ecount_part(size,len) __allowed(on_parameter) +#define __deref_inout_bcount_part(size,len) __allowed(on_parameter) +#define __deref_inout_xcount_part(size,len) __allowed(on_parameter) +#define __deref_inout_ecount_full(size) __allowed(on_parameter) +#define __deref_inout_bcount_full(size) __allowed(on_parameter) +#define __deref_inout_xcount_full(size) __allowed(on_parameter) +#define __deref_inout_z __allowed(on_parameter) +#define __deref_inout_ecount_z(size) __allowed(on_parameter) +#define __deref_inout_bcount_z(size) __allowed(on_parameter) +#define __deref_ecount_opt(size) __allowed(on_parameter) +#define __deref_bcount_opt(size) __allowed(on_parameter) +#define __deref_xcount_opt(size) __allowed(on_parameter) +#define __deref_in_opt __allowed(on_parameter) +#define __deref_in_opt_out __allowed(on_parameter) +#define __deref_in_ecount_opt(size) __allowed(on_parameter) +#define __deref_in_bcount_opt(size) __allowed(on_parameter) +#define __deref_in_xcount_opt(size) __allowed(on_parameter) +#define __deref_out_opt _SAL_VERSION_CHECK(__deref_out_opt) +#define __deref_out_ecount_opt(size) _SAL_VERSION_CHECK(__deref_out_ecount_opt) +#define __deref_out_bcount_opt(size) _SAL_VERSION_CHECK(__deref_out_bcount_opt) +#define __deref_out_xcount_opt(size) _SAL_VERSION_CHECK(__deref_out_xcount_opt) +#define __deref_out_ecount_part_opt(size,len) _SAL_VERSION_CHECK(__deref_out_ecount_part_opt) +#define __deref_out_bcount_part_opt(size,len) _SAL_VERSION_CHECK(__deref_out_bcount_part_opt) +#define __deref_out_xcount_part_opt(size,len) _SAL_VERSION_CHECK(__deref_out_xcount_part_opt) +#define __deref_out_ecount_full_opt(size) _SAL_VERSION_CHECK(__deref_out_ecount_full_opt) +#define __deref_out_bcount_full_opt(size) _SAL_VERSION_CHECK(__deref_out_bcount_full_opt) +#define __deref_out_xcount_full_opt(size) _SAL_VERSION_CHECK(__deref_out_xcount_full_opt) +#define __deref_out_z_opt __allowed(on_parameter) +#define __deref_out_ecount_z_opt(size) __allowed(on_parameter) +#define __deref_out_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_inout_opt __allowed(on_parameter) +#define __deref_inout_ecount_opt(size) __allowed(on_parameter) +#define __deref_inout_bcount_opt(size) __allowed(on_parameter) +#define __deref_inout_xcount_opt(size) __allowed(on_parameter) +#define __deref_inout_ecount_part_opt(size,len) __allowed(on_parameter) +#define __deref_inout_bcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_inout_xcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_inout_ecount_full_opt(size) __allowed(on_parameter) +#define __deref_inout_bcount_full_opt(size) __allowed(on_parameter) +#define __deref_inout_xcount_full_opt(size) __allowed(on_parameter) +#define __deref_inout_z_opt __allowed(on_parameter) +#define __deref_inout_ecount_z_opt(size) __allowed(on_parameter) +#define __deref_inout_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_opt_ecount(size) __allowed(on_parameter) +#define __deref_opt_bcount(size) __allowed(on_parameter) +#define __deref_opt_xcount(size) __allowed(on_parameter) +#define __deref_opt_in __allowed(on_parameter) +#define __deref_opt_in_ecount(size) __allowed(on_parameter) +#define __deref_opt_in_bcount(size) __allowed(on_parameter) +#define __deref_opt_in_xcount(size) __allowed(on_parameter) +#define __deref_opt_out _SAL_VERSION_CHECK(__deref_opt_out) +#define __deref_opt_out_ecount(size) _SAL_VERSION_CHECK(__deref_opt_out_ecount) +#define __deref_opt_out_bcount(size) _SAL_VERSION_CHECK(__deref_opt_out_bcount) +#define __deref_opt_out_xcount(size) _SAL_VERSION_CHECK(__deref_opt_out_xcount) +#define __deref_opt_out_ecount_part(size,len) __allowed(on_parameter) +#define __deref_opt_out_bcount_part(size,len) __allowed(on_parameter) +#define __deref_opt_out_xcount_part(size,len) __allowed(on_parameter) +#define __deref_opt_out_ecount_full(size) __allowed(on_parameter) +#define __deref_opt_out_bcount_full(size) __allowed(on_parameter) +#define __deref_opt_out_xcount_full(size) __allowed(on_parameter) +#define __deref_opt_inout __allowed(on_parameter) +#define __deref_opt_inout_ecount(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount(size) __allowed(on_parameter) +#define __deref_opt_inout_xcount(size) __allowed(on_parameter) +#define __deref_opt_inout_ecount_part(size,len) __allowed(on_parameter) +#define __deref_opt_inout_bcount_part(size,len) __allowed(on_parameter) +#define __deref_opt_inout_xcount_part(size,len) __allowed(on_parameter) +#define __deref_opt_inout_ecount_full(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_full(size) __allowed(on_parameter) +#define __deref_opt_inout_xcount_full(size) __allowed(on_parameter) +#define __deref_opt_inout_z __allowed(on_parameter) +#define __deref_opt_inout_ecount_z(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_z(size) __allowed(on_parameter) +#define __deref_opt_ecount_opt(size) __allowed(on_parameter) +#define __deref_opt_bcount_opt(size) __allowed(on_parameter) +#define __deref_opt_xcount_opt(size) __allowed(on_parameter) +#define __deref_opt_in_opt __allowed(on_parameter) +#define __deref_opt_in_ecount_opt(size) __allowed(on_parameter) +#define __deref_opt_in_bcount_opt(size) __allowed(on_parameter) +#define __deref_opt_in_xcount_opt(size) __allowed(on_parameter) +#define __deref_opt_out_opt __allowed(on_parameter) +#define __deref_opt_out_ecount_opt(size) __allowed(on_parameter) +#define __deref_opt_out_bcount_opt(size) __allowed(on_parameter) +#define __deref_opt_out_xcount_opt(size) __allowed(on_parameter) +#define __deref_opt_out_ecount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_out_bcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_out_xcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_out_ecount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_out_bcount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_out_xcount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_out_z_opt __allowed(on_parameter) +#define __deref_opt_out_ecount_z_opt(size) __allowed(on_parameter) +#define __deref_opt_out_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_opt __allowed(on_parameter) +#define __deref_opt_inout_ecount_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_xcount_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_ecount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_inout_bcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_inout_xcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_inout_ecount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_xcount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_z_opt __allowed(on_parameter) +#define __deref_opt_inout_ecount_z_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_in_ecount_iterator(size,incr) __allowed(on_parameter) +#define __deref_out_ecount_iterator(size,incr) __allowed(on_parameter) +#define __deref_inout_ecount_iterator(size,incr) __allowed(on_parameter) +#define __deref_realloc_bcount(insize,outsize) __allowed(on_parameter) + +/************************************************************************ +* SAL 2 _Ouptr_ family of annotations +************************************************************************/ + +#define _Outptr_ __allowed(on_parameter) +#define _Outptr_result_maybenull_ __allowed(on_parameter) +#define _Outptr_opt_ __allowed(on_parameter) +#define _Outptr_opt_result_maybenull_ __allowed(on_parameter) +#define _Outptr_result_z_ __allowed(on_parameter) +#define _Outptr_opt_result_z_ __allowed(on_parameter) +#define _Outptr_result_maybenull_z_ __allowed(on_parameter) +#define _Outptr_opt_result_maybenull_z_ __allowed(on_parameter) +#define _Outptr_result_nullonfailure_ __allowed(on_parameter) +#define _Outptr_opt_result_nullonfailure_ __allowed(on_parameter) +#define _COM_Outptr_ __allowed(on_parameter) +#define _COM_Outptr_result_maybenull_ __allowed(on_parameter) +#define _COM_Outptr_opt_ __allowed(on_parameter) +#define _COM_Outptr_opt_result_maybenull_ __allowed(on_parameter) +#define _Outptr_result_buffer_(size) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_(size) __allowed(on_parameter) +#define _Outptr_result_buffer_to_(size, count) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_to_(size, count) __allowed(on_parameter) +#define _Outptr_result_buffer_all_(size) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_all_(size) __allowed(on_parameter) +#define _Outptr_result_buffer_maybenull_(size) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_maybenull_(size) __allowed(on_parameter) +#define _Outptr_result_buffer_to_maybenull_(size, count) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_to_maybenull_(size, count) __allowed(on_parameter) +#define _Outptr_result_buffer_all_maybenull_(size) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_all_maybenull_(size) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_(size) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_(size) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_to_(size, count) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_to_(size, count) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_all_(size) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_all_(size) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_maybenull_(size) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_maybenull_(size) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_to_maybenull_(size, count) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_to_maybenull_(size, count) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_all_maybenull_(size) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_all_maybenull_(size) __allowed(on_parameter) + +/************************************************************************ +* Orcas SAL +************************************************************************/ +#define _Deref_out_ _SAL_VERSION_CHECK(_Deref_out_) +#define _Deref_out_opt_ _SAL_VERSION_CHECK(_Deref_out_opt_) +#define _Deref_opt_out_ _SAL_VERSION_CHECK(_Deref_opt_out_) +#define _Deref_opt_out_opt_ _SAL_VERSION_CHECK(_Deref_opt_out_opt_) +#define _In_count_(size) _SAL_VERSION_CHECK(_In_count_) +#define _In_opt_count_(size) _SAL_VERSION_CHECK(_In_opt_count_) +#define _In_bytecount_(size) _SAL_VERSION_CHECK(_In_bytecount_) +#define _In_opt_bytecount_(size) _SAL_VERSION_CHECK(_In_opt_bytecount_) +#define _Out_cap_(size) _SAL_VERSION_CHECK(_Out_cap_) +#define _Out_opt_cap_(size) _SAL_VERSION_CHECK(_Out_opt_cap_) +#define _Out_bytecap_(size) _SAL_VERSION_CHECK(_Out_bytecap_) +#define _Out_opt_bytecap_(size) _SAL_VERSION_CHECK(_Out_opt_bytecap_) +#define _Deref_post_count_(size) _SAL_VERSION_CHECK(_Deref_post_count_) +#define _Deref_post_opt_count_(size) _SAL_VERSION_CHECK(_Deref_post_opt_count_) +#define _Deref_post_bytecount_(size) _SAL_VERSION_CHECK(_Deref_post_bytecount_) +#define _Deref_post_opt_bytecount_(size) _SAL_VERSION_CHECK(_Deref_post_opt_bytecount_) +#define _Deref_post_cap_(size) _SAL_VERSION_CHECK(_Deref_post_cap_) +#define _Deref_post_opt_cap_(size) _SAL_VERSION_CHECK(_Deref_post_opt_cap_) +#define _Deref_post_bytecap_(size) _SAL_VERSION_CHECK(_Deref_post_bytecap_) +#define _Deref_post_opt_bytecap_(size) _SAL_VERSION_CHECK(_Deref_post_opt_bytecap_) + +/************************************************************************ +* Advanced Annotations +* +* Advanced annotations describe behavior that is not expressible with the +* regular buffer macros. These may be used either to annotate buffer +* parameters that involve complex or conditional behavior, or to enrich +* existing annotations with additional information. +* +* _At_(expr, annotes) : annotation list annotes applies to target 'expr' +* +* _When_(expr, annotes) : annotation list annotes applies when 'expr' is true +* +* __success(expr) T f() : indicates whether function f succeeded or +* not. If is true at exit, all the function's guarantees (as given +* by other annotations) must hold. If is false at exit, the caller +* should not expect any of the function's guarantees to hold. If not used, +* the function must always satisfy its guarantees. Added automatically to +* functions that indicate success in standard ways, such as by returning an +* HRESULT. +* +* __out_awcount(expr, size) T *p : Pointer p is a buffer whose size may be +* given in either bytes or elements. If is true, this acts like +* __out_bcount. If is false, this acts like __out_ecount. This +* should only be used to annotate old APIs. +* +* __in_awcount(expr, size) T* p : Pointer p is a buffer whose size may be given +* in either bytes or elements. If is true, this acts like +* __in_bcount. If is false, this acts like __in_ecount. This should +* only be used to annotate old APIs. +* +* __nullterminated T* p : Pointer p is a buffer that may be read or written +* up to and including the first '\0' character or pointer. May be used on +* typedefs, which marks valid (properly initialized) instances of that type +* as being null-terminated. +* +* __nullnullterminated T* p : Pointer p is a buffer that may be read or +* written up to and including the first sequence of two '\0' characters or +* pointers. May be used on typedefs, which marks valid instances of that +* type as being double-null terminated. +* +* __reserved T v : Value v must be 0/NULL, reserved for future use. +* +* __checkReturn T f(); : Return value of f must not be ignored by callers +* of this function. +* +* __typefix(ctype) T v : Value v should be treated as an instance of ctype, +* rather than its declared type when considering validity. +* +* __override T f(); : Specify C#-style 'override' behaviour for overriding +* virtual methods. +* +* __callback T f(); : Function f can be used as a function pointer. +* +* __format_string T p : Pointer p is a string that contains % markers in +* the style of printf. +* +* __blocksOn(resource) f(); : Function f blocks on the resource 'resource'. +* +* __fallthrough : Annotates switch statement labels where fall-through is +* desired, to distinguish from forgotten break statements. +* +* __range(low_bnd, up_bnd) int f(): The return from the function "f" must +* be in the inclusive numeric range [low_bnd, up_bnd]. +* +* __in_range(low_bnd, up_bnd) int i : Precondition that integer i must be +* in the inclusive numeric range [low_bnd, up_bnd]. +* +* __out_range(low_bnd, up_bnd) int i : Postcondition that integer i must be +* in the inclusive numeric range [low_bnd, up_bnd]. +* +* __deref_in_range(low_bnd, up_bnd) int* pi : Precondition that integer *pi +* must be in the inclusive numeric range [low_bnd, up_bnd]. +* +* __deref_out_range(low_bnd, up_bnd) int* pi : Postcondition that integer +* *pi must be in the inclusive numeric range [low_bnd, up_bnd]. +* +* __deref_inout_range(low_bnd, up_bnd) int* pi : Invariant that the integer +* *pi must be in the inclusive numeric range [low_bnd, up_bnd]. +* +* The first argument of a range macro may also be a C relational operator +* (<,>,!=, ==, <=, >=). +* +* __range(rel_op, j) int f(): Postcondition that "f() rel_op j" must be +* true. Note that j may be a expression known only at runtime. +* +* __in_range(rel_op, j) int i : Precondition that "i rel_op j" must be +* true. Note that j may be a expression known only at runtime. +* +* __out_range(rel_op, j) int i : Postcondition that integer "i rel_op j" +* must be true. Note that j may be a expression known only at runtime. +* +* __deref_in_range(rel_op, j) int *pi : Precondition that "*pi rel_op j" +* must be true. Note that j may be a expression known only at runtime. +* +* __deref_out_range(rel_op, j) int *pi : Postcondition that "*pi rel_op j" +* must be true. Note that j may be a expression known only at runtime. +* +* __deref_inout_range(rel_op, j) int *pi : Invariant that "*pi rel_op j" +* must be true. Note that j may be a expression known only at runtime. +* +* __range_max(a, b) int f(): Postcondition f acts as 'max', returns larger +* of a and b. Note that a and b may be expressions known only at runtime. +* +* __range_min(a, b) int f(): Postcondition f acts as 'min', returns smaller +* of a and b. Note that a and b may be expressions known only at runtime. +* +* __in_bound int i : Precondition that integer i must be bound, but the +* exact range can't be specified at compile time. __in_range should be +* used if the range can be explicitly stated. +* +* __out_bound int i : Postcondition that integer i must be bound, but the +* exact range can't be specified at compile time. __out_range should be +* used if the range can be explicitly stated. +* +* __deref_out_bound int pi : Postcondition that integer *pi must be bound, +* but the exact range can't be specified at compile time. +* __deref_out_range should be used if the range can be explicitly stated. +* +* __assume_bound(expr); : Assume that the expression is bound to some known +* range. This can be used to suppress integer overflow warnings on integral +* expressions that are known to be bound due to reasons not explicit in the +* code. Use as a statement in the body of a function. +* +* __analysis_assume_nulltermianted(expr); : Assume that the expression is +* a null terminated buffer. Use this to suppress tool noise specific to +* nulltermination warnings, and capture deeper invariants tools can not +* discover. +* +* __allocator void f(): Function allocates memory using an integral size +* argument +* +* void myfree(__deallocate(Mem) void *p) : Memory is freed, no longer usable +* upon return, and p may not be null. +* +* void myfree(__deallocate_opt(Mem) void *p) : Memory is freed, no longer +* usable upon return, and p may be null. +* +* void free(__post_invalid void* x): Mark memory as untouchable when +* function returns. +* +* ---------------------------------------------------------------------------- +* Advanced Annotation Examples +* +* __success(return == TRUE) LWSTDAPI_(BOOL) +* PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath); +* // pszBuf is only guaranteed to be null-terminated when TRUE is returned. +* +* // Initialized LPWSTRs are null-terminated strings. +* typedef __nullterminated WCHAR* LPWSTR; +* +* __out_ecount(cch) __typefix(LPWSTR) void *psz; +* // psz is a buffer parameter which will be a null-terminated WCHAR string +* // at exit, and which initially contains cch WCHARs. +* +************************************************************************/ +#define _At_(expr, annotes) __allowed(on_parameter_or_return) +#define _When_(expr, annotes) __allowed(on_parameter_or_return) +#define __success(expr) _SAL_VERSION_CHECK(__success) +#define __out_awcount(expr,size) __allowed(on_parameter) +#define __in_awcount(expr,size) __allowed(on_parameter) +#define __nullterminated _SAL_VERSION_CHECK(__nullterminated) +#define __nullnullterminated _SAL_VERSION_CHECK(__nullnullterminated) +#define __reserved _SAL_VERSION_CHECK(__reserved) +#define __checkReturn _SAL_VERSION_CHECK(__checkReturn) +#define __typefix(ctype) __allowed(on_parameter_or_return) +#define __override __allowed(on_function) +#define __callback __allowed(on_function) +#define __format_string __allowed(on_parameter_or_return) +#define __blocksOn(resource) __allowed(on_function) +#define __fallthrough __allowed(as_statement) +#define __range(lb,ub) __allowed(on_return) +#define __in_range(lb,ub) _SAL_VERSION_CHECK(__in_range) +#define __out_range(lb,ub) _SAL_VERSION_CHECK(__out_range) +#define __deref_in_range(lb,ub) __allowed(on_parameter) +#define __deref_out_range(lb,ub) _SAL_VERSION_CHECK(__deref_out_range) +#define __deref_inout_range(lb,ub) __allowed(on_parameter) +#define __field_range(lb,ub) _SAL_VERSION_CHECK(__field_range) +#define __range_max(a,b) __allowed(on_return) +#define __range_min(a,b) __allowed(on_return) +#define __bound __allowed(on_return) +#define __in_bound __allowed(on_parameter) +#define __out_bound __allowed(on_parameter) +#define __deref_out_bound __allowed(on_parameter) +#define __assume_bound(i) __allowed(as_statement_with_arg(i)) +#define __analysis_assume_nullterminated(x) \ + __allowed(as_statement_with_arg(x)) +#define __allocator __allowed(on_function) +#define __deallocate(kind) __allowed(on_parameter) +#define __deallocate_opt(kind) __allowed(on_parameter) +#define __post_invalid __allowed(on_parameter_or_return) +#define __post_nullnullterminated \ + __allowed(on_parameter_or_return) +/*************************************************************************** +* Expert Macros +***************************************************************************/ +#define __null __allowed(on_typedecl) +#define __notnull __allowed(on_typedecl) +#define __maybenull __allowed(on_typedecl) +#define __exceptthat __allowed(on_typedecl) +/*************************************************************************** +* Macros to classify fields of structures. +* Structure Annotations +* +* The buffer annotations are a convenient way of describing +* relationships between buffers and their size on a function by +* function basis. Very often struct or class data members have similar +* invariants, which can be expressed directly on the type. +* +* Similar to our buffer annotations we can summarize all the various +* structure annotations by one choosing an element from each column of +* this table to build a composite annotation. +* +* +--------------------------------------------------+ +* | Selector | Units | Size/Init | Optional | +* |----------+---------+------------------+----------| +* | __field | _ecount | (size) | empty | +* |----------+---------+------------------+----------| +* | __struct | _bcount | _full(size) | _opt | +* |----------+---------+------------------+----------| +* | | _xcount | _part(size,init) | | +* +--------------------------------------------------+ +* +* Note that empty represents the empty string. Sometime arguments need +* to be "floated" to the left to give us a valid annotation name. For +* example the naive combination __field_ecount(size)_opt is actually +* written as __field_ecount_opt(size). Not all possible combinations +* are currently supported or sensible. See specstrings_strict.h for +* the currently supported set. Those that are supported are documented +* below. +* +*Summary of Elements +* +* Selector +* +* __field +* The annotation should only be placed in front +* of data members of structures and classes. The +* data members are pointers to a block of data. +* The annotations describe properties about the +* size of the block of data. This can be used for +* +* __struct +* The annotation should only be placed at the +* beginning of the definition of a structure or +* class. These annotations are used when a struct +* or class is used as a "header" that is +* allocated inline with a block of data and there +* is no apparent field that represents the tail +* end of the structure. +* +* Units +* +* _ecount +* All size and initialization values are in terms +* of elements of the appropriate type +* +* _bcount +* All size and initialization values are in terms +* of raw byte sizes. +* +* _xcount +* The size or initialization values cannot be +* properly expressed as a simple byte or element +* count, and instead a place holder is used to +* document the relationship. +* +* Size/Init +* All the size/init expressions can contain references to +* other fields in the struct or class. +* +* (size) +* The size of the buffer is determined by the +* expression size. Unless, the type of the buffer +* provides more information nothing is know about +* how much of this data is initialized. For +* example, if the data member happens to be a +* string type such as LPSTR. It is assumed that +* the data is initialized to the first '\0'. +* +* _full(size) +* The size of the buffer is determined by the +* expression size and all the data in the buffer +* is guaranteed to be initialized. +* +* _part(size,init) +* The size of the buffer is determined by the +* expression size and all the data in the buffer +* is guaranteed to be initialized up to init +* elements or bytes. +* +* Optional +* +* empty +* The pointer to the block of memory is never +* NULL +* +* _opt +* The pointer to the block of memory is may be +* NULL +* +* +* // Basic Usage of Struct Annotations +* #include +* #include +* struct buf_s { +* int sz; +* __field_bcount_full(sz) +* char *buf; +* }; +* void InitBuf(__out struct *buf_s b,int sz) { +* b->buf = calloc(sz,sizeof(char)); +* b->sz = sz; +* } +* void WriteBuf(__in FILE *fp,__in struct *buf_s b) { +* fwrite(b->buf,b->sz,sizeof(char),fp); +* } +* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) { +* fread(b->buf,b->sz,sizeof(char),fp); +* } +* +* +* +* // Inline Allocated Buffer +* struct buf_s { +* int sz; +* __field_bcount(sz) +* char buf[1]; +* }; +* void WriteBuf(__in FILE *fp,__in struct *buf_s b) { +* fwrite(&(b->buf),b->sz,sizeof(char),fp); +* } +* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) { +* fread(&(b->buf),b->sz,sizeof(char),fp); +* } +* +* +* +* // Embedded Header Structure +* __struct_bcount(sz) +* struct buf_s { +* int sz; +* }; +* void WriteBuf(__in FILE *fp,__in struct *buf_s b) { +* fwrite(&b,b->sz,sizeof(char),fp); +* } +* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) { +* fread(&b,b->sz,sizeof(char),fp); +* } +* +* +****************************************************************************/ +#define __field_ecount(size) _SAL_VERSION_CHECK(__field_ecount) +#define __field_bcount(size) _SAL_VERSION_CHECK(__field_bcount) +#define __field_xcount(size) __allowed(on_field) +#define __field_ecount_opt(size) __allowed(on_field) +#define __field_bcount_opt(size) __allowed(on_field) +#define __field_xcount_opt(size) __allowed(on_field) +#define __field_ecount_part(size,init) __allowed(on_field) +#define __field_bcount_part(size,init) __allowed(on_field) +#define __field_xcount_part(size,init) __allowed(on_field) +#define __field_ecount_part_opt(size,init) __allowed(on_field) +#define __field_bcount_part_opt(size,init) __allowed(on_field) +#define __field_xcount_part_opt(size,init) __allowed(on_field) +#define __field_ecount_full(size) __allowed(on_field) +#define __field_bcount_full(size) __allowed(on_field) +#define __field_xcount_full(size) __allowed(on_field) +#define __field_ecount_full_opt(size) __allowed(on_field) +#define __field_bcount_full_opt(size) __allowed(on_field) +#define __field_xcount_full_opt(size) __allowed(on_field) +#define __field_nullterminated __allowed(on_field) +#define __struct_bcount(size) __allowed(on_struct) +#define __struct_xcount(size) __allowed(on_struct) + +/*************************************************************************** +* Macros to classify the entrypoints and indicate their category. +* +* Pre-defined control point categories include: RPC, KERNEL, GDI. +* +* Pre-defined control point macros include: +* __rpc_entry, __kernel_entry, __gdi_entry. +***************************************************************************/ +#define __control_entrypoint(category) __allowed(on_function) +#define __rpc_entry __allowed(on_function) +#define __kernel_entry __allowed(on_function) +#define __gdi_entry __allowed(on_function) + +/*************************************************************************** +* Macros to track untrusted data and their validation. The list of untrusted +* sources include: +* +* FILE - File reading stream or API +* NETWORK - Socket readers +* INTERNET - WinInet and WinHttp readers +* USER_REGISTRY - HKCU portions of the registry +* USER_MODE - Parameters to kernel entry points +* RPC - Parameters to RPC entry points +* DRIVER - Device driver +***************************************************************************/ +#define __in_data_source(src_sym) __allowed(on_parameter) +#define __out_data_source(src_sym) __allowed(on_parameter) +#define __field_data_source(src_sym) __allowed(on_field) +#define __this_out_data_source(src_syn) __allowed(on_function) + +/************************************************************************** +* Macros to tag file parsing code. Predefined formats include: +* PNG - Portable Network Graphics +* JPEG - Joint Photographic Experts Group +* BMP - Bitmap +* RC_BMP - Resource bitmap +* WMF - Windows Metafile +* EMF - Windows Enhanced Metafile +* GIF - Graphics Interchange Format +* MIME_TYPE - MIME type from header tokens +* MAIL_MONIKER - MAIL information refered by URL moniker +* HTML - HyperText Markup Language +* WMPHOTO - Windows media photo +* OE_VCARD - Outlook Express virtual card +* OE_CONTACT - Outlook Express contact +* MIDI - Musical Instrument Digital Interface +* LDIF - LDAP Data Interchange Format +* AVI - Audio Visual Interchange +* ACM - Audio Compression Manager +**************************************************************************/ +#define __out_validated(filetype_sym) __allowed(on_parameter) +#define __this_out_validated(filetype_sym) __allowed(on_function) +#define __file_parser(filetype_sym) __allowed(on_function) +#define __file_parser_class(filetype_sym) __allowed(on_struct) +#define __file_parser_library(filetype_sym) __allowed(as_global_decl) + +/*************************************************************************** +* Macros to track the code content in the file. The type of code +* contents currently tracked: +* +* NDIS_DRIVER - NDIS Device driver +***************************************************************************/ +#define __source_code_content(codetype_sym) __allowed(as_global_decl) + +/*************************************************************************** +* Macros to track the code content in the class. The type of code +* contents currently tracked: +* +* DCOM - Class implementing DCOM +***************************************************************************/ +#define __class_code_content(codetype_sym) __allowed(on_struct) + +/************************************************************************* +* Macros to tag encoded function pointers +**************************************************************************/ +#define __encoded_pointer +#define __encoded_array +#define __field_encoded_pointer __allowed(on_field) +#define __field_encoded_array __allowed(on_field) + +#define __transfer(formal) __allowed(on_parameter_or_return) +#define __assume_validated(exp) __allowed(as_statement_with_arg(exp)) + +/************************************************************************* +* __analysis_assume(expr) : Expert macro use only when directed. Use this to +* tell static analysis tools like PREfix and PREfast about a non-coded +* assumption that you wish the tools to assume. The assumption will be +* understood by those tools. By default there is no dynamic checking or +* static checking of the assumption in any build. +* +* To obtain dynamic checking wrap this macro in your local version of a debug +* assert. +* Please do not put function calls in the expression because this is not +* supported by all tools: +* __analysis_assume(GetObject () != NULL); // DO NOT DO THIS +* +*************************************************************************/ +#define __analysis_assume(expr) __allowed(as_statement_with_arg(expr)) +#define __analysis_assert(expr) __allowed(as_statement_with_arg(expr)) + +/************************************************************************* +* __analysis_hint(hint_sym) : Expert macro use only when +* directed. Use this to influence certain analysis heuristics +* used by the tools. These hints do not describe the semantics +* of functions but simply direct the tools to act in a certain +* way. +* +* Current hints that are supported are: +* +* INLINE - inline this function during analysis overrides any +* default heuristics +* NOINLINE - do not inline this function during analysis overrides +* and default heuristics +*************************************************************************/ +#define __analysis_hint(hint) __allowed(on_function) + +/************************************************************************* +* Macros to encode abstract properties of values. Used by SALadt.h +*************************************************************************/ +#define __type_has_adt_prop(adt,prop) __allowed(on_typdecl) +#define __out_has_adt_prop(adt,prop) __allowed(on_parameter) +#define __out_not_has_adt_prop(adt,prop) __allowed(on_parameter) +#define __out_transfer_adt_prop(arg) __allowed(on_parameter) +#define __out_has_type_adt_props(typ) __allowed(on_parameter) + +/************************************************************************* +* Macros used by Prefast for Drivers +* +* __possibly_notnullterminated : +* +* Used for return values of parameters or functions that do not +* guarantee nulltermination in all cases. +* +*************************************************************************/ +#define __possibly_notnullterminated __allowed(on_parameter_or_return) + +/************************************************************************* +* Advanced macros +* +* __volatile +* The __volatile annotation identifies a global variable or +* structure field that: +* 1) is not declared volatile; +* 2) is accessed concurrently by multiple threads. +* +* The __deref_volatile annotation identifies a global variable +* or structure field that stores a pointer to some data that: +* 1) is not declared volatile; +* 2) is accessed concurrently by multiple threads. +* +* Prefast uses these annotations to find patterns of code that +* may result in unexpected re-fetching of the global variable +* into a local variable. +* +* We also provide two complimentary annotations __nonvolatile +* and __deref_nonvolatile that could be used to suppress Prefast +* +* re-fetching warnings on variables that are known either: +* 1) not to be in danger of being re-fetched or, +* 2) not to lead to incorrect results if they are re-fetched +* +*************************************************************************/ +#define __volatile __allowed(on_global_or_field) +#define __deref_volatile __allowed(on_global_or_field) +#define __nonvolatile __allowed(on_global_or_field) +#define __deref_nonvolatile __allowed(on_global_or_field) + +/************************************************************************* +* Macros deprecated with strict level greater then 1. +**************************************************************************/ +#if (__SPECSTRINGS_STRICT_LEVEL > 1) +/* Must come before macro defintions */ +#pragma deprecated(__in_nz) +#pragma deprecated(__in_ecount_nz) +#pragma deprecated(__in_bcount_nz) +#pragma deprecated(__out_nz) +#pragma deprecated(__out_nz_opt) +#pragma deprecated(__out_ecount_nz) +#pragma deprecated(__out_bcount_nz) +#pragma deprecated(__inout_nz) +#pragma deprecated(__inout_ecount_nz) +#pragma deprecated(__inout_bcount_nz) +#pragma deprecated(__in_nz_opt) +#pragma deprecated(__in_ecount_nz_opt) +#pragma deprecated(__in_bcount_nz_opt) +#pragma deprecated(__out_ecount_nz_opt) +#pragma deprecated(__out_bcount_nz_opt) +#pragma deprecated(__inout_nz_opt) +#pragma deprecated(__inout_ecount_nz_opt) +#pragma deprecated(__inout_bcount_nz_opt) +#pragma deprecated(__deref_out_nz) +#pragma deprecated(__deref_out_ecount_nz) +#pragma deprecated(__deref_out_bcount_nz) +#pragma deprecated(__deref_inout_nz) +#pragma deprecated(__deref_inout_ecount_nz) +#pragma deprecated(__deref_inout_bcount_nz) +#pragma deprecated(__deref_out_nz_opt) +#pragma deprecated(__deref_out_ecount_nz_opt) +#pragma deprecated(__deref_out_bcount_nz_opt) +#pragma deprecated(__deref_inout_nz_opt) +#pragma deprecated(__deref_inout_ecount_nz_opt) +#pragma deprecated(__deref_inout_bcount_nz_opt) +#pragma deprecated(__deref_opt_inout_nz) +#pragma deprecated(__deref_opt_inout_ecount_nz) +#pragma deprecated(__deref_opt_inout_bcount_nz) +#pragma deprecated(__deref_opt_out_nz_opt) +#pragma deprecated(__deref_opt_out_ecount_nz_opt) +#pragma deprecated(__deref_opt_out_bcount_nz_opt) +#pragma deprecated(__deref_opt_inout_nz_opt) +#pragma deprecated(__deref_opt_inout_ecount_nz_opt) +#pragma deprecated(__deref_opt_inout_bcount_nz_opt) +#pragma deprecated(__deref) +#pragma deprecated(__pre) +#pragma deprecated(__post) +#pragma deprecated(__readableTo) +#pragma deprecated(__writableTo) +#pragma deprecated(__maybevalid) +#pragma deprecated(__data_entrypoint) +#pragma deprecated(__inexpressible_readableTo) +#pragma deprecated(__readonly) +#pragma deprecated(__byte_writableTo) +#pragma deprecated(__byte_readableTo) +#pragma deprecated(__elem_readableTo) +#pragma deprecated(__elem_writableTo) +#pragma deprecated(__valid) +#pragma deprecated(__notvalid) +#pragma deprecated(__refparam) +#pragma deprecated(__precond) +#endif +/* Define soon to be deprecated macros to nops. */ +#define __in_nz +#define __in_ecount_nz(size) +#define __in_bcount_nz(size) +#define __out_nz +#define __out_nz_opt +#define __out_ecount_nz(size) +#define __out_bcount_nz(size) +#define __inout_nz +#define __inout_ecount_nz(size) +#define __inout_bcount_nz(size) +#define __in_nz_opt +#define __in_ecount_nz_opt(size) +#define __in_bcount_nz_opt(size) +#define __out_ecount_nz_opt(size) +#define __out_bcount_nz_opt(size) +#define __inout_nz_opt +#define __inout_ecount_nz_opt(size) +#define __inout_bcount_nz_opt(size) +#define __deref_out_nz +#define __deref_out_ecount_nz(size) +#define __deref_out_bcount_nz(size) +#define __deref_inout_nz +#define __deref_inout_ecount_nz(size) +#define __deref_inout_bcount_nz(size) +#define __deref_out_nz_opt +#define __deref_out_ecount_nz_opt(size) +#define __deref_out_bcount_nz_opt(size) +#define __deref_inout_nz_opt +#define __deref_inout_ecount_nz_opt(size) +#define __deref_inout_bcount_nz_opt(size) +#define __deref_opt_inout_nz +#define __deref_opt_inout_ecount_nz(size) +#define __deref_opt_inout_bcount_nz(size) +#define __deref_opt_out_nz_opt +#define __deref_opt_out_ecount_nz_opt(size) +#define __deref_opt_out_bcount_nz_opt(size) +#define __deref_opt_inout_nz_opt +#define __deref_opt_inout_ecount_nz_opt(size) +#define __deref_opt_inout_bcount_nz_opt(size) +#define __deref +#define __pre +#define __post +#define __readableTo(count) +#define __writableTo(count) +#define __maybevalid +#define __inexpressible_readableTo(string) +#define __data_entrypoint(category) +#define __readonly +#define __byte_writableTo(count) +#define __byte_readableTo(count) +#define __elem_readableTo(count) +#define __elem_writableTo(count) +#define __valid +#define __notvalid +#define __refparam +#define __precond(condition) + +/************************************************************************* +* Definitions to force a compile error when macros are used improperly. +* Relies on VS 2005 source annotations. +*************************************************************************/ +#if !defined(_MSC_EXTENSIONS) && !defined(_PREFAST_) && !defined(OACR) +#define __allowed(p) /* nothing */ +#else +#define __allowed(p) __$allowed_##p +#define __$allowed_as_global_decl /* empty */ +#define __$allowed_as_statement_with_arg(x) \ + __pragma(warning(push)) __pragma(warning(disable : 4548)) \ + do {__noop(x);} while((0,0) __pragma(warning(pop)) ) +#define __$allowed_as_statement __$allowed_as_statement_with_arg(1) + +/************************************************************************** +* This should go away. It's only for __success which we should split into. +* __success and __typdecl_sucess +***************************************************************************/ +#define __$allowed_on_function_or_typedecl /* empty */ +#if (__SPECSTRINGS_STRICT_LEVEL == 1) || (__SPECSTRINGS_STRICT_LEVEL == 2) +#define __$allowed_on_typedecl /* empty */ +#define __$allowed_on_return /* empty */ +#define __$allowed_on_parameter /* empty */ +#define __$allowed_on_function /* empty */ +#define __$allowed_on_struct /* empty */ +#define __$allowed_on_field /* empty */ +#define __$allowed_on_parameter_or_return /* empty */ +#define __$allowed_on_global_or_field /* empty */ +#elif __SPECSTRINGS_STRICT_LEVEL == 3 +#define __$allowed_on_typedecl /* empty */ +/* Define dummy source attributes. Still needs more testing */ +#define __$allowed_on_return [returnvalue: OnReturnOnly] +#define __$allowed_on_parameter [OnParameterOnly] +#define __$allowed_on_function [method: OnFunctionOnly] +#define __$allowed_on_struct [OnStructOnly] +#define __$allowed_on_field [OnFieldOnly] +#define __$allowed_on_parameter_or_return [OnParameterOrReturnOnly] +#define __$allowed_on_global_or_field /* empty */ +#pragma push_macro( "DECL_SA" ) +#pragma push_macro( "SA" ) +#ifdef __cplusplus +#define SA(x) x +#define DECL_SA(name,loc) \ + [repeatable] \ + [source_annotation_attribute( loc )] \ + struct name##Attribute { name##Attribute(); const char* ignored; }; +#else +#define SA(x) SA_##x +#define DECL_SA(name,loc) \ + [source_annotation_attribute( loc )] \ + struct name { const char* ignored; };\ + typedef struct name name; +#endif /* #endif __cplusplus */ +DECL_SA(OnParameterOnly,SA(Parameter)); +DECL_SA(OnReturnOnly,SA(ReturnValue)); +DECL_SA(OnFunctionOnly,SA(Method)); +DECL_SA(OnStructOnly,SA(Struct)); +DECL_SA(OnFieldOnly,SA(Field)); +DECL_SA(OnParameterOrReturnOnly,SA(Parameter) | SA(ReturnValue)); +#pragma pop_macro( "SA" ) +#pragma pop_macro( "DECL_SA" ) +#endif +#endif +#endif diff --git a/sdk/include/psdk/specstrings_undef.h b/sdk/include/psdk/specstrings_undef.h new file mode 100644 index 00000000000..9477d555801 --- /dev/null +++ b/sdk/include/psdk/specstrings_undef.h @@ -0,0 +1,491 @@ +/* + * PROJECT: ReactOS PSDK + * LICENSE: MIT (https://spdx.org/licenses/MIT) + * PURPOSE: Undefines SAL definitions + * COPYRIGHT: Copyright 2020 Timo Kreuzer + */ + +#pragma once + +#undef __ecount +#undef __bcount +#undef __xcount +#undef __in +#undef __in_ecount +#undef __in_bcount +#undef __in_xcount +#undef __in_z +#undef __in_ecount_z +#undef __in_bcount_z +#undef __out +#undef __out_ecount +#undef __out_bcount +#undef __out_xcount +#undef __out_ecount_part +#undef __out_bcount_part +#undef __out_xcount_part +#undef __out_ecount_full +#undef __out_bcount_full +#undef __out_xcount_full +#undef __out_z +#undef __out_ecount_z +#undef __out_bcount_z +#undef __inout +#undef __inout_ecount +#undef __inout_bcount +#undef __inout_xcount +#undef __inout_ecount_part +#undef __inout_bcount_part +#undef __inout_xcount_part +#undef __inout_ecount_full +#undef __inout_bcount_full +#undef __inout_xcount_full +#undef __inout_z +#undef __inout_ecount_z +#undef __inout_bcount_z +#undef __ecount_opt +#undef __bcount_opt +#undef __xcount_opt +#undef __in_opt +#undef __in_ecount_opt +#undef __in_bcount_opt +#undef __in_z_opt +#undef __in_ecount_z_opt +#undef __in_bcount_z_opt +#undef __in_xcount_opt +#undef __out_opt +#undef __out_ecount_opt +#undef __out_bcount_opt +#undef __out_xcount_opt +#undef __out_ecount_part_opt +#undef __out_bcount_part_opt +#undef __out_xcount_part_opt +#undef __out_ecount_full_opt +#undef __out_bcount_full_opt +#undef __out_xcount_full_opt +#undef __out_ecount_z_opt +#undef __out_bcount_z_opt +#undef __inout_opt +#undef __inout_ecount_opt +#undef __inout_bcount_opt +#undef __inout_xcount_opt +#undef __inout_ecount_part_opt +#undef __inout_bcount_part_opt +#undef __inout_xcount_part_opt +#undef __inout_ecount_full_opt +#undef __inout_bcount_full_opt +#undef __inout_xcount_full_opt +#undef __inout_z_opt +#undef __inout_ecount_z_opt +#undef __inout_ecount_z_opt +#undef __inout_bcount_z_opt +#undef __deref_ecount +#undef __deref_bcount +#undef __deref_xcount +#undef __deref_in +#undef __deref_in_ecount +#undef __deref_in_bcount +#undef __deref_in_xcount +#undef __deref_out +#undef __deref_out_ecount +#undef __deref_out_bcount +#undef __deref_out_xcount +#undef __deref_out_ecount_part +#undef __deref_out_bcount_part +#undef __deref_out_xcount_part +#undef __deref_out_ecount_full +#undef __deref_out_bcount_full +#undef __deref_out_xcount_full +#undef __deref_out_z +#undef __deref_out_ecount_z +#undef __deref_out_bcount_z +#undef __deref_inout +#undef __deref_inout_ecount +#undef __deref_inout_bcount +#undef __deref_inout_xcount +#undef __deref_inout_ecount_part +#undef __deref_inout_bcount_part +#undef __deref_inout_xcount_part +#undef __deref_inout_ecount_full +#undef __deref_inout_bcount_full +#undef __deref_inout_xcount_full +#undef __deref_inout_z +#undef __deref_inout_ecount_z +#undef __deref_inout_bcount_z +#undef __deref_ecount_opt +#undef __deref_bcount_opt +#undef __deref_xcount_opt +#undef __deref_in_opt +#undef __deref_in_opt_out +#undef __deref_in_ecount_opt +#undef __deref_in_bcount_opt +#undef __deref_in_xcount_opt +#undef __deref_out_opt +#undef __deref_out_ecount_opt +#undef __deref_out_bcount_opt +#undef __deref_out_xcount_opt +#undef __deref_out_ecount_part_opt +#undef __deref_out_bcount_part_opt +#undef __deref_out_xcount_part_opt +#undef __deref_out_ecount_full_opt +#undef __deref_out_bcount_full_opt +#undef __deref_out_xcount_full_opt +#undef __deref_out_z_opt +#undef __deref_out_ecount_z_opt +#undef __deref_out_bcount_z_opt +#undef __deref_inout_opt +#undef __deref_inout_ecount_opt +#undef __deref_inout_bcount_opt +#undef __deref_inout_xcount_opt +#undef __deref_inout_ecount_part_opt +#undef __deref_inout_bcount_part_opt +#undef __deref_inout_xcount_part_opt +#undef __deref_inout_ecount_full_opt +#undef __deref_inout_bcount_full_opt +#undef __deref_inout_xcount_full_opt +#undef __deref_inout_z_opt +#undef __deref_inout_ecount_z_opt +#undef __deref_inout_bcount_z_opt +#undef __deref_opt_ecount +#undef __deref_opt_bcount +#undef __deref_opt_xcount +#undef __deref_opt_in +#undef __deref_opt_in_ecount +#undef __deref_opt_in_bcount +#undef __deref_opt_in_xcount +#undef __deref_opt_out +#undef __deref_opt_out_ecount +#undef __deref_opt_out_bcount +#undef __deref_opt_out_xcount +#undef __deref_opt_out_ecount_part +#undef __deref_opt_out_bcount_part +#undef __deref_opt_out_xcount_part +#undef __deref_opt_out_ecount_full +#undef __deref_opt_out_bcount_full +#undef __deref_opt_out_xcount_full +#undef __deref_opt_inout +#undef __deref_opt_inout_ecount +#undef __deref_opt_inout_bcount +#undef __deref_opt_inout_xcount +#undef __deref_opt_inout_ecount_part +#undef __deref_opt_inout_bcount_part +#undef __deref_opt_inout_xcount_part +#undef __deref_opt_inout_ecount_full +#undef __deref_opt_inout_bcount_full +#undef __deref_opt_inout_xcount_full +#undef __deref_opt_inout_z +#undef __deref_opt_inout_ecount_z +#undef __deref_opt_inout_bcount_z +#undef __deref_opt_ecount_opt +#undef __deref_opt_bcount_opt +#undef __deref_opt_xcount_opt +#undef __deref_opt_in_opt +#undef __deref_opt_in_ecount_opt +#undef __deref_opt_in_bcount_opt +#undef __deref_opt_in_xcount_opt +#undef __deref_opt_out_opt +#undef __deref_opt_out_ecount_opt +#undef __deref_opt_out_bcount_opt +#undef __deref_opt_out_xcount_opt +#undef __deref_opt_out_ecount_part_opt +#undef __deref_opt_out_bcount_part_opt +#undef __deref_opt_out_xcount_part_opt +#undef __deref_opt_out_ecount_full_opt +#undef __deref_opt_out_bcount_full_opt +#undef __deref_opt_out_xcount_full_opt +#undef __deref_opt_out_z_opt +#undef __deref_opt_out_ecount_z_opt +#undef __deref_opt_out_bcount_z_opt +#undef __deref_opt_inout_opt +#undef __deref_opt_inout_ecount_opt +#undef __deref_opt_inout_bcount_opt +#undef __deref_opt_inout_xcount_opt +#undef __deref_opt_inout_ecount_part_opt +#undef __deref_opt_inout_bcount_part_opt +#undef __deref_opt_inout_xcount_part_opt +#undef __deref_opt_inout_ecount_full_opt +#undef __deref_opt_inout_bcount_full_opt +#undef __deref_opt_inout_xcount_full_opt +#undef __deref_opt_inout_z_opt +#undef __deref_opt_inout_ecount_z_opt +#undef __deref_opt_inout_bcount_z_opt +#undef __deref_in_ecount_iterator +#undef __deref_out_ecount_iterator +#undef __deref_inout_ecount_iterator +#undef __deref_realloc_bcount + +/************************************************************************ +* SAL 2 _Ouptr_ family of annotations +************************************************************************/ + +#undef _Outptr_ +#undef _Outptr_result_maybenull_ +#undef _Outptr_opt_ +#undef _Outptr_opt_result_maybenull_ +#undef _Outptr_result_z_ +#undef _Outptr_opt_result_z_ +#undef _Outptr_result_maybenull_z_ +#undef _Outptr_opt_result_maybenull_z_ +#undef _Outptr_result_nullonfailure_ +#undef _Outptr_opt_result_nullonfailure_ +#undef _COM_Outptr_ +#undef _COM_Outptr_result_maybenull_ +#undef _COM_Outptr_opt_ +#undef _COM_Outptr_opt_result_maybenull_ +#undef _Outptr_result_buffer_ +#undef _Outptr_opt_result_buffer_ +#undef _Outptr_result_buffer_to_ +#undef _Outptr_opt_result_buffer_to_ +#undef _Outptr_result_buffer_all_ +#undef _Outptr_opt_result_buffer_all_ +#undef _Outptr_result_buffer_maybenull_ +#undef _Outptr_opt_result_buffer_maybenull_ +#undef _Outptr_result_buffer_to_maybenull_ +#undef _Outptr_opt_result_buffer_to_maybenull_ +#undef _Outptr_result_buffer_all_maybenull_ +#undef _Outptr_opt_result_buffer_all_maybenull_ +#undef _Outptr_result_bytebuffer_ +#undef _Outptr_opt_result_bytebuffer_ +#undef _Outptr_result_bytebuffer_to_ +#undef _Outptr_opt_result_bytebuffer_to_ +#undef _Outptr_result_bytebuffer_all_ +#undef _Outptr_opt_result_bytebuffer_all_ +#undef _Outptr_result_bytebuffer_maybenull_ +#undef _Outptr_opt_result_bytebuffer_maybenull_ +#undef _Outptr_result_bytebuffer_to_maybenull_ +#undef _Outptr_opt_result_bytebuffer_to_maybenull_ +#undef _Outptr_result_bytebuffer_all_maybenull_ +#undef _Outptr_opt_result_bytebuffer_all_maybenull_ + +/************************************************************************ +* Orcas SAL +************************************************************************/ +#undef _Deref_out_ +#undef _Deref_out_opt_ +#undef _Deref_opt_out_ +#undef _Deref_opt_out_opt_ +#undef _In_count_ +#undef _In_opt_count_ +#undef _In_bytecount_ +#undef _In_opt_bytecount_ +#undef _Out_cap_ +#undef _Out_opt_cap_ +#undef _Out_bytecap_ +#undef _Out_opt_bytecap_ +#undef _Deref_post_count_ +#undef _Deref_post_opt_count_ +#undef _Deref_post_bytecount_ +#undef _Deref_post_opt_bytecount_ +#undef _Deref_post_cap_ +#undef _Deref_post_opt_cap_ +#undef _Deref_post_bytecap_ +#undef _Deref_post_opt_bytecap_ + +/************************************************************************ +* Advanced Annotations +************************************************************************/ +#undef _At_ +#undef _When_ +#undef __success +#undef __out_awcount +#undef __in_awcount +#undef __nullterminated +#undef __nullnullterminated +#undef __reserved +#undef __checkReturn +#undef __typefix +#undef __override +#undef __callback +#undef __format_string +#undef __blocksOn +#undef __fallthrough +#undef __range +#undef __in_range +#undef __out_range +#undef __deref_in_range +#undef __deref_out_range +#undef __deref_inout_range +#undef __field_range +#undef __range_max +#undef __range_min +#undef __bound +#undef __in_bound +#undef __out_bound +#undef __deref_out_bound +#undef __assume_bound +#undef __analysis_assume_nullterminated +#undef __allocator +#undef __deallocate +#undef __deallocate_opt +#undef __post_invalid +#undef __post_nullnullterminated +/*************************************************************************** +* Expert Macros +***************************************************************************/ +#undef __null +#undef __notnull +#undef __maybenull +#undef __exceptthat +/*************************************************************************** +* Macros to classify fields of structures. +****************************************************************************/ +#undef __field_ecount +#undef __field_bcount +#undef __field_xcount +#undef __field_ecount_opt +#undef __field_bcount_opt +#undef __field_xcount_opt +#undef __field_ecount_part +#undef __field_bcount_part +#undef __field_xcount_part +#undef __field_ecount_part_opt +#undef __field_bcount_part_opt +#undef __field_xcount_part_opt +#undef __field_ecount_full +#undef __field_bcount_full +#undef __field_xcount_full +#undef __field_ecount_full_opt +#undef __field_bcount_full_opt +#undef __field_xcount_full_opt +#undef __field_nullterminated +#undef __struct_bcount +#undef __struct_xcount + +/*************************************************************************** +* Macros to classify the entrypoints and indicate their category. +***************************************************************************/ +#undef __control_entrypoint +#undef __rpc_entry +#undef __kernel_entry +#undef __gdi_entry + +/*************************************************************************** +* Macros to track untrusted data and their validation. +***************************************************************************/ +#undef __in_data_source +#undef __out_data_source +#undef __field_data_source +#undef __this_out_data_source + +/************************************************************************** +* Macros to tag file parsing code. +**************************************************************************/ +#undef __out_validated +#undef __this_out_validated +#undef __file_parser +#undef __file_parser_class +#undef __file_parser_library + +/*************************************************************************** +* Macros to track the code content in the file. +***************************************************************************/ +#undef __source_code_content + +/*************************************************************************** +* Macros to track the code content in the class. +***************************************************************************/ +#undef __class_code_content + +/************************************************************************* +* Macros to tag encoded function pointers +**************************************************************************/ +#undef __encoded_pointer +#undef __encoded_array +#undef __field_encoded_pointer +#undef __field_encoded_array + +#undef __transfer +#undef __assume_validated + +/************************************************************************* +* __analysis_assume +*************************************************************************/ +#undef __analysis_assume +#undef __analysis_assert + +/************************************************************************* +* __analysis_hint +*************************************************************************/ +#undef __analysis_hint + +/************************************************************************* +* Macros to encode abstract properties of values. Used by SALadt.h +*************************************************************************/ +#undef __type_has_adt_prop +#undef __out_has_adt_prop +#undef __out_not_has_adt_prop +#undef __out_transfer_adt_prop +#undef __out_has_type_adt_props + +/************************************************************************* +* Macros used by Prefast for Drivers +*************************************************************************/ +#undef __possibly_notnullterminated + +/************************************************************************* +* Advanced macros +*************************************************************************/ +#undef __volatile +#undef __deref_volatile +#undef __nonvolatile +#undef __deref_nonvolatile + +/************************************************************************* +* Macros deprecated with strict level greater then 1. +**************************************************************************/ +#undef __in_nz +#undef __in_ecount_nz +#undef __in_bcount_nz +#undef __out_nz +#undef __out_nz_opt +#undef __out_ecount_nz +#undef __out_bcount_nz +#undef __inout_nz +#undef __inout_ecount_nz +#undef __inout_bcount_nz +#undef __in_nz_opt +#undef __in_ecount_nz_opt +#undef __in_bcount_nz_opt +#undef __out_ecount_nz_opt +#undef __out_bcount_nz_opt +#undef __inout_nz_opt +#undef __inout_ecount_nz_opt +#undef __inout_bcount_nz_opt +#undef __deref_out_nz +#undef __deref_out_ecount_nz +#undef __deref_out_bcount_nz +#undef __deref_inout_nz +#undef __deref_inout_ecount_nz +#undef __deref_inout_bcount_nz +#undef __deref_out_nz_opt +#undef __deref_out_ecount_nz_opt +#undef __deref_out_bcount_nz_opt +#undef __deref_inout_nz_opt +#undef __deref_inout_ecount_nz_opt +#undef __deref_inout_bcount_nz_opt +#undef __deref_opt_inout_nz +#undef __deref_opt_inout_ecount_nz +#undef __deref_opt_inout_bcount_nz +#undef __deref_opt_out_nz_opt +#undef __deref_opt_out_ecount_nz_opt +#undef __deref_opt_out_bcount_nz_opt +#undef __deref_opt_inout_nz_opt +#undef __deref_opt_inout_ecount_nz_opt +#undef __deref_opt_inout_bcount_nz_opt +#undef __deref +#undef __pre +#undef __post +#undef __readableTo +#undef __writableTo +#undef __maybevalid +#undef __inexpressible_readableTo +#undef __data_entrypoint +#undef __readonly +#undef __byte_writableTo +#undef __byte_readableTo +#undef __elem_readableTo +#undef __elem_writableTo +#undef __valid +#undef __notvalid +#undef __refparam +#undef __precond