implemented RFE #1778973 - nsExec & ExecDos - Support DisableX64FSRedirection feature
also fixed bug #1889317 git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5542 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
efebf6bedd
commit
8fba6791ad
1 changed files with 77 additions and 53 deletions
|
@ -82,20 +82,39 @@ BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
||||||
#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(a,b))|(CHAR2_TO_WORD(c,d)<<16))
|
#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(a,b))|(CHAR2_TO_WORD(c,d)<<16))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
BOOL IsWOW64() {
|
||||||
|
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||||
|
BOOL wow64;
|
||||||
|
LPFN_ISWOW64PROCESS fnIsWow64Process;
|
||||||
|
|
||||||
|
fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
|
||||||
|
GetModuleHandle("kernel32"), "IsWow64Process");
|
||||||
|
|
||||||
|
if (fnIsWow64Process != NULL) {
|
||||||
|
if (fnIsWow64Process(GetCurrentProcess(), &wow64)) {
|
||||||
|
return wow64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void ExecScript(int log) {
|
void ExecScript(int log) {
|
||||||
char szRet[128] = "";
|
char szRet[128] = "";
|
||||||
char *pExec;
|
|
||||||
int nComSpecSize;
|
|
||||||
char meDLLPath[MAX_PATH];
|
char meDLLPath[MAX_PATH];
|
||||||
char *p;
|
|
||||||
char *executor;
|
char *executor;
|
||||||
char *g_exec;
|
char *g_exec;
|
||||||
|
char *pExec;
|
||||||
unsigned int g_to;
|
unsigned int g_to;
|
||||||
BOOL bOEM;
|
BOOL bOEM;
|
||||||
|
|
||||||
|
if (IsWOW64()) {
|
||||||
|
char *p;
|
||||||
|
int nComSpecSize;
|
||||||
|
|
||||||
nComSpecSize = GetModuleFileName(g_hInst, meDLLPath, MAX_PATH) + 2; // 2 chars for quotes
|
nComSpecSize = GetModuleFileName(g_hInst, meDLLPath, MAX_PATH) + 2; // 2 chars for quotes
|
||||||
p = meDLLPath + nComSpecSize - 2; // point p at null char of meDLLPath
|
|
||||||
g_exec = (char *)GlobalAlloc(GPTR, sizeof(char)*g_stringsize+nComSpecSize+2); // 1 for space, 1 for null
|
g_exec = (char *)GlobalAlloc(GPTR, sizeof(char)*g_stringsize+nComSpecSize+2); // 1 for space, 1 for null
|
||||||
|
p = meDLLPath + nComSpecSize - 2; // point p at null char of meDLLPath
|
||||||
*g_exec = '"';
|
*g_exec = '"';
|
||||||
executor = g_exec + 1;
|
executor = g_exec + 1;
|
||||||
|
|
||||||
|
@ -140,6 +159,16 @@ void ExecScript(int log) {
|
||||||
|
|
||||||
lstrcat(g_exec, "\"");
|
lstrcat(g_exec, "\"");
|
||||||
|
|
||||||
|
// add space
|
||||||
|
pExec = g_exec + lstrlen(g_exec);
|
||||||
|
*pExec = ' ';
|
||||||
|
pExec++;
|
||||||
|
} else {
|
||||||
|
executor = NULL;
|
||||||
|
g_exec = (char *)GlobalAlloc(GPTR, sizeof(char)*g_stringsize+1); // 1 for null
|
||||||
|
pExec = g_exec;
|
||||||
|
}
|
||||||
|
|
||||||
g_to = 0; // default is no timeout
|
g_to = 0; // default is no timeout
|
||||||
bOEM = FALSE; // default is no OEM->ANSI conversion
|
bOEM = FALSE; // default is no OEM->ANSI conversion
|
||||||
|
|
||||||
|
@ -147,11 +176,6 @@ void ExecScript(int log) {
|
||||||
if (g_hwndParent)
|
if (g_hwndParent)
|
||||||
g_hwndList = FindWindowEx(FindWindowEx(g_hwndParent,NULL,"#32770",NULL),NULL,"SysListView32",NULL);
|
g_hwndList = FindWindowEx(FindWindowEx(g_hwndParent,NULL,"#32770",NULL),NULL,"SysListView32",NULL);
|
||||||
|
|
||||||
// add space
|
|
||||||
pExec = g_exec + lstrlen(g_exec);
|
|
||||||
*pExec = ' ';
|
|
||||||
pExec++;
|
|
||||||
|
|
||||||
params:
|
params:
|
||||||
popstring(pExec);
|
popstring(pExec);
|
||||||
if (my_strstr(pExec, "/TIMEOUT=") == pExec) {
|
if (my_strstr(pExec, "/TIMEOUT=") == pExec) {
|
||||||
|
@ -170,7 +194,7 @@ params:
|
||||||
{
|
{
|
||||||
pushstring("error");
|
pushstring("error");
|
||||||
*(pExec-2) = '\0'; // skip space and quote
|
*(pExec-2) = '\0'; // skip space and quote
|
||||||
DeleteFile(executor);
|
if (executor) DeleteFile(executor);
|
||||||
GlobalFree(g_exec);
|
GlobalFree(g_exec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +350,7 @@ done:
|
||||||
CloseHandle(newstdin);
|
CloseHandle(newstdin);
|
||||||
CloseHandle(read_stdin);
|
CloseHandle(read_stdin);
|
||||||
*(pExec-2) = '\0'; // skip space and quote
|
*(pExec-2) = '\0'; // skip space and quote
|
||||||
DeleteFile(executor);
|
if (executor) DeleteFile(executor);
|
||||||
GlobalFree(g_exec);
|
GlobalFree(g_exec);
|
||||||
if (log) {
|
if (log) {
|
||||||
GlobalUnlock(hUnusedBuf);
|
GlobalUnlock(hUnusedBuf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue