ReactOS  0.4.14-dev-55-g2da92ac
ntstatus_error Class Reference

#include <shellext.h>

Inheritance diagram for ntstatus_error:
Collaboration diagram for ntstatus_error:

Public Member Functions

 ntstatus_error (NTSTATUS Status)
 
const charwhat () const noexcept
 

Private Attributes

string msg
 

Additional Inherited Members

- Public Attributes inherited from __exception
vtable_ptrvtable
 
charname
 
int do_free
 
const vtable_ptrvtable
 
BOOL do_free
 

Detailed Description

Definition at line 353 of file shellext.h.

Constructor & Destructor Documentation

◆ ntstatus_error()

ntstatus_error::ntstatus_error ( NTSTATUS  Status)

Definition at line 748 of file main.cpp.

748  {
750  HMODULE ntdll = LoadLibraryW(L"ntdll.dll");
751  WCHAR* buf;
752 
753  if (!ntdll)
754  throw runtime_error("Error loading ntdll.dll.");
755 
756  try {
757  RtlNtStatusToDosError = (_RtlNtStatusToDosError)GetProcAddress(ntdll, "RtlNtStatusToDosError");
758 
760  throw runtime_error("Error loading RtlNtStatusToDosError in ntdll.dll.");
761 
763  RtlNtStatusToDosError(Status), 0, (WCHAR*)&buf, 0, nullptr) == 0)
764  throw runtime_error("FormatMessage failed");
765 
766  try {
768  } catch (...) {
769  LocalFree(buf);
770  throw;
771  }
772 
773  LocalFree(buf);
774  } catch (...) {
775  FreeLibrary(ntdll);
776  throw;
777  }
778 
779  FreeLibrary(ntdll);
780 }
void utf16_to_utf8(const wstring &utf16, string &utf8)
Definition: main.cpp:694
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
ULONG(WINAPI * _RtlNtStatusToDosError)(NTSTATUS Status)
Definition: main.cpp:44
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
#define LoadLibraryW(x)
Definition: compat.h:404
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define FreeLibrary(x)
Definition: compat.h:405
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
string msg
Definition: shellext.h:362
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define GetProcAddress(x, y)
Definition: compat.h:410

Member Function Documentation

◆ what()

const char* ntstatus_error::what ( ) const
inlinenoexcept

Definition at line 357 of file shellext.h.

357  {
358  return msg.c_str();
359  }
string msg
Definition: shellext.h:362

Member Data Documentation

◆ msg

string ntstatus_error::msg
private

Definition at line 362 of file shellext.h.

Referenced by ntstatus_error(), and what().


The documentation for this class was generated from the following files: