Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

fogcreek shellext: use ATLTRACE for debugging output

Changeset 9d0bb7d14767

Parent 9f723e2a829d

by David Golub

Changes to 15 files · Browse files at 9d0bb7d14767 Showing diff from parent 9f723e2a829d Diff from another changeset...

 
127
128
129
130
 
131
132
133
 
144
145
146
147
 
148
149
150
 
157
158
159
160
161
162
163
 
164
165
166
 
180
181
182
183
 
184
185
186
187
 
188
189
190
 
223
224
225
226
 
227
228
229
 
237
238
239
240
 
241
242
243
244
245
246
 
247
248
249
 
272
273
274
275
 
276
277
278
 
286
287
288
289
 
290
291
292
293
294
295
296
 
297
298
299
 
304
305
306
307
 
308
309
310
 
326
327
328
329
 
330
331
332
 
340
341
342
343
344
 
345
346
347
 
359
360
361
362
363
 
364
365
366
 
370
371
372
373
 
374
375
376
377
378
379
 
380
381
382
 
401
402
403
404
 
405
406
407
 
421
422
423
424
425
 
 
426
427
428
 
477
478
479
480
481
482
483
 
 
484
485
486
 
548
549
550
551
 
552
553
554
 
565
566
567
568
 
569
570
571
572
573
574
 
575
576
577
 
580
581
582
583
584
585
586
 
 
587
588
589
 
619
620
621
622
623
624
625
626
 
 
627
628
629
630
631
 
632
633
634
635
636
 
637
638
639
 
643
644
645
646
647
648
649
 
 
 
650
651
652
 
673
674
675
676
677
 
678
679
680
 
691
692
693
694
695
 
 
696
697
698
 
701
702
703
704
705
 
 
706
707
708
709
710
711
712
 
 
713
714
715
 
780
781
782
783
 
784
785
786
 
812
813
814
815
 
816
817
818
 
832
833
834
835
 
836
837
838
839
 
840
841
842
 
844
845
846
847
 
848
849
850
 
852
853
854
855
 
856
857
858
 
869
870
871
872
 
873
874
875
 
879
880
881
882
883
884
 
 
 
885
886
887
 
889
890
891
892
 
893
894
895
896
 
897
898
899
900
901
902
 
 
903
904
905
 
 
906
907
908
 
926
927
928
929
 
930
931
932
933
 
934
935
936
937
938
939
940
 
941
942
943
 
949
950
951
952
 
953
954
955
 
957
958
959
960
 
961
962
963
964
965
966
967
 
968
969
970
 
127
128
129
 
130
131
132
133
 
144
145
146
 
147
148
149
150
 
157
158
159
 
 
 
 
160
161
162
163
 
177
178
179
 
180
181
182
183
 
184
185
186
187
 
220
221
222
 
223
224
225
226
 
234
235
236
 
237
238
239
240
241
 
 
242
243
244
245
 
268
269
270
 
271
272
273
274
 
282
283
284
 
285
286
287
288
289
290
 
 
291
292
293
294
 
299
300
301
 
302
303
304
305
 
321
322
323
 
324
325
326
327
 
335
336
337
 
 
338
339
340
341
 
353
354
355
 
 
356
357
358
359
 
363
364
365
 
366
367
368
369
370
371
 
372
373
374
375
 
394
395
396
 
397
398
399
400
 
414
415
416
 
 
417
418
419
420
421
 
470
471
472
 
 
 
 
473
474
475
476
477
 
539
540
541
 
542
543
544
545
 
556
557
558
 
559
560
561
562
563
564
 
565
566
567
568
 
571
572
573
 
 
 
 
574
575
576
577
578
 
608
609
610
 
 
 
 
 
611
612
613
614
615
616
 
617
618
619
620
 
 
621
622
623
624
 
628
629
630
 
 
 
 
631
632
633
634
635
636
 
657
658
659
 
 
660
661
662
663
 
674
675
676
 
 
677
678
679
680
681
 
684
685
686
 
 
687
688
689
690
691
692
 
 
 
693
694
695
696
697
 
762
763
764
 
765
766
767
768
 
794
795
796
 
797
798
799
800
 
814
815
816
 
817
818
819
820
 
821
822
823
824
 
826
827
828
 
829
830
831
832
 
834
835
836
 
837
838
839
840
 
851
852
853
 
854
855
856
857
 
861
862
863
 
 
 
864
865
866
867
868
869
 
871
872
873
 
874
875
876
877
 
878
879
880
 
 
 
 
881
882
883
 
 
884
885
886
887
888
 
906
907
908
 
909
910
911
912
 
913
914
915
916
917
918
919
 
920
921
922
923
 
929
930
931
 
932
933
934
935
 
937
938
939
 
940
941
942
943
944
945
946
 
947
948
949
950
@@ -127,7 +127,7 @@
   void CShellExtCMenuBase::AddMenuList(UINT idCmd, const std::string& name)  { - TDEBUG_TRACE("AddMenuList: idCmd = " << idCmd << " name = " << name); + ATLTRACE("AddMenuList: idCmd = %d, name = '%s'\n", idCmd, name.c_str());   myMenuIdMap[idCmd] = myDescMap[name];  }   @@ -144,7 +144,7 @@
  subkey += L"\\";   subkey += MultibyteToWide(name);   - TDEBUG_TRACEW(L"GetCMenuTranslation: " << subkey); + ATLTRACE(L"GetCMenuTranslation: '%s'\n", subkey.c_str());     HKEY hkey = 0;   LONG rv = RegOpenKeyExW( @@ -157,10 +157,7 @@
  }   else   { - TDEBUG_TRACEW( - L"GetCMenuTranslation: RegOpenKeyExW(\"" - << subkey << "\") failed" - ); + ATLTRACE(L"GetCMenuTranslation: RegOpenKeyExW('%s') failed\n", subkey.c_str());   }     if (hkey) @@ -180,11 +177,11 @@
    if (md.name.empty())   { - TDEBUG_TRACE("**** InitMenuMaps: ignoring entry with empty name"); + ATLTRACE("**** InitMenuMaps: ignoring entry with empty name\n");   break;   }   - TDEBUG_TRACE("InitMenuMaps: adding " << md.name); + ATLTRACE("InitMenuMaps: adding '%s'\n", md.name.c_str());     // Look for translation of menu and help text   if (!lang.empty()) @@ -223,7 +220,7 @@
  }   else   { - TDEBUG_TRACE(" ***** InsertMenuItemWithIcon1: can't find " + iconName); + ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", iconName.c_str());   }   }   else @@ -237,13 +234,12 @@
  }   else   { - TDEBUG_TRACE(" ***** InsertMenuItemWithIcon1: can't find " + iconName); + ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", iconName.c_str());   }   }   InsertMenuItemW(hMenu, indexMenu, TRUE, &mi);   - TDEBUG_TRACEW( - L"InsertMenuItemWithIcon1(\"" << menuText << L"\") finished"); + ATLTRACE(L"InsertMenuItemWithIcon1('%s') finished\n", menuText.c_str());  }     @@ -272,7 +268,7 @@
  }   else   { - TDEBUG_TRACE(" ***** InsertSubMenuItemWithIcon2: can't find " + iconName); + ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", iconName.c_str());   }   }   else @@ -286,14 +282,13 @@
  }   else   { - TDEBUG_TRACE(" ***** InsertSubMenuItemWithIcon2: can't find " + iconName); + ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", iconName.c_str());   }   }     InsertMenuItemW(hMenu, indexMenu, TRUE, &mi);   - TDEBUG_TRACEW( - L"InsertMenuItemWithIcon2(\"" << menuText << L"\") finished"); + ATLTRACE(L"InsertMenuItemWithIcon2('%s') finished\n", menuText.c_str());  }     @@ -304,7 +299,7 @@
  MenuDescriptionMap::iterator iter = myDescMap.find(name);   if (iter == myDescMap.end())   { - TDEBUG_TRACE("***** InsertMenuItemByName: can't find menu info for " << name); + ATLTRACE("***** InsertMenuItemByName: can't find menu info for '%s'\n", name.c_str());   return;   }   @@ -326,7 +321,7 @@
  const int count = ::GetMenuItemCount(hMenu);   if (count == -1)   { - TDEBUG_TRACE("***** HasTortoiseMenu: GetMenuItemCount returned -1"); + ATLTRACE("***** HasTortoiseMenu: GetMenuItemCount returned -1\n");   return -1;   }   @@ -340,8 +335,7 @@
  mii.fMask = MIIM_STRING;   BOOL res = ::GetMenuItemInfoW(hMenu, i, true, &mii);   if (res == 0) { - TDEBUG_TRACE("HasTortoiseMenu: " - << "first GetMenuItemInfo returned 0"); + ATLTRACE("HasTortoiseMenu: first GetMenuItemInfo returned 0\n");   continue;   }   @@ -359,8 +353,7 @@
  ++mii.cch; // size of buffer is one more than length of string   res = ::GetMenuItemInfoW(hMenu, i, true, &mii);   if (res == 0) { - TDEBUG_TRACE("HasTortoiseMenu: " - << "second GetMenuItemInfo returned 0"); + ATLTRACE("HasTortoiseMenu: second GetMenuItemInfo returned 0\n");   continue;   }   @@ -370,13 +363,13 @@
    if (menuitemtext == TortoiseHgMenuEntryString)   { - TDEBUG_TRACE("HasTortoiseMenu: FOUND TortoiseHg menu entry"); + ATLTRACE("HasTortoiseMenu: FOUND TortoiseHg menu entry\n");   hasmenu = true;   return 0;   }   }   - TDEBUG_TRACE("HasTortoiseMenu: TortoiseHg menu entry NOT found"); + ATLTRACE("HasTortoiseMenu: TortoiseHg menu entry NOT found\n");   return 0;  }   @@ -401,7 +394,7 @@
 CShellExtCMenuBase::QueryContextMenu(   HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)  { - TDEBUG_TRACE("CShellExtCMenu::QueryContextMenu"); + ATLTRACE("CShellExtCMenu::QueryContextMenu\n");     UINT idCmd = idCmdFirst;   BOOL bAppendItems = TRUE; @@ -421,8 +414,8 @@
  bool hasthgmenu = false;   if (HasTortoiseMenu(hMenu, hasthgmenu) == 0 && hasthgmenu)   { - TDEBUG_TRACE("CShellExtCMenu::QueryContextMenu: " - << "TortoiseHg menu entry already in menu -> skipping"); + ATLTRACE("CShellExtCMenu::QueryContextMenu: " + "TortoiseHg menu entry already in menu -> skipping");   return S_OK;   }   @@ -477,10 +470,8 @@
  }   }   - TDEBUG_TRACE( - "CShellExtCMenu::QueryContextMenu: isHgrepo = " - << isHgrepo << ", fileMenu = " << fileMenu - ); + ATLTRACE("CShellExtCMenu::QueryContextMenu: isHgrepo = %d, fileMenu = %d\n", + isHgrepo, fileMenu);     /* We have three menu types: files-selected, no-files-selected, no-repo */   const char* entries_string = 0; @@ -548,7 +539,7 @@
    }   - TDEBUG_TRACE(" CShellExtCMenu::QueryContextMenu: adding main THG menu"); + ATLTRACE(" CShellExtCMenu::QueryContextMenu: adding main THG menu\n");   InsertSubMenuItemWithIcon2(hMenu, hSubMenu, indexMenu++, idCmd++,   TortoiseHgMenuEntryString, "hg.ico");   @@ -565,13 +556,13 @@
 STDMETHODIMP  CShellExtCMenuBase::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)  { - TDEBUG_TRACE("CShellExtCMenu::InvokeCommand"); + ATLTRACE("CShellExtCMenu::InvokeCommand");     HRESULT hr = E_INVALIDARG;   if (!HIWORD(lpcmi->lpVerb))   {   UINT idCmd = LOWORD(lpcmi->lpVerb); - TDEBUG_TRACE("CShellExtCMenu::InvokeCommand: idCmd = " << idCmd); + ATLTRACE("CShellExtCMenu::InvokeCommand: idCmd = %d\n", idCmd);   MenuIdCmdMap::iterator iter = myMenuIdMap.find(idCmd);   if (iter != myMenuIdMap.end())   { @@ -580,10 +571,8 @@
  }   else   { - TDEBUG_TRACE( - "***** CShellExtCMenu::InvokeCommand: action not found for idCmd " - << idCmd - ); + ATLTRACE("***** CShellExtCMenu::InvokeCommand: action not found " + "for idCmd %d\n", idCmd);   }   }   return hr; @@ -619,21 +608,17 @@
  sflags = "GCS_VERBA"; break;   }   - TDEBUG_TRACE( - "CShellExtCMenu::GetCommandString: idCmd = " << idCmd - << ", uFlags = " << uFlags << " (" << sflags << ")" - << ", cchMax = " << cchMax - ); + ATLTRACE("CShellExtCMenu::GetCommandString: idCmd = %d, uFlags = %d (%s), " + "cchMax = %d\n", idCmd, uFlags, sflags, cchMax);     MenuIdCmdMap::iterator iter = myMenuIdMap.find(static_cast<UINT>(idCmd));   if (iter == myMenuIdMap.end())   { - TDEBUG_TRACE("***** CShellExtCMenu::GetCommandString: idCmd not found"); + ATLTRACE("***** CShellExtCMenu::GetCommandString: idCmd not found\n");   }   else   { - TDEBUG_TRACE( - "CShellExtCMenu::GetCommandString: name = \"" << iter->second.name << "\""); + ATLTRACE("CShellExtCMenu::GetCommandString: name = '%s'\n", iter->second.name.c_str());     if (uFlags == GCS_HELPTEXTW)   { @@ -643,10 +628,9 @@
  size_t size = iter->second.helpText.size();   if (size >= 40)   { - TDEBUG_TRACE( - "***** CShellExtCMenu::GetCommandString: warning:" - << " length of help text is " << size - << ", which is not reasonably short (<40)"); + ATLTRACE("***** CShellExtCMenu::GetCommandString: warning: " + "length of help text is %d, which is not reasonably " + "short (<40)\n", size);   }   }   else if (uFlags == GCS_HELPTEXTA) @@ -673,8 +657,7 @@
    if (cchMax < 1)   { - TDEBUG_TRACE("CShellExtCMenu::GetCommandString: cchMax = " - << cchMax << " (is <1)"); + ATLTRACE("CShellExtCMenu::GetCommandString: cchMax = %d (is <1)\n", cchMax);   return res;   }   @@ -691,8 +674,8 @@
    size = wcslen(src);   - TDEBUG_TRACEW(L"CShellExtCMenu::GetCommandString: res = " << int(res) - << L", pszName (wide) = \"" << dest << L"\""); + ATLTRACE(L"CShellExtCMenu::GetCommandString: res = %d, " + L"pszName (wide) = '%s'\n", (int)res, dest);   }   else   { @@ -701,15 +684,14 @@
    size = strlen(psz);   - TDEBUG_TRACE("CShellExtCMenu::GetCommandString: res = " << int(res) - << ", pszName = \"" << psz << "\""); + ATLTRACE("CShellExtCMenu::GetCommandString: res = %d, pszName = '%s'\n", + (int)res, psz);   }     if (size > cchMax-1)   { - TDEBUG_TRACE( - "***** CShellExtCMenu::GetCommandString: string was truncated: size = " - << size << ", cchMax = " << cchMax); + ATLTRACE("***** CShellExtCMenu::GetCommandString: string was truncated: " + "size = %d, cchMax = %d\n", size, cchMax);   }     return res; @@ -780,7 +762,7 @@
  std::string dir = GetTHgProgRoot();   if (dir.empty())   { - TDEBUG_TRACE("RunDialog: THG root is empty"); + ATLTRACE("RunDialog: THG root is empty\n");   return;   }   std::string hgcmd = dir + "\\thgw.exe"; @@ -812,7 +794,7 @@
  }   else   { - TDEBUG_TRACE("***** RunDialog: can't get cwd"); + ATLTRACE("***** RunDialog: can't get cwd\n");   return;   }   @@ -832,11 +814,11 @@
  const std::string tempfile = GetTemporaryFile();   if (tempfile.empty())   { - TDEBUG_TRACE("***** RunDialog: error: GetTemporaryFile returned empty string"); + ATLTRACE("***** RunDialog: error: GetTemporaryFile returned empty string\n");   return;   }   - TDEBUG_TRACE("RunDialog: temp file = " << tempfile); + ATLTRACE("RunDialog: temp file = %s\n", tempfile.c_str());   HANDLE tempfileHandle = CreateFileA(   tempfile.c_str(), GENERIC_WRITE,   FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 @@ -844,7 +826,7 @@
    if (tempfileHandle == INVALID_HANDLE_VALUE)   { - TDEBUG_TRACE("***** RunDialog: error: failed to create file " << tempfile); + ATLTRACE("***** RunDialog: error: failed to create file '%s'\n", tempfile.c_str());   return;   }   @@ -852,7 +834,7 @@
  for (ST i = 0; i < myFiles.size(); i++)   {   DWORD dwWritten; - TDEBUG_TRACE("RunDialog: temp file adding " << myFiles[i]); + ATLTRACE("RunDialog: temp file adding '%s'\n", myFiles[i].c_str());   WriteFile(   tempfileHandle, myFiles[i].c_str(),   static_cast<DWORD>(myFiles[i].size()), &dwWritten, 0 @@ -869,7 +851,7 @@
   void CShellExtCMenuBase::PrintDebugHeader(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj)  { - TDEBUG_TRACE("CShellExtCMenu::Initialize"); + ATLTRACE("CShellExtCMenu::Initialize\n");     // get installed MSI product id (for debugging purposes for now)  #ifdef _M_X64 @@ -879,9 +861,9 @@
 #endif   std::vector<char> product_id(50, 0);   UINT msires = ::MsiGetProductCodeA(shellexid, &product_id[0]); - TDEBUG_TRACE("MSI shellexid: " << shellexid); - TDEBUG_TRACE("MSI msires: " << msires); - TDEBUG_TRACE("MSI installed product id: " << &product_id[0]); + ATLTRACE("MSI shellexid: %s\n", shellexid); + ATLTRACE("MSI msires: %d", msires); + ATLTRACE("MSI installed product id: %s\n", &product_id[0]);     DWORD busize = 300;   std::vector<char> buf(busize, 0); @@ -889,20 +871,18 @@
  &product_id[0], INSTALLPROPERTY_INSTALLLOCATION, &buf[0], &busize);   if (msires == ERROR_SUCCESS)   { - TDEBUG_TRACE("MSI install location: " << &buf[0]); + ATLTRACE("MSI install location: %s\n", &buf[0]);   }   else   { - TDEBUG_TRACE("MSI install location: error " << msires); + ATLTRACE("MSI install location: error %d\n", msires);   }   - TDEBUG_TRACEW( - L"---- TortoiseHg shell extension version " - << ThgVersion::get() << L"----" - ); + ATLTRACE(L"---- TortoiseHg shell extension version %s ----", + ThgVersion::get().c_str());   - TDEBUG_TRACE(" pIDFolder: " << pIDFolder); - TDEBUG_TRACE(" pDataObj: " << pDataObj); + ATLTRACE(" pIDFolder: %p\n", pIDFolder); + ATLTRACE(" pDataObj: %p\n", pDataObj);  }    STDMETHODIMP CShellExtCMenuBase::Initialize( @@ -926,18 +906,18 @@
  if (hDrop)   {   UINT uNumFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); - TDEBUG_TRACE(" hDrop uNumFiles = " << uNumFiles); + ATLTRACE(" hDrop uNumFiles = %d\n", uNumFiles);   for (UINT i = 0; i < uNumFiles; ++i) {   if (DragQueryFile(hDrop, i, name, MAX_PATH) > 0)   { - TDEBUG_TRACE(" DragQueryFile [" << i << "] = " << name); + ATLTRACE(" DragQueryFile [%d] = '%s'\n", i, name);   myFiles.push_back(name);   }   }   }   else   { - TDEBUG_TRACE(" hDrop is NULL "); + ATLTRACE(" hDrop is NULL\n");   }     GlobalUnlock(stg.hGlobal); @@ -949,7 +929,7 @@
  }   else   { - TDEBUG_TRACE(" pDataObj->GetData failed"); + ATLTRACE(" pDataObj->GetData failed\n");   }   }   @@ -957,14 +937,14 @@
  if (pIDFolder)   {   SHGetPathFromIDList(pIDFolder, name); - TDEBUG_TRACE(" Folder " << name); + ATLTRACE(" Folder '%s'\n", name);   myFolder = name;   }     // disable context menu if neither the folder nor the files   // have been found   if (myFolder.empty() && myFiles.empty()) { - TDEBUG_TRACE(" shell extension not available on this object"); + ATLTRACE(" shell extension not available on this object\n");   return E_FAIL;   } else {   return S_OK;
 
33
34
35
36
 
37
38
39
 
96
97
98
99
 
100
101
102
 
105
106
107
108
 
109
110
111
 
120
121
122
123
 
124
125
126
127
 
128
129
130
 
131
132
133
 
137
138
139
140
 
141
142
143
 
149
150
151
152
 
153
154
155
156
157
158
159
 
160
161
162
 
33
34
35
 
36
37
38
39
 
96
97
98
 
99
100
101
102
 
105
106
107
 
108
109
110
111
 
120
121
122
 
123
124
125
126
 
127
128
129
 
130
131
132
133
 
137
138
139
 
140
141
142
143
 
149
150
151
 
152
153
154
155
156
157
158
 
159
160
161
162
@@ -33,7 +33,7 @@
 CShellExtDnd::QueryContextMenu(   HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)  { - TDEBUG_TRACE("CShellExtDnd::QueryContextMenu"); + ATLTRACE("CShellExtDnd::QueryContextMenu\n");     if ((uFlags & CMF_DEFAULTONLY)!=0)   return S_OK; //we don't change the default action @@ -96,7 +96,7 @@
  if (pIDFolder)   {   SHGetPathFromIDList(pIDFolder, name); - TDEBUG_TRACE(" Folder " << name); + ATLTRACE(" Folder '%s'\n", name);   myFolder = name;   }   @@ -105,7 +105,7 @@
  //short circuit if we're dragging into a non-Hg repository   if (myFolder.empty() || (root = GetHgRepoRoot(myFolder)).empty())   { - TDEBUG_TRACE(" drag into a non-Hg repos directory"); + ATLTRACE(" drag into a non-Hg repos directory\n");   return E_FAIL;   }   @@ -120,14 +120,14 @@
  if (hDrop)   {   UINT uNumFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); - TDEBUG_TRACE(" hDrop uNumFiles = " << uNumFiles); + ATLTRACE(" hDrop uNumFiles = %d\n", uNumFiles);   for (UINT i = 0; i < uNumFiles; ++i) {   if (DragQueryFile(hDrop, i, name, MAX_PATH) > 0)   { - TDEBUG_TRACE(" DragQueryFile [" << i << "] = " << name); + ATLTRACE(" DragQueryFile [%d] = '%s'\n", i, name);   if (GetHgRepoRoot(name) != root)   { - TDEBUG_TRACE(" " << name << " isn't in target dir repository"); + ATLTRACE(" '%s' isn't in target dir repository\n", name);   myFiles.clear();   break;   } @@ -137,7 +137,7 @@
  }   else   { - TDEBUG_TRACE(" hDrop is NULL "); + ATLTRACE(" hDrop is NULL\n");   }     GlobalUnlock(stg.hGlobal); @@ -149,14 +149,14 @@
  }   else   { - TDEBUG_TRACE(" pDataObj->GetData failed"); + ATLTRACE(" pDataObj->GetData failed\n");   }   }     // disable context menu if neither the folder nor the files   // have been found   if (myFiles.empty()) { - TDEBUG_TRACE(" shell extension not available on this object"); + ATLTRACE(" shell extension not available on this object\n");   return E_FAIL;   } else {   return S_OK;
 
11
12
13
14
 
15
16
17
 
11
12
13
 
14
15
16
17
@@ -11,7 +11,7 @@
 STDMETHODIMP CShellExtOverlay::GetOverlayInfo(   LPWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags)  { - TDEBUG_TRACE("CShellExtOverlay::GetOverlayInfo: myTortoiseClass = " << myTortoiseClass); + ATLTRACE("CShellExtOverlay::GetOverlayInfo: myTortoiseClass = '%c'\n", myTortoiseClass);   // icons are determined by TortoiseOverlays shim   *pIndex = 0;   *pdwFlags = 0;
 
81
82
83
84
85
 
 
86
87
88
 
129
130
131
132
133
 
 
134
135
136
 
175
176
177
178
179
 
 
180
181
182
 
208
209
210
211
 
212
213
214
 
81
82
83
 
 
84
85
86
87
88
 
129
130
131
 
 
132
133
134
135
136
 
175
176
177
 
 
178
179
180
181
182
 
208
209
210
 
211
212
213
214
@@ -81,8 +81,8 @@
  {     if (!splitbase(n, base, rest)) { - TDEBUG_TRACE("Directory(" << path() << ")::add(" << n_in - << "): splitbase returned 0"); + ATLTRACE("Directory('%s')::add(%d): splitbase returned 0\n", + path().c_str(), n_in.c_str());   return 0;   }   @@ -129,8 +129,8 @@
    if (!splitbase(n, base, rest))   { - TDEBUG_TRACE("Directory(" << path() << ")::get(" - << n_in << "): splitbase returned 0"); + ATLTRACE("Directory('%s')::get(%d): splitbase returned 0\n", + path().c_str(), n_in.c_str());   return 0;   }   @@ -175,8 +175,8 @@
    if (!splitbase(n, base, rest))   { - TDEBUG_TRACE("Directory(" << path() << ")::getdir(" - << n_in << "): splitbase returned 0"); + ATLTRACE("Directory('%s')::getdir(%d): splitbase returned 0\n", + path().c_str(), n_in.c_str());   return 0;   }   @@ -208,7 +208,7 @@
  const Directory* d = *i;   if (!d)   { - TDEBUG_TRACE("Directory(" << path() << ")::print: error: d is 0"); + ATLTRACE("Directory('%s')::print: error: d is 0\n", path().c_str());   return;   }   d->print();
 
66
67
68
69
 
70
71
72
 
128
129
130
131
132
 
 
133
134
135
 
66
67
68
 
69
70
71
72
 
128
129
130
 
 
131
132
133
134
135
@@ -66,7 +66,7 @@
  FILE *f = fopenReadRenameAllowed(p.c_str());   if (!f)   { - TDEBUG_TRACE("DirectoryStatus::read: can't open '" << p << "'"); + ATLTRACE("DirectoryStatus::read: can't open '%s'\n", p);   std::string p = (cwd.size() < hgroot.size() ? hgroot : cwd);   Thgstatus::update(p);   return 0; @@ -128,8 +128,8 @@
 close:   fclose(f);   - TDEBUG_TRACE("DirectoryStatus::read(" << hgroot << "): done. " - << v_.size() << " entries read. noicons_ = " << noicons_ ); + ATLTRACE("DirectoryStatus::read(%d): done. %d entries read. noicons_ = %d\n", + v_.size(), noicons_);     return res;  }
 
55
56
57
58
 
59
60
61
 
62
63
64
65
66
67
 
68
69
70
 
82
83
84
85
86
 
 
87
88
89
90
91
92
93
 
94
95
96
 
107
108
109
110
 
111
112
113
114
 
115
116
117
 
125
126
127
128
129
 
130
131
132
133
134
 
135
136
137
 
141
142
143
144
145
 
 
146
147
148
149
150
151
152
 
153
154
155
156
157
 
158
159
160
 
175
176
177
178
 
179
180
181
 
55
56
57
 
58
59
60
 
61
62
63
64
65
 
 
66
67
68
69
 
81
82
83
 
 
84
85
86
87
88
89
90
91
 
92
93
94
95
 
106
107
108
 
109
110
111
112
 
113
114
115
116
 
124
125
126
 
 
127
128
129
130
131
 
132
133
134
135
 
139
140
141
 
 
142
143
144
145
146
147
148
149
 
150
151
152
153
154
 
155
156
157
158
 
173
174
175
 
176
177
178
179
@@ -55,16 +55,15 @@
  {   if (stat.lstat(path.c_str(), true) != 0)   { - TDEBUG_TRACE("Dirstatecache::get: lstat(" << path <<") failed"); + ATLTRACE("Dirstatecache::get: lstat('%s') failed\n", path.c_str());   return 0;   } - TDEBUG_TRACE("Dirstatecache::get: lstat(" << path <<") ok "); + ATLTRACE("Dirstatecache::get: lstat('%s') ok\n", path.c_str());   new_stat = true;     if (cache().size() >= 10)   { - TDEBUG_TRACE("Dirstatecache::get: dropping " - << cache().back().hgroot); + ATLTRACE("Dirstatecache::get: dropping '%s'\n", cache().back().hgroot.c_str());   delete cache().back().dstate;   cache().back().dstate = 0;   cache().pop_back(); @@ -82,15 +81,15 @@
  {   if (0 != stat.lstat(path.c_str(), true))   { - TDEBUG_TRACE("Dirstatecache::get: lstat(" << path <<") failed"); - TDEBUG_TRACE("Dirstatecache::get: dropping " << iter->hgroot); + ATLTRACE("Dirstatecache::get: lstat('%s') failed\n", path.c_str()); + ATLTRACE("Dirstatecache::get: dropping '%s'\n", iter->hgroot.c_str());   delete iter->dstate;   iter->dstate = 0;   cache().erase(iter);   return 0;   }   iter->tickcount = tc; - TDEBUG_TRACE("Dirstatecache::get: lstat(" << path <<") ok "); + ATLTRACE("Dirstatecache::get: lstat('%s') ok\n", path.c_str());   new_stat = true;   }   @@ -107,11 +106,11 @@
  return iter->dstate;   }   - TDEBUG_TRACE("Dirstatecache::get: refreshing " << hgroot); + ATLTRACE("Dirstatecache::get: refreshing '%s'\n", hgroot.c_str());   }   else   { - TDEBUG_TRACE("Dirstatecache::get: reading " << hgroot); + ATLTRACE("Dirstatecache::get: reading '%s'\n", hgroot.c_str());   }     unset = false; @@ -125,13 +124,12 @@
  {   if (iter->unset)   { - TDEBUG_TRACE( - "Dirstatecache::get: **** old and new have unset entries"); + ATLTRACE("Dirstatecache::get: **** old and new have unset entries\n");   request_thgstatus_update = false;   }   else   { - TDEBUG_TRACE("Dirstatecache::get: new has unset entries"); + ATLTRACE("Dirstatecache::get: new has unset entries\n");   }   }   @@ -141,20 +139,20 @@
  iter->dstate = ds.release();     unsigned delta = tc1 - tc0; - TDEBUG_TRACE("Dirstatecache::get: read done in " << delta << " ticks, " - << cache().size() << " repos in cache"); + ATLTRACE("Dirstatecache::get: read done in %d ticks, %d repos in cache\n", + delta, cache().size());     iter->dstate_mtime = stat.mtime;   iter->dstate_size = stat.size;     if (request_thgstatus_update)   { - TDEBUG_TRACE("Dirstatecache::get: calling Thgstatus::update"); + ATLTRACE("Dirstatecache::get: calling Thgstatus::update\n");   Thgstatus::update(cwd);   }   else   { - TDEBUG_TRACE("Dirstatecache::get: omitting Thgstatus::update"); + ATLTRACE("Dirstatecache::get: omitting Thgstatus::update\n");   }     return iter->dstate; @@ -175,7 +173,7 @@
  delete i->dstate;   i->dstate = 0;   cache().erase(i); - TDEBUG_TRACE("Dirstatecache::invalidate(" << hgroot << ")"); + ATLTRACE("Dirstatecache::invalidate('%s')\n", hgroot.c_str());   break;   }   }
 
109
110
111
112
 
113
114
115
 
109
110
111
 
112
113
114
115
@@ -109,7 +109,7 @@
    if (pfnBeginBufferedPaint == NULL || pfnEndBufferedPaint == NULL || pfnGetBufferedPaintBits == NULL)   { - TDEBUG_TRACE(" IconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, returns NULL"); + ATLTRACE(" IconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, returns NULL\n");   return NULL;   }  
 
55
56
57
58
 
59
60
 
55
56
57
 
58
59
60
@@ -55,6 +55,6 @@
  std::string reason = "uninitialized handlers: " + missing;   Thgstatus::error(reason);   std::string res = "InitStatus: error: " + reason; - TDEBUG_TRACE("***** " << res); + ATLTRACE("***** %s\n", res.c_str());   return res;  }
 
66
67
68
69
70
71
72
 
 
73
74
75
 
131
132
133
134
 
135
136
137
 
158
159
160
161
162
163
164
 
 
165
166
167
 
173
174
175
176
177
178
 
 
179
180
181
182
 
183
184
185
 
288
289
290
291
292
293
294
 
 
295
296
297
 
299
300
301
302
 
303
304
305
306
307
308
309
310
311
 
 
312
313
314
 
359
360
361
362
 
363
364
365
 
366
367
368
 
381
382
383
384
 
385
386
387
388
389
 
390
391
392
 
66
67
68
 
 
 
 
69
70
71
72
73
 
129
130
131
 
132
133
134
135
 
156
157
158
 
 
 
 
159
160
161
162
163
 
169
170
171
 
 
 
172
173
174
175
176
 
177
178
179
180
 
283
284
285
 
 
 
 
286
287
288
289
290
 
292
293
294
 
295
296
297
298
299
300
 
 
 
 
301
302
303
304
305
 
350
351
352
 
353
354
355
 
356
357
358
359
 
372
373
374
 
375
376
377
378
379
 
380
381
382
383
@@ -66,10 +66,8 @@
  if (ticks > 5 /* ms */)   {   // trace slower PathIsDirectory calls (untypical on local discs) - TDEBUG_TRACE( - "[" << cls << "] hasHgDir: PathIsDirectory(\"" << p << "\")" << - " -> " << res << ", in " << ticks << " ticks" - ); + ATLTRACE("[%c] hasHgDir: PathIsDirectory('%s') -> %d, in %d ticks\n", + cls, p.c_str(), (int)res, ticks);   }     return res; @@ -131,7 +129,7 @@
  if (has_hg)   {   cur.hgroot = cur.path; - TDEBUG_TRACE(dp << "(" << cur.path << "): hgroot = cur.path"); + ATLTRACE("%s('%s'): hgroot = cur.path\n", dp.c_str(), cur.path.c_str());   return 1;   }   } @@ -158,10 +156,8 @@
  if (has_hg)   {   cur.hgroot = p; - TDEBUG_TRACE( - dp << "(" << cur.path << "): hgroot = '" << cur.hgroot - << "' (found repo)" - ); + ATLTRACE("%s('%s'): hgroot = '%s' (found repo)", dp.c_str(), + cur.path.c_str(), cur.hgroot.c_str());   return 1;   }   std::string p2 = DirName(p); @@ -173,13 +169,12 @@
 exit:   if (file_access_is_unacceptably_slow)   { - TDEBUG_TRACE( - "******" << dp << "(" << cur.path << "): ignored, " - << "call took too long (" << ticks << " ticks)"); + ATLTRACE("****** %s('%s'): ignored, call took too long (%d ticks)\n", + dp.c_str(), cur.path.c_str(), ticks);   }   else   { - TDEBUG_TRACE(dp << "(" << cur.path << "): NO repo found"); + ATLTRACE("%s('%s'): NO repo found\n", dp.c_str(), cur.path.c_str());   }   last = cur;   return 0; @@ -288,10 +283,8 @@
  Dirstate* pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset);   if (!pds)   { - TDEBUG_TRACE( - dp << "Dirstatecache::get(" << cur.hgroot - << ") returns no Dirstate" - ); + ATLTRACE("%s Dirstatecache::get('%s') returns no Dirstate\n", dp.c_str(), + cur.hgroot.c_str());   last = cur;   return 0;   } @@ -299,16 +292,14 @@
  Winstat stat;   if (0 != stat.lstat(path.c_str()))   { - TDEBUG_TRACE(dp << "lstat(" << path << ") failed"); + ATLTRACE("%s lstat('%s') failed", dp.c_str(), path.c_str());   last = cur;   return 0;   }   cur.isdir = stat.isdir;  #if 0 - TDEBUG_TRACE( - dp << "stat.lstat(\"" << cur.path << "\") " - << "-> stat.isdir is " << stat.isdir - ); + ATLTRACE("%s stat.lstat('%s') -> stat.isdir is %d\n" << dp.c_str(), + cur.path.c_str(), (int)stat.isdir);  #endif     if (cur.isdir) @@ -359,10 +350,10 @@
  std::string relbase;   if (pdirsta && get_relpath(cur.hgroot, cur.basedir, relbase))   { - TDEBUG_TRACE(dp << "relbase = '" << relbase << "'"); + ATLTRACE("%s relbase = '%s'\n", dp.c_str(), relbase.c_str());     char basedir_status = pdirsta->status(relbase); - TDEBUG_TRACE(dp << "basedir_status = " << basedir_status); + ATLTRACE("%s basedir_status = '%c'\n", dp.c_str(), basedir_status);     if (basedir_status != 'M')   update = true; @@ -381,12 +372,12 @@
  lasttickcount = tc;   }   - TDEBUG_TRACE(dp << "outStatus is 'P'"); + ATLTRACE("%s outStatus is 'P'\n", dp.c_str());   }     if (update)   { - TDEBUG_TRACE(dp << "calling Thgstatus::update"); + ATLTRACE("%s calling Thgstatus::update\n", dp.c_str());   Thgstatus::update(path);   }  
 
25
26
27
28
 
29
30
31
32
33
 
34
35
36
 
39
40
41
42
 
43
44
45
46
47
 
48
49
50
51
52
 
53
54
55
56
57
 
58
59
 
25
26
27
 
28
29
30
31
32
 
33
34
35
36
 
39
40
41
 
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@@ -25,12 +25,12 @@
 {   if (dwReason == DLL_PROCESS_ATTACH)   { - TDEBUG_TRACE("DllMain: DLL_PROCESS_ATTACH"); + ATLTRACE("DllMain: DLL_PROCESS_ATTACH\n");   _Module.Init(ObjectMap, hInstance, &LIBID_THgShell);   }   else if (dwReason == DLL_PROCESS_DETACH)   { - TDEBUG_TRACE("DllMain: DLL_PROCESS_ATTACH"); + ATLTRACE("DllMain: DLL_PROCESS_ATTACH\n");   _Module.Term();   }   @@ -39,21 +39,24 @@
   STDAPI DllCanUnloadNow(void)  { - TDEBUG_TRACE("DllCanUnloadNow"); + ATLTRACE("DllCanUnloadNow\n");   return _Module.GetLockCount() == 0 ? S_OK : S_FALSE;  }    STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)  { + ATLTRACE("DllGetClassObject\n");   return _Module.GetClassObject(rclsid, riid, ppv);  }    STDAPI DllRegisterServer(void)  { + ATLTRACE("DllRegisterServer\n");   return _Module.RegisterServer();  }    STDAPI DllUnregisterServer(void)  { + ATLTRACE("DllUnregisterServer\n");   return _Module.UnregisterServer();  }
 
43
44
45
46
 
47
48
49
 
57
58
59
60
61
 
62
63
64
65
66
67
 
68
69
70
 
43
44
45
 
46
47
48
49
 
57
58
59
 
 
60
61
62
63
64
 
 
65
66
67
68
@@ -43,7 +43,7 @@
  BOOL fSuccess;   DWORD cbRead;   - TDEBUG_TRACE("Thgstatus::update: sending '" << request << "' to " << pname); + ATLTRACE("Thgstatus::update: sending '%s' to %s\n", request.c_str(), pname.c_str());     fSuccess = ::CallNamedPipeA(   pname.c_str(), (void*)request.c_str(), (DWORD)request.size(), 0, 0, &cbRead, @@ -57,14 +57,12 @@
  }   else if (err == ERROR_PIPE_BUSY)   { - TDEBUG_TRACE("Thgstatus::update: CallNamedPipeA failed. " - "ERROR_PIPE_BUSY"); + ATLTRACE("Thgstatus::update: CallNamedPipeA failed (ERROR_PIPE_BUSY)\n");   return -1;   }   else   { - TDEBUG_TRACE("Thgstatus::update: CallNamedPipeA failed (" - << err << ")"); + ATLTRACE("Thgstatus::update: CallNamedPipeA failed (%d)\n", err);   return -1;   }  }
 
18
19
20
21
 
22
23
24
 
29
30
31
32
 
 
33
34
35
36
37
38
39
40
41
 
 
42
43
44
 
18
19
20
 
21
22
23
24
 
29
30
31
 
32
33
34
35
36
37
38
 
 
 
 
39
40
41
42
43
@@ -18,7 +18,7 @@
    if (bmpcache_.size() > 200)   { - TDEBUG_TRACE("**** GetTortoiseIconBitmap: error: too many bitmaps in cache"); + ATLTRACE("**** GetTortoiseIconBitmap: error: too many bitmaps in cache\n");   return 0;   }   @@ -29,16 +29,15 @@
  HBITMAP hBmp = bmpUtils.IconToBitmapPARGB32(hIcon);   if (!hBmp)   { - TDEBUG_TRACE("**** GetTortoiseIconBitmap: error: something wrong in bmpUtils.ConvertToPARGB32(hIcon)"); + ATLTRACE("**** GetTortoiseIconBitmap: error: something wrong in " + "bmpUtils.ConvertToPARGB32(hIcon)\n");   return 0;   }     bmpcache_[iconname] = hBmp;   - TDEBUG_TRACE( - "GetTortoiseIconBitmap: added '" << iconname << "' to bmpcache_" - " (" << bmpcache_.size() << " bitmaps in cache)" - ); + ATLTRACE("GetTortoiseIconBitmap: added '%s' to bmpcache_ (%d bitmaps in cache)\n", + iconname.c_str(), bmpcache_.size());     return hBmp;  }
 
31
32
33
34
35
 
 
36
37
38
 
54
55
56
57
 
58
59
60
 
70
71
72
73
 
74
75
76
 
78
79
80
81
 
82
83
84
 
124
125
126
127
 
128
129
130
 
136
137
138
139
 
140
141
142
 
144
145
146
147
 
148
149
150
151
152
153
154
155
156
 
 
157
158
159
 
161
162
163
164
 
165
166
167
 
171
172
173
174
 
175
176
177
 
186
187
188
189
 
190
191
192
 
214
215
216
217
 
218
219
220
 
223
224
225
226
 
227
228
229
 
251
252
253
254
 
255
256
257
 
31
32
33
 
 
34
35
36
37
38
 
54
55
56
 
57
58
59
60
 
70
71
72
 
73
74
75
76
 
78
79
80
 
81
82
83
84
 
124
125
126
 
127
128
129
130
 
136
137
138
 
139
140
141
142
 
144
145
146
 
147
148
149
150
151
152
 
 
 
 
153
154
155
156
157
 
159
160
161
 
162
163
164
165
 
169
170
171
 
172
173
174
175
 
184
185
186
 
187
188
189
190
 
212
213
214
 
215
216
217
218
 
221
222
223
 
224
225
226
227
 
249
250
251
 
