News:

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

how to run the .chm file from the helptopic menu?

Started by Eric4ever, May 30, 2006, 09:27:06 AM

Previous topic - Next topic

Eric4ever

i'm sorry, zooba, i cannot catch it.

Could you give me some examples to learn?

Ian_B

#16
Or just run through the string byte-by-byte looking for either the null-byte end of string or a second "\" after the first "\" character in the drivespec ("C:\"), which is probably all the SHLWAPI stuff does anyway, and will save you a slow external API call and an include. Then simply truncate the string by adding a null-byte after the "\" if you found one, or a "\" and a null-byte if you didn't.

EDIT: forgot you are definitely getting a full file name after the path with this function. You just need code like this, definitely too minimal to waste calling SHLWAPI functions for:

        lea     ebx, TestPathSpec       ; a buffer MAX_PATH chars in length
        invoke  GetModuleFileName, NULL, ebx, MAX_PATH
        lea     ecx, [ebx+2]            ; first check pos is slash at end of C:\
        test    eax, eax
        jz      FatalPathError
@@:
        mov     al, [ecx]
        add     ecx, 1
        test    al, al                  ; is it the string end
        jz      @F
        cmp     al, "\"                 ; is it a path delimiter
        jne     @B
        mov     edx, ecx                ; save last path delimiter found
        jmp     @B
@@:
        mov     [edx], al               ; null-terminate path
        sub     edx, ebx                ; get path length including last delimiter


Ian_B