OBJECT_ATTRIBUTES (Structures)
Last changed: -113.200.84.43

.
Summary
The OBJECT_ATTRIBUTES structure specifies attributes that can be applied to objects or object handles by routines that create objects and/or return handles to objects.

C# Definition:

[StructLayout(LayoutKind.Sequential)]
public struct OBJECT_ATTRIBUTES : IDisposable
{
   public int Length;
   public IntPtr RootDirectory;
   private IntPtr objectName;
   public uint Attributes;
   public IntPtr SecurityDescriptor;
   public IntPtr SecurityQualityOfService;

   public OBJECT_ATTRIBUTES(string name, uint attrs)
   {
     Length = 0;
     RootDirectory = IntPtr.Zero;
     objectName = IntPtr.Zero;
     Attributes = attrs;
     SecurityDescriptor = IntPtr.Zero;
     SecurityQualityOfService = IntPtr.Zero;

     Length = Marshal.SizeOf(this);
     ObjectName = new UNICODE_STRING(name);
   }

   public UNICODE_STRING ObjectName
   {
     get
     {
       return (UNICODE_STRING)Marshal.PtrToStructure(
     objectName, typeof(UNICODE_STRING));
     }

     set
     {
       bool fDeleteOld = objectName != IntPtr.Zero;
       if (!fDeleteOld)
     objectName = Marshal.AllocHGlobal(Marshal.SizeOf(value));
       Marshal.StructureToPtr(value, objectName, fDeleteOld);
     }
   }

   public void Dispose()
   {
     if (objectName != IntPtr.Zero)
     {
       Marshal.DestroyStructure(objectName, typeof(UNICODE_STRING));
       Marshal.FreeHGlobal(objectName);
       objectName = IntPtr.Zero;
     }
   }
}

User-Defined Field Types:

UNICODE_STRING

Notes:

None.

Documentation