From e19bf287417ee2d36657884cfe0ec270f1db2a64 Mon Sep 17 00:00:00 2001 From: luciaprime54 Date: Mon, 5 Feb 2024 13:54:23 +0000 Subject: [PATCH] Added a catch-all for NTSTATUS for error codes we don't care about --- pyrdp/enum/windows.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pyrdp/enum/windows.py b/pyrdp/enum/windows.py index 63fb7b161..96dbec717 100644 --- a/pyrdp/enum/windows.py +++ b/pyrdp/enum/windows.py @@ -28,7 +28,17 @@ class NTSTATUS(IntEnum): [MS-ERREF]: Windows Error Codes https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781 """ + @classmethod + # Some Clients can return other Error codes. Rather than hardcode 1000s + # of possible Status codes Just handle the ones we need to and create a catch-all + # for the ones we don't care about so we don't throw an exception. + def _missing_(cls, value): + other = NTSTATUS(0x00000000) + other._name_ = "STATUS_PYRDP_FAILURE" + other._value_ = value + return other + STATUS_SUCCESS = 0x00000000 STATUS_NO_MORE_FILES = 0x80000006 STATUS_NO_SUCH_FILE = 0xC000000F - STATUS_ACCESS_DENIED = 0xC0000022 \ No newline at end of file + STATUS_ACCESS_DENIED = 0xC0000022