######## # DEFiNE ######## !define REG `${SET}\EPM.reg` !define DEFREG `${DEFSET}\EPM.reg` ;=== !define LANG `HKEY_LOCAL_MACHINE\SOFTWARE\EASEUS\EPM` !define KEY Language ;=== !define LNG `${DATA}\Languages` !define DEFLNG `${DEFDATA}\Languages` ;=== !define LOG `${DATA}\Logs` !define TLOG `${DATA}\TrayLogs` ;=== !define BIN `${APPDIR}\bin` !define INI1 `${BIN}\language.ini` !define INI2 `${BIN}\start.ini` !define INI3 `${BIN}\UIConfigAdd.ini` ;=== !define RES `${APPDIR}\res` !define RES1 `${RES}\language.ini` !define RES2 `${RES}\start.ini` !define RES3 `${RES}\UIConfigAdd.ini` ;=== !define EN `${LNG}\English` !define DE `${LNG}\German` !define FR `${LNG}\French` !define JA `${LNG}\Japanese` !define ES `${LNG}\Spanish` !define PT `${LNG}\Portuguese` !define PL `${LNG}\Polish` ;=== !define EPMNTDRV `$SYSDIR\epmntdrv.sys` !define EUGDIDRV `$SYSDIR\EuGdiDrv.sys` ;=== !define BOOTMAN `$SYSDIR\BootMan.exe` !define EUEPMGDI `$SYSDIR\EuEpmGdi.dll` ;=== !define DRV32 `$SYSDIR\setupempdrv03.exe` !define DRV64 `$SYSDIR\setupempdrvx64.exe` ;=== !define KEY1 `SYSTEM\CurrentControlSet\services\epmntdrv` !define KEY2 `SYSTEM\CurrentControlSet\services\EuGdiDrv` ;=== !define LEGACY `SYSTEM\CurrentControlSet\Enum\Root\LEGACY_EUGDIDRV` ;=== !define SYS `${DATA}\SysDir` !define DEFSYS `${DEFDATA}\SysDir` ;=== !define SYS1 `${SYS}\EuEpmGdi,1.dll` !define DEFSYS1 `${DEFSYS}\EuEpmGdi,1.dll` ;=== !define SYS2 `${SYS}\BootMan,1.exe` !define DEFSYS2 `${DEFSYS}\BootMan,1.exe` ;=== !define SYS3 `${SYS}\EuGdiDrv,1.sys` !define DEFSYS3 `${DEFSYS}\EuGdiDrv,1.sys` ;=== !define SYS4 `${SYS}\setupempdrv03,1.exe` !define DEFSYS4 `${DEFSYS}\setupempdrv03,1.exe` ;=== !define SYS5 `${SYS}\epmntdrv,2.sys` !define DEFSYS5 `${DEFSYS}\epmntdrv,2.sys` ;=== !define SYS6 `${SYS}\EuGdiDrv,2.sys` !define DEFSYS6 `${DEFSYS}\EuGdiDrv,2.sys` ;=== !define SYS7 `${SYS}\setupempdrv03,2.exe` !define DEFSYS7 `${DEFSYS}\setupempdrv03,2.exe` ;=== !define SYS8 `${SYS}\epmntdrv,3.sys` !define DEFSYS8 `${DEFSYS}\epmntdrv,3.sys` ;=== !define SYS9 `${SYS}\epmntdrv,1.sys` !define DEFSYS9 `${DEFSYS}\epmntdrv,1.sys` ;=== !define SYS10 `${SYS}\EuEpmGdi,2.dll` !define DEFSYS10 `${DEFSYS}\EuEpmGdi,2.dll` ;=== !define SYS11 `${SYS}\BootMan,2.exe` !define DEFSYS11 `${DEFSYS}\BootMan,2.exe` ;=== !define SYS12 `${SYS}\EuGdiDrv,4.sys` !define DEFSYS12 `${DEFSYS}\EuGdiDrv,4.sys` ;=== !define SYS13 `${SYS}\setupempdrvx64,2.exe` !define DEFSYS13 `${DEFSYS}\setupempdrvx64,2.exe` ;=== !define SYS14 `${SYS}\epmntdrv,5.sys` !define DEFSYS14 `${DEFSYS}\epmntdrv,5.sys` ;=== !define SYS15 `${SYS}\EuGdiDrv,3.sys` !define DEFSYS15 `${DEFSYS}\EuGdiDrv,3.sys` ;=== !define SYS16 `${SYS}\setupempdrvx64,1.exe` !define DEFSYS16 `${DEFSYS}\setupempdrvx64,1.exe` ;=== !define SYS17 `${SYS}\epmntdrv,4.sys` !define DEFSYS17 `${DEFSYS}\epmntdrv,4.sys` ;=== !define PFM `$0\PortableApps.com\PortableAppsPlatform.exe` ####### # MACRO ####### !define _GetVolumeInformationSysCall "Kernel32::GetVolumeInformation(t,t,i,*i,*i,*i,t,i) i" !macro GetDiskVolumeSerialNumber _DRIVE Push $0 System::Call '${_GetVolumeInformationSysCall}("${_DRIVE}",,${NSIS_MAX_STRLEN},.r0,,,,${NSIS_MAX_STRLEN})' Exch $0 Pop ${_DRIVE} !macroend !define GetDiskVolumeSerialNumber "!insertmacro GetDiskVolumeSerialNumber" !macro GetDiskVolumeSerialNumberHex _VAR StrCpy ${_VAR} $WINDIR 3 ${GetDiskVolumeSerialNumber} ${_VAR} IntFmt ${_VAR} "%08X" ${_VAR} !macroend !define GetDiskVolumeSerialNumberHex "!insertmacro GetDiskVolumeSerialNumberHex" !define ImportDigitalSignature "!insertmacro _ImportDigitalSignature" !macro _ImportDigitalSignature !define IMPORT `"$SYSDIR\certutil.exe" -importpfx -p "" "$PLUGINSDIR\PortableWares.p12"` SetOutPath `$PLUGINSDIR` File PortableWares.p12 ${If} ${RunningX64} ExecDos::Exec /TOSTACK /DISABLEFSR `${IMPORT}` ${Else} ExecDos::Exec /TOSTACK `${IMPORT}` ${EndIf} SetOutPath `${BIN}` !macroend Function GetLCID !macro _GetLCID _LNG _LCID Push ${_LNG} Call GetLCID Pop ${_LCID} !macroend !define GetLCID "!insertmacro _GetLCID" Exch $0 StrCmp $0 English 0 +3 StrCpy $0 1033 Goto EndLCID StrCmp $0 German 0 +3 StrCpy $0 1031 Goto EndLCID StrCmp $0 French 0 +3 StrCpy $0 1036 Goto EndLCID StrCmp $0 Japanese 0 +3 StrCpy $0 1041 Goto EndLCID StrCmp $0 Polish 0 +3 StrCpy $0 1045 Goto EndLCID StrCmp $0 Portuguese 0 +3 StrCpy $0 2070 Goto EndLCID StrCmp $0 Spanish 0 +3 StrCpy $0 1034 Goto +2 StrCpy $0 1033 EndLCID: Exch $0 FunctionEnd Function GetLNG !macro _GetLNG _LCID _LNG Push ${_LCID} Call GetLNG Pop ${_LNG} !macroend !define GetLNG "!insertmacro _GetLNG" Exch $0 StrCmp $0 1033 0 +3 StrCpy $0 English Goto EndLNG StrCmp $0 1031 0 +3 StrCpy $0 German Goto EndLNG StrCmp $0 1036 0 +3 StrCpy $0 French Goto EndLNG StrCmp $0 1041 0 +3 StrCpy $0 Japanese Goto EndLNG StrCmp $0 1045 0 +3 StrCpy $0 Polish Goto EndLNG StrCmp $0 2070 0 +3 StrCpy $0 Portuguese Goto EndLNG StrCmp $0 1034 0 +3 StrCpy $0 Spanish Goto +2 StrCpy $0 error EndLNG: Exch $0 FunctionEnd ######## # CUSTOM ######## ${SegmentFile} ${Segment.OnInit} Push $0 ${IsWOW64} $0 StrCmp $0 0 0 +3 ${WriteSettings} 32 Architecture Goto +2 ${WriteSettings} 64 Architecture Pop $0 !macroend ;=== !macro OS ${If} ${IsNT} ${IfNot} ${AtLeastWinXP} StrCpy $0 `Windows XP or newer` MessageBox MB_ICONSTOP|MB_TOPMOST `$(MINREQ)` Call Unload Quit ${EndIf} ${Else} StrCpy $0 `Windows XP or newer` MessageBox MB_ICONSTOP|MB_TOPMOST `$(MINREQ)` Call Unload Quit ${EndIf} !macroend ;=== !define PortableApps.comLocaleID "!insertmacro _PortableApps.comLocaleID" !macro _PortableApps.comLocaleID IfFileExists `${REG}` 0 +3 ReadINIStr $0 `${REG}` `${LANG}` `"${KEY}"` Goto +2 ReadINIStr $0 `${DEFREG}` `${LANG}` `"${KEY}"` ${GetLCID} $0 $0 ${SetEnvironmentVariable} PortableApps.comLocaleID $0 !macroend !define GetLocaleID "!insertmacro _GetLocaleID" !macro _GetLocaleID ClearErrors ${ConfigReads} `${CONFIG}` Language= $0 ${If} ${Errors} ${OrIf} $0 == "" ${PortableApps.comLocaleID} ${Else} ${GetLCID} $0 $0 ${SetEnvironmentVariable} PortableApps.comLocaleID $0 WriteINIStr `${CONFIG}` ${APPNAME} Language "" ${EndIf} !macroend !macro Lang Push $0 ${GetParent} `$EXEDIR` $0 ${If} ${FileExists} `${PFM}` ReadEnvStr $0 PortableApps.comLocaleID ${GetLNG} $0 $0 ${If} $0 == error ${GetLocaleID} ${EndIf} ${Else} ${GetLocaleID} ${EndIf} Pop $0 !macroend ;=== !macro LangInit Push $0 ReadEnvStr $0 PortableApps.comLocaleID ${GetLNG} $0 $0 ${SetEnvironmentVariable} PAL:LanguageCustom $0 Pop $0 !macroend ;=== !macro Init Push $0 Push $1 IfFileExists `${LOG}` +2 CreateDirectory `${LOG}` IfFileExists `${TLOG}` +2 CreateDirectory `${TLOG}` IfFileExists `${SYS}` +2 CreateDirectory `${SYS}` ReadEnvStr $0 PAL:LanguageCustom IfFileExists `${LNG}\$0\*.png` +3 CreateDirectory `${LNG}\$0` CopyFiles /SILENT `${DEFLNG}\$0\*.*` `${LNG}\$0` IfFileExists `${REG}` +2 CopyFiles /SILENT `${DEFREG}` `${REG}` ${If} ${RunningX64} IfFileExists `${SYS10}` +2 CopyFiles /SILENT `${DEFSYS10}` `${SYS10}` IfFileExists `${SYS11}` +2 CopyFiles /SILENT `${DEFSYS11}` `${SYS11}` ${If} ${IsWinVista} IfFileExists `${SYS12}` +2 CopyFiles /SILENT `${DEFSYS12}` `${SYS12}` IfFileExists `${SYS13}` +2 CopyFiles /SILENT `${DEFSYS13}` `${SYS13}` IfFileExists `${SYS14}` +2 CopyFiles /SILENT `${DEFSYS14}` `${SYS14}` ${Else} IfFileExists `${SYS15}` +2 CopyFiles /SILENT `${DEFSYS15}` `${SYS15}` IfFileExists `${SYS16}` +2 CopyFiles /SILENT `${DEFSYS16}` `${SYS16}` IfFileExists `${SYS17}` +2 CopyFiles /SILENT `${DEFSYS17}` `${SYS17}` ${EndIf} ${Else} IfFileExists `${SYS1}` +2 CopyFiles /SILENT `${DEFSYS1}` `${SYS1}` IfFileExists `${SYS2}` +2 CopyFiles /SILENT `${DEFSYS2}` `${SYS2}` ${If} ${IsWinXP} IfFileExists `${SYS3}` +2 CopyFiles /SILENT `${DEFSYS3}` `${SYS3}` IfFileExists `${SYS4}` +2 CopyFiles /SILENT `${DEFSYS4}` `${SYS4}` IfFileExists `${SYS5}` +2 CopyFiles /SILENT `${DEFSYS5}` `${SYS5}` ${ElseIf} ${IsWinVista} IfFileExists `${SYS6}` +2 CopyFiles /SILENT `${DEFSYS6}` `${SYS6}` IfFileExists `${SYS7}` +2 CopyFiles /SILENT `${DEFSYS7}` `${SYS7}` IfFileExists `${SYS8}` +2 CopyFiles /SILENT `${DEFSYS8}` `${SYS8}` ${Else} IfFileExists `${SYS3}` +2 CopyFiles /SILENT `${DEFSYS3}` `${SYS3}` IfFileExists `${SYS4}` +2 CopyFiles /SILENT `${DEFSYS4}` `${SYS4}` IfFileExists `${SYS9}` +2 CopyFiles /SILENT `${DEFSYS9}` `${SYS9}` ${EndIf} ${EndIf} Pop $1 Pop $0 !macroend ;=== ${SegmentInit} Push $0 ${ReadSettings} $0 LastUniqueID ${SetEnvironmentVariable} LastUniqueID $0 Pop $0 !macroend ;=== !macro PreFilesMove ${If} ${RunningX64} ${DisableX64FSRedirection} ${File::BackupLocal} `${EUGDIDRV}` ${File::BackupLocal} `${EPMNTDRV}` ${File::BackupLocal} `${BOOTMAN}` ${File::BackupLocal} `${EUEPMGDI}` ${File::BackupLocal} `${DRV64}` ${File::RestorePortable} `${BOOTMAN}` `${SYS11}` ${File::RestorePortable} `${EUEPMGDI}` `${SYS10}` ${If} ${IsWinVista} ${File::RestorePortable} `${EUGDIDRV}` `${SYS12}` ${File::RestorePortable} `${DRV64}` `${SYS13}` ${File::RestorePortable} `${EPMNTDRV}` `${SYS14}` ${Else} ${File::RestorePortable} `${EUGDIDRV}` `${SYS15}` ${File::RestorePortable} `${DRV64}` `${SYS16}` ${File::RestorePortable} `${EPMNTDRV}` `${SYS17}` ${EndIf} ${EnableX64FSRedirection} ${Else} ${File::BackupLocal} `${EUGDIDRV}` ${File::BackupLocal} `${EPMNTDRV}` ${File::BackupLocal} `${BOOTMAN}` ${File::BackupLocal} `${EUEPMGDI}` ${File::BackupLocal} `${DRV32}` ${File::RestorePortable} `${EUEPMGDI}` `${SYS1}` ${File::RestorePortable} `${BOOTMAN}` `${SYS2}` ${If} ${IsWinXP} ${File::RestorePortable} `${EUGDIDRV}` `${SYS3}` ${File::RestorePortable} `${DRV32}` `${SYS4}` ${File::RestorePortable} `${EPMNTDRV}` `${SYS5}` ${ElseIf} ${IsWinVista} ${File::RestorePortable} `${EUGDIDRV}` `${SYS6}` ${File::RestorePortable} `${DRV32}` `${SYS7}` ${File::RestorePortable} `${EPMNTDRV}` `${SYS8}` ${Else} ${File::RestorePortable} `${EUGDIDRV}` `${SYS3}` ${File::RestorePortable} `${DRV32}` `${SYS4}` ${File::RestorePortable} `${EPMNTDRV}` `${SYS9}` ${EndIf} ${EndIf} !macroend ;=== !macro PostFilesMove ${If} ${RunningX64} ${DisableX64FSRedirection} ${File::BackupPortable} `${BOOTMAN}` `${SYS11}` ${File::BackupPortable} `${EUEPMGDI}` `${SYS10}` ${If} ${IsWinVista} ${File::BackupPortable} `${EUGDIDRV}` `${SYS12}` ${File::BackupPortable} `${DRV64}` `${SYS13}` ${File::BackupPortable} `${EPMNTDRV}` `${SYS14}` ${Else} ${File::BackupPortable} `${EUGDIDRV}` `${SYS15}` ${File::BackupPortable} `${DRV64}` `${SYS16}` ${File::BackupPortable} `${EPMNTDRV}` `${SYS17}` ${EndIf} ${File::RestoreLocal} `${DRV64}` ${File::RestoreLocal} `${EUGDIDRV}` ${File::RestoreLocal} `${EPMNTDRV}` ${File::RestoreLocal} `${BOOTMAN}` ${File::RestoreLocal} `${EUEPMGDI}` ${EnableX64FSRedirection} ${Else} ${File::BackupPortable} `${EUEPMGDI}` `${SYS1}` ${File::BackupPortable} `${BOOTMAN}` `${SYS2}` ${If} ${IsWinXP} ${File::BackupPortable} `${EUGDIDRV}` `${SYS3}` ${File::BackupPortable} `${DRV32}` `${SYS4}` ${File::BackupPortable} `${EPMNTDRV}` `${SYS5}` ${ElseIf} ${IsWinVista} ${File::BackupPortable} `${EUGDIDRV}` `${SYS6}` ${File::BackupPortable} `${DRV32}` `${SYS7}` ${File::BackupPortable} `${EPMNTDRV}` `${SYS8}` ${Else} ${File::BackupPortable} `${EUGDIDRV}` `${SYS3}` ${File::BackupPortable} `${DRV32}` `${SYS4}` ${File::BackupPortable} `${EPMNTDRV}` `${SYS9}` ${EndIf} ${File::RestoreLocal} `${DRV32}` ${File::RestoreLocal} `${EUGDIDRV}` ${File::RestoreLocal} `${EPMNTDRV}` ${File::RestoreLocal} `${BOOTMAN}` ${File::RestoreLocal} `${EUEPMGDI}` ${EndIf} !macroend ;=== ${SegmentPrePrimary} Push $0 ReadEnvStr $0 PAL:LanguageCustom StrCmp $0 English 0 +3 Rename `${EN}` `${RES}` Goto +17 StrCmp $0 German 0 +3 Rename `${DE}` `${RES}` Goto +14 StrCmp $0 French 0 +3 Rename `${FR}` `${RES}` Goto +11 StrCmp $0 Japanese 0 +3 Rename `${JA}` `${RES}` Goto +8 StrCmp $0 Spanish 0 +3 Rename `${ES}` `${RES}` Goto +5 StrCmp $0 Portuguese 0 +3 Rename `${PT}` `${RES}` Goto +2 Rename `${PL}` `${RES}` Rename `${RES1}` `${INI1}` Rename `${RES2}` `${INI2}` Rename `${RES3}` `${INI3}` Pop $0 !macroend ;=== ${SegmentPreExecPrimary} Push $0 Push $1 ${GetDiskVolumeSerialNumberHex} $0 ${WriteSettings} $0 LastUniqueID ReadEnvStr $1 LastUniqueID ${If} $0 != $1 ${ImportDigitalSignature} ${EndIf} Pop $1 Pop $0 !macroend ;=== ${SegmentPostPrimary} Push $0 Delete `${RES1}` Rename `${INI1}` `${RES1}` Delete `${RES2}` Rename `${INI2}` `${RES2}` Delete `${RES3}` Rename `${INI3}` `${RES3}` ReadEnvStr $0 PAL:LanguageCustom StrCmp $0 English 0 +5 Delete `${EN}\*.*` RMDir /r `${EN}` Rename `${RES}` `${EN}` Goto +29 StrCmp $0 German 0 +5 Delete `${DE}\*.*` RMDir /r `${DE}` Rename `${RES}` `${DE}` Goto +24 StrCmp $0 French 0 +5 Delete `${FR}\*.*` RMDir /r `${FR}` Rename `${RES}` `${FR}` Goto +19 StrCmp $0 Japanese 0 +5 Delete `${JA}\*.*` RMDir /r `${JA}` Rename `${RES}` `${JA}` Goto +14 StrCmp $0 Spanish 0 +5 Delete `${ES}\*.*` RMDir /r `${ES}` Rename `${RES}` `${ES}` Goto +9 StrCmp $0 Portuguese 0 +5 Delete `${PT}\*.*` RMDir /r `${PT}` Rename `${RES}` `${PT}` Goto +4 Delete `${PL}\*.*` RMDir /r `${PL}` Rename `${RES}` `${PL}` Pop $0 !macroend ;=== !macro PostReg DeleteRegKey /IfEmpty HKCU `Software\EaseUS\EaseUS Partition Master\PopUp` DeleteRegKey /IfEmpty HKCU `Software\EaseUS\EaseUS Partition Master\AutoUpdate` DeleteRegKey /IfEmpty HKCU `Software\EaseUS\EaseUS Partition Master` DeleteRegKey /IfEmpty HKCU `Software\EaseUS` !macroend ;=== !macro PreServices Push $0 Push $1 ClearErrors ReadRegStr $0 HKLM `${KEY1}` ImagePath ${IfNot} ${Errors} StrCpy $1 $0 4 StrCmp $1 \??\ 0 +2 StrCpy $0 $0 "" 4 ${WriteRuntimeData} ${PAL} EPMNTDRV `$0` ${SC::Stop} EPMNTDRV /DISABLEFSR ${SC::Delete} EPMNTDRV /DISABLEFSR ${EndIf} ClearErrors ReadRegStr $0 HKLM `${KEY2}` ImagePath ${IfNot} ${Errors} StrCpy $1 $0 4 StrCmp $1 \??\ 0 +2 StrCpy $0 $0 "" 4 ${WriteRuntimeData} ${PAL} EUGDIDRV `$0` ${SC::Stop} EUGDIDRV /DISABLEFSR ${SC::Delete} EUGDIDRV /DISABLEFSR ${EndIf} Pop $1 Pop $0 !macroend ;=== !macro PrePrimaryServices ${SC::Create} EPMNTDRV `${EPMNTDRV}` kernel demand "" /DISABLEFSR ${SC::Start} EPMNTDRV /DISABLEFSR ${SC::Create} EUGDIDRV `${EUGDIDRV}` kernel demand "" /DISABLEFSR ${SC::Start} EUGDIDRV /DISABLEFSR !macroend ;=== !macro PostPrimaryServices Push $0 ${SC::Stop} EPMNTDRV /DISABLEFSR ${SC::Stop} EUGDIDRV /DISABLEFSR ClearErrors ${ReadRuntimeData} $0 ${PAL} EPMNTDRV ${If} ${Errors} ${SC::Delete} EPMNTDRV /DISABLEFSR ${EndIf} ClearErrors ${ReadRuntimeData} $0 ${PAL} EUGDIDRV ${If} ${Errors} ${SC::Delete} EUGDIDRV /DISABLEFSR ${If} ${AtMostWin7} ${SetACL::Key} HKLM `${LEGACY}\0000\Control` ${SetACL::Key} HKLM `${LEGACY}\0000` ${SetACL::Key} HKLM `${LEGACY}` ${ElseIf} ${AtMostWin2003} AccessControl::GrantOnRegKey HKLM `${LEGACY}` EVERYONE FULLACCESS ${EndIf} DeleteRegKey HKLM `${LEGACY}` ${EndIf} Pop $0 !macroend !macro UnloadServices Push $0 ClearErrors ${ReadRuntimeData} $0 ${PAL} EPMNTDRV ${IfNot} ${Errors} ${SC::Create} EPMNTDRV `${EPMNTDRV}` kernel demand "" /DISABLEFSR ${SC::Start} EPMNTDRV /DISABLEFSR ${EndIf} ClearErrors ${ReadRuntimeData} $0 ${PAL} EUGDIDRV ${IfNot} ${Errors} ${SC::Create} EUGDIDRV `${EUGDIDRV}` kernel demand "" /DISABLEFSR ${SC::Start} EUGDIDRV /DISABLEFSR ${EndIf} Pop $0 !macroend