KDECore
kkernel_win.cpp File Reference
#include "kkernel_win.h"
#include <config.h>
#include <QtCore/QBool>
#include <QtCore/QTextCodec>
#include "kglobal.h"
#include <klocale.h>
#include <QtCore/QDir>
#include <QtCore/QString>
#include <QtCore/QLibrary>
#include <windows.h>
#include <shellapi.h>
#include <process.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <iostream>
#include <fstream>
#include <streambuf>
Go to the source code of this file.
Defines | |
#define | FAILURE |
#define | WIN32_CAST_CHAR (LPCWSTR) |
Typedefs | |
typedef BOOL(WINAPI * | attachConsolePtr )(DWORD dwProcessId) |
Functions | |
static bool | attachToConsole () |
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) |
QString | getKde4Prefix () |
QByteArray | getWin32LocaleName () |
QString | getWin32RegistryValue (HKEY key, const QString &subKey, const QString &item, bool *ok=0) |
QString | getWin32ShellFoldersPath (const QString &folder) |
void | initKde4prefixUtf16 () |
bool | isExecutable (const QString &file) |
static void | kMessageOutputDebugString (QtMsgType type, const char *msg) |
static void | kMessageOutputFileIO (QtMsgType type, const char *msg) |
static void | redirectToConsole () |
bool | showWin32FilePropertyDialog (const QString &fileName) |
static int | subSystem () |
Variables | |
static attachConsolePtr | attachConsole = 0 |
static bool | attachConsoleResolved = false |
static QString * | kde4Prefix = NULL |
static wchar_t | kde4prefixUtf16 [MAX_PATH+2] |
static HINSTANCE | kdecoreDllInstance = NULL |
static class kMessageOutputInstaller | kMessageOutputInstallerInstance |
Define Documentation
#define FAILURE |
{ if (ok) \ *ok = false; \ return QString(); }
#define WIN32_CAST_CHAR (LPCWSTR) |
Definition at line 55 of file kkernel_win.cpp.
Typedef Documentation
typedef BOOL(WINAPI* attachConsolePtr)(DWORD dwProcessId) |
try to attach to the parents console
- Returns:
- true if console has been attached, false otherwise
Definition at line 268 of file kkernel_win.cpp.
Function Documentation
static bool attachToConsole | ( | ) | [static] |
Definition at line 271 of file kkernel_win.cpp.
BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL, | |
DWORD | fdwReason, | |||
LPVOID | lpReserved | |||
) |
The dll entry point - get the instance handle for GetModuleFleNameW Maybe also some special initialization / cleanup can be done here.
Definition at line 96 of file kkernel_win.cpp.
QString getKde4Prefix | ( | ) |
Definition at line 85 of file kkernel_win.cpp.
QByteArray getWin32LocaleName | ( | ) |
- Returns:
- two-letter locale name (like "en" or "pl") taken from MS Windows native registry. Useful when we don't want to rely on KSyCoCa. Used e.g. by kbuildsycoca application.
Definition at line 186 of file kkernel_win.cpp.
QString getWin32RegistryValue | ( | HKEY | key, | |
const QString & | subKey, | |||
const QString & | item, | |||
bool * | ok = 0 | |||
) |
- Returns:
- a value from MS Windows native registry.
- Parameters:
-
key is usually one of HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE constants defined in WinReg.h. subKey is a registry subkey defined as a path to a registry folder, eg. "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" ('\' delimiter must be used) item is an item inside subKey or "" if default folder's value should be returned ok if not null, will be set to true on success and false on failure
Definition at line 136 of file kkernel_win.cpp.
Windows-specific functions needed in kdecore.
- Returns:
- a value from MS Windows native registry for shell folder folder.
Definition at line 205 of file kkernel_win.cpp.
void initKde4prefixUtf16 | ( | ) |
Definition at line 62 of file kkernel_win.cpp.
- Returns:
- true when the file is an executable on windows.
Definition at line 452 of file kkernel_win.cpp.
static void kMessageOutputDebugString | ( | QtMsgType | type, | |
const char * | msg | |||
) | [static] |
kde and qt debug message printer using windows debug message port
Definition at line 215 of file kkernel_win.cpp.
static void kMessageOutputFileIO | ( | QtMsgType | type, | |
const char * | msg | |||
) | [static] |
kde and qt debug message printer using FILE pointer based output
Definition at line 246 of file kkernel_win.cpp.
static void redirectToConsole | ( | ) | [static] |
redirect stdout, stderr and cout, wcout, cin, wcin, wcerr, cerr, wclog and clog to console
Definition at line 284 of file kkernel_win.cpp.
Shows native MS Windows file property dialog for a file fileName.
Return true on success. Only works for local absolute paths. Used by KPropertiesDialog, if possible.
Definition at line 170 of file kkernel_win.cpp.
static int subSystem | ( | ) | [static] |
retrieve type of win32 subsystem from the executable header
- Returns:
- type of win32 subsystem - the subsystem types are defined at http://msdn.microsoft.com/en-us/library/ms680339(VS.85).aspx
Definition at line 355 of file kkernel_win.cpp.
Variable Documentation
attachConsolePtr attachConsole = 0 [static] |
Definition at line 269 of file kkernel_win.cpp.
bool attachConsoleResolved = false [static] |
Definition at line 270 of file kkernel_win.cpp.
QString* kde4Prefix = NULL [static] |
Definition at line 60 of file kkernel_win.cpp.
wchar_t kde4prefixUtf16[MAX_PATH+2] [static] |
Definition at line 59 of file kkernel_win.cpp.
HINSTANCE kdecoreDllInstance = NULL [static] |
Definition at line 58 of file kkernel_win.cpp.
class kMessageOutputInstaller kMessageOutputInstallerInstance [static] |
win32 debug and console output handling
source type of output 1. kde/qt debug system - kDebug(), kWarning(), kFatal(), kError(), qDebug(), qWarning(), qFatal() 2. ios - cout, wcout, wcerr, cerr, wclog and clog 3. FILE * - stdout,stderr
application console ------------------ output ----------------- type available qt/kde-debug ios FILE *
cui yes console console console cui no win32debug win32debug no output[1]
gui yes win32debug console console gui no win32debug win32debug win32debug
[1]no redirect solution for FILE * based output yet
TODO: report events to the windows event log system http://msdn.microsoft.com/en-us/library/aa363680(VS.85).aspx setup up debug output