[DllImport("advapi32.dll", SetLastError=true)]
static extern bool InitializeSecurityDescriptor(IntPtr pSecurityDescriptor, uint dwRevision);
This didn't work for me ... Declare Function InitializeSecurityDescriptor Lib "advapi32.dll" (TODO) As TODO
This did:
<DllImport("advapi32.DLL", EntryPoint:="InitializeSecurityDescriptor", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function InitializeSecurityDescriptor(ByVal src As Long, ByVal dst As Long) As IntPtr
' Leave function empty
End Function
const uint SECURITY_DESCRIPTOR_REVISION = 1;
The dwRevision parameter must be SECURITY_DESCRIPTOR_REVISION.
Please add some!
C#
SECURITY_DESCRIPTOR sd = new SECURITY_DESCRIPTOR();
IntPtr ptr = Marshal.AllocCoTaskMem (Marshal.SizeOf (sd));
Marshal.StructureToPtr (sd, ptr, false);
InitializeSecurityDescriptor(ptr, 1);
Do you know one? Please contribute it!