Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / June 2006

Tip: Looking for answers? Try searching our database.

Distinguish between managed module and unmanaged module.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
trialproduct2004@yahoo.com - 28 Jun 2006 12:27 GMT
Hi all,

Can someone tell me how OS makde differentation betwen managed module
and unmanaged module.

Means say suppose i developed one exe in MFC and one in .net. How Os
recognise that second exe require .net framework. Means which part of
exe is consider while determining whether exe need .net framework or
not.

Please correct me if i am wrong.

thanks in advance.
Ben Voigt - 28 Jun 2006 13:53 GMT
> Hi all,
>
[quoted text clipped - 5 lines]
> exe is consider while determining whether exe need .net framework or
> not.

.NET PE applications have a static dependency on mscoree.dll (and no other
DLLs).  Since a pure/safe/verifiable module can have no native entry point,
we can conclude that the .NET PE has no native entry point (no runtime
initialization, no WinMain).  However, the OS loader must load all
dependencies before launching the application.  Presumably the mscoree.dll
DllMain routine modifies the process descriptor in some way to cause the
process to start running in mscoree.  If an empty entry point is allowed for
the exe, it might be as simple as spawning a new thread in mscoree, but
considering most functions are forbidden in DllMain (loader lock and all),
mscoree DllMain must not be the main routine.  kernel32.dll, which contains
the CreateThread function, is the only static dependency of mscoree.

> Please correct me if i am wrong.
>
> thanks in advance.
trialproduct2004@yahoo.com - 28 Jun 2006 15:04 GMT
Hi,

thanks for your reply.

CAn you elaborate things slightly so that i can get exact idea about
it.

I only know that in idata section of exe it contain import statemnet
for importing dll mscoree.dll. It is means that in normal dll build in
vb6 or mfc this dll is not getting used.

Can u tell me steps getting followed by loaded while loading .net exe
and normal exe like exe developed in mfc or vb6.

Or  please tell me difference between these file format by which os get
idea that this exe require .net framework and other one not.

Is it like in idata second there is coreexemain function which is
imported from mscoree.dll so when loader try to load exe it will check
try to call this function for .net exe and what if exe is developed in
unmanaged code then which function loader try to call is it winmain?

Please correct me if i am wrong.

Thanks in advance.
> > Hi all,
> >
[quoted text clipped - 21 lines]
> >
> > thanks in advance.
Ben Voigt - 28 Jun 2006 15:49 GMT
> Hi,
>
[quoted text clipped - 17 lines]
> try to call this function for .net exe and what if exe is developed in
> unmanaged code then which function loader try to call is it winmain?

The OS loader does not check for managed .exe.  It does not do anything
special.  For all applications, the loader first loads all static
dependencies, running each DllMain function, then checks the PE header for a
native entry point, which it runs if it finds one.

With a managed application, when mscoree's DllMain executes, it starts up
CLR hosting (probably on a new thread which runs outside loader lock) which
get the handle to the running process, reads the metadata tables, finds the
managed entry point type, JIT compiles and executes static constructors and
then the managed main method.  The managed .exe is missing any native entry
point... if it had one, it would not be pure MSIL.

> Please correct me if i am wrong.
>
[quoted text clipped - 30 lines]
>> >
>> > thanks in advance.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.