Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "set" in [All]

dmcl40

.

[DllImport("dmcl40.dll",EntryPoint="dmAPIDeInit", CharSet=CharSet.Ansi, ExactSpelling=true,CallingConvention=CallingConvention.Cdecl )]

.

[DllImport("dmcl40.dll", EntryPoint="dmAPIExec", CharSet=CharSet.Ansi, ExactSpelling=true,CallingConvention=CallingConvention.Cdecl)]

.

[DllImport("dmcl40.dll", EntryPoint="dmAPIGet", CharSet=CharSet.Ansi, ExactSpelling=true,CallingConvention=CallingConvention.Cdecl)]

.

[DllImport("dmcl40.dll",EntryPoint="dmAPIInit", CharSet=CharSet.Ansi,  ExactSpelling=true,CallingConvention=CallingConvention.Cdecl)]

ntdsapi

.

CharSet = CharSet.Unicode, EntryPoint = "DsBindWithCredW", SetLastError = true)]

.

CharSet = CharSet.Unicode, EntryPoint = "DsBindWithCredW", SetLastError = true)]

.

[DllImport("ntdsapi.dll", CharSet=CharSet.Auto)]

.

Note Do not confuse the values of the format elements of the formatOffered parameter used by the DsCrackNames function with the similarly named format elements as defined in the ADS_NAME_TYPE_ENUM enumeration used by the IADsNameTranslate interface. The two sets of element formats are not equivalent and are not interchangeable.

.

       [DllImport(NTDSAPI, CharSet = CharSet.Auto)]

.

       [DllImport(NTDSAPI, CharSet = CharSet.Auto)]

.

       [DllImport(NTDSAPI, CharSet = CharSet.Auto)]

.

       [DllImport(NTDSAPI, CharSet = CharSet.Auto)]

.

       [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]

.

       [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]

.

[DllImport("ntdsapi.dll", CharSet=CharSet.Auto)]

.

[DllImport("Ntdsapi.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode,

.

EntryPoint = "DsFreePasswordCredentials", SetLastError = true)]

.

    [DllImport("Ntdsapi.dll", SetLastError = true)]

.

[DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]

.

    [DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]

.

    [DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]

.

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]

.

        public string NtdsDsaObjectName;      // CN=NTDS Settings,CN=SDBAD10004,CN=Servers,CN=BAD1,CN=Sites,CN=Configuration,DC=ad,DC=sys

.

    [DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]

.

    [DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]

.

[DllImport("Ntdsapi.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode,

.

EntryPoint = "DsMakePasswordCredentialsW", SetLastError = true)]

.

    [DllImport("Ntdsapi.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

    <DllImport("Ntdsapi.dll", CharSet := CharSet.Auto, SetLastError := True)> _

.

    [DllImport("Ntdsapi.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

    [DllImport("Ntdsapi.dll", SetLastError = true)]

.

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]

.

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]

.

    [DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]

.

    [DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]

.

[DllImport("ntdsapi.dll", CharSet=CharSet.Auto)]

.

CharSet = CharSet.Unicode, EntryPoint = "DsUnBindW", SetLastError = true)]

kernel32

15: 8
.

[DllImport("kernel32.dll", SetLastError=true)]

.

[DllImport("Kernel32.dll", SetLastError=true)]

.

    private const uint ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x010;

.

[DllImport("Kernel32.dll", SetLastError=true)]

.

    [DllImport("kernel32", SetLastError = true)]

.

[DllImport("kernel32.dll", CharSet=CharSet.Auto)]

.

[DllImport("kernel32", SetLastError = true)]

.

    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _

.

don't forget to set the dwOSVersionInfoSize  

.

<DllImport("kernel32.dll", SetLastError:=True)> _

.

SetInformationJobObject

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32",SetLastError=true)]

.

    [DllImport("kernel32", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError=true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32",SetLastError=true)]

.

    [DllImport("kernel32", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError=true)]

.

[DllImport("kernel32.dll", SetLastError=true)]

.

<DllImport("kernel32.dll", SetLastError := False)> _

.

calls SetLastError. the last error can be retrieved with Marshal.GetLastWin32Error().

.

[DllImport("Kernel32.dll", SetLastError = true, ExactSpelling = true)]

.

[DllImport("kernel32.dll", SetLastError=true)]

.

<DllImport("kernel32.dll", SetLastError:=True)> _

.

[DllImport("kernel32", SetLastError : true)]

.

[DllImport("kernel32", SetLastError=true)]

.

    [DllImport("kernel32.dll",CharSet=CharSet.Unicode, SetLastError=true)]

.

[DllImport("kernel32.dll",CharSet=CharSet.Unicode)]

.

[DllImport("kernel32.dll", SetLastError=true)]

.

    [DllImport("kernel32", SetLastError = true)]

.

    [DllImport("kernel32", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32", SetLastError = true)]

.

    [DllImport("kernel32", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", EntryPoint = "ReadConsoleInputW", CharSet = CharSet.Unicode)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleActiveScreenBuffer.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleActiveScreenBuffer(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleCP.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleCP(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleCtrlHandler.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleCtrlHandler(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleCursorInfo.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleCursorInfo(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleCursorPosition.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleCursorPosition(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleDisplayMode.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleDisplayMode(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleHistoryInfo.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleHistoryInfo(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleMode.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleMode(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleOutputCP.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleOutputCP(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleScreenBufferInfoEx.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleScreenBufferInfoEx(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleScreenBufferSize.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleScreenBufferSize(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleTextAttribute.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleTextAttribute(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleTitle.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleTitle(

.

    // http://pinvoke.net/default.aspx/kernel32/SetConsoleWindowInfo.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetConsoleWindowInfo(

.

    // http://pinvoke.net/default.aspx/kernel32/SetCurrentConsoleFontEx.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetCurrentConsoleFontEx(

.

    // http://pinvoke.net/default.aspx/kernel32/SetStdHandle.html

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    static extern bool SetStdHandle(

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

        public void SetColor(System.Drawing.Color color)

.

        [FieldOffset(0)]

.

        [FieldOffset(4)]

.

        [FieldOffset(4)]

.

        [FieldOffset(4)]

.

        [FieldOffset(4)]

.

        [FieldOffset(4)]

.

    [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]

.

        [FieldOffset(0), MarshalAs(UnmanagedType.Bool)]

.

        [FieldOffset(4), MarshalAs(UnmanagedType.U2)]

.

        [FieldOffset(6), MarshalAs(UnmanagedType.U2)]

.

        [FieldOffset(8), MarshalAs(UnmanagedType.U2)]

.

        [FieldOffset(10)]

.

        [FieldOffset(12), MarshalAs(UnmanagedType.U4)]

.

        public uint bSetFocus;

.

        [FieldOffset(0)]

.

        [FieldOffset(0)]

.

        [FieldOffset(2)] //2 bytes seems to work properly

.

[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

    [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

    [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

[DllImport("Kernel32.dll", SetLastError=true)]

.

[DllImport("Kernel32.dll", SetLastError=true)]

.

- Call SetConsoleActiveScreenBuffer.

.

    ByVal bManualReset As Boolean, _

.

static extern IntPtr CreateEvent(IntPtr lpEventAttributes, bool bManualReset, bool bInitialState, string lpName);

.

Tip 1: Use CreateEvent to create named event and attach it to AutoResetEvent class:

.

  AutoResetEvent are= new AutoResetEvent(false);

.

// Create an manual-reset event, which is initially set.

.

    /// The NamedEvent class object provides the ability to wait on, pulse, set, and

.

    /// reset a named event. The event can be created with manual or automatic reset,

.

    /// and is always created with an initial state of reset(false).

.

    /// the configuration of auto reset and initially not signaled.

.

    private bool _ManualReset;

.

    static extern IntPtr CreateEvent(IntPtr lpEventAttributes, bool bManualReset, bool bInitialState, string lpName);

.

    [DllImport("kernel32.dll", SetLastError=true)]

.

    static extern bool SetEvent(IntPtr hEvent);

.

    static extern bool ResetEvent(IntPtr hEvent);

.

    [DllImport("kernel32", SetLastError=true, ExactSpelling=true)]

.

    /// Create a NamedEvent object with the name of the event, and assume auto reset with

.

    /// an initial state of reset.

.

    /// Create a NamedEvent object with the name of the event and the auto reset property,

.

    /// assuming an initial state of reset.

.

    public NamedEvent(string EventName, bool ManualReset )

.

        _ManualReset = ManualReset;

.

        _Handle = CreateEvent( _Attributes, _ManualReset, _InitialState, _EventName );

.

        _Handle = CreateEvent( _Attributes, _ManualReset, _InitialState, _EventName );

.

    /// Set the named event to a signaled state. The Wait() method will not block any

.

    public void Set()

.

        _Handle = CreateEvent( _Attributes, _ManualReset, _InitialState, _EventName );

.

        SetEvent( _Handle );

.

    /// Reset the named event to a non signaled state. The Wait() method will block

.

    public void Reset()

.

        _Handle = CreateEvent( _Attributes, _ManualReset, _InitialState, _EventName );

.

        ResetEvent( _Handle );

.

    /// Set the event with the given name to a signaled state. The Wait() method will not block

.

    static public void Set(string Name) { (new NamedEvent(Name)).Set(); }

.

    /// Reset the event with the given name to a non signaled state. The Wait() method will block

.

    static public void Reset( string Name) { (new NamedEvent(Name)).Reset(); }

.

[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

<DllImport("kernel32.dll", SetLastError:= true, CharSet:= CharSet.Auto)> _

.

    unsafe public void Write(Object o, Int64 AtOffset)

.

        Int64 FileMapStart = (AtOffset / _AllocationGranularity) * _AllocationGranularity;

.

        Int64 MapViewSize = (AtOffset % _AllocationGranularity) + _AllocationGranularity;

.

        Int64 iViewDelta = AtOffset - FileMapStart;

.

    unsafe public object Read(Int64 AtOffset)

.

        Int64 FileMapStart = (AtOffset / _AllocationGranularity) * _AllocationGranularity;

.

        Int64 MapViewSize = (AtOffset % _AllocationGranularity) + _AllocationGranularity;

.

        Int64 iViewDelta = AtOffset - FileMapStart;

.

    /// <param name="AtOffset"></param>

.

    unsafe public void Write(byte[] Buffer, int BytesToWrite, Int64 AtOffset)

.

        Int64 FileMapStart = (AtOffset / _AllocationGranularity) * _AllocationGranularity;

.

        Int64 MapViewSize = (AtOffset % _AllocationGranularity) + _AllocationGranularity;

.

        Int64 iViewDelta = AtOffset - FileMapStart;

.

    /// <param name="AtOffset"></param>

.

    unsafe public int Read(byte[] Buffer, int BytesToRead, Int64 AtOffset)

.

        Int64 FileMapStart = (AtOffset / _AllocationGranularity) * _AllocationGranularity;

.

        Int64 MapViewSize = (AtOffset % _AllocationGranularity) + _AllocationGranularity;

.

        Int64 iViewDelta = AtOffset - FileMapStart;

.

    [DllImport("Kernel32", CharSet = CharSet.Auto, SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("Kernel32", CharSet = CharSet.Auto, SetLastError = true)]

.

    private static extern IntPtr MapViewOfFile(IntPtr hFileMapping, FileMapAccess dwDesiredAccess, Int32 dwFileOffsetHigh, Int32 dwFileOffsetLow, Int32 dwNumberOfBytesToMap);

.

    internal static IntPtr MapViewOfFile(IntPtr hFileMapping, FileMapAccess dwDesiredAccess, Int64 ddFileOffset, Int32 dwNumberOfBytesToMap)

.

        int Hi = (Int32)(ddFileOffset / Int32.MaxValue);

.

        int Lo = (Int32)(ddFileOffset % Int32.MaxValue);

.

    [DllImport("kernel32", SetLastError = true)]

.

        [FieldOffset(0)]

.

        [FieldOffset(0)]

.

        [FieldOffset(2)]

.

[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

<DllImport("kernel32.dll", SetLastError:= true, CharSet:= CharSet.Auto)> _

.

    unsafe public void Write(Object o, Int64 AtOffset)

.

        Int64 FileMapStart = (AtOffset / _AllocationGranularity) * _AllocationGranularity;

.

        Int64 MapViewSize = (AtOffset % _AllocationGranularity) + _AllocationGranularity;

.

        Int64 iViewDelta = AtOffset - FileMapStart;

.

    unsafe public object Read(Int64 AtOffset)

.

        Int64 FileMapStart = (AtOffset / _AllocationGranularity) * _AllocationGranularity;

.

        Int64 MapViewSize = (AtOffset % _AllocationGranularity) + _AllocationGranularity;

.

        Int64 iViewDelta = AtOffset - FileMapStart;

.

    /// <param name="AtOffset"></param>

.

    unsafe public void Write(byte[] Buffer, int BytesToWrite, Int64 AtOffset)

.

        Int64 FileMapStart = (AtOffset / _AllocationGranularity) * _AllocationGranularity;

.

        Int64 MapViewSize = (AtOffset % _AllocationGranularity) + _AllocationGranularity;

.

        Int64 iViewDelta = AtOffset - FileMapStart;

.

    /// <param name="AtOffset"></param>

.

    unsafe public int Read(byte[] Buffer, int BytesToRead, Int64 AtOffset)

.

        Int64 FileMapStart = (AtOffset / _AllocationGranularity) * _AllocationGranularity;

.

        Int64 MapViewSize = (AtOffset % _AllocationGranularity) + _AllocationGranularity;

.

        Int64 iViewDelta = AtOffset - FileMapStart;

.

    [DllImport("Kernel32", CharSet = CharSet.Auto, SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("Kernel32", CharSet = CharSet.Auto, SetLastError = true)]

.

    private static extern IntPtr MapViewOfFile(IntPtr hFileMapping, FileMapAccess dwDesiredAccess, Int32 dwFileOffsetHigh, Int32 dwFileOffsetLow, Int32 dwNumberOfBytesToMap);

.

    internal static IntPtr MapViewOfFile(IntPtr hFileMapping, FileMapAccess dwDesiredAccess, Int64 ddFileOffset, Int32 dwNumberOfBytesToMap)

.

        int Hi = (Int32)(ddFileOffset / Int32.MaxValue);

.

        int Lo = (Int32)(ddFileOffset % Int32.MaxValue);

.

    [DllImport("kernel32", SetLastError = true)]

.

        [FieldOffset(0)]

.

        [FieldOffset(0)]

.

        [FieldOffset(2)]

.

[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

<DllImport("kernel32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _

.

[DllImport('kernel32.dll', SetLastError:=true, CharSet:=CharSet.Auto)]

.

    [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

[DllImport("kernel32.dll", SetLastError = true)]

.

[DllImport("kernel32.dll", CharSet=CharSet.Unicode)]

.

<DllImport("kernel32.dll", CharSet := CharSet.Unicode)> _

.

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]

.

[DllImport("kernel32.dll", SetLastError = true)]

.

<DllImport("Kernel32.dll", CharSet:=CharSet.Auto, setlasterror:=True)> _

.

        [DllImport("kernel32.dll", SetLastError = true)]

.

        [DllImport("advapi32.dll", SetLastError=true)]

.

        public static extern bool SetSecurityDescriptorDacl(ref SECURITY_DESCRIPTOR securityDescriptor, bool daclPresent, IntPtr dacl, bool daclDefaulted);

.

        [DllImport("advapi32.dll", SetLastError=true)]

.

                    worked = Native.SetSecurityDescriptorDacl(ref securityDesc, true, IntPtr.Zero, false);

.

                        throw new MutexCreationException( string.Format( "Failed to set security descriptor DACL. Win32 error num: '{0}'", lastError ) );

.

[DllImport("kernel32.dll", SetLastError = true)]

.

[DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", EntryPoint = "CreateFile", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", EntryPoint = "PeekNamedPipe", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    [DllImport("kernel32.dll", SetLastError = true)]

.

    /*[DllImport("kernel32.dll", SetLastError = true)]

.

        // Set members persistently...

.

        set { }

.

    public override int Read(byte[] buffer, int offset, int count)

.

        if (buffer.Length < (offset + count))

.

        if (offset < 0)

.

        throw new ArgumentOutOfRangeException("offset", offset, "Offset cannot be negative");

.

        // a specified offset

.

        if (offset != 0)

.

        if (offset != 0)

.

            buffer[offset + x] = buf[x];

.

    public override void SetLength(long length)

.

        throw new NotSupportedException("NamedPipeStream doesn't support SetLength");

.

    public override void Write(byte[] buffer, int offset, int count)

.

        if (buffer.Length < (offset + count))

.

        if (offset < 0)

.

        throw new ArgumentOutOfRangeException("offset", offset, "Offset cannot be negative");

.

        // copy data to internal buffer to allow writing from a specified offset

.

        if (offset != 0)

.

            buf[x] = buffer[offset + x];

.

    public override long Seek(long offset, SeekOrigin origin)

.

[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

[DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

    /// The timer will be set to the signaled state only once. If this flag is set, the Period parameter must be zero.

.

[timeSetEvent]

.

    /// The timer will be set to the signaled state only once. If this flag is set, the Period parameter must be zero.

.

[timeSetEvent]

.

[DllImport("kernel32.dll", SetLastError=true)]

.

<DllImport("kernel32.dll", SetLastError:=True)> _

.

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]

.

    [DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]

.

    [DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]

.

    [DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]

.

    [DllImport("kernel32", SetLastError = true)]

.

static extern IntPtr CreateWaitableTimer(IntPtr lpTimerAttributes, bool bManualReset, string lpTimerName);

.

public static extern IntPtr CreateWaitableTimer(IntPtr lpTimerAttributes, bool bManualReset,

.

public static extern bool SetWaitableTimer(IntPtr hTimer, [In] ref long pDueTime,

.

[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]

.

     Win32.PowerManagement.SetWaitableTimer(handle, ref duetime, 0, null, IntPtr.Zero, true);

.

[DllImport("Kernel32.dll", SetLastError=true)]

.
Summary
Sets the action to be performed when the calling thread exits.
.

static extern void DebugSetProcessKillOnExit(bool killOnExit);

.
Documentation
[DebugSetProcessKillOnExit] on MSDN
.

[DllImport("Advapi32.dll", SetLastError=true)]

.

[DllImport("kernel32.dll", SetLastError=true, ExactSpelling=true)]

.

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]

.

[DllImport("kernel32.dll", SetLastError = true)]

.

[DllImport("kernel32.dll", SetLastError = true)]

.

[DllImport("kernel32.dll", SetLastError = true)]

.

[DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Auto)]

.

[DllImport("Kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

    [DllImport("Kernel32.dll", SetLastError = false, CharSet = CharSet.Auto)]

.

    <DllImport("kernel32.dll", ExactSpelling := True, SetLastError := True, CharSet := CharSet.Auto)>

.

    <DllImport("Kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>

.

    <DllImport("Kernel32.dll", SetLastError := False, CharSet := CharSet.Auto)>

.

hDevice - To retrieve a handle to a volume, call CreateFile with the lpFileName parameter set to a string of the following form: \\.\DriveLetter:. DriveLetter is not case-sensitive and does not require a colon after it.

.

This is great for interacting with devices; now perhaps someone can help with the SetupDi calls to actually discover the device handles, etc...? If you are able to conquer it (I wasn't) toss me a mail at dotnet at richardgoodwin dot com

.

    // Set return variable up

.

     StorageResetBus = (EFileDevice.MassStorage << 16) | (0x0400 << 2) | EMethod.Buffered | (FileAccess.Read << 14),

.

     StorageResetDevice = (EFileDevice.MassStorage << 16) | (0x0401 << 2) | EMethod.Buffered | (FileAccess.Read << 14),

.

     StorageObsoleteResetBus = (EFileDevice.MassStorage << 16) | (0x0400 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     StorageObsoleteResetDevice = (EFileDevice.MassStorage << 16) | (0x0401 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     DiskSetPartitionInfo = (EFileDevice.Disk << 16) | (0x0002 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     DiskSetDriveLayout = (EFileDevice.Disk << 16) | (0x0004 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     DiskHistogramReset = (EFileDevice.Disk << 16) | (0x000e << 2) | EMethod.Buffered | (0 << 14),

.

     DiskSetCacheInformation = (EFileDevice.Disk << 16) | (0x0036 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     DiskSetPartitionInfoEx = (EFileDevice.Disk << 16) | (0x0013 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     DiskSetDriveLayoutEx = (EFileDevice.Disk << 16) | (0x0015 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     ChangerSetAccess = (EFileDevice.Changer << 16) | (0x0004 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     ChangerSetPosition = (EFileDevice.Changer << 16) | (0x0007 << 2) | EMethod.Buffered | (FileAccess.Read << 14),

.

     FsctlSetCompression = (EFileDevice.FileSystem << 16) | (16 << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     FsctlSetObjectId = (EFileDevice.FileSystem << 16) | (38 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlSetReparsePoint = (EFileDevice.FileSystem << 16) | (41 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlSetObjectIdExtended = (EFileDevice.FileSystem << 16) | (47 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlSetSparse = (EFileDevice.FileSystem << 16) | (49 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlSetZeroData = (EFileDevice.FileSystem << 16) | (50 << 2) | EMethod.Buffered | (FileAccess.Write << 14),

.

     FsctlSetEncryption = (EFileDevice.FileSystem << 16) | (53 << 2) | EMethod.Neither | (0 << 14),

.

     VideoSetDisplayBrightness = (EFileDevice.Video << 16) | (0x0127 << 2) | EMethod.Buffered | (0 << 14)

.

[DllImport("Kernel32.dll", SetLastError = false, CharSet = CharSet.Auto)]

.

    private int mFieldOffset_InternalLow = 0;

.

    private int mFieldOffset_InternalHigh = 0;

.

    private int mFieldOffset_OffsetLow = 0;

.

    private int mFieldOffset_OffsetHigh = 0;

.

    private int mFieldOffset_EventHandle = 0;

.

        mFieldOffset_InternalLow = Marshal.OffsetOf(typeof (NativeOverlapped), "InternalLow").ToInt32();

.

        mFieldOffset_InternalHigh = Marshal.OffsetOf(typeof (NativeOverlapped), "InternalHigh").ToInt32();

.

        mFieldOffset_OffsetLow = Marshal.OffsetOf(typeof (NativeOverlapped), "OffsetLow").ToInt32();

.

        mFieldOffset_OffsetHigh = Marshal.OffsetOf(typeof (NativeOverlapped), "OffsetHigh").ToInt32();

.

        mFieldOffset_EventHandle = Marshal.OffsetOf(typeof (NativeOverlapped), "EventHandle").ToInt32();

.

        get { return Marshal.ReadIntPtr(mPtrOverlapped, mFieldOffset_InternalLow); }

.

        set { Marshal.WriteIntPtr(mPtrOverlapped, mFieldOffset_InternalLow, value); }

.

        get { return Marshal.ReadIntPtr(mPtrOverlapped, mFieldOffset_InternalHigh); }

.

        set { Marshal.WriteIntPtr(mPtrOverlapped, mFieldOffset_InternalHigh, value); }

.

    public int OffsetLow

.

        get { return Marshal.ReadInt32(mPtrOverlapped, mFieldOffset_OffsetLow); }

.

        set { Marshal.WriteInt32(mPtrOverlapped, mFieldOffset_OffsetLow, value); }

.

    public int OffsetHigh

.

        get { return Marshal.ReadInt32(mPtrOverlapped, mFieldOffset_OffsetHigh); }

.

        set { Marshal.WriteInt32(mPtrOverlapped, mFieldOffset_OffsetHigh, value); }

.

        get { return Marshal.ReadIntPtr(mPtrOverlapped, mFieldOffset_EventHandle); }

.

        set { Marshal.WriteIntPtr(mPtrOverlapped, mFieldOffset_EventHandle, value); }

.

    /// Set the overlapped wait handle and clear out the rest of the structure.

.

    public void ClearAndSetEvent(IntPtr hEventOverlapped)

.

        OffsetLow = 0;

.

        OffsetHigh = 0;

.

  ManualResetEvent hEvent = new ManualResetEvent(false);

.

  deviceIoOverlapped.ClearAndSetEvent(hEvent.SafeWaitHandle.DangerousGetHandle());

.

       If Not IsBitSet(VerParam.bIDEDeviceMap, 0) Then

.

   Private Function IsBitSet(ByVal iBitString As Byte, ByVal lBitNo As Integer) As Boolean

.

       IsBitSet = iBitString < 0

.

       IsBitSet = iBitString And (2 ^ lBitNo)

.

here's how to set a file to be a sparse file:

.

   int result=DeviceIoControl(fileHandle,(int)EIOControlCode.FsctlSetSparse,ref shTemp,0,IntPtr.Zero,0,ref dwTemp,IntPtr.Zero);

.

[DllImport("kernel32.dll", SetLastError=true)]

.

[DllImport("kernel32.dll", SetLastError = true)]

.

[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

    [DllImport("kernel32", CallingConvention = CallingConvention.StdCall, SetLastError = true)]

.

    [DllImport("kernel32", CallingConvention = CallingConvention.StdCall, SetLastError = true)]

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: