there are two parts to your question
1. Install the cab file ONLY on coldboot.
this you can achieve by determining the last boot sequence, using the following reg keys
RegOpenKeyEx(HKEY_CURRENT_USER, _T("Performance"), 0, 0,&hKey);
RegQueryValueEx(hKey, L"Last Boot Type", 0,&dwType, (LPBYTE)&dwRegData, &dwSize);
this value is 1 for cold boot, for warm boot this will be non-zero value
2. you could use the following code piece
lRet=RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0, 0,&hKey);
if(ERROR_SUCCESS == lRet)
{
dwRegData = 0;
RegSetValueEx(hKey, _T("UseStartImage"), 0, REG_DWORD,(BYTE*)&dwRegData,sizeof(DWORD));
wcscpy(szCmdLine, _T("/safe /noui /nouninstall /delete 0 "));
wcscat(szCmdLine, <name of the cab file>);
if(::CreateProcess(_T("\\Windows\\wceload.exe"),szCmdLine,NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
{
::WaitForSingleObject(pi.hProcess, INFINITE);
RegSetValueEx(hKey, _T("Skin"), 0, REG_SZ, (BYTE*)szNew,sizeof(TCHAR) * (wcslen(szNew) + 1));
RegCloseKey(hKey);
}
::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
}
}
I tried it and it works,
Sr.Engineer