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.

96 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. CoffeeCupHTMLEditor.cpp
  5. Abstract:
  6. This app implicitly loads a DLL whose linkage is not found and the loader
  7. comes up with a message box.
  8. Notes:
  9. This is specific to this app.
  10. History:
  11. 11/21/2000 prashkud Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(CoffeeCupHTMLEditor)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(CreateProcessA)
  18. APIHOOK_ENUM_END
  19. /*++
  20. This function hooks CreateProcessA and checks the COMMAND_LINE. If the commandline has
  21. %systemdir%\lftif90n.dll.
  22. --*/
  23. BOOL
  24. APIHOOK(CreateProcessA)(
  25. LPCSTR lpApplicationName, // name of executable module
  26. LPSTR lpCommandLine, // command line string
  27. LPSECURITY_ATTRIBUTES lpProcessAttributes, // SD
  28. LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
  29. BOOL bInheritHandles, // handle inheritance option
  30. DWORD dwCreationFlags, // creation flags
  31. LPVOID lpEnvironment, // new environment block
  32. LPCSTR lpCurrentDirectory, // current directory name
  33. LPSTARTUPINFOA lpStartupInfo, // startup information
  34. LPPROCESS_INFORMATION lpProcessInformation // process information
  35. )
  36. {
  37. CSTRING_TRY
  38. {
  39. CString csIgnoreDLL;
  40. csIgnoreDLL.GetSystemDirectoryW();
  41. csIgnoreDLL.AppendPath(L"lftif90n.dll");
  42. CString csCl(lpCommandLine);
  43. if (csCl.Find(csIgnoreDLL) >= 0)
  44. {
  45. return TRUE;
  46. }
  47. }
  48. CSTRING_CATCH
  49. {
  50. // Do nothing
  51. }
  52. return ORIGINAL_API(CreateProcessA)(
  53. lpApplicationName,
  54. lpCommandLine,
  55. lpProcessAttributes,
  56. lpThreadAttributes,
  57. bInheritHandles,
  58. dwCreationFlags,
  59. lpEnvironment,
  60. lpCurrentDirectory,
  61. lpStartupInfo,
  62. lpProcessInformation);
  63. }
  64. /*++
  65. Register hooked functions
  66. --*/
  67. HOOK_BEGIN
  68. APIHOOK_ENTRY(KERNEL32.DLL, CreateProcessA)
  69. HOOK_END
  70. IMPLEMENT_SHIM_END