Example #1
0
 public static extern NtStatus NtOpenDirectoryObject(out SafeKernelObjectHandle Handle, DirectoryAccessRights DesiredAccess, [In] ObjectAttributes ObjectAttributes);
 /// <summary>
 /// Create a directory object with a shadow
 /// </summary>
 /// <param name="obj_attributes">The object attributes to create the directory with</param>
 /// <param name="desired_access">The desired access to the directory</param>
 /// <param name="shadow_dir">The shadow directory</param>
 /// <returns>The directory object</returns>
 /// <exception cref="NtException">Thrown on error</exception>
 public static NtDirectory Create(ObjectAttributes obj_attributes, DirectoryAccessRights desired_access, NtDirectory shadow_dir)
 {
     return(Create(obj_attributes, desired_access, shadow_dir, DirectoryCreateFlags.None, true).Result);
 }
 /// <summary>
 /// Open a directory object
 /// </summary>
 /// <param name="obj_attributes">The object attributes to use for the open call.</param>
 /// <param name="desired_access">Access rights for directory object</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 /// <exception cref="NtException">Thrown on error and throw_on_error is true.</exception>
 public static NtResult <NtDirectory> Open(ObjectAttributes obj_attributes, DirectoryAccessRights desired_access, bool throw_on_error)
 {
     return(NtSystemCalls.NtOpenDirectoryObject(out SafeKernelObjectHandle handle,
                                                desired_access, obj_attributes).CreateResult(throw_on_error, () => new NtDirectory(handle)));
 }
Example #4
0
 public static extern SafeKernelObjectHandle NtUserOpenWindowStation(
     ObjectAttributes ObjectAttributes,
     WindowStationAccessRights DesiredAccess);
Example #5
0
 public static extern NtStatus NtOpenTransaction(out SafeKernelObjectHandle TransactionHandle, TransactionAccessRights DesiredAccess,
                                                 ObjectAttributes ObjectAttributes, ref Guid Uow, SafeKernelObjectHandle TmHandle);
Example #6
0
 public static extern NtStatus NtOpenSymbolicLinkObject(
     out SafeKernelObjectHandle LinkHandle,
     SymbolicLinkAccessRights DesiredAccess,
     ObjectAttributes ObjectAttributes
     );
 public virtual NtResult <NtObject> Open(ObjectAttributes obj_attributes, AccessMask desired_access, bool throw_on_error)
 {
     return(NtStatus.STATUS_NOT_IMPLEMENTED.CreateResultFromError <NtObject>(throw_on_error));
 }
Example #8
0
 /// <summary>
 /// Open a transaction object.
 /// </summary>
 /// <param name="object_attributes">The object attributes for the object</param>
 /// <param name="desired_access">The desired access for the object</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">UOW Guid.</param>
 /// <returns>The object result.</returns>
 public static NtTransaction Open(ObjectAttributes object_attributes, TransactionAccessRights desired_access,
                                  Guid uow, NtTransactionManager transaction_manager)
 {
     return(Open(object_attributes, desired_access, uow, transaction_manager, true).Result);
 }
 public static extern NtStatus NtCreateSection(out SafeKernelObjectHandle SectionHandle,
                                               SectionAccessRights DesiredAccess,
                                               [In] ObjectAttributes ObjectAttributes, [In] LargeInteger SectionSize,
                                               MemoryAllocationProtect Protect, SectionAttributes Attributes,
                                               SafeHandle FileHandle);
Example #10
0
 /// <summary>
 /// Create a transaction
 /// </summary>
 /// <param name="path">The path of the transaction</param>
 /// <param name="root">The root if path is relative</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The opened transaction</returns>
 public static NtResult <NtTransaction> Create(string path, NtObject root, TransactionAccessRights desired_access, bool throw_on_error)
 {
     using (ObjectAttributes obja = new ObjectAttributes(path, AttributeFlags.CaseInsensitive, root)) {
         return(Create(obja, desired_access, throw_on_error));
     }
 }
