internal static void CheckHandle(this AMSIHandleContext handleContext) { if (handleContext.IsInvalid) { throw AMSIException.FailedToInitialize(); } }
internal static void CheckHandle(this AMSIHandleSession handleSession) { if (handleSession.IsInvalid) { throw AMSIException.FailedToInitializeSession(); } }
internal static void CheckResult(this int amsiMethodResult, string methodName) { if (amsiMethodResult == -2147019873) { throw AMSIException.AMSIInvalidState; } if (amsiMethodResult != 0) { throw AMSIException.AMSIFailedToExecute(methodName, new Win32Exception(amsiMethodResult)); } }