Click here to Skip to main content
15,908,842 members
Home / Discussions / System Admin
   

System Admin

 
QuestionCommands for filtering IPv6 traffic on winXP Pin
Ather Zaidi9-Apr-08 5:10
Ather Zaidi9-Apr-08 5:10 
Questionhow to configure windows media server to push stream from encoder Pin
vptech198-Apr-08 21:49
vptech198-Apr-08 21:49 
GeneralCommands for Run dialog box [modified] Pin
kraft8-Apr-08 15:45
kraft8-Apr-08 15:45 
Questionhow to run program in limited account? Pin
the pink jedi6-Apr-08 4:18
the pink jedi6-Apr-08 4:18 
AnswerRe: how to run program in limited account? Pin
Sebastian Schneider7-Apr-08 23:55
Sebastian Schneider7-Apr-08 23:55 
GeneralPE file format + relocations Pin
zildjohn015-Apr-08 11:29
zildjohn015-Apr-08 11:29 
GeneralRe: PE file format + relocations Pin
Jeffrey Walton6-Apr-08 17:41
Jeffrey Walton6-Apr-08 17:41 
GeneralRe: PE file format + relocations Pin
Mike Dimmick7-Apr-08 4:19
Mike Dimmick7-Apr-08 4:19 
Since the EXE is the first thing to load into the process, and therefore there are very few allocations (a few DLLs are pre-mapped, such as kernel32.dll), it very rarely needs relocating. You might do it if you wanted to load an EXE as a DLL in another process, but more commonly you just want the resources out of it, in which case you specify LOAD_LIBRARY_AS_DATAFILE.

Because relocation is so very rarely unnecessary, the linker provides an option, /FIXED, to control generation of relocation information. Since at least VC6, the default for EXEs has been to set /FIXED and not generate relocations, and for DLLs, to set /FIXED:NO (which does generate relocations).

It's not that you can't find them, it's that they aren't there.

The relocations information in each section is really for the use of the linker to link .obj files into an .exe or .dll. In a finished DLL, only the Base Relocations (.reloc section) are present.

.NET executables have a .reloc section containing one relocation, which is a pointer to the start of the Import Address Table. When the loader loads the DLL or EXE, it overwrites this entry with the address of the function imported - for an executable, _CorExeMain in mscoree.dll. The two bytes before the address that is updated are 0xFF 0x25, which are an indirect JMP instruction. The 'entry point' field in the IMAGE_OPTIONAL_HEADER structure points to the start of this instruction, so on loading the program, Windows calls this address which immediately transfers control to _CorExeMain. DLLs are similar but use _CorDllMain. In this way, a version of Windows which knows nothing about .NET can still load a .NET program as if it were any other kind of program with very little x86 code included. I'm guessing it's compiled at this odd location - after the Import Name Table - so it's on a page that will get discarded very quickly, as this instruction will run exactly once.

I believe newer versions of the OS understand .NET programs and just invoke mscoree.dll directly, not even bothering to map this page. The 64-bit versions would have to, if they're going to create a 64-bit process (particularly on Itanium where 0xFF 0x25 means something else entirely - actually you'd get an alignment fault straightaway as that processor requires instructions to be aligned on 128-bit boundaries). If you specify /platform:itanium or /platform:x64, the C# 2.0 compiler generates a PE32+ structure, no import tables, and puts 0 in the 'entry point' field, so the 64-bit OS must understand .NET binaries directly.


DoEvents: Generating unexpected recursion since 1991

GeneralRe: PE file format + relocations Pin
zildjohn0110-Apr-08 17:08
zildjohn0110-Apr-08 17:08 
GeneralError with ntdll.dll Pin
Brady Kelly4-Apr-08 0:14
Brady Kelly4-Apr-08 0:14 
GeneralRe: Error with ntdll.dll Pin
Mekong River11-Apr-08 0:29
Mekong River11-Apr-08 0:29 
GeneralSystem Restore XP - HP desktop problem Pin
john john mackey31-Mar-08 18:06
john john mackey31-Mar-08 18:06 
GeneralRe: System Restore XP - HP desktop problem Pin
Sebastian Schneider2-Apr-08 5:10
Sebastian Schneider2-Apr-08 5:10 
GeneralRe: System Restore XP - HP desktop problem Pin
Zoltan Balazs4-Apr-08 11:28
Zoltan Balazs4-Apr-08 11:28 
Questionhow can i protect my folder from others ? Pin
r_mohd31-Mar-08 0:10
r_mohd31-Mar-08 0:10 
GeneralRe: how can i protect my folder from others ? Pin
Dave Kreskowiak31-Mar-08 10:42
mveDave Kreskowiak31-Mar-08 10:42 
GeneralRe: how can i protect my folder from others ? Pin
r_mohd31-Mar-08 19:41
r_mohd31-Mar-08 19:41 
QuestionAssembly Wrappers Pin
Luis_the_Code30-Mar-08 15:57
Luis_the_Code30-Mar-08 15:57 
GeneralRe: Assembly Wrappers Pin
zildjohn014-Apr-08 15:27
zildjohn014-Apr-08 15:27 
GeneralExchange server Pin
Balaji.k29-Mar-08 0:12
Balaji.k29-Mar-08 0:12 
GeneralRe: Exchange server Pin
Jörgen Andersson29-Mar-08 12:38
professionalJörgen Andersson29-Mar-08 12:38 
QuestionHow to prevent user from changing wallpaper in XP Pin
Amer Rehman28-Mar-08 6:54
Amer Rehman28-Mar-08 6:54 
AnswerRe: How to prevent user from changing wallpaper in XP Pin
Scott Dorman28-Mar-08 16:28
professionalScott Dorman28-Mar-08 16:28 
AnswerRe: How to prevent user from changing wallpaper in XP Pin
Jörgen Andersson29-Mar-08 3:01
professionalJörgen Andersson29-Mar-08 3:01 
Questiondoes windows XP supports MIB-II(SNMP) by default ? Pin
vptech1927-Mar-08 21:01
vptech1927-Mar-08 21:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.