Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to open chm file (winapi) ?

Featured Replies

Posted

Hi,


 


Is there a way to open a chm file in the index tab and write something there ?


 


Well, OllyDBG 2.01 does that ... I tried to debug it but couldn't figure out how it does that


bp on 0049A8F1 and use "Help on API function" from the R click menu to break on it.


 


This is the code I tried in ASM:



.data
libN db "HHCTRL.OCX", 0
funcN db "HtmlHelpA", 0 ;unicode HtmlHelpW
path db "D:\WinApi.chm", 0
val db 20h, 0
DeskHWND dd ? .code
start:
invoke GetDesktopWindow
mov DeskHWND, eax invoke LoadLibrary, addr libN
invoke GetProcAddress, eax, addr funcN push offset val
push 0Dh
push offset path
push DeskHWND ; could be NULL
call eax invoke ExitProcess, 0
end start

dont know what "open chm in index tab & write something there means" but to display a .chm in the "html browser" this works for me.


 


 
push 0
push 0 ; HH_DISPLAY_TOPIC
push offset path
push DeskHWND
call eax
 

  • Author

Thanks ... works like a charm :)


only ExitProcess invoke needs to be omitted


 


Still, I want to write something in the index after opening the file cuz I'm writing a plugin for x64dbg, OllyDBG, and (maybe) IDA pro :)


This is how Olly works as u know :


http://postimg.org/image/4q8fits3p/


Do u have any idea on how to do so ?


Edited by Alzri2

use HTML Help Workshop. just briefly tried & looks like to create custom index (w/tab view in left pane) u just create an index file & compile in ur project. tons of info on this.


 


https://msdn.microsoft.com/en-us/library/windows/desktop/ms644604%28v=vs.85%29.aspx


 


edit - u can also use htmlhelp.lib from the html help SDK instead of dynamically loading it


Edited by simple

  • Author

Ollydbg 2.01 can simply open the chm and write the function name in the index tab without all of that (it doesn't create any index or smth cuz the chm browser creates this file automatically)


Is there a simple way ?


  • Author

thanks Dreamer, but what u've posted is an independent chm viewer ... I'm looking for a way to launch a chm file using the windows html viewer


If the file type is known to the system you should just be able to use ShellExecute to open it.


0Dh is HH_KEYWORD_LOOKUP command. So, study the MSDN topic and pass a correct structure to HtmlHelp, not just a dummy value of 20h.

As simple as that.

  • Author

simple:


I didn't import htmlhelp.lib cuz I don't like to import a whole library to get only one var !


 


@atom0s:


ShellExecute would only open the file as the user normally does, which means there won't be anything written in the index tab.


I can then wait for the chm viewer window and add smth using SendMessage. But, it would be hyper ugliness code :D


 


kao:


Do u really think I would pass an argument randomly ?!!


As I said, I ripped the code above from Olly 2.01, but it doesn't work properly as it does in Olly.


 


 


whenever I have the time, I'll try another way


Edited by Alzri2

Did you actually read my suggestion and look at that MSDN topic? You ripped some data but that was not enough.


  • Author

Sure I did. But, I haven't tried it yet ...

Btw it looks like it will show the search tab instead of showing the index tab if I passed that arg.

Anyway, as I said, I'll try it once i have the time.

  • Author

As I said, I did it in an another way ...


I wrote it in C++ cuz I couldn't pass a dword value in ASM :D


 


Here is a working code:



int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ typedef INT (CALLBACK* LPFNDLLFUNC1)(HWND, LPCTSTR, UINT, DWORD);
HINSTANCE hDLL; // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer
UINT valS = 32; hDLL = LoadLibrary("HHCTRL.OCX");
if (hDLL != NULL)
{
lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL, "HtmlHelpA");
if (!lpfnDllFunc1)
{
FreeLibrary(hDLL);
return 0;
}else{
lpfnDllFunc1(GetDesktopWindow(),
"D:\\WinApi.chm",
0x0002, //HH_DISPLAY_INDEX
(DWORD)"MessageBox");
while (true){} // just don't exit
}
}
return 0;
};

Edited by Alzri2

Not all the time, but in that case a dword cast means the address in binary


 


db MBString "MessageBox", 0
 
...
 
push offset MbString
push 2
push offset path
push DeskHWND
call eax

Hi guys,


 


I have a little question.Can anybody tell me where to find API references files (offline versions to use without internet access) about almost all APIs?Normaly I just use win32.hlp (24 MB) but I also wanna know whether there are also others to download like documentations about VB & Msvcrt API's etc (also in hlp or chm).If you know some then it would be nice if you could post some links where I can download them.


 


PS: Sorry for asking on your topic Alzri2 but on your picture I have seen you do use any other MSDN Lite reference (I don't know this one).


 


Thank you


  • Author

No problem to ask here at all :)

Well, u don't how much time I spent on compiling this help :D

I have converted help files of win7 sdk into a chm file just for the purpose mentioned in this topic (make plugins).

Sure, I will upload it with the plugins once I have the time.

Hi Alzri2,


 


thanks first.


Sounds good if you could upload all files for us. :)


I also like hlp files a bit more than chm files but anyway so its just important to have some extern offline documentation. :) Oh and if you also know or have any (extern / offline) VB & Msvcrt API documentation then upload them too if possible.No idea why I can't find anything about these on the internet to download.


 


PS: Good luck with your plugin.


 


Thank you


  • Author

Chm files are much better than hlp files ... one of many advantages is supporting Win vista/7/8/8.1 (without any updates from MS)


 


Don't know about VB. But, is there information about it in the online MSDN ? If so, you might find info about it in the chm file as well.


Edited by Alzri2

  • 3 months later...

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.