Skip to content

Instantly share code, notes, and snippets.

@KenLuoTW
Last active May 22, 2018 04:15
Show Gist options
  • Save KenLuoTW/f509f910e03cd9cc0d532b2decbc52fe to your computer and use it in GitHub Desktop.
Save KenLuoTW/f509f910e03cd9cc0d532b2decbc52fe to your computer and use it in GitHub Desktop.
麻將巨星自動掛載光碟映像檔執行
!include "MUI2.nsh" ; modern UI
!include "x64.nsh" ; NSIS plugin used to detect 64 bit Windows
Unicode true ; turn on Unicode (This requires NSIS 3.0)
; icons of the generated installer and uninstaller
!define MUI_ICON "StarMAJ.ico"
Name "麻將巨星"
OutFile "麻將巨星.exe" ; The generated installer file name
;Request application privileges (need administrator to install)
RequestExecutionLevel admin
;Pages
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "TradChinese"
; Called during installer initialization
Function .onInit
WriteRegStr HKLM "SOFTWARE\Microsoft\DirectDraw\Compatibility\Starmaj" "Name" "Starmaj.exe"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\DirectDraw\Compatibility\Starmaj" "ID" 0x3EEF540E
WriteRegBin HKLM "SOFTWARE\Microsoft\DirectDraw\Compatibility\Starmaj" "Flags" 00080000
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Starmaj" "" "D:\Games\StarMAJ\Sm.exe"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Starmaj" "Run" "D:\Games\StarMAJ\Starmaj.exe"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Starmaj" "Path" "D:\Games\StarMAJ"
FunctionEnd
Section ""
nsExec::ExecToLog '"$PROGRAMFILES\Alcohol Soft\Alcohol 120\AxCmd.exe" 0: /M:"$EXEDIR\STARMAJ.mds"'
;nsExec::ExecToLog '"C:\Program Files\DAEMON Tools Lite\DTCommandLine.exe" -M -l "F" -p "$EXEDIR\STARMAJ.mds"'
nsExec::ExecToLog '"$EXEDIR\Starmaj.exe" /F'
;nsExec::ExecToLog '"C:\Program Files\DAEMON Tools Lite\DTCommandLine.exe" -u -l "F"'
nsExec::ExecToLog '"$PROGRAMFILES\Alcohol Soft\Alcohol 120\AxCmd.exe" 0: /U'
DeleteRegKey HKLM "SOFTWARE\Microsoft\DirectDraw\Compatibility\Starmaj"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Starmaj"
SectionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment