Introduction: I'm an administrator currently working on the dedicated servers of the game "Sniper Elite V2". SEV2's dedicated servers are running under windows in a console application. We are able to run this application under Linux too, with wineHQ. Everything is good, excepted that the console is launched in a new window, so no way to have the console inputs/outputs (link: http://img802.imageshack.us/img802/650/sev22.png). Moreover, we can read (with an HEX editor) that "This program cannot be run in DOS mode". My objective is to bring back DOS compatibility.
My idea is to create another console application written in C++ (with CodeBlocks). This "Hook" should retrieve the content (text) of the dedicated server "window" and will display it, with the possibility of course to input commands to the dedicated server console. Like that, we will be able to work with inputs/outputs both on Windows and Linux. I took the time to draw a little schema : http://img195.imageshack.us/img195/3017/29585679.png
My question is: How to do this ? Which functions should I use ?
At this point, I'm stuck. I've tried the following approaches :
FUNC "AttachConsole
" has failed.
The following pseudo-code has failed too:
mainWindow = FindWindow( TEXT("ConsoleWindowClass"), NULL) );
console = FindWindowEx( mainWindow, NULL, TEXT("ConsoleWindowClass"), NULL );
SendMessage(
console,
WM_GETTEXT,
sizeof(buffer) / sizeof(TCHAR),
(LPARAM)buffer);
I'm using a tool called "WinSpy++
" to help me, but the tool is not able itself to retrieve/input data to the Sniper Elite V2 Dedicated Server.
Any ideas/examples/reflections is welcome :-)