File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
library/std/src/sys/pal/windows
src/tools/miri/src/shims/windows Expand file tree Collapse file tree 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> {
202202 |buf, mut sz| {
203203 // GetUserProfileDirectoryW does not quite use the usual protocol for
204204 // 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.
207205 match c:: GetUserProfileDirectoryW (
208206 ptr:: without_provenance_mut ( CURRENT_PROCESS_TOKEN ) ,
209207 buf,
Original file line number Diff line number Diff line change @@ -230,16 +230,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
230230 interp_ok ( match directories:: UserDirs :: new ( ) {
231231 Some ( dirs) => {
232232 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 ) ? {
234234 0 // if the buf pointer is null, we can't write to it; `size` will be updated to the required length
235235 } else {
236236 this. read_scalar ( & size) ?. to_u32 ( ) ?
237237 } ;
238238 // Of course we cannot use `windows_check_buffer_size` here since this uses
239239 // a different method for dealing with a too-small buffer than the other functions...
240240 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
242- // seems to rely on it always being written .
241+ // As per <https://github.com/MicrosoftDocs/sdk-api/pull/1810>, the size is always
242+ // written, not just on failure .
243243 this. write_scalar ( Scalar :: from_u32 ( len. try_into ( ) . unwrap ( ) ) , & size) ?;
244244 if success {
245245 Scalar :: from_i32 ( 1 ) // return TRUE
You can’t perform that action at this time.
0 commit comments