All pastes #753638 Raw Edit

Unnamed

public c v1 · immutable
#753638 ·published 2007-10-29 12:14 UTC
rendered paste body
#include <windows.h>#include <commctrl.h>  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,    LPSTR lpCmdLine, int nCmdShow){         HWND WindowsMediaPlayer = FindWindow(NULL,"Windows Media Player");        if(!WindowsMediaPlayer)        {                MessageBox(NULL,"Error!","Windows Media Player not found!",MB_ICONEXCLAMATION);               return 0;        }        HWND WMPAppHost = FindWindowEx(WindowsMediaPlayer,NULL,"WMPAppHost",NULL);        if(!WMPAppHost)        {               MessageBox(NULL,"Error!","Control not found!",MB_ICONEXCLAMATION);                return 0;        }        HWND SkinHost = FindWindowEx(WMPAppHost,NULL,"WMP Skin Host",NULL);        if(!SkinHost)         {        MessageBox(NULL,"Error!","Skin Host not found!",MB_ICONEXCLAMATION);               return 0;        }        HWND irw = FindWindowEx(SkinHost,NULL,NULL,"LibraryContainer");     if(!irw)        {                MessageBox(NULL,"Error!","Library Container not found!",MB_ICONEXCLAMATION);                return 0;        }         HWND oi = FindWindowEx(irw,NULL,NULL,"BasketListView"); 		char stringBuff[20] ;		int listCount = ListView_GetItemCount(oi) ; 		itoa(listCount, stringBuff, 10) ;   	int count = (int)SendMessage(oi, LVM_GETITEMCOUNT, 0, 0);	 int i; 	 LVITEM lvi, *_lvi;	 char item[512], subitem[512];	 char *_item, *_subitem;	 unsigned long pid;	 HANDLE process; 	 GetWindowThreadProcessId(oi, &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);	 _subitem=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT,									PAGE_READWRITE); 	 lvi.cchTextMax=512; 	  i = 0;	  lvi.iSubItem=0;	  lvi.pszText=_item;	  WriteProcessMemory(process, _lvi, &lvi, sizeof(LVITEM), NULL);	  SendMessage(oi, LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)_lvi); 	  lvi.iSubItem=1;	  lvi.pszText=_subitem;	  WriteProcessMemory(process, _lvi, &lvi, sizeof(LVITEM), NULL);	  SendMessage(oi, LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)_lvi); 	  ReadProcessMemory(process, _item, item, 512, NULL);	  ReadProcessMemory(process, _subitem, subitem, 512, NULL); 	  printf("Getting song: %s",item);           return 0;}