diff --git a/rust/gui-client/src-tauri/src/client/elevation.rs b/rust/gui-client/src-tauri/src/client/elevation.rs index cfff37847..9f3d5ddc4 100644 --- a/rust/gui-client/src-tauri/src/client/elevation.rs +++ b/rust/gui-client/src-tauri/src/client/elevation.rs @@ -112,8 +112,20 @@ mod imp { impl Drop for ProcessToken { fn drop(&mut self) { // SAFETY: We got `inner` from `OpenProcessToken` and didn't mutate it after that. + // Closing a pseudo-handle is a harmless no-op, though this is a real handle. + // + // > The pseudo handle need not be closed when it is no longer needed. Calling the CloseHandle function with a pseudo handle has no effect. If the pseudo handle is duplicated by DuplicateHandle, the duplicate handle must be closed. unsafe { CloseHandle(self.inner) }.expect("`CloseHandle` should always succeed"); self.inner = HANDLE::default(); } } } + +#[cfg(test)] +mod tests { + // Make sure it doesn't crash + #[test] + fn is_normal_user() { + super::is_normal_user().unwrap(); + } +}