File: s_uninstall.nsi

package info (click to toggle)
win32-loader 0.10.6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 1,868 kB
  • sloc: ansic: 2,492; sh: 706; asm: 344; makefile: 338
file content (79 lines) | stat: -rw-r--r-- 2,668 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
; Debian-Installer Loader - Uninstallation
; 
; Copyright (C) 2007,2008,2009  Robert Millan <rmh@aybabtu.com>
; Copyright (C) 2010,2011       Didier Raboud <odyx@debian.org>
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program.  If not, see <http://www.gnu.org/licenses/>.

; Include required functions
${un.BOOTCFG_ConnectWMI}
${un.BOOTCFG_DeleteObject}
${un.BOOTCFG_GetObject}
${un.BOOTCFG_OpenDefaultBcdStore}
${un.BOOTCFG_ReleaseObject}

Function un.RemoveBootEntry
  System::Store 'S'
  ReadRegStr $2 HKLM "${REGSTR_WIN32}" "bootmgr"
  ${If} $2 != ""
    ${un.BOOTCFG_ConnectWMI} $R0 $R1 $0
    ${If} $0 == 0
      ${un.BOOTCFG_GetObject} $R1 "BcdStore" $R2 $0
      ${If} $0 == 0
        ${un.BOOTCFG_GetObject} $R1 "BcdObject" $R3 $0
        ${If} $0 == 0
          ${un.BOOTCFG_OpenDefaultBcdStore} $R1 $R2 $R4 $0
          ${If} $0 == 0
            ${un.BOOTCFG_DeleteObject} $R1 $R2 $R4 $2 $1 $0
            ${If} $0 != 0
              IntFmt $0 "0x%08X" $0
              DetailPrint "$1: $0"
            ${EndIf}
            ${un.BOOTCFG_ReleaseObject} $R4
          ${Endif}
          ${un.BOOTCFG_ReleaseObject} $R3
        ${EndIf}
        ${un.BOOTCFG_ReleaseObject} $R2
      ${EndIf}
      ${un.BOOTCFG_ReleaseObject} $R1
      ${un.BOOTCFG_ReleaseObject} $R0
    ${EndIf}
  ${EndIf}
  System::Store 'L'
FunctionEnd

Section "Uninstall"
  ; Initialise $c
  ReadRegStr $c HKLM "${REGSTR_WIN32}" "system_drive"

  Call un.RemoveBootEntry

  IfFileExists "$c\boot.ini" 0 no_saved_boot_ini_timeout
  SetFileAttributes "$c\boot.ini" NORMAL
  SetFileAttributes "$c\boot.ini" SYSTEM|HIDDEN
  DeleteINIStr "$c\boot.ini" "operating systems" "$INSTDIR\g2ldr.mbr"
    
  ReadIniStr $0 "$c\boot.ini" "boot loader" "old_timeout_win32-loader"
  IfErrors 0 no_saved_boot_ini_timeout
     ; Restore original timeout
     ClearErrors
     WriteIniStr "$c\boot.ini" "boot loader" "timeout" $0
     DeleteINIStr "$c\boot.ini" "boot loader" "old_timeout_win32-loader"
  no_saved_boot_ini_timeout:

  DeleteRegKey HKLM "${REGSTR_WIN32}"
  DeleteRegKey HKLM "${REGSTR_UNINST}"
  Delete $c\g2ldr
  RMDir /r /REBOOTOK $INSTDIR
SectionEnd