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.

86 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. RemoveIpFromMsInfoCommandLine.cpp
  5. Abstract:
  6. Microsoft Streets & Trips 2000 specific hack. removing /p option when it
  7. calls msinfo: Bug #30531
  8. Notes:
  9. This is a general purpose shim.
  10. History:
  11. 02/23/2000 jarbats Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(RemoveIpFromMsInfoCommandLine)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(CreateProcessW)
  18. APIHOOK_ENUM_END
  19. BOOL
  20. APIHOOK(CreateProcessW)(
  21. LPCWSTR lpApplicationName,
  22. LPWSTR lpCommandLine,
  23. LPSECURITY_ATTRIBUTES lpProcessAttributes,
  24. LPSECURITY_ATTRIBUTES lpThreadAttributes,
  25. BOOL bInheritHandles,
  26. DWORD dwCreationFlags,
  27. LPVOID lpEnvironment,
  28. LPWSTR lpCurrentDirectory,
  29. LPSTARTUPINFOW lpStartupInfo,
  30. LPPROCESS_INFORMATION lpProcessInformation
  31. )
  32. {
  33. WCHAR *szTemp = NULL;
  34. if (lpCommandLine && wcsistr(lpCommandLine, L"msinfo32.exe"))
  35. {
  36. szTemp = wcsistr(lpCommandLine, L"/p");
  37. if (NULL != szTemp)
  38. {
  39. *szTemp ++ = L' ';
  40. *szTemp = L' ';
  41. }
  42. }
  43. return ORIGINAL_API(CreateProcessW)(
  44. lpApplicationName,
  45. lpCommandLine,
  46. lpProcessAttributes,
  47. lpThreadAttributes,
  48. bInheritHandles,
  49. dwCreationFlags,
  50. lpEnvironment,
  51. lpCurrentDirectory,
  52. lpStartupInfo,
  53. lpProcessInformation);
  54. }
  55. /*++
  56. Register hooked functions
  57. --*/
  58. HOOK_BEGIN
  59. APIHOOK_ENTRY(KERNEL32.DLL, CreateProcessW)
  60. HOOK_END
  61. IMPLEMENT_SHIM_END