Fixed QUIT problem inside custom pages, user-variables activated and command "Dim" changed to "Var", language strings inside other strings are replaced

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2704 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
ramon18 2003-07-08 23:18:47 +00:00
parent 00926155b9
commit 323c9af320
8 changed files with 48 additions and 27 deletions

View file

@ -33,9 +33,9 @@
;--------------------------------
; Declaration of User Variables with command DIM, allowed charaters for variables names : [a-z][A-Z][0-9] and '_'
DIM "un.Info" ; this one can only be used in uninstaller methods
DIM "Name"
DIM "Serial"
Var "un.Info" ; this one can only be used in uninstaller methods
Var "Name"
Var "Serial"
;--------------------------------
;Installer Sections

View file

@ -102,19 +102,37 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
char *realcmds;
char seekchar=' ';
char *cmdline;
#ifdef NSIS_SUPPORT_NAMED_USERVARS
g_usrvars = (NSIS_STRING*)my_GlobalAlloc(USER_VARS_COUNT*sizeof(NSIS_STRING));
#endif
//WIN32_FIND_DATA *pfd;
InitCommonControls();
mystrcpy(g_caption,_LANG_GENERIC_ERROR);
GetTempPath(sizeof(state_temp_dir), state_temp_dir);
CreateDirectory(state_temp_dir,NULL);
validate_filename(state_temp_dir);
// This is not so effective...!!??!
// The perfect way is:
// - Test Access for filewrite
// - Test Access for folder creation (needed for plugins)
// - And if one of the above tests fail, change to "$WINDIR\TEMP" and re-test
// but this will take to much size in exehead and is unreliable too
/*
pfd = file_exists(state_temp_dir);
if (!pfd || !(pfd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
// Setup temp dir to "$WINDIR\TEMP"
mystrcpy(state_temp_dir+GetWindowsDirectory(state_temp_dir, sizeof(state_temp_dir)), "\\Temp");
if ( !file_exists(state_temp_dir) || !CreateDirectory(state_temp_dir, NULL) )
{
m_Err = _LANG_ERRORWRITINGTEMP;
goto end;
}
}
*/
lstrcpyn(state_command_line,GetCommandLine(),NSIS_MAX_STRLEN);
mystrcpy(g_caption,_LANG_GENERIC_ERROR);
g_hInstance=GetModuleHandle(NULL);
GetModuleFileName(g_hInstance,state_exe_directory,NSIS_MAX_STRLEN);
@ -304,7 +322,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
for (x = 0; x < 26; x ++)
{
static char s[]="A~NSISu_.exe";
// File name need slash before coz temp dir was changed by validate_filename(...)
static char s[]="\\A~NSISu_.exe";
static char buf2[NSIS_MAX_STRLEN*2];
static char ibuf[NSIS_MAX_STRLEN];

View file

@ -395,7 +395,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (m_page>=0) {
#ifdef NSIS_SUPPORT_CODECALLBACKS
// Call leave function. If Abort used don't move to the next page.
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) return 1;
// But if quit called we must exit now
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) return !g_quit_flag;
#endif
// if the last page was a custom page, wait for it to finish by itself.

View file

@ -196,14 +196,14 @@
// Added by ramon 3 jun 2003
// NSIS_SUPPORT_NAMED_USERVARS enables support for user variables
//#define NSIS_SUPPORT_NAMED_USERVARS
#define NSIS_SUPPORT_NAMED_USERVARS
// Added by ramon 5 jun 2003
// NSIS_SUPPORT_VERSION_INFO enables support for version information on final exe
#define NSIS_SUPPORT_VERSION_INFO
// NSIS_SUPPORT_LANG_IN_STRINGS enables support for language strings inside other strings
//#define NSIS_SUPPORT_LANG_IN_STRINGS
#define NSIS_SUPPORT_LANG_IN_STRINGS
// NSIS_FIX_DEFINES_IN_STRINGS fix defines inside defines and handles chars $ perfectly
//#define NSIS_FIX_DEFINES_IN_STRINGS

View file

@ -26,19 +26,6 @@ static stack_t *g_st;
union installer_flags g_flags;
static WIN32_FIND_DATA * NSISCALL file_exists(char *buf)
{
HANDLE h;
static WIN32_FIND_DATA fd;
h = FindFirstFile(buf,&fd);
if (h != INVALID_HANDLE_VALUE)
{
FindClose(h);
return &fd;
}
return NULL;
}
#ifdef NSIS_SUPPORT_REGISTRYFUNCTIONS
// based loosely on code from Tim Kosse
// in win9x this isn't necessary (RegDeleteKey() can delete a tree of keys),

View file

@ -704,3 +704,16 @@ void NSISCALL log_write(int close)
}
}
#endif
WIN32_FIND_DATA * NSISCALL file_exists(char *buf)
{
HANDLE h;
static WIN32_FIND_DATA fd;
h = FindFirstFile(buf,&fd);
if (h != INVALID_HANDLE_VALUE)
{
FindClose(h);
return &fd;
}
return NULL;
}

View file

@ -13,6 +13,7 @@ void NSISCALL myitoa(char *s, int d);
char * NSISCALL mystrcpy(char *out, const char *in);
int NSISCALL mystrlen(const char *in);
char * NSISCALL mystrstr(char *a, char *b);
WIN32_FIND_DATA * NSISCALL file_exists(char *buf);
//BOOL NSISCALL my_SetWindowText(HWND hWnd, const char *val);
#define my_SetWindowText SetWindowText

View file

@ -228,7 +228,7 @@ static tokenType tokenlist[TOK__LAST] =
// Added by ramon 23 May 2003
{TOK_ALLOWSKIPFILES,"AllowSkipFiles",1,0,"(off|on)"},
// Added by ramon 3 jun 2003
{TOK_DEFVAR,"dim",1,0,"VarName"},
{TOK_DEFVAR,"Var",1,0,"VarName"},
// Added by ramon 6 jun 2003
{TOK_VI_ADDKEY,"VIAddVersionKey", 2, 1, "[/LANG=lang_id] keyname value"},
{TOK_VI_SETPRODUCTVERSION,"VIProductVersion", 1, 0, "[version_string_X.X.X.X]"},