flat assembler
Message board for the users of flat assembler.

Index > Windows > Does this work on all versions of windows??


Did it work for you?
Yes
25%
 25%  [ 1 ]
No
75%
 75%  [ 3 ]
Total Votes : 4

Author
Thread Post new topic Reply to topic
asmdemon



Joined: 18 Jan 2004
Posts: 97
Location: Virginia Beach, VA
asmdemon
Hello All Very Happy

I was browsing the net and found a demo in Masm on how to run a program without using an import table. I took it to the next level, but for starters, i modified the template example. I was wondering if you would test it and tell me if it worked under your windows environment.

OS: and YES/NO

I'm testing if i can statically define locations(which is what i'm testing) or dynamically locate them in memory to do such a program(which is in the masm's example).

Thanx in advanced.


Description: Included is test.asm and test.exe(for those who don't have fasm1.51)
Download
Filename: test.zip
Filesize: 1.43 KB
Downloaded: 141 Time(s)


_________________
It is better to be on the right side of the devil than in his path.
Post 29 Mar 2004, 23:04
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
1) To work on all versions of win32, you must have KERNEL32.DLL loaded. Either by importing directly from it (May I suggest ExitProcess?), or by importing from something that imports from something that (...) imports from kernel32.

2) You cannot define proc addresses statically, they can change not only from OS to OS, but from service pack to service pack as well.

If you want to create your own GetProcAddress, there's a lot of things to consider: normal imports, import by ordinal, bound imports, forwarded exports, ... - not to mention that you should of course implement binary search since exports are sorted, et cetera.

[edit]
Win2k PE loader fails silently(!) on programs that don't import from kernel32.
Post 29 Mar 2004, 23:14
View user's profile Send private message Visit poster's website Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
asmdemon wrote:
Hello All Very Happy

...

I'm testing if i can statically define locations(which is what i'm testing) or dynamically locate them in memory to do such a program(which is in the masm's example).

....


No you cannot. I guess that masm example is a bad example. This is because the kernel32.dll size is not consistent across all the 9x/nt. It will increase in size as the dll grows in size, so the address might also vary according to the service packs. Also it is mapped to different address for different OS.

f0dder is right, you need to import at least a function in windows 2k, if not the exe will not run and no error will pop up. This issue does not happen in XP though, currently have no explanatiion for the weird behaviour
Post 30 Mar 2004, 13:51
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
asmdemon



Joined: 18 Jan 2004
Posts: 97
Location: Virginia Beach, VA
asmdemon
thanx all, the masm example does a search in memory to locate the functions; i just wanted to see if this static way was portable... the answer: NO

But, i will now port the other example and will return with that in a new thread. Very Happy
Post 30 Mar 2004, 17:31
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.