scanf problem

Ivan Leo Murray-Smith puoti at inwind.it
Wed Feb 18 14:27:08 CST 2004


Apparently there is a problem with wine's scanf. this code

#include <stdio.h>

int main()
{
int a;
printf ("Type a number\n");
scanf ("%d", &a);
printf ("You've entered %d\n", a);
return 0;
}

works as expected on linux, but on wine returns
[ivan at localhost ivan]$ wine test.exe
Type a number
5
You've entered 1076166144
[ivan at localhost ivan]$
Dimi thinks it's a bug and asked me to fwd this to wine-devel, a very similar
program that has the same problem works on windows, I can't test this one
because I do't currently have access to a windows box, but unless I've some
badly bugged header or something like that, this is a bug.

a msvcrt.dll trace follows
[ivan at localhost ivan]$ wine test.exe --debugmsg +msvcrt
trace:msvcrt:DllMain (0x407d0000, DLL_PROCESS_ATTACH, 0x1) pid(8), tid(9), tls(0)
trace:msvcrt:msvcrt_init_mt_locks initializing mtlocks
trace:msvcrt:msvcrt_init_io :handles (0x14)(0x24)(0x2c)
trace:msvcrt:msvcrt_init_console :Opening console handles
warn:msvcrt:msvcrt_init_console :Console handle Initialisation FAILED!
trace:msvcrt:msvcrt_init_args got 'test.exe', wide = L"test.exe" argc=1
trace:msvcrt:MSVCRT_setlocale (0 C)
trace:msvcrt:_lock (19)
trace:msvcrt:_lock (17)
trace:msvcrt:_lock : creating lock #19
trace:msvcrt:_unlock (17)
trace:msvcrt:_unlock (19)
trace:msvcrt:DllMain finished process init
trace:msvcrt:MSVCRT___set_app_type (1) Console application
trace:msvcrt:__getmainargs (0x403000,0x403004,0x407bff10,-1,0x407bff14).
trace:msvcrt:_lock (9)
trace:msvcrt:_lock (17)
trace:msvcrt:_lock : creating lock #9
trace:msvcrt:_unlock (17)
trace:msvcrt:_unlock (9)
trace:msvcrt:MSVCRT_atexit (0x4013b0)
trace:msvcrt:_onexit (0x4013b0)
trace:msvcrt:_lock (13)
trace:msvcrt:_lock (17)
trace:msvcrt:_lock : creating lock #13
trace:msvcrt:_unlock (17)
trace:msvcrt:_onexit expanding table
trace:msvcrt:_unlock (13)
Type a number
warn:msvcrt:MSVCRT_fscanf 0x408068e0 ("%d"): semi-stub
trace:msvcrt:_read :fd (0) handle (0x14) buf (0x40363f18) len (512)
5
trace:msvcrt:_read :EOF
trace:msvcrt:_read "5\n"
trace:msvcrt:MSVCRT_fscanf returning 1
You've entered 1076166144
trace:msvcrt:MSVCRT__cexit (void)
trace:msvcrt:DllMain (0x407d0000, DLL_PROCESS_DETACH, 0x1) pid(8), tid(9), tls(0)
trace:msvcrt:msvcrt_free_mt_locks : uninitializing all mtlocks
trace:msvcrt:_fcloseall :closed (0) handles
trace:msvcrt:_close :fd (0) handle (0x14)
trace:msvcrt:msvcrt_free_fd :fd (0) freed
trace:msvcrt:_close :ok
trace:msvcrt:_close :fd (1) handle (0x24)
trace:msvcrt:msvcrt_free_fd :fd (1) freed
trace:msvcrt:_close :ok
trace:msvcrt:_close :fd (2) handle (0x2c)
trace:msvcrt:msvcrt_free_fd :fd (2) freed
trace:msvcrt:_close :ok
trace:msvcrt:msvcrt_free_console :Closing console handles
trace:msvcrt:DllMain finished process free
[ivan at localhost ivan]$

Ivan.





More information about the wine-devel mailing list