Exemple #1
0
 public static extern NtStatus NtWriteFileGather(
     SafeKernelObjectHandle FileHandle,
     SafeKernelObjectHandle Event,
     IntPtr ApcRoutine,
     IntPtr ApcContext,
     SafeIoStatusBuffer IoStatusBlock,
     [MarshalAs(UnmanagedType.LPArray), In] FileSegmentElement[] SegmentArray,
     int Length,
     [In] LargeInteger ByteOffset,
     IntPtr Key);
 public static extern NtStatus NtCreateMailslotFile(
     out SafeKernelObjectHandle FileHandle,
     FileAccessRights DesiredAccess,
     [In] ObjectAttributes ObjectAttributes,
     [Out] IoStatus IoStatusBlock,
     FileOpenOptions CreateOptions,
     int MailslotQuota,
     int MaximumMessageSize,
     LargeInteger ReadTimeout
     );
Exemple #3
0
        public long ToInt64()
        {
            LargeInteger li = new LargeInteger
            {
                LowPart  = LowPart,
                HighPart = HighPart
            };

            return(li.QuadPart);
        }
Exemple #4
0
 public static extern NtStatus NtWriteFile(
     SafeKernelObjectHandle FileHandle,
     SafeKernelObjectHandle Event,
     IntPtr ApcRoutine,
     IntPtr ApcContext,
     SafeIoStatusBuffer IoStatusBlock,
     SafeBuffer Buffer,
     int Length,
     [In] LargeInteger ByteOffset,
     IntPtr Key
     );
Exemple #5
0
 public static extern NtStatus NtLockFile(
     SafeKernelObjectHandle FileHandle,
     SafeKernelObjectHandle Event,
     IntPtr ApcRoutine,
     IntPtr ApcContext,
     SafeIoStatusBuffer IoStatusBlock,
     [In] LargeInteger ByteOffset,
     [In] LargeInteger Length,
     int Key,
     bool FailImmediately,
     bool ExclusiveLock
     );
Exemple #6
0
 public static extern NtStatus NtCreateFile(
     out SafeKernelObjectHandle FileHandle,
     FileAccessRights DesiredAccess,
     ObjectAttributes ObjAttr,
     [Out] IoStatus IoStatusBlock,
     LargeInteger AllocationSize,
     FileAttributes FileAttributes,
     FileShareMode ShareAccess,
     FileDisposition CreateDisposition,
     FileOpenOptions CreateOptions,
     byte[] EaBuffer,
     int EaLength);
Exemple #7
0
 public static extern NtStatus NtMapViewOfSection(
     SafeKernelObjectHandle SectionHandle,
     SafeKernelObjectHandle ProcessHandle,
     ref IntPtr BaseAddress,
     IntPtr ZeroBits,
     IntPtr CommitSize,
     [In, Out] LargeInteger SectionOffset,
     ref IntPtr ViewSize,
     SectionInherit InheritDisposition,
     AllocationType AllocationType,
     ProtectionType Win32Protect
     );
 public static extern NtStatus NtAlpcConnectPortEx(
     out SafeKernelObjectHandle PortHandle,
     [In] ObjectAttributes ConnectionPortObjectAttributes,
     [Optional, In] ObjectAttributes ClientPortObjectAttributes,
     [Optional, In] AlpcPortAttributes PortAttributes,
     uint Flags,
     [Optional] IntPtr ServerSecurityRequirements, // SECURITY_DESCRIPTOR
     [Optional, In, Out] AlpcPortMessage ConnectionMessage,
     [Optional, In, Out] OptionalLength BufferLength,
     [Optional, In, Out] AlpcMessageAtributes OutMessageAttributes,
     [Optional, In, Out] AlpcMessageAtributes InMessageAttributes,
     [Optional, In] LargeInteger Timeout);
 public static extern NtStatus NtAlpcConnectPort(
     out SafeKernelObjectHandle PortHandle,
     [In] UnicodeString PortName,
     [Optional, In] ObjectAttributes ObjectAttributes,
     [Optional, In] AlpcPortAttributes PortAttributes,
     uint Flags,
     [Optional] IntPtr RequiredServerSid,
     [Optional, In, Out] AlpcPortMessage ConnectionMessage,
     [Optional, In, Out] OptionalInt32 BufferLength,
     [Optional, In, Out] AlpcMessageAtributes OutMessageAttributes,
     [Optional, In, Out] AlpcMessageAtributes InMessageAttributes,
     [Optional, In] LargeInteger Timeout
     );
 public static extern NtStatus NtMapViewOfSectionEx(
     SafeKernelObjectHandle SectionHandle,
     SafeKernelObjectHandle ProcessHandle,
     ref IntPtr BaseAddress,
     IntPtr ZeroBits,
     IntPtr CommitSize,
     [In, Out] LargeInteger SectionOffset,
     ref IntPtr ViewSize,
     SectionInherit InheritDisposition,
     AllocationType AllocationType,
     MemoryAllocationProtect Win32Protect,
     MemExtendedParameter[] ExtendedParameters,
     int ExtendedParameterCount
     );
Exemple #11
0
 public static extern NtStatus NtCreateToken(
     out SafeKernelObjectHandle TokenHandle,
     TokenAccessRights DesiredAccess,
     [In] ObjectAttributes ObjectAttributes,
     TokenType TokenType,
     [In] ref Luid AuthenticationId,
     [In] LargeInteger ExpirationTime,
     [In] ref TokenUser TokenUser,
     [In] SafeTokenGroupsBuffer TokenGroups,
     [In] SafeTokenPrivilegesBuffer TokenPrivileges,
     [In] ref TokenOwner TokenOwner,
     [In] ref TokenPrimaryGroup TokenPrimaryGroup,
     [In] ref TokenDefaultDacl TokenDefaultDacl,
     [In] TokenSource TokenSource);