Example #11
0
 /// <summary>
 /// Open a transaction object.
 /// </summary>
 /// <param name="object_attributes">The object attributes for the object</param>
 /// <param name="desired_access">The desired access for the object</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">UOW Guid.</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtResult <NtTransaction> Open(ObjectAttributes object_attributes, TransactionAccessRights desired_access,
                                             Guid uow, NtTransactionManager transaction_manager, bool throw_on_error)
 {
     return(NtSystemCalls.NtOpenTransaction(out SafeKernelObjectHandle handle, desired_access, object_attributes,
                                            ref uow, transaction_manager.GetHandle()).CreateResult(throw_on_error, () => new NtTransaction(handle)));
 }
Example #12
0
 /// <summary>
 /// Create a transaction
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <returns>The opened transaction</returns>
 public static NtTransaction Create(ObjectAttributes object_attributes, TransactionAccessRights desired_access)
 {
     return(Create(object_attributes, desired_access, true).Result);
 }
Example #13
0
 /// <summary>
 /// Create a transaction
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtResult <NtTransaction> Create(ObjectAttributes object_attributes, TransactionAccessRights desired_access, bool throw_on_error)
 {
     return(Create(object_attributes, desired_access, null, null, TransactionCreateFlags.None, 0, 0, null, null, throw_on_error));
 }
Example #14
0
 public static extern NtStatus NtOpenPrivateNamespace(
     out SafeKernelObjectHandle NamespaceHandle,
     DirectoryAccessRights DesiredAccess,
     [In] ObjectAttributes ObjectAttributes,
     IntPtr BoundaryDescriptor);
Example #15
0
 public static extern NtStatus NtOpenThread(out SafeKernelObjectHandle ThreadHandle,
                                            ThreadAccessRights DesiredAccess, ObjectAttributes ObjectAttributes, ClientId ClientId);
 public static extern NtStatus NtCreateSectionEx(out SafeKernelObjectHandle SectionHandle,
                                                 SectionAccessRights DesiredAccess,
                                                 [In] ObjectAttributes ObjectAttributes, [In] LargeInteger SectionSize,
                                                 MemoryAllocationProtect Protect, SectionAttributes Attributes,
                                                 SafeHandle FileHandle,
                                                 MemSectionExtendedParameter[] ExtendedParameters, int ExtendedParameterCount);
Example #17
0
 public static extern NtStatus NtCreateSymbolicLinkObject(
     out SafeKernelObjectHandle LinkHandle,
     SymbolicLinkAccessRights DesiredAccess,
     ObjectAttributes ObjectAttributes,
     UnicodeString DestinationName
     );
 public static extern NtStatus NtOpenSection(out SafeKernelObjectHandle SectionHandle,
                                             SectionAccessRights DesiredAccess,
                                             [In] ObjectAttributes ObjectAttributes);
 public static extern NtStatus NtCreateTimer(
     out SafeKernelObjectHandle TimerHandle,
     TimerAccessRights DesiredAccess,
     ObjectAttributes ObjectAttributes,
     TimerType TimerType
     );
 /// <summary>
 /// Create a section object
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">The desired access</param>
 /// <param name="size">Optional size of the section</param>
 /// <param name="protection">The section protection</param>
 /// <param name="attributes">The section attributes. The lower 5 bits can be used to specify the NUMA node.</param>
 /// <param name="file">Optional backing file</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtResult <NtSection> Create(ObjectAttributes object_attributes, SectionAccessRights desired_access, LargeInteger size,
                                           MemoryAllocationProtect protection, SectionAttributes attributes, NtFile file, bool throw_on_error)
 {
     return(NtSystemCalls.NtCreateSection(out SafeKernelObjectHandle section_handle, desired_access, object_attributes,
                                          size, protection, attributes, file.GetHandle()).CreateResult(throw_on_error, () => new NtSection(section_handle)));
 }
