I would like to call LsaOpenPolicy
, which takes a LSA_OBJECT_ATTRIBUTES
struct. I am using the struct definition from pinvoke.net. This struct has the field public LSA_UNICODE_STRING ObjectName;
.
The LSA_OBJECT_ATTRIBUTES
MSDN article says:
When you call
LsaOpenPolicy
, initialize the members of this structure to NULL or zero because the function does not use the information.
And specifically:
ObjectName
Should be NULL.
While I can assign the other fields of the LSA_OBJECT_ATTRIBUTES
struct to IntPtr.Zero
(or just plain 0
for the value types), I cannot see a way to do so for ObjectName
. Specifically,
Cannot implicitly convert type 'System.IntPtr' to 'LSA_UNICODE_STRING'
What should I do in this case? Should I just initialise a LSA_UNICODE_STRING
of length zero (length 0, maximumlength 0, empty/null buffer)? Should I change the LSA_OBJECT_ATTRIBUTES
definition so that field is an IntPtr
? Should I make it nullable and assign null
to that field?
I have very little experience with memory management, so I am rather wary of anything that could cause memory leaks.