Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Description: Custom DirectX Handler for the PortableApps.com Launcher (custom.nsh)
Submitted by demondevin on January 7, 2018

custom.nsh (NSIS)

;=#
;
; DirectX Custom Code (1/07/2018)
; Written by daemon.devin ([email protected])
;
; Checks for a local copy of a DirectX DLL and if not found, registers the DLLs in the portable CommonFiles folder.
; 
; Dependancies
;	DirectX Portable Plugins
;		x86 - https://www.upload.ee/files/7730916/DirectX_Runtime_Portable_Plugin_June_2010_x86.paf.exe.html
;		x64 - https://www.upload.ee/files/7730915/DirectX_Runtime_Portable_Plugin_June_2010_x64.paf.exe.html
;

!ifndef REGSVR
	!define REGSVR `$SYSDIR\regsvr32.exe`
!endif

${SegmentFile}

Var PortableAppsCommonFiles

${SegmentPrePrimary}
	StrCpy $PortableAppsCommonFiles "$PortableAppsDirectory\CommonFiles"
	${If} $Bits = 64
		FindFirst $0 $1 "$PortableAppsCommonFiles\DirectX64\bin\*.dll"
		${DoUntil} $1 == ""
			System::Call "kernel32::Wow64EnableWow64FsRedirection(i0)"
			${IfNot} ${FileExists} "$SYSDIR\$1"
				ExecDos::Exec /TOSTACK /DISABLEFSR `"${REGSVR}" /s "$PortableAppsCommonFiles\DirectX64\bin\$1"` "" ""
			${EndIf}
			System::Call "kernel32::Wow64EnableWow64FsRedirection(i1)"
			FindNext $0 $1
		${Loop}
		FindClose $0
	${EndIf}
	FindFirst $0 $1 "$PortableAppsCommonFiles\DirectX\bin\*.dll"
	${DoUntil} $1 == ""
		${IfNot} ${FileExists} "$SYSDIR\$1"
			ExecDos::Exec /TOSTACK `"${REGSVR}" /s "$PortableAppsCommonFiles\DirectX\bin\$1"` "" ""
		${EndIf}
		FindNext $0 $1
	${Loop}
	FindClose $0
!macroend
${SegmentPostPrimary}
	${If} $Bits = 64
		FindFirst $0 $1 "$PortableAppsCommonFiles\DirectX64\bin\*.dll"
		${DoUntil} $1 == ""
			System::Call "kernel32::Wow64EnableWow64FsRedirection(i0)"
			${IfNot} ${FileExists} "$SYSDIR\$1"
				ExecDos::Exec /TOSTACK /DISABLEFSR `"${REGSVR}" /s /u "$PortableAppsCommonFiles\DirectX64\bin\$1"` "" ""
			${EndIf}
			System::Call "kernel32::Wow64EnableWow64FsRedirection(i1)"
			FindNext $0 $1
		${Loop}
		FindClose $0
	${EndIf}
	FindFirst $0 $1 "$PortableAppsCommonFiles\DirectX\bin\*.dll"
	${DoUntil} $1 == ""
		${IfNot} ${FileExists} "$SYSDIR\$1"
			ExecDos::Exec /TOSTACK `"${REGSVR}" /s /u "$PortableAppsCommonFiles\DirectX\bin\$1"` "" ""
		${EndIf}
		FindNext $0 $1
	${Loop}
	FindClose $0
!macroend