Jump to content
Tuts 4 You
  • 0
Alzri2

Figure me out

Rate this question

Question

Alzri2

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

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
mrexodia

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

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
A200K

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 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites
  • 0
Alzri2

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.

Share this post


Link to post
Share on other sites

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...