StrToWstrAlloc -> winchar_fromansi

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4889 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-01-25 13:09:24 +00:00
parent 01ebc199ef
commit 4fb4a1f688

View file

@ -18,6 +18,7 @@
#include "Platform.h"
#include "util.h"
#include "winchar.h"
#ifdef NSIS_SUPPORT_VERSION_INFO
@ -131,19 +132,6 @@ void CResourceVersionInfo::SetProductVersion(int HighPart, int LowPart)
m_FixedInfo.dwProductVersionMS = HighPart;
}
// Util function - must be freeded
WCHAR* StrToWstrAlloc(const char* istr, int codepage)
{
int strSize = MultiByteToWideChar(codepage, 0, istr, -1, 0, 0);
WCHAR* wstr = new WCHAR[strSize];
if (!MultiByteToWideChar(codepage, 0, istr, -1, wstr, strSize))
{
delete [] wstr;
wstr = NULL;
}
return wstr;
}
int GetVersionHeader (LPSTR &p, WORD &wLength, WORD &wValueLength, WORD &wType)
{
WCHAR *szKey;
@ -202,7 +190,7 @@ void CResourceVersionInfo::ExportToStream(GrowBuf &strm, int Index)
WCHAR *KeyName, *KeyValue;
strm.resize(0);
KeyName = StrToWstrAlloc("VS_VERSION_INFO", CP_ACP);
KeyName = winchar_fromansi("VS_VERSION_INFO");
SaveVersionHeader (strm, 0, sizeof (VS_FIXEDFILEINFO), 0, KeyName, &m_FixedInfo);
delete [] KeyName;