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.

78 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. product.c
  5. Abstract:
  6. This file implements common setup routines for fax.
  7. Author:
  8. Mooly Beery (MoolyB) 16-Aug-2000
  9. Environment:
  10. User Mode
  11. --*/
  12. #include <SetupUtil.h>
  13. #include <MsiQuery.h>
  14. //
  15. //
  16. // Function: PrivateMsiGetProperty
  17. // Description: Gets a property from Windows Installer API
  18. // In case of failure , returns FALSE
  19. // In case of success , returns TRUE
  20. // GetLastError() to get the error code in case of failure.
  21. //
  22. // Remarks:
  23. //
  24. //
  25. // Author: MoolyB
  26. BOOL PrivateMsiGetProperty
  27. (
  28. MSIHANDLE hInstall, // installer handle
  29. LPCTSTR szName, // property identifier, case-sensitive
  30. LPTSTR szValueBuf // buffer for returned property value
  31. )
  32. {
  33. UINT uiRet = ERROR_SUCCESS;
  34. int iCount = 0;
  35. DWORD cchValue = MAX_PATH;
  36. DBG_ENTER(TEXT("PrivateMsiGetProperty"));
  37. uiRet = MsiGetProperty(hInstall,szName,szValueBuf,&cchValue);
  38. if (uiRet==ERROR_SUCCESS && (iCount=_tcslen(szValueBuf)))
  39. {
  40. VERBOSE( DBG_MSG,
  41. _T("MsiGetProperty:%s returned %s."),
  42. szName,
  43. szValueBuf);
  44. }
  45. else if (iCount==0)
  46. {
  47. VERBOSE(GENERAL_ERR,
  48. _T("MsiGetProperty:%s returned an empty string."),
  49. szName);
  50. SetLastError(ERROR_INVALID_PARAMETER);
  51. return FALSE;
  52. }
  53. else
  54. {
  55. VERBOSE(GENERAL_ERR,
  56. _T("MsiGetProperty:%s failed (ec: %ld)."),
  57. szName,
  58. uiRet);
  59. SetLastError(uiRet);
  60. return FALSE;
  61. }
  62. return TRUE;
  63. }