Exemple #12
0
 public static extern NtStatus NtCreateNamedPipeFile(
     out SafeKernelObjectHandle FileHandle,
     FileAccessRights DesiredAccess,
     [In] ObjectAttributes ObjectAttributes,
     [Out] IoStatus IoStatusBlock,
     FileShareMode ShareAccess,
     FileDisposition CreateDisposition,
     FileOpenOptions CreateOptions,
     NamedPipeType NamedPipeType,
     NamedPipeReadMode ReadMode,
     NamedPipeCompletionMode CompletionMode,
     int MaximumInstances,
     int InboundQuota,
     int OutboundQuota,
     LargeInteger DefaultTimeout
     );
Exemple #13
0
 public static extern NtStatus NtWaitForMultipleObjects(int HandleCount,
                                                        IntPtr[] Handles, WaitType WaitType, bool Alertable, LargeInteger Timeout);
Exemple #14
0
 public static extern NtStatus NtWaitForSingleObject(
     SafeKernelObjectHandle Handle,
     bool Alertable,
     LargeInteger Timeout
     );
Exemple #15
0
 public static extern NtStatus NtDelayExecution(bool Alertable, LargeInteger DelayInterval);
 public static extern NtStatus NtRollforwardTransactionManager(
     SafeKernelObjectHandle TmHandle,
     LargeInteger TmVirtualClock
     );
Exemple #17
0
 /// <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>
 /// <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> CreateEx(ObjectAttributes object_attributes, SectionAccessRights desired_access, LargeInteger size,
                                             MemoryAllocationProtect protection, SectionAttributes attributes, NtFile file, MemSectionExtendedParameter[] extended_parameters, bool throw_on_error)
 {
     return(NtSystemCalls.NtCreateSectionEx(out SafeKernelObjectHandle section_handle, desired_access, object_attributes,
                                            size, protection, attributes, file.GetHandle(),
                                            extended_parameters, extended_parameters?.Length ?? 0).CreateResult(throw_on_error, () => new NtSection(section_handle)));
 }
Exemple #18
0
 internal NtSection(SafeKernelObjectHandle handle, SectionAttributes attributes, ProtectionType protection, LargeInteger size) : base(handle)
 {
 }
Exemple #19
0
 public static extern NtStatus NtCreateSection(out SafeKernelObjectHandle SectionHandle,
                                               SectionAccessRights DesiredAccess,
                                               [In] ObjectAttributes ObjectAttributes, [In] LargeInteger SectionSize,
                                               ProtectionType Protect, SectionAttributes Attributes,
                                               SafeHandle FileHandle);
 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);
 public static extern NtStatus NtWaitForDebugEvent(
     SafeKernelObjectHandle DebugObjectHandle,
     bool Alertable,
     LargeInteger Timeout,
     SafeBuffer WaitStateChange
     );
 public static extern NtStatus NtExtendSection(
     SafeKernelObjectHandle SectionHandle,
     [In, Out] LargeInteger SectionSize
     );
 public static extern NtStatus NtWaitForMultipleObjects(int HandleCount, 
     IntPtr[] Handles, WaitType WaitType, bool Alertable, LargeInteger Timeout);
Exemple #24
0
        /// <summary>
        /// Extend the section to a new size.
        /// </summary>
        /// <param name="new_size">The new size to extend to.</param>
        /// <param name="throw_on_error">True to throw on error.</param>
        /// <returns>The new size.</returns>
        /// <exception cref="NtException">Thrown on error.</exception>
        public NtResult <long> Extend(long new_size, bool throw_on_error)
        {
            LargeInteger size = new LargeInteger(new_size);

            return(NtSystemCalls.NtExtendSection(Handle, size).CreateResult(throw_on_error, () => size.QuadPart));
        }
Exemple #25
0
 internal NtSection(SafeKernelObjectHandle handle, SectionAttributes attributes, MemoryAllocationProtect protection, LargeInteger size) : base(handle)
 {
 }
Exemple #26
0
 /// <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);
 }
Exemple #27
0
 public static extern NtStatus NtSignalAndWaitForSingleObject(
     SafeKernelObjectHandle ObjectToSignal,
     SafeKernelObjectHandle WaitableObject,
     bool Alertable,
     LargeInteger Timeout);
Exemple #28
0
 internal NtWaitTimeout(long value)
 {
     Timeout = new LargeInteger(value);
 }
Exemple #29
0
        /// <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)
        {
            SafeKernelObjectHandle section_handle;

            return(NtSystemCalls.NtCreateSection(out section_handle, desired_access, object_attributes,
                                                 size, protection, attributes, file.GetHandle()).CreateResult(throw_on_error, () => new NtSection(section_handle)));
        }
 internal NtWaitTimeout(long value)
 {
     Timeout = new LargeInteger(value);
 }
Exemple #31
0
 public static extern NtStatus NtUnlockFile(
     SafeKernelObjectHandle FileHandle,
     IoStatus IoStatusBlock,
     [In] LargeInteger ByteOffset,
     [In] LargeInteger Length,
     int Key);
 public static extern NtStatus NtWaitForSingleObject(
   SafeKernelObjectHandle Handle,
   bool Alertable,
   LargeInteger Timeout
 );
Exemple #33
0
 /// <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);
 }