You are passing 0 as the size of the buffer in the "length" argument which is too small. Try
DWORD length = sizeof(szProductName)/sizeof(TCHAR); -----Original Message----- From: Jiang, Chunyan (GE Healthcare) [mailto:chunyan.ji...@ge.com] Sent: 19 November 2009 16:12 To: General discussion for Windows Installer XML toolset. Subject: [WiX-users] How to use MsiGetProductInfo function? Hi, I tried to retrieve some information about installed Product, as bellow: TCHAR szProductName[100] = {0}; DWORD length(0); MsiGetProductInfoW(szProductCode,L"InstalledProductName",szProductName,& length); However, it always return ERROR_MORE_DATA. It sounds like that TCHAR szProductName[100] is not enough. Actually, length is only 42 in my case. I would like to use CStrBufW(szProductName, length, CStrBufW::SET_LENGTH) instead of TCHAR. However, #include <atlstr.h> causes many errors, like: 1>D:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\atlchecked.h(93) : error C2664: 'errno_t strcpy_s(char *,rsize_t,const char *)' : cannot convert parameter 1 from 'TCHAR *' to 'char *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Is there anyway to use MsiGetProductInfo function? Regards, Chunyan ------------------------------------------------------------------------ ------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users SDL PLC confidential, all rights reserved. If you are not the intended recipient of this mail SDL requests and requires that you delete it without acting upon or copying any of its contents, and we further request that you advise us. SDL PLC is a public limited company registered in England and Wales. Registered number: 02675207. Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, UK. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users