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.

136 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. Britannica2001.cpp
  5. Abstract:
  6. Britannica expects IE 5 install to install msjavx86.exe
  7. which doesn't happen if a newer version of IE is already there.
  8. Notes:
  9. This is an app specific shim.
  10. History:
  11. 05/31/2001 mnikkel Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(Britannica2001)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(CreateProcessA)
  18. APIHOOK_ENUM_END
  19. /*++
  20. Check CreateProcessA for execution of ie5wzdex.exe, when this
  21. occurs, run msjavx86.exe.
  22. --*/
  23. BOOL
  24. APIHOOK(CreateProcessA)(
  25. LPCSTR lpApplicationName,
  26. LPSTR lpCommandLine,
  27. LPSECURITY_ATTRIBUTES lpProcessAttributes,
  28. LPSECURITY_ATTRIBUTES lpThreadAttributes,
  29. BOOL bInheritHandles,
  30. DWORD dwCreationFlags,
  31. LPVOID lpEnvironment,
  32. LPCSTR lpCurrentDirectory,
  33. LPSTARTUPINFOA lpStartupInfo,
  34. LPPROCESS_INFORMATION lpProcessInformation
  35. )
  36. {
  37. DPFN( eDbgLevelSpew, "[CreateProcessA] appname:(%s)\ncommandline:(%s)", lpApplicationName, lpCommandLine );
  38. //
  39. // Call the original API
  40. //
  41. BOOL bRet= ORIGINAL_API(CreateProcessA)(lpApplicationName,
  42. lpCommandLine,
  43. lpProcessAttributes,
  44. lpThreadAttributes,
  45. bInheritHandles,
  46. dwCreationFlags,
  47. lpEnvironment,
  48. lpCurrentDirectory,
  49. lpStartupInfo,
  50. lpProcessInformation);
  51. // wait for original API to finish
  52. if (bRet)
  53. {
  54. WaitForSingleObject( lpProcessInformation->hProcess, INFINITE);
  55. }
  56. // Check for <ie5wzd /S:\"> and if found run msjavx86.exe in quiet mode
  57. if (lpCommandLine)
  58. {
  59. CSTRING_TRY
  60. {
  61. CString csCL(lpCommandLine);
  62. int nLoc = csCL.Find(L"ie5wzd /S:\"");
  63. if ( nLoc > -1 )
  64. {
  65. PROCESS_INFORMATION processInfo;
  66. CString csNew = csCL.Mid(nLoc+11, 3);
  67. csNew += L"javavm\\msjavx86.exe /Q:A /R:N";
  68. DPFN( eDbgLevelError, "[CreateProcessA] starting %S", csNew.Get() );
  69. BOOL bRet2= CreateProcessA(NULL,
  70. csNew.GetAnsi(),
  71. NULL,
  72. NULL,
  73. FALSE,
  74. 0,
  75. NULL,
  76. NULL,
  77. lpStartupInfo,
  78. &processInfo);
  79. if (bRet2)
  80. {
  81. WaitForSingleObject( processInfo.hProcess, INFINITE);
  82. }
  83. }
  84. }
  85. CSTRING_CATCH
  86. {
  87. // Do Nothing
  88. }
  89. }
  90. return bRet;
  91. }
  92. /*++
  93. Register hooked functions
  94. --*/
  95. HOOK_BEGIN
  96. APIHOOK_ENTRY(KERNEL32.DLL, CreateProcessA)
  97. HOOK_END
  98. IMPLEMENT_SHIM_END