protected override bool ReleaseHandle()
 {
     if (m_pBlob != null)
     {
         NativeMemoryMethods.LocalFree(Blob.pbData);
         m_pBlob.Close();
     }
     return(true);
 }
Exemplo n.º 2
0
 protected override bool ReleaseHandle()
 {
     if (m_pbData != null)
     {
         m_pbData.Close();
     }
     if (m_blob != null)
     {
         m_blob.Close();
     }
     return(true);
 }
Exemplo n.º 3
0
        internal static bool AllocateAndInitializeSid(byte nSubAuthorityCount, uint nSubAuthority0, uint nSubAuthority1, uint nSubAuthority2, uint nSubAuthority3, uint nSubAuthority4, uint nSubAuthority5, uint nSubAuthority6, uint nSubAuthority7, out SafeSidPtr pSid)
        {
            SafeLocalFree safeLocalFree = null;

            try
            {
                SID_IDENTIFIER_AUTHORITY structure = default(SID_IDENTIFIER_AUTHORITY);
                structure.m_Value0 = SECURITY_NT_AUTHORITY[0];
                structure.m_Value1 = SECURITY_NT_AUTHORITY[1];
                structure.m_Value2 = SECURITY_NT_AUTHORITY[2];
                structure.m_Value3 = SECURITY_NT_AUTHORITY[3];
                structure.m_Value4 = SECURITY_NT_AUTHORITY[4];
                structure.m_Value5 = SECURITY_NT_AUTHORITY[5];
                safeLocalFree      = SafeLocalFree.LocalAlloc(Marshal.SizeOf(structure));
                Marshal.StructureToPtr(structure, safeLocalFree.DangerousGetHandle(), fDeleteOld: true);
                return(NativeMemoryMethods.AllocateAndInitializeSid(safeLocalFree, nSubAuthorityCount, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, out pSid));
            }
            finally
            {
                safeLocalFree?.Close();
            }
        }