能力值:
( LV4,RANK:40 )
|
-
-
2 楼
CString DECtoHEX(CString DEC)
{
//测试成功
CString HEX;
CHAR acTemp[16] = {0};
UINT uiCur = 0;
UINT uiLen = DEC.GetLength();
UINT uiLenTemp = 0;
UINT uiSpace = 0;
CHAR *pcChar = NULL;
CString strTemp;
CString strReturn(_T("\r\n"));
UINT ubReturn = 0;
pcChar = (CHAR*)(DEC.GetBuffer(0));
memset(acTemp, 0, sizeof(acTemp));
uiLenTemp = 0;
HEX = _T("");
while (uiCur < uiLen)
{
if (10 == *pcChar)
{
ubReturn = 1;
}
if (('0' <= *pcChar) && ('9' >= *pcChar) && (uiLenTemp < 10))
{
acTemp[uiLenTemp] = *pcChar;
uiLenTemp++;
pcChar++;
uiCur++;
if (uiCur < uiLen)
{
continue;
}
}
uiSpace++;
if ((uiSpace < m_uiBytesSet) && ((uiCur + 1) < uiLen))
{
pcChar++;
uiCur++;
continue;
}
if (0 != acTemp[0])
{
uiLenTemp = strtoul(acTemp, 0, 10);
strTemp.Format(_T("0x%x "), uiLenTemp);
HEX += strTemp;
}
uiSpace = 0;
memset(acTemp, 0, sizeof(acTemp));
uiLenTemp = 0;
strTemp.Empty();
uiCur++;
pcChar++;
if (1 == ubReturn)
{
HEX += strReturn;
ubReturn = 0;
}
}
return HEX;
}
CChocoDayDllApp theApp;
LRESULT CALLBACK Gameproc(
int code,
WPARAM wParam,//按键代码 END=23
LPARAM lParam
)
{
//添加其他的代码 比如说 按下end时 我们要做的事情
return CallNextHookEx(0,code,wParam,lParam);
}
//开始安装钩子
void SetHook()
{
//先来获取现在的进程ID
//定义这个ID
CString cs_dlln;
CString cs_gameID;
char ch_gameID[20];
DWORD GameID;
int ini_dlln;
int ini_calldll;
int ini_gameID;
int dlldec;//设置计次数
char ch_dlln[20];//配置项里的一共注入多少Dlll了
char ch_calldll[4];//配置项里的游戏是否已经注入CallDll
char ch_pit[20];//配置项里的游戏ID
//读配置项里的内容
ch_dlln=GetPrivateProfileString("GameNum","DLL","",ch_dlln,20,"C:\\WINDOWS\\BreChoco\\BreSet\\set.ini");
ini_dlln=_ttoi(ch_dlln);
dlldec=ini_dlln-0;
while(dlldec>0)
{
cs_dlln.Format("%d",dlldec);
GetPrivateProfileString(cs_dlln,"ProcessID","",ch_gameID,20,"C:\\WINDOWS\\BreChoco\\BreSet\\set.ini");
//写到转换
cs_gameID=CString(ch_gameID);
int ini_gameID=_ttoi(cs_gameID);
if(ini_gameID>100)
{
cs_gameID=DECtoHEX(cs_gameID);
AfxMessageBox(cs_gameID);
GetPrivateProfileString(cs_dlln,"CallDll","",ch_calldll,4,"C:\\WINDOWS\\BreChoco\\BreSet\\set.ini");
ini_calldll=_ttoi(ch_calldll);
if(ini_calldll==0)
{
//终于可以开始注入了
::SetWindowsHookEx(WH_KEYBOARD,&Gameproc,0,GameID);//最后一个参数为线程ID 也就是游戏ID
//GameID是应为16进制的
}
}
}
}
|
能力值:
( LV5,RANK:71 )
|
-
-
3 楼
strtol
itoa
|
能力值:
( LV2,RANK:10 )
|
-
-
4 楼
要么用atoi 要么自己写个函数
|
能力值:
( LV2,RANK:10 )
|
-
-
5 楼
void ITUNEHEX(char hex[],char* str){
const char* cHex = "0123456789ABCDEF";
int i = 7;
for(int j = 3; j >= 0; j--)
{
unsigned int a = (unsigned int) str[j];
hex[i--] = cHex[(a & 0x0f)];
hex[i--] = cHex[(a & 0xf0) >> 4];
}
hex[8] = '\0';
}
|
能力值:
( LV2,RANK:10 )
|
-
-
6 楼
_ttoi 不知道这个可以搞定不?
|