| View previous topic :: View next topic |
| Author |
Message |
iCucco Advanced Cheater
Reputation: 0
Joined: 11 May 2007 Posts: 51 Location: 0x0600
|
Posted: Sun Feb 03, 2008 10:10 am Post subject: [C] Console to WIN32 GUI Application |
|
|
Hey,
Is there a way to create a console window into existing WIN32 GUI application (jaac is a good example). I tried AllocConsole() but it didn't even open the console window. Any suggestions/tips?
Thank you~
_________________
printf("You just ate a %X!!\n",3735928559); |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sun Feb 03, 2008 10:57 am Post subject: |
|
|
I know in CodeBLocks if you select console application it will show the command line by default. I never tried it in VS
_________________
|
|
| Back to top |
|
 |
iCucco Advanced Cheater
Reputation: 0
Joined: 11 May 2007 Posts: 51 Location: 0x0600
|
Posted: Sun Feb 03, 2008 11:00 am Post subject: |
|
|
The point is to make DLL that can be injected with BOOL APPENTRY DllMain().
Then DllMain() will create a thread that will allocate console with AllocConsole(). This is the point I'm stuck with.
_________________
printf("You just ate a %X!!\n",3735928559); |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Feb 03, 2008 11:10 am Post subject: |
|
|
read and learn from this
http://www.halcyon.com/~ast/dload/guicon.htm
(yes, its old, try to focus on the console coding, like GetStdHandle and such)
just in Dll you have to create a thread in the DLL_PROCESS_ATTACH and then u can code everything from there.
_________________
Last edited by lurc on Sun Feb 03, 2008 11:12 am; edited 1 time in total |
|
| Back to top |
|
 |
iCucco Advanced Cheater
Reputation: 0
Joined: 11 May 2007 Posts: 51 Location: 0x0600
|
Posted: Sun Feb 03, 2008 11:12 am Post subject: |
|
|
Exactly... That was my source for the first attempt. Opened the console window but didn't display any output / input.
_________________
printf("You just ate a %X!!\n",3735928559); |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
|
| Back to top |
|
 |
iCucco Advanced Cheater
Reputation: 0
Joined: 11 May 2007 Posts: 51 Location: 0x0600
|
Posted: Sun Feb 03, 2008 11:27 am Post subject: |
|
|
Woo! Found a way.
| Code: |
DWORD dwBytesWritten;
AllocConsole();
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
WriteFile(handle, "test", strlen("test"), &dwBytesWritten, NULL);
_getch();
FreeConsole();
|
Though usage of WriteFile is complicated, I'm glad that I even managed to get the output to console.
_________________
printf("You just ate a %X!!\n",3735928559); |
|
| Back to top |
|
 |
DoomsDay Grandmaster Cheater
Reputation: 0
Joined: 06 Jan 2007 Posts: 768 Location: %HomePath%
|
Posted: Sun Feb 03, 2008 2:02 pm Post subject: |
|
|
Better use WriteFile - it allows you to dump your output to text files(batch files\cmd often use that).
|
|
| Back to top |
|
 |
|