GetExeName: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
Instructor (talk | contribs) |
Instructor (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|Instructor}} | {{PageAuthor|Instructor}} | ||
{{User:Instructor/Headers/Template}} | |||
== Function Description== | |||
<highlight-nsis> | <highlight-nsis> | ||
Line 17: | Line 12: | ||
Get installer filename (with valid case for Windows | Get installer filename (with valid case for Windows 98/Me). | ||
Line 32: | Line 27: | ||
</highlight-nsis> | </highlight-nsis> | ||
== | == Function Code == | ||
<highlight-nsis> | <highlight-nsis> | ||
Line 46: | Line 41: | ||
Push $1 | Push $1 | ||
Push $2 | Push $2 | ||
System::Call 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024)' | System::Call /NOUNLOAD 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024)' | ||
System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2' | System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2' | ||
StrCmp $2 error +2 | StrCmp $2 error +2 |
Latest revision as of 07:22, 7 February 2006
Author: Instructor (talk, contrib) |
Page for NSIS 2.07 and below users
You can use the latest version of headers (recommended) or the following function code (put the function code in your script before calling it)
Function Description
____________________________________________________________________________ GetExeName ____________________________________________________________________________ Get installer filename (with valid case for Windows 98/Me). Syntax: ${GetExeName} $var
Example:
Section ${GetExeName} $R0 ; $R0="C:\ftp\program.exe" SectionEnd
Function Code
Function GetExeName !define GetExeName `!insertmacro GetExeNameCall` !macro GetExeNameCall _RESULT Call GetExeName Pop ${_RESULT} !macroend Push $0 Push $1 Push $2 System::Call /NOUNLOAD 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024)' System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2' StrCmp $2 error +2 StrCpy $0 $1 Pop $2 Pop $1 Exch $0 FunctionEnd