flat assembler
Message board for the users of flat assembler.

Index > Windows > (gelöst)The DLL file isn't working—who can help me?

Author
Thread Post new topic Reply to topic
Harald2026



Joined: 13 Apr 2026
Posts: 9
Harald2026 11 May 2026, 16:29
Hallo Leute

Dieses DLL Programm lässt sich starten aber er vermittelt nur eine null als Ergebnis.
Was hab ich da falsch gemacht ???

TestA wird übergeben und sollte 16 als Ergebnis bringen

Hi everyone,

This DLL program launches successfully, but it only returns a zero as the result.
What did I do wrong here?

TestA is passed as input and should yield 16 as the result.


format PE64 console DLL
entry DllEntryPoint

include 'win64a.inc'

section '.text' code readable executable


proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
mov eax,TRUE
ret
endp



; Funktion: Add(a, b) -> eax = a + b
proc AddHar , TestA

mov RAX,[TestA]
ADD rax,0x00000010
MOV [TestA],rax
ret

endp



;section '.bss' data readable writeable
;TestA dq ?

section '.edata' export data readable writeable

export 'TestH.DLL',\
AddHar, 'AddHar'

section '.reloc' fixups data readable discardable

if $=$$
dd 0,8 ; if there are no fixups, generate dummy entry
end if

;section '.idata' import data readable writeable

;library kernel32,'KERNEL32.DLL'

;include 'api/kernel32.inc'



invoke AddHar ,TestA ;warum ????? DLL geht nicht !!!!
MOV RAX,[TestA] (TestA = 0)


Description:
Download
Filename: TestH.asm
Filesize: 808 Bytes
Downloaded: 7 Time(s)



Last edited by Harald2026 on 12 May 2026, 10:24; edited 3 times in total
Post 11 May 2026, 16:29
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20976
Location: In your JS exploiting you and your system
revolution 11 May 2026, 16:35
404: DLL not found.

Please post the sources.
Post 11 May 2026, 16:35
View user's profile Send private message Visit poster's website Reply with quote
Core i7



Joined: 14 Nov 2024
Posts: 164
Location: Socket on motherboard
Core i7 11 May 2026, 17:20
In x64 arguments are passed through the rcx, rdx, r8, and r9 registers, so the "TestA" input parameter is empty (=0). Rewrite the procedure like this, and everything should work correctly:
Code:
proc  AddHar uses rbx rsi rdi, TestA
      mov    [TestA],rcx

      mov    rax,[TestA]
      add    rax,0x10      ;// RAX = result
      ret
endp
;//-----------------------------
;// Or just read RCX:
;//-----------------------------
proc  AddHar uses rbx rsi rdi
      mov    rax,rcx
      add    rax,0x10
      ret
endp    
Post 11 May 2026, 17:20
View user's profile Send private message Reply with quote
Core i7



Joined: 14 Nov 2024
Posts: 164
Location: Socket on motherboard
Core i7 11 May 2026, 18:25
For example: DLL library
Code:
format  pe64 console dll
include 'win64ax.inc'
entry   DllEntry
;//-------------
section '.text' code readable executable
proc DllEntry uses rbx rsi rdi, hDLL,Reason,Rsv
        mov     eax,1
        ret
endp

align 16
proc  AddHar uses rbx rsi rdi
        mov     rax,rcx
        add     rax,0x10
        ret
endp
;//-------------
section '.edata' export data readable writeable
export  'TestH.dll',AddHar,'AddHar'
;//-------------
section '.reloc' fixups data discardable
if      $=$$
        dd      0,8
end if
    

And application:
Code:
format  pe64 console
include 'win64ax.inc'
entry start
;//-------------
.data
buff    dq  0
;//-------------
section '.text' code readable executable
start:  sub     rsp,8
       cinvoke  printf,<10,' Enter dec value:  ',0>
       cinvoke  scanf,'%llu',buff

        mov     rcx,[buff]
      stdcall   [AddHar]

        xchg    rdx,rax
       cinvoke  printf,<   ' Result.........:  %llu',0>,rdx

       cinvoke  getch
       cinvoke  exit,0

section '.idata' import data readable writeable
library  msvcrt,'msvcrt.dll',TestH,'TestH.dll'
import   msvcrt,printf,'printf',scanf,'scanf',\
                getch,'_getch', exit, 'exit'
import   TestH, AddHar,'AddHar'
    


Description:
Filesize: 1016 Bytes
Viewed: 121 Time(s)

dll.png


Post 11 May 2026, 18:25
View user's profile Send private message Reply with quote
Harald2026



Joined: 13 Apr 2026
Posts: 9
Harald2026 11 May 2026, 21:19
Ich schau mir das mal an. Vielen Dank in voraus...

I'll take a look at that. Thanks in advance...
Post 11 May 2026, 21:19
View user's profile Send private message Reply with quote
Harald2026



Joined: 13 Apr 2026
Posts: 9
Harald2026 12 May 2026, 10:16
Hallo , mit ein wenig Änderungen hat es endlich Funktioniert , danke dir für deine Hilfe

Hello, with a few minor changes, it finally worked—thank you for your help!



format pe64 console dll
include 'win64ax.inc'
entry DllEntry
;//-------------


section '.text' code readable executable
proc DllEntry uses rbx rsi rdi, hDLL,Reason,Rsv
mov eax,1
ret
endp

align 16
proc AddHar uses rbx rsi rdi
mov rax,rcx
add rax,32768
ret
endp
;//-----------------------------
;// Or just read RCX:
;//-----------------------------


;//-------------
section '.edata' export data readable writeable
export 'TestH.dll',AddHar,'AddHar'
;//-------------
section '.reloc' fixups data discardable
if $=$$
dd 0,8
end if






MYPrrogramm eingesetzt


CMP [STOPCode],0
JNE FGH
;cinvoke scanf,'%llu',TestA
MOV RCX,[TestA]
stdcall [AddHar] ;warum ????? DLL geht nicht !!!!
;MOV rdx,rax
MOV [TestA],rax

FGH:
Post 12 May 2026, 10:16
View user's profile Send private message 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-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.