@@ -206,6 +206,20 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
206
206
this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
207
207
}
208
208
209
+ // Dynamic symbol loading
210
+ "GetProcAddress" => {
211
+ #[ allow( non_snake_case) ]
212
+ let & [ hModule, lpProcName] = check_arg_count ( args) ?;
213
+ this. read_scalar ( hModule) ?. not_undef ( ) ?;
214
+ let name = this. memory . read_c_str ( this. read_scalar ( lpProcName) ?. not_undef ( ) ?) ?;
215
+ if let Some ( dlsym) = Dlsym :: from_str ( name, & this. tcx . sess . target . target . target_os ) ? {
216
+ let ptr = this. memory . create_fn_alloc ( FnVal :: Other ( dlsym) ) ;
217
+ this. write_scalar ( Scalar :: from ( ptr) , dest) ?;
218
+ } else {
219
+ this. write_null ( dest) ?;
220
+ }
221
+ }
222
+
209
223
// Miscellaneous
210
224
"SystemFunction036" => {
211
225
// The actual name of 'RtlGenRandom'
@@ -258,17 +272,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
258
272
// Pretend this does not exist / nothing happened, by returning zero.
259
273
this. write_null ( dest) ?;
260
274
}
261
- "GetProcAddress" if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) => {
262
- #[ allow( non_snake_case) ]
263
- let & [ _hModule, lpProcName] = check_arg_count ( args) ?;
264
- let name = this. memory . read_c_str ( this. read_scalar ( lpProcName) ?. not_undef ( ) ?) ?;
265
- if let Some ( dlsym) = Dlsym :: from_str ( name, & this. tcx . sess . target . target . target_os ) ? {
266
- let ptr = this. memory . create_fn_alloc ( FnVal :: Other ( dlsym) ) ;
267
- this. write_scalar ( Scalar :: from ( ptr) , dest) ?;
268
- } else {
269
- this. write_null ( dest) ?;
270
- }
271
- }
272
275
"SetConsoleTextAttribute" if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) => {
273
276
#[ allow( non_snake_case) ]
274
277
let & [ _hConsoleOutput, _wAttribute] = check_arg_count ( args) ?;
0 commit comments