ReactOS  0.4.15-dev-4870-g846c9aa
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
 

Public Attributes

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

Private Attributes

string msg
 

Detailed Description

Definition at line 377 of file shellext.h.

Constructor & Destructor Documentation

◆ ntstatus_error()

ntstatus_error::ntstatus_error ( NTSTATUS  Status)

Definition at line 793 of file main.cpp.

793  : Status(Status) {
795  HMODULE ntdll = LoadLibraryW(L"ntdll.dll");
796  WCHAR* buf;
797 
798  if (!ntdll)
799  throw runtime_error("Error loading ntdll.dll.");
800 
801  try {
802  RtlNtStatusToDosError = (_RtlNtStatusToDosError)GetProcAddress(ntdll, "RtlNtStatusToDosError");
803 
805  throw runtime_error("Error loading RtlNtStatusToDosError in ntdll.dll.");
806 
808  RtlNtStatusToDosError(Status), 0, (WCHAR*)&buf, 0, nullptr) == 0)
809  throw runtime_error("FormatMessage failed");
810 
811  try {
812  msg = utf16_to_utf8(buf);
813  } catch (...) {
814  LocalFree(buf);
815  throw;
816  }
817 
818  LocalFree(buf);
819  } catch (...) {
820  FreeLibrary(ntdll);
821  throw;
822  }
823 
824  FreeLibrary(ntdll);
825 }
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define L(x)
Definition: ntvdm.h:50
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
ULONG(WINAPI * _RtlNtStatusToDosError)(NTSTATUS Status)
Definition: main.cpp:44
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:416
#define LoadLibraryW(x)
Definition: compat.h:606
static string utf16_to_utf8(const wstring_view &utf16)
Definition: main.cpp:670
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:420
Status
Definition: gdiplustypes.h:24
#define FreeLibrary(x)
Definition: compat.h:607
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:417
string msg
Definition: shellext.h:388
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define GetProcAddress(x, y)
Definition: compat.h:612
NTSTATUS Status
Definition: shellext.h:385

Member Function Documentation

◆ what()

const char* ntstatus_error::what ( ) const
inlinenoexcept

Definition at line 381 of file shellext.h.

381  {
382  return msg.c_str();
383  }
string msg
Definition: shellext.h:388

Member Data Documentation

◆ msg

string ntstatus_error::msg
private

Definition at line 388 of file shellext.h.

Referenced by ntstatus_error().

◆ Status

NTSTATUS ntstatus_error::Status

Definition at line 385 of file shellext.h.

Referenced by BtrfsChangeDriveLetter::DlgProc().


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