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.

88 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. SirenJukebox2.cpp
  5. Abstract:
  6. This app has a problem with DirectDraw 7.0 and hence we fail the call to
  7. GetProcAddress when it asks for DirectDrawCreateEx.
  8. Notes:
  9. This is an app specific shim.
  10. History:
  11. 03/13/2001 prashkud Created
  12. 05/04/2001 prashkud Modified to fix a bug if ordinals are passed
  13. instead of string addresses. We now imitate
  14. the behaviour of the actual GetProcAddress().
  15. --*/
  16. #include "precomp.h"
  17. IMPLEMENT_SHIM_BEGIN(SirenJukebox2)
  18. #include "ShimHookMacro.h"
  19. APIHOOK_ENUM_BEGIN
  20. APIHOOK_ENUM_ENTRY(GetProcAddress)
  21. APIHOOK_ENUM_END
  22. const WCHAR wszDirectDrawCreateEx[] = L"DirectDrawCreateEx";
  23. /*++
  24. If the app is asking for the Proc adress for DirectDrawCreateEx, then return
  25. NULL.
  26. --*/
  27. FARPROC
  28. APIHOOK(GetProcAddress)(
  29. HMODULE hMod,
  30. LPCSTR lpProcName
  31. )
  32. {
  33. CSTRING_TRY
  34. {
  35. //
  36. // Check to see if lpProcName contains an ordinal value.
  37. // Only the low word can contain the ordinal and the
  38. // upper word has to be 0's.
  39. //
  40. if ((ULONG_PTR) lpProcName > 0xffff)
  41. {
  42. CString csProcName(lpProcName);
  43. if (csProcName.CompareNoCase(wszDirectDrawCreateEx) == 0)
  44. {
  45. return NULL;
  46. }
  47. }
  48. }
  49. CSTRING_CATCH
  50. {
  51. // Do Nothing
  52. }
  53. return ORIGINAL_API(GetProcAddress)(hMod, lpProcName);
  54. }
  55. /*++
  56. Register hooked functions
  57. --*/
  58. HOOK_BEGIN
  59. APIHOOK_ENTRY(KERNEL32.DLL, GetProcAddress)
  60. HOOK_END
  61. IMPLEMENT_SHIM_END