Thanks you so much Galik. I didn't initialize my pointer, so now I' ve done and this is my code working:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
char* _stdcall ReadString(char *window, int Point, int Len)
{
//char *value = (char*)malloc(Len+1) = {0};
char value[8] = {0};
HWND hWnd = FindWindow(NULL, window);
DWORD proc_id;
GetWindowThreadProcessId(hWnd, &proc_id);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, proc_id);
BOOL bReturn = ReadProcessMemory(hProcess, (LPVOID)Point, &value, 7, 0);
if ( bReturn == 0 )
{
DWORD lastError = GetLastError();
// error
}
else
{
// success
return value;
}
}
| |
I had tried to compare my 2 values 3 days ago using strcmp, but it was not working because the readprocessmemory was wrong... Now it is reading the correct value, and I'm trying to make a routine to find a text value from visual basic. This is what i've done:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
int _stdcall SearchString(char *window, char *Text)
{
long int x;
for(x = 0; x < 80000000; x++) // This is a fucking disaster
{
if (strcmp(ReadString(window, x, sizeof(Text)), Text) == 0)
{
return x;
}
}
return 0;
}
| |
That routine, i will call through vb6, with the window name and the text to search. I don't know why but it still not working properly. And I know there's a way to get the base address of a process to start searching since it like 0x40000000 but it changes on Windows 7 or Windows Vista, so i guess mi app will crash and will not work properly.
That routine, i will call through vb6, with the window name and the text to search. I don't know why but it still not working properly. And I know there's a way to get the base address of a process to start searching since it like 0x40000000 but it changes on Windows 7 or Windows Vista, so i guess mi app will crash and will not work properly.
I've tried an example with apis but it gives me errors. And also search examples for EnumProcessModules and those apis but they only work on 32bits.
Thank you again. I'll continue trying to improve and fix my routine. If anyone know how to fix it, thanks again.
Regards