Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

stable shellext: disable debug output per default

To have debug output enabled
- compile with THG_DEBUG set (debug build)
- double-click the file DebugShellExt.reg
- restart explorer

Changeset ddce4294c9ef

Parent 7b7599d33425

by Adrian Buehlmann

Changes to 6 files · Browse files at ddce4294c9ef Showing diff from parent 7b7599d33425 Diff from another changeset...

Change 1 of 1 Show Entire File win32/​shellext/​DebugShellExt.reg Stacked
 
 
 
 
 
 
1
2
3
4
@@ -0,0 +1,4 @@
+Windows Registry Editor Version 5.00 + +[HKEY_CURRENT_USER\Software\TortoiseHg] +"DebugShellExt"="1"
 
2
3
4
5
 
 
6
7
8
 
15
16
17
18
 
 
19
20
21
 
2
3
4
 
5
6
7
8
9
 
16
17
18
 
19
20
21
22
23
@@ -2,7 +2,8 @@
 OBJECTS_DIRSTATE = TortoiseUtils.obj \   Direntry.obj \   Directory.obj \ - Winstat.obj + Winstat.obj \ + ThgDebug.obj    OBJECTS_THGSGELL = $(OBJECTS_DIRSTATE) \   InitStatus.obj \ @@ -15,7 +16,8 @@
  Dirstatecache.obj \   DirectoryStatus.obj \   Thgstatus.obj \ - QueryDirstate.obj + QueryDirstate.obj \ + ThgDebug.obj    LIBS = User32.lib Ole32.lib Shlwapi.lib Shell32.lib Advapi32.lib  DEFFILE = ShellExt.def
 
151
152
153
 
 
 
154
155
156
 
151
152
153
154
155
156
157
158
159
@@ -151,6 +151,9 @@
 can be captured by using for example the tool **DebugView** from Microsoft sysinternals (see  http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx).   +The debug output must be enabled in the registry. Double click the file +"DebugShellExt.reg" and restart explorer. +  Example output (copied via clipboard):    {{{
Change 1 of 1 Show Entire File win32/​shellext/​ThgDebug.cpp Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@@ -0,0 +1,24 @@
+ +// Copyright (C) 2009 Adrian Buehlmann +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. + +#include "ThgDebug.h" +#include "TortoiseUtils.h" + +#include <string> + +bool ThgDebug::regDebugShellExt() +{ + std::string val; + return GetRegistryConfig("DebugShellExt", val) != 0 && val == "1"; +} + +bool ThgDebug::enabled() +{ + static bool e = regDebugShellExt(); + return e; +}
Change 1 of 1 Show Entire File win32/​shellext/​ThgDebug.h Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
@@ -0,0 +1,23 @@
+ +// Copyright (C) 2009 Adrian Buehlmann +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. + +#ifndef THGDEBUG_H +#define THGDEBUG_H + +class ThgDebug +{ +public: + static bool enabled(); + +private: + ThgDebug(); + + static bool regDebugShellExt(); +}; + +#endif
 
15
16
17
 
 
18
19
20
 
24
25
26
27
 
28
29
30
31
32
33
 
 
34
35
36
37
38
 
39
40
41
 
15
16
17
18
19
20
21
22
 
26
27
28
 
29
30
31
32
33
 
 
34
35
36
37
38
39
 
40
41
42
43
@@ -15,6 +15,8 @@
 #include <assert.h>  #include <string>   +#include "ThgDebug.h" +  #define ASSERT assert     @@ -24,18 +26,18 @@
  // TDEBUG_TRACE() prints debugging messages to Windows' debugger display.   // The messages can be viewed with Sysinternals DebugView, which may be   // downloaded from Microsoft TechNet. - #define TDEBUG_TRACE(s) do { \ + #define TDEBUG_TRACE(s) if (ThgDebug::enabled()) { \   std::stringstream _the_msg; \   _the_msg << "[THG] " << s; \   std::string _the_str = _the_msg.str(); \   OutputDebugStringA(_the_str.c_str()); \ - } while (0) - #define TDEBUG_TRACEW(s) do { \ + } + #define TDEBUG_TRACEW(s) if (ThgDebug::enabled()) { \   std::basic_stringstream<wchar_t> _the_msg; \   _the_msg << L"[THG] " << s; \   std::wstring _the_str = _the_msg.str(); \   OutputDebugStringW(_the_str.c_str()); \ - } while (0) + }   #define TDEBUG_ENTER TDEBUG_TRACE  #else   #define TDEBUG_TRACE(s)