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 / July 2007

Tip: Looking for answers? Try searching our database.

Windows API in SAFE code.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ziangi Jones - 19 Jul 2007 19:30 GMT
Hi All,

I guess Windows API calls are unmanaged. Then how does CLR manage when a
such a call is made in a safe code block?
Plz. throw some light on this topic...(may be a good link)
Signature

Greats!

Ben Voigt [C++ MVP] - 22 Jul 2007 23:11 GMT
> Hi All,
>
> I guess Windows API calls are unmanaged. Then how does CLR manage when a
> such a call is made in a safe code block?
> Plz. throw some light on this topic...(may be a good link)

The permissions for each assembly are granted based on its load location
(the directory where the .dll file is).  Assemblies in the global assembly
cache run with FullTrust, so they can call unmanaged code.  If the trusted
assembly is marked with AllowPartiallyTrustedCallersAttribute then untrusted
code can call the unmanaged code in whatever way the trusted assembly
allows.

None of this has anything to do with "safe" or "unsafe" though.  "unsafe"
only applies to pointer arithmetic, where you could overrun the bounds of an
array or cast to a different pointer type.  I believe it's actually an error
in the .NET specification that unsafe blocks are required for other pointer
operations, but clearly someone at Microsoft really doesn't like pointers.

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.