This can be done probably by reading the ico file using the
Code: CPP
//Create the file
hFile = CreateFile(L"PathToIconFile", GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
// Read the bunary data of the file
ReadFile(hFile, lpBuffer, dwFileSize, &dwBytesRead, NULL)
then you can update the destination EXE as follow
Code: CPP
hResource = BeginUpdateResource(L"C:\\...\\t3.exe", FALSE);
if (NULL != hResource)
{
if (UpdateResource(hResource,
RT_ICON,
MAKEINTRESOURCE(1),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPVOID) lpBuffer,
dwFileSize) != FALSE)
{
EndUpdateResource(hResource, FALSE);
}
}
Note this is not working code but just providing hints as how this can be done. If you find something better do share with us.