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.

68 lines
1.0 KiB

  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. // Security change - using strsafe.h
  16. #include "strsafe.h"
  17. IMPLEMENT_SHIM_BEGIN(TreasureCove)
  18. #include "ShimHookMacro.h"
  19. APIHOOK_ENUM_BEGIN
  20. APIHOOK_ENUM_ENTRY(_lopen)
  21. APIHOOK_ENUM_END
  22. /*++
  23. App requires this file to exist.
  24. --*/
  25. HFILE
  26. APIHOOK(_lopen)(
  27. LPCSTR lpPathName,
  28. int iReadWrite
  29. )
  30. {
  31. if (stristr(lpPathName, "midimap.cfg"))
  32. {
  33. return (HFILE)1;
  34. }
  35. else
  36. {
  37. return ORIGINAL_API(_lopen)(lpPathName, iReadWrite);
  38. }
  39. }
  40. /*++
  41. Register hooked functions
  42. --*/
  43. HOOK_BEGIN
  44. APIHOOK_ENTRY(KERNEL32.DLL,_lopen)
  45. HOOK_END
  46. IMPLEMENT_SHIM_END