Index: Installer/dxgl.nsi |
— | — | @@ -2,14 +2,17 @@ |
3 | 3 |
|
4 | 4 | SetCompressor /SOLID lzma
|
5 | 5 |
|
| 6 | +!include 'LogicLib.nsh'
|
| 7 | +
|
| 8 | +
|
6 | 9 | ; HM NIS Edit Wizard helper defines
|
7 | 10 | !define PRODUCT_NAME "DXGL"
|
8 | | -!define PRODUCT_VERSION "0.0.6"
|
9 | 11 | !define PRODUCT_PUBLISHER "William Feely"
|
10 | 12 | !define PRODUCT_WEB_SITE "https://www.williamfeely.info/wiki/DXGL"
|
11 | 13 | !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\dxglcfg.exe"
|
12 | 14 | !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
13 | 15 | !define PRODUCT_UNINST_ROOT_KEY "HKLM"
|
| 16 | +!include "version.nsh"
|
14 | 17 |
|
15 | 18 | ; MUI2
|
16 | 19 | !include "MUI2.nsh"
|
— | — | @@ -41,8 +44,20 @@ |
42 | 45 |
|
43 | 46 | ; MUI end ------
|
44 | 47 |
|
| 48 | +
|
| 49 | +!define HKEY_CURRENT_USER 0x80000001
|
| 50 | +!define RegOpenKeyEx "Advapi32::RegOpenKeyEx(i, t, i, i, *i) i"
|
| 51 | +!define RegQueryValueEx "Advapi32::RegQueryValueEx(i, t, i, *i, i, *i) i"
|
| 52 | +!define RegCloseKey "Advapi32::RegCloseKey(i) i"
|
| 53 | +!define REG_MULTI_SZ 7
|
| 54 | +!define INSTPATH "InstallPaths"
|
| 55 | +!define KEY_QUERY_VALUE 0x0001
|
| 56 | +!define KEY_ENUMERATE_SUB_KEYS 0x0008
|
| 57 | +!define ROOT_KEY ${HKEY_CURRENT_USER}
|
| 58 | +Var SUBKEY
|
| 59 | +
|
45 | 60 | Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
46 | | -OutFile "DXGL-0.0.6-win32.exe"
|
| 61 | +OutFile "DXGL-${PRODUCT_VERSION}-win32.exe"
|
47 | 62 | InstallDir "$PROGRAMFILES\DXGL"
|
48 | 63 | InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
|
49 | 64 | ShowInstDetails show
|
— | — | @@ -59,6 +74,74 @@ |
60 | 75 | File "..\Release\ddraw.dll"
|
61 | 76 | File "..\ReadMe.txt"
|
62 | 77 | File "..\COPYING.txt"
|
| 78 | +
|
| 79 | + StrCpy $8 0
|
| 80 | + SetPluginUnload alwaysoff
|
| 81 | + regloop:
|
| 82 | + EnumRegKey $SUBKEY HKCU "Software\DXGL" $8
|
| 83 | + StrCmp $SUBKEY "" regdone
|
| 84 | + StrCpy $SUBKEY "Software\DXGL\$SUBKEY"
|
| 85 | + MessageBox MB_OK "$SUBKEY"
|
| 86 | + IntOp $8 $8 + 1
|
| 87 | + ;REG_MULTI_SZ reader based on code at http://nsis.sourceforge.net/REG_MULTI_SZ_Reader
|
| 88 | + StrCpy $0 ""
|
| 89 | + StrCpy $1 ""
|
| 90 | + StrCpy $2 ""
|
| 91 | + StrCpy $3 ""
|
| 92 | + System::Call "${RegOpenKeyEx}(${ROOT_KEY},'$SUBKEY',0, \
|
| 93 | + ${KEY_QUERY_VALUE}|${KEY_ENUMERATE_SUB_KEYS},.r0) .r3"
|
| 94 | + StrCmp $3 0 readvalue
|
| 95 | + Goto regloop
|
| 96 | + readvalue:
|
| 97 | + System::Call "${RegQueryValueEx}(r0,'${INSTPATH}',0,.r1,0,.r2) .r3"
|
| 98 | + StrCmp $3 0 checksz
|
| 99 | + goto readdone
|
| 100 | + checksz:
|
| 101 | + StrCmp $1 ${REG_MULTI_SZ} checkempty
|
| 102 | + MessageBox MB_OK|MB_ICONSTOP "Registry value no REG_MULTI_SZ! ($3)"
|
| 103 | + Goto readdone
|
| 104 | + checkempty:
|
| 105 | + StrCmp $2 0 0 multiszalloc
|
| 106 | + MessageBox MB_OK|MB_ICONSTOP "Registry value empty! ($3)"
|
| 107 | + Goto readdone
|
| 108 | + multiszalloc:
|
| 109 | + System::Alloc $2
|
| 110 | + Pop $1
|
| 111 | + StrCmp $1 0 0 multiszget
|
| 112 | + MessageBox MB_OK|MB_ICONSTOP "Can't allocate enough memory! ($3)"
|
| 113 | + Goto readdone
|
| 114 | + multiszget:
|
| 115 | + System::Call "${RegQueryValueEx}(r0, '${INSTPATH}', 0, n, r1, r2) .r3"
|
| 116 | + StrCmp $3 0 multiszprocess
|
| 117 | + MessageBox MB_OK|MB_ICONSTOP "Can't query registry value data! ($3)"
|
| 118 | + System::Free $1
|
| 119 | + Goto readdone
|
| 120 | + multiszprocess:
|
| 121 | + StrCpy $4 $1
|
| 122 | + IntOp $6 $4 + $2
|
| 123 | + !ifdef NSIS_UNICODE
|
| 124 | + IntOp $6 $6 - 2
|
| 125 | + !else
|
| 126 | + IntOp $6 $6 - 1
|
| 127 | + !endif
|
| 128 | + szloop:
|
| 129 | + System::Call "*$4(&t${NSIS_MAX_STRLEN} .r3)"
|
| 130 | + StrLen $5 $3
|
| 131 | + IntOp $5 $5 + 1
|
| 132 | + !ifdef NSIS_UNICODE
|
| 133 | + IntOp $5 $5 * 2
|
| 134 | + !endif
|
| 135 | + IntOp $4 $4 + $5
|
| 136 | + MessageBox MB_OK "$3"
|
| 137 | + IntCmp IntCmp $4 $6 0 szloop
|
| 138 | + System::Free $1
|
| 139 | +
|
| 140 | + readdone:
|
| 141 | + StrCmp $0 0 regloop
|
| 142 | + System::Call "${RegCloseKey}(r0)"
|
| 143 | + goto regloop
|
| 144 | + regdone:
|
| 145 | + SetPluginUnload manual
|
63 | 146 | SectionEnd
|
64 | 147 |
|
65 | 148 | Section -AdditionalIcons
|
Index: Installer/version.nsh |
— | — | @@ -0,0 +1 @@ |
| 2 | +!define PRODUCT_VERSION "0.1.0" |
\ No newline at end of file |