ReactOS  0.4.14-dev-554-g2f8d847
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 795 of file main.cpp.

795  : Status(Status) {
797  HMODULE ntdll = LoadLibraryW(L"ntdll.dll");
798  WCHAR* buf;
799 
800  if (!ntdll)
801  throw runtime_error("Error loading ntdll.dll.");
802 
803  try {
804  RtlNtStatusToDosError = (_RtlNtStatusToDosError)GetProcAddress(ntdll, "RtlNtStatusToDosError");
805 
807  throw runtime_error("Error loading RtlNtStatusToDosError in ntdll.dll.");
808 
810  RtlNtStatusToDosError(Status), 0, (WCHAR*)&buf, 0, nullptr) == 0)
811  throw runtime_error("FormatMessage failed");
812 
813  try {
814  msg = utf16_to_utf8(buf);
815  } catch (...) {
816  LocalFree(buf);
817  throw;
818  }
819 
820  LocalFree(buf);
821  } catch (...) {
822  FreeLibrary(ntdll);
823  throw;
824  }
825 
826  FreeLibrary(ntdll);
827 }
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:412
static string utf16_to_utf8(const wstring_view &utf16)
Definition: main.cpp:672
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define FreeLibrary(x)
Definition: compat.h:413
__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:388
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define GetProcAddress(x, y)
Definition: compat.h:418
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: