News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

RadHelp bug fix

Started by donkey, March 06, 2009, 02:42:09 AM

Previous topic - Next topic

donkey

There are a few bugs in RadHelp that prevent it from successfully parsing a command line that contains an argument. The first and biggest is the way it find the file extension, since it uses PathFindExtension if there is an argument on the command line it will always fail, to fix this I have added a PathGetArgs call to find the position of first argument in the path and NULL terminate the path at the byte immediately previous to it. This will give you a valid extension and a valid argument making it possible to use the following type of command line

$D\Help2Viewer.exe /$K /MS.MSDNQTR.v90.en

Which would have resulted in the "Filename has no extension" message before. I have attached the source for the addin, in the source folder you will find a compiled DLL. Niether the path nor the executable can contain spaces. Quoted strings have a number of issues that I hope to get to but it will probably be a complete rewrite of the OpenHelp function and since I am a bit rusty with MASM it will take some time. In he mean time here's the first fix.

Edgar

"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

Well, I guess I'm not as rusty as I thought. I have rewritten the parsing of the supplied path. I decided to make it a little cleaner, the existing code was a mess so I put the scan for tokens into a separate procedure. It now handles quotes around the path properly as well as more effectively determining the split between paths and arguments. Spaces in paths are handled by enclosing the path in quotes, including any $ tokens (ie $D), it will replace $$ with $ and single $ will be removed. Leading and trailing spaces are removed from both the arguments and the path, the quotes are removed from the path before sending it to CreateProcess. I have tested this with as many permutations as I could think of and it all seems to be working, since the parser is now more modular it is easier to expand. The following tokens have been added (because I needed them)

$S = system folder
$W = Windows folder

It is now completely OK to use the following syntax:

"$D\Help2 Viewer.exe" /$K /MS.MSDNQTR.v90.en

And the line will be parsed properly.

Help2 Viewer can now accept command lines from RadASM making it possible to use it as your API viewer with the above command line, jsut copy Help2 Viewer to the addins folder and enter the command line in RadHelp options. The collection name is optional (version 0.6.2.5 and above), if it is not supplied the default registry entry will be used, if the supplied collection is different than the one saved in the registry you will not be prompted to save it when you quit the application, so when you restart Help2 Viewer it will load the previous default collection.

[attachment deleted by admin]
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable