Annoyance in TortoiseCVS fixed

Quite a while ago I reported a bug in TortoiseCVS 1.10.x (the Unicode versions) which more or less affects everyone that is using an alternative file manager. I for one use SpeedCommander and can highly recommend it, although for non-German users there is a slight disadvantage in that no English manual/help file is offered – however, on the user forum you will not have a problem finding help, even in English 😉

Anyway, the problem was (and still is for the 1.10.x releases), that TortoiseAct.exe, the process that is showing the checkout/commit/etc dialog, posts a window message to the window of the caller. Now, the Windows Explorer understands this particular WM_COMMAND message as “refresh the file/directory list” (or something very similar. However, unfortunately it is up to each and every implementer how he handles the WM_COMMAND message and particular combinations of the parameters there. And unfortunately SpeedCommander does exactly this (which is a “fault” on part of TortoiseCVS, though – because it uses undocumented window messages specific to a particular calling program). SpeedCommander uses this to invoke its internet favorites feature. I my case this means that TortoiseAct.exe will tell SpeedCommander to open an Explorer window.

Here’s the offending code in TortoiseAct.cpp (rev 1.307):

void TortoiseAct::RefreshExplorerWindow(/*const std::vector dirs*/)
   PostMessage(myRemoteHandle, WM_COMMAND, 41504, 0);

Last year a while before the fix in the project’s CVS I built my own fixed version, however, it turns out there is a one-byte fix to the problem (find the download below for TortoiseCVS 1.10.10 from 2009-01-16).

At file offset 0x00009180 change the first byte of the two-byte opcode (a mov) from 8B to C3. This prevents TortoiseAct.exe from ever sending the offending message again. This is how it looks in IDA before:

sub_409180 proc near
mov     eax, [ecx]
push    0               ; lParam
push    0A220h          ; wParam
push    111h            ; Msg
push    eax             ; hWnd
call    ds:PostMessageW
sub_409180 endp

… and after the patch (omitting the now obsolete part):

nullsub_1 proc near
nullsub_1 endp

Problem solved and I’m happy as TortoiseCVS is usable again. I make the download available in case some reader feels uncomfortable with a hex editor but still needs the fixed version.

Download: Patched TortoiseAct.exe
SHA1: 73a609b42946504aaddb66e834832e0450fb131a

// Oliver

PS: a newer version of TortoiseCVS is available. It does not fix the issue, though. For a fix look here.

This entry was posted in /dev/null, Programming, Reversing and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *