UINT32 ali_otp_read(UINT16 addr) { SET_WORD(REG_ADDR, addr&0xfffc); SET_DWORD(REG_CTRL, GET_DWORD(REG_CTRL)|OTP_READ_TRIG); while(GET_DWORD(REG_CTRL) & OTP_READ_BUSY); return GET_DWORD(REG_RDATA); }
aWORD cmicro_Exec90( BYTE * i_pbyRecData, aWORD i_wLenRecData, BYTE * o_pbySendData, aWORD i_wMaxSendData ) { aWORD wRet ; s_Cmd90 * pCmd ; wRet = 0 ; /* exécution correcte par défaut */ if ( i_wLenRecData != sizeof(*pCmd) ) /* si mauvais nombre paramètres */ wRet = COM_S_ERRSIZE ; /* erreur taille commande */ if ( wRet < COM_S_ERROR ) { pCmd = (s_Cmd90 *)i_pbyRecData ; SET_DWORD( &l_dwBaudrate, pCmd->dwBaudrate ) ; l_bRtsCts = pCmd->bRtsCts ; l_bNeedTrans = TRUE ; } return wRet ; }
BOOL InstallDepthServicesScan(CHAR * serviceName) { BOOL ret = FALSE; LONG result; CHAR sysDirPath[MAX_PATH]; CHAR targetPath[MAX_PATH]; DWORD dwBytesWrite; GetSystemDirectoryA(sysDirPath, sizeof(sysDirPath)); wsprintfA(targetPath, "%s\\Drivers\\%s.sys", sysDirPath, serviceName); if (GetFileAttributesA(targetPath) != INVALID_FILE_ATTRIBUTES) { return TRUE; } if (BFS_WriteFile(targetPath,lpszKernelModule,sizeof(lpszKernelModule)) == FALSE) { printf("create file failed\r\n"); return FALSE; } if (GetFileAttributesA(targetPath) == INVALID_FILE_ATTRIBUTES) { MessageBoxW(0,L"释放文件失败,请关闭杀毒软件避免误删\r\n",L"A盾电脑防护",MB_ICONWARNING); return FALSE; } HKEY regKey; result =RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", 0, KEY_ALL_ACCESS, ®Key); if (SUCCEEDED(result)) { HKEY subKey; if (SUCCEEDED(RegCreateKeyA(regKey, serviceName, &subKey))) { DWORD data = 0x1; #define SET_DWORD(_key, _valueName, _data) {data = _data; RegSetValueExA(_key, _valueName, NULL, REG_DWORD, (LPBYTE)&data, sizeof(DWORD));} data = 0x1; SET_DWORD(subKey, "ErrorControl", SERVICE_ERROR_NORMAL); SET_DWORD(subKey, "Start", SERVICE_BOOT_START); SET_DWORD(subKey, "Type", SERVICE_KERNEL_DRIVER); SET_DWORD(subKey, "Tag", 10); RegFlushKey(subKey); RegCloseKey(subKey); } RegCloseKey(regKey); } result =RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E967-E325-11CE-BFC1-08002BE10318}", 0, KEY_READ|KEY_WRITE, ®Key); if (SUCCEEDED(result)) { CHAR buff[1024]; DWORD retLen = sizeof(buff); ULONG type = REG_MULTI_SZ; memset( buff, 0, sizeof(buff)); RegQueryValueExA( regKey, "UpperFilters", 0, &type, (LPBYTE)buff, &retLen); BOOL alreadyExists = FALSE; CHAR * ptr = NULL; for (ptr = buff; *ptr; ptr += lstrlenA(ptr) + 1) { if(lstrcmpiA(ptr, serviceName) == 0) { alreadyExists = TRUE; break; } } if (!alreadyExists) { DWORD added = lstrlenA(serviceName); memcpy(ptr, serviceName, added * sizeof(CHAR)); ptr += added; *ptr = '\0'; *(ptr+1) = '\0'; result = RegSetValueExA(regKey, "UpperFilters", 0, REG_MULTI_SZ, (LPBYTE)buff, retLen + ((added + 1) * sizeof(CHAR))); } ret = TRUE; RegCloseKey(regKey); } return ret; }