*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "utils.h"
using namespace std;
-char *CStrFromBSTR(int codePage, BSTR bstr)
+char *CStrFromBSTR(UINT codePage, BSTR bstr)
{
UINT len = SysStringLen(bstr);
if( len > 0 )
return NULL;
};
-BSTR BSTRFromCStr(int codePage, const char *s)
+BSTR BSTRFromCStr(UINT codePage, LPCSTR s)
{
int wideLen = MultiByteToWideChar(codePage, 0, s, -1, NULL, 0);
- if( wideLen )
+ if( wideLen > 0 )
{
WCHAR* wideStr = (WCHAR*)CoTaskMemAlloc(wideLen*sizeof(WCHAR));
if( NULL != wideStr )
ZeroMemory(wideStr, wideLen*sizeof(WCHAR));
MultiByteToWideChar(codePage, 0, s, -1, wideStr, wideLen);
- bstr = SysAllocString(wideStr);
+ bstr = SysAllocStringLen(wideStr, wideLen);
free(wideStr);
return bstr;
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
VARIANT vres;
+ VariantInit(&vres);
hr = pDisp->Invoke(dispID, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, &dispparamsNoArgs, &vres, NULL, NULL);
if( SUCCEEDED(hr) )