Source code of Windows XP (NT5)
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.

115 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. ExchangeServerSetup.cpp
  5. Abstract:
  6. This is a non-reusable patch for Exchange Server Setup 5.5 for SP2 and SP3
  7. to change the parameters passed to xcopy. The reason for that is that
  8. Win2k's xcopy doesn't have the /y parameter a default parameter.
  9. Notes:
  10. This is an app specific shim.
  11. History:
  12. 02/16/2000 clupu Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(ExchangeServerSetup)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_ENTRY(CreateProcessW)
  19. APIHOOK_ENUM_END
  20. /*++
  21. Change the parameters passed to xcopy.
  22. --*/
  23. BOOL
  24. APIHOOK(CreateProcessW)(
  25. LPWSTR lpApplicationName,
  26. LPWSTR lpCommandLine,
  27. LPSECURITY_ATTRIBUTES lpProcessAttributes,
  28. LPSECURITY_ATTRIBUTES lpThreadAttributes,
  29. BOOL bInheritHandles,
  30. DWORD dwCreationFlags,
  31. LPVOID lpEnvironment,
  32. LPWSTR lpCurrentDirectory,
  33. LPSTARTUPINFOW lpStartupInfo,
  34. LPPROCESS_INFORMATION lpProcessInformation
  35. )
  36. {
  37. BOOL bRet;
  38. if (lpCommandLine != NULL) {
  39. int cbSize = lstrlenW(lpCommandLine);
  40. WCHAR ch;
  41. if (cbSize > 12) {
  42. DPFN(
  43. eDbgLevelInfo,
  44. "[CreateProcessW] for \"%ws\".\n",
  45. lpCommandLine);
  46. ch = lpCommandLine[11];
  47. lpCommandLine[11] = 0;
  48. if (lstrcmpiW(lpCommandLine, L"xcopy /s /e") == 0) {
  49. lstrcpyW(lpCommandLine, L"xcopy /sye ");
  50. lpCommandLine[11] = ch;
  51. DPFN(
  52. eDbgLevelInfo,
  53. "[CreateProcessW] changed to \"%ws\".\n",
  54. lpCommandLine);
  55. } else {
  56. lpCommandLine[11] = ch;
  57. }
  58. }
  59. }
  60. bRet = ORIGINAL_API(CreateProcessW)(
  61. lpApplicationName,
  62. lpCommandLine,
  63. lpProcessAttributes,
  64. lpThreadAttributes,
  65. bInheritHandles,
  66. dwCreationFlags,
  67. lpEnvironment,
  68. lpCurrentDirectory,
  69. lpStartupInfo,
  70. lpProcessInformation);
  71. return bRet;
  72. }
  73. /*++
  74. Register hooked functions
  75. --*/
  76. HOOK_BEGIN
  77. APIHOOK_ENTRY(KERNEL32.DLL, CreateProcessW)
  78. HOOK_END
  79. IMPLEMENT_SHIM_END