18 bytes down
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1158 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
717b2389fc
commit
1683a1f248
3 changed files with 18 additions and 16 deletions
|
@ -270,10 +270,10 @@ CEXEBuild::CEXEBuild()
|
|||
// Changed by Amir Szekely 11th July 2002
|
||||
// Changed to fit the new format in which uninstaller icons are saved
|
||||
m_unicon_data=(unsigned char *)malloc(unicondata_size+3*sizeof(DWORD));
|
||||
memcpy(m_unicon_data+3*sizeof(DWORD),unicon_data+22,unicondata_size);
|
||||
*(DWORD*)m_unicon_data = 1;
|
||||
memcpy(m_unicon_data+2*sizeof(DWORD),unicon_data+22,unicondata_size);
|
||||
*(DWORD*)(DWORD(m_unicon_data) + sizeof(DWORD)) = unicondata_size;
|
||||
*(DWORD*)(DWORD(m_unicon_data) + 2*sizeof(DWORD)) = 0;
|
||||
*(DWORD*)(DWORD(m_unicon_data) + 3*sizeof(DWORD)) = 0;
|
||||
unicondata_size += 3*sizeof(DWORD);
|
||||
|
||||
m_inst_fileused=0;
|
||||
|
@ -1674,9 +1674,9 @@ int CEXEBuild::uninstall_generate()
|
|||
#endif
|
||||
// Changed by Amir Szekely 11th July 2002
|
||||
// This bunch of lines do CRC for the uninstaller icon data
|
||||
unsigned char* seeker = m_unicon_data + sizeof(DWORD);
|
||||
unsigned char* seeker = m_unicon_data;
|
||||
DWORD dwEndOfIcons = 0;
|
||||
for (DWORD i = 0; i < *(DWORD*)m_unicon_data; i++) {
|
||||
while (*seeker) {
|
||||
DWORD dwSize = *(DWORD*)seeker;
|
||||
seeker += sizeof(DWORD);
|
||||
DWORD dwOffset = *(DWORD*)seeker;
|
||||
|
@ -1684,7 +1684,7 @@ int CEXEBuild::uninstall_generate()
|
|||
// Do CRC for icon data
|
||||
crc=CRC32(crc,seeker,dwSize);
|
||||
seeker += dwSize;
|
||||
if (i < (*(DWORD*)m_unicon_data) - 1) {
|
||||
if (*seeker) {
|
||||
// Do CRC for data between icons
|
||||
crc=CRC32(crc,header_data_new+dwOffset+dwSize,(*(DWORD*)(seeker+sizeof(DWORD)))-dwOffset-dwSize);
|
||||
}
|
||||
|
|
|
@ -350,7 +350,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
HANDLE hOut;
|
||||
int ret;
|
||||
int overwriteflag=parm0;
|
||||
#define overwriteflag parm0
|
||||
addtrailingslash(mystrcpy(buf0,state_output_directory));
|
||||
|
||||
process_string_fromparm_tobuf(0x31);
|
||||
|
@ -433,6 +433,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
my_MessageBox(buf0,MB_OK|MB_ICONSTOP);
|
||||
return EXEC_ERROR;
|
||||
}
|
||||
|
||||
#undef overwriteflag
|
||||
}
|
||||
return 0;
|
||||
#endif//NSIS_SUPPORT_FILE
|
||||
|
@ -917,6 +919,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
log_printf3("Error registering DLL: %s not found in %s",buf1,buf0);
|
||||
}
|
||||
if (!parm3) FreeLibrary(h);
|
||||
// saves 2 bytes - FreeLibrary((HANDLE)((unsigned long)h&(unsigned long)parm3));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1353,13 +1356,13 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
if (g_inst_header->uninstdata_offset != -1)
|
||||
{
|
||||
// Changed by Amir Szekely 11th July 2002
|
||||
unsigned char* unicon_data = (unsigned char*)my_GlobalAlloc(g_inst_header->uninsticon_size);
|
||||
unsigned char* seeker;
|
||||
unsigned char* unicon_data = seeker = (unsigned char*)my_GlobalAlloc(g_inst_header->uninsticon_size);
|
||||
if (unicon_data) {
|
||||
DWORD i;
|
||||
unsigned char* seeker = unicon_data + sizeof(DWORD);
|
||||
GetCompressedDataFromDataBlockToMemory(g_inst_header->uninstdata_offset,
|
||||
unicon_data,g_inst_header->uninsticon_size);
|
||||
for (i = 0; i < *(DWORD*)unicon_data; i++) {
|
||||
//for (i = 0; i < *(DWORD*)unicon_data; i++) {
|
||||
while (*seeker) {
|
||||
DWORD dwSize, dwOffset;
|
||||
dwSize = *(DWORD*)seeker;
|
||||
seeker += sizeof(DWORD);
|
||||
|
|
|
@ -197,8 +197,8 @@ unsigned char* generate_uninstall_icon_data(char* filename)
|
|||
iNewIconSize += ige.dwRawSize;
|
||||
}
|
||||
|
||||
// First DWORD tells how many icons this array contains
|
||||
// Before each icon come two DWORDs, one for size and the other for offset (set later)
|
||||
// The last size is 0, no offset
|
||||
iNewIconSize += sizeof(DWORD)*(1 + igh.wCount*2);
|
||||
|
||||
BYTE* pbUninstIcon = (BYTE*)malloc(iNewIconSize);
|
||||
|
@ -206,9 +206,6 @@ unsigned char* generate_uninstall_icon_data(char* filename)
|
|||
|
||||
BYTE* seeker = pbUninstIcon;
|
||||
|
||||
*(DWORD*)seeker = igh.wCount;
|
||||
seeker += sizeof(DWORD);
|
||||
|
||||
for (i = 0; i < igh.wCount; i++) {
|
||||
*(DWORD*)seeker = rawSizes[i];
|
||||
seeker += sizeof(DWORD);
|
||||
|
@ -219,6 +216,9 @@ unsigned char* generate_uninstall_icon_data(char* filename)
|
|||
seeker += rawSizes[i];
|
||||
}
|
||||
|
||||
// This is how we know there are no more icons (size = 0)
|
||||
*(DWORD*)seeker = 0;
|
||||
|
||||
free(offsets);
|
||||
free(rawSizes);
|
||||
|
||||
|
@ -268,8 +268,6 @@ int generate_unicons_offsets(unsigned char* exeHeader, unsigned char* uninstIcon
|
|||
PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdRoot->Entries[idx].OffsetToDirectory + DWORD(rdRoot));
|
||||
|
||||
unsigned char* seeker = uninstIconData;
|
||||
MY_ASSERT(*(DWORD*)seeker != rdIcons->Header.NumberOfIdEntries, "number of icons doesn't match");
|
||||
seeker += sizeof(DWORD);
|
||||
|
||||
for (i = 0; i < rdIcons->Header.NumberOfIdEntries; i++) { // Icons dir can't have named entries
|
||||
MY_ASSERT(!rdIcons->Entries[i].DataIsDirectory, "bad resource directory");
|
||||
|
@ -285,6 +283,7 @@ int generate_unicons_offsets(unsigned char* exeHeader, unsigned char* uninstIcon
|
|||
seeker += sizeof(DWORD) + dwSize;
|
||||
}
|
||||
MY_ASSERT(i == 0, "no icons found");
|
||||
MY_ASSERT(*(DWORD*)seeker != 0, "number of icons doesn't match");
|
||||
|
||||
return PIMAGE_RESOURCE_DATA_ENTRY(PRESOURCE_DIRECTORY(rdIcons->Entries[0].OffsetToDirectory + DWORD(rdRoot))->Entries[0].OffsetToData + DWORD(rdRoot))->OffsetToData + DWORD(rdRoot) - dwResourceSectionVA - DWORD(exeHeader);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue