This can be done probably by reading the ico file using the
Code: CPP
//Create the file
hFile = CreateFile(L"PathToIconFile", GENERIC_READ,
// 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,
        (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.