summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore12
-rw-r--r--Makefile4
-rw-r--r--debian/changelog21
-rw-r--r--debian/control8
-rw-r--r--expert.nsi131
-rw-r--r--include/bootcfg.nsh2766
-rw-r--r--l10n/po/sq.po220
-rwxr-xr-xl10n/win32-loader.sh22
-rw-r--r--main.nsi10
-rw-r--r--onInit.nsi81
-rw-r--r--s_install.nsi149
-rw-r--r--s_uninstall.nsi38
12 files changed, 3238 insertions, 224 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..de9b57b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+l10n/po/*.po~
+win32-loader.exe
+core.img
+g2ldr*
+l10n/locale
+l10n/templates
+l10n/win32-loader
+license
+loadlin.*
+plugins/*.dll
+plugins/*/*.dll
+*.ico
diff --git a/Makefile b/Makefile
index db8ffef..5968016 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ ICONSIZES := 16 24 32 48 256
ifeq ($(wildcard /usr/i686-w64-mingw32/include/exdll.h), /usr/i686-w64-mingw32/include/exdll.h)
NSIS_CFLAGS += -DHAVE_EXDLL_H
else
-NSIS_CFLAGS += -L/usr/i686-w64-mingw32/lib/nsis/ -lpluginapi
+NSIS_CFLAGS += -L/usr/i686-w64-mingw32/lib/nsis/ -lpluginapi-x86-ansi
endif
# Standard makensis call
@@ -163,7 +163,7 @@ plugins/string.dll: plugins/string.c
$(NSIS_STRIP) $@
plugins/libgcrypt_hash.dll: plugins/libgcrypt_hash.c
- $(NSIS_CC) $^ $(NSIS_CFLAGS) -shared -static-libgcc /usr/i686-w64-mingw32/lib/libgcrypt.a /usr/i686-w64-mingw32/lib/libgpg-error.a -o $@
+ $(NSIS_CC) $^ $(NSIS_CFLAGS) -shared -static-libgcc /usr/i686-w64-mingw32/lib/libgcrypt.a /usr/i686-w64-mingw32/lib/libgpg-error.a /usr/i686-w64-mingw32/lib/libwsock32.a -o $@
$(NSIS_STRIP) $@
iso: stable.iso daily.iso
diff --git a/debian/changelog b/debian/changelog
index 695c237..56aad16 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,24 @@
+win32-loader (0.9.0) unstable; urgency=medium
+
+ * The « ፨ ለስላሳ » release
+
+ * Migrate to NSIS 3
+
+ [ Thomas Gaugler ]
+ * Code cleanup; port to NSIS 3 and BCD
+
+ [ Didier Raboud ]
+ * Remove Robert Millan and Christian Perrier from Uploaders with thanks for
+ their past work
+ * Link statically against libwsock32.a
+ * Bump Standards-Version to 4.1.3
+ * Set priority to optional
+
+ [ Eva Vranici ]
+ * Translation of win32-loader to Albanian (sq)
+
+ -- Didier Raboud <odyx@debian.org> Sun, 01 Apr 2018 16:34:36 +0200
+
win32-loader (0.8.4) unstable; urgency=medium
* The « Folivora » release
diff --git a/debian/control b/debian/control
index 28645d7..649a743 100644
--- a/debian/control
+++ b/debian/control
@@ -1,12 +1,12 @@
Source: win32-loader
Section: utils
-Priority: extra
+Priority: optional
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
-Uploaders: Robert Millan <rmh.debian@aybabtu.com>, Didier Raboud <odyx@debian.org>, Christian Perrier <bubulle@debian.org>
+Uploaders: Didier Raboud <odyx@debian.org>
Build-Depends:
dpkg (>= 1.16.2),
debhelper (>= 9),
- nsis (>= 2.48), nsis-pluginapi,
+ nsis (>= 3), nsis-pluginapi,
mingw-w64,
libgcrypt-mingw-w64-dev, libgpg-error-mingw-w64-dev,
librsvg2-bin, icoutils,
@@ -19,7 +19,7 @@ Build-Depends:
locales-all,
gpgv-win32, debian-archive-keyring,
cpio-win32 (>= 2.11-4), gzip-win32
-Standards-Version: 3.9.8
+Standards-Version: 4.1.3
Vcs-Browser: https://anonscm.debian.org/cgit/d-i/win32-loader.git
Vcs-Git: https://anonscm.debian.org/git/d-i/win32-loader.git
diff --git a/expert.nsi b/expert.nsi
index c53d15f..04c3e29 100644
--- a/expert.nsi
+++ b/expert.nsi
@@ -16,6 +16,108 @@
; 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 function
+${BOOTCFG_GetElementFromBcd}
+${BOOTCFG_GetObjectPropertyValue}
+${BOOTCFG_GetObjectOfVariant}
+${BOOTCFG_GetStringOfVariant}
+
+; Get drive letter of device
+; Parameter:
+; device - path of device, e. g. \Device\HarddiskVolume2
+; Return value:
+; drive letter
+Function GetDriveLetterOfDevice
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+
+ ; Go through the present logical drives and identify
+ ; the matching device
+ System::Call "kernel32::GetLogicalDrives() i .r5"
+ StrCpy $1 0
+ StrCpy $2 ""
+ ${DoWhile} $1 < 26
+ IntOp $4 $5 & 1
+ ${If} $4 != 0
+ IntOp $4 $1 + 65
+ IntFmt $2 "%c:" $4
+ System::Call "kernel32::QueryDosDevice(t r2, t .r3, \
+ i${NSIS_MAX_STRLEN}) i .r4"
+ ${If} $4 != 0
+ ${AndIf} $3 == $0
+ StrCpy $0 $2
+ ${Break}
+ ${EndIf}
+ ${EndIf}
+ IntOp $5 $5 >> 1
+ IntOp $1 $1 + 1
+ ${Loop}
+
+ ${If} $0 != $2
+ StrCpy $0 "error"
+ ${EndIf}
+
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+
+; Get device path of the partition of the current BCD entry
+; Return value:
+; device path or empty string in case of failure
+Function GetDevicePathOfPartition
+ Push $0
+ Push $1
+ Push $2
+
+ ${BOOTCFG_GetElementFromBcd} $services $basebcdstore $bcdstore \
+ $basebcdobject ${BOOTCFG_CURRENT_GUID} ${BOOTCFG_BCDE_DEVICE} \
+ $2 $1 $0
+ ${If} $0 == 0
+ ; Save returned element onto stack
+ Push $1
+ ; Release returned bcd object
+ ${BOOTCFG_ReleaseObject} $2
+ StrCpy $2 $1
+ ${BOOTCFG_GetObjectPropertyValue} $2 "Device" $1 $0
+ ${If} $0 == 0
+ ${BOOTCFG_GetObjectOfVariant} $1 $2 $0
+ ; Free variant
+ System::Free $1
+ ${If} $0 == 0
+ ${BOOTCFG_GetObjectPropertyValue} $2 "Path" $1 $0
+ ${If} $0 == 0
+ ${BOOTCFG_GetStringOfVariant} $1 $2 $0
+ ; Free variant
+ System::Free $1
+ StrCpy $1 $2
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ; Release returned element
+ Pop $2
+ ${BOOTCFG_ReleaseObject} $2
+ ${EndIf}
+
+ ${If} $0 != 0
+ DetailPrint $1
+ StrCpy $0 ""
+ ${Else}
+ StrCpy $0 $1
+ ${EndIf}
+
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+
Function ShowExpert
; Do initialisations as early as possible
@@ -77,13 +179,8 @@ readme_file_not_found:
StrCpy $windows_boot_method ntldr
Goto windows_version_ok
${Endif}
- ; So far, all versions post Windows 7 support bcdedit.exe
+ ; So far, all versions post Windows 7 support BCD
StrCpy $windows_boot_method bootmgr
- ; FIXME: this blurb is duplicated in the uninstaller. keep in sync!
- GetFullPathName $bcdedit $WINDIR\Sysnative\bcdedit.exe
- ${If} $bcdedit == ""
- StrCpy $bcdedit $SYSDIR\bcdedit.exe
- ${Endif}
windows_version_ok:
; ********************************************** Initialise $c
@@ -95,19 +192,17 @@ windows_version_ok:
Pop $c
${If} $c == failed
${If} $windows_boot_method == bootmgr
- ; If we are under Vista or Win7, try reading the partition from {current} entry in bcdedit
- nsExec::ExecToStack '"$bcdedit" /enum {current}'
- Pop $0
- ${If} $0 != 0
- StrCpy $0 '"$bcdedit" /enum {current}'
- MessageBox MB_OK|MB_ICONSTOP "$(error_exec)"
+ ; If we are under Vista or Win7, try reading the partition from {current} entry of default BCD store
+ Call GetDevicePathOfPartition
+ Pop $0
+ ${If} $0 != ""
+ Push $0
+ Call GetDriveLetterOfDevice
+ Pop $c
+ ${If} $c != error
+ Goto c_is_initialized
+ ${EndIf}
${EndIf}
- ; The whole output of bcdedit is on stack now. Search for partition=??
- string::bcdedit_extract_partition
- Pop $c
- ${If} $c != "error"
- Goto c_is_initialized
- ${EndIf}
${EndIf}
${GetRoot} $WINDIR $c
MessageBox MB_OK|MB_ICONEXCLAMATION $(cant_find_system_partition)
diff --git a/include/bootcfg.nsh b/include/bootcfg.nsh
new file mode 100644
index 0000000..8130707
--- /dev/null
+++ b/include/bootcfg.nsh
@@ -0,0 +1,2766 @@
+; Licensed under the zlib/libpng license (same as NSIS)
+
+!ifndef BOOTCFG_INCLUDED
+!define BOOTCFG_INCLUDED
+
+!include "LogicLib.nsh"
+
+; Function parameters are ordered from first pushed parameter
+; to the last pushed parameter (top most on the stack)
+
+!define BOOTCFG_PREFIX "BOOTCFG_"
+!define BOOTCFG_UNFUNC "un."
+
+; Redefine function macro (switch from include to call function mode)
+!macro BOOTCFG_FUNCREDEF UN FUNCNAME
+ !ifndef `${UN}${BOOTCFG_PREFIX}${FUNCNAME}_INCLUDED`
+ !insertmacro ${BOOTCFG_PREFIX}${FUNCNAME} "${UN}"
+ !endif
+ !define /redef `${UN}${BOOTCFG_PREFIX}${FUNCNAME}` \
+ `!insertmacro ${BOOTCFG_PREFIX}${FUNCNAME}_Call "${UN}"`
+!macroend
+
+; Define function macro
+!macro BOOTCFG_FUNCDEF FUNCNAME
+ !define `${BOOTCFG_PREFIX}${FUNCNAME}` \
+ `!insertmacro BOOTCFG_FUNCREDEF "" ${FUNCNAME}`
+ !define `${BOOTCFG_UNFUNC}${BOOTCFG_PREFIX}${FUNCNAME}` \
+ `!insertmacro BOOTCFG_FUNCREDEF ${BOOTCFG_UNFUNC} ${FUNCNAME}`
+!macroend
+
+; Provide function prolog for installer and uninstaller
+!macro BOOTCFG_FUNCPROLOG UN FUNCNAME
+ !define `${UN}${BOOTCFG_PREFIX}${FUNCNAME}_INCLUDED`
+ Function `${UN}${BOOTCFG_PREFIX}${FUNCNAME}`
+!macroend
+
+; Include required function
+!macro BOOTCFG_FUNCINC UN FUNCNAME
+ !ifndef `${UN}${BOOTCFG_PREFIX}${FUNCNAME}_INCLUDED`
+ !insertmacro ${BOOTCFG_PREFIX}${FUNCNAME} "${UN}"
+ !endif
+!macroend
+
+; ${BOOTCFG_AllocEmptyVariant} variant
+!insertmacro BOOTCFG_FUNCDEF AllocEmptyVariant
+!macro BOOTCFG_AllocEmptyVariant_Call UN VARIANT
+ Call `${UN}${BOOTCFG_PREFIX}AllocEmptyVariant`
+ Pop ${VARIANT}
+!macroend
+
+; ${BOOTCFG_AllocI4Variant} value variant
+!insertmacro BOOTCFG_FUNCDEF AllocI4Variant
+!macro BOOTCFG_AllocI4Variant_Call UN VALUE VARIANT
+ Push ${VALUE}
+ Call `${UN}${BOOTCFG_PREFIX}AllocI4Variant`
+ Pop ${VARIANT}
+!macroend
+
+; ${BOOTCFG_AllocStringArrayVariant} array variant
+!insertmacro BOOTCFG_FUNCDEF AllocStringArrayVariant
+!macro BOOTCFG_AllocStringArrayVariant_Call UN ARRAY VARIANT
+ Push ${ARRAY}
+ Call `${UN}${BOOTCFG_PREFIX}AllocStringArrayVariant`
+ Pop ${VARIANT}
+!macroend
+
+; ${BOOTCFG_AllocStringVariant} string variant
+!insertmacro BOOTCFG_FUNCDEF AllocStringVariant
+!macro BOOTCFG_AllocStringVariant_Call UN STRING VARIANT
+ Push "${STRING}"
+ Call `${UN}${BOOTCFG_PREFIX}AllocStringVariant`
+ Pop ${VARIANT}
+!macroend
+
+; ${BOOTCFG_FreeStringVariant} variant
+!insertmacro BOOTCFG_FUNCDEF FreeStringVariant
+!macro BOOTCFG_FreeStringVariant_Call UN VARIANT
+ Push ${VARIANT}
+ Call `${UN}${BOOTCFG_PREFIX}FreeStringVariant`
+!macroend
+
+; ${BOOTCFG_GetVariantType} variant type
+!insertmacro BOOTCFG_FUNCDEF GetVariantType
+!macro BOOTCFG_GetVariantType_Call UN VARIANT TYPE
+ Push ${VARIANT}
+ Call `${UN}${BOOTCFG_PREFIX}GetVariantType`
+ Pop ${TYPE}
+!macroend
+
+; ${BOOTCFG_GetBoolOfVariant} variant value err
+!insertmacro BOOTCFG_FUNCDEF GetBoolOfVariant
+!macro BOOTCFG_GetBoolOfVariant_Call UN VARIANT VALUE ERR
+ Push ${VARIANT}
+ Call `${UN}${BOOTCFG_PREFIX}GetBoolOfVariant`
+ Pop ${ERR}
+ Pop ${VALUE}
+!macroend
+
+; ${BOOTCFG_GetObjectOfVariant} variant obj err
+!insertmacro BOOTCFG_FUNCDEF GetObjectOfVariant
+!macro BOOTCFG_GetObjectOfVariant_Call UN VARIANT OBJ ERR
+ Push ${VARIANT}
+ Call `${UN}${BOOTCFG_PREFIX}GetObjectOfVariant`
+ Pop ${ERR}
+ Pop ${OBJ}
+!macroend
+
+; ${BOOTCFG_GetStringOfVariant} variant string err
+!insertmacro BOOTCFG_FUNCDEF GetStringOfVariant
+!macro BOOTCFG_GetStringOfVariant_Call UN VARIANT STRING ERR
+ Push ${VARIANT}
+ Call `${UN}${BOOTCFG_PREFIX}GetStringOfVariant`
+ Pop ${ERR}
+ Pop ${STRING}
+!macroend
+
+; ${BOOTCFG_GetStringArrayOfVariant} variant array err
+!insertmacro BOOTCFG_FUNCDEF GetStringArrayOfVariant
+!macro BOOTCFG_GetStringArrayOfVariant_Call UN VARIANT ARRAY ERR
+ Push ${VARIANT}
+ Call `${UN}${BOOTCFG_PREFIX}GetStringArrayOfVariant`
+ Pop ${ERR}
+ Pop ${ARRAY}
+!macroend
+
+; ${BOOTCFG_IsUEFI} uefi
+!insertmacro BOOTCFG_FUNCDEF IsUEFI
+!macro BOOTCFG_IsUEFI_Call UN UEFI
+ Call `${UN}${BOOTCFG_PREFIX}IsUEFI`
+ Pop ${UEFI}
+!macroend
+
+; ${BOOTCFG_ConnectWMI} locator services err
+!insertmacro BOOTCFG_FUNCDEF ConnectWMI
+!macro BOOTCFG_ConnectWMI_Call UN LOCATOR SERVICES ERR
+ Call `${UN}${BOOTCFG_PREFIX}ConnectWMI`
+ Pop ${ERR}
+ Pop ${SERVICES}
+ Pop ${LOCATOR}
+!macroend
+
+; ${BOOTCFG_GetObject} services classname obj err
+!insertmacro BOOTCFG_FUNCDEF GetObject
+!macro BOOTCFG_GetObject_Call UN SERVICES CLASSNAME OBJ ERR
+ Push ${SERVICES}
+ Push ${CLASSNAME}
+ Call `${UN}${BOOTCFG_PREFIX}GetObject`
+ Pop ${ERR}
+ Pop ${OBJ}
+!macroend
+
+; ${BOOTCFG_GetMethod} baseobject method inparams err
+!insertmacro BOOTCFG_FUNCDEF GetMethod
+!macro BOOTCFG_GetMethod_Call UN BASEOBJECT METHOD INPARAMS ERR
+ Push ${BASEOBJECT}
+ Push ${METHOD}
+ Call `${UN}${BOOTCFG_PREFIX}GetMethod`
+ Pop ${ERR}
+ Pop ${INPARAMS}
+!macroend
+
+; ${BOOTCFG_SpawnInstance} inparams instance err
+!insertmacro BOOTCFG_FUNCDEF SpawnInstance
+!macro BOOTCFG_SpawnInstance_Call UN INPARAMS INSTANCE ERR
+ Push ${INPARAMS}
+ Call `${UN}${BOOTCFG_PREFIX}SpawnInstance`
+ Pop ${ERR}
+ Pop ${INSTANCE}
+!macroend
+
+; ${BOOTCFG_PrepareMethod} baseobject method instance err
+!insertmacro BOOTCFG_FUNCDEF PrepareMethod
+!macro BOOTCFG_PrepareMethod_Call UN BASEOBJECT METHOD INSTANCE ERR
+ Push ${BASEOBJECT}
+ Push ${METHOD}
+ Call `${UN}${BOOTCFG_PREFIX}PrepareMethod`
+ Pop ${ERR}
+ Pop ${INSTANCE}
+!macroend
+
+; ${BOOTCFG_Put} instance key value err
+!insertmacro BOOTCFG_FUNCDEF Put
+!macro BOOTCFG_Put_Call UN INSTANCE KEY VALUE ERR
+ Push ${INSTANCE}
+ Push ${KEY}
+ Push ${VALUE}
+ Call `${UN}${BOOTCFG_PREFIX}Put`
+ Pop ${ERR}
+!macroend
+
+; ${BOOTCFG_ExecMethod} services obj instance method result err
+!insertmacro BOOTCFG_FUNCDEF ExecMethod
+!macro BOOTCFG_ExecMethod_Call UN SERVICES \
+ OBJ INSTANCE METHOD RESULT ERR
+ Push ${SERVICES}
+ Push ${OBJ}
+ Push ${INSTANCE}
+ Push ${METHOD}
+ Call `${UN}${BOOTCFG_PREFIX}ExecMethod`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_CallMethod} services baseobject obj method key \
+; value result err
+!insertmacro BOOTCFG_FUNCDEF CallMethod
+!macro BOOTCFG_CallMethod_Call UN SERVICES BASEOBJECT \
+ OBJ METHOD KEY VALUE RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEOBJECT}
+ Push ${OBJ}
+ Push ${METHOD}
+ Push ${KEY}
+ Push ${VALUE}
+ Call `${UN}${BOOTCFG_PREFIX}CallMethod`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_OpenBcdStore} services baseobject filename obj err
+!insertmacro BOOTCFG_FUNCDEF OpenBcdStore
+!macro BOOTCFG_OpenBcdStore_Call UN SERVICES BASEOBJECT \
+ FILENAME OBJ ERR
+ Push ${SERVICES}
+ Push ${BASEOBJECT}
+ Push ${FILENAME}
+ Call `${UN}${BOOTCFG_PREFIX}OpenBcdStore`
+ Pop ${ERR}
+ Pop ${OBJ}
+!macroend
+
+; ${BOOTCFG_OpenDefaultBcdStore} services baseobject obj err
+!insertmacro BOOTCFG_FUNCDEF OpenDefaultBcdStore
+!macro BOOTCFG_OpenDefaultBcdStore_Call UN SERVICES BASEOBJECT \
+ OBJ ERR
+ Push ${SERVICES}
+ Push ${BASEOBJECT}
+ Push ""
+ Call `${UN}${BOOTCFG_PREFIX}OpenBcdStore`
+ Pop ${ERR}
+ Pop ${OBJ}
+!macroend
+!macro BOOTCFG_OpenDefaultBcdStore UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" OpenBcdStore
+!macroend
+
+; ${BOOTCFG_GetBcdObject} services baseobject bcdstore id obj err
+!insertmacro BOOTCFG_FUNCDEF GetBcdObject
+!macro BOOTCFG_GetBcdObject_Call UN SERVICES BASEOBJECT \
+ BCDSTORE ID OBJ ERR
+ Push ${SERVICES}
+ Push ${BASEOBJECT}
+ Push ${BCDSTORE}
+ Push ${ID}
+ Call `${UN}${BOOTCFG_PREFIX}GetBcdObject`
+ Pop ${ERR}
+ Pop ${OBJ}
+!macroend
+
+; ${BOOTCFG_GetBcdElement} services baseobject bcdobject elemtype \
+; elment err
+!insertmacro BOOTCFG_FUNCDEF GetBcdElement
+!macro BOOTCFG_GetBcdElement_Call UN SERVICES BASEOBJECT \
+ BCDOBJECT ELEMTYPE ELEMENT ERR
+ Push ${SERVICES}
+ Push ${BASEOBJECT}
+ Push ${BCDOBJECT}
+ Push ${ELEMTYPE}
+ Call `${UN}${BOOTCFG_PREFIX}GetBcdElement`
+ Pop ${ERR}
+ Pop ${ELEMENT}
+!macroend
+
+; ${BOOTCFG_GetObjectPropertyValue} obj property value err
+!insertmacro BOOTCFG_FUNCDEF GetObjectPropertyValue
+!macro BOOTCFG_GetObjectPropertyValue_Call UN OBJ PROPERTY \
+ VALUE ERR
+ Push ${OBJ}
+ Push ${PROPERTY}
+ Call `${UN}${BOOTCFG_PREFIX}GetObjectPropertyValue`
+ Pop ${ERR}
+ Pop ${VALUE}
+!macroend
+
+; ${BOOTCFG_GetElementFromBcd} services basebcdstore bcdstore \
+; basebcdobject id elemtype obj elem err
+!insertmacro BOOTCFG_FUNCDEF GetElementFromBcd
+!macro BOOTCFG_GetElementFromBcd_Call UN SERVICES \
+ BASEBCDSTORE BCDSTORE BASEBCDOBJECT ID ELEMTYPE OBJ ELEM ERR
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Push ${BCDSTORE}
+ Push ${BASEBCDOBJECT}
+ Push ${ID}
+ Push ${ELEMTYPE}
+ Call `${UN}${BOOTCFG_PREFIX}GetElementFromBcd`
+ Pop ${ERR}
+ Pop ${ELEM}
+ Pop ${OBJ}
+!macroend
+
+; ${BOOTCFG_GetSystemPartition} services basebcdstore partition err
+!insertmacro BOOTCFG_FUNCDEF GetSystemPartition
+!macro BOOTCFG_GetSystemPartition_Call UN SERVICES BASEBCDSTORE PARTITION ERR
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Call `${UN}${BOOTCFG_PREFIX}GetSystemPartition`
+ Pop ${ERR}
+ Pop ${PARTITION}
+!macroend
+
+; ${BOOTCFG_ObjectListGetSafeArray} objectlist safearray err
+!insertmacro BOOTCFG_FUNCDEF ObjectListGetSafeArray
+!macro BOOTCFG_ObjectListGetSafeArray_Call UN OBJECTLIST \
+ SAFEARRAY ERR
+ Push ${OBJECTLIST}
+ Call `${UN}${BOOTCFG_PREFIX}ObjectListGetSafeArray`
+ Pop ${ERR}
+ Pop ${SAFEARRAY}
+!macroend
+
+; ${BOOTCFG_GetSizeOfSafeArray} safearray size
+!insertmacro BOOTCFG_FUNCDEF GetSizeOfSafeArray
+!macro BOOTCFG_GetSizeOfSafeArray_Call UN SAFEARRAY SIZE
+ Push ${SAFEARRAY}
+ Call `${UN}${BOOTCFG_PREFIX}GetSizeOfSafeArray`
+ Pop ${SIZE}
+!macroend
+
+; ${BOOTCFG_GetElementDescription} element description
+!insertmacro BOOTCFG_FUNCDEF GetElementDescription
+!macro BOOTCFG_GetElementDescription_Call UN ELEMENT DESCRIPTION
+ Push ${ELEMENT}
+ Call `${UN}${BOOTCFG_PREFIX}GetElementDescription`
+ Pop ${DESCRIPTION}
+!macroend
+
+; ${BOOTCFG_GetBcdObjectDescription} $services basebcdstore bcdstore \
+; basebcdobject id description
+!insertmacro BOOTCFG_FUNCDEF GetBcdObjectDescription
+!macro BOOTCFG_GetBcdObjectDescription_Call UN SERVICES BASEBCDSTORE \
+ BCDSTORE BASEBCDOBJECT ID DESCRIPTION
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Push ${BCDSTORE}
+ Push ${BASEBCDOBJECT}
+ Push ${ID}
+ Call `${UN}${BOOTCFG_PREFIX}GetBcdObjectDescription`
+ Pop ${DESCRIPTION}
+!macroend
+
+; ${BOOTCFG_EnumerateBcdObjectList} services basebcdstore bcdstore \
+; basebcdobject objectlist err
+!insertmacro BOOTCFG_FUNCDEF EnumerateBcdObjectList
+!macro BOOTCFG_EnumerateBcdObjectList_Call UN SERVICES \
+ BASEBCDSTORE BCDSTORE BASEBCDOBJECT OBJECTLIST ERR
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Push ${BCDSTORE}
+ Push ${BASEBCDOBJECT}
+ Push ${OBJECTLIST}
+ Call `${UN}${BOOTCFG_PREFIX}EnumerateBcdObjectList`
+ Pop ${ERR}
+!macroend
+
+; ${BOOTCFG_CreateGUID} guid
+!insertmacro BOOTCFG_FUNCDEF CreateGUID
+!macro BOOTCFG_CreateGUID_Call UN GUID
+ Call `${UN}${BOOTCFG_PREFIX}CreateGUID`
+ Pop ${GUID}
+!macroend
+
+; ${BOOTCFG_CreateObject} services basebcdstore bcdstore type guid obj err
+!insertmacro BOOTCFG_FUNCDEF CreateObject
+!macro BOOTCFG_CreateObject_Call UN SERVICES BASEBCDSTORE BCDSTORE \
+ TYPE GUID OBJ ERR
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Push ${BCDSTORE}
+ Push ${TYPE}
+ Push ${GUID}
+ Call `${UN}${BOOTCFG_PREFIX}CreateObject`
+ Pop ${ERR}
+ Pop ${OBJ}
+!macroend
+
+; ${BOOTCFG_DeleteObject} services basebcdstore bcdstore guid result err
+!insertmacro BOOTCFG_FUNCDEF DeleteObject
+!macro BOOTCFG_DeleteObject_Call UN SERVICES BASEBCDSTORE BCDSTORE GUID \
+ RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Push ${BCDSTORE}
+ Push ${GUID}
+ Call `${UN}${BOOTCFG_PREFIX}DeleteObject`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_SetStringElement} services basebcdobject bcdobject type string \
+; result err
+!insertmacro BOOTCFG_FUNCDEF SetStringElement
+!macro BOOTCFG_SetStringElement_Call UN SERVICES BASEBCDOBJECT BCDOBJECT \
+ TYPE STRING RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDOBJECT}
+ Push ${BCDOBJECT}
+ Push ${TYPE}
+ Push "${STRING}"
+ Call `${UN}${BOOTCFG_PREFIX}SetStringElement`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_SetDescription} services basebcdobject bcdobject string \
+; result err
+!insertmacro BOOTCFG_FUNCDEF SetDescription
+!macro BOOTCFG_SetDescription_Call UN SERVICES BASEBCDOBJECT BCDOBJECT \
+ STRING RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDOBJECT}
+ Push ${BCDOBJECT}
+ Push ${BOOTCFG_BCDE_DESCRIPTION}
+ Push "${STRING}"
+ Call `${UN}${BOOTCFG_PREFIX}SetStringElement`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+!macro BOOTCFG_SetDescription UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" SetStringElement
+!macroend
+
+; ${BOOTCFG_SetPath} services basebcdobject bcdobject path \
+; result err
+!insertmacro BOOTCFG_FUNCDEF SetPath
+!macro BOOTCFG_SetPath_Call UN SERVICES BASEBCDOBJECT BCDOBJECT \
+ PATH RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDOBJECT}
+ Push ${BCDOBJECT}
+ Push ${BOOTCFG_BCDE_PATH}
+ Push "${PATH}"
+ Call `${UN}${BOOTCFG_PREFIX}SetStringElement`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+!macro BOOTCFG_SetPath UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" SetStringElement
+!macroend
+
+; ${BOOTCFG_SetPartition} services basebcdobject bcdobject path \
+; result err
+!insertmacro BOOTCFG_FUNCDEF SetPartition
+!macro BOOTCFG_SetPartition_Call UN SERVICES BASEBCDOBJECT BCDOBJECT \
+ PARTITION RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDOBJECT}
+ Push ${BCDOBJECT}
+ Push "${PARTITION}"
+ Call `${UN}${BOOTCFG_PREFIX}SetPartition`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_SetObjectList} services basebcdobject bcdobject \
+; type objlist result err
+!insertmacro BOOTCFG_FUNCDEF SetObjectList
+!macro BOOTCFG_SetObjectList_Call UN SERVICES BASEBCDOBJECT \
+ BCDOBJECT TYPE OBJLIST RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDOBJECT}
+ Push ${BCDOBJECT}
+ Push ${TYPE}
+ Push ${OBJLIST}
+ Call `${UN}${BOOTCFG_PREFIX}SetObjectList`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_AppendBootEntry} services basebcdstore bcdstore \
+; guid result err
+!insertmacro BOOTCFG_FUNCDEF AppendBootEntry
+!macro BOOTCFG_AppendBootEntry_Call UN SERVICES BASEBCDSTORE \
+ BCDSTORE BASEBCDOBJECT GUID RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Push ${BCDSTORE}
+ Push ${BASEBCDOBJECT}
+ Push ${GUID}
+ Call `${UN}${BOOTCFG_PREFIX}AppendBootEntry`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_RemoveBootEntry} services basebcdstore bcdstore \
+; guid result err
+!insertmacro BOOTCFG_FUNCDEF RemoveBootEntry
+!macro BOOTCFG_RemoveBootEntry_Call UN SERVICES BASEBCDSTORE \
+ BCDSTORE BASEBCDOBJECT GUID RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Push ${BCDSTORE}
+ Push ${BASEBCDOBJECT}
+ Push ${GUID}
+ Call `${UN}${BOOTCFG_PREFIX}RemoveBootEntry`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_SetActiveBootEntry} services basebcdstore bcdstore \
+; guid result err
+!insertmacro BOOTCFG_FUNCDEF SetActiveBootEntry
+!macro BOOTCFG_SetActiveBootEntry_Call UN SERVICES BASEBCDSTORE \
+ BCDSTORE BASEBCDOBJECT GUID RESULT ERR
+ Push ${SERVICES}
+ Push ${BASEBCDSTORE}
+ Push ${BCDSTORE}
+ Push ${BASEBCDOBJECT}
+ Push ${GUID}
+ Call `${UN}${BOOTCFG_PREFIX}SetActiveBootEntry`
+ Pop ${ERR}
+ Pop ${RESULT}
+!macroend
+
+; ${BOOTCFG_ReleaseObject} obj
+!define BOOTCFG_ReleaseObject `!insertmacro BOOTCFG_ReleaseObject_Call ""`
+!define ${BOOTCFG_UNFUNC}BOOTCFG_ReleaseObject \
+ `!insertmacro BOOTCFG_ReleaseObject_Call ${BOOTCFG_UNFUNC}`
+!macro BOOTCFG_ReleaseObject_Call UN OBJ
+ System::Call "${OBJ}->2()"
+!macroend
+
+!define BOOTCFG_BCDE_AUTORECOVERYENABLED 0x16000009
+!define BOOTCFG_BCDE_RECOVERYSEQUENCE 0x14000008
+!define BOOTCFG_BCDE_DESCRIPTION 0x12000004
+!define BOOTCFG_BCDE_DEVICE 0x11000001
+!define BOOTCFG_BCDE_PATH 0x12000002
+!define BOOTCFG_BOOT_SECTOR 0x10400008
+!define BOOTCFG_DISPLAY_ORDER 0x24000001
+!define BOOTCFG_BOOTSEQUENCE 0x24000002
+!define BOOTCFG_BOOTMGR_GUID "{9dea862c-5cdd-4e70-acc1-f32b344d4795}"
+!define BOOTCFG_CURRENT_GUID "{fa926493-6f1c-4193-a414-58f0b2456d1e}"
+!define BOOTCFG_FWBOOTMGR_GUID "{a5a30fa2-3d06-4e9f-b5f4-a01df9d1fcba}"
+!define BOOTCFG_PARTIONDEVICE_TYPE 2
+
+!define CLSCTX_INPROC_SERVER 1
+!define CLSID_WbemLocator "{4590f811-1d3a-11d0-891f-00aa004b2e24}"
+
+!define EOAC_NONE 0
+
+!define ERROR_INVALID_DATA 13
+!define ERROR_INVALID_PARAMETER 87
+!define ERROR_NO_ACCESS 998
+!define ERROR_NO_MORE_ITEMS 259
+!define ERROR_NOT_ENOUGH_MEMORY 8
+
+!define FIRMWARE_TYPE_UEFI 2
+
+!define IID_IWbemLocator "{dc12a687-737f-11cf-884d-00aa004b2e24}"
+
+!define RPC_C_AUTHN_LEVEL_DEFAULT 0
+!define RPC_C_AUTHN_LEVEL_NONE 1
+!define RPC_C_IMP_LEVEL_IMPERSONATE 3
+
+!define RPC_E_TOO_LATE -2147417831 ; 0x80010119
+
+!define SE_PRIVILEGE_ENABLED 0x00000002
+
+!define TOKEN_ADJUST_PRIVILEGES 0x0020
+!define TOKEN_QUERY 0x0008
+
+!define WBEM_FLAG_FORWARD_ONLY 0x20
+!define WBEM_FLAG_RETURN_IMMEDIATELY 0x10
+!define WBEM_INFINITE 0xffffffff
+
+!define wbemPrivilegeBackup 16
+!define wbemPrivilegeRestore 17
+
+!define VT_ARRAY 8192 ; 0x2000
+!define VT_ARRAY_BSTR 8200 ; 0x2008
+!define VT_BOOL 11 ; 0x000B
+!define VT_BSTR 8 ; 0x0008
+!define VT_EMPTY 0 ; 0x0000
+!define VT_I4 3 ; 0x0003
+!define VT_UNKNOWN 13 ; 0x000D
+
+!macro BOOTCFG_AllocEmptyVariant UN
+; Allocate empty variant
+; Caller is responsible to release returned object.
+; Return value:
+; variant
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" AllocEmptyVariant
+ ; VARTYPE (unsigned short) vt, WORD wReserved1,
+ ; WORD wReserved2, WORD wReserved3
+ ; and the one consuming the most space
+ ; struct __tagRECORD { PVOID pvRecord, IRecordInfo *pRecInfo)
+ System::Call "*(&i2 ${VT_EMPTY}, &i2 0, &i2 0, &i2 0, p 0, p 0) p.s"
+FunctionEnd
+!macroend ; BOOTCFG_AllocEmptyVariant
+
+!macro BOOTCFG_AllocI4Variant UN
+; Allocate 4-byte signed integer (I4) variant and fill it with provided value
+; Parameter:
+; value - integer
+; Return value:
+; variant - I4 variant
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" AllocI4Variant
+ Push $0
+ Exch
+ Exch $1
+
+ !insertmacro ${BOOTCFG_PREFIX}AllocEmptyVariant_Call "${UN}" $0
+ ${If} $0 != 0
+ System::Call "*$0(&i2 ${VT_I4}, &i2, &i2, &i2, &i4 r1)"
+ ${EndIf}
+
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_AllocI4Variant
+
+!macro BOOTCFG_AllocStringArrayVariant UN
+; Allocate string array variant and fill it with provided array
+; Parameter:
+; array - safe array of strings
+; Return value:
+; variant - safe array variant
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" AllocStringArrayVariant
+ Push $0
+ Exch
+ Exch $1
+
+ !insertmacro ${BOOTCFG_PREFIX}AllocEmptyVariant_Call "${UN}" $0
+ ${If} $0 != 0
+ System::Call "*$0(&i2 ${VT_ARRAY_BSTR}, &i2, &i2, &i2, p r1)"
+ ${EndIf}
+
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_AllocStringVariant
+
+!macro BOOTCFG_AllocStringVariant UN
+; Allocate string variant and fill it with provided string
+; Parameter:
+; string
+; Return value:
+; variant - string variant
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" AllocStringVariant
+ Push $0
+ Exch
+ Exch $1
+
+ !insertmacro ${BOOTCFG_PREFIX}AllocEmptyVariant_Call "${UN}" $0
+ ${If} $0 != 0
+ System::Call "oleaut32::SysAllocString(w r1) p.s"
+ Pop $1
+ ${If} $1 != 0
+ System::Call "*$0(&i2 ${VT_BSTR}, &i2, &i2, &i2, p r1)"
+ ${Else}
+ System::Free $0
+ StrCpy $0 0
+ ${EndIf}
+ ${EndIf}
+
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_AllocStringVariant
+
+!macro BOOTCFG_FreeStringVariant UN
+; Free string variant
+; Parameter:
+; variant - string variant
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" FreeStringVariant
+ Exch $0
+
+ ${If} $0 != 0
+ Push $0
+ System::Call "*$0(&i2, &i2, &i2, &i2, p .r0)"
+ ${If} $0 != 0
+ System::Call "oleaut32::SysFreeString(p r0)"
+ ${EndIf}
+ Pop $0
+ System::Free $0
+ ${EndIf}
+
+ Pop $0
+FunctionEnd
+!macroend ; BOOTCFG_FreeStringVariant
+
+!macro BOOTCFG_GetVariantType UN
+; Get variant type
+; Parameter:
+; variant
+; Return value:
+; type of variant
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetVariantType
+ Push $0
+ Exch
+ Exch $1
+ System::Call "*$1(&i2 .r0)"
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetVariantType
+
+!macro BOOTCFG_GetBoolOfVariant UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetVariantType
+; Get boolean value of variant
+; Parameter:
+; variant
+; Return value:
+; value - boolean value (0 = false) or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetBoolOfVariant
+ Push $0
+ Exch
+ Push $1
+ Exch
+ Exch $2
+
+ ; variant=$2
+
+ !insertmacro ${BOOTCFG_PREFIX}GetVariantType_Call "${UN}" $2 $0
+ ${If} $0 != ${VT_BOOL}
+ StrCpy $1 "unexpected variant type: $0"
+ StrCpy $0 ${ERROR_INVALID_DATA}
+ ${Else}
+ System::Call "*$2(&i2, &i2, &i2, &i2, i .r1)"
+ StrCpy $0 0
+ ${EndIf}
+
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetBoolOfVariant
+
+!macro BOOTCFG_GetObjectOfVariant UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetVariantType
+; Get object of variant
+; Parameter:
+; variant
+; Return value:
+; obj - object or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetObjectOfVariant
+ Push $0
+ Exch
+ Push $1
+ Exch
+ Exch $2
+
+ ; variant=$2
+
+ !insertmacro ${BOOTCFG_PREFIX}GetVariantType_Call "${UN}" $2 $0
+ ${If} $0 != ${VT_UNKNOWN}
+ StrCpy $1 "unexpected variant type: $0"
+ StrCpy $0 ${ERROR_INVALID_DATA}
+ ${Else}
+ System::Call "*$2(&i2, &i2, &i2, &i2, p .r1)"
+ StrCpy $0 0
+ ${EndIf}
+
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetObjectOfVariant
+
+!macro BOOTCFG_GetStringOfVariant UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetVariantType
+; Get string of variant
+; Parameter:
+; variant
+; Return value:
+; string - string or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetStringOfVariant
+ Push $0
+ Exch
+ Push $1
+ Exch
+ Exch $2
+
+ ; variant=$2
+
+ !insertmacro ${BOOTCFG_PREFIX}GetVariantType_Call "${UN}" $2 $0
+ ${If} $0 != ${VT_BSTR}
+ StrCpy $1 "unexpected variant type: $0"
+ StrCpy $0 ${ERROR_INVALID_DATA}
+ ${Else}
+ System::Call "*$2(&i2, &i2, &i2, &i2, w .r1)"
+ StrCpy $0 0
+ ${EndIf}
+
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetStringOfVariant
+
+!macro BOOTCFG_GetStringArrayOfVariant UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetVariantType
+; Get string array of variant
+; Parameter:
+; variant
+; Return value:
+; array - string array or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetStringArrayOfVariant
+ Push $0
+ Exch
+ Push $1
+ Exch
+ Exch $2
+
+ ; variant=$2
+
+ !insertmacro ${BOOTCFG_PREFIX}GetVariantType_Call "${UN}" $2 $0
+ ${If} $0 != ${VT_ARRAY_BSTR}
+ StrCpy $1 "unexpected variant type: $0"
+ StrCpy $0 ${ERROR_INVALID_DATA}
+ ${Else}
+ System::Call "*$2(&i2, &i2, &i2, &i2, p .r1)"
+ StrCpy $0 0
+ ${EndIf}
+
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetStringArrayOfVariant
+
+!macro BOOTCFG_IsUEFI UN
+; Check for UEFI firmware
+; Return value
+; 1 - UEFI
+; 0 - BIOS
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" IsUEFI
+ Push $0
+ Push $1
+ Push $2
+
+ ; Initialize return value
+ StrCpy $0 0
+ ; GetFirmwareType is available in Windows 8 or a later version of Windows
+ System::Call "kernel32::GetFirmwareType(*i 0 r2) i .r1"
+ ${If} $1 != "error"
+ ${AndIf} $1 != 0
+ ${If} $2 == ${FIRMWARE_TYPE_UEFI}
+ StrCpy $0 1
+ ${EndIf}
+ ${Else}
+ ; Fall back to GetFirmwareEnvironmentVariable API function
+ System::Call "kernel32::GetFirmwareEnvironmentVariable(t '', \
+ t '{00000000-0000-0000-0000-000000000000}', p 0, i 0) i .r1 ? e"
+ Pop $2
+ ${If} $1 != "error"
+ ${AndIf} $2 == ${ERROR_NO_ACCESS}
+ StrCpy $0 1
+ ${EndIf}
+ ${EndIf}
+
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_IsUEFI
+
+!macro BOOTCFG_GetObject UN
+; Get object of provided class name
+; Caller is responsible to release returned object.
+; Parameters:
+; services - IWbemServices object
+; name - class name
+; Return values:
+; obj - object or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetObject
+ Push $0
+ Exch 2
+ Push $1
+ Exch 2
+ Exch $2
+ Exch
+ Exch $3
+
+ ; name=$2, services=$3
+
+ ; IWbemServices::GetObject
+ ; services->GetObject(objectpath, flags, context, object, result)
+
+ System::Call "$3->6(w r2, i 0, p 0, *p 0 r1, p 0) p.r0"
+ ${If} $0 != 0
+ StrCpy $1 "GetObject $2 failed"
+ ${EndIf}
+
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetObject
+
+!macro BOOTCFG_GetObjectPropertyValue UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocEmptyVariant
+; Get property value of provided object
+; Caller is responsible to free returned variant.
+; Parameters:
+; object - IWbemClassObject
+; property - name of property
+; Return Values:
+; value - allocated property value as a variant
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetObjectPropertyValue
+ Push $0
+ Exch 2
+ Push $1
+ Exch 2
+ Exch $2
+ Exch
+ Exch $3
+
+ ; property=$2, object=$3
+
+ !insertmacro ${BOOTCFG_PREFIX}AllocEmptyVariant_Call "${UN}" $1
+ ; variant=$1
+
+ ${If} $1 != 0
+ ; IWbemClassObject::Get
+ ; object->Get(property, flags, variant, vtType, flavor)
+ System::Call "$3->4(w r2, i 0, p r1, p 0, p 0) i.r0"
+ ${If} $0 != 0
+ System::Free $1
+ StrCpy $1 "Unable to get property $2"
+ ${EndIf}
+ ${Else}
+ StrCpy $1 "Failed to allocate variant for property $2"
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetObjectPropertyValue
+
+!macro BOOTCFG_GetMethod UN
+; Prepare method
+; Parameters:
+; baseobject - base class object
+; method - name of method
+; Return values:
+; inparams - inparams object respectively an error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetMethod
+ Push $0
+ Exch 2
+ Push $1
+ Exch 2
+ Exch $2
+ Exch
+ Exch $3
+
+ ; method=$2, baseobject=$3
+
+ ; IWbemClassObject::GetMethod
+ ; object->GetMethod(method, flags, inparams, outparams)
+ System::Call "$3->19(w r2, i 0, *p 0 r1, p 0) i.r0"
+ ${If} $0 != 0
+ StrCpy $1 "GetMethod $3 failed"
+ ${EndIf}
+
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetMethod
+
+!macro BOOTCFG_SpawnInstance UN
+; Spawn instance
+; Parameters:
+; inparams - inparams object
+; Return values:
+; instance - instance object
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" SpawnInstance
+ Push $0
+ Exch
+ Push $1
+ Exch
+ Exch $2
+
+ ; inparams=$2
+
+ ; IWbemClassObject::SpawnInstance
+ ; inparams->SpawnInstance(flags, classinstance)
+ ; inparmasinstance=$1
+ System::Call "$2->15(i 0, *p 0 r1) i.r0"
+
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_SpawnInstance
+
+!macro BOOTCFG_PrepareMethod UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" SpawnInstance
+; Prepare method
+; Parameters:
+; baseobject - base class object
+; method - name of method
+; Return values:
+; instance - instance object
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" PrepareMethod
+ Push $0
+ Exch 2
+ Push $1
+ Exch 2
+ Exch $2
+ Exch
+ Exch $3
+
+ ; method=$2, baseobject=$3
+
+ !insertmacro ${BOOTCFG_PREFIX}GetMethod_Call "${UN}" $3 $2 $1 $0
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}SpawnInstance_Call "${UN}" $1 $3 $0
+ ; Release inparams
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${If} $0 != 0
+ StrCpy $1 "SpawnInstance $2 failed"
+ ${Else}
+ StrCpy $1 $3
+ ${EndIf}
+ ${EndIf}
+
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_PrepareMethod
+
+!macro BOOTCFG_Put UN
+; Fill instance object of input parameters with key/value pair
+; Parameters:
+; instance - instance object of input parameters
+; key - name of input parameter
+; value - input parameter variant value
+; Return values:
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" Put
+ Push $0
+ Exch 3
+ Exch $1
+ Exch 2
+ Exch $2
+ Exch
+ Exch $3
+
+ ; instance=$1, param=$2, varvalue=$3
+ ; IWbemClassObject::Put
+ ; inparamsinstance->Put(param, flags, valuevariant, vtType)
+ System::Call "$1->5(w r2, i 0, p r3, i 0) i.r0"
+
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_Put
+
+!macro BOOTCFG_ExecMethod UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectPropertyValue
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetBoolOfVariant
+; Execute method
+; Parameters:
+; services - IWbemServices object
+; obj - object to perform method
+; instance - instance object of input parameters
+; method - name of method
+; Return values:
+; result object
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" ExecMethod
+ Push $0
+ Exch 4
+ Push $1
+ Exch 4
+ Exch $2
+ Exch 3
+ Exch $3
+ Exch 2
+ Exch $4
+ Exch
+ Exch $5
+ Push $6
+
+ ; obj=$2, instance=$3, method=$4, services=$5
+
+ StrCpy $6 "__RELPATH"
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call "${UN}" \
+ $2 $6 $1 $0
+ ${If} $0 == 0
+ ; Extract path from variant structure
+ System::Call "*$1(&i2 .r0)"
+ IntOp $0 $0 - ${VT_BSTR}
+ ${If} $0 != 0
+ IntOp $0 $0 + ${VT_BSTR}
+ StrCpy $1 "Get $6 for method $4 returned unexpected variant \
+ type: $0"
+ StrCpy $0 ${ERROR_INVALID_DATA}
+ ${Else}
+ System::Call "*$1(&i2, &i2, &i2, &i2, w .r6)"
+ ${EndIf}
+ ; Free variant
+ System::Free $1
+ ${If} $0 == 0
+ ; IWbemServices::ExecMethod
+ ; services->ExecMethod(objectpath, method, flags, context
+ ; inparamsinstance, outparams, result)
+ System::Call "$5->24(w r6, w r4, i 0, p 0, p r3, *p 0 r1, \
+ p 0) i.r0"
+ ${If} $0 != 0
+ StrCpy $1 "ExecMethod $4 failed"
+ ${Else}
+ StrCpy $6 "ReturnValue"
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call \
+ "${UN}" $1 $6 $5 $0
+ ${If} $0 == 0
+ ; Push variant onto stack
+ Push $5
+ !insertmacro ${BOOTCFG_PREFIX}GetBoolOfVariant_Call "${UN}" \
+ $5 $5 $0
+ Exch $5
+ ; Free variant
+ System::Free $5
+ Pop $5
+ ${If} $0 != 0
+ StrCpy $5 "Get $6 for method $4 returned $5"
+ ${ElseIf} $5 == 0
+ StrCpy $5 "Get $6 for method $4 returned unexpected \
+ value: $5"
+ StrCpy $0 ${ERROR_NO_MORE_ITEMS}
+ ${EndIf}
+ ${EndIf}
+ ${If} $0 != 0
+ ; If an error occurred then release outparams
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ StrCpy $1 $5
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_ExecMethod
+
+!macro BOOTCFG_CallMethod UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" SpawnInstance
+!insertmacro BOOTCFG_FUNCINC "${UN}" Put
+!insertmacro BOOTCFG_FUNCINC "${UN}" ExecMethod
+; Call method of WMI object with provided input parameters and
+; return output parameters in result object
+; Caller is responsible to release returned result object.
+; Parameters:
+; services - IWbemServices object
+; baseobject - base class object
+; obj - object to perform method
+; method - name of method
+; key - name of input parameter
+; value - input parameter variant value
+; Return values:
+; result object
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" CallMethod
+ Push $0
+ Exch 6
+ Push $1
+ Exch 6
+ Exch $2
+ Exch 5
+ Exch $3
+ Exch 4
+ Exch $4
+ Exch 3
+ Exch $5
+ Exch 2
+ Exch $6
+ Exch
+ Exch $7
+ Push $8
+
+ ; baseobject=$2, obj=$3, method=$4, key=$5, value=$6, services=$7
+
+ ; GetMethod(baseobject, method)
+ !insertmacro ${BOOTCFG_PREFIX}GetMethod_Call "${UN}" $2 $4 $8 $0
+ ${If} $0 != 0
+ StrCpy $1 $8
+ ${Else}
+ ; Copy inparams to $2
+ StrCpy $2 $8
+ ${If} $5 != ""
+ ; Handle input parameters
+ ; SpawnInstance(inparams)
+ !insertmacro ${BOOTCFG_PREFIX}SpawnInstance_Call "${UN}" \
+ $2 $8 $0
+ ; instance=$8
+ ${If} $0 != 0
+ StrCpy $1 "SpawnInstance $4 failed"
+ ${Else}
+ ; Put(instance, key, value)
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" \
+ $8 $5 $6 $0
+ ${If} $0 != 0
+ StrCpy $1 "Put $4 failed for $5"
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $8 0
+ ${EndIf}
+ ; Release inparams
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $2
+ ${If} $0 == 0
+ ; ExecMethod(services, obj, instance, method)
+ !insertmacro ${BOOTCFG_PREFIX}ExecMethod_Call "${UN}" \
+ $7 $3 $8 $4 $1 $0
+ ${EndIf}
+ ${If} $8 != 0
+ ; If input parameters were provided then release inparams instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $8
+ ${EndIf}
+ ${EndIf}
+
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_CallMethod
+
+!macro BOOTCFG_OpenBcdStore UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" FreeStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" CallMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectPropertyValue
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectOfVariant
+; Open Bcd store
+; Parameters:
+; services - IWbemServices object
+; baseobject - BcdStore base class object
+; filename - complete path to BCD store file
+; Return values:
+; obj - BcdStore object respectively an error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" OpenBcdStore
+ Push $0
+ Exch 3
+ Push $1
+ Exch 3
+ Exch $2
+ Exch 2
+ Exch $3
+ Exch
+ Exch $4
+ Push $5
+
+ ; bcdstore=$2, filename=$3, services=$4
+
+ StrCpy $5 "OpenStore"
+ !insertmacro ${BOOTCFG_PREFIX}AllocStringVariant_Call "${UN}" $3 $3
+
+ ${If} $3 != 0
+ !insertmacro ${BOOTCFG_PREFIX}CallMethod_Call "${UN}" \
+ $4 $2 $2 $5 "File" $3 $1 $0
+ !insertmacro ${BOOTCFG_PREFIX}FreeStringVariant_Call "${UN}" $3
+ ${If} $0 == 0
+ StrCpy $3 "Store"
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call "${UN}" \
+ $1 $3 $2 $0
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${If} $0 != 0
+ StrCpy $1 $2
+ ${Else}
+ ; Get BcdStore object from variant structure
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectOfVariant_Call "${UN}" \
+ $2 $1 $0
+ System::Free $2
+ ${If} $0 != 0
+ StrCpy $1 "Get $3 for method $5 returned $1"
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $1 "Failed to allocate variant for method $5"
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_OpenBcdStore
+
+!macro BOOTCFG_GetBcdObject UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" FreeStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" CallMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectPropertyValue
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectOfVariant
+; Open default Bcd store
+; Get BcdObject given id from BCD store
+; Parameters:
+; services - IWbemServices
+; baseobject - BcdStore base class object
+; bcdstore - BcdStore object
+; id - BcdObject identifier
+; Return values:
+; obj - BcdObject respectively an error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetBcdObject
+ ; Handle parameters and save registers
+ Push $0
+ Exch 4
+ Push $1
+ Exch 4
+ Exch $2
+ Exch 3
+ Exch $3
+ Exch 2
+ Exch $4
+ Exch
+ Exch $5
+ Push $6
+
+ ; baseobject=$2, bcdstore=$3, id=$4, services=$5
+
+ StrCpy $6 "OpenObject"
+ !insertmacro ${BOOTCFG_PREFIX}AllocStringVariant_Call "${UN}" $4 $4
+
+ ${If} $4 != 0
+ ; CallMethod(services, baseobject, object, method, param, value)
+ !insertmacro ${BOOTCFG_PREFIX}CallMethod_Call "${UN}" \
+ $5 $2 $3 $6 "Id" $4 $1 $0
+ !insertmacro ${BOOTCFG_PREFIX}FreeStringVariant_Call "${UN}" $4
+ ${If} $0 == 0
+ StrCpy $2 "Object"
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call "${UN}" \
+ $1 $2 $3 $0
+ ; Release outparams
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${If} $0 != 0
+ StrCpy $1 $3
+ ${Else}
+ ; Get BcdObject from variant structure
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectOfVariant_Call "${UN}" \
+ $3 $1 $0
+ System::Free $3
+ ${If} $0 != 0
+ StrCpy $1 "Get $2 for method $6 returned $1"
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $1 "Failed to allocate variant for method $6"
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetBcdObject
+
+!macro BOOTCFG_GetBcdElement UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocI4Variant
+!insertmacro BOOTCFG_FUNCINC "${UN}" CallMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectPropertyValue
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectOfVariant
+; Get element from BCDObject of given element type
+; Parameters:
+; services - IWbemServices object
+; baseobject - BcdObject base class object
+; bcdobject - BcdObject
+; elemtype - element type
+; Return values:
+; element - element object respectively an error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetBcdElement
+ Push $0
+ Exch 4
+ Push $1
+ Exch 4
+ Exch $2
+ Exch 3
+ Exch $3
+ Exch 2
+ Exch $4
+ Exch
+ Exch $5
+ Push $6
+
+ ; baseobject=$2, bcdobject=$3, elemtype=$4, services=$5
+
+ StrCpy $6 "GetElement"
+ !insertmacro ${BOOTCFG_PREFIX}AllocI4Variant_Call "${UN}" $4 $4
+
+ ${If} $4 != 0
+ !insertmacro ${BOOTCFG_PREFIX}CallMethod_Call "${UN}" \
+ $5 $2 $3 $6 "Type" $4 $1 $0
+ System::Free $4
+ ${If} $0 == 0
+ StrCpy $2 "Element"
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call "${UN}" \
+ $1 $2 $3 $0
+ ; Release outparams
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${If} $0 != 0
+ StrCpy $1 $3
+ ${Else}
+ ; Get BcdObject from variant structure
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectOfVariant_Call "${UN}" \
+ $3 $1 $0
+ System::Free $3
+ ${If} $0 != 0
+ StrCpy $1 "Get $2 for method $6 returned $1"
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $1 "Failed to allocate variant for method $6"
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetBcdElement
+
+!macro BOOTCFG_GetElementFromBcd UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetBcdObject
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetBcdElement
+; Get provided element type of BcdObject of given id from BCD store
+; Parameters:
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; bcdstore - BcdStore object
+; basebcdobject - BcdObject base class object
+; id - BcdObject identifier
+; elemtype - element type
+; Return values:
+; object - BcdObject
+; element - element object respectively an error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetElementFromBcd
+ Push $0
+ Exch 6
+ Push $1
+ Exch 6
+ Push $2
+ Exch 6
+ Exch $3
+ Exch 5
+ Exch $4
+ Exch 4
+ Exch $5
+ Exch 3
+ Exch $6
+ Exch 2
+ Exch $7
+ Exch
+ Exch $8
+
+ ; bcdstore=$3, basebcdobject=$4, id=$5, elemtyp=$6, services=$7,
+ ; basebcdstore=$8
+
+ !insertmacro ${BOOTCFG_PREFIX}GetBcdObject_Call "${UN}" \
+ $7 $8 $3 $5 $2 $0
+ ${If} $0 != 0
+ StrCpy $1 $2
+ StrCpy $2 ""
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}GetBcdElement_Call "${UN}" \
+ $7 $4 $2 $6 $1 $0
+ ${If} $0 != 0
+ ; Release bcdobject
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $2
+ StrCpy $2 ""
+ ${EndIf}
+ ${EndIf}
+
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Exch $2
+ Exch 2
+ Exch
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetElementFromBcd
+
+!macro BOOTCFG_GetSystemPartition UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" ExecMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectPropertyValue
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetStringOfVariant
+; Get system partition
+; Parameters:
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; Return values:
+; partition - path of partition
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetSystemPartition
+ Push $0
+ Exch 2
+ Push $1
+ Exch 2
+ Exch $2
+ Exch
+ Exch $3
+ Push $4
+ Push $5
+
+ ; basebcdstore=$2, services=$3
+ StrCpy $5 "GetSystemPartition"
+ !insertmacro ${BOOTCFG_PREFIX}GetMethod_Call "${UN}" $2 $5 $4 $0
+ ; instance=$4
+ ${If} $0 != 0
+ StrCpy $1 $4
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}ExecMethod_Call "${UN}" $3 $2 $4 $5 $1 $0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $4
+ ${If} $0 == 0
+ StrCpy $5 "Partition"
+ StrCpy $4 $1
+ ; result=$4
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call "${UN}" \
+ $4 $5 $1 $0
+ ; Release result
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $4
+ ${If} $0 == 0
+ StrCpy $4 $1
+ ; variant=$4
+ !insertmacro ${BOOTCFG_PREFIX}GetStringOfVariant_Call "${UN}" \
+ $4 $1 $0
+ ; Free variant
+ System::Free $4
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOOTCFG_GetSystemPartition
+
+!macro BOOTCFG_ObjectListGetSafeArray UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetStringArrayOfVariant
+; Get safe array from object list
+; Parameters:
+; objectlist - object list
+; Return value:
+; safearray - safe array respectively an error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" ObjectListGetSafeArray
+ Push $0
+ Exch
+ Push $1
+ Exch
+ Exch $2
+ Push $3
+ Push $4
+
+ ; objectlist=$2
+
+ ; Initialize return value
+ StrCpy $0 0
+ StrCpy $4 "Ids"
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call "${UN}" \
+ $2 $4 $3 $0
+ ${If} $0 != 0
+ StrCpy $1 $3
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}GetStringArrayOfVariant_Call "${UN}" \
+ $3 $1 $0
+ System::Free $3
+ ${If} $0 != 0
+ StrCpy $1 "Get $4 returned $1"
+ ${EndIf}
+ ${EndIf}
+
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_ObjectListGetSafeArray
+
+!macro BOOTCFG_GetSizeOfSafeArray UN
+; Get size of safe array
+; Parameter:
+; safearray - reference to SAFEARRAY
+; Return value:
+; size of safe array
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetSizeOfSafeArray
+ Push $0
+ Exch
+ Exch $1
+ Push $2
+ Push $3
+ Push $4
+
+ ; safearray=$1
+
+ System::Call "oleaut32::SafeArrayGetDim(p r1) i.r2"
+ System::Call "oleaut32::SafeArrayGetUBound(p r1, i r2, *i 0 r3) i.r0"
+ ${If} $0 != 0
+ StrCpy $0 0
+ ${Else}
+ System::Call "oleaut32::SafeArrayGetLBound(p r1, i r2, *i 0 r4) i.r0"
+ ${If} $0 != 0
+ StrCpy $0 0
+ ${Else}
+ IntOp $0 $3 - $4
+ IntOp $0 $0 + 1
+ ${EndIf}
+ ${EndIf}
+
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetSizeOfSafeArray
+
+!macro BOOTCFG_GetElementDescription UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectPropertyValue
+; Get element description from BCDObject
+; Parameters:
+; element - element object
+; Return value:
+; description - description or "" if it could not be obtained
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetElementDescription
+ Push $0
+ Exch
+ Exch $1
+ Push $2
+
+ ; element=$1
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call "${UN}" \
+ $1 "String" $2 $0
+ ${If} $0 != 0
+ StrCpy $0 ""
+ ${Else}
+ System::Call "*$2(&i2 .r1)"
+ IntOp $1 $1 - ${VT_BSTR}
+ ${If} $1 != 0
+ StrCpy $0 ""
+ ${Else}
+ System::Call "*$2(&i2, &i2, &i2, &i2, w .r0)"
+ ${EndIf}
+ System::Free $2
+ ${EndIf}
+
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_GetElementDescription
+
+!macro BOOTCFG_GetBcdObjectDescription UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetElementFromBcd
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetElementDescription
+; Get description of BcdObject of given id from BCD store
+; Parameters:
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; bcdstore - BcdStore object
+; basebcdobject - BcdObject base class object
+; id - BcdObject identifier
+; Return value:
+; description
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" GetBcdObjectDescription
+ ; Handle parameters and save registers
+ Push $0
+ Exch 5
+ Exch $1
+ Exch 4
+ Exch $2
+ Exch 3
+ Exch $3
+ Exch 2
+ Exch $4
+ Exch
+ Exch $5
+
+ ; services=$1, basebcdstore=$2, bcdstore=$3, basebcdobject=$4, id=$5
+
+ ; GetElementFromBcd(services, basebcdstore, bcdstore,
+ ; basebcdobject, id, elemtype)
+ !insertmacro ${BOOTCFG_PREFIX}GetElementFromBcd_Call "${UN}" \
+ $1 $2 $3 $4 $5 ${BOOTCFG_BCDE_DESCRIPTION} $2 $1 $0
+
+ ${If} $0 != 0
+ StrCpy $0 ""
+ ${Else}
+ ; Release bcdobject
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $2
+ ; GetElementDescription(element)
+ !insertmacro ${BOOTCFG_PREFIX}GetElementDescription_Call "${UN}" $1 $0
+ ; Release element
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${EndIf}
+
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; GetBcdObjectDescription
+
+!macro BOOTCFG_EnumerateBcdObjectList UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" ObjectListGetSafeArray
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetBcdObjectDescription
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetSizeOfSafeArray
+; Enumerate BcdObject list
+; Parameters:
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; bcdstore - BcdStore object
+; basebcdobject - BcdObject base class object
+; objectlist - object list
+; Return value:
+; error message
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" EnumerateBcdObjectList
+ Push $0
+ Exch 5
+ Exch $1
+ Exch 4
+ Exch $2
+ Exch 3
+ Exch $3
+ Exch 2
+ Exch $4
+ Exch
+ Exch $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+
+ ; services=$1, basebcdstore=$2, bcdstore=$3, basebcdobject=$4,
+ ; objectlist=$5
+
+ !insertmacro ${BOOTCFG_PREFIX}ObjectListGetSafeArray_Call "${UN}" \
+ $5 $7 $0
+ ${If} $0 == 0
+ ; Enumerate safe array
+ !insertmacro ${BOOTCFG_PREFIX}GetSizeOfSafeArray_Call "${UN}" \
+ $7 $6
+ System::Call "oleaut32::SafeArrayAccessData(p r7, *p 0 r8) i.r0"
+ ${If} $0 != 0
+ StrCpy $0 "SafeArrayAccessData failed"
+ ${Else}
+ ${For} $0 1 $6
+ System::Call "*$8(w .r5)"
+ !insertmacro ${BOOTCFG_PREFIX}GetBcdObjectDescription_Call \
+ "${UN}" $1 $2 $3 $4 $5 $9
+!ifndef BOOTCFG_ENUMERATION_CALLBACK
+ DetailPrint "$5 [$9]"
+!else
+ Push $9
+ Push $5
+ Call ${BOOTCFG_ENUMERATION_CALLBACK}
+!endif
+ IntOp $8 $8 + ${NSIS_PTR_SIZE}
+ ${Next}
+ System::Call "oleaut32::SafeArrayUnaccessData(p r7) i.r0"
+ ${If} $0 != 0
+ StrCpy $0 "SafeArrayUnaccessData failed"
+ ${Else}
+ StrCpy $0 ""
+ ${EndIF}
+ ${EndIf}
+ ${EndIf}
+
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_EnumerateBcdObjectList
+
+!macro BOOTCFG_CreateGUID UN
+; Create a globally unique identifier (guid)
+; Return value:
+; guid
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" CreateGUID
+ Push $0
+ Push $1
+ Push $2
+ Push $3
+
+ ; Initialize return value
+ StrCpy $0 ""
+ System::Call "*(g) p.r2"
+ ${If} $2 != 0
+ System::Call "rpcrt4::UuidCreate(p r2) i.r1"
+ ${If} $1 == 0
+ System::Call "rpcrt4::UuidToString(p r2, *t.r3) i.r1"
+ ${If} $1 == 0
+ StrCpy $0 "{$3}"
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_CreateGUID
+
+!macro BOOTCFG_CreateObject UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" PrepareMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocI4Variant
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" Put
+!insertmacro BOOTCFG_FUNCINC "${UN}" FreeStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" ExecMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectPropertyValue
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObjectOfVariant
+; Create BCD object
+; Parameter
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; bcdstore - BcdStore object
+; type - application type of BCD object
+; guid - GUID of boot entry
+; Return values:
+; obj - BCD object or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" CreateObject
+ Push $0
+ Exch 5
+ Push $1
+ Exch 5
+ Exch $2
+ Exch 4
+ Exch $3
+ Exch 3
+ Exch $4
+ Exch 2
+ Exch $5
+ Exch
+ Exch $6
+ Push $7
+ Push $8
+
+ ; basebcdstore=$2, bcdstore=$3, type=$4, guid=$5, services=$6
+ StrCpy $7 "CreateObject"
+ !insertmacro ${BOOTCFG_PREFIX}PrepareMethod_Call "${UN}" $2 $7 $1 $0
+ ; instance=$1
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocI4Variant_Call "${UN}" $4 $8
+ ${If} $8 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" $1 "Type" $8 $0
+ ; Free variant
+ System::Free $8
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocStringVariant_Call "${UN}" $5 $8
+ ${If} $8 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" $1 "Id" $8 $0
+ !insertmacro ${BOOTCFG_PREFIX}FreeStringVariant_Call "${UN}" $8
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${If} $0 != 0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${If} $0 != ${ERROR_NOT_ENOUGH_MEMORY}
+ StrCpy $1 "Failed to allocate memory for method $7"
+ ${Else}
+ StrCpy $1 "Put failed for method $7"
+ ${EndIf}
+ ${Else}
+ StrCpy $4 $1
+ ; instance=$4
+ !insertmacro ${BOOTCFG_PREFIX}ExecMethod_Call "${UN}" \
+ $6 $3 $4 $7 $1 $0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $4
+ ${If} $0 == 0
+ StrCpy $7 "Object"
+ StrCpy $4 $1
+ ; result=$4
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectPropertyValue_Call "${UN}" \
+ $4 $7 $1 $0
+ ; Release result
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $4
+ ${If} $0 == 0
+ StrCpy $4 $1
+ ; variant=$4
+ ; Get BCD object from variant structure
+ !insertmacro ${BOOTCFG_PREFIX}GetObjectOfVariant_Call "${UN}" \
+ $4 $1 $0
+ ; Free variant
+ System::Free $4
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_CreateObject
+
+!macro BOOTCFG_DeleteObject UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" PrepareMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" Put
+!insertmacro BOOTCFG_FUNCINC "${UN}" FreeStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" ExecMethod
+; Delete BCD object
+; Parameter
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; bcdstore - BcdStore object
+; guid - GUID of boot entry
+; Return values:
+; result - result object or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" DeleteObject
+ Push $0
+ Exch 4
+ Push $1
+ Exch 4
+ Exch $2
+ Exch 3
+ Exch $3
+ Exch 2
+ Exch $4
+ Exch
+ Exch $5
+ Push $6
+ Push $7
+
+ ; basebcdstore=$2, bcdstore=$3, guid=$4, services=$5
+ StrCpy $6 "DeleteObject"
+ !insertmacro ${BOOTCFG_PREFIX}PrepareMethod_Call "${UN}" $2 $6 $1 $0
+ ; instance=$1
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocStringVariant_Call "${UN}" $4 $7
+ ${If} $7 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" $1 "Id" $7 $0
+ !insertmacro ${BOOTCFG_PREFIX}FreeStringVariant_Call "${UN}" $7
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${If} $0 != 0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${If} $0 != ${ERROR_NOT_ENOUGH_MEMORY}
+ StrCpy $1 "Failed to allocate memory for method $6"
+ ${Else}
+ StrCpy $1 "Put failed for method $6"
+ ${EndIf}
+ ${Else}
+ StrCpy $4 $1
+ ; instance=$4
+ !insertmacro ${BOOTCFG_PREFIX}ExecMethod_Call "${UN}" \
+ $5 $3 $4 $6 $1 $0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $4
+ ${EndIf}
+ ${EndIf}
+
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_DeleteObject
+
+!macro BOOTCFG_SetStringElement UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" PrepareMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocI4Variant
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" Put
+!insertmacro BOOTCFG_FUNCINC "${UN}" FreeStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" ExecMethod
+; Set string element
+; Parameter
+; services - IWbemServices object
+; basebcdobject - BcdObject base class
+; bcdobject - BcdObject
+; type - element type
+; string
+; Return values:
+; result - result object or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" SetStringElement
+ Push $0
+ Exch 5
+ Push $1
+ Exch 5
+ Exch $2
+ Exch 4
+ Exch $3
+ Exch 3
+ Exch $4
+ Exch 2
+ Exch $5
+ Exch
+ Exch $6
+ Push $7
+ Push $8
+
+ ; basebcdobject=$2, bcdobject=$3, type=$4, string=$5, services=$6
+ StrCpy $7 "SetStringElement"
+ !insertmacro ${BOOTCFG_PREFIX}PrepareMethod_Call "${UN}" $2 $7 $1 $0
+ ; instance=$1
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocI4Variant_Call "${UN}" $4 $8
+ ${If} $8 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" $1 "Type" $8 $0
+ ; Free variant
+ System::Free $8
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocStringVariant_Call "${UN}" $5 $8
+ ${If} $8 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" $1 "String" $8 $0
+ !insertmacro ${BOOTCFG_PREFIX}FreeStringVariant_Call "${UN}" $8
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${If} $0 != 0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${If} $0 != ${ERROR_NOT_ENOUGH_MEMORY}
+ StrCpy $1 "Failed to allocate memory for $7"
+ ${Else}
+ StrCpy $1 "Put failed for method $7"
+ ${EndIf}
+ ${Else}
+ StrCpy $4 $1
+ ; instance=$4
+ !insertmacro ${BOOTCFG_PREFIX}ExecMethod_Call "${UN}" \
+ $6 $3 $4 $7 $1 $0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $4
+ ${EndIf}
+ ${EndIf}
+
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_SetStringElement
+
+!macro BOOTCFG_SetPartition UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" PrepareMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocI4Variant
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" Put
+!insertmacro BOOTCFG_FUNCINC "${UN}" FreeStringVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" ExecMethod
+; Set partition
+; Parameter
+; services - IWbemServices object
+; basebcdobject - BcdObject base class
+; bcdobject - BcdObject
+; partition - partition identifier
+; Return values:
+; result - result object or error message
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" SetPartition
+ Push $0
+ Exch 4
+ Push $1
+ Exch 4
+ Exch $2
+ Exch 3
+ Exch $3
+ Exch 2
+ Exch $4
+ Exch
+ Exch $5
+ Push $6
+ Push $7
+
+ ; basebcdobject=$2, bcdobject=$3, partition=$4, services=$5
+ StrCpy $6 "SetPartitionDeviceElement"
+ !insertmacro ${BOOTCFG_PREFIX}PrepareMethod_Call "${UN}" $2 $6 $1 $0
+ ; instance=$1
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocI4Variant_Call "${UN}" \
+ ${BOOTCFG_BCDE_DEVICE} $7
+ ${If} $7 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" $1 "Type" $7 $0
+ ; Free variant
+ System::Free $7
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocI4Variant_Call "${UN}" \
+ ${BOOTCFG_PARTIONDEVICE_TYPE} $7
+ ${If} $7 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" \
+ $1 "DeviceType" $7 $0
+ ; Free variant
+ System::Free $7
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocStringVariant_Call "${UN}" \
+ $4 $7
+ ${If} $7 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" \
+ $1 "Path" $7 $0
+ !insertmacro ${BOOTCFG_PREFIX}FreeStringVariant_Call \
+ "${UN}" $7
+ ${If} $0 == 0
+ !insertmacro ${BOOTCFG_PREFIX}AllocStringVariant_Call \
+ "${UN}" "" $7
+ ${If} $7 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" \
+ $1 "AdditionalOptions" $7 $0
+ !insertmacro ${BOOTCFG_PREFIX}FreeStringVariant_Call \
+ "${UN}" $7
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${If} $0 != 0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $1
+ ${If} $0 != ${ERROR_NOT_ENOUGH_MEMORY}
+ StrCpy $1 "Failed to allocate memory for $6"
+ ${Else}
+ StrCpy $1 "Put failed for method $6"
+ ${EndIf}
+ ${Else}
+ StrCpy $4 $1
+ ; instance=$4
+ !insertmacro ${BOOTCFG_PREFIX}ExecMethod_Call "${UN}" \
+ $5 $3 $4 $6 $1 $0
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $4
+ ${EndIf}
+ ${EndIf}
+
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_SetPartition
+
+!macro BOOTCFG_SetObjectList UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" PrepareMethod
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocI4Variant
+!insertmacro BOOTCFG_FUNCINC "${UN}" AllocStringArrayVariant
+!insertmacro BOOTCFG_FUNCINC "${UN}" Put
+!insertmacro BOOTCFG_FUNCINC "${UN}" ExecMethod
+; Set object list
+; Parameters:
+; services - IWbemServices object
+; basebcdobject - BcdObject base class object
+; bcdobject - BcdObject
+; type - type of object list
+; objectlist - object list
+; Return values:
+; result object
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" SetObjectList
+ ; Handle parameters and save registers
+ Push $0
+ Exch 5
+ Push $1
+ Exch 5
+ Exch $2
+ Exch 4
+ Exch $3
+ Exch 3
+ Exch $4
+ Exch 2
+ Exch $5
+ Exch
+ Exch $6
+ Push $7
+ Push $8
+
+ ; basebcdobject=$2, bcdobject=$3, type=$4, objectlist=$5, services=$6
+
+ StrCpy $7 "SetObjectListElement"
+ !insertmacro ${BOOTCFG_PREFIX}PrepareMethod_Call "${UN}" \
+ $2 $7 $8 $0
+ ; instance=$8
+ ${If} $0 != 0
+ StrCpy $1 $8
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}AllocI4Variant_Call "${UN}" \
+ $4 $4
+ ${If} $4 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" \
+ $8 "Type" $4 $0
+ System::Free $4
+ ${If} $0 == 0
+ ; Allocate array variant and fill it with safe array
+ !insertmacro ${BOOTCFG_PREFIX}AllocStringArrayVariant_Call \
+ "${UN}" $5 $4
+ ${If} $4 != 0
+ !insertmacro ${BOOTCFG_PREFIX}Put_Call "${UN}" \
+ $8 "Ids" $4 $0
+ System::Free $4
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${If} $0 != 0
+ StrCpy $1 "Put failed for $7"
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}ExecMethod_Call "${UN}" \
+ $6 $3 $8 $7 $1 $0
+ ${EndIf}
+ ; Release instance
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $8
+ ${EndIf}
+
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_SetObjectList
+
+!macro BOOTCFG_AppendBootEntry UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetElementFromBcd
+!insertmacro BOOTCFG_FUNCINC "${UN}" ObjectListGetSafeArray
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetSizeOfSafeArray
+!insertmacro BOOTCFG_FUNCINC "${UN}" SetObjectList
+; Append boot entry to boot manager
+; Parameter:
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; bcdstore - BcdStore object
+; basebcdobject - BcdObject base class object
+; guid - GUID of boot entry
+; Return values:
+; result object
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" AppendBootEntry
+ Push $0
+ Exch 5
+ Push $1
+ Exch 5
+ Exch $2
+ Exch 4
+ Exch $3
+ Exch 3
+ Exch $4
+ Exch 2
+ Exch $5
+ Exch
+ Exch $6
+ Push $7
+ Push $8
+
+ ; basebcdstore=$2, bcdstore=$3, basebcdobject=$4, guid=$5, services=$6
+ !insertmacro ${BOOTCFG_PREFIX}GetElementFromBcd_Call "${UN}" \
+ $6 $2 $3 $4 ${BOOTCFG_BOOTMGR_GUID} ${BOOTCFG_DISPLAY_ORDER} $2 $8 $0
+ ; element=$8, bcdobject=$2
+ ${If} $0 != 0
+ StrCpy $1 $8
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}ObjectListGetSafeArray_Call "${UN}" \
+ $8 $7 $0
+ ; Release object list element
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $8
+ ${If} $0 != 0
+ System::Call "oleaut32::SafeArrayCreateVector(i ${VT_BSTR}, \
+ i 0, i 1) p.r7"
+ StrCpy $1 0
+ StrCpy $0 0
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}GetSizeOfSafeArray_Call "${UN}" \
+ $7 $1
+ Push $1
+ IntOp $1 $1 + 1
+ System::Call "*(i $1, i 0) p.r8"
+ Pop $1
+ ${If} $8 != 0
+ System::Call "oleaut32::SafeArrayRedim(p r7r7, p r8) i.r0"
+ ${If} $0 != 0
+ StrCpy $1 "SafeArrayReDim failed"
+ ${EndIf}
+ System::Free $8
+ ${Else}
+ StrCpy $1 "Memory allocation failed for SafeArrayRedim"
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${If} $7 != 0
+ ; Allocate BSTR variant and fill it with GUID
+ System::Call "oleaut32::SysAllocString(w r5) p.s"
+ Pop $5
+ ${If} $5 != 0
+ System::Call "oleaut32::SafeArrayPutElement(p r7, *i r1, p r5) i.r0"
+ System::Call "oleaut32::SysFreeString(p r5)"
+ ${If} $0 != 0
+ StrCpy $1 "SafeArrayPutElement failed"
+ System::Call "oleaut32::SafeArrayDestroy(p r7) i.r5"
+ ${EndIf}
+ ${Else}
+ StrCpy $1 "SysAllocString failed"
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $0 == 0
+ ; objectlist=$7
+ !insertmacro ${BOOTCFG_PREFIX}SetObjectList_Call "${UN}" \
+ $6 $4 $2 ${BOOTCFG_DISPLAY_ORDER} $7 $1 $0
+ System::Call "oleaut32::SafeArrayDestroy(p r7) i.r5"
+ ${EndIf}
+
+ ; Release bcdobject
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $2
+
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_AppendBootEntry
+
+!macro BOOTCFG_RemoveBootEntry UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetElementFromBcd
+!insertmacro BOOTCFG_FUNCINC "${UN}" ObjectListGetSafeArray
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetSizeOfSafeArray
+!insertmacro BOOTCFG_FUNCINC "${UN}" SetObjectList
+; Remove boot entry from boot manager
+; Parameter:
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; bcdstore - BcdStore object
+; basebcdobject - BcdObject base class object
+; guid - GUID of boot entry
+; Return values:
+; result object
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" RemoveBootEntry
+ Push $0
+ Exch 5
+ Push $1
+ Exch 5
+ Exch $2
+ Exch 4
+ Exch $3
+ Exch 3
+ Exch $4
+ Exch 2
+ Exch $5
+ Exch
+ Exch $6
+ Push $7
+ Push $8
+ Push $9
+
+ ; basebcdstore=$2, bcdstore=$3, basebcdobject=$4, guid=$5, services=$6
+ !insertmacro ${BOOTCFG_PREFIX}GetElementFromBcd_Call "${UN}" \
+ $6 $2 $3 $4 ${BOOTCFG_BOOTMGR_GUID} ${BOOTCFG_DISPLAY_ORDER} $2 $8 $0
+ ; element=$8, bcdobject=$2
+ ${If} $0 != 0
+ StrCpy $1 $8
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}ObjectListGetSafeArray_Call "${UN}" \
+ $8 $7 $0
+ ; Release object list element
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $8
+ ${If} $0 != 0
+ System::Call "oleaut32::SafeArrayCreateVector(i ${VT_BSTR}, \
+ i 0, i 1) p.r7"
+ StrCpy $1 0
+ StrCpy $0 0
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}GetSizeOfSafeArray_Call "${UN}" \
+ $7 $1
+ System::Call "oleaut32::SafeArrayAccessData(p r7, *p 0 r8) i.r0"
+ ${If} $0 != 0
+ StrCpy $1 "SafeArrayAccessData failed"
+ ${Else}
+ ${If} $1 > 0
+ IntOp $1 $1 - 1
+ ${For} $0 0 $1
+ System::Call "*$8(w .r9)"
+ ${If} $9 == $5
+ IntOp $0 $0 + 1
+ ${Break}
+ ${EndIf}
+ IntOp $8 $8 + ${NSIS_PTR_SIZE}
+ ${Next}
+ ${For} $0 $0 $1
+ IntOp $9 $8 + ${NSIS_PTR_SIZE}
+ System::Call "*$9(p .s)"
+ Exch $9
+ System::Call "*$8(p r9)"
+ Pop $8
+ ${Next}
+ System::Call "oleaut32::SafeArrayUnaccessData(p r7) i.r0"
+ ${If} $0 != 0
+ StrCpy $0 "SafeArrayUnaccessData failed"
+ ${Else}
+ StrCpy $0 ""
+ ${EndIF}
+ ${EndIf}
+ System::Call "*(i $1, i 0) p.r8"
+ ${If} $8 != 0
+ System::Call "oleaut32::SafeArrayRedim(p r7r7, p r8) i.r0"
+ ${If} $0 != 0
+ StrCpy $1 "SafeArrayReDim failed"
+ ${EndIf}
+ System::Free $8
+ !insertmacro ${BOOTCFG_PREFIX}GetSizeOfSafeArray_Call "${UN}" \
+ $7 $1
+ ${Else}
+ StrCpy $1 "Memory allocation failed for SafeArrayRedim"
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $0 == 0
+ ; objectlist=$7
+ !insertmacro ${BOOTCFG_PREFIX}SetObjectList_Call "${UN}" \
+ $6 $4 $2 ${BOOTCFG_DISPLAY_ORDER} $7 $1 $0
+ System::Call "oleaut32::SafeArrayDestroy(p r7) i.r5"
+ ${EndIf}
+
+ ; Release bcdobject
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $2
+
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_RemoveBootEntry
+
+!macro BOOTCFG_SetActiveBootEntry UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetBcdObject
+!insertmacro BOOTCFG_FUNCINC "${UN}" SetObjectList
+; Set active boot entry
+; Parameter:
+; services - IWbemServices object
+; basebcdstore - BcdStore base class object
+; bcdstore - BcdStore object
+; basebcdobject - BcdObject base class object
+; guid - GUID of boot entry
+; Return values:
+; result object
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" SetActiveBootEntry
+ Push $0
+ Exch 5
+ Push $1
+ Exch 5
+ Exch $2
+ Exch 4
+ Exch $3
+ Exch 3
+ Exch $4
+ Exch 2
+ Exch $5
+ Exch
+ Exch $6
+ Push $7
+ Push $8
+
+ ; basebcdstore=$2, bcdstore=$3, basebcdobject=$4, guid=$5, services=$6
+
+ System::Call "oleaut32::SafeArrayCreateVector(i ${VT_BSTR}, i 0, i 1) \
+ p.r7"
+ ${If} $7 != 0
+ ; Allocate BSTR variant and fill it with GUID
+ System::Call "oleaut32::SysAllocString(w r5) p.r8"
+ ${If} $8 != 0
+ StrCpy $1 0
+ System::Call "oleaut32::SafeArrayPutElement(p r7, *i r1, p r8) i.r0"
+ System::Call "oleaut32::SysFreeString(p r8)"
+ ${If} $0 != 0
+ StrCpy $1 "SafeArrayPutElement failed"
+ System::Call "oleaut32::SafeArrayDestroy(p r7) i.r8"
+ StrCpy $7 0
+ ${EndIf}
+ ${Else}
+ StrCpy $1 "SysAllocString failed"
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $7 != 0
+ !insertmacro ${BOOTCFG_PREFIX}GetBcdObject_Call "${UN}" \
+ $6 $2 $3 ${BOOTCFG_BOOTMGR_GUID} $2 $0
+ ; bcdobject=$2
+ ${If} $0 != 0
+ StrCpy $1 $2
+ ${Else}
+ ; bootorderlist=$7
+ !insertmacro ${BOOTCFG_PREFIX}SetObjectList_Call "${UN}" \
+ $6 $4 $2 ${BOOTCFG_BOOTSEQUENCE} $7 $1 $0
+ System::Call "oleaut32::SafeArrayDestroy(p r7) i.r5"
+ ; Release bcdobject
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $2
+ ${EndIf}
+ System::Call "oleaut32::SafeArrayDestroy(p r7) i.r4"
+ ${EndIf}
+
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_SetActiveBootEntry
+
+!macro BOOTCFG_ConnectWMI UN
+; Acquire backup and restore privileges
+; Return value:
+; If the function succeeds, the return value is zero.
+; Otherwise return value represents an error code.
+Function `${UN}${BOOTCFG_PREFIX}AcquirePrivileges`
+ Push $0
+ Push $1
+ Push $2
+
+ System::Call "kernel32::GetCurrentProcess() p .r0"
+ System::Call "advapi32::OpenProcessToken(p r0, \
+ i ${TOKEN_QUERY}|${TOKEN_ADJUST_PRIVILEGES}, *p 0 r1) i .r0"
+ ${If} $0 != 0
+ System::Call "*(i 2, \
+ l ${wbemPrivilegeBackup}, i ${SE_PRIVILEGE_ENABLED}, \
+ l ${wbemPrivilegeRestore}, i ${SE_PRIVILEGE_ENABLED}, \
+ ) p .r2"
+ ${If} $2 != 0
+ System::Call "advapi32::AdjustTokenPrivileges(p r1, i 0, \
+ p r2, i 0, i 0, i 0) i.r0"
+ ${If} $0 != 0
+ StrCpy $0 0
+ ${Else}
+ System::Call "kernel32::GetLastError() i.r0"
+ ${EndIf}
+ System::Free $2
+ ${Else}
+ StrCpy $0 ${ERROR_NOT_ENOUGH_MEMORY}
+ ${EndIf}
+ System::Call "kernel32::CloseHandle(p r1)"
+ ${EndIf}
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+
+; Connect to the root/wmi namespace
+; Return values:
+; locator - IWbemLocator object
+; services - IWbemServices object respectively an error mesage
+; err - error code
+!insertmacro BOOTCFG_FUNCPROLOG "${UN}" ConnectWMI
+ Push $0
+ Push $1
+ Push $2
+ Push $3
+
+ ; Initialization of COM is done via OleInitialize in NSIS installer code
+ ; Set general COM security level
+ System::Call "ole32::CoInitializeSecurity( \
+ p 0, i -1, p 0, p 0, i ${RPC_C_AUTHN_LEVEL_DEFAULT}, \
+ i ${RPC_C_IMP_LEVEL_IMPERSONATE}, p 0, i ${EOAC_NONE}, p 0) i.r0"
+ ${If} $0 != 0
+ StrCpy $1 "CoInitializeSecurity failed"
+ ${Else}
+ ; Acquire backup and restore privileges
+ Call `${UN}${BOOTCFG_PREFIX}AcquirePrivileges`
+ Pop $0
+ ${If} $0 != 0
+ StrCpy $1 "Failed to acquire required privileges"
+ ${Else}
+ ; Connect to root/WMI namespace
+ ; Create IWbemLocator interface
+ System::Call "ole32::CoCreateInstance( \
+ g '${CLSID_WbemLocator}', p 0, \
+ i ${CLSCTX_INPROC_SERVER}, \
+ g '${IID_IWbemLocator}', *p .r2) i.r0"
+ ; locator=$2
+ ${If} $0 != 0
+ StrCpy $1 "CoCreateInstance failed"
+ ${Else}
+ ; IWbemLocator::ConnectServer
+ ; locator->ConnectServer(objectpath, user, password, locale,
+ ; securityflags, authority, context, services)
+ System::Call "$2->3(w 'root/wmi', p 0, p 0, p 0, i 0, p 0, p 0, \
+ *p .r3) p.r0"
+ ; services=$3
+ ${If} $0 != 0
+ ; Release locator
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $2
+ StrCpy $3 ""
+ StrCpy $1 "ConnectServer failed"
+ ${Else}
+ StrCpy $1 $3
+ ${EndIF}
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ Pop $3
+ Exch $2
+ Exch 2
+ Exch
+ Exch $1
+ Exch
+ Exch $0
+FunctionEnd
+!macroend ; BOOTCFG_ConnectWMI
+
+!endif ; BOOTCFG_INCLUDED
diff --git a/l10n/po/sq.po b/l10n/po/sq.po
index 4d60d04..052f156 100644
--- a/l10n/po/sq.po
+++ b/l10n/po/sq.po
@@ -9,7 +9,7 @@ msgstr ""
"Report-Msgid-Bugs-To: win32-loader@packages.debian.org\n"
"POT-Creation-Date: 2014-09-25 17:30+0200\n"
"PO-Revision-Date: 2008-05-09 12:01+0100\n"
-"Last-Translator: Elian Myftiu <elian.myftiu@gmail.com>\n"
+"Last-Translator: Eva Vranici <evavranici@gmail.com>\n"
"Language-Team: Albanian <gnome-albanian-perkthyesit@lists.sourceforge.net>\n"
"Language: sq\n"
"MIME-Version: 1.0\n"
@@ -57,7 +57,7 @@ msgstr "Albanian"
#: win32-loader.sh:82
#, sh-format
msgid "$target_distro $kernel_name - Continue with install process"
-msgstr ""
+msgstr "$target_distro $kernel_name - vazhdo me proçesin e instalimit"
#. translate:
#. IMPORTANT: only the subset of UTF-8 that can be converted to NTLDR charset
@@ -65,7 +65,7 @@ msgstr ""
#. applies, limit yourself to ascii.
#: win32-loader.sh:88
msgid "PXE - Network boot"
-msgstr ""
+msgstr "PXE - Network boot"
#. translate:
#. The nlf file for your language should be found in
@@ -80,25 +80,23 @@ msgstr "Albanian.nlf"
#. Ampersands (&) are _forbidden_ in that string.
#.
#: win32-loader.c:75
-#, fuzzy
msgid "Debian-Installer loader"
-msgstr "Ngarkues Debian-Instaluesi"
+msgstr "Ngarkuesi Instalues-Debian"
#: win32-loader.c:76
msgid "Cannot find win32-loader.ini."
-msgstr "Nuk mund të gjej win32-loader.ini."
+msgstr "Nuk mund te gjendej win32-loader.ini."
#: win32-loader.c:77
msgid "win32-loader.ini is incomplete. Contact the provider of this medium."
-msgstr "win32-loader.ini është i paplotë. Kontakto furnizuesin e këtij mjeti."
+msgstr "win32-loader.ini është i paplotë. Kontakto ofruesin e këtij mediumi."
#: win32-loader.c:78
msgid ""
"This program has detected that your keyboard type is \"$0\". Is this "
"correct?"
-msgstr ""
-"Ky program zbuloi që lloji i tastierës tënde është \"$0\". A është kjo e "
-"saktë?"
+msgstr "Ky program ka gjetur që lloji i tastierës tuaj është \"$0\". "
+"Është e saktë kjo?"
#: win32-loader.c:79
msgid ""
@@ -111,38 +109,36 @@ msgid ""
"\n"
"Thank you."
msgstr ""
-"Të lutem dërgo një raport gabimi me të dhënat e mëposhtme:\n"
+"Ju lutem dërgo një report gabimesh me informacionin e mëposhtëm:\n"
"\n"
-" - Versionin e Windows-it.\n"
-" - Rregullimet e vendndodhjes.\n"
-" - Llojin e tastierës së vërtetë.\n"
-" - Llojin e tastierës së zbuluar.\n"
+" - Versioni i Windows.\n"
+" - Konfigurimet e vendit.\n"
+" - Lloji i tastierës reale.\n"
+" - Lloji i tastierës së gjetur.\n"
"\n"
"Faleminderit."
#: win32-loader.c:80
-#, fuzzy
msgid ""
"There doesn't seem to be enough free disk space in drive $c. For a complete "
"desktop install, it is recommended to have at least 3 GB. If there is "
"already a separate disk or partition for this install, or if you plan to "
"replace Windows completely, you can safely ignore this warning."
-msgstr ""
-"Nuk ngjan të ketë hapësirë të mjaftueshme në diskun $c. Për një instalim të "
-"plotë, këshillohet të ketë të paktën 3 GB. Nëse ekziston një disk apo "
-"ndarje e veçantë për të instaluar Debian, ose nëse planifikon të zëvendësosh "
-"Windows, mund ta injorosh pa problem këtë paralajmërim."
+msgstr "Duket sikur nuk ka mjaftushëm vend të lirë në pajisjen $c. "
+"Për një instalim të plotë desktopi është rekomanduar për të patur "
+"të paktën 3 GB. Në qoftë se është tashmë një disk apo ndarje e veçuar "
+"për këtë instalim, ose në qoftë se keni menduar ta zëvendosoni "
+"Windows plotësisht, mund ta injoroni këtë paralajmërim."
#: win32-loader.c:81
msgid "Error: not enough free disk space. Aborting install."
-msgstr "Gabim: hapësirë e pamjaftueshme disku. Duke lënë instalimin."
+msgstr "Gabim: nuk ka hapesirë të mjaftueshme të diskut. Aborto instalimin."
#: win32-loader.c:82
msgid "This program doesn't support Windows $windows_version yet."
-msgstr "Ky program ende nuk suporton Windows $windows_version."
+msgstr "Ky program nuk e suporton Windows $windows_version akoma."
#: win32-loader.c:83
-#, fuzzy
msgid ""
"The system version you're trying to install is designed to run on modern, 64-"
"bit computers. However, your computer is incapable of running 64-bit "
@@ -153,17 +149,16 @@ msgid ""
"\n"
"This installer will abort now."
msgstr ""
-"Versioni i Debian që po përpiqesh të instalosh është planifikuar të xhirojë "
-"në kompjuterat modernë 64-bit. Pra, kompjuteri yt është i paaftë të punojë "
-"me programe 64-bit.\n"
+"Versoni i sistemit që ju po përpiqeni të instaloni është dizenjuar për tu ekzekutuar "
+"ne kompjutera modernë, 64-bit. Megjithatë, kompjuteri juaj nuk është në gjendje të "
+"ekzekutojë programe 64-bit.\n"
"\n"
-"Përdor versionin 32-bit (\"i386\") të Debian-it, ose versionin Multi-arch i "
-"cili është i aftë të instalojë njërin prej tyre.\n"
+"Përdor versionin 32-bit (\"i386\"), ose versionin Multi-arch i cili është në gjendje "
+"të instalojë secilin nga ata.\n"
"\n"
-"Ky instalues do të përfundojë tani."
+"Ky instalues do të abortohet tani."
#: win32-loader.c:84
-#, fuzzy
msgid ""
"Your computer is capable of running modern, 64-bit operating systems. "
"However, the system version you're trying to install is designed to run on "
@@ -175,16 +170,15 @@ msgid ""
"of them.\n"
"\n"
"Would you like to abort now?"
-msgstr ""
-"Kompjuteri yt është i aftë të xhirojë sisteme operues modernë 64-bit. "
-"Megjithatë, versioni i Debian-it që po përpiqesh të instalosh është "
-"planifikuar të punojë në hardware të vjetër 32-bit.\n"
+msgstr "Kompjuteri juaj është në gjendje të ekzekutojë sisteme operative moderne, "
+"64-bit. Megjithatë, versioni i sistemit që ju po përpiqeni të instaloni "
+"është dizenjuar për tu ekzekutuar në hardware të vjetër, 32-bit.\n"
"\n"
-"Mund të vazhdosh me këtë instalim, por që të marrësh më të mirën nga "
-"kompjuteri yt, të këshillojmë të përdorësh versionin 64-bit (\"amd64\") të "
-"Debian-it, ose versionin Multi-arch që arrin të instalojë njërin prej tyre.\n"
+"Ju akoma mund të vazhdoni me këtë instalim por për të përfituar më së shumti "
+"nga kompjuteri juaj ne ju rekomandojmë të përdorni versionin 64-bit (\"amd64\") "
+"ose versionin Multi-arch i cili është në gjendje të instalojë secilin prej tyre.\n"
"\n"
-"Dëshiron ta lësh tani?"
+"Doni të abortoni tani?"
#. translate:
#. "system partition" and "boot partition" are defined by Microsoft to mean the opposite of what a
@@ -197,57 +191,55 @@ msgid ""
"Unable to find \"system partition\", assuming it is the same as the \"boot "
"partition\" ($c)."
msgstr ""
+"E pamundur për të gjetur \"system partition\", duke supozuar që është e njëjtë me "
+"\"boot partition\" ($c)."
#: win32-loader.c:93 win32-loader.c:104
msgid "Select install mode:"
-msgstr "Zgjidh mënyrën e instalimit:"
+msgstr "Zgjidh modulin e instalimit:"
#: win32-loader.c:94
msgid "Normal mode. Recommended for most users."
-msgstr "Mënyra normale. E këshillueshme për shumë përdorues."
+msgstr "Mënyrë normale. E rekomanduar për shumicën e përdoruesve."
#: win32-loader.c:95
msgid ""
"Expert mode. Recommended for expert users who want full control of the "
"install process."
-msgstr ""
-"Mënyra eksperte. E këshillueshme për përdorues ekspertë që duan kontroll të "
-"plotë të procesit të instalimit."
+msgstr "Modaliteti ekspert. I rekomanduar për përdorues ekspert që duan kontroll "
+"të plotë të proçesit të instalimit."
#: win32-loader.c:96
msgid "PXE mode: install a PXE loader to allow remote kernel loading."
-msgstr ""
+msgstr "Modaliteti PXE: instalo nje ngarkues PXE për të lejuar ngarkim në distanë të kernel."
#: win32-loader.c:97
msgid "Select action:"
msgstr "Zgjidh veprimin:"
#: win32-loader.c:98
-#, fuzzy
msgid "Begin install on this computer."
-msgstr "Instalo Debian GNU/Linux në këtë kompjuter."
+msgstr "Fillo instalimin në këtë kompjuter."
#: win32-loader.c:99
-#, fuzzy
msgid "Repair an installed system (rescue mode)."
-msgstr "Riparo një sistem Debian ekzistues (mënyrë shpëtimi)."
+msgstr "Riparo një sistem të instaluar (moduli i shpëtimit)."
#: win32-loader.c:100
-#, fuzzy
msgid "Select the kernel:"
-msgstr "Zgjidh veprimin:"
+msgstr "Zgjidh kernel:"
#: win32-loader.c:101
msgid "GNU/Linux"
-msgstr ""
+msgstr "GNU/Linux"
#: win32-loader.c:102
msgid "GNU/kFreeBSD"
-msgstr ""
+msgstr "GNU/kFreeBSD"
#: win32-loader.c:103
msgid "GNU/Hurd"
-msgstr ""
+msgstr "GNU/Hurd"
#: win32-loader.c:105
msgid "Graphical install"
@@ -255,24 +247,24 @@ msgstr "Instalim grafik"
#: win32-loader.c:106
msgid "Text install"
-msgstr "Instalim tekstual"
+msgstr "Instalim teksti"
#: win32-loader.c:107
#, c-format
msgid "Downloading %s"
-msgstr "Po shkarkoj %s"
+msgstr "Duke shkarkuar %s"
#: win32-loader.c:108
msgid "Connecting ..."
-msgstr "Duke u lidhur..."
+msgstr "Duke u lidhur ..."
#: win32-loader.c:109
msgid "second"
-msgstr "sekonda"
+msgstr "sekondë"
#: win32-loader.c:110
msgid "minute"
-msgstr "minuta"
+msgstr "minutë"
#: win32-loader.c:111
msgid "hour"
@@ -291,20 +283,20 @@ msgstr "s"
#: win32-loader.c:120
#, c-format
msgid "%dkB (%d%%) of %dkB at %d.%01dkB/s"
-msgstr "%dkB (%d%%) e %dkB me %d.%01dkB/s"
+msgstr "%dkB (%d%%) nga %dkB në %d.%01dkB/s"
#: win32-loader.c:121
#, c-format
msgid " (%d %s%s remaining)"
-msgstr " (mungojnë %d %s%s)"
+msgstr " (%d %s%s të mbetura)"
#: win32-loader.c:122
msgid "Select which version of Debian-Installer to use:"
-msgstr "Zgjidh cilin version të Instaluesit Debian të përdorësh:"
+msgstr "Zgjidh versionin të Instaluesit-Debian për të përdorur:"
#: win32-loader.c:123
msgid "Stable release. This will install Debian \"stable\"."
-msgstr "Botimi i qëndrueshëm. Ky do të instalojë Debian \"stable\"."
+msgstr "Lëshim i qëndrueshëm. Kjo do të instalojë Debian \"stable\"."
#: win32-loader.c:124
msgid ""
@@ -312,9 +304,9 @@ msgid ""
"install Debian \"testing\" by default, and may be capable of installing "
"\"stable\" or \"unstable\" as well."
msgstr ""
-"Botimi i përditshëm. Ky është versioni i zhvillimit së Debian-Instaluesit. "
-"Do të instalojë Debian \"testing\" si të parazgjedhur, dhe versionin \"stable"
-"\" ose \"unstable\" gjithashtu."
+"Ndërtim ditor. Ky është versioni zhvillues i Instaluesit-Debian. Ai do të instalojë "
+"Debian \"testing\" sipas parazgjedhjes, dhe mund të jetë në gjendje të instalojë "
+"\"stable\" ose \"unstable\" gjithashtu."
#. translate:
#. You might want to mention that so-called "known issues" page is only available in English.
@@ -324,29 +316,27 @@ msgid ""
"It is recommended that you check for known issues before using a daily "
"build. Would you like to do that now?"
msgstr ""
-"Këshillohet që të kontrollosh për probleme të njohura përpara se të "
-"përdorësh botimin e përditshëm. Dëshiron ta bësh tani këtë?"
+"Eshtë e rekomanduar të kontrolloni për probleme të njohura përpara një "
+"ndërtimi ditor. Doni ta bëni këtë tani?"
#: win32-loader.c:130
-#, fuzzy
msgid ""
"The following parameters will be used. Do NOT change any of these unless "
"you know what you're doing."
-msgstr ""
-"Ngarkuesi i Debian-Instaluesit do të rregullohet me parametrat e mëposhtëm. "
-"MOS ndrysho asnjë prej tyre në mos po dite atë që bën."
+msgstr "Parametrat e mëposhtëm do të përdoren. MOS ndrysho asnjë nga to në qoftë se "
+"nuk e dini se çfarë po bëni."
#: win32-loader.c:131
msgid "Proxy settings (host:port):"
-msgstr "Rregullimet Proxy (hosti:porta):"
+msgstr "Konfigurimet e Proxy (host:port):"
#: win32-loader.c:132
msgid "Location of boot.ini:"
-msgstr "Vendndodhja e boot.ini:"
+msgstr "Vendodhja e boot.ini:"
#: win32-loader.c:133
msgid "Base URL for netboot images (linux and initrd.gz):"
-msgstr "URL bazë për imazhet e netboot (linux dhe initrd.gz):"
+msgstr "URL bazë për imazhe netboot (linux and initrd.gz):"
#: win32-loader.c:134
msgid "Error"
@@ -354,21 +344,21 @@ msgstr "Gabim"
#: win32-loader.c:135
msgid "Error: failed to copy $0 to $1."
-msgstr "Gabim: dështova në kopjimin e $0 tek $1."
+msgstr "Gabim: dështoi për të kopjuar $0 tek $1"
#. translate:
#. $0 will be "Release" (it is a filename).
#.
#: win32-loader.c:140
msgid "Checking GPG signature on $0."
-msgstr ""
+msgstr "Duke kontrolluar nënshkrimin GPS në $0."
#. translate:
#. $0 will be "Release" (it is a filename).
#.
#: win32-loader.c:145
msgid "The downloaded $0 file cannot be trusted! Aborting."
-msgstr ""
+msgstr "Skedari $0 i shkarkuar nuk mund të besohet! Duke abortuar."
#. translate:
#. This appears in a MessageBox when the md5 checksum verification failed. $0 is a url; $2 is the filename $1 is the
@@ -376,54 +366,50 @@ msgstr ""
#.
#: win32-loader.c:151
msgid "Checksum mismatch for $0/$2. Got $1 when expecting $4. Aborting."
-msgstr ""
+msgstr "Mospërputhje checksum-i për $0/$2. U mor $1 kur pritej $4. Duke u abortuar."
#. translate:
#. $2 is a filename
#.
#: win32-loader.c:156
msgid "Computing checksum for $2"
-msgstr ""
+msgstr "Duke llogaritur checksum për $2"
#: win32-loader.c:157
msgid "Generating $0"
-msgstr "Po gjeneroj $0"
+msgstr "Duke gjeneruar $0"
#: win32-loader.c:158
msgid "Appending preseeding information to $0"
-msgstr "Po bashkangjis të dhënat e parashtruara tek $0"
+msgstr "Duke shtuar informacionin paraprak në $0"
#: win32-loader.c:159
msgid "Error: unable to run $0."
-msgstr "Gabim: e pamundur të xhirojë $0."
+msgstr "Gabim: e pamundur për të ekzekutuar $0."
#: win32-loader.c:160
msgid "Disabling NTFS compression in bootstrap files"
-msgstr "Duke çaktivizuar ngjeshjen NTFS në skedat bootstrap"
+msgstr "Duke çaktivizuar kompresionin NTFS në skedarët bootstrap"
#: win32-loader.c:161
-#, fuzzy
msgid "Registering in NTLDR"
-msgstr "Po regjistroj Debian-Instaluesin në NTLDR"
+msgstr "Duke regjistruar në NTLDR"
#: win32-loader.c:162
-#, fuzzy
msgid "Registering in BootMgr"
-msgstr "Po regjistroj Debian-Instaluesin në BootMgr"
+msgstr "Duke regjistruar në BootMgr"
#: win32-loader.c:163
msgid "Error: failed to parse bcdedit.exe output."
-msgstr "Gabim: dështova në analizimin e prodhimit të bcdedit.exe."
+msgstr "Gabim: nuk arriti të analizojë produktin bcdedit.exe"
#: win32-loader.c:164
-#, fuzzy
msgid "Error: $0 not found. Is this really Windows $windows_version?"
-msgstr ""
-"Gabim: boot.ini nuk u gjet. A është vërtet ky Windows $windows_version?"
+msgstr "Gabim: $0 nuk u gjet. A është kjo vërtet Windows $windows_version?"
#: win32-loader.c:165
msgid "VERY IMPORTANT NOTICE:\\n\\n"
-msgstr "VËREJTJE SHUMË E RËNDËSISHME:\\n\\n"
+msgstr "ÇDO SHËNIM TË RËNDËSISHËM:\\n\\n"
#. translate:
#. The following two strings are mutualy exclusive. win32-loader
@@ -432,30 +418,24 @@ msgstr "VËREJTJE SHUMË E RËNDËSISHME:\\n\\n"
#. current context (i.e. be careful when using pronouns, etc).
#.
#: win32-loader.c:173
-#, fuzzy
msgid ""
"The second stage of this install process will now be started. After your "
"confirmation, this program will restart Windows in DOS mode, and "
"automatically load the next part of the install process.\\n\\n"
-msgstr ""
-"Hapi i dytë i këtij procesi instalimi do të fillojë tani. Pas konfirmimit "
-"tënd, ky program do të rinisë Windows në DOS, dhe do të ngarkojë "
-"automatikisht Instaluesin Debian.\\n\\n"
+msgstr "Faza e dytë e këtij proçesi instalimi do të fillojë tani. "
+"Pas konfirmimit tuaj, ky program do të rifillojë Windows në DOS mode, "
+"dhe do të ngarkojë automatikisht pjesën tjetër të proçesit të instalimit.\\n\\n"
#: win32-loader.c:174
-#, fuzzy
msgid ""
"You need to reboot in order to proceed with the install process. During "
"your next boot, you will be asked whether you want to start Windows or "
"continue with the install process.\\n\\n"
-msgstr ""
-"Duhet të rindezësh kompjuterin që të ecësh me instalimin Debian. Gjatë "
-"nisjes së re, do të pyetesh nëse dëshiron të fillosh Windows apo Instaluesin "
-"Debian. Zgjidh Instaluesin Debian që të vazhdosh me procesin e instalimit."
-"\\n\\n"
+msgstr "Ju duhet të rindezni në mënyrë që të vazhdoni me proçesin e instalimit. "
+"Gjatë ndezjes tjeter, ju do të pyeteni nëse doni të filloni Windows apo "
+"të vazhdoni me proçesin e instalimit.\\n\\n"
#: win32-loader.c:175
-#, fuzzy
msgid ""
"During the install process, you will be offered the possibility of either "
"reducing your Windows partition or completely replacing it. In both cases, "
@@ -464,28 +444,14 @@ msgid ""
"event of data loss.\\n\\nOnce your install is complete (and if you have "
"chosen to keep Windows in your disk), you can uninstall this loader through "
"the Windows Add/Remove Programs dialog in Control Panel."
-msgstr ""
-"Gjatë procesit të instalimit, do të të jepet mundësia e zvogëlimit të "
-"ndarjes tënde Windows për të instaluar Debian ose për ta zëvendësuar "
-"tërësisht atë. Në të dyja rastet, KËSHILLOHET FUQIMISHT ruajtja paraprake e "
-"të dhënave të tua. As autorët e këtij ngarkuesi, as projekti Debian do të "
-"marrin NDONJË PËRGJEGJËSI në rast se humbin të dhëna.\\n\\nSapo instalimi "
-"Debian përfundon (dhe ti ke zgjedhur të mbash Windows në diskun tënd), mund "
-"të çinstalosh Ngarkuesin e Debian-Instaluesit me anë të dialogut Windows "
-"Shto/Hiq Programe në Panelin e Kontrollit."
+msgstr "Gjatë procesit të instalimit, juve do ju ofrohet mundesia ose për të "
+"zvogëluar ndarjen e Windows-it tuaj ose ta zëvendësuar plotësisht atë. Në të "
+"dyja rastet, është E REKOMANDUAR FUQIMISHT që të keni berë paraprakisht "
+"ruajtjen e të dhënave tuaja. Autorët e këtij programi NUK do të marrin "
+"ASNJE PERGJEGJESI në rastin e humbjen së të dhënave.\\n\\nKur instalimi të ketë "
+"mbaruar (dhe në qoftë se keni zgjedhur të mbani Windows në diskun tuaj), "
+"ju mund ta çinstaloni këtë ngarkim me anë të dialogut Windows Shto/Hiq Programe, në Control Panel."
#: win32-loader.c:176
msgid "Do you want to reboot now?"
-msgstr "Dëshiron ta rindezësh tani?"
-
-#~ msgid "Desktop environment:"
-#~ msgstr "Mjedis hapësire pune:"
-
-#~ msgid "None"
-#~ msgstr "Asnjë"
-
-#~ msgid "Debian Installer"
-#~ msgstr "Debian Instaluesi"
-
-#~ msgid "Debconf preseed line:"
-#~ msgstr "Rreshti paraardhës i Debconf:"
+msgstr "Doni të rindizni tani?"
diff --git a/l10n/win32-loader.sh b/l10n/win32-loader.sh
index f39835d..c71d5e0 100755
--- a/l10n/win32-loader.sh
+++ b/l10n/win32-loader.sh
@@ -67,7 +67,7 @@ fi
gettext English > /dev/null
# The bulk of the strings
-./win32-loader | iconv -c -f utf-8 -t "${charset}"
+./win32-loader
# Now comes a string that may be used by NTLDR (or not). So we need both
# samples.
@@ -88,19 +88,7 @@ d_i=`gettext '$target_distro $kernel_name - Continue with install process'`
pxe=`gettext "PXE - Network boot"`
# - Then we get a sample for bootmgr in the native charset.
-echo "${d_i}" | iconv -c -f utf-8 -t "${charset}" | langstring d-i
-echo "${pxe}" | iconv -c -f utf-8 -t "${charset}" | langstring pxe
-
-# - And another for ntldr in its own charset. If the charset cannot be
-# converted to ${ntldr_charset}, fallback to English untill it's fixed.
-(if echo "${d_i}" | iconv -c -f utf-8 -t "${ntldr_charset}" > /dev/null 2>&1 ; then
- echo "${d_i}" | iconv -c -f utf-8 -t "${ntldr_charset}"
-else
- echo '$target_distro $kernel_name - Continue with install process'
-fi) | langstring d-i_ntldr
-
-(if echo "${pxe}" | iconv -c -f utf-8 -t "${ntldr_charset}" > /dev/null 2>&1 ; then
- echo "${pxe}" | iconv -c -f utf-8 -t "${ntldr_charset}"
-else
- echo "PXE - Network boot"
-fi) | langstring pxe_ntldr
+echo "${d_i}" | langstring d-i
+echo "${d_i}" | langstring d-i_ntldr
+echo "${pxe}" | langstring pxe
+echo "${pxe}" | langstring pxe_ntldr
diff --git a/main.nsi b/main.nsi
index 7b8d88d..d3b2885 100644
--- a/main.nsi
+++ b/main.nsi
@@ -48,10 +48,10 @@ Page custom ShowGraphics ; graphics.nsi
Page custom ShowBranch ; download.nsi and branch.nsi
!endif
Page custom ShowCustom ; custom.nsi
-Page instfiles
+Page instfiles CreateBootEntry
UninstPage uninstConfirm
-UninstPage instfiles
+UninstPage instfiles un.RemoveBootEntry
;--------------------------------
Var /GLOBAL c
@@ -62,7 +62,11 @@ Var /GLOBAL preseed_cmdline
Var /GLOBAL preseed_cfg
Var /GLOBAL proxy
Var /GLOBAL arch
-Var /GLOBAL bcdedit
+Var /GLOBAL services
+Var /GLOBAL locator
+Var /GLOBAL basebcdstore
+Var /GLOBAL basebcdobject
+Var /GLOBAL bcdstore
Var /GLOBAL target_distro
;--------------------------------
diff --git a/onInit.nsi b/onInit.nsi
index 6ec86e3..e21a6b3 100644
--- a/onInit.nsi
+++ b/onInit.nsi
@@ -16,10 +16,79 @@
; 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 include/bootcfg.nsh
+
+!macro SetUp UN
+!insertmacro BOOTCFG_FUNCINC "${UN}" ConnectWMI
+!insertmacro BOOTCFG_FUNCINC "${UN}" GetObject
+!insertmacro BOOTCFG_FUNCINC "${UN}" OpenDefaultBcdStore
+Function `${UN}Setup`
+ Push $0
+ Push $1
+
+ !insertmacro ${BOOTCFG_PREFIX}ConnectWMI_Call "${UN}" $locator $services $0
+ ${If} $0 != 0
+ StrCpy $1 $services
+ StrCpy $services ""
+ StrCpy $locator ""
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}GetObject_Call "${UN}" \
+ $services "BcdStore" $basebcdstore $0
+ ${If} $0 != 0
+ StrCpy $1 $basebcdstore
+ StrCpy $basebcdstore ""
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}GetObject_Call "${UN}" \
+ $services "BcdObject" $basebcdobject $0
+ ${If} $0 != 0
+ StrCpy $1 $basebcdobject
+ StrCpy $basebcdobject ""
+ ${Else}
+ !insertmacro ${BOOTCFG_PREFIX}OpenDefaultBcdStore_Call "${UN}" \
+ $services $basebcdstore $bcdstore $0
+ ${If} $0 != 0
+ StrCpy $1 $bcdstore
+ StrCpy $bcdstore ""
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $0 != 0
+ IntFmt $0 "0x%08X" $0
+ DetailPrint "$1: $0"
+ ${EndIf}
+
+ Pop $1
+ Pop $0
+FunctionEnd
+!macroend
+
+!macro CleanUp UN
+Function `${UN}CleanUp`
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $bcdstore
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $basebcdobject
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $basebcdstore
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $services
+ !insertmacro ${BOOTCFG_PREFIX}ReleaseObject_Call "${UN}" $locator
+ StrCpy $bcdstore ""
+ StrCpy $basebcdobject ""
+ StrCpy $basebcdstore ""
+ StrCpy $services ""
+ StrCpy $locator ""
+FunctionEnd
+!macroend
+
+!insertmacro SetUp ""
+!insertmacro Setup "un."
+!insertmacro CleanUp ""
+!insertmacro CleanUp "un."
Function .onInit
InitPluginsDir
+ Call SetUp
+
!ifdef TARGET_DISTRO
StrCpy $target_distro "${TARGET_DISTRO}"
!else
@@ -68,3 +137,15 @@ wider choice, where your language is more likely to be present."
StrCpy $unsupported_language false
${Endif}
FunctionEnd
+
+Function .onUserAbort
+ Call CleanUp
+FunctionEnd
+
+Function un.onInit
+ Call un.SetUp
+FunctionEnd
+
+Function un.onUserAbort
+ Call un.CleanUp
+FunctionEnd
diff --git a/s_install.nsi b/s_install.nsi
index db4e022..876aff6 100644
--- a/s_install.nsi
+++ b/s_install.nsi
@@ -16,8 +16,109 @@
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
-Section "Installer Loader"
+; Include required functions
+${BOOTCFG_CreateGUID}
+${BOOTCFG_CreateObject}
+${BOOTCFG_SetDescription}
+${BOOTCFG_SetPartition}
+${BOOTCFG_SetPath}
+${BOOTCFG_AppendBootEntry}
+
+; Create boot entry and add it to display list of boot manager
+; Parameter:
+; guid - global unique identifier of boot entry
+; label - brief description of boot entry
+Function AddBootEntry
+ Exch $0
+ Exch
+ Exch $1
+ Push $2
+ Push $3
+ Push $4
+
+ StrCpy $3 $0
+ StrCpy $2 $1
+ StrCpy $1 $c
+ System::Call "kernel32::QueryDosDevice(t r1, t .r4, \
+ i${NSIS_MAX_STRLEN}) i .r0"
+
+ ; guid=$2, label=$3, systempartition=$4
+ ${If} $2 != ""
+ ${BOOTCFG_CreateObject} $services $basebcdstore $bcdstore \
+ ${BOOTCFG_BOOT_SECTOR} $2 $1 $0
+ ${If} $0 == 0
+ ${BOOTCFG_SetDescription} $services $basebcdobject $1 "$3" $3 $0
+ ${If} $0 == 0
+ ; Release result
+ ${BOOTCFG_ReleaseObject} $3
+ ${BOOTCFG_SetPartition} $services $basebcdobject $1 $4 $3 $0
+ ${If} $0 == 0
+ ; Release result
+ ${BOOTCFG_ReleaseObject} $3
+ ${BOOTCFG_SetPath} $services $basebcdobject $1 \
+ "\g2ldr.mbr" $3 $0
+ ${If} $0 == 0
+ ; Release result
+ ${BOOTCFG_ReleaseObject} $3
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ; Release bcdobject
+ ${BOOTCFG_ReleaseObject} $1
+ ${If} $0 != 0
+ StrCpy $1 $3
+ ${Else}
+ ; Append boot entry to list
+ ${BOOTCFG_AppendBootEntry} $services $basebcdstore \
+ $bcdstore $basebcdobject $2 $1 $0
+ ${If} $0 == 0
+ ; Release result
+ ${BOOTCFG_ReleaseObject} $1
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $0 != 0
+ IntFmt $2 "0x%08X" $0
+ MessageBox MB_OK "$1: $2"
+ ${EndIf}
+
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+Function CreateBootEntry
+ ${If} $windows_boot_method == bootmgr
+ ReadRegStr $0 HKLM "${REGSTR_WIN32}" "bootmgr"
+ ${If} $0 == ""
+ ${BOOTCFG_CreateGUID} $2
+ ${If} $2 != ""
+ Push "$2"
+!ifdef PXE
+ ${If} $pxe_mode == "true"
+ Push "$(pxe)"
+ ${Else}
+!endif ; PXE
+ Push "$(d-i)"
+!ifdef PXE
+ ${EndIf} ; $pxe_mode == "true"
+!endif ; PXE
+ Call AddBootEntry
+ WriteRegStr HKLM "${REGSTR_WIN32}" "bootmgr" "$2"
+ Call CleanUp
+ ${Else}
+ MessageBox MB_OK|MB_ICONSTOP "$(error_bcdedit_extract_id)"
+ Quit
+ ${EndIf}
+ ${Endif}
+ ${Endif}
+FunctionEnd
+Section "Installer Loader"
; ******************************************************************************
; ***************************************** THIS IS WHERE THE REAL ACTION STARTS
; ******************************************************************************
@@ -364,13 +465,16 @@ ${EndIf}
WriteIniStr "$c\boot.ini" "boot loader" "timeout" "30"
!ifdef PXE
${If} $pxe_mode == "true"
- WriteIniStr "$c\boot.ini" "operating systems" "$c\g2ldr.mbr" '"$(pxe_ntldr)"'
+ StrCpy $1 "$(pxe)"
${Else}
!endif ; PXE
- WriteIniStr "$c\boot.ini" "operating systems" "$c\g2ldr.mbr" '"$(d-i_ntldr)"'
+ StrCpy $1 "$(d-i)"
!ifdef PXE
${EndIf} ; $pxe_mode == "true"
!endif ; PXE
+ System::Call "kernel32::WideCharToMultiByte(i 850, i 0, w r1, i -1, \
+ m.r2, i${NSIS_MAX_STRLEN}, p 0, p 0) i.r0"
+ WriteIniStr "$c\boot.ini" "operating systems" "$c\g2ldr.mbr" '"$2"'
${Endif}
${If} $windows_boot_method == direct
@@ -402,39 +506,11 @@ ${EndIf}
MessageBox MB_OK|MB_ICONSTOP "$(error_copyfiles)"
Quit
!endif
- DetailPrint "$(registering_bootmgr)"
- ReadRegStr $0 HKLM "${REGSTR_WIN32}" "bootmgr"
- ${If} $0 == ""
-!ifdef PXE
- ${If} $pxe_mode == "true"
- nsExec::ExecToStack '"$bcdedit" /create /d "$(pxe_ntldr)" /application bootsector'
- ${Else}
-!endif ; PXE
- nsExec::ExecToStack '"$bcdedit" /create /d "$(d-i_ntldr)" /application bootsector'
-!ifdef PXE
- ${EndIf} ; $pxe_mode == "true"
-!endif ; PXE
- Pop $0
- ${If} $0 != 0
- StrCpy $0 $bcdedit
- MessageBox MB_OK|MB_ICONSTOP "$(error_exec)"
- Quit
- ${Endif}
- ; "The entry {id} was successfully created" is in top of stack now
- string::bcdedit_extract_id
- Pop $0
- ${If} $0 == "error"
- MessageBox MB_OK|MB_ICONSTOP "$(error_bcdedit_extract_id)"
- Quit
- ${Endif}
- ; $0 holds the boot id. Write it down, both for installer idempotency
- ; and for uninstaller.
- WriteRegStr HKLM "${REGSTR_WIN32}" "bootmgr" "$0"
- ${Endif}
- nsExec::Exec '"$bcdedit" /set $0 device boot'
- nsExec::Exec '"$bcdedit" /set $0 path \g2ldr.mbr'
- nsExec::Exec '"$bcdedit" /set $0 device partition=$c'
- nsExec::Exec '"$bcdedit" /displayorder $0 /addlast'
+ ${If} $bcdstore != ""
+ Call CleanUp
+ ${Else}
+ DetailPrint "$(registering_bootmgr)"
+ ${EndIf}
${Endif}
; ********************************************** Needed for systems with compressed NTFS
@@ -453,5 +529,4 @@ ${EndIf}
nsExec::Exec '"compact" /u $INSTDIR\pxe.lkrn'
${EndIf}
!endif ;PXE
-
SectionEnd
diff --git a/s_uninstall.nsi b/s_uninstall.nsi
index f08523e..a51d34e 100644
--- a/s_uninstall.nsi
+++ b/s_uninstall.nsi
@@ -16,6 +16,28 @@
; 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_DeleteObject}
+${un.BOOTCFG_RemoveBootEntry}
+
+Function un.RemoveBootEntry
+ ReadRegStr $0 HKLM "${REGSTR_WIN32}" "bootmgr"
+ ${If} $0 != ""
+ ${un.BOOTCFG_DeleteObject} $services $basebcdstore $bcdstore $0 $2 $1
+ ${If} $1 != 0
+ IntFmt $1 "0x%08X" $1
+ MessageBox MB_OK "$2: $1"
+ ${EndIf}
+ ${un.BOOTCFG_RemoveBootEntry} $services $basebcdstore $bcdstore \
+ $basebcdobject $0 $2 $1
+ ${If} $1 != 0
+ IntFmt $1 "0x%08X" $1
+ MessageBox MB_OK "$2: $1"
+ ${EndIf}
+ ${Endif}
+
+ Call un.CleanUp
+FunctionEnd
Section "Uninstall"
; Initialise $c
@@ -34,22 +56,6 @@ Section "Uninstall"
DeleteINIStr "$c\boot.ini" "boot loader" "old_timeout_win32-loader"
no_saved_boot_ini_timeout:
- ReadRegStr $0 HKLM "${REGSTR_WIN32}" "bootmgr"
- ${If} $0 != ""
- ; FIXME: this blurb is duplicated in the installer (expert.nsi). keep in sync!
- GetFullPathName $bcdedit $WINDIR\Sysnative\bcdedit.exe
- ${If} $bcdedit == ""
- StrCpy $bcdedit $SYSDIR\bcdedit.exe
- ${Endif}
-
- nsExec::Exec '"$bcdedit" /delete $0'
- Pop $0
- ${If} $0 != 0
- StrCpy $0 $bcdedit
- MessageBox MB_OK|MB_ICONSTOP "$(error_exec)"
- ${Endif}
- ${Endif}
-
DeleteRegKey HKLM "${REGSTR_WIN32}"
DeleteRegKey HKLM "${REGSTR_UNINST}"
Delete $c\g2ldr