Geeks With Blogs
ex-blog Information security world

Shawn Farkas mentioned usefull addition to P/Invoke in Whidbey - SafeHandle class, which can be used to wrap around handles to unmanaged resources:

SafeHandle is an abstract class, which you derive from to create a wrapper around specific types of handles. (Or other unmanaged resources that require some sort of cleanup).  The CLR will then work with P/Invoke to marshal your safe handle back and forth to managed code.  More in in Chris Brumme's Finalization blog entry.

So CertDuplicateStore declaration would be for example:

[DllImport("Crypt32.dll", CallingConvention = CallingConvention.StdCall)]
private static extern CertificateStoreHandle CertDuplicateStore(CertificateStoreHandle hCertStore);

instead of IntPtrs. More information in Shawn's post.

Posted on Friday, August 13, 2004 11:02 AM Development | Back to top

Copyright © John Doe | Powered by: GeeksWithBlogs.net