flat assembler
Message board for the users of flat assembler.

Index > Windows > Problem with DLL...

Author
Thread Post new topic Reply to topic
Necromancer13



Joined: 18 Oct 2007
Posts: 32
Location: Ukraine
Necromancer13
I try to write a DLL in FASM bu I have not success...


It's a source of DLL:



Code:
format PE GUI 4.0 DLL
entry start
include '%fasminc%\win32a.inc'
cdopen        db 'set cdaudio door open',0
cdclose       db 'set cdaudio door closed',0

proc start DhInst,DReason,DReserved
      mov        eax,TRUE
      ret
endp

proc cdcontrol AcT
      cmp        [AcT],1
      jz         .opencd
      cmp        [AcT],2
      jz         .closecd
      xor        eax,eax
      inc        eax
      ret
.opencd:
      invoke     mciSendString,cdopen,0,0,0
      xor        eax,eax
      ret
.closecd:
      invoke     mciSendString,cdclose,0,0,0
      xor        eax,eax
      ret
endp

data import
        library winmm,'winmm.dll'
        import  winmm,mciSendString,'mciSendStringA'
end data

data export
      export     'DLL.DLL',\
                 cdcontrol,'cdcontrol'
end data
    



and here I try to load it:

Code:
format PE GUI 4.0
entry start
include '%fasminc%\win32a.inc'
start:
        invoke  cdcontrol,1
        ret
data import
     library  DLL,'DLL.DLL'
     import   DLL,\
              cdcontrol,'cdcontrol'
end data
    


invoke cdcontrol,1
It must open a cd-rom... But...Sad

_________________
FASM Rulezzzzzz!
Post 02 Nov 2007, 17:02
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Well, I'm not sure if you are using the appropiate string commands but in the DLL you forgot to add the fixups.
Code:
data fixups
end data    


Use the DLL example as a template to make sure you don't miss something.
Post 02 Nov 2007, 17:05
View user's profile Send private message Reply with quote
Necromancer13



Joined: 18 Oct 2007
Posts: 32
Location: Ukraine
Necromancer13
Ok.. I'll try to add it:)
Post 02 Nov 2007, 17:07
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Necromancer13



Joined: 18 Oct 2007
Posts: 32
Location: Ukraine
Necromancer13
Thanks, now it works:)
Post 02 Nov 2007, 17:17
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.