Advertisement
Guest User

Enable/Disable Metro on Windows 8

a guest
Sep 23rd, 2011
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*////////////////////////////////////////////////////////////////////////////////////////////////////
  2.  
  3.  
  4.     Codificado por: Julio Chinchilla
  5.    
  6.     Herramienta de desarrollo: Nullsoft Scriptable Install System
  7.     http://nsis.sourceforge.net/
  8.         Plugin adcional:   Registry plug-in
  9.         http://nsis.sourceforge.net/Registry_plug-in
  10.    
  11. Basado en la funcion "Windows Version Detection" http://bit.ly/n3xj9M, y modificada para detectar la versión 6.2 de Windows Developer Preview.
  12. ///////////////////////////////////////////////////////////////////////////////////////////////////*/
  13.  
  14.  
  15.  
  16.  
  17.   ;archivo de inclusión de interface
  18.   !include "MUI.nsh"
  19.   !include "Registry.nsh"
  20.  
  21.  
  22.  
  23. !insertmacro MUI_LANGUAGE "English"
  24. !insertmacro MUI_INTERFACE
  25.  
  26.  
  27.  
  28. VIProductVersion "0.1.1.2"
  29.   VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Enable Disable Windows Metro on Windows 8"
  30.   VIAddVersionKey /LANG=${LANG_ENGLISH} "Diseño de Instalador" "Desarrollado por Julio Francisco Chinchilla Valenzuela"
  31.   VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Free"
  32.   VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Grupo Ideas"
  33.   VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Disable Enable Metro"
  34.   VIAddVersionKey /LANG=${LANG_ENGLISH} "InternalName" "Disable Enable Metro"
  35.   VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "MetroONOFF"
  36.   VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "GRUPO IDEAS"
  37.   VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1"
  38.   VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "0.1Beta"
  39.  
  40.  
  41.  
  42.   Name "DisableMetro"
  43.   OutFile "MetroONOFF.exe"
  44.   SilentInstall Silent
  45. Caption "Activar/Desactivar Metro"
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. Function GetWindows
  54.   Push $R0
  55.   Push $R1
  56.   ClearErrors
  57.   ReadRegStr $R0 HKLM \
  58.   "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  59.   IfErrors 0 lbl_winnt
  60.   ; we are not NT
  61.   ReadRegStr $R0 HKLM \
  62.   "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
  63.   StrCpy $R1 $R0 1
  64.   StrCmp $R1 '4' 0 lbl_error
  65.   StrCpy $R1 $R0 3
  66.   StrCmp $R1 '4.0' lbl_win32_95
  67.   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
  68.   lbl_win32_95:
  69.     StrCpy $R0 '95'
  70. MessageBox MB_OK|MB_ICONQUESTION "Windows 95" IDOK
  71. Quit
  72.     Goto lbl_done
  73.  
  74.   lbl_win32_98:
  75.     StrCpy $R0 '98'
  76. MessageBox MB_OK|MB_ICONQUESTION "Windows 98" IDOK
  77. Quit
  78.     Goto lbl_done
  79.  
  80.   lbl_win32_ME:
  81.     StrCpy $R0 'ME'
  82. MessageBox MB_OK|MB_ICONQUESTION "Windows ME" IDOK
  83. Quit
  84.     Goto lbl_done
  85.  
  86.   lbl_winnt:
  87.  
  88.   StrCpy $R1 $R0 1
  89.  
  90.   StrCmp $R1 '3' lbl_winnt_x
  91.   StrCmp $R1 '4' lbl_winnt_x
  92.  
  93.   StrCpy $R1 $R0 3
  94.  
  95.   StrCmp $R1 '5.0' lbl_winnt_2000
  96.   StrCmp $R1 '5.1' lbl_winnt_XP
  97.   StrCmp $R1 '5.2' lbl_winnt_2003
  98.   StrCmp $R1 '6.0' lbl_winnt_vista
  99.   StrCmp $R1 '6.1' lbl_winnt_7
  100.   StrCmp $R1 '6.2' lbl_winnt_8 lbl_error
  101.  
  102.   lbl_winnt_x:
  103.     StrCpy $R0 "NT $R0" 6
  104.  
  105.   Goto lbl_done
  106.  
  107.   lbl_winnt_2000:
  108.     Strcpy $R0 '2000'
  109. MessageBox MB_OK|MB_ICONQUESTION "Windows 2000" IDOK
  110. Quit
  111.     Goto lbl_done
  112.  
  113.   lbl_winnt_XP:
  114.     Strcpy $R0 'XP'
  115. MessageBox MB_OK|MB_ICONQUESTION "Windows XP" IDOK
  116. Quit
  117.     Goto lbl_done
  118.  
  119.   lbl_winnt_2003:
  120.     Strcpy $R0 '2003'
  121. MessageBox MB_OK|MB_ICONQUESTION "Windows 2003" IDOK
  122. Quit
  123.     Goto lbl_done
  124.  
  125.   lbl_winnt_vista:
  126.     Strcpy $R0 'Vista'
  127. MessageBox MB_OK|MB_ICONQUESTION "Windows Vista" IDOK
  128. Quit
  129.     Goto lbl_done
  130.  
  131.   lbl_winnt_7:
  132.     Strcpy $R0 '7'
  133. MessageBox MB_OK|MB_ICONQUESTION "Windows 7" IDOK
  134. Quit
  135.   Goto lbl_done
  136.  
  137. lbl_winnt_8:
  138.     Strcpy $R0 '7'
  139.     call Metro
  140. Quit
  141.   Goto lbl_done
  142.  
  143.   lbl_error:
  144.     Strcpy $R0 ''
  145.   lbl_done:
  146.  
  147.   Pop $R1
  148.   Exch $R0
  149.  
  150. Quit
  151. FunctionEnd
  152.  
  153. Var Registro
  154. Var Valor
  155. Var Error
  156.  
  157. Function Metro
  158. ${registry::Read} "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" "RPEnabled" $Valor $Registro
  159. StrCmp $Valor "1" Activado Desactivado
  160. Activado:
  161.          MessageBox MB_YESNO|MB_ICONQUESTION "Metro se encuentra activado, ¿Desea DESACTIVAR Metro?" IDYES OFF IDNO EXIT
  162.  
  163. Desactivado:
  164.           MessageBox MB_YESNO|MB_ICONQUESTION "Metro se encuentra desactivado, ¿Desea ACTIVAR Metro?" IDYES ON IDNO EXIT
  165. ON:
  166.    ${registry::Write} "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" "RPEnabled" "1" $Registro $Error
  167.    goto REGR
  168. OFF:
  169.     ${registry::Write} "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" "RPEnabled" "0" $Registro $Error
  170. REGR:
  171. MessageBox MB_OK|MB_USERICON  "Desarrollado por Julio Chinchilla GUATEMALA"
  172. MessageBox MB_YESNO|MB_ICONQUESTION "¿Desea reiniciar el sistema para ver los cambios?" IDNO +4
  173.   Reboot
  174. EXIT:
  175.      MessageBox MB_OK|MB_USERICON  "Desarrollado por Julio Chinchilla GUATEMALA"
  176. Quit
  177. FunctionEnd
  178.  
  179.  
  180.  
  181. Section
  182. call GetWindows
  183. SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement