Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*////////////////////////////////////////////////////////////////////////////////////////////////////
- Codificado por: Julio Chinchilla
- Herramienta de desarrollo: Nullsoft Scriptable Install System
- http://nsis.sourceforge.net/
- Plugin adcional: Registry plug-in
- http://nsis.sourceforge.net/Registry_plug-in
- Basado en la funcion "Windows Version Detection" http://bit.ly/n3xj9M, y modificada para detectar la versión 6.2 de Windows Developer Preview.
- ///////////////////////////////////////////////////////////////////////////////////////////////////*/
- ;archivo de inclusión de interface
- !include "MUI.nsh"
- !include "Registry.nsh"
- !insertmacro MUI_LANGUAGE "English"
- !insertmacro MUI_INTERFACE
- VIProductVersion "0.1.1.2"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Enable Disable Windows Metro on Windows 8"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "Diseño de Instalador" "Desarrollado por Julio Francisco Chinchilla Valenzuela"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Free"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Grupo Ideas"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Disable Enable Metro"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "InternalName" "Disable Enable Metro"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "MetroONOFF"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "GRUPO IDEAS"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1"
- VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "0.1Beta"
- Name "DisableMetro"
- OutFile "MetroONOFF.exe"
- SilentInstall Silent
- Caption "Activar/Desactivar Metro"
- Function GetWindows
- Push $R0
- Push $R1
- ClearErrors
- ReadRegStr $R0 HKLM \
- "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
- IfErrors 0 lbl_winnt
- ; we are not NT
- ReadRegStr $R0 HKLM \
- "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
- StrCpy $R1 $R0 1
- StrCmp $R1 '4' 0 lbl_error
- StrCpy $R1 $R0 3
- StrCmp $R1 '4.0' lbl_win32_95
- StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
- lbl_win32_95:
- StrCpy $R0 '95'
- MessageBox MB_OK|MB_ICONQUESTION "Windows 95" IDOK
- Quit
- Goto lbl_done
- lbl_win32_98:
- StrCpy $R0 '98'
- MessageBox MB_OK|MB_ICONQUESTION "Windows 98" IDOK
- Quit
- Goto lbl_done
- lbl_win32_ME:
- StrCpy $R0 'ME'
- MessageBox MB_OK|MB_ICONQUESTION "Windows ME" IDOK
- Quit
- Goto lbl_done
- lbl_winnt:
- StrCpy $R1 $R0 1
- StrCmp $R1 '3' lbl_winnt_x
- StrCmp $R1 '4' lbl_winnt_x
- StrCpy $R1 $R0 3
- StrCmp $R1 '5.0' lbl_winnt_2000
- StrCmp $R1 '5.1' lbl_winnt_XP
- StrCmp $R1 '5.2' lbl_winnt_2003
- StrCmp $R1 '6.0' lbl_winnt_vista
- StrCmp $R1 '6.1' lbl_winnt_7
- StrCmp $R1 '6.2' lbl_winnt_8 lbl_error
- lbl_winnt_x:
- StrCpy $R0 "NT $R0" 6
- Goto lbl_done
- lbl_winnt_2000:
- Strcpy $R0 '2000'
- MessageBox MB_OK|MB_ICONQUESTION "Windows 2000" IDOK
- Quit
- Goto lbl_done
- lbl_winnt_XP:
- Strcpy $R0 'XP'
- MessageBox MB_OK|MB_ICONQUESTION "Windows XP" IDOK
- Quit
- Goto lbl_done
- lbl_winnt_2003:
- Strcpy $R0 '2003'
- MessageBox MB_OK|MB_ICONQUESTION "Windows 2003" IDOK
- Quit
- Goto lbl_done
- lbl_winnt_vista:
- Strcpy $R0 'Vista'
- MessageBox MB_OK|MB_ICONQUESTION "Windows Vista" IDOK
- Quit
- Goto lbl_done
- lbl_winnt_7:
- Strcpy $R0 '7'
- MessageBox MB_OK|MB_ICONQUESTION "Windows 7" IDOK
- Quit
- Goto lbl_done
- lbl_winnt_8:
- Strcpy $R0 '7'
- call Metro
- Quit
- Goto lbl_done
- lbl_error:
- Strcpy $R0 ''
- lbl_done:
- Pop $R1
- Exch $R0
- Quit
- FunctionEnd
- Var Registro
- Var Valor
- Var Error
- Function Metro
- ${registry::Read} "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" "RPEnabled" $Valor $Registro
- StrCmp $Valor "1" Activado Desactivado
- Activado:
- MessageBox MB_YESNO|MB_ICONQUESTION "Metro se encuentra activado, ¿Desea DESACTIVAR Metro?" IDYES OFF IDNO EXIT
- Desactivado:
- MessageBox MB_YESNO|MB_ICONQUESTION "Metro se encuentra desactivado, ¿Desea ACTIVAR Metro?" IDYES ON IDNO EXIT
- ON:
- ${registry::Write} "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" "RPEnabled" "1" $Registro $Error
- goto REGR
- OFF:
- ${registry::Write} "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" "RPEnabled" "0" $Registro $Error
- REGR:
- MessageBox MB_OK|MB_USERICON "Desarrollado por Julio Chinchilla GUATEMALA"
- MessageBox MB_YESNO|MB_ICONQUESTION "¿Desea reiniciar el sistema para ver los cambios?" IDNO +4
- Reboot
- EXIT:
- MessageBox MB_OK|MB_USERICON "Desarrollado por Julio Chinchilla GUATEMALA"
- Quit
- FunctionEnd
- Section
- call GetWindows
- SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement