News:

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

dialog in DLL

Started by 5k3l3t0r, September 02, 2010, 08:26:32 PM

Previous topic - Next topic

5k3l3t0r

Hi all...
I come across one problem in RadAsm, i have created a DLL, added a resource->Dialog, but when i compille the resource don't go to the dll, i have debugged and
i get ERROR_RESOURCE_NOT_FOUND when i call "DialogBoxParam" or "CreateDialogParam" i have tested both...


.inc

include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
include c:\masm32\macros\macros.asm


MainDlg proto :HWND,:UINT,:WPARAM,:LPARAM
Log proto :DWORD
PluginName proto
PluginIni proto :HWND,:DWORD,:DWORD

.data
szPluginName db 'xumpDll1',0,0

.data?
hWmain dd ?
hDlgPrnt dd ?
lpLogFunc dd ?
hInstance dd ?


.asm

.386
.model flat,stdcall
option casemap:none

include xunpDll1.inc

.code
DllEntry proc hInstDLL:HINSTANCE, reason:DWORD, reserved1:DWORD

.if reason==DLL_PROCESS_ATTACH
push hInstDLL
pop hInstance
.endif

    mov  eax,TRUE
    ret
       
DllEntry Endp

PluginName proc

    mov eax,offset szPluginName
    ret
   
PluginName endp
PluginIni proc hWnd:HWND,ptLogFunc:DWORD,hDlgParent:DWORD

push hWnd
pop hWmain
push ptLogFunc
pop lpLogFunc
push hDlgParent
pop hDlgPrnt

ret

PluginIni endp
Log proc lpMsg:DWORD

push lpMsg
push hWmain
call lpLogFunc
ret

Log endp
PlugWork proc
invoke DialogBoxParam,hInstance,5000,hDlgPrnt,addr MainDlg,0        -----> Here i have the error.
;invoke CreateDialogParam,hInstance,5000,hDlgPrnt,addr MainDlg,0
invoke Log,SADD("Test Log func")
ret

PlugWork endp
MainDlg proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

.if uMsg==WM_INITDIALOG

invoke MessageBox,hWnd,SADD("Hello"),SADD("Info"),MB_OK

.elseif uMsg==WM_COMMAND

.elseif uMsg==WM_CLOSE
invoke EndDialog,hWnd,0
            .else
             mov eax,FALSE
             ret
.endif
mov eax,TRUE
ret
MainDlg endp
End DllEntry


.def

LIBRARY   xunpDll1
EXPORTS   PluginName      @1
                PluginIni          @2
                PlugWork @3
    MainDlg @4


@EDIT : I have tested the same code in other IDE and works fine...



maybee some bad configuration in radasm?

tkx in advance.

5k3l3t0r

kennie

#1
Wrote something similar (opening a Dialog from a DLL), it failed, but I found my bug meanwhile.

It should work. Your code looks good for me.

But are you shure with ERROR_RESOURCE_NOT_FOUND  ?
According with my error-list this is Nr.5007 "The cluster resource could not be found."
? cluster ?