CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unlocked

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: CHM Help opened with F1 from some dialogs, after closing then not released by TC, and not re opened with F1 if unloc

Post by *Usher »

Flint wrote: 2020-02-11, 12:41 UTCCould it be some 3rd-party software that's interfering and prevents the WinAPI internals from unlocking the CHM properly?
Maybe CHM is locked by some TC plugin (wcx, wlx)?
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
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

Post by *Flint »

2DrShark
Ah, that's what I've missed! I was calling from the main window; didn't read the steps properly. Thanks, I reproduced it with the dialog.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
petermad
Power Member
Power Member
Posts: 14741
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
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

Post by *petermad »

Are you sure you're opening help with F1 while in Pack files (or other TC's) dialog?
I can reproduce the problem both when pressing F1 and when clicking the Help button (Windows 7)
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
petermad
Power Member
Power Member
Posts: 14741
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
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

Post by *petermad »

2Usher
Maybe CHM is locked by some TC plugin (wcx, wlx)?
It also happens with a clean ini file (no plugins).
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
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

Post by *ghisler(Author) »

Since this seems to be an intentional "feature" of the HtmlHelp function, I think that we shouldn't try to fight against it. I will therefore move this thread to "Will not be changed" soon.
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
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

Post by *DrShark »

While the topic is not yet moved, maybe following information will be helpful:
Htmlhelp Forensics wrote:Using a process explorer you can actually see that Internet Explorer dlls will be kept in memory, even after HH_CLOSE_ALL closes the help window - But only if you use the HH_HELP_CONTEXT command! Stick with HH_LOOKUP_TOPIC and the dlls will be unloaded as expected and the chm-file lock disappear. My best guess is that after reading the context mapping information "somebody" forgets to close an internal stream in the chm-file...
More info is here: https://www.codeproject.com/Articles/3618/Htmlhelp-Forensics
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
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

Post by *ghisler(Author) »

Interesting indeed. Unfortunately I couldn't find any documentation of HH_LOOKUP_TOPIC, not via Google and not in the linked article.
Do you have any information on how to use it?
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
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

Post by *DrShark »

ghisler(Author) wrote: 2020-02-12, 18:57 UTCUnfortunately I couldn't find any documentation of HH_LOOKUP_TOPIC, not via Google and not in the linked article.
It's only mentioned in article, but in sample sources HH_DISPLAY_TOPIC is actually used. I'm not a programmer so cannot say how useful this is.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
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

Post by *Flint »

As far as I understood, he simply parses the CHM internal structures (which are quite simple) to manually fetch the page name assigned to the specified index, and opens this page directly instead of relying on HH_HELP_CONTEXT (which basically does the same, but with the file locking bug).

P. S. I foresee a possible shortcut, which is to hardcode the list of pages directly into TC, and use them instead of indices; but that is to be avoided. Many of the translated CHM help files have different structure to the original one (mostly, the HTML files are put into a subdirectory), so the hardcoded list won't work for them.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
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

Post by *ghisler(Author) »

I see, so that's why I couldn't find any documentation about HH_LOOKUP_TOPIC!
HH_DISPLAY_TOPIC uses the topic name, so I can't use that directly because it can differ between languages.

Is it really worth to add a manual CHM parser just to avoid the locked file?
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
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

Post by *DrShark »

ghisler(Author) wrote: 2020-02-13, 11:03 UTCHH_DISPLAY_TOPIC uses the topic name, so I can't use that directly because it can differ between languages.
I think you can at least use it directly for English (and maybe also German, French) help.
ghisler(Author) wrote: 2020-02-13, 11:03 UTCIs it really worth to add a manual CHM parser just to avoid the locked file?
I'm not a programmer so cannot say how much efforts it will require. But I think for the way Total Commander uses context help (one help topic for one TC window or dialog), HH_DISPLAY_TOPIC is a best choice. HH_HELP_CONTEXT which locks the file and keeps help loaded in RAM may be better if different help topics describe different UI controls on same window/dialog, and the help topic for each control is opened by moving "?" pointer to certain GUI control (screenshot).
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
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

Post by *ghisler(Author) »

I have added this now, but it doesn't seem to work on Windows 7. It works fine on Windows 10 1803 and 1909, though.
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
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

Post by *DrShark »

history951.txt wrote:18.02.20 Fixed: Help file would get locked when opened with a page other than the main index (e.g. Keyboard shortcuts) -> use HH_DISPLAY_TOPIC instead of HH_HELP_CONTEXT (32/64)
ghisler(Author) wrote: 2020-02-19, 18:18 UTCI have added this now, but it doesn't seem to work on Windows 7. It works fine on Windows 10 1803 and 1909, though.
I can confirm on 32-bit XP/Vista/7 the help file is still locked (cannot check on Windows 10 right now, as well as on older Windows versions; also I didn't check whether new way of opening help affects translated CHM help files with different structure to the original one).
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
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

Post by *Flint »

That's funny, for me it stays locked only in 32-bit version of TC. The 64-bit one unlocks the CHM successfully. I tested it in Win7 x64 and Win10 x64 1909, results were the same.

Also I confirm the correct work of the translated Russian CHM, which has different internal file structure to the original one.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
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

Post by *ghisler(Author) »

for me it stays locked only in 32-bit version of TC
Ah, it's actually a mistake on my part - I had disabled the function in the 32-bit version because it seemed slower than using the old method, but this wasn't the case. I removed the comments from the function via "Undo", but the compiler didn't pick it up (a known bug of Delphi 2). After re-saving the file, it now works on Windows 7 too!
Author of Total Commander
https://www.ghisler.com
Post Reply