wince 6.0 动态加载驱动 CreateFile 返回 55
LONG a=RegCreateKeyEx(HKEY_LOCAL_MACHINE,DEV_KEY, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,&m_hKey,&dwDisp); LONG b=RegSetValueEx(m_hKey,TEXT("Order"), 0, REG_DWORD, (const BYTE *) szValue, sizeof(DWORD)); LONG c=RegSetValueEx(m_hKey,TEXT("Index"), 0, REG_DWORD, (const BYTE *) szValue1, sizeof(DWORD)); LONG e=RegSetValueEx(m_hKey,TEXT("Dll"), 0, REG_SZ, (LPBYTE)TEXT("\\Program Files\\wdll\\wdll.dll"), 1 + sizeof(TEXT("\\Program Files\\wdll\\wdll.dll"))); LONG d=RegSetValueEx(m_hKey,TEXT("Prefix"), 0, REG_SZ ,(LPBYTE)TEXT("FKE"), 1 + sizeof(TEXT("FKE"))); DWORD dwParam = 89; //HANDLE hd = ActivateDeviceEx(DEV_KEY,NULL,0,&dwParam); HANDLE hd = ActivateDeviceEx(DEV_KEY,NULL,0,&dwParam); if(hd==NULL){printf("%d",GetLastError());return 0;}/*HANDLE hDriver = CreateFile(TEXT("FKE1:"), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);*/HANDLE hDriver = CreateFile(TEXT("FKE1:"), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if(hDriver==INVALID_HANDLE_VALUE){ printf("%d",GetLastError()); DeactivateDevice(hd); return 0; }
RegisterDevice (L"GGD", 1, L"GPRS.dll", NULL);Handle hSMD = CreateFile(L"GGD1:", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0 );