The `GetCurrentProcess` and `IsWow64Process` Windows API calls (mediated through the `windows` crate) are pretty straightforward, and this code is only in the test suite, not in production. Still, it's probably best to have a "SAFETY:" comment where `unsafe` code is used. This adds such a comment, covering those two calls.
Unified · Split
| @@ -181,7 +181,11 @@ mod locations { · 180 unmodified lines | ||
| 181 | 181 | // is for the test suite, and doing it this way allows problems to be caught earlier if |
| 182 | 182 | // a change made on a 64-bit development machine breaks the IsWow64Process() call. |
| 183 | 183 | let mut wow64process = BOOL::default(); |
| 184 | − unsafe { IsWow64Process(GetCurrentProcess(), &mut wow64process)? }; | |
| 184 | + unsafe { | |
| 185 | + // SAFETY: `GetCurrentProcess` always succeeds, and the handle it returns is a | |
| 186 | + // valid process handle to pass to `IsWow64Process`. | |
| 187 | + IsWow64Process(GetCurrentProcess(), &mut wow64process)?; | |
| 188 | + } | |
| 185 | 189 | |
| 186 | 190 | let platform_bitness = if wow64process.as_bool() { |
| 187 | 191 | Self::Is32on64 |