void IDisposable.Dispose() { // Close handles which come from errors switch (State) { case ProcessCreateState.FailOnSectionCreate: NtObject.CloseHandle(Data.FileHandle); break; case ProcessCreateState.FailExeName: NtObject.CloseHandle(Data.IFEOKey); break; case ProcessCreateState.Success: NtObject.CloseHandle(Data.Success.FileHandle); NtObject.CloseHandle(Data.Success.SectionHandle); break; } }
/// <summary> /// Close the handle in the original process. /// </summary> /// <param name="throw_on_error">True throw on error.</param> /// <returns>The NT status code.</returns> /// <remarks>This is not recommended.</remarks> public NtStatus CloseHandle(bool throw_on_error) { return(NtObject.CloseHandle(ProcessId, new IntPtr(Handle), throw_on_error)); }