- Fixed uninstaller refusal to start when on the root directory (note that AllowRootDirInstall true is still required)

- Some touch ups regarding NSIS_CONFIG_VISIBLE_SUPPORT


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2896 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-09-10 16:39:06 +00:00
parent aa09b6bdb9
commit 9d7de707ea
5 changed files with 40 additions and 15 deletions

View file

@ -44,7 +44,10 @@ extern HANDLE dbd_hFile;
char g_caption[NSIS_MAX_STRLEN*2]; char g_caption[NSIS_MAX_STRLEN*2];
int g_filehdrsize; int g_filehdrsize;
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
HWND g_hwnd; HWND g_hwnd;
HANDLE g_hInstance;
#endif
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow)
{ {
@ -89,7 +92,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
lstrcpyn(state_command_line, GetCommandLine(), NSIS_MAX_STRLEN); lstrcpyn(state_command_line, GetCommandLine(), NSIS_MAX_STRLEN);
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
g_hInstance = GetModuleHandle(NULL); g_hInstance = GetModuleHandle(NULL);
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
cmdline = state_command_line; cmdline = state_command_line;
if (*cmdline == '\"') seekchar = *cmdline++; if (*cmdline == '\"') seekchar = *cmdline++;
@ -139,6 +144,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
while (p >= cmdline && (p[0] != '_' || p[1] != '?' || p[2] != '=')) p--; while (p >= cmdline && (p[0] != '_' || p[1] != '?' || p[2] != '=')) p--;
m_Err = _LANG_UNINSTINITERROR;
if (p >= cmdline) if (p >= cmdline)
{ {
*(p-1)=0; // terminate before the " _?=" *(p-1)=0; // terminate before the " _?="
@ -147,20 +154,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
{ {
mystrcpy(state_install_directory, p); mystrcpy(state_install_directory, p);
mystrcpy(state_output_directory, p); mystrcpy(state_output_directory, p);
m_Err = 0;
} }
else else
{ {
m_Err = _LANG_UNINSTINITERROR;
goto end; goto end;
} }
} }
else else
{ {
int x,done=0; int x;
for (x = 0; x < 26; x ++) for (x = 0; x < 26; x ++)
{ {
// File name need slash before coz temp dir was changed by validate_filename(...) // File name need slash before because temp dir was changed by validate_filename
static char s[]="\\A~NSISu_.exe"; static char s[]="\\A~NSISu_.exe";
static char buf2[NSIS_MAX_STRLEN*2]; static char buf2[NSIS_MAX_STRLEN*2];
static char ibuf[NSIS_MAX_STRLEN]; static char ibuf[NSIS_MAX_STRLEN];
@ -171,7 +178,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
DeleteFile(buf2+1); // clean up after all the other ones if they are there DeleteFile(buf2+1); // clean up after all the other ones if they are there
if (!done) if (m_Err) // not done yet
{ {
// get current name // get current name
int l=GetModuleFileName(g_hInstance,ibuf,sizeof(ibuf)); int l=GetModuleFileName(g_hInstance,ibuf,sizeof(ibuf));
@ -187,19 +194,23 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
#endif #endif
if (state_install_directory[0]) mystrcpy(ibuf,state_install_directory); if (state_install_directory[0]) mystrcpy(ibuf,state_install_directory);
else trimslashtoend(ibuf); else trimslashtoend(ibuf);
done++;
lstrcat(buf2,"\" "); lstrcat(buf2,"\" ");
lstrcat(buf2,realcmds); lstrcat(buf2,realcmds);
lstrcat(buf2," _?="); lstrcat(buf2," _?=");
lstrcat(buf2,ibuf); lstrcat(buf2,ibuf);
// add a trailing backslash to make sure is_valid_instpath will not fail when it shouldn't
lstrcat(buf2,"\\");
hProc=myCreateProcess(buf2,state_temp_dir); hProc=myCreateProcess(buf2,state_temp_dir);
if (hProc) CloseHandle(hProc); if (hProc)
else m_Err = _LANG_UNINSTINITERROR; {
CloseHandle(hProc);
// success
m_Err = 0;
}
} }
} }
s[0]++; s[0]++;
} }
if (!done) m_Err = _LANG_UNINSTINITERROR;
goto end; goto end;
} }
} }

