I've been away for quite a while now from ASM programming, but now I finally have time again :)

I've begun rewriting my MsdnHelp addin, but I'm wondering how many people use it anymore? A lot of new help add-ins have surfaced since I wrote MsdnHelp. If I'm doing this just for me, that's a lot less work than to make it work for everyone :) So please tell me if you'd like to see MsdnHelp expanded further.

The modifications I've already done are:

- Moved help file paths out of the database and into a ini file (help.ini) to make changing the helpfile paths easier
- Besides .hlp, .chm, .col, and .exe, URL's are now also allowed as help files (*k* is replaced with keyword)
- Helpfile paths can now be relative to the help path setting in RadASM (*h* is replaced with RadASM's Help folder setting)

All this means that when working (for example) with Masm32 and RadASM, no editing of the database or ini file is needed at all if all your helpfiles are in Masm32's Help folder.
Also, a default setting is now included to lookup API definitions using Google (Search for "Microsoft+" using "I'm feeling lucky button", so it jumps directly to correct entry on MSDN). This is much faster and easier than using my old MsdnOnline hack.
Posted on 2004-06-06 13:13:11 by Qweerdy
Thanks bro! Keep the good work up! Very helpfull plugin!


/siddhartha
Posted on 2004-06-06 13:37:21 by siddhartha
Hi Qweerdy

A few modifications (hopefully without introducing bugs):

- Support for addin-manager (ketilo)
- Support for html help2 format (donkey)
- Fixed some of the memory leaks (when addinmanager reloads addin)
- Ini file updated to support recent help.mdb by Milos.

KetilO
Posted on 2004-06-06 19:00:51 by KetilO
Thanks for the fix! The memory leak was bugging me...


/siddhartha
Posted on 2004-06-06 19:10:38 by siddhartha
Hi KetilO, and thanks for the fixes!

Memory leaks huh? The code really is horrible... I should do a complete rewrite. Maybe even rip out the database code entirely and base it all around text files. Right now I'm thinking of splitting the various categories into separate files, which are then merged at run-time into one sorted, indexed, memory-mapped file. This file would only be re-created when the selected keyword files change. Also, if I make this file assembler-specific, true assembler-specific help would finally be possible...
A nice dream for now, now let's see if I can get it implemented within a reasonable time :)
Posted on 2004-06-07 01:06:44 by Qweerdy
Good news, the rewrite of MsdnHelp is progressing well! The dynamic loading, merging, and indexing of keyword textfiles is working, the caching of this data is working, searching by keyword is working. In short, the entire database heart of MsdnHelp has been replaced. All data files except the keyword cache (which is automatically generated) is now plaintext and easily user-editable. Tomorrow I'm going to finish the rest of the core code (opening the help file specified by the database), and convert the real database to suitable textfiles. Then I'll be able to do some benchmarks to see if this is really as fast as I think it is :)
Then of course I'll still need to finish the GUI (SetPaths replacement that actually works and also allows you to select and deselect keyword lists per assembler type), but I'll probably be able to post a basic working version tomorrow :cool:
For those who are interested, the keyword file format is:

First line - keyword set name
Second line - keyword set description
Next lines - sorted, lowercase keywords.

ReplaceWith functionality of the old database system is reproduced like this:
keyword=replacewiththis
Posted on 2004-06-08 16:17:30 by Qweerdy
Hi Qweerdy

Sounds very advanced. Can't wait to see the source.

KetilO
Posted on 2004-06-08 16:37:25 by KetilO
I've converted the database to text files and done some benchmarks. The two PC's I used are a Pentium IV 2.8 GHz machine running RadASM from a network share and the old Pentium 166 server running RadASM locally. The Pentium IV took 0.688 seconds to generate the cachefile, and on the server it actually took less: 0.560 seconds. Kind of makes me wonder why I bother checking if a valid cachefile exists and only generate it if the selected keyfiles change :) By the way, loading an existing cachefile takes around 0.03 seconds :)
The cachefile containing all of the data from the old database is just 46kb, although most of that data is duplicated from the keyword lists so the total size of data used on disk is 86kb. Compare that to the size of the MS Access database :)
All of the old MsdnHelp functionality is already implemented (and some more) and working, but I'm going to write a little GUI settings dialog before I post it here, and clean up the project files a bit.
Search speed was not benchmarked, but is still near-instant as with MsdnHelp.

I've discovered one minor drawback in the new datafile layout, which is that "=" is not allowed in a keyword. Shouldn't be much of a problem, although I had to strip some of the comparison-runtime operator entries from the Masm32 help keyword list. To get to that entry you can still select any of the other operators without "=" though.
Posted on 2004-06-09 08:33:41 by Qweerdy
Hi Qweerdy,

