The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RedXVII on July 03, 2006, 12:19:21 AM

Title: DLL Query
Post by: RedXVII on July 03, 2006, 12:19:21 AM
Im experimenting with dll's as they are a new topic for me. Let me get this straight - after reading iczelions, i understand that a DLL's .code is reused throught different processes, but the .data section is saved individually for each process. So, as a side thaught, i tried to modify part of the code section (which would normall be "ok" in normal .exe's) - and naturally, windows crashed it for me. Does windows protect the dll's .code section from modifications in some way? Doesnt that mean i cant have self modifing code in dll's or is there a way round it?

Thanks :U
RedXVII
Title: Re: DLL Query
Post by: dougiem on July 03, 2006, 11:05:29 PM
as it happens I was looking for standard techniques, and I came across this, which helped,

http://doc.ddart.net/asm/Microsoft_MASM_Programmers_Guide_v6.1/Chap_10.htm

hope its of some use

dougiem
Title: Re: DLL Query
Post by: RedXVII on July 04, 2006, 12:24:01 AM
Nice one, thx  :U
Title: Re: DLL Query
Post by: hutch-- on July 04, 2006, 03:52:31 AM
Red,

Have a play with making the secftions read/write/execute and it should solve most of your problems. They are linker options.
Title: Re: DLL Query
Post by: sluggy on July 04, 2006, 12:38:16 PM
Quote from: RedXVII on July 03, 2006, 12:19:21 AMi tried to modify part of the code section (which would normall be "ok" in normal .exe's) - and naturally, windows crashed it for me. Does windows protect the dll's .code section from modifications in some way?
It depends what OS you are running. Apart from making code pages writable, in WinXP SP2 it is advisable to turn off DEP (data execution protection, and surprisingly some big name apps require you to disable DEP), and in Vista the whole security scene changes dramatically.