The MASM Forum Archive 2004 to 2012

Project Support Forums => GoAsm Assembler and Tools => Topic started by: donkey on February 22, 2009, 12:51:01 AM

Title: Help2 revisited
Post by: donkey on February 22, 2009, 12:51:01 AM
I have worked a bit on the MSDN/Help2 viewer ToutEnAsm and I discussed in another thread and thought I would post the progress. It has evolved into almost a complete viewer application. You are now allowed to choose the Namespace (actually you're required to at first run). The index is an HxIndexView control and it loads the keyword index very quickly. The Web browser is the MFC WebBrowser control which is basically IE. I have kept much of he junk like IE toolbars and url boxes out of the program in order to maintain a bit of control over the GUI. Both ATL controls have event sinks so they can be used interactively, the Keyword HxIndexList was challenging as it only sent click and select and it took a bit of puzzling to extract the data, see the IHxIndexViewEvents_Invoke for how it was done. The biggest obstacle to my last attempt at a raw HX interface program was looking up partial names, unless you know the full name of the keyword most methods returned an error. After experimenting for a couple of days I found that IHxIndex.GetSlotFromString would do exactly what I needed it to do and return an item number in the index, from there its simple, see the DisplayKeyword function for how I implemented it. I have added a few more comments and it was not as painful as I thought, I am notoriously lax in commenting my code. There are still a few things that need to be done before it can be built into a full blown application, better exception handling and a splitter bar between the index and webbrowser to name two.

As usual, the code in the program was written by me and is free for any use, however I would ask that you respect my wishes and it is not used in any work published under the GPL.

(http://img88.imageshack.us/img88/7250/hvscreenshot.jpg)

Download Help2 Viewer (http://www.quickersoft.com/donkey/help2_viewer.htm)
Title: Re: Help2 revisited
Post by: donkey on February 22, 2009, 02:43:54 AM
Sorry guys I accidentally uploaded an earlier version, the one I first uploaded didn't have a fully functional options dialog. The correct version is now up top, the options dialog now works and provides a brief description of the Namespace object that you select. There were 5 downloads.

(http://img527.imageshack.us/img527/8360/options.jpg)
Title: Re: Help2 revisited
Post by: GregL on February 22, 2009, 03:10:29 AM
Donkey,

I wanted to check out your Help2 Viewer, but it's crashing on me. I'm running Vista Ultimate.

Here is the debugger listing, see comment:


_RtlInitLargeAnsiString@12:
757B90F5  mov         edi,edi
757B90F7  push        ebp 
757B90F8  mov         ebp,esp
757B90FA  mov         eax,dword ptr [ebp+8]
757B90FD  mov         ecx,dword ptr [ebp+0Ch]
757B9100  mov         edx,80000000h
757B9105  or          dword ptr [eax+4],edx
757B9108  test        ecx,ecx
757B910A  push        esi 
757B910B  mov         esi,dword ptr [eax+4]
757B910E  mov         dword ptr [eax+8],ecx
757B9111  je          _RtlInitLargeAnsiString@12+51h (757B914Dh)
757B9113  push        edi 
757B9114  lea         edi,[ecx+1]
757B9117  mov         dl,byte ptr [ecx]    <<<<<<<<<<<<<<<<<< access violation (0c0000005h) here, ecx = 0ffffffffh
757B9119  inc         ecx 
757B911A  test        dl,dl
757B911C  jne         _RtlInitLargeAnsiString@12+22h (757B9117h)
757B911E  sub         ecx,edi
757B9120  mov         edi,dword ptr [ebp+10h]
757B9123  cmp         ecx,edi
757B9125  mov         edx,ecx
757B9127  jae         _RtlInitLargeAnsiString@12+34h (757F2F7Ch)

Title: Re: Help2 revisited
Post by: donkey on February 22, 2009, 04:02:19 AM
Well, first off let me say that I am thoroughly disappointed in the disassembly you posted, I mean what a bonehead way to scan for the NULL terminator. Also whats with mov edi,edi, it doesn't set any flags or help with register stalls (might cause one though) so its just garbage from a compiler. Besides that I have no idea whats happening, if you could try to trace the exception back to the SysAllocString or MultibyteToWideChar that most likely made the call I would appreciate it, I am not running any Vista machines here at the moment (or in the foreseeable future). Beyond knowing what the applications call is, there's not much I can do since the exception is in what appears to be NTDLL.
Title: Re: Help2 revisited
Post by: donkey on February 22, 2009, 07:18:02 AM
Hi Greg,

Are you running it with the MSDN library ?
Title: Re: Help2 revisited
Post by: japheth on February 22, 2009, 08:31:35 AM

I tried on WinXP SP 2 and it crashes as well:


77d2236f 56              push    esi
77d22370 8b7004          mov     esi,dword ptr [eax+4]
77d22373 894808          mov     dword ptr [eax+8],ecx
77d22376 743a            je      USER32!RegisterClassA+0x9c (77d223b2)
77d22378 57              push    edi
77d22379 8d7901          lea     edi,[ecx+1]
77d2237c 8a11            mov     dl,byte ptr [ecx]          ds:0023:ffffffff=??  ;<<<<<<<<<<<<<
77d2237e 41              inc     ecx
77d2237f 84d2            test    dl,dl
77d22381 75f9            jne     USER32!RegisterClassA+0x66 (77d2237c)
77d22383 2bcf            sub     ecx,edi
77d22385 8b7d10          mov     edi,dword ptr [ebp+10h]
77d22388 3bcf            cmp     ecx,edi
77d2238a 8bd1            mov     edx,ecx
77d2238c 0f831bf20100    jae     USER32!GetClipboardFormatNameA+0x1268 (77d415ad)


However, it's in USER32, and the call stack is

USER32!RegisterClassA+0x66
USER32!PaintMenuBar+0x57
USER32!AppendMenuA+0x12a
USER32!UnhookWindowsHook+0x28
USER32!SetWindowTextA+0x2d
USER32!SetDlgItemTextA+0x1d
Help2_Viewer+0x1b51
USER32!GetDC+0x72


the location in the binary (0x401b51) looks like this:


00401b2d 6850010000      push    150h
00401b32 68ea030000      push    3EAh
00401b37 ff750c          push    dword ptr [ebp+0Ch]
0:000> u
Help2_Viewer+0x1b3a:
00401b3a e8b1f50000      call    Help2_Viewer+0x110f0 (004110f0)
00401b3f 85c0            test    eax,eax
00401b41 740e            je      Help2_Viewer+0x1b51 (00401b51)
00401b43 50              push    eax
00401b44 68ee030000      push    3EEh
00401b49 ff750c          push    dword ptr [ebp+0Ch]
00401b4c e8a5f50000      call    Help2_Viewer+0x110f6 (004110f6)
00401b51 ff7518          push    dword ptr [ebp+18h]

Title: Re: Help2 revisited
Post by: akane on February 22, 2009, 10:28:14 AM
It is crashing at SetDlgItemText, control id=0x3EE, text* = -1.
Title: Re: Help2 revisited
Post by: donkey on February 22, 2009, 12:22:48 PM
Quote from: akane on February 22, 2009, 10:28:14 AM
It is crashing at SetDlgItemText, control id=0x3EE, text* = -1.

Weird, the only way I can see there being an error ther is if no Help2 namespaces were found on the system. Try the version I just uploaded, I will work on a more fault tolerant namespace enumeration that will fail the whole program if no usable namespaces are found.
Title: Re: Help2 revisited
Post by: donkey on February 22, 2009, 12:34:45 PM
Stupid error, Took a line out because it was interfering with somethign else and tested the program,eveything worked, Didn't think to test it without an initial namespace selected, the first run routine failed because it was trying to display text in a memory buffer with an address of -1. The upload at the top should solve the problem.
Title: Re: Help2 revisited
Post by: akane on February 22, 2009, 12:44:08 PM
This attachmet is unaccessible now, I see You are not allowed to access this section.
I have 45 namespaces installed on my primary host so this should be no problem. By the way, the first attachment had missing vertical scrollbar in namespace selector.
Title: Re: Help2 revisited
Post by: donkey on February 22, 2009, 12:55:57 PM
Just tried the download, it seems to work fine.

QuoteI have 45 namespaces installed on my primary host so this should be no problem

Yes, lack of namespaces was not the problem but would have had the same symptoms,it was an oversight on first run,I didn't take into account a -1 return from CB_GETITEMDATA. It has been dealt with.
Title: Re: Help2 revisited
Post by: GregL on February 23, 2009, 02:34:14 AM
Donkey,

It's working fine now. I should have posted the call stack. Nice tool and nice example. I have always liked H2Viewer (http://www.helpware.net/mshelp2/h2viewer.htm) because it has more command line options than Dexplore, making integrating into editors and IDEs easier.

Title: Re: Help2 revisited
Post by: donkey on February 23, 2009, 04:38:23 AM
Hi Greg,

Thanks. the hard part was working through undocumented COM interfaces using OleView and guessing what might or might not work. I am thinking about making it into a full blown integrated help application, adding command line support would be trivial but right now I am looking for docs on the underlying HTMLHelp format, specifically how I can integrate it into the program using the same GUI. I am looking for a way to get an index listing from a chm help file without opening a chm help window, once I find that I should be able to make CHM content available as well. I will definitely look at the command line interface, I really liked that about H2Viewer as well, they had one long before it was available on DExplore and I rewrote part of RadASM's RadHelp plugin to support it. Right now I am converting my app to Unicode in order to save some time doing conversions, after that I will be working on the GUI, adding a few features I think are important (TOC, menu, Splitter bar etc..). SInce I am pretty much stalled on my main project, it is my new "de jour"
Title: Re: Help2 revisited
Post by: donkey on February 24, 2009, 03:13:30 AM
Added a Find Topic dialog, it will find the first 50 matches for a string entered. I am running out of button images so the index search has been changed to the image with the little pencil and Find Topic is the magnifying glass. I will get around to tooltips as soon as I finish figuring out the rest of the interface issues (still no luck finding the default start page programatically). The upload is in the top post, there were about 20 downloads.

(http://img365.imageshack.us/img365/9346/findtopic.jpg)

Double-click a topic in the listbox to display it
Title: Re: Help2 revisited
Post by: donkey on February 24, 2009, 09:24:38 PM
Had a chance to work on the GUI a bit today, fixed the Rebar band problem so the windows resize properly when the bands are moved. Added tooltips for the toolbar and an about box. I was considering adding a menu but couldn't really think of anything to put in it so I let it go. I also added version information to the file, the current version is 0.2.0.0, it can be checked in the normal way (right click the executable - select Properties).
Title: Re: Help2 revisited
Post by: donkey on February 25, 2009, 02:46:27 AM
I think I have found the way to get a default page from a Help2 namespace however I need someone to test it on something other than MS.VSCC.v90 and MS.MSDNQTR.v90.en, I have uploaded the program to my website, link at the top of this thread. A test on the PSDK would be great.
Title: Re: Help2 revisited
Post by: donkey on February 25, 2009, 08:57:38 AM
Rob Chandler, author of FAR and H2Viewer and Microsoft Help MVP has helped me out with the home page issue, I was not getting a home page for MSDN Express edition. He emailed me how he accomplished it in FAR and it solved the problem nicely, version 0.4.0.0 has the GetHomePage function that is my attempt at implementing what he told me he did in H2Viewer. Essentially he first tries for the HomePage entry, if that's not found then the DefaultPage entry if that fails then he scans the table of contents to find the topmost url. I did not fully implement the scan of the TOC, I simply look at the first slot and if it contains a valid URL I use that, if not then I show a blank page.

Again, I would appreciate feedback on whether everything is working.
Title: Re: Help2 revisited
Post by: ToutEnMasm on February 25, 2009, 01:31:28 PM
Hello,
It's work with XP sp3,but .... the search box disappear too much quickly.
Better would be a button to close it
Title: Re: Help2 revisited
Post by: akane on February 25, 2009, 02:05:28 PM
Donkey, I'm providing a set of answers/bugs:

line 1268 // Should I Release the iHxTopic here ???
Yes, you know its index. The index identifies single IHxTopic until the session is valid, and the selected filter does not change.

BUG line 1304 InitializeNamespace ... CoInvoke Release.
You need to zero global pointers after releasing any instance. If SetHxCollection fails (or something later), next time you execute InitializeNamespace, Release will be called again on the released pointer. Change the namespace two or three times to see what happens.

BUG line 1435 EndHxSession
Release method is allowed to return any value, not only the reference count, so you should not rely on it, and always set *ppSession to NULL after calling Release.

Memory leaks in function GetURL, GetName, GetCollectionTitle...
pbszName = SysAllocString{Len}
CoInvoke methodname, [pbszName]

The methodname method always calls SysAllocString and returns the new string in the last parameter. If you do so, the first 4 bytes in pbszName are a BSTR pointing to new string. Use this instead:
// do not call invoke SysAllocString{Len}
CoInvoke(pInterface,IWebBrowser2.get_LocationName,offset pbszName)

This is how a method returns BSTR:
HRESULT __stdcall IMyInterface::get_title(BSTR* ppv)
{
*ppv = SysAllocString(L"whatever");
return *ppv ? S_OK : E_OUTOFMEMORY;
}
or
invoke SysAllocString, L"whatever"
mov edx,[ppv]
mov [edx],eax
Title: Re: Help2 revisited
Post by: donkey on February 25, 2009, 03:20:40 PM
Hi akane,

Thanks very much, I wasn't comfortable with the way the BSTR returns seemed to end up working, I am actually glad I had it wrong, at least now it makes sense. Just not used to having to free someone else's memory so it never dawned on me that I might have to. I have combed through the application as much as I could and hopefully I've taken care of the leaks and the necessary releases. I hope to finish up the unicode version in the next couple of days, that way I can get rid of the back and forth conversion that dogs the program. I still have one leak that I haven't tracked down, when I dbl click an item in the index memory usage shoots up about 200 or so K and doesn't drop back down after 20 or so pages it adds up, I am trying to find the cause.

I have uploaded an interim version (0.4.1.0) while I continue work on the unicode release.

Hi ToutEnMasm

Good idea, the Search dialog now works the way you suggested, it remains active until you close it.

Edgar
Title: Re: Help2 revisited
Post by: donkey on February 25, 2009, 07:04:54 PM
You have to love GoAsm,

Nearly 2000 lines of code and the ANSI to UNICODE transition took less than half an hour and everything was working, I am so happy I picked this assembler !!!

The UNICODE version has been uploaded (0.5.0.0) there was an issue with the commctrl header file under UNICODE that has been dealt with, headers version 0x013002 is required to build the application because of the error, that has been uploaded as well. There is very little code changed since the change over from ANSI to UNICODE apis is automatically handled in the headers. The most significant difference is the lack of conversion back and forth, there were places where the lstrcpyn function was used when moving data from bstr return values to memory buffers. I decided on lstrcpyn because since I have no control over the length of string returned from the COM calls it protects the buffers from overruns. Any inline quoted text has the L modifier to indicate UNICODE, declared text uses DUS. The only real issue I ran into was the registry, you will have to delete the registry key created by the ANSI version and run the program to reselect it, it is found under

HKCU\Software\Donkey\HelpViewer\

Just delete the whole thing, the namespace is the only thing saved there for now anyway.
Title: Re: Help2 revisited
Post by: akane on February 25, 2009, 10:01:11 PM
Donkey, could you please include the object file in your zip file? On a crash, it would be easier to find the bug. It is crashing if you change the namespace (no visible change) and close the viewer or click a topic.
Title: Re: Help2 revisited
Post by: donkey on February 26, 2009, 01:07:21 AM
Quote from: akane on February 25, 2009, 10:01:11 PM
Donkey, could you please include the object file in your zip file? On a crash, it would be easier to find the bug. It is crashing if you change the namespace (no visible change) and close the viewer or click a topic.

Hi akane,

Had to work so I didn't get to this till I got home (my boss actually wants me to show up in order to get paid nazi bast*rd), I should have also been releasing the whole session when changing collections, as well I needed to call AtlUnAdvise for the index view. It seems to be working fine now, actually better than before, I am not sure why this problem didn't appear in the ANSI version as it has nothing to do with the conversion. I have included the OBJ and RES files in the zip.
Title: Re: Help2 revisited
Post by: donkey on March 01, 2009, 06:44:32 PM
I have added a table of contents to the viewer along with a synchronize button on the toolbar. In order to add the TOC I also had to add a tab control which should allow for better expandability in the future as I can now add new windows easily. I have yet to code the splitter bar, too many things going on with other parts of the program right now. I am currently working on adding the ability to open CHM files in the viewer and making the UI transparent to the difference. This will allow for a fully integrated help system for both HTML Help 1.x and 2.0 with complete transparency to the user.

The progress with HTMLHelp 1.x is slow, I have implemented the IStorage interface and can extract a Keyword index in XML format from any CHM file, the major outstanding issue is to parse the XML file. The TOC should be straight forward enough once I finish the parser. Once this is finished and implemented I will begin to scratch my head over the splitter bar and a few other UI issues.

You can download the source and executable at my website.

The new version number is 0.6.0.0
Title: Re: Help2 revisited
Post by: akane on March 01, 2009, 08:37:42 PM
I've got my frst exception, thanks for the object file! I managed to find the cause in StartHxSession:
StartHxSession FRAME ppSession
LOCAL pSession:D

mov eax,[ppSession]
mov ecx,[eax]
test ecx,ecx
jz >
CoInvoke(eax,IHxSession.IUnknown.Release)
:

Should not ecx be passed to coinvoke?
Title: Re: Help2 revisited
Post by: donkey on March 01, 2009, 11:17:25 PM
Hi akane,

Actually that whole bit was supposed to be removed, it is unnecessary I missed it when I rewrote the namespace loader. Odd that I don't get the exception here though. Yes, it should be ECX but that will not help as the interface is released immediately prior to the call by the InitializeNamespace function so it is redundant. The first call to StartHxSession at startup was also redundant and has been removed since the session is started in InitializeNamespace instead. I have uploaded version 0.6.1.1 which should correct the problem, it also has the search dialog moved to the tab, it makes more sense having it there.

Edgar
Title: Re: Help2 revisited
Post by: donkey on March 02, 2009, 08:20:55 AM
Version 0.6.1.4:

A few minor changes to the UI, the DISPID_COMMANDSTATECHANGE event is processed allowing the back and forward buttons to be disabled when there are no pages for them to navigate to. The top of the web browser has been aligned to the tab control and the search window resizing issue has been dealt with.

The initialization of the application had a bug where I assumed that any one running the app would have Help2 installed, that may not be the case so it will exit gracefully if the required class is not found. The OLE error code is reported in the termination dialog if the program cannot load Help2.

Edgar
Title: Re: Help2 revisited
Post by: donkey on March 03, 2009, 10:57:25 PM
Version 0.6.2.1

Added a command line option to do an index search, this is primarily for integration into an IDE. The command line is very simple...

Help2 Viewer.exe /Keyword /Namespace

The keyword cannot contain spaces, nor can there be a space after the /. In order to make the program workable I also added a SingleInstance function, it enforces only one instance of the program to be running at a time. If another is started the command line is parsed and through some fancy interprocess communication it passes the keyword to the running instance. However, I am not entirely sure that Vista allows this type of thing so I need someone to test on Vista. Also the program needs to be run in Admin mode as far as I know, if someone can test that as well I would greatly appreciate it.

EDIT> I thought about the command line and added the /Namespace as well. The program will check to see if one was specified and initialize it if it is. The arguments are location specific, in other words the first argument must be the keyword. The namespace is as it appears in the select namespace dialog, that is :

MS.MSDNQTR.v90.en

Do not add the "ms-help://" prefix, it is added by the program.

Since this feature is aimed at IDE plugin authors I have decided the strictness is not a limitation so I will most likely not be changing it to a more robust method. It is up to the IDE to determine the fitness of the data passed.
Title: Re: Help2 revisited
Post by: donkey on March 06, 2009, 01:05:59 AM
Version 0.6.2.4

Had to redo the command line parser to parse it completely from within the application as there were issues with instances started through CreateProcess when lpApplicationName was non-NULL. It should now catch the problem and deal with it appropriately, I also added the option to change collections from an IDE, the command line syntax remains the same.
Title: Re: Help2 revisited
Post by: donkey on March 09, 2009, 06:11:33 AM
Version 0.6.2.5

Incredibly small update, I was trying resource based urls and added a resource based page to display a custom page when a navigation error occurs.

BTW I really need to know if interprocess communication works under Vista, just run the prog and double click the "Find ExitProcess" link.
Title: Re: Help2 revisited
Post by: UtillMasm on March 10, 2009, 06:29:36 AM
C:\GoAsm\BIN\GoAsm.EXE /d UNICODE  "Help2 Viewer.asm"

GoAsm.Exe Version 0.55.02 - Copyright Jeremy Gordon 2001/6 - JG@JGnet.co.uk

Warnings ......................

Line 21 of the include file Help2 Viewer.h:-
Could not open file:-
#include "WINDOWS.H"
Line 29 of the include file Help2 Viewer.h:-
Could not open file:-
#include "Commctrl.h"
Line 30 of the include file Help2 Viewer.h:-
Could not open file:-
#include "macros.a"
Line 31 of the include file Help2 Viewer.h:-
Could not open file:-
#include "exdisp.h"
Line 32 of the include file Help2 Viewer.h:-
Could not open file:-
#include "atlbase.h"
Line 33 of the include file Help2 Viewer.h:-
Could not open file:-
#include "ExDispid.h"
Line 34 of the include file Help2 Viewer.h:-
Could not open file:-
#include "MSHelpServices.h"
Line 35 of the include file Help2 Viewer.h:-
Could not open file:-
#include "MSHelpControls.h"
Line 36 of the include file Help2 Viewer.h:-
Could not open file:-
#include "htmlhelp.h"

Error!
Line 28 of assembler source file (Help2 Viewer.asm):-
Label of this name already declared:-
GUID GUID_CLSID_HxRegistryWalker

OBJ file not made

Make error(s) occured.

---------------------------------------------------
Hello, I'm a beginner of goasm.
I need somebody help me!
Title: Re: Help2 revisited
Post by: donkey on March 10, 2009, 06:57:26 AM
From the Windows.H file:

/* IMPORTANT !!!!!
**********************************************************************************
IMPORTANT !!!!!

You must create an INCLUDE environment variable with the path to these header files
See "Include files - using #include and INCBIN" in the GoAsm manual for details
***********************************************************************************
*/

First be sure you have downloaded and unzipped my headers to a folder on your system, then to use the headers you must set the include environment variable. For the duplicate definition I am not sure, perhaps it will resolve once the headers load properly.

The headers are available here:

http://www.quickersoft.com/donkey/headers/headers.zip

Edgar
Title: Re: Help2 revisited
Post by: UtillMasm on March 10, 2009, 07:01:47 AM
C:\RadASM\GoASM\Projects\Help2 Viewer>set INCLUDE=c:\goasm\include

C:\RadASM\GoASM\Projects\Help2 Viewer>C:\GoAsm\BIN\GoAsm.EXE /d UNICODE  "Help2
Viewer.asm"

GoAsm.Exe Version 0.56.5b - Copyright Jeremy Gordon 2001/9 - JG@JGnet.co.uk

Error!
Line 464 of assembler source file (Help2 Viewer.asm):-
Could not get size of structure/union in local data declaration:-
LOCAL   tci                             :TCITEM

OBJ file not made
--------------------------------------------------------------------------
Help me!
Title: Re: Help2 revisited
Post by: donkey on March 10, 2009, 07:10:28 AM
There is an error in commctrl.h that I didn't catch, here is the replacement file (I use a different set of headers, well the same ones but much more advanced over what is available on my site), I will upload the corrected zip in the morning...



[attachment deleted by admin]
Title: Re: Help2 revisited
Post by: UtillMasm on March 10, 2009, 07:19:48 AM
C:\RadASM\GoASM\Projects\Help2 Viewer>set include=c:\goasm\include

C:\RadASM\GoASM\Projects\Help2 Viewer>c:\goasm\bin\gorc.exe /r 'help2 viewer.rc'


GoRC.Exe Version 0.90.3f - Copyright Jeremy Gordon 1998/2009 - JG@JGnet.co.uk

Warnings ......................

Line 10 of the include file Res\MainDlg.rc:-
A class name was not recognised but assumed to be a user-class:-
"Help2ViewerClass"

Line 17 of the include file Res/InfoDlg.rc:-
A class name was not recognised but assumed to be a user-class:-
"UDC_Hyperlink"

Line 18 of the include file Res/InfoDlg.rc:-
A class name was not recognised but assumed to be a user-class:-
"UDC_Hyperlink"

Line 2 of the include file Res/navfail.rc:-
An ID was not evaluated and was assumed to be a name:-
navfail.htm

Output file: help2 viewer.res

C:\RadASM\GoASM\Projects\Help2 Viewer>c:\goasm\bin\goasm.exe /d UNICODE 'Help2 V
iewer.asm'

GoAsm.Exe Version 0.56.5b - Copyright Jeremy Gordon 2001/9 - JG@JGnet.co.uk
Output file: Help2 Viewer.obj

C:\RadASM\GoASM\Projects\Help2 Viewer>c:\goasm\bin\golink.exe 'help2 viewer.res'
'help2 viewer.obj'

GoLink.Exe Version 0.26.10 beta- Copyright Jeremy Gordon 2002/9-JG@JGnet.co.uk
Output file: help2 viewer.exe
Format: win32 size: 69,632 bytes

C:\RadASM\GoASM\Projects\Help2 Viewer>
---------------------------------------------------------------------------
Everything is oK???
           Run EXE is ok, but I'm not sure.
thanks help me!!!
Title: Re: Help2 revisited
Post by: donkey on March 10, 2009, 07:37:22 AM
The warnings are normal, I use two custom classes in the program, the main window class and the hyperlink. The unevaluated ID is also completely normal, to use a web page from the resource section you must define it in a  specific way (it uses a name instead of an ID), GoRC issues a warning in case you made a typo, but there is no error.
Title: Re: Help2 revisited
Post by: mitchi on March 10, 2009, 03:47:36 PM
What an excellent application, I will reinstall Platform SDK now  :bg
Title: Re: Help2 revisited
Post by: PBrennick on March 11, 2009, 01:10:59 AM
Edgar,

Your hard work is sure making life easy for others searching for help/information.  :U

Paul
Title: Re: Help2 revisited
Post by: donkey on March 11, 2009, 06:06:15 AM
Quote from: PBrennick on March 11, 2009, 01:10:59 AM
Edgar,

Your hard work is sure making life easy for others searching for help/information.  :U

Paul

Thanks Paul

Edgar
Title: Re: Help2 revisited
Post by: donkey on March 11, 2009, 09:13:02 PM
Version 0.6.2.7 uploaded

This update deals with an issue I had with the fail page, when a url fails it remains in the history and displays the default "not found" IE page when you hit back. After struggling with DispGetParam, I wrote a macro to deal with the events dispparams member and have replaced that lame-a** function throughout the program. With the new macro came the ability to cancel the navigation since the pointers passed to the sink are now handled directly instead of through a proxy. With that new ability I have canceled the navigation and displayed the NavFail page (or the resource based one if the collection has none), the IE "not found" page will not be in the history so pressing Back will bring you to the last good url.

Note that I am no longer including the OBJ or RES file in the zip

Edgar
Title: Re: Help2 revisited
Post by: donkey on March 15, 2009, 02:55:05 AM
Version 0.6.2.8,

I added a Google button to google for a keyword, to use it you will obviously need an internet connection, because of that the Google button is only shown if a test for an internet connection returns success otherwise the button is removed from the toolbar. I have been using this for a couple of days and find it very useful so I have added it to the release version.

EDIT: Since the dialog was trapping the enter key the webbrowser control was not receiving a VK_RETURN, though this was not a critical issue, it was annoying so I decided to relay the key to the control if it was pressed. The alternative was to subclass the webbrowser but since the get_HWND method did not return a result I could think of no practical way to do it so this small hack was my solution. There is no version increment for this change as it adds no features and barely qualifies as a bug fix.
Title: Re: Help2 revisited
Post by: akane on March 15, 2009, 08:41:06 AM
Edgar, if you select an empty namespace (without topics and TOC), while closing your viewer ATL is calling Release with NULL pointer.
To create a blank namespace you can use the hxreg.exe tool, or IHxRegisterSession interface with queried IHxRegister.

What i am missing:
- autofocus while using the mouse wheel (i did it inside message loop).
- navigating back/forward with mouse X-buttons (detection in the message loop).
- yay, the splitter!
Title: Re: Help2 revisited
Post by: donkey on March 15, 2009, 09:50:50 PM
Hi akane,

My plans for the day fell through so I had the time to implement the splitter bar. At the same time I decided to save the window position and splitter bar width to the registry so the program remembers its last configuration. Won't have time to look at autofocus or the blank TOC today though.

Version 0.6.3.0 uploaded

<0.6.3.1 added mouse clipping so the focus rectangle could not be sized beyond the fixed limits in the application, also limited the size the main window could be reduced to>
Title: Re: Help2 revisited
Post by: donkey on March 16, 2009, 06:31:11 AM
Version 0.6.3.4 uploaded

Well, with the concentration today on the GUI for the application I have fixed a long standing issue. Not sure where I got the idea that the index lookup could be on the toolbar and the index search could not, it adds inconsistency to the GUI so to fix the problem I have moved the index lookup to the tab, it looks and works like the search tab. The index lookup button has been removed from the toolbar, the old dialog doubled as the google dialog, it now only does google searches.

<a minor change with no version increment, the text entered in search or index is now transferred to the google dialog since I suspect that for the most part it will be used to enhance searches. The search tab is first checked, any text found there is transferred, if none is found then the index tab is checked, if no text is found in the index tab the google text box is left blank. An index search from the command line now displays the search string in the index tab. Both the index and search tabs were clipping the top of the tab control by a couple of pixels, this has been corrected>
Title: Re: Help2 revisited
Post by: UtillMasm on March 16, 2009, 10:46:30 AM
I like your work.
But i have a question? I think it's not normal...
Help me!!!

attachment include a picture about my question.

thanks.

[attachment deleted by admin]
Title: Re: Help2 revisited
Post by: donkey on March 16, 2009, 03:41:58 PM
That's an artifact in RadASM when converting the console output to the window text, not sure why its there but it's been there ever since I started using GoAsm with RadAsm, and I was the first one to ever use it with it. You can just ignore it, on mine it comes up as ""
Title: Re: Help2 revisited
Post by: UtillMasm on March 16, 2009, 04:16:55 PM
Ok,,,I'm not the only one... :bg
Title: Re: Help2 revisited
Post by: donkey on March 17, 2009, 02:53:11 AM
Hi akane,

Could you zip up a little demo of a namespace without topics or a TOC, I don't have a copy of HxReg.exe that I can find.

Edgar
Title: Re: Help2 revisited
Post by: akane on March 17, 2009, 08:06:37 AM
Sure, uploaded to sendspace: http://www.sendspace.com/file/kvab00. Will be available for at least two weeks.
You fnd there the hxreg tool (included with Visual Studio 2008 (http://www.microsoft.com/downloads/details.aspx?FamilyId=59EC6EC3-4273-48A3-BA25-DC925A45584D&displaylang=en) SDK), a unfinished (and also blank) namespace, and if you can read C/C++ code you'll find the source of my browser with namespace (un)registering and editing options.
Title: Re: Help2 revisited
Post by: donkey on March 17, 2009, 11:08:50 AM
Thanks akane,

Flying out of town for the day but I should be back tonight and will take a look at it.

Edgar
Title: Re: Help2 revisited
Post by: donkey on March 18, 2009, 04:44:15 AM
Version 0.6.3.5

Thanks very much for the blank namespace akane.

Added error checking for empty namespaces, the program will revert to the last successfully loaded namespace or if there is none will show an error dialog and exit. In tthe case of command line calls the program will just exit with a message, no attempt is made to find a valid namespace. Cleaned up WinMain, lots of sizing stuff for windows that were completely unnecessary since the addition of the splitter bar, all created windows are now initialized to 1x1 pixels and adjusted when the dialog is shown.
Title: Re: Help2 revisited
Post by: UtillMasm on March 18, 2009, 10:25:28 AM
Help me!!

[attachment deleted by admin]
Title: Re: Help2 revisited
Post by: ur4ltz on March 18, 2009, 01:29:56 PM
Quote from: UtillMasm on March 18, 2009, 10:25:28 AM
Help me!!
Help2 Viewer.Asm [597] :
mov D[rbbi.fStyle],RBBS_TOPALIGN + 0x00000100
Title: Re: Help2 revisited
Post by: donkey on March 18, 2009, 01:50:58 PM
Also, Wininet.h had an error in one of the structures, it was fixed in my version but the new upload is on hold until I am ready with the 64bit version of the headers, commctrl.h has undergone extensive editing and though I thought that definition was in the older file it must not have been. I have attached both here along with the new windef.h that you will need in order to use the new style of headers, it will not effect older headers or ones you have written yourself.

Be sure to use both the STRINGS UNICODE and UNICODE switch with these headers !!!




[attachment deleted by admin]
Title: Re: Help2 revisited
Post by: UtillMasm on March 18, 2009, 01:54:46 PM
Great!
Title: Re: Help2 revisited
Post by: ur4ltz on March 18, 2009, 02:27:51 PM
Thank you!
Title: Re: Help2 revisited
Post by: PBrennick on March 18, 2009, 10:36:21 PM
Edgar,

Is it possible to allow CTRL+A and CTRL+C in the right hand window?  Or could you add an export to text file? This may be beyond the capabilities of the help engin you are forced to work with but, I thought it fair to ask.

Paul
Title: Re: Help2 revisited
Post by: donkey on March 19, 2009, 12:05:24 AM
Quote from: PBrennick on March 18, 2009, 10:36:21 PM
Edgar,

Is it possible to allow CTRL+A and CTRL+C in the right hand window?  Or could you add an export to text file? This may be beyond the capabilities of the help engin you are forced to work with but, I thought it fair to ask.

Paul


Hi Paul,

I have been working on that for about a week with no success, I am trying a different approach at the moment but the keys are trapped below the threshold of the ATL so I have no access or even notification that they have been pressed. There is also no DISP notification for the event so that was an empty lead. But there are many interfaces that are accessible from the control so I still have a few ideas.

I will be adding a print option soon, print to file will be available.

Edgar
Title: Re: Help2 revisited
Post by: PBrennick on March 19, 2009, 03:03:02 AM
Edgar,

If all else fails, Print To File will work.

Paul
Title: Re: Help2 revisited
Post by: donkey on March 19, 2009, 05:28:26 AM
Quote from: PBrennick on March 19, 2009, 03:03:02 AM
Edgar,

If all else fails, Print To File will work.

Paul

Hi Paul,

Do you need the output in HTML ? A plain text from HTML parser would be a large addition to the project, I am not sure I would be ready to take that on right away, I only have abut 4 more weeks until work begins to ramp up again and I will have very little time to myself. Actually when we're in full swing I am only home around 1 day in 5 and lucky to have that, from April to December I pretty much live in hotels and work 14 hour days/7 days a week so I have to finalize any outstanding projects before then.
Title: Re: Help2 revisited
Post by: akane on March 19, 2009, 02:38:02 PM
To implement CTRL+A and CTRL+C for webbrowser, just add a standard accelerator. For select all or copy, use the following method:webbrowser->ExecWB(OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT, NULL, NULL)
webbrowser->ExecWB(OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT, NULL, NULL)

To save the current page in various formats (full, html, mht, text), callwebbrowser->ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, NULL, NULL)
Title: Re: Help2 revisited
Post by: PBrennick on March 19, 2009, 03:56:53 PM
Edgar,

HTML format is fine for me. It looks like akane has some good news, also.

Paul
Title: Re: Help2 revisited
Post by: donkey on March 19, 2009, 07:24:15 PM
Hi Paul,

I did look at accelerators however they are fairly arbitrary, I would need to know when the window is focused and I am still having issues with getting a useful window handle. For example I can use the following code to extract the handle of the browser...

CoInvoke(pIWebBrowser2,IWebBrowser2.IUnknown.QueryInterface,offset IID_IServiceProvider,offset pServiceProvider)
CoInvoke(pServiceProvider,IServiceProvider.QueryService,offset SID_SShellBrowser,offset IID_IOleWindow,offset pWindow)
CoInvoke(pWindow,IOleWindow.GetWindow,offset hBrowser)
CoInvoke(pWindow,IOleWindow.IUnknown.Release)
CoInvoke(pServiceProvider,IServiceProvider.IUnknown.Release)


However the handle returned is not the handle with the focus when the copy command is sent. Actually sending a copy or select all is very simple with ExecWB however making sure that the window is correct is important since the user might also want to copy from the various text boxes. For that reason I was hoping to find an alternative to the accelerator approach.

Edgar
Title: Re: Help2 revisited
Post by: akane on March 19, 2009, 08:21:17 PM
Edgar, use GetClassName and separate selectall/copy dispatchers for different window classes:

OnCopyCommand proc
invoke GetFocus
and    eax,eax
jz     copy_from_browser ; default
invoke GetClassNameW, hwnd, buff, 64
invoke lstrcmpiW, buff, L"edit"
and    eax,eax
jz     copy_from_edit
invoke lstrcmpiW, buff, L"Internet Explorer_Server"
and    eax,eax
jz     copy_from_browser

Instead comparing class names, you could test the return value form SendMessage(WM_GETDLGCODE) for DLGC_HASSETSEL flag.
Title: Re: Help2 revisited
Post by: donkey on March 19, 2009, 09:37:47 PM
Thanks Akane,

Good idea, I had looked at the class name to find the window handle for a compare but it your method is more reliable.

Version 0.6.3.7

Added Select All (ctrl-A) Copy (ctrl-C) and Save As (ctrl-S)

Version 0.6.3.8

Added filters to the search dialog

Version 0.6.3.9

Found a bug where the topic would not be loaded properly through CreateProcess due to not preserving EBX in InitializeNamespace, this bug was introduced by the filters mod and has been corrected.
Title: Re: Help2 revisited
Post by: PauloH on April 03, 2009, 04:40:49 PM
Hi Donkey,

When I try to compile Help2 Viewer I get this output:

=====================================================
C:\Programing\Assembler\Compiladores\Goasm\BIN\GoAsm.EXE /d UNICODE  "Help2 Viewer.asm"

GoAsm.Exe Version 0.56.5h - Copyright Jeremy Gordon 2001/9 - JG@JGnet.co.uk
Output file: Help2 Viewer.obj
C:\Programing\Assembler\Compiladores\Goasm\BIN\GoLink.EXE "Help2 Viewer.obj" "Help2 Viewer.res"

GoLink.Exe Version 0.26.10 beta5- Copyright Jeremy Gordon 2002/9-JG@JGnet.co.uk

Warning!
Assumed entry point (Start) was not found.
Output file: Help2 Viewer.exe
Format: win32 size: 53,248 bytes

Make finished.
Total compile time 344 ms
======================================================

On execution it crashes.
Any hint?

By the way, thank you for your work on headers and examples for GoAsm.

PauloH.
Title: Re: Help2 revisited
Post by: donkey on April 03, 2009, 05:18:07 PM
Hi PauloH,

The error indicates a problem in the headers, I have been working for the last couple of days weeding them out in order to implement INCLUDEALL. I will upload a fixed version today at some point. Sorry about that but there was something screwy with the editor I was using, a Scintilla based one, it would occasionally say it saved when it actually hadn't. I'm back to using good old RadAsm with some macros I recorded for it, it's much more reliable.

Edgar
Title: Re: Help2 revisited
Post by: PauloH on April 03, 2009, 05:26:00 PM
Thank you, Donkey. You're doing a giant's work!

PauloH.