程序使用以下類似代碼實現多開限制
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, "This program check for other Instance!");
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
//将程序切换到前台
}
彙編代碼如下:
00543CCB > /68 78D75500 PUSH msnmsgr.0055D778 ; /EventName = "MSNMSGR"
00543CD0 . |57 PUSH EDI ; |InitiallySignaled
00543CD1 . |6A 01 PUSH 1 ; |ManualReset = TRUE
00543CD3 . |57 PUSH EDI ; |pSecurity
00543CD4 . |FF15 3C144000 CALL DWORD PTR DS:[<&KERNEL32.CreateEven>; \CreateEventA
00543CDA . |3BC7 CMP EAX,EDI
00543CDC . |8B5D E8 MOV EBX,DWORD PTR SS:[EBP-18]
00543CDF . |8943 24 MOV DWORD PTR DS:[EBX+24],EAX
00543CE2 . |0F84 EA4B0000 JE msnmsgr.005488D2
00543CE8 . |FF15 8C154000 CALL DWORD PTR DS:[<&KERNEL32.GetLastErr>; [GetLastError
00543CEE . |3D B7000000 CMP EAX,0B7
00543CF3 . |0F84 2F4B0000 JE msnmsgr.00548828
當GetLastError返回0B7時就代表捕捉到了ERROR_ALREADY_EXISTS錯誤
就無法多開了!
爆破方法:將最後一行JE msnmsgr.00548828 全部NOP掉就行了!
試試看吧!