Not sure how easy this would be to do but it would be nice if the addin would translate ANSI and UNICODE API calls to the generic equivalent. For example...

SendMessageA would be auto-translated to SendMessage

I find this is a problem when writing Unicode apps and having to call an ANSI function (or Visa Versa). I have to be more specific about which wrapper to call and help will not find it. Attached is a copy of the ANSI versions of all the API functions that have an A/W suffix...
Posted on 2004-06-10 04:21:57 by donkey
1. It is finished

2. It's now called RadHelp :)

3. I HATE the windows listview control. You won't believe it, but problems with this control took me an entire day to solve... and I still don't understand what I was doing wrong. :(

Anyway, just unzip the dll and .kwl files to your addin directory and enable the addin. On startup you'll get a message saying you don't have any helpfiles loaded. A menu option labelled "RadHelp options" should have been added to the Options menu. Select it and check the keyword lists you want to use, and type in a path to their respective helpfiles. I suggest you to use the built-in variables: "$H\FPhelp.hlp"

Please help me find the bugs that are left, I may not have as much time in the coming days as I had. Everything works as far as I can tell, but things like memory leaks haven't been checked thoroughly yet, and I may be incorrectly using some of the RadASM plugin interfaces. (ADDINDATA.lpLoadPath is the RadASM folder, right? Or is it just the result of GetCurrentDirectory at RadASM startup?)

Enjoy the plugin :)

Donkey: All that needs to be done is to generate extra entries in winapi.kwl like so:
myapia=myapi
myapiu=myapi
This would nearly double the size of the file, but I don't think that's enough to slow it down. I may have time in the future to do this, but if you want speedy service you'll have to do it yourself :) The biggest problem I think is that the kwl files need to be sorted to work.
Posted on 2004-06-10 14:46:32 by Qweerdy
Hi Qweerdy,

No problem with the equates, I can generate it myself pretty quick. I copied the contents of the AddIns folder from the distro to my RadASM addins folder and enabled the addin, disabling ehelp first. I then checked for RadHelp in the Option menu and it was not there. I restarted RadASM and still do not have the options available. Is there something else that is required ?

Tesiting on Windows 2000 SP4.

BTW for an extensive addin such as this you should include a VersionInfo structure with your name and a description in order to identify it in Addin Manager.
Posted on 2004-06-10 15:19:09 by donkey
About the versioninfo, I'll fix that tomorrow.

The menu not showing up is not good. Did you see the messagebox I described above? If not I guess the addin wasn't loaded/enabled at all. Check radasm.ini to make sure it says:

##=Radhelp.dll,1

(I'm not sure what Addin manager does and does not do.)

If it still doesn't work you can try adding this to RadASM.ini manually (but when I tested this wasn't necessary):


KeywordLists=winapi,fpu,x86,masm

Also, check if all the files (dll and kwl files) are in the AddIns directory.

That's all I can think of right now.

Btw, when generating your new kwl files, don't forget to preserve the top two lines when sorting... probably obvious though :)
Posted on 2004-06-10 15:46:52 by Qweerdy
Hi Qweerdy,

No problem, it was in the RadAsm.ini file.

##=Radhelp.dll,0,1

was entered. You should have an enable/disable option in the SetOptions structure to ensure that it is properly set.

The entry edit is too limited, I can't enter the full command line for MSDN help 2. Also I could not test to make sure that it would properly parse the "K$$$K" entry, it must follow "K$lstrcpy"

winapi=$D\H2Viewer.exe /helpcol ms-help://MS.MSDNQTR.2003APR.1033 /filterquery /keyword "K$$$K" 


Entering it manually in RadASM.ini I get "Filename has no extension" as an error.


As another suggestion, I regularly use GoAsm but I sometimes need MASM, currently I have two separate assembler help files, it would be nice to have the help file and kwl paths stored in the assembler.ini files instead of the RadASM.ini files so they can be made assembler specific. You would need to reload them each time a project is opened but they are not exceedingly large and it should be pretty quick.



The title and description for the KWL files are the same, for example the FPU file is supposed to have a title of "FPU Mnemonics" and a description of "Standard FPU instruction set", in the dialog it has both a title and description of "FPU Mnemonics".


I will try to dust off my MASM and take a look at the problem with the Help2 command line tonight.
Posted on 2004-06-10 16:47:15 by donkey
Hi Qweerdy,

I removed some of the duplicates in your file and added the full set of all A/W apis in the following format...

lstrcat
lstrcata=lstrcat
lstrcatw=lstrcat

however I get keyword is too long all the time as there are some very long keywords, the longest is 104 bytes, perhaps 128 bytes would be a better limit to length. Also it created over 1000 tmp files in my addins folder before I shut it down with task manager.
Posted on 2004-06-10 19:15:30 by donkey
Hi Qweerdy,

Sorry to keep posting but I am trying to get your addin working 100%, still no progress on the A/W switches but I will look at the RebuildCache function to see how they are added.

Just a small change for msdn help2. The correct help file to enter should be:

ms-help://MS.MSDNQTR.2003APR.1033

But PathIsUrl determines that it is a URL and it is not processed properly. If you use /helpcol then it results in it being added twice ie:

/helpcol /helpcol ms-help://MS.MSDNQTR.2003APR.1033

This does not appear to cause any problems but just in case it can be solved with the following change to the OpenHelp function :

invoke PathIsURL,pMem

.if eax ; Show URL's using ShellExecute
invoke PathFindExtension,pMem
cmp DWORD PTR [eax],"301."
jne @F
invoke OpenHelpHH2,pMem,pkeyword
jmp Done
@@:
invoke ShellExecute,0,0,pMem,0,0,SW_SHOWDEFAULT
jmp Done
.else
...


You must remove the existing call to OpenHelpHH2.
Posted on 2004-06-10 22:52:40 by donkey
Wow, lots of posts donkey!

First of all, your first way of opening HtmlHelp 2 files might have worked (at least it was designed to work then), if you had enclosed the exe filename in quotes like it says in the options dialog ;)
The htmlhelp2 code is entirely based upon the HtmlHelp 2 modifications in the old MsdnHelp, since I do not have a htmlhelp 2 file installed to test with. I'll download the platform sdk though, so I can test this better.

Increasing the keyword lengt limit is not something I look forward to, since I was stupid enough not to define it as a single constant. Same goes for maximum path length, although it should work fine with lengths approching MAX_PATH, with the expanded string (with $H, $K and such expanded) even allowed to be 2*MAX_PATH if I remember correctly.

Better error handling in OpenCache and RebuildCache also coming real soon. I agree that filling your Addins folder with tmp files is something that should never happen, no matter what.

As another suggestion, I regularly use GoAsm but I sometimes need MASM, currently I have two separate assembler help files, it would be nice to have the help file and kwl paths stored in the assembler.ini files instead of the RadASM.ini files so they can be made assembler specific. You would need to reload them each time a project is opened but they are not exceedingly large and it should be pretty quick.


This is already implemented actually (look at the combobox at the top of the settings dialog), but I may have forgotten to reload the cachefile if a project is loaded :sweat: If no settings are found in the assembler's ini file then RadASM.ini is used.

The title and description for the KWL files are the same, for example the FPU file is supposed to have a title of "FPU Mnemonics" and a description of "Standard FPU instruction set", in the dialog it has both a title and description of "FPU Mnemonics".


Didn't catch that, thanks!
Posted on 2004-06-11 02:41:08 by Qweerdy
All reported bugs fixed, and some more.

- Keyword max. length is now 128 bytes and easily changeable (equ at top of main file)
- Old cachefiles are deleted when a new one is created.
- Getting stuck in a RebuildCache loop should now be impossible
- Htmlhelp2 changed as suggested, not tested yet
- Cachefile is reloaded when a project is opened
- Improved error handling in a couple of cases
- Description field in settings dialog now displays correct data
- No existing settings in RadASM.ini could put garbage in file edit control in settings dialog

I'm now going to work on the Addin manager settings.

Donkey: I loaded your winapi.kwl and it had no problems opening the MessageBox topic when F1 was pressed on MessageBoxA.
Posted on 2004-06-11 03:56:46 by Qweerdy
Hi Qweerdy

Very nice.

Following problems:

Help file ext must be lowercase or you get Msg "Unknown extension."

You are using lstrcmp. It is slow and a little too inteligent. In Norway AA is sorted as ?


KeywordLists=x86,winapi,masm,fpu
KeywordCacheFile=C:\RadASM\AddIns\hlp7F1.tmp
x86=$H\x86eas.hlp
winapi=$H\win32.hlp
masm=$H\masm32.hlp
fpu=$H\fphelp.hlp

Could not get x86 to work. Probably caused by AAA mnemonic.

KetilO
Posted on 2004-06-11 07:33:20 by KetilO
Hi Qweerdy,

I was wondering what the combo was for :) You should increase the height so it will drop down, right now the only way to use it is to select the current item and use the arrow keys. Everything else seems to work fine right now.
Posted on 2004-06-11 08:41:12 by donkey
Very cool :alright:

With GoAsm there is a pretty minimalist help file without search functions. This makes it difficult to look up keywords like with MASM. But with the new RadHelp it is possible to do it by bookmarks !

Use the following command line for GoAsm.kwl..

mk:@MSITStore:C:\GoAsm\Help\GoAsm.chm::/GoAsm.htm$K


And use the following kwl file to translate the keywords to their appropriate bookmark...
Posted on 2004-06-11 11:55:37 by donkey