!include "Sections.nsh"
Page license
+Page directory
Page components
Page instfiles
UninstPage uninstConfirm
CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
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" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteUninstaller "$INSTDIR\uninstall.exe"
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);
+ if(err == ERROR_SUCCESS) {
+ return value;
+ } else {
+ free(value);
+ return NULL;
+ }
+}
+#endif
+
#ifdef SERVICE
SERVICE_STATUS status;
SERVICE_STATUS_HANDLE status_handle;
}
void WINAPI servmain(DWORD argc, LPSTR* argv) {
- logfile = fopen(PREFIX "/logs/tewi.log", "a");
+ char* path = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir");
+ if(path != NULL) {
+ char* lpath = cm_strcat(path, "/logs/tewi.log");
+ logfile = fopen(lpath, "a");
+ free(lpath);
+ free(path);
+ } else {
+ logfile = fopen(PREFIX "/logs/tewi.log", "a");
+ }
if(logfile == NULL) logfile = stderr;
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
status.dwCurrentState = SERVICE_START_PENDING;
int startup(int argc, char** argv) {
int i;
+#ifdef __MINGW32__
+ char* confpath = cm_strdup(PREFIX "/etc/tewi.conf");
+ char* regpath = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir");
+ if(regpath != NULL) {
+ free(confpath);
+ confpath = cm_strcat(regpath, "/etc/tewi.conf");
+ free(regpath);
+ }
+#else
const char* confpath = PREFIX "/etc/tewi.conf";
+#endif
if(argv != NULL) {
for(i = 1; i < argc; i++) {
if(argv[i][0] == '-') {
extern "C" {
#endif
-#define TW_VERSION "2.03B\0"
+#define TW_VERSION "2.03C\0"
const char* tw_get_version(void);
const char* tw_get_platform(void);
sed "s/undef NO_SSL/define NO_SSL/g" config.h.tmpl > config.h
make clean || fail
-make PLATFORM=$1 -j4 || fail
+make PLATFORM=$1 PREFIX=C:/srv/Tewi -j4 || fail
cp Server/tewi.exe tewi.exe
make clean || fail
-make PLATFORM=$1-service -j4 || fail
+make PLATFORM=$1-service -j4 PREFIX=C:/srv/Tewi || fail
cp Server/tewi.exe tewi-service.exe
cd Server
-../Tool/genconf "C:/Tewi" modules dll > ../generated.conf
+../Tool/genconf "C:/srv/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 || fail
+make PLATFORM=$1 -j4 PREFIX=C:/srv/Tewi|| fail
cp Server/tewi.exe tewi.exe
make clean || fail
-make PLATFORM=$1-service -j4 || fail
+make PLATFORM=$1-service -j4 PREFIX=C:/srv/Tewi || fail
cp Server/tewi.exe tewi-service.exe
cd Server
-../Tool/genconf "C:/Tewi" modules dll > ../generated.conf
+../Tool/genconf "C:/srv/Tewi" modules dll > ../generated.conf
../Tool/itworks > ../itworks.html
makensis -DVERSION=$VERSION install.nsi
cp install.exe ../install-ssl.exe