File tree 2 files changed +3
-5
lines changed
library/std/src/sys/pal/windows
src/tools/miri/src/shims/windows
2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -202,8 +202,6 @@ fn home_dir_crt() -> Option<PathBuf> {
202
202
|buf, mut sz| {
203
203
// GetUserProfileDirectoryW does not quite use the usual protocol for
204
204
// negotiating the buffer size, so we have to translate.
205
- // FIXME(#141254): We rely on the *undocumented* property that this function will
206
- // always set the size, not just on failure.
207
205
match c:: GetUserProfileDirectoryW (
208
206
ptr:: without_provenance_mut ( CURRENT_PROCESS_TOKEN ) ,
209
207
buf,
Original file line number Diff line number Diff line change @@ -230,16 +230,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
230
230
interp_ok ( match directories:: UserDirs :: new ( ) {
231
231
Some ( dirs) => {
232
232
let home = dirs. home_dir ( ) ;
233
- let size_avail = if this. ptr_is_null ( size . ptr ( ) ) ? {
233
+ let size_avail = if this. ptr_is_null ( buf ) ? {
234
234
0 // if the buf pointer is null, we can't write to it; `size` will be updated to the required length
235
235
} else {
236
236
this. read_scalar ( & size) ?. to_u32 ( ) ?
237
237
} ;
238
238
// Of course we cannot use `windows_check_buffer_size` here since this uses
239
239
// a different method for dealing with a too-small buffer than the other functions...
240
240
let ( success, len) = this. write_path_to_wide_str ( home, buf, size_avail. into ( ) ) ?;
241
- // The Windows docs just say that this is written on failure, but std relies on it
242
- // always being written. Also see <https://github.com/rust-lang/rust/issues/141254> .
241
+ // As per <https://github.com/MicrosoftDocs/sdk-api/pull/1810>, the size is always
242
+ // written, not just on failure .
243
243
this. write_scalar ( Scalar :: from_u32 ( len. try_into ( ) . unwrap ( ) ) , & size) ?;
244
244
if success {
245
245
Scalar :: from_i32 ( 1 ) // return TRUE
You can’t perform that action at this time.
0 commit comments