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"
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"
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
#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);
#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}};
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
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