473,379 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

NativeMethods versus SafeNativeMethods versus UnsafeNativeMethods? (reflector)

I've been using reflector to look into some of the core MS .NET
assemblies. I have noticed this pattern in the naming of classes that
wrap p-Invoked Win32 api functions.

I like this pattern.

I'm just curious why are some API functions considered "Safe" and
others "Unsafe"?

Shouldn't any call into unmanaged code be considered "unsafe"?

-Thx

May 23 '07 #1
1 8926
This is the pattern that they use, and information about what is
considered safe, unsafe, and native:

http://msdn2.microsoft.com/en-us/lib...4w(vs.80).aspx

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ki*******@gmail.comwrote in message
news:11*********************@h2g2000hsg.googlegrou ps.com...
I've been using reflector to look into some of the core MS .NET
assemblies. I have noticed this pattern in the naming of classes that
wrap p-Invoked Win32 api functions.

I like this pattern.

I'm just curious why are some API functions considered "Safe" and
others "Unsafe"?

Shouldn't any call into unmanaged code be considered "unsafe"?

-Thx

May 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Greg Bacchus | last post by:
Hi, I'm getting an exception that really has me stumped. It's sporadic at best, it's only happened a handful of times. This particular time it happened when the user pressed 'Alt-S' to save the...
1
by: Colin | last post by:
Hi there, I have wrote a simple console app in C# to get the dimensions for a jpeg file /*** Image img = Image.FromFile(@"C:\TEMP\PvFile\1036437.jpg", true); LogEvent("Height = " +...
3
by: Dan Bass | last post by:
while working in a probject, you realise that some string handling stuff you're implementing has occurred before in the same project. So being a good developer, you factorise the commonalities out...
0
by: Wal Turner | last post by:
Hi. The following error I seemingly get at random times when my application is loading. ************** Exception Text ************** System.NullReferenceException: Object reference not set to an...
1
by: john doe | last post by:
The UnsafeNativeMethods seems to be the answer to most .NET developer's prayers in terms of defining interfaces and functions from the Windows API, without us having to constantly having to...
2
by: Bill Green | last post by:
We have an aspnet application that all of a sudden starts building up memory, I attached a debugger and other then the normal there was a ton of the following. I am trying to narrow down where...
1
by: Russ | last post by:
I've been trying to get my head around this for 3 days now and it seems like everything I try does not work for one reason or another. I built a test page using the TabStrip and MultiPage controls....
1
by: Paul H | last post by:
I have never used the MSDE as a backend for a database but I am considering dipping my foot in the SQL waters and trying out SQL Server Express. I remember that the MSDE had certain limitations...
4
by: aj | last post by:
DB2 8.2 LUW FP14 Is there any real difference between select blahblahblah... where blah IN (select blah......) versus select blahblahblah... where blah = ANY (select blah.....) versus select...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.