Advertisement
Advertisement
| 07.22.2008 at 05:57AM PDT, ID: 23584904 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: |
HANDLE hProcess = 0;
POINT *ptVitual = 0;
char *ptTitle = 0;
DWORD wndThreadID;
DWORD pID;
int i;
char title[256];
HWND main = ::FindWindow("Progman", NULL);
HWND defView = ::FindWindowEx(main, NULL, "SHELLDLL_DefView", NULL);
HWND list = ::FindWindowEx(defView, NULL, "SysListView32", NULL);
wndThreadID = ::GetWindowThreadProcessId(list, &pID);
hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, pID);
ptTitle = (char *)VirtualAllocEx(hProcess, NULL, 256, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
ptVitual = (POINT *)VirtualAllocEx(hProcess, NULL, sizeof(POINT), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
CListCtrl mydesktop;
mydesktop.Attach(list);
int count = mydesktop.GetItemCount();
for(i = 0; i < count; i++) {
// read the item position (this is working)
mydesktop.GetItemPosition(x, ptVitual);
ReadProcessMemory(hProcess, ptVitual, &DesktopIcon.pt, sizeof(POINT), NULL);
// read the item text (not working)
mydesktop.GetItemText(x, 0, ptTitle, 255);
ReadProcessMemory(hProcess, ptTitle, &title, sizeof DesktopIcon.title, NULL);
// here there is a break to check the title variable content
}
mydesktop.Detach();
VirtualFreeEx(hProcess, ptTitle, 256, MEM_RELEASE);
VirtualFreeEx(hProcess, ptVitual, sizeof(POINT), MEM_RELEASE);
CloseHandle(hProcess);
fclose(file);
|