CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unlocked
Moderators: Hacker, petermad, Stefan2, white
CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unlocked
To reproduce:
1. Open Pack Files dialog.
2. Press F1 there: CHM help will be opened.
3. Close help, then close pack dialog.
4. Try to replace %commander_path%\TOTALCMD.CHM with other TOTALCMD.CHM file:
TC will show Access denied dialog.
You can also check TOTALCMD.CHM file with tool like Unlocker: it will show TOTALCMD.CHM is used by TOTALCMD.EXE.
5. (Optional) Use "Unlock" button in Unlocker started for TOTALCMD.CHM to unlock it from being used by TOTALCMD.EXE and try to call help with F1 in Total Commander again: it will fail, it seems to make it succeed the restart of Total Commander is required.
1. Open Pack Files dialog.
2. Press F1 there: CHM help will be opened.
3. Close help, then close pack dialog.
4. Try to replace %commander_path%\TOTALCMD.CHM with other TOTALCMD.CHM file:
TC will show Access denied dialog.
You can also check TOTALCMD.CHM file with tool like Unlocker: it will show TOTALCMD.CHM is used by TOTALCMD.EXE.
5. (Optional) Use "Unlock" button in Unlocker started for TOTALCMD.CHM to unlock it from being used by TOTALCMD.EXE and try to call help with F1 in Total Commander again: it will fail, it seems to make it succeed the restart of Total Commander is required.
Last edited by DrShark on 2020-02-28, 17:04 UTC, edited 1 time in total.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
This is new to TC 9.50 final, it is not present in TC 9.5rc2 or TC 9.5rc2d
It applies to both 32- and 64bit TC 9.50.
It applies to both 32- and 64bit TC 9.50.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
Not confirmed, it happens with TC 9.22a too!This is new to TC 9.50 fina
It doesn't seem to be a bug either, but some kind of caching done by the HtmlHelp function. The only difference between F1 in the main form and F1 in a dialog box are the parameters passed to HtmlHelp:
Main window call:
HtmlHelp(0, HelpFileName, HH_DISPLAY_TOC,0);
Dialog box:
HtmlHelp(0, HelpFileName, HH_HELP_CONTEXT, ContextID);
I have also tried to call HH_DISPLAY_TOC first followed by HH_HELP_CONTEXT, but it has the same problem.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
I tried again - you are right - sorry.Not confirmed, it happens with TC 9.22a too!
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
Can this behavior be fixed? Can you please also check why calling help with F1 then fails if to unlock TOTALCMD.CHM file from TOTALCMD.EXE using Unlocker (see step 5)? Maybe if you'll make it work in this case, I guess it would possible to use Unlocker's method for unlocking help file opened by HtmlHelp called with parameters...ghisler(Author) wrote: 2020-02-07, 09:00 UTCIt doesn't seem to be a bug either, but some kind of caching done by the HtmlHelp function. The only difference between F1 in the main form and F1 in a dialog box are the parameters passed to HtmlHelp
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
Honestly, I don't know. Maybe it's mapped into memory, or the help process has some higher priority to avoid tampering, no idea.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
Unlocker closes file handle, and help system would not not try to reopen the file.
In most cases, closing and re-opening help files would waste more resources than keeping file handles open.
Sources for Delphi's help system could probably be found somewhere in rtl subdirectory.
In most cases, closing and re-opening help files would waste more resources than keeping file handles open.
Sources for Delphi's help system could probably be found somewhere in rtl subdirectory.
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
TC does not use the Delphi help system here. I'm using Delphi 2 for 32-bit, and it only supports HLP files. Instead, I make just a single function call:
HtmlHelp (as described above)
I have also tried to call HtmlHelp with parameter HH_INITIALIZE first to run html help on the same thread as the main window, but this didn't make any difference either.
HtmlHelp (as described above)
I have also tried to call HtmlHelp with parameter HH_INITIALIZE first to run html help on the same thread as the main window, but this didn't make any difference either.
Maybe it's protected somehow by the html control, so the content of the page (which is essentially a web page) cannot be manipulated?Unlocker closes file handle
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
If it's not a bug, then it's strange that such "caching" doesn't happen if to call HtmlHelp function without parameters.ghisler(Author) wrote: 2020-02-07, 09:00 UTCIt doesn't seem to be a bug either, but some kind of caching done by the HtmlHelp function. The only difference between F1 in the main form and F1 in a dialog box are the parameters passed to HtmlHelp
Anyway, I experimented a bit more with this: after unlocking main help file I changed language to open localized help (wcmd_<lng>.chm) with F1, it works.
But after changing TC language back to English it doesn't open main help no matter what: remaming/moving, or even permanent deleting the TOTALCMD.CHM and then restoring it to %COMMANDER_PATH%, F1 or cm_HelpIndex fail to open it.
But opening it with HH.exe from Total Commander's command line using ITS aka InfoTech Storage URI format:
hh its:%COMMANDER_PATH%\TOTALCMD.CHM::main_index.htm
works (without hh.exe at start of that line the chm is being opened in Internet Explorer).
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
It isn't a bug, just a misfeature of the HtmlHelp function.
When changing languages, TC unloads the help to load the new one. I could unload the help also when it's no longer needed, but I don't know when - the user may have just switched back to Total Commander and want to keep the help open.
When changing languages, TC unloads the help to load the new one. I could unload the help also when it's no longer needed, but I don't know when - the user may have just switched back to Total Commander and want to keep the help open.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
2ghisler(Author)
I've had a quick look at the API; it seems that HtmlHelp should return the help window handle. When the TC window receives focus, you could check by that handle, if the help window is still open. If it's closed, then the CHM may be safely unloaded.
I've had a quick look at the API; it seems that HtmlHelp should return the help window handle. When the TC window receives focus, you could check by that handle, if the help window is still open. If it's closed, then the CHM may be safely unloaded.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
Using TC 11.03 / Win10 x64
Using TC 11.03 / Win10 x64
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
I have just tried it, it doesn't help. Here is what I tried:
1. Check IsWindow() -> the help window is still there, just hidden
2. Check IsWindowVisible() -> works
3. Call HtmlHelp(0, NULL, HH_CLOSE_ALL, 0) -> the help file is still locked
4. Added c all to HH_INITIALIZE at start and called HH_UNINITIALIZE after HH_CLOSE_ALL -> the help file is still locked
So the only way to unlock the help file seems to open a different help file!?
1. Check IsWindow() -> the help window is still there, just hidden
2. Check IsWindowVisible() -> works
3. Call HtmlHelp(0, NULL, HH_CLOSE_ALL, 0) -> the help file is still locked
4. Added c all to HH_INITIALIZE at start and called HH_UNINITIALIZE after HH_CLOSE_ALL -> the help file is still locked
So the only way to unlock the help file seems to open a different help file!?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
Maybe it will work if to try following: if help window is hidden, unlock TOTALCMD.CHM using Unlocker's method, then close Help using calls from your steps 3/4, and on next F1 keypress try to open it again?ghisler(Author) wrote: 2020-02-11, 07:51 UTC I have just tried it, it doesn't help. Here is what I tried:
1. Check IsWindow() -> the help window is still there, just hidden
2. Check IsWindowVisible() -> works
3. Call HtmlHelp(0, NULL, HH_CLOSE_ALL, 0) -> the help file is still locked
4. Added c all to HH_INITIALIZE at start and called HH_UNINITIALIZE after HH_CLOSE_ALL -> the help file is still locked
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
By the way, I've tried to reproduce the issue, and could not. On my system the CHM file's handle is automatically closed whenever I close the help window (I've been monitoring it via Process Explorer), and the CHM file can be deleted/overwritten.
I've tried it on 32- and 64-bit version of TC 9.50; Win7 SP1 x64 (and also in an old Win10 virtual machine with TC 9.21a). Tested with both the original English help and the Russian one (Language\wcmd_rus.chm). I'm not sure what I'm doing wrong here. Could it be some 3rd-party software that's interfering and prevents the WinAPI internals from unlocking the CHM properly?
2ghisler(Author)
Maybe unloading the hhctrl.ocx could help? Although, there are some mentions in the Internet that this may cause issues if not done properly; I didn't have time to get into details, but it seems there is a working way of doing it.
I've tried it on 32- and 64-bit version of TC 9.50; Win7 SP1 x64 (and also in an old Win10 virtual machine with TC 9.21a). Tested with both the original English help and the Russian one (Language\wcmd_rus.chm). I'm not sure what I'm doing wrong here. Could it be some 3rd-party software that's interfering and prevents the WinAPI internals from unlocking the CHM properly?
2ghisler(Author)
Maybe unloading the hhctrl.ocx could help? Although, there are some mentions in the Internet that this may cause issues if not done properly; I didn't have time to get into details, but it seems there is a working way of doing it.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
Using TC 11.03 / Win10 x64
Using TC 11.03 / Win10 x64
Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc
Are you sure you're opening help with F1 while in Pack files (or other TC's) dialog?Flint wrote: 2020-02-11, 12:41 UTCBy the way, I've tried to reproduce the issue, and could not. [...] I'm not sure what I'm doing wrong here.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708