Changeset 206 in Main for trunk/Server
- Timestamp:
- Oct 2, 2024, 11:33:40 AM (6 weeks ago)
- Location:
- trunk/Server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/install.nsi
r128 r206 27 27 28 28 Page license 29 Page directory 29 30 Page components 30 31 Page instfiles … … 58 59 59 60 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd" 61 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "InstallDir" '"$INSTDIR"' 60 62 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"' 61 63 -
trunk/Server/main.c
r200 r206 72 72 int startup(int argc, char** argv); 73 73 74 #ifdef __MINGW32__ 75 char* get_registry(const char* main, const char* sub) { 76 DWORD bufsize = 255; 77 char* value = malloc(256); 78 int err = RegGetValue(HKEY_LOCAL_MACHINE, main, sub, RRF_RT_ANY, NULL, (void*)value, &bufsize); 79 if(err == ERROR_SUCCESS) { 80 return value; 81 } else { 82 free(value); 83 return NULL; 84 } 85 } 86 #endif 87 74 88 #ifdef SERVICE 75 89 SERVICE_STATUS status; … … 87 101 88 102 void WINAPI servmain(DWORD argc, LPSTR* argv) { 89 logfile = fopen(PREFIX "/logs/tewi.log", "a"); 103 char* path = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir"); 104 if(path != NULL) { 105 char* lpath = cm_strcat(path, "/logs/tewi.log"); 106 logfile = fopen(lpath, "a"); 107 free(lpath); 108 free(path); 109 } else { 110 logfile = fopen(PREFIX "/logs/tewi.log", "a"); 111 } 90 112 if(logfile == NULL) logfile = stderr; 91 113 status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; … … 662 684 int startup(int argc, char** argv) { 663 685 int i; 686 #ifdef __MINGW32__ 687 char* confpath = cm_strdup(PREFIX "/etc/tewi.conf"); 688 char* regpath = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir"); 689 if(regpath != NULL) { 690 free(confpath); 691 confpath = cm_strcat(regpath, "/etc/tewi.conf"); 692 free(regpath); 693 } 694 #else 664 695 const char* confpath = PREFIX "/etc/tewi.conf"; 696 #endif 665 697 if(argv != NULL) { 666 698 for(i = 1; i < argc; i++) { -
trunk/Server/tw_version.h
r205 r206 8 8 #endif 9 9 10 #define TW_VERSION "2.03 B\0"10 #define TW_VERSION "2.03C\0" 11 11 12 12 const char* tw_get_version(void);
Note:
See TracChangeset
for help on using the changeset viewer.