ReactOS 0.4.15-dev-7924-g5949c20
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 {
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}
NTSTATUS Status
Definition: shellext.h:385
string msg
Definition: shellext.h:388
static string utf16_to_utf8(const wstring_view &utf16)
Definition: main.cpp:670
ULONG(WINAPI * _RtlNtStatusToDosError)(NTSTATUS Status)
Definition: main.cpp:44
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
Status
Definition: gdiplustypes.h:25
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define L(x)
Definition: ntvdm.h:50
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:420
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
__wchar_t WCHAR
Definition: xmlstorage.h:180

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 }

Member Data Documentation

◆ msg

string ntstatus_error::msg
private

Definition at line 388 of file shellext.h.

Referenced by ntstatus_error(), and what().

◆ 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: