1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Editing desktop icons text

Discussion in 'C, C++, C#' started by zorro59, Sep 20, 2011.

  1. zorro59

    zorro59 Newbie

    Joined:
    Sep 20, 2011
    Messages:
    4
    Likes Received:
    1
    So here is what i got (code not 100% mine):
    Code:
    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);
    	process=OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|
    		PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, pid);
    
    	_lvi=(LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM),
    		MEM_COMMIT, PAGE_READWRITE);
    	_item=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT,
    		PAGE_READWRITE);
    
    	lvi.iSubItem=0;
    	lvi.pszText=_item;
    
    	for(i=0; i<count; i++) 
    	{
    		strcpy(item, "Hacked by zoro59");
    		lvi.cchTextMax=NULL;
    		WriteProcessMemory(process, _item, &item, sizeof(char[512]), NULL);		
    		WriteProcessMemory(process, _lvi, &lvi, sizeof(LVITEM), NULL);
    		SendMessage(task, LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)_lvi);
    
    		lvi.cchTextMax=512;
    		WriteProcessMemory(process, _lvi, &lvi, sizeof(LVITEM), NULL);
    		SendMessage(task, LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)_lvi);
    		ReadProcessMemory(process, _item, item, 512, NULL);
    
    		printf("%s\n", 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.
    Can anyone please help me?
     
  2. Chris22

    Chris22 Regular Member

    Joined:
    Sep 29, 2010
    Messages:
    400
    Likes Received:
    1,059
    Have you tried using the PROCESS_ALL_ACCESS flag in your OpenProcess call?
     
  3. zorro59

    zorro59 Newbie

    Joined:
    Sep 20, 2011
    Messages:
    4
    Likes Received:
    1
    Tried that, no success.
    Maibe it has something to do with unicode? (i have multi byte set in my project).
     
    Last edited: Sep 23, 2011
  4. 4don4i

    4don4i Newbie

    Joined:
    Sep 23, 2011
    Messages:
    22
    Likes Received:
    1
    Maibe it has something to do with unicode?...need for moore researsh I thing.
     
  5. zorro59

    zorro59 Newbie

    Joined:
    Sep 20, 2011
    Messages:
    4
    Likes Received:
    1
    Its because of UIPI.
    Works on windows xp perfectly. Anyone knows a way to bypass UIPI?
     
  6. ~divinci

    ~divinci Registered Member

    Joined:
    Sep 23, 2009
    Messages:
    51
    Likes Received:
    11
    Occupation:
    Infastructure Reverse Engineer
    Location:
    Liverpool UK
    Does it even fail when running it as administrator?