请问:
outp(),inp()是用于WIN95、98的;
那么与其相同功能的函数在WIN2000下是什么?

解决方案 »

  1.   

    Win2K下面没有,也不支持嵌入式汇编的in和out使用。
    我开发我这个项目的时候也试了很长时间。
    win2k的保护模式太可怕了,镀金的笼子!!
    如果想操作硬件,建议你看看WDM方面的书,关于win2k内核模式的编程——win2k下面的驱动程序编写。
      

  2.   

    See the sample below, FYI: http://www.codeproject.com/system/CSerialCom.asp
      

  3.   

    请问serverclient(郁闷)是如何调试的哪?
    就是在98下了?
    我的工具都在2000下,98下什么也没有。
      

  4.   

    我后来还是选择98了,已经调通,并交付用户了。Win98下上述那些都可以!
    听说外国有个叫BlueWater的公司专门制作这方面的ActiveX控键,555555,也没有盗版的。
    WDM可以用DDK(drivers develop kits) for Win2000来开发,不过非常浪费时间,全汇编的!32位汇编和Win NT操作系统内核要精通喔。
    否则的话,就赶快换系统吧,安装相关的工具,一天足够了!
      

  5.   

    发信人: April (椰风海韵), 信区: VisualC 标  题: Re: 关于端口读写,help 发信站: BBS 水木清华站 (Tue Apr 17 13:12:56 2001)   NT下对I/O操作进行了保护的,不允许直接访问i/o端口,一般的解决方法是 编写驱动程序,这样可以在Kernel层访问I/O.在NT/2000DDK\src\general目录下有个 portio的例子,拿来就可以用了.还有更好的方法,利用DDK中几个未公开的API也可以 达到同样的目的. //portio.c #include <ntddk.h> /*  *  The name of our device driver.  */ #define DEVICE_NAME_STRING      L"portio" #define IOPM_SIZE       0x2000 typedef UCHAR IOPM[IOPM_SIZE]; IOPM *IOPM_local = 0;   void Ke386SetIoAccessMap(int, IOPM *); void Ke386QueryIoAccessMap(int, IOPM *); void Ke386IoSetAccessProcess(PEPROCESS, int);   /*********************************************************************   Release any allocated objects. *********************************************************************/ VOID GiveioUnload(IN PDRIVER_OBJECT DriverObject) {         WCHAR DOSNameBuffer[] = L"\\DosDevices\\" DEVICE_NAME_STRING;         UNICODE_STRING uniDOSString;           if(IOPM_local)                 MmFreeNonCachedMemory(IOPM_local, sizeof(IOPM));           RtlInitUnicodeString(&uniDOSString, DOSNameBuffer);         IoDeleteSymbolicLink (&uniDOSString);         IoDeleteDevice(DriverObject->DeviceObject); }   VOID SetIOPermissionMap(int OnFlag) {         Ke386IoSetAccessProcess(PsGetCurrentProcess(), OnFlag);         Ke386SetIoAccessMap(1, IOPM_local); }   void GiveIO(void) {         SetIOPermissionMap(1); }   NTSTATUS GiveioCreateDispatch(     IN  PDEVICE_OBJECT  DeviceObject,     IN  PIRP            Irp     ) {         GiveIO();                       // give the calling process I/O access       Irp->IoStatus.Information = 0;     Irp->IoStatus.Status = STATUS_SUCCESS;     IoCompleteRequest(Irp, IO_NO_INCREMENT);     return STATUS_SUCCESS; }   NTSTATUS DriverEntry(     IN PDRIVER_OBJECT DriverObject,     IN PUNICODE_STRING RegistryPath     ) {         PDEVICE_OBJECT deviceObject;         NTSTATUS status;         WCHAR NameBuffer[] = L"\\Device\\" DEVICE_NAME_STRING;         WCHAR DOSNameBuffer[] = L"\\DosDevices\\" DEVICE_NAME_STRING;         UNICODE_STRING uniNameString, uniDOSString;           //         //  Allocate a buffer for the local IOPM and zero it.         //         IOPM_local = MmAllocateNonCachedMemory(sizeof(IOPM));         if(IOPM_local == 0)                 return STATUS_INSUFFICIENT_RESOURCES;         RtlZeroMemory(IOPM_local, sizeof(IOPM));           //         //  Set up device driver name and device object.         //         RtlInitUnicodeString(&uniNameString, NameBuffer);         RtlInitUnicodeString(&uniDOSString, DOSNameBuffer);           status = IoCreateDevice(DriverObject, 0,                                         &uniNameString,                                         FILE_DEVICE_UNKNOWN,                                         0, FALSE, &deviceObject);           if(!NT_SUCCESS(status))                 return status;           status = IoCreateSymbolicLink (&uniDOSString, &uniNameString);           if (!NT_SUCCESS(status))                 return status;       //     //  Initialize the Driver Object with driver's entry points.         // All we require are the Create and Unload operations.     //     DriverObject->MajorFunction[IRP_MJ_CREATE] = GiveioCreateDispatch;         DriverObject->DriverUnload = GiveioUnload;     return STATUS_SUCCESS; }   //在同一个目录下建造sources文件,内容: TARGETNAME=portio TARGETPATH=. TARGETTYPE=DRIVER INCLUDES=e:\ntddk\inc  ;//这儿填写DDK下inc目录的路径 SOURCES=portio.c   //在同一个目录下建造makefile文件,内容: !INCLUDE $(NTMAKEENV)\makefile.def   利用命令行:SetEnv e:\ntddk //设置DDK环境  在该目录下 build,然后会在该目录的I386中产生portio.sys文件,将文件 copy到WINNT\system32\drivers里面,在注册表中手工安装驱动程序(别告诉我你不会 ,到驱动程序版查查,最好设置为驱动程序自动启动,service的key为portio),重起机子。   编写用户态程序: HANDLE h; h = CreateFile("\\\\.\\portio", GENERIC_READ, 0, NULL,                                         OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NUULL);     if(h == INVALID_HANDLE_VALUE) {         printf("Couldn't access giveio device\n");         return -1;     }     CloseHandle(h); //然后以后用嵌入汇编或者_inp,_oup写端口即可.   【 在 qaq (qaq) 的大作中提到: 】 : 标  题: 关于端口读写,help : 发信站: BBS 水木清华站 (Tue Apr 17 11:04:26 2001) : : 各位大虾,dos下可以用inp(),outp()对端口操作。 : win95/98可以用-inp(),-outp(), : winnt 和 2000 呢,别告我不能对端口操作. : 3x : : -- : : ※ 来源:·BBS 水木清华站 smth.org·[FROM: 203.93.178.115]     --
      

  6.   

    In DOS , you can can simply call the _inp/_outp functions to access CMOS, in windows I recommend WinIO to you. http://www.internals.com/utilities/winio.zipWhy should I use the WinIo library if I can simply call the _inp/_outp functions? 
    Port access under Windows 9x is possible as long as you refrain from accessing trapped ports. Several VxDs hook I/O ports to virtualize hardware and will block any attempt to modify these ports from a Windows application. If you wish to control a piece of hardware which is mapped to free addresses such as 300h, you can use the inp/outp functions with no fear. However, any attempt to access system ports (such as those reserved for the DMA chip, HD controller, etc.) will be to no avail. To control such ports from your application, you'll need to use the WinIo library which executes in ring 0 and bypasses Windows port trapping mechanism. Under Windows NT/2000, user mode applications are completely prohibited from accessing I/O ports. Any attempt to access an I/O port from a ring 3 application is terminated with a protection fault. Thus, the only way to overcome this limitation is by using a kernel-mode device driver, such as the one supplied with the WinIo library.
      

  7.   

    哈,还是WinIO库,我已经试验过了,他的东西只能初始化一次,读取一次的数据,无法快速读取。似乎初始化的时候将端口的数据保存起来供人读写一样,速度太慢。我不知道是我使用的不对还是其他的原因。还请楼上的将代码贴一下。麻烦了!谢谢。