View file

@ -37,7 +37,9 @@
#define LB_ICONWIDTH 20 #define LB_ICONWIDTH 20
#define LB_ICONHEIGHT 20 #define LB_ICONHEIGHT 20
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
HICON g_hIcon; HICON g_hIcon;
#endif
int dlg_offset; int dlg_offset;

View file

@ -191,10 +191,12 @@ static int NSISCALL ExecuteEntry(entry *entry_)
Sleep(max(x,1)); Sleep(max(x,1));
} }
break; break;
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
case EW_BRINGTOFRONT: case EW_BRINGTOFRONT:
log_printf("BringToFront"); log_printf("BringToFront");
SetForegroundWindow(g_hwnd); SetForegroundWindow(g_hwnd);
break; break;
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
case EW_SETFLAG: case EW_SETFLAG:
g_exec_flags.flags[parm0]=GetIntFromParm(1); g_exec_flags.flags[parm0]=GetIntFromParm(1);
break; break;
@ -207,10 +209,12 @@ static int NSISCALL ExecuteEntry(entry *entry_)
case EW_GETFLAG: case EW_GETFLAG:
myitoa(var0,g_exec_flags.flags[parm1]); myitoa(var0,g_exec_flags.flags[parm1]);
break; break;
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
case EW_CHDETAILSVIEW: case EW_CHDETAILSVIEW:
if (insthwndbutton) ShowWindow(insthwndbutton,parm1); if (insthwndbutton) ShowWindow(insthwndbutton,parm1);
if (insthwnd) ShowWindow(insthwnd,parm0); if (insthwnd) ShowWindow(insthwnd,parm0);
break; break;
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
case EW_SETFILEATTRIBUTES: { case EW_SETFILEATTRIBUTES: {
char *buf1=GetStringFromParm(-0x10); char *buf1=GetStringFromParm(-0x10);
log_printf3("SetFileAttributes: \"%s\":%08X",buf1,parm1); log_printf3("SetFileAttributes: \"%s\":%08X",buf1,parm1);
@ -944,12 +948,16 @@ static int NSISCALL ExecuteEntry(entry *entry_)
{ {
void (*func)(HWND,int,char*,void*); void (*func)(HWND,int,char*,void*);
func=(void*)funke; func=(void*)funke;
func(g_hwnd,NSIS_MAX_STRLEN,(char*)g_usrvars, func(
g_hwnd,
NSIS_MAX_STRLEN,
(char*)g_usrvars,
#ifdef NSIS_SUPPORT_STACK #ifdef NSIS_SUPPORT_STACK
(void*)&g_st); (void*)&g_st
#else #else
NULL); NULL
#endif #endif//NSIS_SUPPORT_STACK
);
} }
} }
else else

View file

@ -16,7 +16,13 @@
#endif #endif
extern char g_caption[NSIS_MAX_STRLEN*2]; extern char g_caption[NSIS_MAX_STRLEN*2];
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
extern HWND g_hwnd; extern HWND g_hwnd;
extern HANDLE g_hInstance; extern HANDLE g_hInstance;
extern HWND insthwnd,insthwndbutton; extern HWND insthwnd,insthwndbutton;
extern HICON g_hIcon; extern HICON g_hIcon;
#else
#define g_hwnd 0
#define g_hInstance 0
#define g_hIcon 0
#endif//NSIS_CONFIG_VISIBLE_SUPPORT

View file

@ -40,8 +40,6 @@ char g_log_file[1024];
char *state_plugins_dir=g_usrvars[36]; char *state_plugins_dir=g_usrvars[36];
#endif #endif
HANDLE g_hInstance;
#ifndef INVALID_FILE_ATTRIBUTES #ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif #endif