Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.1 KiB

  1. #include "pch.h"
  2. /////////////////////////////////////////////////////////////////////////////
  3. // ChannelsFinalCopy
  4. HRESULT ChannelsFinalCopy(LPCTSTR pcszDestDir, DWORD dwFlags, LPDWORD pdwCabState)
  5. {
  6. TCHAR szChlsWrkDir[MAX_PATH],
  7. szWrkChlsInf[MAX_PATH];
  8. PathCombine(szChlsWrkDir, g_szWorkDir, TEXT("channels.wrk"));
  9. PathCombine(szWrkChlsInf, szChlsWrkDir, TEXT("ie4chnls.inf"));
  10. if (HasFlag(dwFlags, PM_CHECK) && pdwCabState != NULL)
  11. {
  12. if (PathFileExists(szWrkChlsInf))
  13. SetFlag(pdwCabState, CAB_TYPE_CONFIG);
  14. if (!PathIsEmptyPath(szChlsWrkDir, FILES_ONLY, szWrkChlsInf))
  15. SetFlag(pdwCabState, CAB_TYPE_DESKTOP);
  16. }
  17. // note: we are depending on copyfile to fail here if szWrkChlsInf
  18. // does not exist so we don't clobber szTo
  19. if (HasFlag(dwFlags, PM_COPY))
  20. {
  21. TCHAR szTo[MAX_PATH];
  22. // delete the ie4chnls.inf from the branding cab
  23. DeleteFileInDir(szWrkChlsInf, pcszDestDir);
  24. // put ie4chnls.inf in branding.cab for IE4 support
  25. if (PathFileExists(szWrkChlsInf))
  26. {
  27. CopyFileToDir(szWrkChlsInf, pcszDestDir);
  28. DeleteFile(szWrkChlsInf);
  29. }
  30. // move all the remaining files to pcszDestDir\"desktop"
  31. PathCombine(szTo, pcszDestDir, TEXT("desktop"));
  32. CopyFileToDir(szChlsWrkDir, szTo);
  33. }
  34. if (HasFlag(dwFlags, PM_CLEAR))
  35. PathRemovePath(szChlsWrkDir);
  36. return S_OK;
  37. }
  38. void HandleChannelsDeletion(LPCTSTR pszChlInf)
  39. // Note. iMode == 1 means remove Channels, iMode == 2 means remove Software Updates, otherwise remove all;
  40. {
  41. static const TCHAR c_szInfCleanUpAll[] = TEXT("HKCU,\"%CleanKey%\\ieakCleanUp\",,,\r\n");
  42. HANDLE hInf;
  43. hInf = CreateFile(pszChlInf, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
  44. if (hInf == INVALID_HANDLE_VALUE)
  45. return;
  46. SetFilePointer(hInf, 0, NULL, FILE_END);
  47. WriteStringToFile(hInf, c_szInfCleanUpAll, StrLen(c_szInfCleanUpAll));
  48. CloseHandle(hInf);
  49. }