_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Macros | Typedefs | Functions | Variables
attachconsole.cpp File Reference
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <stdio.h>

Macros

#define _WIN32_WINNT_WIN2K   0x0500
 

Typedefs

typedef int FAR WINAPI proto_AttachConsole(int)
 
typedef int FAR WINAPI proto_NtQueryObject(HANDLE, int, void *, unsigned long int, unsigned long int *)
 

Functions

static int WINAPI_CheckIfConsoleHandle (HANDLE handle)
 Check if HANDLE is attached to console. More...
 
static void WINAPI_ReopenFileFromHandle (HANDLE handle, FILE *file, const char *mode)
 Try to reopen FILE* from WINAPI HANDLE. More...
 
static void WINAPI_SetStdHandleFromFile (int type, FILE *file)
 Try to set std HANDLE from FILE*. More...
 
static void WINAPI_AttachConsole (void)
 Try attach console of parent process for std input/output in Windows NT, 2000, XP or new. More...
 
 __attribute__ ((constructor)) static void initialize(void)
 This section set that WINAPI_AttachConsole() will be called at application startup before main() More...
 

Variables

static int fixmode = 0
 
static HINSTANCE lib_kernel32 = NULL
 
static HINSTANCE lib_ntdll = NULL
 
static proto_AttachConsole * func_AttachConsole = NULL
 
static proto_NtQueryObject * func_NtQueryObject = NULL
 

Macro Definition Documentation

#define _WIN32_WINNT_WIN2K   0x0500

Typedef Documentation

typedef int FAR WINAPI proto_AttachConsole(int)
typedef int FAR WINAPI proto_NtQueryObject(HANDLE, int, void *, unsigned long int, unsigned long int *)

Function Documentation

__attribute__ ( (constructor)  )

This section set that WINAPI_AttachConsole() will be called at application startup before main()

static void WINAPI_AttachConsole ( void  )
static

Try attach console of parent process for std input/output in Windows NT, 2000, XP or new.

static int WINAPI_CheckIfConsoleHandle ( HANDLE  handle)
static

Check if HANDLE is attached to console.

static void WINAPI_ReopenFileFromHandle ( HANDLE  handle,
FILE *  file,
const char *  mode 
)
static

Try to reopen FILE* from WINAPI HANDLE.

static void WINAPI_SetStdHandleFromFile ( int  type,
FILE *  file 
)
static

Try to set std HANDLE from FILE*.

Variable Documentation

int fixmode = 0
static
proto_AttachConsole* func_AttachConsole = NULL
static
proto_NtQueryObject* func_NtQueryObject = NULL
static
HINSTANCE lib_kernel32 = NULL
static
HINSTANCE lib_ntdll = NULL
static
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.