CHM file unreadble if saved to hdd - chm

I've just downloaded JSon.Net for framework 4.0 as a zip file.
Opening zip (using WinRar) I'm able to open Documentation.chm file by double-clicking over the name listed and the help file is well done.
Anyway if I extract this file to hdd and I open it, help is unreadable.
Sounds silly, but it's happening.
Thanks for your help!!!
EDITED:
Another tip: unreadble chm file is located in D:\.... (second NTFS partition of first hdd); if I save it on my desktop, chm file becomes readable !!! Crazy...
------------------------------------
---------- SOLUTION ----------
------------------------------------
I answer my question to close it and to help someone who finds in my same trouble.
Using tip suggested by #Marco van de Voort I searched Google for "chm unblock" and found this link:
Your CHM files are stored in the folder with '#' (hash) character in
the path Many C# developers discovered that their documentation
and e-books in CHM format cannot be read because they were storing
their CHM files in the directories like 'C:\E-books\C#\'. The hash
character signifies an anchor in HTML so the CHM viewer fails to
resolve the path properly and to retrieve the content.
That was my problem: I had path with a #... and I'd never thought this could be a great mess for CHM files!!!
Thanks to SO mates for the help given !!

Windows keeps track of downloaded files on NTFS systems, and puts certain restrictions on them. If you extract with windows explorer, this status propagates from archive to file. Using a third party tool (winrar in your case, I use INFO zip) can circumvent this.
Some descriptions and other links can be found
http://wiki.lazarus.freepascal.org/chm_backend_for_fpdoc#Troubleshooting
Free Pascal (2.4.4) has some tool to unlock them. (chmls unblock). It is done by truncating an alternate filestream (therefore it only works with NTFS). I found this info somewhere on stackoverflow, but can't quickly find the link.
It might be that virtual folders like desktop don't fully support this.

maybe the references to some content is to web or no chm file. maybe if you can disassamble in CHM editor and change paths can fix it.
maybe this can help you

There are security permissions applied to this file type by a recent patch.
you need to unblock the file:
http://www.helpscribble.com/chmnetwork.html

instead of thinking many possibilities of "windows security permission", get a CHM reader or wrap your CHM using winrar, and doubleclick to view it like you did.
It's save your time a lot!!
So, two simple solutions are:
have a CHM reader: https://blog.kowalczyk.info/articles/chm-reader-viewer-for-windows.html
OR right click CHM file/s, > Add to RAR Archive.
If you want to read it, double click RAR file > double click CHM file. BINGO!!

Related

How can I get a list of help context IDs used in a CHM help file?

I have a C++ program that calls AfxMessageBox, passing in a help file context ID. When I click Help on the resulting message box, I get a litte error box that says "Failed to launch help." I need to verify that I'm using a valid help ID. Is there a way to examine a CHM file to find out what context IDs are valid for it? Either a commercial tool or a way to write a C# or C++ or even Python program to do it.
Edit: This is an old CHM file, and I do not have the files that were used to create it. I used 7-zip to extract its contents into a folder, but I see nothing there that tells me what context IDs the file has. When the error occurs, the C++ code assigns a value of 135 to the error, and then it adds 0x30000 (196,608) to that for no reason I know. Then, when the message box gets generated, 0x30000 is subtracted and the result, 135, is passed in to AfxMessageBox() as the help ID. I've tried both 135 and 196743 (0x30000 + 135) in the AfxMessageBox() call but neither has worked. The files extracted from the help file by 7-Zip include a set of .htm file with numbers for names, but the numbers have no relation to the context IDs that I can find.
There is another execution path in my code that uses the same help file. As near as I can tell, it uses low-level functions to create a dialog box that resembles the output of AfxMessageBox(). When I force that code path use context ID 196743, I get the expected help page. Unfortunately, it's not easy to get from the code that doesn't work to the code that does.
Edit:
Your additional Edit in the question take me back many years. Not related to your original question but some links to read:
Starting with HTML Help
Adding HTML Help to Existing Dialog-Based Application
Extracting help contextID by code you must have deep knowledge of the CHM internals.
For a single value e.g. 10000 you may want to test the contextID using PowerShell or a DOS prompt. This opens the requested .chm in the Help viewer, and uses a context ID to request a URL to display.
hh.exe -mapid 10000 ms-its:CHM-example.chm
Sometimes you only have the CHM output file and nobody can locate the source files. It’s not always possible to recover all files and data you need.
Decompiling loses the alias.h and map.h files and their information for F1-Help (context sensitive help).
You may know a CHM is something like a zipped web (HTML archive) with some additional system files of metadata. Context ID's are mostly integrated by compiling a alias.h and map.h file. The purpose of the two files is to ease the coordination between developer and help author. The mapping file links an ID to the map number - typically this can be easily created by the developer and passed to the help author. Then the help author creates an alias file linking the IDs to the topic names (See: Creating Context-Sensitive Help for Applications.
I'm using FAR HTML as a toolbox full of various authoring, file and HTML utilities (Disclaimer: It is freeware now!).
Please note there is a download link (for required Microsoft HTMLHelp Workshop) because the Microsoft download links are broken.
The CHM can be opened using FAR HTML and by copy and paste you have all ID and topic information (ALIAS section). In Help File Explorer you need to open Internal Files > #IVB.

