Jump to content
Tuts 4 You

Recommended Posts

Posted

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 :)

Posted

it might compile, if you put 'iWinMain' as the EntryPoint. it will definitely compile if you compile it as a .lib

  • Like 1
Posted (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 by A200K
Spoiler
  • Like 1
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...