日期:2014-05-17  浏览次数:21669 次

C# 调用winio.dll
C# 怎么调用winio.dll?
我在网上看了很多例子
大部分都和下面的差不多

using System;

using System.Collections.Generic;

using System.Text;

using System.Runtime.InteropServices;

namespace lizheAionWG

{

    public class WinIo

    {

        public const int KBC_KEY_CMD = 0x64;

        public const int KBC_KEY_DATA = 0x60;

        [DllImport("winio.dll")]

        public static extern bool InitializeWinIo();

        [DllImport("winio.dll")]

        public static extern bool GetPortVal(IntPtr wPortAddr, out int pdwPortVal, byte bSize);

        [DllImport("winio.dll")]

        public static extern bool SetPortVal(uint wPortAddr, IntPtr dwPortVal, byte bSize);

        [DllImport("winio.dll")]

        public static extern byte MapPhysToLin(byte pbPhysAddr, uint dwPhysSize, IntPtr PhysicalMemoryHandle);

        [DllImport("winio.dll")]

        public static extern bool UnmapPhysicalMemory(IntPtr PhysicalMemoryHandle, byte pbLinAddr);

        [DllImport("winio.dll")]

        public static extern bool GetPhysLong(IntPtr pbPhysAddr, byte pdwPhysVal);

        [DllImport("winio.dll")]

        public static extern bool SetPhysLong(IntPtr pbPhysAddr, byte dwPhysVal);

        [DllImport("winio.dll")]

        public static extern void ShutdownWinIo();

        [DllImport("user32.dll")]

        public static extern int MapVirtualKey(uint Ucode, uint uMapType);

        public void sendwinio()

        {

            if (InitializeWinIo())

            {

                KBCWait4IBE();

            }

        }

        ///Wait for Buffer gets empty

        private void KBCWait4IBE()

        {

            int