Unicode to MBCS conversion bugs fixed

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@689 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-08-16 09:36:46 +00:00
parent 06dbc9a22b
commit d9285b2cbf
2 changed files with 8 additions and 7 deletions

View file

@ -49,10 +49,10 @@ void ReadVarLenArr(BYTE* &seeker, char* &readInto) {
break;
default:
{
DWORD dwStrLen = WCStrLen((WCHAR*)arr);
readInto = new char[dwStrLen];
WideCharToMultiByte(CP_ACP, 0, (WCHAR*)arr, dwStrLen, readInto, dwStrLen, 0, 0);
seeker += (dwStrLen)*sizeof(WCHAR);
int iStrLen = WideCharToMultiByte(CP_ACP, 0, (WCHAR*)arr, -1, 0, 0, 0, 0);
readInto = new char[iStrLen];
WideCharToMultiByte(CP_ACP, 0, (WCHAR*)arr, -1, readInto, iStrLen, 0, 0);
seeker += WCStrLen((WCHAR*)arr)*sizeof(WCHAR);
}
break;
}

View file

@ -340,9 +340,10 @@ CResourceDirectory* CResourceEditor::ScanDirectory(PRESOURCE_DIRECTORY rdRoot, P
if (rdToScan->Entries[i].NameIsString) {
PIMAGE_RESOURCE_DIR_STRING_U rds = PIMAGE_RESOURCE_DIR_STRING_U(rdToScan->Entries[i].NameOffset + (char*)rdRoot);
szName = new char[rds->Length+1];
WideCharToMultiByte(CP_ACP, 0, rds->NameString, rds->Length, szName, rds->Length, 0, 0);
szName[rds->Length] = 0;
int mbsSize = WideCharToMultiByte(CP_ACP, 0, rds->NameString, rds->Length, 0, 0, 0, 0);
szName = new char[mbsSize+1];
WideCharToMultiByte(CP_ACP, 0, rds->NameString, rds->Length, szName, mbsSize, 0, 0);
szName[mbsSize] = 0;
}
// Else, set the name to this entry's id
else