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.

99 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. SierraCartRacing.cpp
  5. Abstract:
  6. A hack for Cart Racing (Sierra). They call InitializeSecurityDescriptor
  7. which trashes an old stack pointer which is later needed. They call
  8. CreateSemaphore with an invalid security descriptor:
  9. lpSemaphoreAttributes->lpSecurityDescriptor == 1
  10. This looks like a semaphore they use to prevent getting executed twice,
  11. Note, although it doesn't matter if the Semaphore doesn't get created,
  12. I thought it better if this worked.
  13. Fix:
  14. CreateSemaphore: set the security attributes to NULL (default)
  15. InitializeSecurityDescriptor: do nothing, since it's not needed anymore
  16. Notes:
  17. This is an app specific shim.
  18. History:
  19. 11/03/1999 linstev Created
  20. --*/
  21. #include "precomp.h"
  22. IMPLEMENT_SHIM_BEGIN(SierraCartRacing)
  23. #include "ShimHookMacro.h"
  24. APIHOOK_ENUM_BEGIN
  25. APIHOOK_ENUM_ENTRY(CreateSemaphoreA)
  26. APIHOOK_ENUM_ENTRY(InitializeSecurityDescriptor)
  27. APIHOOK_ENUM_END
  28. /*++
  29. Use the default security descriptor.
  30. --*/
  31. HANDLE
  32. APIHOOK(CreateSemaphoreA)(
  33. LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
  34. LONG lInitialCount,
  35. LONG lMaximumCount,
  36. LPCSTR lpName
  37. )
  38. {
  39. // Use default security descriptor
  40. return ORIGINAL_API(CreateSemaphoreA)(
  41. NULL,
  42. lInitialCount,
  43. lMaximumCount,
  44. lpName);
  45. }
  46. /*++
  47. Returns false for InitializeSecurityDescriptor. i.e. do nothing so we don't
  48. touch the stack.
  49. --*/
  50. BOOL
  51. APIHOOK(InitializeSecurityDescriptor)(
  52. PSECURITY_DESCRIPTOR pSecurityDescriptor,
  53. DWORD dwRevision
  54. )
  55. {
  56. return FALSE;
  57. }
  58. /*++
  59. Register hooked functions
  60. --*/
  61. HOOK_BEGIN
  62. APIHOOK_ENTRY(KERNEL32.DLL, CreateSemaphoreA)
  63. APIHOOK_ENTRY(ADVAPI32.DLL, InitializeSecurityDescriptor)
  64. HOOK_END
  65. IMPLEMENT_SHIM_END