mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
enable console debug logs
svn path=/trunk/; revision=6769
This commit is contained in:
parent
de8a2594e8
commit
cfb3861175
6 changed files with 124 additions and 108 deletions
|
@ -64,6 +64,17 @@ ExplorerGlobals::ExplorerGlobals()
|
|||
}
|
||||
|
||||
|
||||
void log(LPCTSTR txt)
|
||||
{
|
||||
FmtString msg(TEXT("%s\n"), txt);
|
||||
|
||||
if (g_Globals._log)
|
||||
_fputts(msg, g_Globals._log);
|
||||
|
||||
OutputDebugString(msg);
|
||||
}
|
||||
|
||||
|
||||
ResString::ResString(UINT nid)
|
||||
{
|
||||
TCHAR buffer[BUFFER_LEN];
|
||||
|
@ -244,6 +255,8 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
|
|||
|
||||
g_Globals._log = fdopen(1, "w");
|
||||
setvbuf(g_Globals._log, 0, _IONBF, 0);
|
||||
|
||||
LOG("starting explore debug log\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -45,14 +45,6 @@ extern struct ExplorerGlobals
|
|||
#endif
|
||||
} g_Globals;
|
||||
|
||||
#undef LOG
|
||||
|
||||
#define LOG(x) \
|
||||
{ \
|
||||
if (g_Globals._log) _ftprintf(g_Globals._log, TEXT("%s\n"), (LPCTSTR)(x)); \
|
||||
OutputDebugString(FmtString(TEXT("%s\n"), (LPCTSTR)(x))); \
|
||||
}
|
||||
|
||||
|
||||
/// convenient loading of string resources
|
||||
struct ResString : public String
|
||||
|
|
|
@ -54,6 +54,8 @@ struct ShellDirectory : public ShellEntry, public Directory
|
|||
_folder(root_folder, shell_path),
|
||||
_hwnd(hwnd)
|
||||
{
|
||||
CONTEXT("ShellDirectory::ShellDirectory()");
|
||||
|
||||
lstrcpy(_data.cFileName, root_folder.get_name(shell_path));
|
||||
_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
|
||||
_shell_attribs = SFGAO_FOLDER;
|
||||
|
|
|
@ -723,6 +723,7 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
|
|||
|
||||
ShellFolder get_folder(IShellFolder* parent)
|
||||
{
|
||||
CONTEXT("ShellPath::get_folder()");
|
||||
return ShellFolder(parent, _p);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ String Context::getStackTrace() const
|
|||
|
||||
str << "Context Trace:\n";
|
||||
|
||||
for(const Context*p=this; p!=&s_main; p=p->_last) {
|
||||
for(const Context*p=this; p && p!=&s_main; p=p->_last) {
|
||||
str << "- " << p->_ctx;
|
||||
|
||||
if (!p->_obj.empty())
|
||||
|
|
|
@ -55,6 +55,103 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define for if (0) {} else for
|
||||
|
||||
|
||||
#define BUFFER_LEN 1024
|
||||
|
||||
|
||||
extern void log(LPCTSTR txt);
|
||||
|
||||
#define LOG(txt) log(txt)
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define LONGLONGARG TEXT("I64")
|
||||
#else
|
||||
#define LONGLONGARG TEXT("L")
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _tcsrchr
|
||||
#ifdef UNICODE
|
||||
#define _tcsrchr wcsrchr
|
||||
#else
|
||||
#define _tcsrchr strrchr
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _stprintf
|
||||
#ifdef UNICODE
|
||||
#define _stprintf wcsprintf
|
||||
#else
|
||||
#define _stprintf sprintf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __WINE__
|
||||
#ifdef UNICODE
|
||||
extern void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
|
||||
#else
|
||||
extern void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
|
||||
#define FILE_ATTRIBUTE_ENCRYPTED 0x00000040
|
||||
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
|
||||
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
|
||||
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
|
||||
#endif
|
||||
|
||||
|
||||
#define SetDlgCtrlID(hwnd, id) SetWindowLong(hwnd, GWL_ID, id)
|
||||
#define SetWindowStyle(hwnd, val) (DWORD)SetWindowLong(hwnd, GWL_STYLE, val)
|
||||
#define SetWindowExStyle(h, val) (DWORD)SetWindowLong(hwnd, GWL_EXSTYLE, val)
|
||||
#define Window_SetIcon(hwnd, type, hicon) (HICON)SendMessage(hwnd, WM_SETICON, type, (LPARAM)(hicon))
|
||||
|
||||
|
||||
// center window in respect to its parent window
|
||||
extern void CenterWindow(HWND hwnd);
|
||||
|
||||
// move window into visibility
|
||||
extern void MoveVisible(HWND hwnd);
|
||||
|
||||
// display error message
|
||||
extern void display_error(HWND hwnd, DWORD error);
|
||||
|
||||
// convert time_t to WIN32 FILETIME
|
||||
extern BOOL time_to_filetime(const time_t* t, FILETIME* ftime);
|
||||
|
||||
// search for windows of a specific classname
|
||||
extern int find_window_class(LPCTSTR classname);
|
||||
|
||||
// create a bitmap from an icon
|
||||
extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
|
||||
|
||||
// launch a program or document file
|
||||
extern BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow);
|
||||
#ifdef UNICODE
|
||||
extern BOOL launch_fileA(HWND hwnd, LPSTR cmd, UINT nCmdShow);
|
||||
#else
|
||||
#define launch_fileA launch_file
|
||||
#endif
|
||||
|
||||
// call an DLL export like rundll32
|
||||
BOOL RunDLL(HWND hwnd, LPCTSTR dllname, LPCSTR procname, LPCTSTR cmdline, UINT nCmdShow);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -79,15 +176,6 @@ using namespace _com_util;
|
|||
#endif // _MSC_VER && !_NO_COMUTIL
|
||||
|
||||
|
||||
#define for if (0) {} else for
|
||||
|
||||
|
||||
#define BUFFER_LEN 1024
|
||||
|
||||
|
||||
#define LOG(x) OutputDebugString(FmtString(TEXT("%s\n"), (LPCTSTR)(x)));
|
||||
|
||||
|
||||
/// initialization of windows common controls
|
||||
struct CommonControlInit
|
||||
{
|
||||
|
@ -706,9 +794,17 @@ struct Context
|
|||
s_current = this;
|
||||
}
|
||||
|
||||
Context(const Context& other)
|
||||
: _ctx(other._ctx),
|
||||
_obj(other._obj)
|
||||
{
|
||||
_last = NULL;
|
||||
}
|
||||
|
||||
~Context()
|
||||
{
|
||||
s_current = _last;
|
||||
_last = NULL;
|
||||
}
|
||||
|
||||
String toString() const;
|
||||
|
@ -717,12 +813,12 @@ struct Context
|
|||
const char* _ctx;
|
||||
String _obj;
|
||||
|
||||
static Context current() {return *s_current;}
|
||||
static Context& current() {return *s_current;}
|
||||
|
||||
protected:
|
||||
Context* _last;
|
||||
|
||||
static Context* s_current;
|
||||
static Context* s_current; ///@todo use TLS
|
||||
static Context s_main;
|
||||
};
|
||||
|
||||
|
@ -733,91 +829,3 @@ protected:
|
|||
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define LONGLONGARG TEXT("I64")
|
||||
#else
|
||||
#define LONGLONGARG TEXT("L")
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _tcsrchr
|
||||
#ifdef UNICODE
|
||||
#define _tcsrchr wcsrchr
|
||||
#else
|
||||
#define _tcsrchr strrchr
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _stprintf
|
||||
#ifdef UNICODE
|
||||
#define _stprintf wcsprintf
|
||||
#else
|
||||
#define _stprintf sprintf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __WINE__
|
||||
#ifdef UNICODE
|
||||
extern void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
|
||||
#else
|
||||
extern void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
|
||||
#define FILE_ATTRIBUTE_ENCRYPTED 0x00000040
|
||||
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
|
||||
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
|
||||
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
|
||||
#endif
|
||||
|
||||
|
||||
#define SetDlgCtrlID(hwnd, id) SetWindowLong(hwnd, GWL_ID, id)
|
||||
#define SetWindowStyle(hwnd, val) (DWORD)SetWindowLong(hwnd, GWL_STYLE, val)
|
||||
#define SetWindowExStyle(h, val) (DWORD)SetWindowLong(hwnd, GWL_EXSTYLE, val)
|
||||
#define Window_SetIcon(hwnd, type, hicon) (HICON)SendMessage(hwnd, WM_SETICON, type, (LPARAM)(hicon))
|
||||
|
||||
|
||||
|
||||
// center window in respect to its parent window
|
||||
extern void CenterWindow(HWND hwnd);
|
||||
|
||||
// move window into visibility
|
||||
extern void MoveVisible(HWND hwnd);
|
||||
|
||||
// display error message
|
||||
extern void display_error(HWND hwnd, DWORD error);
|
||||
|
||||
// convert time_t to WIN32 FILETIME
|
||||
extern BOOL time_to_filetime(const time_t* t, FILETIME* ftime);
|
||||
|
||||
// search for windows of a specific classname
|
||||
extern int find_window_class(LPCTSTR classname);
|
||||
|
||||
// create a bitmap from an icon
|
||||
extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
|
||||
|
||||
// launch a program or document file
|
||||
extern BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow);
|
||||
#ifdef UNICODE
|
||||
extern BOOL launch_fileA(HWND hwnd, LPSTR cmd, UINT nCmdShow);
|
||||
#else
|
||||
#define launch_fileA launch_file
|
||||
#endif
|
||||
|
||||
// call an DLL export like rundll32
|
||||
BOOL RunDLL(HWND hwnd, LPCTSTR dllname, LPCSTR procname, LPCTSTR cmdline, UINT nCmdShow);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue