/win32/shellext/README.txt

https://bitbucket.org/tortoisehg/hgtk/ · Plain Text · 221 lines · 159 code · 62 blank · 0 comment · 0 complexity · 6d8e36125a46df04c1ccc16ff1e52f56 MD5 · raw file

  1. == C++ Shell Extension ==
  2. === Installing build tools ===
  3. Get the gratis "Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1"
  4. from microsoft.com.
  5. You can install from web or download an ISO image, burn a DVD and install from
  6. that. Make sure you get the correct download for the Windows version you want to
  7. use for building: the x86 (32 bit) download won't install on 64 bit platforms.
  8. The SDK contains the C++ compiler, linker, nmake, and header files, which is all
  9. we need to build the x86 (32 bit) and 64 bit variants of the shell extension.
  10. The compiler and linker can build both the 32 bit and the 64 bit targets, no matter
  11. if you install the 32 bit (x86) or the 64 bit version of the SDK. In other words:
  12. it can cross compile.
  13. The SDK is compatible with Visual C++ 2005 and 2008 (including express versions).
  14. But Visual C++ is *not* needed to build the shell extension!
  15. Leave all install options at their defaults.
  16. (see also C:\Program Files\Microsoft SDKs\Windows\v7.0\ReleaseNotes.Htm
  17. section "4.4.2 Setting Build Environment Switches" after install)
  18. === Building the x86 (32 bit) target ===
  19. Open a command shell and cd into win32/shellext of the TortoiseHg sources.
  20. Copy/paste the following line (including the double quotes) into that shell
  21. cmd.exe /E:ON /V:ON /K "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.cmd" /xp /x86 /Release
  22. and execute it (see ReleaseNotes.Htm).
  23. This should show the following in your shell
  24. '''
  25. Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v7.0.
  26. Targeting Windows XP x86 RELEASE
  27. '''
  28. Then execute
  29. nmake /f Makefile.nmake clean
  30. followed by
  31. nmake /f Makefile.nmake
  32. Which should go like this:
  33. '''
  34. $ nmake /f Makefile.nmake clean
  35. Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
  36. Copyright (C) Microsoft Corporation. All rights reserved.
  37. del *.obj *.dll *.exe *.lib *.exp *.manifest
  38. $ nmake /f Makefile.nmake
  39. Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
  40. Copyright (C) Microsoft Corporation. All rights reserved.
  41. cl /nologo /Ox /W2 /EHsc /MT /DAPPMAIN /DTHG_DEBUG /c TortoiseUtils.cpp Direntry.cpp Directory.cpp Winstat.cpp ThgDebug.cpp InitStatus.cpp CShellExtCMenu.cpp CShellExtOverlay.cpp IconBitmapUtils.cpp Registry.cpp ShellExt.cpp StringUtils.cpp SysInfo.cpp dirstate.cpp Winstat64.cpp Dirstatecache.cpp DirectoryStatus.cpp Thgstatus.cpp QueryDirstate.cpp
  42. TortoiseUtils.cpp
  43. Direntry.cpp
  44. Directory.cpp
  45. Winstat.cpp
  46. ThgDebug.cpp
  47. InitStatus.cpp
  48. CShellExtCMenu.cpp
  49. CShellExtOverlay.cpp
  50. IconBitmapUtils.cpp
  51. Registry.cpp
  52. ShellExt.cpp
  53. StringUtils.cpp
  54. SysInfo.cpp
  55. dirstate.cpp
  56. Winstat64.cpp
  57. Dirstatecache.cpp
  58. DirectoryStatus.cpp
  59. Thgstatus.cpp
  60. QueryDirstate.cpp
  61. Generating Code...
  62. link /OUT:THgShell.dll /nologo /INCREMENTAL:NO /MANIFEST shlwapi.lib gdiplus.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /DLL /DEF:ShellExt.def TortoiseUtils.obj Direntry.obj Directory.obj Winstat.obj
  63. ThgDebug.obj InitStatus.obj CShellExtCMenu.obj CShellExtOverlay.obj IconBitmapUtils.obj Registry.obj ShellExt.obj StringUtils.obj SysInfo.obj dirstate.obj
  64. Winstat64.obj Dirstatecache.obj DirectoryStatus.obj Thgstatus.obj QueryDirstate.obj
  65. Creating library THgShell.lib and object THgShell.exp
  66. mt -nologo -manifest THgShell.dll.manifest -outputresource:"THgShell.dll;#2"
  67. '''
  68. This should produce the file THgShell.dll, which contains the 32 bit variant of the
  69. shell extension.
  70. === Building the 64 bit target ===
  71. Open a command shell and cd into win32/shellext of the TortoiseHg sources.
  72. Copy/paste the following line (including the double quotes) into that shell
  73. cmd.exe /E:ON /V:ON /K "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.cmd" /xp /x64 /Release
  74. and execute it (see ReleaseNotes.Htm).
  75. This should show the following in your shell
  76. '''
  77. Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v7.0.
  78. Targeting Windows XP x64 RELEASE
  79. '''
  80. Then execute
  81. nmake /f Makefile.nmake clean
  82. followed by
  83. nmake /f Makefile.nmake
  84. Which should go like this:
  85. '''
  86. $ nmake /f Makefile.nmake clean
  87. Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
  88. Copyright (C) Microsoft Corporation. All rights reserved.
  89. del *.obj *.dll *.exe *.lib *.exp *.manifest
  90. $ nmake /f Makefile.nmake
  91. Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
  92. Copyright (C) Microsoft Corporation. All rights reserved.
  93. cl /nologo /Ox /W2 /EHsc /MT /DAPPMAIN /DTHG_DEBUG /c TortoiseUtils.cpp Direntry.cpp Directory.cpp Winstat.cpp ThgDebug.cpp InitStatus.cpp CShellExtCMenu.cpp CShellExtOverlay.cpp IconBitmapUtils.cpp Registry.cpp ShellExt.cpp StringUtils.cpp SysInfo.cpp dirstate.cpp Winstat64.cpp Dirstatecache.cpp DirectoryStatus.cpp Thgstatus.cpp QueryDirstate.cpp
  94. TortoiseUtils.cpp
  95. Direntry.cpp
  96. Directory.cpp
  97. Winstat.cpp
  98. ThgDebug.cpp
  99. InitStatus.cpp
  100. CShellExtCMenu.cpp
  101. CShellExtOverlay.cpp
  102. IconBitmapUtils.cpp
  103. Registry.cpp
  104. ShellExt.cpp
  105. StringUtils.cpp
  106. SysInfo.cpp
  107. dirstate.cpp
  108. Winstat64.cpp
  109. Dirstatecache.cpp
  110. DirectoryStatus.cpp
  111. Thgstatus.cpp
  112. QueryDirstate.cpp
  113. Generating Code...
  114. link /OUT:THgShell.dll /nologo /INCREMENTAL:NO /MANIFEST shlwapi.lib gdiplus.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /DLL /DEF:ShellExt.def TortoiseUtils.obj Direntry.obj Directory.obj Winstat.obj
  115. ThgDebug.obj InitStatus.obj CShellExtCMenu.obj CShellExtOverlay.obj IconBitmapUtils.obj Registry.obj ShellExt.obj StringUtils.obj SysInfo.obj dirstate.obj
  116. Winstat64.obj Dirstatecache.obj DirectoryStatus.obj Thgstatus.obj QueryDirstate.obj
  117. Creating library THgShell.lib and object THgShell.exp
  118. mt -nologo -manifest THgShell.dll.manifest -outputresource:"THgShell.dll;#2"
  119. '''
  120. This should produce the file THgShell.dll, which contains the 64 bit variant of the
  121. shell extension.
  122. === Testing ===
  123. To install the new THgShell.dll for testing, rename the THgShellx86.dll in
  124. "C:\Program Files\TortoiseHg" to something else (e.g. THgShell-01.dll), then copy the newly built
  125. THgShell.dll to "C:\Program Files\TortoiseHg\THgShellx86.dll" and restart explorer.exe
  126. (logout/login will do as well).
  127. For x64 systems, the dll is instead located in
  128. "C:\Program Files\Common Files\TortoiseHg\ThgShellx64.dll".
  129. See
  130. http://www.addictivetips.com/windows-tips/how-to-restart-explorer-exe-process-properly-in-windows-xp-and-vista/
  131. for properly restarting explorer (in case you don't want to do a logout/login).
  132. Of course, simply killing explorer.exe with the task manager and restarting it will work too
  133. (you might loose some settings changes you might have done in explorer though).
  134. The shell extension emits trace output (TDEBUG_TRACE macro calls in the sources). This output
  135. can be captured by using for example the tool **DebugView** from Microsoft sysinternals (see
  136. http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx).
  137. The debug output must be enabled in the registry. Double click the file
  138. "DebugShellExt.reg" and restart explorer.
  139. Example output (copied via clipboard):
  140. {{{
  141. [3504] [THG] findHgRoot(W:\xxx2\aa): hgroot = 'W:\xxx2' (found repo)
  142. [3504] [THG] Dirstatecache::get: lstat(W:\xxx2\.hg\dirstate) ok
  143. [3504] [THG] DirectoryStatus::read(W:\xxx2): done. 2 entries read
  144. [3504] [THG] HgQueryDirstate: relbase = ''
  145. [3504] [THG] HgQueryDirstate: basedir_status = M
  146. }}}
  147. Another very helpful tool is sysinternals **Autoruns**
  148. (http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx ).
  149. This can be used to explore the registration of the extension. Use the tab "Explorer"
  150. to see the shell extensions registered.
  151. Recommended setting is "Hide Microsoft Entries" in menu "Options"
  152. === TortoiseOverlays shim ===
  153. The TortoiseHg shell extension uses the common TortoiseOverlays package shared with
  154. other Tortoise projects (TortoiseSVN, TortoiseBZR, etc.).
  155. The sources for the TortoiseOverlays project can be found at
  156. http://tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/
  157. (use user: "guest", no password).
  158. === Issues ===
  159. * #324 - Question mark overlays are missing on Windows 7