Skip to content

Commit

Permalink
Sync With OS (#383)
Browse files Browse the repository at this point in the history
* Squash to reset history

* Sync with OS commit c143d3aede87a314ba71660ece3da5426e359d46

* 'StringCchPrintfA' was still needed internally

* More build fixes
  • Loading branch information
dunhor committed Oct 27, 2023
1 parent 5e9be7b commit b5aea4e
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 57 deletions.
4 changes: 2 additions & 2 deletions include/wil/nt_result_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// Helpers for return macros
#define __NT_RETURN_NTSTATUS(status, str) __WI_SUPPRESS_4127_S do { NTSTATUS __status = (status); if (FAILED_NTSTATUS(__status)) { __R_FN(Return_NtStatus)(__R_INFO(str) __status); } return __status; } __WI_SUPPRESS_4127_E while ((void)0, 0)
#define __NT_RETURN_NTSTATUS_MSG(status, str, fmt, ...) __WI_SUPPRESS_4127_S do { NTSTATUS __status = (status); if (FAILED_NTSTATUS(__status)) { __R_FN(Return_NtStatusMsg)(__R_INFO(str) __status, fmt, ##__VA_ARGS__); } return __status; } __WI_SUPPRESS_4127_E while ((void)0, 0)
#define __NT_RETURN_NTSTATUS_MSG(status, str, fmt, ...) __WI_SUPPRESS_4127_S do { NTSTATUS __status = (status); if (FAILED_NTSTATUS(__status)) { __R_FN(Return_NtStatusMsg)(__R_INFO(str) __status, __WI_CHECK_MSG_FMT(fmt, ##__VA_ARGS__)); } return __status; } __WI_SUPPRESS_4127_E while ((void)0, 0)

//*****************************************************************************
// Macros for returning failures as NTSTATUS
Expand All @@ -39,7 +39,7 @@

// Use these macros *within* a catch (...) block to handle exceptions
#define NT_RETURN_CAUGHT_EXCEPTION() return __R_FN(Nt_Return_CaughtException)(__R_INFO_ONLY(nullptr))
#define NT_RETURN_CAUGHT_EXCEPTION_MSG(fmt, ...) return __R_FN(Nt_Return_CaughtExceptionMsg)(__R_INFO(nullptr) fmt, ##__VA_ARGS__)
#define NT_RETURN_CAUGHT_EXCEPTION_MSG(fmt, ...) return __R_FN(Nt_Return_CaughtExceptionMsg)(__R_INFO(nullptr) __WI_CHECK_MSG_FMT(fmt, ##__VA_ARGS__))

// Use these macros in place of a catch block to handle exceptions
#define NT_CATCH_RETURN() catch (...) { NT_RETURN_CAUGHT_EXCEPTION(); }
Expand Down
8 changes: 8 additions & 0 deletions include/wil/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -5721,6 +5721,14 @@ namespace wil
::WdfWaitLockRelease,
details::pointer_access_none>;

#if defined(WIL_KERNEL_MODE)
using unique_wdf_device_init =
unique_any<
WDFDEVICE_INIT *,
decltype(&::WdfDeviceInitFree),
::WdfDeviceInitFree>;
#endif

inline
WI_NODISCARD
_IRQL_requires_max_(PASSIVE_LEVEL)
Expand Down
Loading

0 comments on commit b5aea4e

Please sign in to comment.