Uninstaller data offset is saved as EW_WRITEUNINSTALLER's parameters. A step forward to multiple uninstallers and smaller exehead.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3192 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
75299797fd
commit
0ef7fcd98b
4 changed files with 22 additions and 14 deletions
|
@ -2754,8 +2754,24 @@ int CEXEBuild::uninstall_generate()
|
||||||
if (icon_offset == 0)
|
if (icon_offset == 0)
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
|
|
||||||
build_header.uninstdata_offset=build_datablock.getlen();
|
entry *ent = (entry *) build_entries.get();
|
||||||
build_header.uninsticon_size=unicondata_size;
|
if (!ent)
|
||||||
|
return PS_ERROR;
|
||||||
|
int ents = build_header.blocks[NB_ENTRIES].num;
|
||||||
|
int uns = uninstaller_writes_used;
|
||||||
|
int uninstdata_offset = build_datablock.getlen();
|
||||||
|
while (ents--)
|
||||||
|
{
|
||||||
|
if (ent->which == EW_WRITEUNINSTALLER)
|
||||||
|
{
|
||||||
|
ent->offsets[1] = uninstdata_offset;
|
||||||
|
ent->offsets[2] = unicondata_size;
|
||||||
|
uns--;
|
||||||
|
if (!uns)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ent++;
|
||||||
|
}
|
||||||
|
|
||||||
if (add_db_data((char *)m_unicon_data,unicondata_size) < 0)
|
if (add_db_data((char *)m_unicon_data,unicondata_size) < 0)
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
|
@ -2920,7 +2936,7 @@ int CEXEBuild::uninstall_generate()
|
||||||
uninstall_size_full=fh.length_of_all_following_data+unicondata_size;
|
uninstall_size_full=fh.length_of_all_following_data+unicondata_size;
|
||||||
|
|
||||||
// compressed size
|
// compressed size
|
||||||
uninstall_size=build_datablock.getlen()-build_header.uninstdata_offset;
|
uninstall_size=build_datablock.getlen()-uninstdata_offset;
|
||||||
|
|
||||||
SCRIPT_MSG("Done!\n");
|
SCRIPT_MSG("Done!\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1436,10 +1436,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
ReadSelfFile((char*)filebuf,filehdrsize);
|
ReadSelfFile((char*)filebuf,filehdrsize);
|
||||||
{
|
{
|
||||||
unsigned char* seeker;
|
unsigned char* seeker;
|
||||||
unsigned char* unicon_data = seeker = (unsigned char*)my_GlobalAlloc(g_header->uninsticon_size);
|
unsigned char* unicon_data = seeker = (unsigned char*)my_GlobalAlloc(parm2);
|
||||||
if (unicon_data) {
|
if (unicon_data) {
|
||||||
GetCompressedDataFromDataBlockToMemory(g_header->uninstdata_offset,
|
GetCompressedDataFromDataBlockToMemory(parm1,unicon_data,parm2);
|
||||||
unicon_data,g_header->uninsticon_size);
|
|
||||||
while (*seeker) {
|
while (*seeker) {
|
||||||
struct icondata {
|
struct icondata {
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
|
|
|
@ -159,7 +159,7 @@ enum
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||||
EW_WRITEUNINSTALLER, // WriteUninstaller: 1 [name]
|
EW_WRITEUNINSTALLER, // WriteUninstaller: 3 [name, offset, icon_size]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_LOG
|
#ifdef NSIS_CONFIG_LOG
|
||||||
|
@ -304,11 +304,6 @@ typedef struct
|
||||||
|
|
||||||
int install_directory_ptr; // default install dir.
|
int install_directory_ptr; // default install dir.
|
||||||
int install_directory_auto_append; // auto append part
|
int install_directory_auto_append; // auto append part
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
|
||||||
int uninstdata_offset; // -1 if no uninst data.
|
|
||||||
int uninsticon_size;
|
|
||||||
#endif
|
|
||||||
} header;
|
} header;
|
||||||
|
|
||||||
// used for section->flags
|
// used for section->flags
|
||||||
|
|
|
@ -2579,8 +2579,6 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
uninstaller_writes_used++;
|
uninstaller_writes_used++;
|
||||||
ent.which=EW_WRITEUNINSTALLER;
|
ent.which=EW_WRITEUNINSTALLER;
|
||||||
ent.offsets[0]=add_string(line.gettoken_str(1));
|
ent.offsets[0]=add_string(line.gettoken_str(1));
|
||||||
ent.offsets[1]=0; // uninstall section 0
|
|
||||||
ent.offsets[2]=0;
|
|
||||||
if (!ent.offsets[0]) PRINTHELP()
|
if (!ent.offsets[0]) PRINTHELP()
|
||||||
SCRIPT_MSG("WriteUninstaller: \"%s\"\n",line.gettoken_str(1));
|
SCRIPT_MSG("WriteUninstaller: \"%s\"\n",line.gettoken_str(1));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue