Author Topic: HTML to RTF  (Read 78325 times)

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
Re: HTML to RTF
« Reply #135 on: July 08, 2013, 04:09:56 PM »

The IsFormatCorrect function return correct values.See my source code who use it.
To use it,filters the return values as i have posted in my upper post.
The unknown errors are not interpreted as errors,they can be only various messages given by the dll.
Fa is a musical note to play with CL

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: HTML to RTF
« Reply #136 on: July 08, 2013, 06:31:02 PM »
Hi Yves....i know, but it is crashing here, due to the overloading of the globallalloc function.

Some of these functions may be unitialized to clear the allocated memory in order to not break internally. It seems to be the case of IsFormatCorrect. Since i already used globalalloc heavily, it broke inside. The documentation says we must unitiliaze some functions. The problem is only figure it out which ones and how to make them work properly for all converters without breaking.

I did the same as you using IsFormatCorrect and the app simply showed the error. I tried many different variatonsfor the function....I used my own global alloc routines to better points internally what was happenning. The problem was that, before the IsFormatCorrect was used, the app was making heavy usage of globalalloc/globalloc/globalfree functions. This is why the doc says that some functions maybe unitilialized.

Now that it is working, it is better to figure it out exactly where/which functions needs better attention. I´m finishing the routine to create a config file, and will restore the usage of IsFormatCorrect checkings.

Code: [Select]
Proc IsFormatCorrect:
    Arguments @szAppName
    Local @hFileName, @hDest
    Uses ecx, ebx, edx

    xor eax eax
    On D$CConverter.m_hLibCnv = 0, ExitP
    On D$CConverter.m_IsFormatCorrect = 0, ExitP

    ;call StrCpyEx D@szAppName, StringCheckBuff, Size_Of_String
    ;call 'user32.CharToOemA' StringCheckBuff, StringCheckBuff
    call StringtoHGlobal D@szAppName | mov D@hFileName eax

    ;mov D@hDest 0
    ;lea eax D@hDest
    ;call 'RosMem.VMemAlloc' eax, 256

    call 'kernel32.GlobalAlloc' &GHND, 4096 | mov D@hDest eax
    ;call 'kernel32.GlobalAlloc'2 &GHND, 1024 | mov D@hDest eax
    ;call 'kernel32.GlobalLock' eax
    ;call 'kernel32.GlobalHandle' eax
    ;call GlobalHandle eax

    ;call 'kernel32.GlobalAlloc'2 &GHND, 1024 | mov D@hDest eax
    call D$CConverter.m_IsFormatCorrect D@hFileName, eax

    mov ebx eax
    call 'kernel32.GlobalFree' D@hFileName
    call 'kernel32.GlobalFree' D@hDest
    ;call 'kernel32.GlobalFree' D@hDest
    ;call 'kernel32.GlobalFree' D@hFileName
    ;call 'RosMem.VMemFree' D@hDest
    ;call 'RosMem.VMemFree' D@hFileName
    mov eax ebx

EndP
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com