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
This commit is contained in:
parent
d5ba6306e7
commit
5eb8365481
3 changed files with 53 additions and 28 deletions
|
@ -519,7 +519,7 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
BOOL param_defined = FALSE;
|
BOOL param_defined = FALSE;
|
||||||
SystemProc *proc = NULL;
|
SystemProc *proc = NULL;
|
||||||
TCHAR *ibuf, *ib, *sbuf, *cbuf, *cb;
|
TCHAR *ibuf, *ib, *sbuf, *cbuf, *cb;
|
||||||
unsigned int UsedTString = 0, aligntype;
|
unsigned int UsedTString = 0, aligntype, inpathq = 0;
|
||||||
#ifdef POPT_SYNTAX2
|
#ifdef POPT_SYNTAX2
|
||||||
const UINT alignflag = PAT_ALIGNFLAG;
|
const UINT alignflag = PAT_ALIGNFLAG;
|
||||||
#else
|
#else
|
||||||
|
@ -550,22 +550,39 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
|
|
||||||
switch (*ib)
|
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)
|
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;
|
SectionType = PST_PROC, ProcType = PT_NOTHING;
|
||||||
else
|
else
|
||||||
changed = FALSE;
|
changed = FALSE;
|
||||||
break;
|
break;
|
||||||
case _T('('):
|
case _T('('):
|
||||||
SectionType = PST_PARAMS;
|
if (inpathq)
|
||||||
// fake-real parameter: for COM interfaces first param is Interface Pointer
|
changed = FALSE;
|
||||||
ParamIndex = ((ProcType == PT_VTABLEPROC)?(2):(1));
|
else
|
||||||
temp3 = temp = 0;
|
{
|
||||||
param_defined = FALSE;
|
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;
|
break;
|
||||||
case _T(')'): SectionType = PST_RETURN; temp3 = temp = 0; break;
|
case _T(')'):
|
||||||
case _T('?'): SectionType = PST_OPTIONS; temp = 1; break;
|
if (inpathq)
|
||||||
|
changed = FALSE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SectionType = PST_RETURN;
|
||||||
|
temp3 = temp = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case _T('?'):
|
||||||
|
SectionType = PST_OPTIONS; temp = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
changed = FALSE;
|
changed = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -651,16 +668,29 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
switch (SectionType)
|
switch (SectionType)
|
||||||
{
|
{
|
||||||
// Proc sections parser
|
// Proc sections parser
|
||||||
case PST_PROC:
|
case PST_PROC: parse_next_proc_section_char:
|
||||||
switch (*ib)
|
switch (*ib)
|
||||||
{
|
{
|
||||||
|
case _T('\"'):
|
||||||
|
ib++; // Skip '\"'
|
||||||
|
if (inpathq)
|
||||||
|
{
|
||||||
|
inpathq = 0;
|
||||||
|
goto parse_next_proc_section_char;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inpathq++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case _T(':'):
|
case _T(':'):
|
||||||
case _T('-'):
|
case _T('-'):
|
||||||
// Is it '::'
|
// Is it '::'
|
||||||
if ((*(ib) == _T('-')) && (*(ib+1) == _T('>')))
|
if ((*(ib) == _T('-')) && (*(ib+1) == _T('>')))
|
||||||
{
|
{
|
||||||
ProcType = PT_VTABLEPROC;
|
ProcType = PT_VTABLEPROC;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if ((*(ib+1) != _T(':')) || (*(ib) == _T('-'))) break;
|
if ((*(ib+1) != _T(':')) || (*(ib) == _T('-'))) break;
|
||||||
ProcType = PT_PROC;
|
ProcType = PT_PROC;
|
||||||
|
@ -671,7 +701,9 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
{
|
{
|
||||||
*cb = 0;
|
*cb = 0;
|
||||||
lstrcpy(sbuf, cbuf);
|
lstrcpy(sbuf, cbuf);
|
||||||
} else *sbuf = 0; // No dll - system proc
|
}
|
||||||
|
else
|
||||||
|
*sbuf = 0; // No dll - system proc
|
||||||
|
|
||||||
// Ok
|
// Ok
|
||||||
ChangesDone = PCD_DONE;
|
ChangesDone = PCD_DONE;
|
||||||
|
|
|
@ -434,8 +434,9 @@ System::Free $0
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<ul>
|
<ul>
|
||||||
<li>To find out the index of a member in a COM interface, you need to search for the definition of this COM interface in the header files that come with Visual C/C++ or the Platform SDK. Remember the index is zero based.</li>
|
<li>To find out the index of a member in a COM interface, you need to search for the definition of this COM interface in the header files that come with Visual C/C++ or the Platform SDK. The index is zero based.</li>
|
||||||
<li>If a function can't be found or the <code>t</code> parameter type was used, an `A' or `W' will be appended to its name and it will be looked up again. This is done because a lot of Windows API functions have two versions, one for ANSI strings and one for Unicode strings. The ANSI version of the function is marked with `A' and the Unicode version is marked with `W'. For example: lstrcpyA and lstrcpyW.</li>
|
<li>If a function can't be found or the <code>t</code> parameter type was used, an `A' or `W' will be appended to its name and it will be looked up again. This is done because a lot of Windows API functions have two versions, one for ANSI strings and one for Unicode strings. The ANSI version of the function is marked with `A' and the Unicode version is marked with `W'. For example: lstrcpyA and lstrcpyW.</li>
|
||||||
|
<li>Libraries in the system32 directory can be loaded without a path. All other libraries should be loaded with a <a href="#funcqpath">quoted full path</a>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
@ -489,7 +490,8 @@ System::Free $0
|
||||||
<h4>Usage Examples</h4>
|
<h4>Usage Examples</h4>
|
||||||
|
|
||||||
<blockquote><pre>
|
<blockquote><pre>
|
||||||
<a name="func"></a>System::<b>Call</b> "user32::MessageBox(p $HWNDPARENT, t 'NSIS System Plug-in', t 'Test', i 0)"
|
<a name="func"></a>System::<b>Call</b> 'user32::MessageBox(p $HWNDPARENT, t "NSIS System Plug-in", t "Test", i 0)'
|
||||||
|
<a name="funcqpath"></a>System::<b>Call</b> '"$InstDir\MyLibrary.dll"::MyFunction(i 42)'
|
||||||
</pre></blockquote>
|
</pre></blockquote>
|
||||||
<blockquote><pre>
|
<blockquote><pre>
|
||||||
<a name="funcaddr"></a>System::<b>Call</b> "kernel32::GetModuleHandle(t 'user32.dll') p .s"
|
<a name="funcaddr"></a>System::<b>Call</b> "kernel32::GetModuleHandle(t 'user32.dll') p .s"
|
||||||
|
@ -672,11 +674,6 @@ Pop $0
|
||||||
DetailPrint "5 + 5 = $0" # 10
|
DetailPrint "5 + 5 = $0" # 10
|
||||||
</pre></blockquote>
|
</pre></blockquote>
|
||||||
<blockquote><pre>
|
<blockquote><pre>
|
||||||
System::<b>Int64Op</b> 64 - 25
|
|
||||||
Pop $0
|
|
||||||
DetailPrint "64 - 25 = $0" # 39
|
|
||||||
</pre></blockquote>
|
|
||||||
<blockquote><pre>
|
|
||||||
System::<b>Int64Op</b> 526355 * 1565487
|
System::<b>Int64Op</b> 526355 * 1565487
|
||||||
Pop $0
|
Pop $0
|
||||||
DetailPrint "526355 * 1565487 = $0" # 824001909885
|
DetailPrint "526355 * 1565487 = $0" # 824001909885
|
||||||
|
@ -710,13 +707,6 @@ Pop $0
|
||||||
DetailPrint "0x8000000000000000 >>> 1 = $0" # 4611686018427387904 (0x4000000000000000)
|
DetailPrint "0x8000000000000000 >>> 1 = $0" # 4611686018427387904 (0x4000000000000000)
|
||||||
</pre></blockquote>
|
</pre></blockquote>
|
||||||
<blockquote><pre>
|
<blockquote><pre>
|
||||||
System::<b>Int64Op</b> 0xF0F0F0F | 0xF0F0FFF
|
|
||||||
Pop $0
|
|
||||||
# IntFmt is 32-bit, this is just for the example
|
|
||||||
IntFmt $0 "0x%X" $0
|
|
||||||
DetailPrint "0xF0F0F0F | 0xF0F0FFF = $0" # 0xF0F0FFF
|
|
||||||
</pre></blockquote>
|
|
||||||
<blockquote><pre>
|
|
||||||
System::<b>Int64Op</b> 0x12345678 & 0xF0F0F0F0
|
System::<b>Int64Op</b> 0x12345678 & 0xF0F0F0F0
|
||||||
Pop $0
|
Pop $0
|
||||||
# IntFmt is 32-bit, this is just for the example
|
# IntFmt is 32-bit, this is just for the example
|
||||||
|
|
|
@ -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 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
|
\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})
|
\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})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue