News:

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

Dll in Iczelion tute17 and tute24

Started by Farbis, October 21, 2008, 04:43:48 PM

Previous topic - Next topic

Farbis

Hello, i just start studying iczelion tutes (m32v9) about Dll and problems stop me in my learning.
I've been looking for answers using forum search, but didn' found anything.So could you help me please?

Tute17:
When i run skeleton.exe, i get the messagebox "A thread is distroyed in this process".
Tute24:
When i run makeit.bat , i get the following message in console
mhook.dll: warning LNK4086 :entrypoint "_start" is not __stdcall with 12 bytes of arguments: image may not run

I've read MASM32 Dll Tute (How to build a dll in Masm32), but this didn't help me.
It's new for me and some "blur". :(

Thanks for advices

Xacker

tut17:

don't use skeleton.exe, it's a bad example, actually it shows a skeleton architecture of the DLL I don't know what's the point of it anyway, run the file usedll.exe under icztutes\tute17\1 and it will show you how a DLL can be imported by an executable.

tut24:
not sure, have you tried to adjust the path to masm32 in the file makeit.bat ?

MichaelW

Farbis,

For tute24 there is a mistake in makeit.bat. It is supposed to build mhook.exe from mhook.asm in that same directory, but it is coded to build a DLL instead. I think the expectation was that the EXE should be built as per readme.txt in the icztutes directory:
Quote
Iczelion's classic tutorials build in the MASM32 environment directly from the editor using "Assembler & Link".

Here is a corrected version:

@echo off

if not exist rsrc.rc goto over1
\masm32\bin\rc /v rsrc.rc
\masm32\bin\cvtres /machine:ix86 rsrc.res
:over1

if exist "mhook.obj" del "mhook.obj"

\masm32\bin\ml /c /coff "mhook.asm"
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /SUBSYSTEM:WINDOWS "mhook.obj" rsrc.res
if errorlevel 1 goto errlink

dir "mhook.*"
goto TheEnd

:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS "mhook.obj"
if errorlevel 1 goto errlink
dir "mhook.*"
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause


BTW, the hook DLL is built from mhook.asm source in the hookdll directory, using build.bat in that directory. Note that the system will be unable to find the DLL if it is left in the directory where it was built. Before you try to run the EXE, you need to delete the mhook.dll that the original makeit.bat created. Then try running the EXE to see what happens, then copy the DLL that build.bat created to the same directory as the EXE, and try running the EXE again.
eschew obfuscation

Farbis

Yes Xacker, i have noticed that examples in folder tute17/1 and tute17/2 run good.
So i've understood how it works.
For tute24, i have change path to masm32 but it doesn' work.
It doesn't matter, i keep on looking for a solution  :bg

Thanks for your help Xacker  :U

Farbis

Now it works !
Than you MichaelW, you save me.
Now i can test it and go on  :dance:

I can sleep at last!
Regards