diff --git a/Docs/src/history.but b/Docs/src/history.but index eddffbe5..ee3670df 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -8,7 +8,7 @@ Released on ??? ??th, 20?? \S2{} Major Changes -\b Added IsNativeProcessorArchitecture helper macros to x64.nsh +\b Added IsNativeMachineArchitecture helper macros to x64.nsh \S2{} Minor Changes @@ -3379,7 +3379,7 @@ Released on December 6th, 2002 \b Licence text receives initial focus (page up & down work immediately, return key still works) -\b Made win9x move/delete on reboot support proper and function like on win2k +\b Made Win9x move/delete on reboot support proper and function like on Win2k \b Now always loads RichEdit v2 if present (links work on Win9x) diff --git a/Docs/src/ui.but b/Docs/src/ui.but index fdfdb4ab..5ea7cfce 100644 --- a/Docs/src/ui.but +++ b/Docs/src/ui.but @@ -112,7 +112,7 @@ Shows or hides the details, depending on which parameter you pass. Overrides the \c none|listonly|textonly|both|lastused -Sets mode at which commands print their status. None has commands be quiet, listonly has status text only added to the listbox, textonly has status text only printed to the status bar, and both enables both (the default). For extracting many small files, textonly is recommended (especially on win9x with smooth scrolling enabled). +Sets mode at which commands print their status. None has commands be quiet, listonly has status text only added to the listbox, textonly has status text only printed to the status bar, and both enables both (the default). For extracting many small files, textonly is recommended (especially on Win9x with smooth scrolling enabled). \c SetDetailsPrint none \c File "secret file.dat" diff --git a/Include/Win/WinNT.nsh b/Include/Win/WinNT.nsh index 4abfed8d..09e9aaf4 100644 --- a/Include/Win/WinNT.nsh +++ b/Include/Win/WinNT.nsh @@ -212,6 +212,13 @@ !define PROCESSOR_ARCHITECTURE_ARM64 12 !define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13 +!define IMAGE_FILE_MACHINE_UNKNOWN 0 +!define IMAGE_FILE_MACHINE_I386 332 ; x86 +!define IMAGE_FILE_MACHINE_ARMNT 452 +!define IMAGE_FILE_MACHINE_IA64 512 ; Itanium +!define IMAGE_FILE_MACHINE_AMD64 34404 ; x86-64/x64 +!define IMAGE_FILE_MACHINE_ARM64 43620 + !endif /* __WIN_NOINC_WINNT */ !verbose pop !endif /* __WIN_WINNT__INC */ \ No newline at end of file diff --git a/Include/x64.nsh b/Include/x64.nsh index 7212f3a0..2b77ed57 100644 --- a/Include/x64.nsh +++ b/Include/x64.nsh @@ -43,7 +43,10 @@ !macro _IsWow64 _a _b _t _f !insertmacro _LOGICLIB_TEMP System::Call kernel32::GetCurrentProcess()p.s - System::Call kernel32::IsWow64Process(ps,*i0s) + System::Call kernel32::IsWow64Process2(ps,*i0s,*i) ; [Win10.1511+] 0 if not WOW64 + Push | + System::Call kernel32::IsWow64Process(p-1,*i0s) ; [WinXP+] FALSE for a 32-bit application on ARM64! + System::Int64Op Pop $_LOGICLIB_TEMP !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` !macroend @@ -59,31 +62,39 @@ !macroend -!define GetNativeProcessorArchitecture "!insertmacro GetNativeProcessorArchitecture " -!macro GetNativeProcessorArchitecture outvar - !if ${outvar} != $1 - Push $1 - !endif - !if "${NSIS_PTR_SIZE}" <= 4 - System::Call 'KERNEL32::GetSystemInfo(@r1)' ; < XP - !endif - System::Call 'KERNEL32::GetNativeSystemInfo(@r1)' - System::Call '*$1(&i2.s)' ; Extract wProcessorArchitecture (PROCESSOR_ARCHITECTURE_*) +!define GetNativeMachineArchitecture "!insertmacro GetNativeMachineArchitecture " +!macro GetNativeMachineArchitecture outvar + !define GetNativeMachineArchitecture_lbl lbl_GNMA_${__COUNTER__} + System::Call kernel32::GetCurrentProcess()p.s + System::Call kernel32::IsWow64Process2(ps,*i,*i0s) Pop ${outvar} - !if ${outvar} != $1 - Pop $1 - !endif + IntCmp ${outvar} 0 "" ${GetNativeMachineArchitecture_lbl}_done ${GetNativeMachineArchitecture_lbl}_done + !if "${NSIS_PTR_SIZE}" <= 4 + !if "${NSIS_CHAR_SIZE}" <= 1 + System::Call 'USER32::CharNextW(w"")p.s' + Pop ${outvar} + IntPtrCmpU ${outvar} 0 "" ${GetNativeMachineArchitecture_lbl}_oldnt ${GetNativeMachineArchitecture_lbl}_oldnt + StrCpy ${outvar} 332 ; Always IMAGE_FILE_MACHINE_I386 on Win9x + Goto ${GetNativeMachineArchitecture_lbl}_done + ${GetNativeMachineArchitecture_lbl}_oldnt: + !endif + !endif + System::Call '*0x7FFE002E(&i2.s)' + Pop ${outvar} + ${GetNativeMachineArchitecture_lbl}_done: + !undef GetNativeMachineArchitecture_lbl !macroend -!define IsNativeProcessorArchitecture `"" IsNativeProcessorArchitecture ` -!macro _IsNativeProcessorArchitecture _ignore _arc _t _f +!macro _IsNativeMachineArchitecture _ignore _arc _t _f !insertmacro _LOGICLIB_TEMP - ${GetNativeProcessorArchitecture} $_LOGICLIB_TEMP + ${GetNativeMachineArchitecture} $_LOGICLIB_TEMP !insertmacro _= $_LOGICLIB_TEMP ${_arc} `${_t}` `${_f}` !macroend -!define IsNativeIA32 '${IsNativeProcessorArchitecture} 0' ; Intel x86 -!define IsNativeAMD64 '${IsNativeProcessorArchitecture} 9' ; x86-64/x64 -!define IsNativeARM64 '${IsNativeProcessorArchitecture} 12' + +!define IsNativeMachineArchitecture `"" IsNativeMachineArchitecture ` +!define IsNativeIA32 '${IsNativeMachineArchitecture} 332' ; Intel x86 +!define IsNativeAMD64 '${IsNativeMachineArchitecture} 34404' ; x86-64/x64 +!define IsNativeARM64 '${IsNativeMachineArchitecture} 43620' !define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"