News:

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

Creating Usable .exe File

Started by raleeper, August 28, 2007, 09:37:20 AM

Previous topic - Next topic

raleeper

I uploaded a zip file (to http://www.intergate.com/~rale/lfw.zip) containing lfw.exe, lfw.lf, and lfw.asm.  (The .asm file is not involved in this problem)  To see if it would work I downloaded the zip to my desktop and extracted the files to c:\lfw.  It worked fine, so I posted the link to this forum.

Two forum members tried running the exe and it crashed.  And (somewhat later) I tried it on a different computer and it crashed.

As I said in "Thanks, Demonstration"

   It's crashing because ebx is not initialized and is
   0 when it hits the mov dh, [ebx] (8A 33)
   instruction.  But why this should happen is beyond
   me.

[Thanks to sinsi for posting the windows 95 error message]

I assemble and link using the following batch file, and I am guessing that it contains the cause of the problem:

C:\AW.BAT

g:
cd lfw
g:\masm32\bin\ml /c /coff /Cp /Fl /W2 /Zi g:\lfw\lfw.asm >errs
g:\masm32\bin\link /SUBSYSTEM:WINDOWS /LIBPATH:g:\masm32\lib /DEBUG /DEBUGTYPE:CV lfw.obj >>errs
cd\
c:

Can anyone suggest what I am doing wrong and why an exe file that works on my main system crashes on other computers?

Thanks.

evlncrn8

well some windows versions are picky about register preservation... primarially esi, edi, ebx, ebp
which can cause crashes on some windows versions but not on others...
other reasons for crashes can obviously be bad code...

raleeper

I have made [almost] no progress on this problem and do not know what to try next.

1.  The Problem: my program works for me (on some systems) but not for others (forum members and others of my systems).

2.  My systems are:

    a.  "Chief" - XP sp2 on (MB = ASUS A8V-E SE  Via KT8T890; CPU = AMD Athlon 64 X2 3800+)
    b.  "Ally" -  (MB = AOPEN AK86-L VIA K8T800; CPU = AMD Athlon 64 3000+)
        1.  OS = Windows98 SE
        2.  OS = XP sp2 - a "clean reinstall"
    c.  "Swoosh" - XP sp2 on (MB = Chaintech VNF3-250; CPU = AMD Sempron 2600+)

3.  My program - lfw.exe - works fine (within its limitations) on 2a and 2b2.  It crashes on 2b1 and 2c.

Help!  Can anyone suggest a next step?

raleeper

OK - I can think of some things to try:

    1. Try evlncrn8 's suggestion and preserve all regs.  I've been assuming the API functions would preserve ebx, esi, edi, ebp, esp  and not eax, ecx, edx ; and I wrote my sbr's with the same convention - but it is easy enough to pushad...popad, so I'll try that.

    2. Get and install a version of the SDK for W98 SE.  Or try what I've been using [MS PSDK WSERV 2003 SP1 APRIL 2005] on my one XP system that crashes.

Thanks

Farabi

If you have problem with EBX. I suggest you to put "uses ebx" word on your function.

Example:

MyProc proc uses ebx test:dword

ret
MyProc endp
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

sonic

Crashes here too . Seems bug in your code

mov   [mfa], edi   is never reached here.

So mfa will contain zero and later you move this value to ebx (which is eventually zero) and calling mov dh,byte ptr[ebx] will cause access violation and crash

raleeper

Thanks for your suggestions.  I am working on the problem and will no doubt crack it in time.

raleeper

Moderators:

Is there a way to cancel or delete a post?

Sevag.K

If all the crashes are happening only on Win2k (or NT?) systems, the problem is most likely in preserving of ebx/esi/edi (as others have pointed out) in the callback procedures.  Normally, the other systems aren't as anal about the ABI.

raleeper

Quote from: Sevag.K on September 02, 2007, 12:26:40 AM
If all the crashes are happening only on Win2k (or NT?) systems, the problem is most likely in preserving of ebx/esi/edi (as others have pointed out) in the callback procedures.  Normally, the other systems aren't as anal about the ABI.


The crashes now occur only on my windows 98 SE system.

I have 3 XP sp2 systems - no crashes, although it was crashing on the third until I installed the SDK and debugging tools and included the .pdb and .ilk files.

My problem now is that I don't have a debugger that works on the 98 system.  OllyDbg (v1.10) seems a bust as it won't load the source file.

I'm going to set up a 4th XP system from the ground up (I've had the makings of a core2 duo system just sitting around for a while) so I won't be working on this for a few days at least.

Thanks.