align strings on 4 byte boundary and don't write NULL termination twice

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4931 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-02-17 10:49:50 +00:00
parent fac39f2435
commit e194176ec3

View file

@ -666,13 +666,9 @@ void CResourceEditor::WriteRsrcSec(BYTE* pbRsrcSec) {
WORD iLen = winchar_strlen(szName) + 1;
*(WORD*)seeker = ConvertEndianness(iLen);
seeker += sizeof(WORD);
CopyMemory(seeker, szName, iLen*sizeof(WCHAR));
seeker += iLen*sizeof(WCHAR);
CopyMemory(seeker + sizeof(WORD), szName, iLen*sizeof(WCHAR));
// Even though the number of chars is predefined a null termination is required
*(WORD*)seeker = 0;
seeker += sizeof(WORD);
seeker += RALIGN(iLen * sizeof(WCHAR) + sizeof(WORD), 4);
delete [] szName;