Who knows this is the real dude !!!!!!!!!!!!!!!!!!!!!!

This is a discussion on Who knows this is the real dude !!!!!!!!!!!!!!!!!!!!!! within the Windows Programming forums, part of the Platform Specific Boards category; Who can make me this function is the man ! void SetIcon(char *exesource,int icon,char *exedest) { } I want a ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    18

    Question Who knows this is the real dude !!!!!!!!!!!!!!!!!!!!!!

    Who can make me this function is the man !
    void SetIcon(char *exesource,int icon,char *exedest)
    {
    }
    I want a function to replace an executable`s icon with an icon i tell him from another executable !
    SetIcon("c:\\windows\\calc.exe",1,"c:\\windows\\no tepad.exe")
    to make notepad.exe look like calc.exe !
    What would this world be without some1 to break into your comuter or crack your software !????

  2. #2
    Mox
    Mox is offline
    Registered User
    Join Date
    Aug 2001
    Posts
    41
    You've made me curious. I tried and found some things out...
    You can do this (I think) if you're running windows NT 3.1 or later. Not 9X. And because I have 98 I can't try it. But you can use UpdateResource, BeginUpdateResource and EndUpdateResource for NT. This is my quick code (haven't been able to try it, for I haven't got NT...):
    Code:
    BOOL CALLBACK enumProc(HMODULE  hModule,	// resource-module handle 
        LPCTSTR  lpszType,	// address of resource type 
        LPTSTR  lpszName,	// address of resource name 
        LONG  lParam 	// application-defined parameter  
       )
    {
    	if ((long)lpszName < *(long *)lParam)
    		*(long *)lParam = (long)lpszName;
    	
    	return true;
    }
    
    int iconChange(char * srcFile, char * dstFile)
    {
    	DWORD lowest1 = 0x0FFFFFFF;
    	DWORD lowest2 = 0x0FFFFFFF;
    
    	HMODULE hFile1 = LoadLibrary(srcFile);
    	HMODULE hFile2 = LoadLibrary(dstFile);
    
    	EnumResourceNames(hFile1, RT_ICON, enumProc, (long)&lowest1);
    	EnumResourceNames(hFile2, RT_ICON, enumProc, (long)&lowest2);
    
    	HRSRC	hRes = FindResource(hFile1, MAKEINTRESOURCE(lowest1), RT_ICON);
    
    	char * data = LockResource(hRes);
    
    	HANDLE hUpdate =	BeginUpdateResource(dstFile, false);
    
    	UpdateResource(hUpdate, RT_ICON, MAKEINTRESOURCE(lowest2), 
    					MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
    					(void *)data, SizeofResource(hFile1, hRes));
    
    	EndUpdateResource(hUpdate, false);
    
    	FreeLibrary(hFile1);
    	FreeLibrary(hFile2);
    
    	return 0;
    }
    I've put in the enum to get the lowest icon (I think that's the one thats the actual icon for a app).

    You can try this, if you have NT (tell me if it works )

    Joren

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    18

    thanks a lot

    i`ve got win2000 and i`ll try it today !
    thanks a lot !
    What would this world be without some1 to break into your comuter or crack your software !????

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,853
    Have you looked at SetClassLong() & GCL_ICON?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    18

    Unhappy nope

    i want to change the icon of the executable not the one in the titlebar !
    ......
    and write it in the end of the destination file !

  6. #6
    Mox
    Mox is offline
    Registered User
    Join Date
    Aug 2001
    Posts
    41
    Well then, have you tried my method yet, because it should adjust the resource file in the exe file and therefor the exe itself
    Don't know if it works though... (tell me )

    Joren

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,853
    Ahhh,
    now I understand.

    You want to change the icon on the desktop so it runs YOUR exe not the one that it was set to run when created.

    WHY?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  8. #8
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Reply

    *cough* *cough* virus *cough*
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  9. #9
    Registered User
    Join Date
    Nov 2001
    Posts
    18

    nope

    Originally posted by Mox
    Well then, have you tried my method yet, because it should adjust the resource file in the exe file and therefor the exe itself
    Don't know if it works though... (tell me )

    Joren

    it doesn`t work !
    modified it a little .... still doesn`t work !
    What would this world be without some1 to break into your comuter or crack your software !????

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. %16 with double
    By spank in forum C Programming
    Replies: 11
    Last Post: 03-05-2006, 09:10 PM
  2. Programming Puns
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 44
    Last Post: 03-23-2002, 03:38 PM
  3. Replies: 7
    Last Post: 12-12-2001, 09:28 AM
  4. Who knows this ... is the real dude !
    By tomkat in forum C Programming
    Replies: 1
    Last Post: 11-02-2001, 05:52 PM
  5. Who knows this ... is the real dude !!!!!!!!!
    By tomkat in forum Windows Programming
    Replies: 0
    Last Post: 11-02-2001, 05:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21