252
253
254
255
@@ -31,8 +31,8 @@
 // (see http://www.encocoservices.com/createprocess.html)  bool LaunchCommand(const std::string& command, const std::string& cwd)  { - TDEBUG_TRACE("LaunchCommand: " << command); - TDEBUG_TRACE("LaunchCommand: in " << cwd); + ATLTRACE("LaunchCommand: %s\n", command.c_str()); + ATLTRACE("LaunchCommand: in '%s'\n", cwd.c_str());   PROCESS_INFORMATION processInfo;   memset(&processInfo, 0, sizeof(processInfo));   @@ -54,7 +54,7 @@
    if (res == 0)   { - TDEBUG_TRACE("LaunchCommand: failed to launch"); + ATLTRACE("LaunchCommand: failed to launch\n");   return false;   }   @@ -70,7 +70,7 @@
    if (GetTempPath(MAX_PATH, tempDir) == 0)   { - TDEBUG_TRACE("GetTemporaryFile: Failed to find temporary path"); + ATLTRACE("GetTemporaryFile: Failed to find temporary path\n");   }   else if (GetTempFileName(tempDir, prefix, 0, tempFile) != 0)   { @@ -78,7 +78,7 @@
  }   else   { - TDEBUG_TRACE("GetTemporaryFile: Failed to get temporary file"); + ATLTRACE("GetTemporaryFile: Failed to get temporary file\n");   }     return ""; @@ -124,7 +124,7 @@
  std::string thgdir = GetTHgProgRoot();   if (thgdir.empty())   { - TDEBUG_TRACE("GetTortoiseIcon: THG root is empty"); + ATLTRACE("GetTortoiseIcon: THG root is empty\n");   return 0;   }   @@ -136,7 +136,7 @@
    if (iconcache_.size() > 200)   { - TDEBUG_TRACE("**** GetTortoiseIcon: error: too many icons in cache"); + ATLTRACE("**** GetTortoiseIcon: error: too many icons in cache\n");   return 0;   }   @@ -144,16 +144,14 @@
  16, 16, LR_LOADFROMFILE);   if (!h)   { - TDEBUG_TRACE("GetTortoiseIcon: can't find " + iconpath); + ATLTRACE("GetTortoiseIcon: can't find '%s'\n", iconpath.c_str());   return 0;   }     iconcache_[iconpath] = h;   - TDEBUG_TRACE( - "GetTortoiseIcon: added '" << iconpath << "' to iconcache_" - " (" << iconcache_.size() << " icons in cache)" - ); + ATLTRACE("GetTortoiseIcon: added '%s' to iconcache_ (%d icons in cache)\n", + iconpath.c_str(), iconcache_.size());     return h;  } @@ -161,7 +159,7 @@
   std::string GetHgRepoRoot(const std::string& path)  { - TDEBUG_TRACE("GetHgRepoRoot('" << path << "')"); + ATLTRACE("GetHgRepoRoot('%s')\n", path.c_str());     std::string p =   (::PathIsUNCServerShare(path.c_str()) || IsDirectory(path)) @@ -171,7 +169,7 @@
  std::string tdir = p + "\\.hg";   if (::PathIsUNCServerShare(tdir.c_str()))   { - TDEBUG_TRACE("GetHgRepoRoot: tdir is UNC share '" << tdir << "'"); + ATLTRACE("GetHgRepoRoot: tdir is UNC share '%s'\n", tdir.c_str());   p.clear();   break;   } @@ -186,7 +184,7 @@
  }   }   - TDEBUG_TRACE("GetHgRepoRoot: returning '" << p << "'"); + ATLTRACE("GetHgRepoRoot: returning '%s'\n", p.c_str());   return p;  }   @@ -214,7 +212,7 @@
  int fd = ::_open_osfhandle((intptr_t)fh, _O_RDONLY);   if (fd == -1)   { - TDEBUG_TRACE("fopenReadRenameAllowed: _open_osfhandle failed"); + ATLTRACE("fopenReadRenameAllowed: _open_osfhandle failed\n");   ::CloseHandle(fh);   return 0;   } @@ -223,7 +221,7 @@
  FILE* f = ::_fdopen(fd, "r");   if (f == 0)   { - TDEBUG_TRACE("fopenReadRenameAllowed: _fdopen failed"); + ATLTRACE("fopenReadRenameAllowed: _fdopen failed\n");   ::_close(fd);   return 0;   } @@ -251,7 +249,7 @@
  return 1;   }   - TDEBUG_TRACEW(L"GetRegSZValueW(\"" << name << L"\") failed"); + ATLTRACE(L"GetRegSZValueW('%s') failed\n", name);     return 0;  }
 
28
29
30
31
 
32
33
34
 
28
29
30
 
31
32
33
34
@@ -28,7 +28,7 @@
  FILE *f = fopenReadRenameAllowed(path.c_str());   if (!f)   { - TDEBUG_TRACE("Dirstate::read: can't open " << path); + ATLTRACE("Dirstate::read: can't open '%s'\n", path.c_str());   return std::auto_ptr<Dirstate>(0);   }  
 
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
15
16
17
 
18
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
21
 
 
@@ -15,47 +15,7 @@
 extern CComModule _Module;  #include <atlcom.h>  #include <shlobj.h> -#include <assert.h>  #include <string>   -#include "ThgDebug.h" - -#define ASSERT assert - - -#ifdef THG_DEBUG - #include <sstream> - - #ifdef _M_X64 - #define THG_PREFIX "[THGx64] " - #define THG_PREFIXL L"[THGx64] " - #else - #define THG_PREFIX "[THGx86] " - #define THG_PREFIXL L"[THGx86] " - #endif - - // 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) if (ThgDebug::enabled()) { \ - std::stringstream _the_msg; \ - _the_msg << THG_PREFIX << s; \ - std::string _the_str = _the_msg.str(); \ - OutputDebugStringA(_the_str.c_str()); \ - } - #define TDEBUG_TRACEW(s) if (ThgDebug::enabled()) { \ - std::basic_stringstream<wchar_t> _the_msg; \ - _the_msg << THG_PREFIXL << s; \ - std::wstring _the_str = _the_msg.str(); \ - OutputDebugStringW(_the_str.c_str()); \ - } - #define TDEBUG_ENTER TDEBUG_TRACE -#else - #define TDEBUG_TRACE(s) - #define TDEBUG_TRACEW(s) - #define TDEBUG_ENTER(s) -  #endif   -#endif -