2006-10-28 19:45:02 +00:00
/*
* fileform . h
*
* This file is a part of NSIS .
*
2009-02-01 14:44:30 +00:00
* Copyright ( C ) 1999 - 2009 Nullsoft and Contributors
2006-10-28 19:45:02 +00:00
*
* Licensed under the zlib / libpng license ( the " License " ) ;
* you may not use this file except in compliance with the License .
*
* Licence details can be found in the file COPYING .
*
* This software is provided ' as - is ' , without any express or implied
* warranty .
2010-03-24 17:22:56 +00:00
*
* Unicode support by Jim Park - - 08 / 13 / 2007
2006-10-28 19:45:02 +00:00
*/
2002-08-02 10:01:35 +00:00
# include "config.h"
2004-10-23 17:43:08 +00:00
# include "../Platform.h"
2002-08-02 10:01:35 +00:00
# ifndef _FILEFORM_H_
# define _FILEFORM_H_
2008-02-23 15:04:53 +00:00
// * the installer is composed of the following parts:
2003-09-04 18:25:57 +00:00
// exehead (~34kb)
// firstheader (struct firstheader)
// * headers (compressed together):
2008-02-23 15:04:53 +00:00
// header (struct header - contains pointers to all blocks)
2003-09-04 18:25:57 +00:00
// pages (struct page)
// section headers (struct section)
// entries/instructions (struct entry)
// strings (null seperated)
// language tables (language id, dialog offset, language strings)
// colors (struct color)
2008-02-23 15:04:53 +00:00
// data block (compressed files and uninstaller data)
2002-08-02 10:01:35 +00:00
// CRC (optional - 4 bytes)
2003-09-04 18:25:57 +00:00
//
// headers + datablock is at least 512 bytes if CRC enabled
2002-08-02 10:01:35 +00:00
2002-09-13 21:23:01 +00:00
# define MAX_ENTRY_OFFSETS 6
2002-08-02 10:01:35 +00:00
// if you want people to not be able to decompile your installers as easily,
// reorder the lines following EW_INVALID_OPCODE randomly.
enum
{
2003-05-24 13:50:24 +00:00
EW_INVALID_OPCODE , // zero is invalid. useful for catching errors. (otherwise an all zeroes instruction
// does nothing, which is easily ignored but means something is wrong.
2002-08-02 10:01:35 +00:00
EW_RET , // return from function call
EW_NOP , // Nop/Jump, do nothing: 1, [?new address+1:advance one]
EW_ABORT , // Abort: 1 [status]
EW_QUIT , // Quit: 0
EW_CALL , // Call: 1 [new address+1]
EW_UPDATETEXT , // Update status text: 2 [update str, ui_st_updateflag=?ui_st_updateflag:this]
EW_SLEEP , // Sleep: 1 [sleep time in milliseconds]
EW_BRINGTOFRONT , // BringToFront: 0
EW_CHDETAILSVIEW , // SetDetailsView: 2 [listaction,buttonaction]
EW_SETFILEATTRIBUTES , // SetFileAttributes: 2 [filename, attributes]
EW_CREATEDIR , // Create directory: 2, [path, ?update$INSTDIR]
EW_IFFILEEXISTS , // IfFileExists: 3, [file name, jump amount if exists, jump amount if not exists]
2003-02-07 23:04:25 +00:00
EW_SETFLAG , // Sets a flag: 2 [id, data]
2003-04-02 19:54:53 +00:00
EW_IFFLAG , // If a flag: 4 [on, off, id, new value mask]
2003-05-24 13:50:24 +00:00
EW_GETFLAG , // Gets a flag: 2 [output, id]
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_RENAME
2002-08-02 10:01:35 +00:00
EW_RENAME , // Rename: 3 [old, new, rebootok]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_FNUTIL
2002-08-02 10:01:35 +00:00
EW_GETFULLPATHNAME , // GetFullPathName: 2 [output, input, ?lfn:sfn]
EW_SEARCHPATH , // SearchPath: 2 [output, filename]
2003-07-18 14:22:17 +00:00
EW_GETTEMPFILENAME , // GetTempFileName: 2 [output, base_dir]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_FILE
2003-05-26 17:55:15 +00:00
EW_EXTRACTFILE , // File to extract: 6 [overwriteflag, output filename, compressed filedata, filedatetimelow, filedatetimehigh, allow ignore]
2002-08-02 10:01:35 +00:00
// overwriteflag: 0x1 = no. 0x0=force, 0x2=try, 0x3=if date is newer
2002-09-24 23:26:55 +00:00
# endif
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_DELETE
2002-08-02 10:01:35 +00:00
EW_DELETEFILE , // Delete File: 2, [filename, rebootok]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_MESSAGEBOX
2002-08-02 10:01:35 +00:00
EW_MESSAGEBOX , // MessageBox: 5,[MB_flags,text,retv1:retv2,moveonretv1:moveonretv2]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_RMDIR
2002-08-02 10:01:35 +00:00
EW_RMDIR , // RMDir: 2 [path, recursiveflag]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_STROPTS
2002-08-02 10:01:35 +00:00
EW_STRLEN , // StrLen: 2 [output, input]
EW_ASSIGNVAR , // Assign: 4 [variable (0-9) to assign, string to assign, maxlen, startpos]
2006-01-06 16:00:15 +00:00
EW_STRCMP , // StrCmp: 5 [str1, str2, jump_if_equal, jump_if_not_equal, case-sensitive?]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_ENVIRONMENT
2002-08-02 10:01:35 +00:00
EW_READENVSTR , // ReadEnvStr/ExpandEnvStrings: 3 [output, string_with_env_variables, IsRead]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_INTOPTS
2003-03-20 20:49:13 +00:00
EW_INTCMP , // IntCmp: 6 [val1, val2, equal, val1<val2, val1>val2, unsigned?]
2002-08-02 10:01:35 +00:00
EW_INTOP , // IntOp: 4 [output, input1, input2, op] where op: 0=add, 1=sub, 2=mul, 3=div, 4=bor, 5=band, 6=bxor, 7=bnot input1, 8=lnot input1, 9=lor, 10=land], 11=1%2
EW_INTFMT , // IntFmt: [output, format, input]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_STACK
2002-08-02 10:01:35 +00:00
EW_PUSHPOP , // Push/Pop/Exchange: 3 [variable/string, ?pop:push, ?exch]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_SUPPORT_HWNDS
2002-08-21 19:02:47 +00:00
EW_FINDWINDOW , // FindWindow: 5, [outputvar, window class,window name, window_parent, window_after]
2002-09-13 21:23:01 +00:00
EW_SENDMESSAGE , // SendMessage: 6 [output, hwnd, msg, wparam, lparam, [wparamstring?1:0 | lparamstring?2:0 | timeout<<2]
2002-08-02 10:01:35 +00:00
EW_ISWINDOW , // IsWindow: 3 [hwnd, jump_if_window, jump_if_notwindow]
2002-09-18 19:08:53 +00:00
# endif
# ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
2003-01-27 15:05:50 +00:00
EW_GETDLGITEM , // GetDlgItem: 3: [outputvar, dialog, item_id]
2003-09-04 18:25:57 +00:00
EW_SETCTLCOLORS , // SerCtlColors: 3: [hwnd, pointer to struct colors]
2002-09-18 19:08:53 +00:00
EW_SETBRANDINGIMAGE , // SetBrandingImage: 1: [Bitmap file]
EW_CREATEFONT , // CreateFont: 5: [handle output, face name, height, weight, flags]
2002-11-15 13:15:42 +00:00
EW_SHOWWINDOW , // ShowWindow: 2: [hwnd, show state]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_SHELLEXECUTE
2002-08-02 10:01:35 +00:00
EW_SHELLEXEC , // ShellExecute program: 4, [shell action, complete commandline, parameters, showwindow]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_EXECUTE
2002-08-02 10:01:35 +00:00
EW_EXECUTE , // Execute program: 3,[complete command line,waitflag,>=0?output errorcode]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_GETFILETIME
2002-08-02 10:01:35 +00:00
EW_GETFILETIME , // GetFileTime; 3 [file highout lowout]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_GETDLLVERSION
2002-08-02 10:01:35 +00:00
EW_GETDLLVERSION , // GetDLLVersion: 3 [file highout lowout]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_ACTIVEXREG
2002-08-29 10:25:45 +00:00
EW_REGISTERDLL , // Register DLL: 3,[DLL file name, string ptr of function to call, text to put in display (<0 if none/pass parms), 1 - no unload, 0 - unload]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_CREATESHORTCUT
2002-08-02 10:01:35 +00:00
EW_CREATESHORTCUT , // Make Shortcut: 5, [link file, target file, parameters, icon file, iconindex|show mode<<8|hotkey<<16]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_COPYFILES
2002-08-02 10:01:35 +00:00
EW_COPYFILES , // CopyFiles: 3 [source mask, destination location, flags]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_REBOOT
2002-08-31 10:27:34 +00:00
EW_REBOOT , // Reboot: 0
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_INIFILES
2002-08-02 10:01:35 +00:00
EW_WRITEINI , // Write INI String: 4, [Section, Name, Value, INI File]
EW_READINISTR , // ReadINIStr: 4 [output, section, name, ini_file]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_REGISTRYFUNCTIONS
2002-08-02 10:01:35 +00:00
EW_DELREG , // DeleteRegValue/DeleteRegKey: 4, [root key(int), KeyName, ValueName, delkeyonlyifempty]. ValueName is -1 if delete key
EW_WRITEREG , // Write Registry value: 5, [RootKey(int),KeyName,ItemName,ItemData,typelen]
// typelen=1 for str, 2 for dword, 3 for binary, 0 for expanded str
EW_READREGSTR , // ReadRegStr: 5 [output, rootkey(int), keyname, itemname, ==1?int::str]
EW_REGENUM , // RegEnum: 5 [output, rootkey, keyname, index, ?key:value]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_FILEFUNCTIONS
2002-08-02 10:01:35 +00:00
EW_FCLOSE , // FileClose: 1 [handle]
EW_FOPEN , // FileOpen: 4 [name, openmode, createmode, outputhandle]
EW_FPUTS , // FileWrite: 3 [handle, string, ?int:string]
EW_FGETS , // FileRead: 4 [handle, output, maxlen, ?getchar:gets]
EW_FSEEK , // FileSeek: 4 [handle, offset, mode, >=0?positionoutput]
2002-09-18 19:08:53 +00:00
# endif //NSIS_SUPPORT_FILEFUNCTIONS
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_SUPPORT_FINDFIRST
2002-08-02 10:01:35 +00:00
EW_FINDCLOSE , // FindClose: 1 [handle]
EW_FINDNEXT , // FindNext: 2 [output, handle]
EW_FINDFIRST , // FindFirst: 2 [filespec, output, handleoutput]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
2003-11-24 13:11:35 +00:00
EW_WRITEUNINSTALLER , // WriteUninstaller: 3 [name, offset, icon_size]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_CONFIG_LOG
2002-08-02 10:01:35 +00:00
EW_LOG , // LogText: 2 [0, text] / LogSet: [1, logstate]
2002-09-18 19:08:53 +00:00
# endif
2002-08-02 10:01:35 +00:00
2002-09-18 19:08:53 +00:00
# ifdef NSIS_CONFIG_COMPONENTPAGE
2002-08-02 10:01:35 +00:00
EW_SECTIONSET , // SectionSetText: 3: [idx, 0, text]
// SectionGetText: 3: [idx, 1, output]
// SectionSetFlags: 3: [idx, 2, flags]
// SectionGetFlags: 3: [idx, 3, output]
2003-05-24 13:50:24 +00:00
EW_INSTTYPESET , // InstTypeSetFlags: 3: [idx, 0, flags]
// InstTypeGetFlags: 3: [idx, 1, output]
2002-09-18 19:08:53 +00:00
# endif
2002-08-21 19:02:47 +00:00
2002-08-02 10:01:35 +00:00
// instructions not actually implemented in exehead, but used in compiler.
EW_GETLABELADDR , // both of these get converted to EW_ASSIGNVAR
EW_GETFUNCTIONADDR ,
2003-11-09 22:45:25 +00:00
# ifdef NSIS_LOCKWINDOW_SUPPORT
EW_LOCKWINDOW ,
# endif
2002-08-02 10:01:35 +00:00
} ;
2002-11-01 20:34:55 +00:00
# define FH_FLAGS_MASK 15
2003-07-18 14:22:17 +00:00
# define FH_FLAGS_UNINSTALL 1
2002-11-01 20:34:55 +00:00
# ifdef NSIS_CONFIG_SILENT_SUPPORT
2003-07-18 14:22:17 +00:00
# define FH_FLAGS_SILENT 2
# endif
# ifdef NSIS_CONFIG_CRC_SUPPORT
# define FH_FLAGS_NO_CRC 4
# define FH_FLAGS_FORCE_CRC 8
2002-11-01 20:34:55 +00:00
# endif
# define FH_SIG 0xDEADBEEF
// neato surprise signature that goes in firstheader. :)
# define FH_INT1 0x6C6C754E
# define FH_INT2 0x74666F73
# define FH_INT3 0x74736E49
2002-08-02 10:01:35 +00:00
typedef struct
{
2003-03-18 20:36:52 +00:00
int flags ; // FH_FLAGS_*
2002-08-02 10:01:35 +00:00
int siginfo ; // FH_SIG
int nsinst [ 3 ] ; // FH_INT1,FH_INT2,FH_INT3
// these point to the header+sections+entries+stringtable in the datablock
int length_of_header ;
// this specifies the length of all the data (including the firstheader and CRC)
int length_of_all_following_data ;
} firstheader ;
2003-03-18 20:36:52 +00:00
// Flags for common_header.flags
# define CH_FLAGS_DETAILS_SHOWDETAILS 1
# define CH_FLAGS_DETAILS_NEVERSHOW 2
# define CH_FLAGS_PROGRESS_COLORED 4
# ifdef NSIS_CONFIG_SILENT_SUPPORT
# define CH_FLAGS_SILENT 8
# define CH_FLAGS_SILENT_LOG 16
# endif
# define CH_FLAGS_AUTO_CLOSE 32
# define CH_FLAGS_DIR_NO_SHOW 64
# define CH_FLAGS_NO_ROOT_DIR 128
# ifdef NSIS_CONFIG_COMPONENTPAGE
# define CH_FLAGS_COMP_ONLY_ON_CUSTOM 256
# define CH_FLAGS_NO_CUSTOM 512
# endif
2003-09-04 18:25:57 +00:00
// nsis blocks
struct block_header {
int offset ;
int num ;
} ;
enum {
# ifdef NSIS_CONFIG_VISIBLE_SUPPORT
NB_PAGES ,
2003-03-26 17:47:46 +00:00
# endif
2003-09-04 18:25:57 +00:00
NB_SECTIONS ,
NB_ENTRIES ,
NB_STRINGS ,
NB_LANGTABLES ,
NB_CTLCOLORS ,
2004-06-11 15:33:00 +00:00
# ifdef NSIS_SUPPORT_BGBG
NB_BGFONT ,
# endif
2003-09-04 18:25:57 +00:00
NB_DATA ,
BLOCKS_NUM
} ;
2003-03-18 20:36:52 +00:00
2006-02-24 19:28:51 +00:00
// nsis strings
2010-03-24 17:22:56 +00:00
typedef TCHAR NSIS_STRING [ NSIS_MAX_STRLEN ] ;
2006-02-24 19:28:51 +00:00
2002-08-03 23:06:10 +00:00
// Settings common to both installers and uninstallers
typedef struct
{
2003-09-04 18:25:57 +00:00
int flags ; // CH_FLAGS_*
struct block_header blocks [ BLOCKS_NUM ] ;
2002-08-02 10:01:35 +00:00
2003-09-04 18:25:57 +00:00
// InstallDirRegKey stuff
int install_reg_rootkey ;
// these two are not processed!
int install_reg_key_ptr , install_reg_value_ptr ;
2002-11-01 20:34:55 +00:00
2002-08-02 10:01:35 +00:00
# ifdef NSIS_SUPPORT_BGBG
int bg_color1 , bg_color2 , bg_textcolor ;
# endif
2003-09-04 18:25:57 +00:00
# ifdef NSIS_CONFIG_VISIBLE_SUPPORT
// installation log window colors
int lb_bg , lb_fg ;
# endif
// langtable size
int langtable_size ;
# ifdef NSIS_CONFIG_LICENSEPAGE
// license background color
int license_bg ;
# endif //NSIS_CONFIG_LICENSEPAGE
2002-08-02 10:01:35 +00:00
# ifdef NSIS_SUPPORT_CODECALLBACKS
// .on* calls
int code_onInit ;
int code_onInstSuccess ;
int code_onInstFailed ;
int code_onUserAbort ;
2002-09-18 19:08:53 +00:00
# ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
2002-11-01 20:34:55 +00:00
int code_onGUIInit ;
2003-05-09 21:11:14 +00:00
int code_onGUIEnd ;
2003-09-04 18:25:57 +00:00
int code_onMouseOverSection ;
2004-10-14 13:56:02 +00:00
# endif //NSIS_CONFIG_ENHANCEDUI_SUPPORT
int code_onVerifyInstDir ;
2003-09-04 18:25:57 +00:00
# ifdef NSIS_CONFIG_COMPONENTPAGE
int code_onSelChange ;
# endif //NSIS_CONFIG_COMPONENTPAGE
2004-10-14 13:56:02 +00:00
# ifdef NSIS_SUPPORT_REBOOT
int code_onRebootFailed ;
# endif //NSIS_SUPPORT_REBOOT
2003-09-04 18:25:57 +00:00
# endif //NSIS_SUPPORT_CODECALLBACKS
2002-08-02 10:01:35 +00:00
# ifdef NSIS_CONFIG_COMPONENTPAGE
2003-07-18 17:39:45 +00:00
int install_types [ NSIS_MAX_INST_TYPES + 1 ] ;
2002-08-02 10:01:35 +00:00
# endif
int install_directory_ptr ; // default install dir.
2003-06-05 20:33:33 +00:00
int install_directory_auto_append ; // auto append part
2007-03-03 14:18:49 +00:00
# ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
int str_uninstchild ;
int str_uninstcmd ;
# endif //NSIS_CONFIG_UNINSTALL_SUPPORT
# ifdef NSIS_SUPPORT_MOVEONREBOOT
2010-03-24 17:22:56 +00:00
int str_wininit ; // Points to the path of wininit.ini
2007-03-03 14:18:49 +00:00
# endif //NSIS_SUPPORT_MOVEONREBOOT
2002-08-02 10:01:35 +00:00
} header ;
2004-08-06 11:05:48 +00:00
# ifdef NSIS_SUPPORT_CODECALLBACKS
// callback indices
enum
{
CB_ONINIT ,
CB_ONINSTSUCCESS ,
CB_ONINSTFAILED ,
CB_ONUSERABORT ,
# ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
CB_ONGUIINIT ,
CB_ONGUIEND ,
CB_ONMOUSEOVERSECTION ,
2004-10-14 13:56:02 +00:00
# endif //NSIS_CONFIG_ENHANCEDUI_SUPPORT
CB_ONVERIFYINSTDIR ,
2004-08-06 11:05:48 +00:00
# ifdef NSIS_CONFIG_COMPONENTPAGE
2004-10-14 13:56:02 +00:00
CB_ONSELCHANGE ,
2004-08-06 11:05:48 +00:00
# endif //NSIS_CONFIG_COMPONENTPAGE
2004-10-14 13:56:02 +00:00
# ifdef NSIS_SUPPORT_REBOOT
CB_ONREBOOTFAILED
# endif //NSIS_SUPPORT_REBOOT
2004-08-06 11:05:48 +00:00
} ;
# endif //NSIS_SUPPORT_CODECALLBACKS
2002-10-02 15:01:06 +00:00
// used for section->flags
# define SF_SELECTED 1
2005-01-10 12:43:52 +00:00
# define SF_SECGRP 2
# define SF_SECGRPEND 4
2002-10-02 15:01:06 +00:00
# define SF_BOLD 8
# define SF_RO 16
# define SF_EXPAND 32
2003-04-05 12:56:57 +00:00
# define SF_PSELECTED 64
2005-01-11 16:29:29 +00:00
# define SF_TOGGLED 128
2005-01-14 15:11:20 +00:00
# define SF_NAMECHG 256
2002-10-02 15:01:06 +00:00
2004-03-29 20:21:00 +00:00
typedef struct
2002-08-02 10:01:35 +00:00
{
2005-01-14 15:11:20 +00:00
int name_ptr ; // initial name pointer
2004-03-29 20:21:00 +00:00
int install_types ; // bits set for each of the different install_types, if any.
int flags ; // SF_* - defined above
2010-03-24 17:22:56 +00:00
// for labels, it looks like it's only used to track how often it is used.
int code ; // The "address" of the start of the code in count of struct entries.
int code_size ; // The size of the code in num of entries?
2004-03-29 20:21:00 +00:00
int size_kb ;
2010-03-24 17:22:56 +00:00
TCHAR name [ NSIS_MAX_STRLEN ] ; // '' for invisible sections
2002-08-02 10:01:35 +00:00
} section ;
2004-01-04 17:05:03 +00:00
# define SECTION_OFFSET(field) (FIELD_OFFSET(section, field) / sizeof(int))
2002-08-02 10:01:35 +00:00
typedef struct
{
2010-03-24 17:22:56 +00:00
int which ; // EW_* enum. Look at the enum values to see what offsets mean.
2003-07-12 15:19:49 +00:00
int offsets [ MAX_ENTRY_OFFSETS ] ; // count and meaning of offsets depend on 'which'
2010-03-24 17:22:56 +00:00
// sometimes they are just straight int values or bool
// values and sometimes they are indices into string
// tables.
2002-08-02 10:01:35 +00:00
} entry ;
2003-09-04 18:25:57 +00:00
// page window proc
2002-11-01 20:34:55 +00:00
enum
{
# ifdef NSIS_CONFIG_LICENSEPAGE
2003-09-04 18:25:57 +00:00
PWP_LICENSE ,
2002-08-02 10:01:35 +00:00
# endif
2002-11-01 20:34:55 +00:00
# ifdef NSIS_CONFIG_COMPONENTPAGE
2003-09-04 18:25:57 +00:00
PWP_SELCOM ,
2002-11-01 20:34:55 +00:00
# endif
2003-09-04 18:25:57 +00:00
PWP_DIR ,
PWP_INSTFILES ,
2002-11-01 20:34:55 +00:00
# ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
2003-09-04 18:25:57 +00:00
PWP_UNINST ,
2002-11-01 20:34:55 +00:00
# endif
2003-09-04 18:25:57 +00:00
PWP_COMPLETED ,
PWP_CUSTOM
2002-11-01 20:34:55 +00:00
} ;
2002-08-02 10:01:35 +00:00
2003-09-04 18:25:57 +00:00
// page flags
# define PF_BACK_ENABLE 256
# define PF_NEXT_ENABLE 2
# define PF_CANCEL_ENABLE 4
# define PF_BACK_SHOW 8 // must be SW_SHOWNA, don't change
# define PF_LICENSE_STREAM 16
# define PF_LICENSE_FORCE_SELECTION 32
# define PF_LICENSE_NO_FORCE_SELECTION 64
# define PF_LICENSE_SELECTED 1 // must be 1
# define PF_NO_NEXT_FOCUS 128
# define PF_PAGE_EX 512
2003-11-24 17:05:10 +00:00
# define PF_DIR_NO_BTN_DISABLE 1024
2003-09-04 18:25:57 +00:00
2002-11-01 20:34:55 +00:00
typedef struct
{
2003-09-04 18:25:57 +00:00
int dlg_id ; // dialog resource id
int wndproc_id ;
2002-11-01 20:34:55 +00:00
# ifdef NSIS_SUPPORT_CODECALLBACKS
2003-09-04 18:25:57 +00:00
// called before the page is created, or if custom to show the page
// use Abort to skip the page
int prefunc ;
// called right before page is shown
int showfunc ;
// called when the user leaves to the next page
// use Abort to force the user to stay on this page
int leavefunc ;
2002-11-01 20:34:55 +00:00
# endif //NSIS_SUPPORT_CODECALLBACKS
2003-09-04 18:25:57 +00:00
int flags ;
int caption ;
int back ;
2002-11-01 20:34:55 +00:00
int next ;
2003-09-04 18:25:57 +00:00
int clicknext ;
int cancel ;
int parms [ 5 ] ;
2002-11-01 20:34:55 +00:00
} page ;
2002-08-02 10:01:35 +00:00
2004-03-29 20:21:00 +00:00
// text/bg color
2003-09-04 18:25:57 +00:00
# define CC_TEXT 1
# define CC_TEXT_SYS 2
# define CC_BK 4
# define CC_BK_SYS 8
# define CC_BKB 16
typedef struct {
COLORREF text ;
2003-12-29 14:27:33 +00:00
COLORREF bkc ;
UINT lbStyle ;
2003-09-04 18:25:57 +00:00
HBRUSH bkb ;
int bkmode ;
int flags ;
} ctlcolors ;
2004-08-06 17:03:07 +00:00
// constants for myDelete (util.c)
# define DEL_DIR 1
# define DEL_RECURSE 2
# define DEL_REBOOT 4
2005-02-18 13:39:42 +00:00
# define DEL_SIMPLE 8
2004-08-06 17:03:07 +00:00
2004-03-29 20:21:00 +00:00
// $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value.
// Added by ramon 3 jun 2003
# define NS_SKIP_CODE 252
# define NS_VAR_CODE 253
# define NS_SHELL_CODE 254
# define NS_LANG_CODE 255
# define NS_CODES_START NS_SKIP_CODE
2010-03-29 14:24:47 +00:00
# define NS_IS_CODE(x) ((x) >= NS_SKIP_CODE)
2004-03-29 20:21:00 +00:00
2010-03-24 17:22:56 +00:00
// We are doing this to store an integer value into a char string and we
// don't want false end of string values so we shift then OR with 0x8080
2009-03-28 10:20:04 +00:00
# define CODE_SHORT(x) (WORD)((((WORD)(x) & 0x7F) | (((WORD)(x) & 0x3F80) << 1) | 0x8080))
2010-03-24 17:22:56 +00:00
# define MAX_CODED 16383 // 0x3FFF
2004-03-29 20:21:00 +00:00
# define NSIS_INSTDIR_INVALID 1
# define NSIS_INSTDIR_NOT_ENOUGH_SPACE 2
# define FIELDN(x, y) (((int *)&x)[y])
# ifdef EXEHEAD
2002-08-02 10:01:35 +00:00
// the following are only used/implemented in exehead, not makensis.
2002-08-19 23:18:19 +00:00
int NSISCALL isheader ( firstheader * h ) ; // returns 0 on not header, length_of_datablock on success
2002-08-02 10:01:35 +00:00
// returns nonzero on error
// returns 0 on success
// on success, m_header will be set to a pointer that should eventually be GlobalFree()'d.
// (or m_uninstheader)
2010-03-24 17:22:56 +00:00
const TCHAR * NSISCALL loadHeaders ( int cl_flags ) ;
2002-08-02 10:01:35 +00:00
2002-10-12 17:08:09 +00:00
int NSISCALL _dodecomp ( int offset , HANDLE hFileOut , char * outbuf , int outbuflen ) ;
# define GetCompressedDataFromDataBlock(offset, hFileOut) _dodecomp(offset,hFileOut,NULL,0)
# define GetCompressedDataFromDataBlockToMemory(offset, out, out_len) _dodecomp(offset,NULL,out,out_len)
2002-08-02 10:01:35 +00:00
extern HANDLE g_db_hFile ;
extern int g_quit_flag ;
2002-09-25 03:34:30 +00:00
BOOL NSISCALL ReadSelfFile ( LPVOID lpBuffer , DWORD nNumberOfBytesToRead ) ;
2003-09-04 18:25:57 +00:00
DWORD NSISCALL SetSelfFilePointer ( LONG lDistanceToMove ) ;
2002-08-02 10:01:35 +00:00
2003-09-04 18:25:57 +00:00
extern struct block_header g_blocks [ BLOCKS_NUM ] ;
extern header * g_header ;
extern int g_flags ;
extern int g_filehdrsize ;
extern int g_is_uninstaller ;
# define g_pages ((page*)g_blocks[NB_PAGES].offset)
# define g_sections ((section*)g_blocks[NB_SECTIONS].offset)
# define num_sections (g_blocks[NB_SECTIONS].num)
# define g_entries ((entry*)g_blocks[NB_ENTRIES].offset)
# endif
2002-08-02 10:01:35 +00:00
# endif //_FILEFORM_H_