Alzri2 Posted June 12, 2016 Posted June 12, 2016 Hello everyone, This challenge was written by naquadria in at4re forum: There is a file main.c contains this code: #include <windows.h> int iWinMain() { MessageBoxW(NULL, "PoC", "Hello!", MB_ICONINFORMATION); return 0; } 1- Is there a mistake in the code ? 2- Is it possible to build it ? Try to answer without testing it. One more thing... PM me your answer so others can have fun too, I'll post the answer after 3 days
mrexodia Posted June 12, 2016 Posted June 12, 2016 it might compile, if you put 'iWinMain' as the EntryPoint. it will definitely compile if you compile it as a .lib 1
A200K Posted June 12, 2016 Posted June 12, 2016 (edited) MessageBoxW requires wide chars, and you call it with ansi chars, so it wont work unless the default string type isn't set to wide chars. Its could be possible to build it, but the mesage box might contain unreadable content. Edited June 12, 2016 by A200K Spoiler 1
Alzri2 Posted June 16, 2016 Author Posted June 16, 2016 Time is up Well, if it was a cpp file "main.cpp" it won't compile... but here it's a c file, so it will compile with no problems. However, it will show a message with unreadable content as A200K indicated. Why so ? The unicode version of MessageBox function will treat the string as if it was in UTF-16 encoding which is not the case.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now