Copy a file to the clipboard in HTML

I've Googled around this for an hour and not found anything suitable, but it feels like something that surely should exist and be quite easy/common? So I'm asking here.
I'm planning on hosting a number of small files on my server. These contain Midi information (used in music production).
What I want is to create an HTML page that lists each of these midi files, and allows the user to click a button to copy the file straight to their clipboard, so that they don't have to download each file and then locate it in their downloads folder.
I can't find any solution for this. I've found lots of solutions for copying text, but I want to copy a file instead - Is this possible?
Primarily I'm open to using HTML, PHP or JavaScript.
Thanks in advance for any assistance.

Chrome extension how to append or edit a csv file on pc

I am able to find some information on how to read a csv file on a computer but is there any way I can modify one? In my chrome extension I need to add data to each row one at a time after scraping some websites. Is there any better way then read csv, store data as variable and rewrite is everytime? This becomes problematic when the file gets large. I am looking for a way to “append ” to a existing file or a work around. Any suggestions appreciated.
Update: From comment I see it is not possible to read from file system. But is there anyway to read from within the extension directory? How should I do so if the csv file is included with in the zip file of the extension? Can I access them somehow? Code snippets would be helpful.
I'm in the middle of creating something which might help you. Right now you can upload the CSV file and append a "modifier". You can adjust the code according to your requirement. Here's the repo https://github.com/amanrOnly/CSV_Modifier

Recompile CHM file

I'm working on a script that should be able to add additional information to a .chm file.
After decompiling it with hh.exe -decompile outputFolder fileName.chm command, I get the html files, and other 2 files with .hhc and .hhk extension.
After editing the html files, I'd like to recompile the files into a single .chm file. I read that that I also need a .hhp file in order to do that, but that's not generated in the decompilation process.
How can I solve this?
This is a problem of Compiled Help Modules (CHM). And yes - you need a *.hhp for compiling again by HTMLHelp Workshop or e.g. FAR HTML.
You know, you can use 7Zip or just open a command prompt window on a Windows PC and type the following:
hh.exe -decompile <target_directory> <path>\<filename>.chm
The only decompiler with any additional features is KeyTools as this can try to rebuild the project (.hhp) file. You'll need this file if you want to recompile the help project.
One thing to note is that the decompile/recompile process isn't a "round-trip" process. Certain features that the help author added to the original help file can't be recovered when you decompile it, so these may no longer work properly after you've recompiled.
This is especially true in the area of context-sensitive help, which may be broken in the new version of the file.
It can be useful, to include the .hhp file itself - after regenerating is done - into the section [FILES] of the project file (.HHP). Thus, this is included in the Compiled Help Module (CHM) when compiling. The appropriate *.HHP file then is decompiled in addition to the other files for future use.

How to extract hhp file from a chm file

I have an A.chm file for my windows application which runs as expected.
When I decompile it using HTML workshop I get set of html files, .hhc file, .hhk file. When I compile another file B.chm from these extracted files without changing any of the files.((I want to add more html contents to this file but looks like I am losing some information after decompiling)) The output file I get is 72K where as the original file was 75K. B.chm's contents look all file when viewed in the chm viewer but the behavior is lost when when used with the application.
After reading around I found that if .hhp can be extracted from a .chm file then it can be re-constructed as it is without losing any mapping or aliases. Is that true?
How can I extract .hhp file from a .chm file?
Thanks,
Sam
No, Yes , and no.
The original hhp can't be guaranteed extracted
however since chm is an archive type, the project could have added all project files to the archive. I assume you already would have found them if that were the case.
If the decompile process does its administration, it can regenerate the .hhp to a certain degree.
Comments and #define names will probably be lost though, maybe more, but that should not result in problems when recompiling.
But of course it could be that the decompiler is limited. You could try some other (search for something from "keytools").
If not, then take "chmlib" and start drilling down into the format.