!define MUI_UI "${NSISDIR}\Contrib\UIs\modern2.exe"
!define MUI_EXEC "setup.exe"
!define MUI_PRODUCT "vbproduct"
!define MUI_VERSION ""

!define VBFILESDIR ".";
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
!include "${NSISDIR}\macros\upgradeDll.nsh"
!include "${NSISDIR}\macros\sharedDll.nsh"
!include "${NSISDIR}\macros\installVB.nsh"

  
;--------------------------------
;Configuration

  ;General
  OutFile ".\${MUI_EXEC}"

;--------------------------------
;Modern UI Configuration

  !define MUI_WELCOMEPAGE
  !define MUI_COMPONENTSPAGE
  !define MUI_DIRECTORYPAGE
  !define MUI_FINISHPAGE
  
  !define MUI_ABORTWARNING
  
  !define MUI_UNINSTALLER
  !define MUI_UNCONFIRMPAGE
  
  ;Modern UI System
  !insertmacro MUI_SYSTEM
  
;--------------------------------
;Languages
 
 !insertmacro MUI_LANGUAGE "English"
  

  


Function .onInit


FunctionEnd



InstallDir "$PROGRAMFILES\No_Name_Given_Yet"

Section No_Name_Given_Yet

Call InstallVBDLLs
SetOutPath "$SYSDIR"
!insertmacro UpgradeDLL "mswinsck.ocx" "$SYSDIR\mswinsck.ocx"
Push $SYSDIR\mswinsck.ocx
Call AddSharedDLL

SetOutPath "$SYSDIR"
!insertmacro UpgradeDLL "Mscomctl.ocx" "$SYSDIR\Mscomctl.ocx"
Push $SYSDIR\Mscomctl.ocx
Call AddSharedDLL

SetOutPath "$SYSDIR"
File "sensapi.dll"
Push $SYSDIR\sensapi.dll
Call AddSharedDLL

SetOutPath "$INSTDIR"
File "gsmsalg.dll"
Push $INSTDIR\gsmsalg.dll
Call AddSharedDLL

SetOutPath "$INSTDIR"
File "AvP2S4.exe"
Push $INSTDIR\AvP2S4.exe
Call AddSharedDLL


SetShellVarContext current
CreateDirectory "$SMPROGRAMS\No_Name_Given_Yet"
CreateShortCut "$SMPROGRAMS\No_Name_Given_Yet\No_Name_Given_Yet.lnk" "$INSTDIR\AvP2S4.exe"
SetOutPath "$INSTDIR"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd


Section -uninstEntry
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "No_Name_Given_Yet"
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\uninstall.exe"
SectionEnd

Section "Uninstall"
Push "$SYSDIR\mswinsck.ocx"
Call un.RemoveSharedDLL

Push "$SYSDIR\Mscomctl.ocx"
Call un.RemoveSharedDLL

Delete "$SYSDIR\sensapi.dll"

Delete "$INSTDIR\gsmsalg.dll"

Delete "$INSTDIR\AvP2S4.exe"


Delete "$SMPROGRAMS\No_Name_Given_Yet\No_Name_Given_Yet.lnk"
RMDir "$SMPROGRAMS\No_Name_Given_Yet"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
!insertmacro MUI_UNFINISHHEADER
SectionEnd
