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.

98 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. BaanERP5c.cpp
  5. Abstract:
  6. The app sets the SharedSection in Windows Value under the key
  7. HKLM\System\CCS\Control\Session Manger\SubSystems to 4096
  8. from the one that is exisiting in registry. But this is resulting
  9. in failure of the BannLogicService and BaanSharedMemroy
  10. services when they are started.
  11. This shim hooks the RegSetValueExA and returns SUCCESS
  12. without setting the value in registry if the app is trying to set the
  13. HKLM\\System\CCS\Control\Session Manager\SubSystems\Windows
  14. value from *SharedSection=####,####,512,* to *SharedSection=####,####,4096,*
  15. Notes:
  16. This is an app specific shim.
  17. History:
  18. 02/09/2001 a-leelat Created
  19. --*/
  20. #include "precomp.h"
  21. IMPLEMENT_SHIM_BEGIN(BaanERP5c)
  22. #include "ShimHookMacro.h"
  23. APIHOOK_ENUM_BEGIN
  24. APIHOOK_ENUM_ENTRY(RegSetValueExA)
  25. APIHOOK_ENUM_END
  26. LONG
  27. APIHOOK(RegSetValueExA)(
  28. HKEY hKey,
  29. LPCSTR lpValueName,
  30. DWORD Reserved,
  31. DWORD dwType,
  32. CONST BYTE * lpData,
  33. DWORD cbData
  34. )
  35. {
  36. CSTRING_TRY
  37. {
  38. CString csValueName(lpValueName);
  39. if (csValueName.CompareNoCase(L"Windows") == 0 )
  40. {
  41. LPSTR lpszData = (LPSTR)lpData;
  42. CString csData(lpszData);
  43. if (csData.Find(L"4096") >= 0)
  44. {
  45. return ERROR_SUCCESS;
  46. }
  47. }
  48. }
  49. CSTRING_CATCH
  50. {
  51. // Do nothing
  52. }
  53. return ORIGINAL_API(RegSetValueExA)(hKey,
  54. lpValueName,
  55. Reserved,
  56. dwType,
  57. lpData,
  58. cbData);
  59. }
  60. /*++
  61. Register hooked functions
  62. --*/
  63. HOOK_BEGIN
  64. APIHOOK_ENTRY(ADVAPI32.DLL, RegSetValueExA);
  65. HOOK_END
  66. IMPLEMENT_SHIM_END