你的还不行吗?我按照你的这部分代码写了一个极其简单的流驱动 你看一下.....希望对你有帮助。(怎么就是没有办法上传rar,郁闷。。。。。。)
/*************GPItest*****************/
#include "windows.h"
bool WINAPI GIO_DllEntry (HANDLE hInstDll,DWORD dwReason,LPVOID lpvReserved)
{
switch( dwReason )
{
case DLL_PROCESS_ATTACH:
RETAILMSG(1, (TEXT("GPIOSET : DLL_PROCESS_ATTACH\r\n")));
DisableThreadLibraryCalls((HMODULE) hInstDll);
break;
case DLL_PROCESS_DETACH:
// should be signaling thread here
RETAILMSG(1, (TEXT("GPIOSET : DLL_PROCESS_DETACH\r\n")));
break;
}
return (TRUE);
}
DWORD GPO_Init(LPCTSTR pContext, DWORD dwBusContext)
{
RETAILMSG(1,(L"GPI_Init\r\n"));
return true;
}
DWORD GPO_Open(DWORD hDeviceContext, DWORD AccessCode, DWORD ShareMode)
{
RETAILMSG(1,(L"GIO_Open\r\n"));
return true;
}
BOOL GPO_Close(DWORD hOpenContext)
{
RETAILMSG(1,(L"GIO_Close\r\n"));
return true;
}
DWORD GPO_Read(DWORD hOpenContext, LPVOID pBuffer, DWORD Count)
{
RETAILMSG(1,(L"GIO_Read\r\n"));
return true;
}
DWORD GPO_Write(DWORD hOpenContext, LPCVOID pBuffer, DWORD Count)
{
RETAILMSG(1,(L"GIO_Write\r\n"));
return true;
}
DWORD GPO_Seek(DWORD hOpenContext, long Amount, WORD Type)
{
RETAILMSG(1,(L"GIO_Seek\r\n"));
return true;
}
void GPO_PowerUp(DWORD hOpenContext)
{
RETAILMSG(1,(L"GIO_PowerUp\r\n"));
return ;
}
void GPO_PowerDown(DWORD hOpenContext)
{
RETAILMSG(1,(L"GIO_PowerDown\r\n"));
return ;
}
BOOL GPO_Deinit(DWORD hDeviceContext)
{
RETAILMSG(1,(L"GPO_Deinit\r\n"));
return true;
}
BOOL GPO_IOControl(DWORD hOpenContext, DWORD dwCode, PBYTE pBufIn, DWORD dwLenIn, PBYTE pBufOut, DWORD dwLenOut, PDWORD pdwActualOut)
{
RETAILMSG(1,(L"GIO_IOControl\r\n"));
return true;
}
/**************Sources*********************/
TARGETNAME=GPItest
TARGETTYPE=DYNLINK
RELEASETYPE=PLATFORM
DLLENTRY=GIO_DllEntry
TARGETPATH=$(_CSPCOMMONPATH)\LIB\$(_CPUINDPATH)
DEFFILE=GPItest.def
WINCEREL=1
TARGETLIBS= \
$(_COMMONSDKROOT)\LIB\$(_CPUINDPATH)\coredll.lib \
SOURCELIBS= \
SOURCES= \
GPItest.cpp \
/****************GPItest.def***********************/
LIBRARY GPItest
EXPORTS
GPO_Init
GPO_Deinit
GPO_Open
GPO_Close
GPO_Read
GPO_Write
GPO_Seek
GPO_IOControl
GPO_PowerDown
GPO_PowerUp
/********************GPItest.reg***************************/
[HKEY_LOCAL_MACHINE\Drivers\Builtin\GPItest]
"Prefix"="GPO"
"Dll"="GPItest.dll"
"Order"=dword:10
"Index"=dword:1 |