The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Vermi on April 30, 2006, 03:51:13 PM

Title: No way to make the ".shared" section ?
Post by: Vermi on April 30, 2006, 03:51:13 PM
I'm coding a DLL, and I need a .shared section, but I can't make it directly.
I use the SEGMENT directive, and I wanted to do :
.shared SEGMENT
.shared ENDS

but MASM don't like the ".", so I can make :
shared SEGMENT
shared ENDS

But windows don't like, I have to rename the section with a PE editor....
As anyone the solution ? The section name MUST be ".shared". :/
I have try things like : ".shared" SEGMENT
but it don't work. If you have an idea...

@+
Vermi
Title: Re: No way to make the ".shared" section ?
Post by: Vermi on April 30, 2006, 04:15:50 PM
I have foud a solution. I have add a param to the link.exe :
/MERGE:shared=.shared

And it have renamed automatically my section name. It's not a very nice solution, but it work. If you have another one, tell me !

@+
Vermi
Title: Re: No way to make the ".shared" section ?
Post by: Biterider on April 30, 2006, 06:04:24 PM
Have you tried "option dotname" ?

Regards,

Biterider
Title: Re: No way to make the ".shared" section ?
Post by: Vermi on May 01, 2006, 01:19:01 PM
I have a bigger probleme, when I rename the section to .shared ( in stay of shared ), the function SetWindowsHookEx freeze. I have trace the API to see when it freeze, and I have founds it's on a INT 2E ( if I remember well ), it's when API switch to ring 0.
I don't understand why, but I can't have my .shared section because of that **** API ( lol ) ... :'(

@+
Vermi
Title: Re: No way to make the ".shared" section ?
Post by: Ossa on May 01, 2006, 01:37:21 PM
Well, it's been a while since I last fiddled with this stuff, but if I recall correctly, to make the segment shared (ie not just calling it that) you must change the segemnt permissions, so if you have:


option dotname

.shared SEGMENT
.shared ENDS


you must use the following in the linker commandline:

/SECTION:.shared,S

This changes the permission DWORD from the default of C0000040 to D0000040.

You should be able to do this without altering the commandline, but I forget the commands.

Hope that helps,
Ossa
Title: Re: No way to make the ".shared" section ?
Post by: Vermi on May 01, 2006, 08:14:50 PM
Thanj you, it's work fine :p
Thank you very much XD

@+
Vermi