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.

102 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. AdobeLiveMotion.cpp
  5. Abstract:
  6. This installation has a version problem that is corrected
  7. by the MSI transform but later has a problem with it's custom action
  8. DLL.It calls one of the MSI API's with invalid parameters.
  9. Notes:
  10. This is specific to this app.
  11. History:
  12. 05/15/2001 prashkud Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(AdobeLiveMotion)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_ENTRY(MsiGetPropertyA)
  19. APIHOOK_ENUM_ENTRY(MsiGetPropertyW)
  20. APIHOOK_ENUM_END
  21. /*++
  22. Pass valid parameters to the API.
  23. --*/
  24. UINT
  25. APIHOOK(MsiGetPropertyA)(
  26. MSIHANDLE hInstall,
  27. LPCSTR szName,
  28. LPSTR szValueBuf,
  29. DWORD *pchValueBuf)
  30. {
  31. char szTempBuf[] = "";
  32. int len = (*pchValueBuf) ?(int)(*pchValueBuf) : MAX_PATH;
  33. if ((szValueBuf == NULL) || IsBadStringPtrA(szValueBuf,(UINT_PTR)len))
  34. {
  35. // If the string pointer is bad, send our empty string in
  36. szValueBuf = szTempBuf;
  37. *pchValueBuf = 0;
  38. }
  39. return ORIGINAL_API(MsiGetPropertyA)(hInstall,szName,szValueBuf,pchValueBuf);
  40. }
  41. /*++
  42. --*/
  43. UINT
  44. APIHOOK(MsiGetPropertyW)(
  45. MSIHANDLE hInstall,
  46. LPCWSTR szName,
  47. LPWSTR szValueBuf,
  48. DWORD *pchValueBuf)
  49. {
  50. WCHAR szTempBuf[] = L"";
  51. int len = (*pchValueBuf) ?(int)(*pchValueBuf) : MAX_PATH;
  52. if ((szValueBuf == NULL) || IsBadStringPtr(szValueBuf,(UINT_PTR)len))
  53. {
  54. // If the string pointer is bad, send our empty string in
  55. szValueBuf = szTempBuf;
  56. *pchValueBuf = 0;
  57. }
  58. return ORIGINAL_API(MsiGetPropertyW)(hInstall,szName,szValueBuf,pchValueBuf);
  59. }
  60. /*++
  61. Register hooked functions
  62. --*/
  63. HOOK_BEGIN
  64. APIHOOK_ENTRY(MSI.DLL, MsiGetPropertyA)
  65. APIHOOK_ENTRY(MSI.DLL, MsiGetPropertyW)
  66. HOOK_END
  67. IMPLEMENT_SHIM_END