Penulis Topik: [NSIS] MultiUser patching  (Dibaca 521 kali)

Offline descrates

  • Pro500
  • ******
  • Tulisan: 621
  • Reputation: 5073
    • Lihat Profil
[NSIS] MultiUser patching
« pada: Juli 20, 2017, 07:05:40 AM »
gunanya biar multiuser.nsh bisa menampilkan username & nama komputer kita
win2000 ke atas, simpel tapi berguna

di bagian ini


!macro MULTIUSER_FUNCTION_INSTALLMODEPAGE PRE LEAVE

  ;Page functions of Modern UI page

  Function "${PRE}"
 
    ${ifnot} ${IsNT}
      Abort
    ${endif}
 
    ${if} $MultiUser.Privileges != "Power"
      ${andif} $MultiUser.Privileges != "Admin"
      Abort
    ${endif}
   
    !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE
    !insertmacro MUI_HEADER_TEXT_PAGE $(MULTIUSER_TEXT_INSTALLMODE_TITLE) $(MULTIUSER_TEXT_INSTALLMODE_SUBTITLE)
   
    nsDialogs::Create 1018
    Pop $MultiUser.InstallModePage

    ${NSD_CreateLabel} 0u 0u 300u 20u "${MULTIUSER_INSTALLMODEPAGE_TEXT_TOP}"
    Pop $MultiUser.InstallModePage.Text

;===============================================
    ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
    StrCpy $1 $0 4 3

    ${NSD_CreateRadioButton} 20u 50u 280u 10u "${MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS} ($0)"
    Pop $MultiUser.InstallModePage.AllUsers

    System::Call "advapi32::GetUserName(t.r0,*i${NSIS_MAX_STRLEN})i"   

    ${NSD_CreateRadioButton} 20u 70u 280u 10u "${MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER} ($0)"
    Pop $MultiUser.InstallModePage.CurrentUser
;===============================================

   
    ${if} $MultiUser.InstallMode == "AllUsers"
      SendMessage $MultiUser.InstallModePage.AllUsers ${BM_SETCHECK} ${BST_CHECKED} 0
    ${else}
      SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_SETCHECK} ${BST_CHECKED} 0
    ${endif}
   
    !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW
    nsDialogs::Show
   
  FunctionEnd

  Function "${LEAVE}"
     SendMessage $MultiUser.InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $MultiUser.InstallModePage.ReturnValue
     
     ${if} $MultiUser.InstallModePage.ReturnValue = ${BST_CHECKED}
        Call MultiUser.InstallMode.AllUsers
     ${else}
        Call MultiUser.InstallMode.CurrentUser
     ${endif}
 
    !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE
  FunctionEnd

!macroend
TASKKILL /F /IM SMĪ”RTP.exe /T

Win7 32bit [kernel patch] --- 2x2,8GHz Intel --- 8GB RAM DDR3 --- 512MB 9600M GT NVidia --- Iron 15 beta --- Opera Mini Proxies

other OS: Lucid Puppy, XP SP2 [custom], XP SP3, Win7 64bit, Tails