Why do you keep ignoring everything? Keep it managed!
There is a very simple function somewhere in the framework that does what you want!
No need for messy conversion and interop between native.
After just a minute at msdn, I find this:
http://msdn2.microsoft.com/en-us/library/wz42302f.aspx
It's the same function in managed that you're trying to use native.