flat assembler
Message board for the users of flat assembler.

Index > Windows > run dll example error: The handle is invalid

Author
Thread Post new topic Reply to topic
nazha



Joined: 05 Mar 2009
Posts: 40
Location: Beijing, China
nazha 03 Apr 2009, 06:13
I have compiled the dll example successfully, but when I run lasterr.exe, got error "The handle is invalid", why?
command I used to compile:
fasm ERRORMSG.ASM
fasm LASTERR.ASM

_________________
Assembly Asker
Post 03 Apr 2009, 06:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 03 Apr 2009, 06:31
I think that depends upon your system. Things like which apps you have installed that hook into the startup DLLs. Maybe you have an app the uses the standard DLL injection to catch hotkeys?

I get this:
lasterr.exe wrote:
The operation completed successfully.
And I have no external DLLs being injected.
Post 03 Apr 2009, 06:31
View user's profile Send private message Visit poster's website Reply with quote
nazha



Joined: 05 Mar 2009
Posts: 40
Location: Beijing, China
nazha 03 Apr 2009, 07:05
But why the masm32 dll example is ok? does it means the fasm compiled dll is easier be injected?
I have try re-downloaded the latest fasm package from this website to other machine and even run the dll example in safe model, got same error, regardless of re-compiled or not, the machine is cleaning.
Post 03 Apr 2009, 07:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 03 Apr 2009, 07:14
Can you give the url for the masm source please.
Post 03 Apr 2009, 07:14
View user's profile Send private message Visit poster's website Reply with quote
nazha



Joined: 05 Mar 2009
Posts: 40
Location: Beijing, China
nazha 03 Apr 2009, 07:29
http://www.masm32.com/masmdl.htm

D:\masm32\examples\exampl01\dll\calldll
Post 03 Apr 2009, 07:29
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 03 Apr 2009, 07:40
Erm, I don't feel like downloading the whole package for a few KB of source. Perhaps you can post the relevant files here instead. Then we can compare an see what the masm source is doing differently.
Post 03 Apr 2009, 07:40
View user's profile Send private message Visit poster's website Reply with quote
nazha



Joined: 05 Mar 2009
Posts: 40
Location: Beijing, China
nazha 03 Apr 2009, 07:45
the source code is not same with fams's


Description:
Download
Filename: dll.zip
Filesize: 17.27 KB
Downloaded: 143 Time(s)


_________________
Assembly Asker
Post 03 Apr 2009, 07:45
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 03 Apr 2009, 07:52
Well the difference is that the masm code calls a number of functions that all change the lastError flag. So you will see the result of just the last call only. Whereas the fasm code calls no functions that affect the lastError flag and simply gets whatever error the Win32 loader last encountered.

Most notably is the very first call in the masm code is "invoke GetModuleHandle, NULL" which sets the lastError flag and overwrites any previous flag.
Post 03 Apr 2009, 07:52
View user's profile Send private message Visit poster's website Reply with quote
nazha



Joined: 05 Mar 2009
Posts: 40
Location: Beijing, China
nazha 03 Apr 2009, 08:06
Oh, sorry, is my misunderstanding.
Post 03 Apr 2009, 08:06
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.