Example #21
0
 public static extern NtStatus NtCreateDebugObject(out SafeKernelObjectHandle DebugHandle, DebugAccessRights DesiredAccess, [In] ObjectAttributes ObjectAttributes, int Flags);
 /// <summary>
 /// Create a section object
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">The desired access</param>
 /// <param name="size">Optional size of the section</param>
 /// <param name="protection">The section protection</param>
 /// <param name="attributes">The section attributes</param>
 /// <param name="file">Optional backing file</param>
 /// <returns>The opened section</returns>
 /// <exception cref="NtException">Thrown on error.</exception>
 public static NtSection Create(ObjectAttributes object_attributes, SectionAccessRights desired_access, LargeInteger size,
                                MemoryAllocationProtect protection, SectionAttributes attributes, NtFile file)
 {
     return(Create(object_attributes, desired_access, size, protection, attributes, file, true).Result);
 }
Example #23
0
 public static extern NtStatus NtCreateTransaction(out SafeKernelObjectHandle TransactionHandle,
                                                   TransactionAccessRights DesiredAccess, ObjectAttributes ObjectAttributes,
                                                   OptionalGuid Uow, SafeKernelObjectHandle TmHandle,
                                                   TransactionCreateFlags CreateOptions,
                                                   int IsolationLevel,
                                                   TransactionIsolationFlags IsolationFlags,
                                                   LargeInteger Timeout,
                                                   UnicodeString Description);
 /// <summary>
 /// Create a section object
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">The desired access</param>
 /// <param name="size">Optional size of the section</param>
 /// <param name="protection">The section protection</param>
 /// <param name="attributes">The section attributes</param>
 /// <param name="file">Optional backing file</param>
 /// <param name="extended_parameters">Extended parameters for section create.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtSection CreateEx(ObjectAttributes object_attributes, SectionAccessRights desired_access, LargeInteger size,
                                  MemoryAllocationProtect protection, SectionAttributes attributes, NtFile file, MemSectionExtendedParameter[] extended_parameters)
 {
     return(CreateEx(object_attributes, desired_access, size, protection, attributes, file, extended_parameters, true).Result);
 }
 /// <summary>
 /// Create a directory object with a shadow
 /// </summary>
 /// <param name="obj_attributes">The object attributes to create the directory with</param>
 /// <param name="desired_access">The desired access to the directory</param>
 /// <param name="shadow_dir">The shadow directory</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 /// <exception cref="NtException">Thrown on error and throw_on_error is true.</exception>
 public static NtResult <NtDirectory> Create(ObjectAttributes obj_attributes, DirectoryAccessRights desired_access,
                                             NtDirectory shadow_dir, bool throw_on_error)
 {
     return(Create(obj_attributes, desired_access, shadow_dir, DirectoryCreateFlags.None, throw_on_error));
 }
 /// <summary>
 /// Open a section object
 /// </summary>
 /// <param name="object_attributes">The object attributes for the section</param>
 /// <param name="desired_access">The desired access for the sections</param>
 /// <returns>The opened section</returns>
 public static NtSection Open(ObjectAttributes object_attributes, SectionAccessRights desired_access)
 {
     return(Open(object_attributes, desired_access, true).Result);
 }
 protected override sealed NtResult <NtDirectory> OpenInternal(ObjectAttributes obj_attributes,
                                                               DirectoryAccessRights desired_access, bool throw_on_error)
 {
     return(NtDirectory.Open(obj_attributes, desired_access, throw_on_error));
 }
 internal static NtResult <NtObject> FromName(ObjectAttributes object_attributes, AccessMask desired_access, bool throw_on_error)
 {
     return(Open(object_attributes, desired_access.ToSpecificAccess <SectionAccessRights>(), throw_on_error).Cast <NtObject>());
 }
 /// <summary>
 /// Open a directory object
 /// </summary>
 /// <param name="obj_attributes">The object attributes to use for the open call.</param>
 /// <param name="desired_access">Access rights for directory object</param>
 /// <returns>The directory object</returns>
 /// <exception cref="NtException">Throw on error</exception>
 public static NtDirectory Open(ObjectAttributes obj_attributes, DirectoryAccessRights desired_access)
 {
     return(Open(obj_attributes, desired_access, true).Result);
 }
Example #30
0
 public static extern NtStatus NtCreateDirectoryObjectEx(out SafeKernelObjectHandle Handle,
                                                         DirectoryAccessRights DesiredAccess, ObjectAttributes ObjectAttributes, SafeKernelObjectHandle ShadowDirectory, int Flags);