static BYTE g_Tmp = 0;
static DWORD g_OpenCount = 0;
HANDLE g_hInstance;
BOOL WINAPI
DllEntry(HANDLE hInstDLL,
DWORD dwReason,
LPVOID lpvReserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
g_hInstance = hInstDLL;
RETAILMSG(1,(TEXT("SPL:DLL_PROCESS_ATTACH\r\n")));
DisableThreadLibraryCalls((HMODULE) hInstDLL);
return TRUE;
case DLL_THREAD_ATTACH:
RETAILMSG(1,(TEXT("SPL:DLL_THREAD_ATTACH\n")));
break;
case DLL_THREAD_DETACH:
RETAILMSG(1,(TEXT("SPL:DLL_THREAD_DETACH\n")));
break;
case DLL_PROCESS_DETACH:
RETAILMSG(1,(TEXT("SPL:DLL_PROCESS_DETACH\n")));
break;
#ifdef UNDER_CE
case DLL_PROCESS_EXITING:
RETAILMSG(1,(TEXT("SPL:DLL_PROCESS_EXITING\n")));
break;
case DLL_SYSTEM_STARTED:
RETAILMSG(1,(TEXT("SPL:DLL_SYSTEM_STARTED\n")));
break;
#endif
}
return TRUE;
}
DWORD SPL_Init(LPCTSTR pContext, LPCVOID lpvBusContext)
{
RETAILMSG(1, (TEXT(":::SPL_Init\r\n")));
g_Tmp = 0;
g_OpenCount = 0;
return 1;
}
DWORD SPL_DeInit(DWORD dwContext)
{
RETAILMSG(1, (TEXT(":::SPL_DeInit\r\n")));
g_Tmp = 0;
g_OpenCount = 0;
return TRUE;
}
DWORD SPL_Open(DWORD hDeviceContext, DWORD AccessMode, DWORD ShareMode)
{
RETAILMSG(1, (TEXT(":::SPL_Open\r\n")));
if(g_OpenCount != 0)
{
RETAILMSG(1, (TEXT("SPL Open Failed\r\n")));
return 0;
}
g_OpenCount++;
return g_OpenCount;
}
BOOL SPL_Close(DWORD hOpenContext)
{
RETAILMSG(1, (TEXT(":::SPL_Close\r\n")));
if(g_OpenCount != 0)
{
g_OpenCount--;
}
return TRUE;
}
BOOL SPL_IOControl(DWORD hOpenContext,
DWORD dwCode,
PBYTE pBufIn,
DWORD dwLenIn,
PBYTE pBufOut,
DWORD dwLenOut,
PDWORD pdwActualOut)
{
RETAILMSG(1, (TEXT(":::SPL_IOControl\r\n")));
return TRUE;
}
void SPL_PowerUp(void)
{
RETAILMSG(1, (TEXT(":::SPL_PowerUp\r\n")));
}
void SPL_PowerDown(void)
{
RETAILMSG(1, (TEXT(":::SPL_PowerDown\r\n")));
}
DWORD SPL_Read(DWORD hOpenContext, LPVOID pBuffer, DWORD Count)
{
UCHAR* pReadBuffer;
RETAILMSG(1, (TEXT(":::SPL_Read\r\n")));
if(pBuffer == NULL || Count <= 0)
{
RETAILMSG(1, (TEXT(":::SPL_Read() parameter is error\r\n")));
return 0;
}
pReadBuffer = MapPtrToProcess(pBuffer, GetCallerProcess());
*pReadBuffer = g_Tmp;
return 1;
}
DWORD SPL_Write(DWORD hOpenContext, LPVOID pBuffer, DWORD Count)
{
UCHAR* pWriterBuffer;
RETAILMSG(1, (TEXT(":::SPL_Write\r\n")));
if(pBuffer == NULL || Count <= 0)
{
RETAILMSG(1, (TEXT(":::SPL_Write() parameter is error\r\n")));
return 0;
}
pWriterBuffer = MapPtrToProcess(pBuffer, GetCallerProcess());
g_Tmp = *pWriterBuffer;
return 1;
}
DWORD SPL_Seek(DWORD hOpenContext, long Amount, DWORD Type)
{
RETAILMSG(1, (TEXT(":::SPL_Seek\r\n")));
return 0;
}
这10个函数我都写了啊,但是还是没有执行SPL_Init()这个函数,不知怎么回事呢? |