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.

67 lines
946 B

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. TreasureCove.cpp
  5. Abstract:
  6. This SHIM hooks _lopen and fakes the opening of the file when the file is
  7. "midimap.cfg".
  8. Notes:
  9. This is an app specific shim.
  10. History:
  11. 12/14/00 prashkud Created
  12. --*/
  13. #include "precomp.h"
  14. // This module has been given an official blessing to use the str routines.
  15. #include "LegalStr.h"
  16. IMPLEMENT_SHIM_BEGIN(TreasureCove)
  17. #include "ShimHookMacro.h"
  18. APIHOOK_ENUM_BEGIN
  19. APIHOOK_ENUM_ENTRY(_lopen)
  20. APIHOOK_ENUM_END
  21. /*++
  22. App requires this file to exist.
  23. --*/
  24. HFILE
  25. APIHOOK(_lopen)(
  26. LPCSTR lpPathName,
  27. int iReadWrite
  28. )
  29. {
  30. if (stristr(lpPathName, "midimap.cfg"))
  31. {
  32. return (HFILE)1;
  33. }
  34. else
  35. {
  36. return ORIGINAL_API(_lopen)(lpPathName, iReadWrite);
  37. }
  38. }
  39. /*++
  40. Register hooked functions
  41. --*/
  42. HOOK_BEGIN
  43. APIHOOK_ENTRY(KERNEL32.DLL,_lopen)
  44. HOOK_END
  45. IMPLEMENT_SHIM_END