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
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
kerneliocontrol (coredll)
 

coredll is for smart devices, not desktop Windows. Therefore, this information only applies to code using the .NET Compact Framework. To see if information for kerneliocontrol in other DLLs exists, click on Find References to the right.

.
Summary
TODO - a short description

C# Signature:

[DllImport("coredll.dll", SetLastError=true)]
internal static extern bool KernelIoControl(int dwIoControlCode, byte[] inBuf, int inBufSize, byte[] outBuf, int outBufSize, ref int bytesReturned);

VB Signature:

Declare Function KernelIoControl Lib "coredll.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

Taken from openNetCF in OpenNETCF.Win32.Core

Tips & Tricks:

Please add some!

Sample Code:

C# code, A Sample of soft resetting the device:

#region declares for softreset (KernelIOControl)

    // Control Code flags
    private const uint FILE_DEVICE_UNKNOWN = 0x00000022;
    private const uint FILE_DEVICE_HAL = 0x00000101;
    private const uint FILE_DEVICE_CONSOLE = 0x00000102;
    private const uint FILE_DEVICE_PSL = 0x00000103;
    private const uint METHOD_BUFFERED = 0;
    private const uint METHOD_IN_DIRECT = 1;
    private const uint METHOD_OUT_DIRECT = 2;
    private const uint METHOD_NEITHER = 3;
    private const uint FILE_ANY_ACCESS = 0;
    private const uint FILE_READ_ACCESS = 0x0001;
    private const uint FILE_WRITE_ACCESS = 0x0002;

    private static uint CTL_CODE(uint DeviceType, uint Function, uint Method, uint Access)
        {
            return ((DeviceType << 16) | (Access << 14) | (Function << 2) | Method);
        }

        /// <summary>
        /// This function provides the kernel with a generic I/O control for
        /// carrying out I/O operations.
        /// </summary>
        /// <param name="dwIoControlCode">I/O control code, which should support the
        /// OAL I/O controls. For a list of these I/O controls, see Supported
        /// OAL APIs.</param>
        /// <param name="lpInBuf">Pointer to the input buffer.</param>
        /// <param name="nInBufSize">Size, in bytes, of lpInBuf.</param>
        /// <param name="lpOutBuf">Pointer to the output buffer.</param>
        /// <param name="nOutBufSize">Maximum number of bytes that can be returned in
        /// lpOutBuf.</param>
        /// <param name="lpBytesReturned">Address of a DWORD that receives the size,
        /// in bytes, of the data returned.</param>
        /// <returns>TRUE indicates success; FALSE indicates failure.</returns>
        [DllImport("Coredll.dll")]
    private extern static uint KernelIoControl
        (
            uint dwIoControlCode,
            IntPtr lpInBuf,
            uint nInBufSize,
            IntPtr lpOutBuf,
            uint nOutBufSize,
            ref uint lpBytesReturned
        );
    #endregion

    /// <summary>
    /// the method needed to be called to actually reset the device.
    /// </summary>
    public static void resetDevice()
    {
        uint bytesReturned = 0;
        uint IOCTL_HAL_REBOOT = CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS);
        KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, ref bytesReturned);
    }


Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions