Why is it that whenever I start writing [Managed]C++ code that I:
- Feel the urge to write wrapper classes
- Worry much more about failure conditions / scenarios
- Think obsessively about const-correctness
Well, writing wrapper classes is pretty much all that I use MC++ for these days. There’s a bunch of unmanaged Win32 API’s that I need to call from managed code and MC++ is the perfect tool for the job (only a masochist would try and manipulate SIDs from C#/VB.NET).
Yes, I know that Whidbey provides wrappers for SIDs and their friends in System.Security.AccessControl, but I need to deploy systems today on V1.1.
5 archived reader comments
Sam Gentile (2003-11-11)
See above. You’ll like it-)
AsbjornM (2003-11-11)
Maybe it is of no use, but it looks like there are lots of such wrappers in this project: http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=2cb20e79-d706-4706-9ea0-26188257ee7d (SDC Build tool from ms) under this folder you will find wrappers for sid, ace, acl etc.: MainSolution\Microsoft.Sdc.Configuration\Win32Security
Slavomir Furman (2003-11-12)
Hello!
here are few links to materials (about programming win32 security in managed code) that you may find handy:
First two managed libs for manipulating with win32 security:
GotDotNet User Sample: ACLs in .NET (http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=e6098575-dda0-48b8-9abf-e0705af065d9)
NT Security Classes for .NET (managed C++) (http://www.codeproject.com/dotnet/NTSecurityNET.asp)
here is another example how to do this with managed C++ in WinDev Journal
Win32 Security in Managed C++ (http://www.windevnet.com/documents/win0309b/)
And also Keith Brown work on his new book and new lib on this topic
“a .net developer’s guide to Windows security” (http://www.develop.com/kbrown/book/) (http://www.develop.com/technology/resourcedetail.aspx?id=ee929f0b-1f9d-4a2a-92a1-911706bd7b52)
hth, Slavo.
John Lam (2003-11-12)
Thanks for posting these links, Slavo! The Code Project sample by David Hall is really nice. I took a quick peek at the code today, and it looks really solid. It might even persuade me to abandon writing my MC++ wrappers for this stuff … but wait I’m a C++ programmer, right? Don’t we all have to invent our own String er .. I mean SecurityIdentity wrapper classes? :)
Dilip (2003-11-13)
John How much C++ do you work on nowadays? The recent change of direction the MC++ team has took in reinventing a wholly different way of accessing the CLR/CLI stuff without the use of strange keywords like __gc, __box etc. might probably change your mind, wouldn’t it? :-) If you hook on to Andy Rich’s blog (http://blogs.gotdotnet.com/arich) you’d see a lot of those improvements.