fenix01/cheatengine-library

fenix01, please help me

YtsgKzk opened this issue · 3 comments

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;
}

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 ?

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?

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

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

  • the first parameter is the index of an address returned by the scanner (it's like an arraylist and starts from 0)
  • this parameter represents an address associated with an entry of the arraylist (it's a pointer on a BSTR variable : for instance it filled your BSTR with the string representation of 0x4000000
  • this parameter represents the value associated with 0x4000000. It's also a pointer on a BSTR.