The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: trodon on July 29, 2006, 11:46:51 AM

Title: Entry point
Post by: trodon on July 29, 2006, 11:46:51 AM
hi!
i have one question about entry point of fresh compiled programs in masm32
as all people know 99% compiled programs have entry point on offset 00401000....
is there any posibility to when i write my code and compile to be for example 00402000 or something like this?
thanks!

Title: Re: Entry point
Post by: Max_Power on July 29, 2006, 09:09:25 PM
To my knowledge there really isn't a way to tell the linker, "I want the entry point to be right... there!" You might play with the entry switch though and if you just don't want the entry point to be at 401000 you could always change the image base.
Title: Re: Entry point
Post by: bonobo on July 29, 2006, 10:00:00 PM
You can add some code (procedures) before the start: label.

I can't see any point in changing the entry point though.
Title: Re: Entry point
Post by: trodon on July 29, 2006, 11:18:15 PM
Quoteif you just don't want the entry point to be at 401000 you could always change the image base.

yeah but when i change image base my aplication then crash :(

Title: Re: Entry point
Post by: zooba on July 30, 2006, 03:47:50 AM
Why would you want to do this? Changing the entry point won't affect anything in code you've compiled yourself.

Bonobo is right though, putting code before your entry label will move it away from the default 401000.

Cheers,

Zooba :U
Title: Re: Entry point
Post by: trodon on July 30, 2006, 04:01:44 AM
QuoteWhy would you want to do this? Changing the entry point won't affect anything in code you've compiled yourself.

yes i know that will not affect but i am just interesting is there posibility to do this :)

QuoteBonobo is right though, putting code before your entry label will move it away from the default 401000.

Yes its work i am also try this, but i am thinking myself is there any other way to do this job
Title: Re: Entry point
Post by: zooba on July 30, 2006, 04:38:23 AM
AFAIK, re-basing is the best way to move it far away. Moving it a few bytes is probably best done with 'NOP's or 'DB 0'
Title: Re: Entry point
Post by: drizz on July 30, 2006, 05:50:08 AM

org 0C0DEh-1000h
start:

.../BASE:0xBAD0000...


everything works ok. :)
Title: Re: Entry point
Post by: trodon on July 30, 2006, 06:36:22 AM
thank you drizz you are the man  :U