void IDisposable.Dispose() { // Close handles which come from errors switch (State) { case ProcessCreateState.FailOnSectionCreate: NtObjectUtils.CloseHandle(Data.FileHandle); break; case ProcessCreateState.FailExeName: NtObjectUtils.CloseHandle(Data.IFEOKey); break; case ProcessCreateState.Success: NtObjectUtils.CloseHandle(Data.Success.FileHandle); NtObjectUtils.CloseHandle(Data.Success.SectionHandle); break; } }