[Advanced]Editing desktop icons text

So here is what i got (code not 100% mine):
int main()
    HWND task;
    task = FindWindow(NULL, TEXT("Program Manager"));
    task = FindWindowEx(task, NULL, TEXT("SHELLDLL_DefView"), NULL);
    task = FindWindowEx(task, NULL, NULL, TEXT("FolderView"));

    int count=(int)SendMessage(task, LVM_GETITEMCOUNT, 0, 0);
    int i;

    LVITEM lvi, *_lvi;
    char item[512], *_item;

    unsigned long pid;
    HANDLE process;

    GetWindowThreadProcessId(task, &pid);

    _lvi=(LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM),
    _item=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT,


    for(i=0; i<count; i++)
        strcpy(item, "Hacked by zoro59");
        WriteProcessMemory(process, _item, &item, sizeof(char[512]), NULL);       
        WriteProcessMemory(process, _lvi, &lvi, sizeof(LVITEM), NULL);
        SendMessage(task, LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)_lvi);

        WriteProcessMemory(process, _lvi, &lvi, sizeof(LVITEM), NULL);
        SendMessage(task, LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)_lvi);
        ReadProcessMemory(process, _item, item, 512, NULL);

        printf("%sn", item);

    VirtualFreeEx(process, _lvi, 0, MEM_RELEASE);
    VirtualFreeEx(process, _item, 0, MEM_RELEASE);

    return 0;


This section works great when it has to read the data, but fails to change it. Things i’ve tried: adding MEM_RESERVE flag, using lvi.pszText = “smth”, writing the data directly into “process”, without using another variable, but it all failed.

We will be happy to hear your thoughts

Leave a reply