]> Nishi Git Mirror - tewi.git/commitdiff
do this instead
authorNishi <nishi@nishi.boats>
Wed, 2 Oct 2024 02:59:59 +0000 (02:59 +0000)
committerNishi <nishi@nishi.boats>
Wed, 2 Oct 2024 02:59:59 +0000 (02:59 +0000)
git-svn-id: file:///raid/svn-personal/tewi/trunk@208 8739d7e6-ffea-ec47-b151-bdff447c6205

Server/install.nsi
Server/main.c
installer.sh

index e3c7bc4fdf9df047637cbec369c38cd5411b9765..e50b23950eae7050c912ebf5e658bb87dbc8d215 100644 (file)
@@ -22,6 +22,7 @@ LangString SERV_TOO ${LANG_JAPANESE} "サービスもインストールする(NT
 LangString WAIT_STOP ${LANG_ENGLISH} "Waiting for 1 second so service can stop"
 LangString WAIT_STOP ${LANG_JAPANESE} "サービスが止まるのを待っています"
 
+!include "x64.nsh"
 !include "LogicLib.nsh"
 !include "Sections.nsh"
 
@@ -57,8 +58,13 @@ Section
        CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
        CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
 
+       ${If} ${RunningX64}
+               SetRegView 64
+       ${Else}
+               SetRegView 32
+       ${EndIf}
        WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
-       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "InstallDir" '"$INSTDIR"'
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "InstallDir" "$INSTDIR"
        WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
 
        WriteUninstaller "$INSTDIR\uninstall.exe"
@@ -125,5 +131,10 @@ Section "Uninstall"
        RMDir /r "$INSTDIR"
        RMDir /r "$SMPROGRAMS\Tewi HTTPd"
 
+       ${If} ${RunningX64}
+               SetRegView 64
+       ${Else}
+               SetRegView 32
+       ${EndIf}
        DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
 SectionEnd
index 4b3c832f96396a8e8cf9896ecada7bae46ec50ba..cece19bfb3a7141c97f9dc3e8a899cee039e9fc9 100644 (file)
@@ -73,10 +73,18 @@ int startup(int argc, char** argv);
 
 #ifdef __MINGW32__
 char* get_registry(const char* main, const char* sub) {
-       DWORD bufsize = 255;
-       char* value = malloc(256);
-       int err = RegGetValue(HKEY_LOCAL_MACHINE, main, sub, RRF_RT_ANY, NULL, (void*)value, &bufsize);
+       DWORD bufsize = 512;
+       HKEY handle;
+       char* value = malloc(513);
+       int err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, main, 0, KEY_QUERY_VALUE, &handle);
        if(err == ERROR_SUCCESS) {
+               err = RegQueryValueEx(handle, sub, NULL, NULL, value, &bufsize);
+               if(err != ERROR_SUCCESS) {
+                       free(value);
+                       RegCloseKey(handle);
+                       return NULL;
+               }
+               RegCloseKey(handle);
                return value;
        } else {
                free(value);
@@ -502,6 +510,7 @@ void show_png(void) {
 #endif
 
 int main(int argc, char** argv) {
+       printf("%s\n", get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir"));
        logfile = stderr;
 #ifdef SERVICE
        SERVICE_TABLE_ENTRY table[] = {{"Tewi HTTPd", servmain}, {NULL, NULL}};
index 768855a1d5a8ce746008227d76238a6d8d3a1407..f2a840babb0b08a8e28667b9f06709dd98f8c7b6 100755 (executable)
@@ -22,13 +22,13 @@ VERSION=`make get-version`
 sed "s/undef NO_SSL/define NO_SSL/g" config.h.tmpl > config.h
 
 make clean || fail
-make PLATFORM=$1 PREFIX=C:/srv/Tewi -j4 || fail
+make PLATFORM=$1 PREFIX=C:/Tewi -j4 || fail
 cp Server/tewi.exe tewi.exe
 make clean || fail
-make PLATFORM=$1-service -j4 PREFIX=C:/srv/Tewi || fail
+make PLATFORM=$1-service -j4 PREFIX=C:/Tewi || fail
 cp Server/tewi.exe tewi-service.exe
 cd Server
-../Tool/genconf "C:/srv/Tewi" modules dll > ../generated.conf
+../Tool/genconf "C:/Tewi" modules dll > ../generated.conf
 ../Tool/itworks > ../itworks.html
 makensis -DVERSION=$VERSION install.nsi
 cp install.exe ../install-nossl.exe
@@ -38,13 +38,13 @@ cd ..
 sed "s/define NO_SSL/undef NO_SSL/g" config.h.tmpl > config.h
 
 make clean || fail
-make PLATFORM=$1 -j4 PREFIX=C:/srv/Tewi|| fail
+make PLATFORM=$1 -j4 PREFIX=C:/Tewi|| fail
 cp Server/tewi.exe tewi.exe
 make clean || fail
-make PLATFORM=$1-service -j4 PREFIX=C:/srv/Tewi || fail
+make PLATFORM=$1-service -j4 PREFIX=C:/Tewi || fail
 cp Server/tewi.exe tewi-service.exe
 cd Server
-../Tool/genconf "C:/srv/Tewi" modules dll > ../generated.conf
+../Tool/genconf "C:/Tewi" modules dll > ../generated.conf
 ../Tool/itworks > ../itworks.html
 makensis -DVERSION=$VERSION install.nsi
 cp install.exe ../install-ssl.exe