flat assembler
Message board for the users of flat assembler.

Index > Windows > Problems with my DLL in Win8x64 (but XP64/Win7x64 - works!)

Author
Thread Post new topic Reply to topic
f2065



Joined: 01 Jan 2012
Posts: 16
Location: Russia,Moscow
f2065 01 Jan 2012, 20:19
For some reason can not perform my .DLL under Windows 8 x64.
regsvr32 error:

The module test64.dll failed to load.
Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent. DLL files.
Invalid access to memory location.

In Windows XP 64bit and Windows 7 64bit - copy my test64.dll in C:\Windows\System32, and execute in CMD-console:
C:\>regsvr32 test64.dll
All is fine, everything works.

The problem with Windows 8 x64. There's my test64.dll does not work.
UAC off completely, I'm admin, tried to run from .cmd as Run as Adminstrator.
In any case, the result: Invalid access to memory location.

Debugging MessageBox does not show - that is, .DLL does not called at all - DllEntryPoint not called.

Other startup methods (via the registry) is not working. Since then, and began proceedings. There is my program (COM-server shell extensions) which works in all 64bit Windows (XP64, 7x64, 2008), but here in Win8 found that does not work. In what has created such a simple example test64.dll - and found that he Win8 does not work ...

Have any ideas what I have here a mistake?

Code:
; build in FASM v.1.69.35
; X:\ASM\FASM\FASM.EXE test64dll.asm test64.dll

format PE64 GUI 4.0 DLL
entry DllEntryPoint

include 'X:\ASM\FASM\INCLUDE\WIN64A.INC'

section '.idata' import data readable writeable
library user32,'USER32.DLL'
import user32,MessageBoxA,'MessageBoxA'

section '.text' code readable executable

proc DllEntryPoint .hinstDLL,.fdwReason,.lpvReserved
    invoke    MessageBoxA, 0, t_DllEntryPoint, t_test64, MB_OK
    mov    rax, 1
    ret
endp

proc DllCanUnloadNow
    invoke    MessageBoxA, 0, t_DllCanUnloadNow, t_test64, MB_OK
    mov    rax, 0
    ret
endp

proc DllGetClassObject, rclsid,riid,ppv
    mov    [rclsid], rcx
    mov    [riid], rdx
    mov    [ppv], r8
    push    rdi
    sub    rsp, 8 ; stack align
    invoke    MessageBoxA, 0, t_DllGetClassObject, t_test64, MB_OK
    mov    rdi, [ppv]
    mov    qword [rdi], 0
    mov    rax, 0x80040111 ; CLASS_E_CLASSNOTAVAILABLE
    add    rsp, 8
    pop    rdi
    ret
endp

proc DllRegisterServer
    invoke    MessageBoxA, 0, t_DllRegisterServer, t_test64, MB_OK
    mov    rax, 0
    ret
endp

proc DllUnregisterServer
    invoke    MessageBoxA, 0, t_DllUnregisterServer, t_test64, MB_OK
    mov    rax, 0
    ret
endp

section '.bss' data readable writeable
t_test64 db 'test64.dll',0
t_DllEntryPoint db 'DllEntryPoint',0
t_DllCanUnloadNow db 'DllCanUnloadNow',0
t_DllGetClassObject db 'DllGetClassObject',0
t_DllRegisterServer db 'DllRegisterServer',0
t_DllUnregisterServer db 'DllUnregisterServer',0

section '.edata' export data readable
export 'test64.DLL',\
    DllEntryPoint,'DllEntryPoint',\
    DllCanUnloadNow,'DllCanUnloadNow',\
    DllGetClassObject,'DllGetClassObject',\
    DllRegisterServer,'DllRegisterServer',\
    DllUnregisterServer,'DllUnregisterServer'

section '.reloc' fixups data discardable
    


Description:
Download
Filename: test64_dll.rar
Filesize: 2.24 KB
Downloaded: 259 Time(s)

Post 01 Jan 2012, 20:19
View user's profile Send private message Visit poster's website Reply with quote
f2065



Joined: 01 Jan 2012
Posts: 16
Location: Russia,Moscow
f2065 03 Jan 2012, 00:12
Remove the line section '.reloc'... And DLL in Windows8 - works!

But broken in WinXP64 (LoadLibrary failed - Attempt to access invalid address) and Win7x64 (Invalid access to memory location).

Further discovered that the problem is not just win8x64, but in general both Win8 - to 32-bit exactly the same mistake (of course there I wrote a 32-bit DLL).

What to write in '.reloc' to work in WinXP/Win7 and Win8 ?

Gathered the same DLL in MASM x64 v10 - it works in xp64, and win8x64...
The problem with FASM... Sad
Post 03 Jan 2012, 00:12
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 03 Jan 2012, 01:49
Check this
Post 03 Jan 2012, 01:49
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.