fenix01 / cheatengine-library

Cheat Engine Library is based on CheatEngine a debugger and coding environment particularly aimed at games, but can also be used for other purposes like debugging applications and used in schools for teaching how computers work
259 stars 79 forks source link

fenix01, please help me #6

Closed YtsgKzk closed 8 years ago

YtsgKzk commented 8 years ago

I have write code like below, but iCountAddressesFound() still return 0. But when i try to use cheatengine, it show 27 found address. Why is that?

bool sSCAN::FirstScan() { bool _stat= false; BSTR l_pid= ::SysAllocString(L"000002F0"); TScanOption scanOption= soExactValue; TVariableType variableType= vtDword; TRoundingType roundingtype= rtRounded; BSTR scanvalue1= ::SysAllocString(L"100"); BSTR scanvalue2= ::SysAllocString(L""); BSTR startaddress = ::SysAllocString(L"$00000000"); BSTR stopaddress = ::SysAllocString(L"$7fffffff"); bool hexadecimal= false; bool binaryStringAsDecimal= false; bool unicode= false; bool casesensitive= false; TFastScanMethod fastscanmethod= fsmNotAligned; BSTR fastscanparameter= ::SysAllocString(L"4");

    iOpenProcess(l_pid);
    iInitMemoryScanner((HWND)GetCurrentProcess());
    iConfigScanner(scanInclude, scanDontCare, scanExclude);
    iFirstScan(scanOption, variableType,
        roundingtype, scanvalue1, scanvalue2,
        startaddress, stopaddress, hexadecimal, binaryStringAsDecimal,
        unicode, casesensitive, fastscanmethod,
        fastscanparameter);
    stat= 2;

    _exit:
    ::SysFreeString(l_pid);
    ::SysFreeString(scanvalue1);
    ::SysFreeString(scanvalue2);
    ::SysFreeString(startaddress);
    ::SysFreeString(stopaddress);
    ::SysFreeString(fastscanparameter);
    return _stat;
}
fenix01 commented 8 years ago

Hi ! Sorry for this late answer :s I was in holydays during all the week and I didn't find the time to answer.

I don't know exactly where the problem come from but you could make these verifications. 1) These values are statics or dynamics ? 2) Does it work for another value ? 3) Is your program protected by any anti-cheat software ?

YtsgKzk commented 8 years ago

Thank you, but It is solved now. Because i ask value from ICountAddressesFound() to early. Then i read a bit from your c# example, that it wait for WM_APP + 2 first before calling.

But now i have another problem. I hope you can help me. The documentation about IGetAddress(Qword index, out String address, out String value). How to use that function?

fenix01 commented 8 years ago

Yes, you have to call ICountAddressesFound inside the callback function ^^

If you are programming in c++, you have to call IGetAddress in this way :