From 5eb8365481707652f08b8c48533ca67437ef82d0 Mon Sep 17 00:00:00 2001 From: anders_k Date: Mon, 11 Mar 2019 19:33:07 +0000 Subject: [PATCH] Allow quoted library path in System::Call (bug #546) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7089 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/System/Source/System.c | 60 ++++++++++++++++++++++++++-------- Contrib/System/System.html | 18 +++------- Docs/src/history.but | 3 ++ 3 files changed, 53 insertions(+), 28 deletions(-) diff --git a/Contrib/System/Source/System.c b/Contrib/System/Source/System.c index 11ac8ab2..4a17e656 100644 --- a/Contrib/System/Source/System.c +++ b/Contrib/System/Source/System.c @@ -519,7 +519,7 @@ SystemProc *PrepareProc(BOOL NeedForCall) BOOL param_defined = FALSE; SystemProc *proc = NULL; TCHAR *ibuf, *ib, *sbuf, *cbuf, *cb; - unsigned int UsedTString = 0, aligntype; + unsigned int UsedTString = 0, aligntype, inpathq = 0; #ifdef POPT_SYNTAX2 const UINT alignflag = PAT_ALIGNFLAG; #else @@ -550,22 +550,39 @@ SystemProc *PrepareProc(BOOL NeedForCall) switch (*ib) { - case 0x0: SectionType = -1; break; + case 0x0: + SectionType = -1; + break; case _T('#'): // "...#" redefines proc unless preceded by ":", then it's an ordinal (dll::#123) - if (ib <= ibuf || *(ib-1) != _T(':') || PST_PROC != SectionType) + if ((ib <= ibuf || *(ib-1) != _T(':') || PST_PROC != SectionType) && !inpathq) SectionType = PST_PROC, ProcType = PT_NOTHING; else changed = FALSE; break; - case _T('('): - SectionType = PST_PARAMS; - // fake-real parameter: for COM interfaces first param is Interface Pointer - ParamIndex = ((ProcType == PT_VTABLEPROC)?(2):(1)); - temp3 = temp = 0; - param_defined = FALSE; + case _T('('): + if (inpathq) + changed = FALSE; + else + { + SectionType = PST_PARAMS; + // fake-real parameter: for COM interfaces first param is Interface Pointer + ParamIndex = ((ProcType == PT_VTABLEPROC)?(2):(1)); + temp3 = temp = 0; + param_defined = FALSE; + } break; - case _T(')'): SectionType = PST_RETURN; temp3 = temp = 0; break; - case _T('?'): SectionType = PST_OPTIONS; temp = 1; break; + case _T(')'): + if (inpathq) + changed = FALSE; + else + { + SectionType = PST_RETURN; + temp3 = temp = 0; + } + break; + case _T('?'): + SectionType = PST_OPTIONS; temp = 1; + break; default: changed = FALSE; } @@ -651,16 +668,29 @@ SystemProc *PrepareProc(BOOL NeedForCall) switch (SectionType) { // Proc sections parser - case PST_PROC: + case PST_PROC: parse_next_proc_section_char: switch (*ib) { + case _T('\"'): + ib++; // Skip '\"' + if (inpathq) + { + inpathq = 0; + goto parse_next_proc_section_char; + } + else + { + inpathq++; + } + break; case _T(':'): case _T('-'): // Is it '::' if ((*(ib) == _T('-')) && (*(ib+1) == _T('>'))) { ProcType = PT_VTABLEPROC; - } else + } + else { if ((*(ib+1) != _T(':')) || (*(ib) == _T('-'))) break; ProcType = PT_PROC; @@ -671,7 +701,9 @@ SystemProc *PrepareProc(BOOL NeedForCall) { *cb = 0; lstrcpy(sbuf, cbuf); - } else *sbuf = 0; // No dll - system proc + } + else + *sbuf = 0; // No dll - system proc // Ok ChangesDone = PCD_DONE; diff --git a/Contrib/System/System.html b/Contrib/System/System.html index baa6b4d0..26d05757 100644 --- a/Contrib/System/System.html +++ b/Contrib/System/System.html @@ -434,8 +434,9 @@ System::Free $0
@@ -489,7 +490,8 @@ System::Free $0

Usage Examples

-System::Call "user32::MessageBox(p $HWNDPARENT, t 'NSIS System Plug-in', t 'Test', i 0)"
+System::Call 'user32::MessageBox(p $HWNDPARENT, t "NSIS System Plug-in", t "Test", i 0)'
+System::Call '"$InstDir\MyLibrary.dll"::MyFunction(i 42)'
 
 System::Call "kernel32::GetModuleHandle(t 'user32.dll') p .s"
@@ -672,11 +674,6 @@ Pop $0
 DetailPrint "5 + 5 = $0" # 10
 
-System::Int64Op 64 - 25
-Pop $0
-DetailPrint "64 - 25 = $0" # 39
-
-
 System::Int64Op 526355 * 1565487
 Pop $0
 DetailPrint "526355 * 1565487 = $0" # 824001909885
@@ -710,13 +707,6 @@ Pop $0
 DetailPrint "0x8000000000000000 >>> 1 = $0" # 4611686018427387904 (0x4000000000000000)
 
-System::Int64Op 0xF0F0F0F | 0xF0F0FFF
-Pop $0
-# IntFmt is 32-bit, this is just for the example
-IntFmt $0 "0x%X" $0
-DetailPrint "0xF0F0F0F | 0xF0F0FFF = $0" # 0xF0F0FFF
-
-
 System::Int64Op 0x12345678 & 0xF0F0F0F0
 Pop $0
 # IntFmt is 32-bit, this is just for the example
diff --git a/Docs/src/history.but b/Docs/src/history.but
index 99aa79b0..57897886 100644
--- a/Docs/src/history.but
+++ b/Docs/src/history.but
@@ -18,6 +18,9 @@ ANSI targets are deprecated, consider moving to Unicode.
 
 \b Fixed -O stderr stream issue (\W{http://sf.net/p/nsis/bugs/1221}{bug #1221})
 
+\b Allow quoted library path in System::Call (\W{http://sf.net/p/nsis/bugs/546}{bug #546})
+
+
 \S2{} Translations
 
 \b Updated Hindi (\W{http://sf.net/p/nsis/patches/291}{patch #291}) and Portuguese (\W{http://sf.net/p/nsis/bugs/1219}{bug #1219})