1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-02 03:26:38 +02:00

Win32 fixes

This commit is contained in:
codemastr
2001-04-25 21:21:33 +00:00
parent 684e6dbc4d
commit fe33eabc47
3 changed files with 70 additions and 60 deletions
+2
View File
@@ -446,3 +446,5 @@
- Removed newdns
- Fixed a memory bug in win32 code found and fixed by McSkaf, and fixed a typo
- Fixed a win32 bug found by RaYmAn causing the tray icon not to be displayed sometimes
- Fixed a bunch of Win32 bugs reported and fixed by McSkaf
- Made the IRCd delete its tray icon in win32 on SIGSEGV
+7 -5
View File
@@ -106,7 +106,9 @@ aClient me; /* That's me */
char *me_hash;
aClient *client = &me; /* Pointer to beginning of Client list */
extern char backupbuf[8192];
#ifdef _WIN32
extern void CleanUpSegv(int sig);
#endif
#ifndef NO_FDLIST
fdlist default_fdlist;
fdlist busycli_fdlist;
@@ -793,9 +795,7 @@ int InitwIRCD(argc, argv)
WSAStartup(wVersionRequested, &wsaData);
#endif
bzero((char *)&me, sizeof(me));
#ifndef _WIN32
setup_signals();
#endif
initload();
init_ircstats();
clear_scache_hash_table();
@@ -1498,9 +1498,9 @@ static void open_debugfile()
return;
}
#ifndef _WIN32
static void setup_signals()
{
#ifndef _WIN32
#ifdef POSIX_SIGNALS
struct sigaction act;
act.sa_handler = SIG_IGN;
@@ -1557,6 +1557,8 @@ static void setup_signals()
*/
(void)siginterrupt(SIGALRM, 1);
#endif
#else
(void)signal(SIGSEGV,CleanUpSegv);
#endif
}
#endif /* !_Win32 */
+61 -55
View File
@@ -78,7 +78,10 @@ void CleanUp(void)
{
Shell_NotifyIcon(NIM_DELETE ,&SysTray);
}
void CleanUpSegv(int sig)
{
Shell_NotifyIcon(NIM_DELETE ,&SysTray);
}
HWND hwIRCDWnd=NULL/* hwnd=NULL*/;
HWND hwTreeView;
HANDLE hMainThread = 0;
@@ -473,16 +476,17 @@ LRESULT CALLBACK ConfigDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
char *buffer = '\0';
struct stat sb;
SetWindowText(hDlg, "UnrealIRCd Configuration File");
fd = open(CPATH, _O_RDONLY|_O_BINARY);
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
if ((fd = open(CPATH, _O_RDONLY|_O_BINARY)) != -1) {
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
}
return (TRUE);
}
case WM_COMMAND:
@@ -504,10 +508,6 @@ LRESULT CALLBACK ConfigDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
}
break;
case WM_CHAR:
MessageBox(NULL, (char *)wParam, (char *)wParam, MB_OK);
break;
case WM_CLOSE:
EndDialog(hDlg, TRUE);
break;
@@ -522,16 +522,17 @@ LRESULT CALLBACK MotdDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
int fd,len;
char *buffer = '\0';
SetWindowText(hDlg, "UnrealIRCd MOTD File");
fd = open(MPATH, _O_RDONLY|_O_BINARY);
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
if ((fd = open(MPATH, _O_RDONLY|_O_BINARY)) != -1) {
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
}
return (TRUE);
}
case WM_COMMAND:
@@ -567,16 +568,17 @@ LRESULT CALLBACK OperMotdDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar
int fd,len;
char *buffer = '\0';
SetWindowText(hDlg, "UnrealIRCd OperMOTD File");
fd = open(OPATH, _O_RDONLY|_O_BINARY);
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
if ((fd = open(OPATH, _O_RDONLY|_O_BINARY)) != -1) {
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
}
return (TRUE);
}
case WM_COMMAND:
@@ -612,16 +614,17 @@ LRESULT CALLBACK BotMotdDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPara
int fd,len;
char *buffer = '\0';
SetWindowText(hDlg, "UnrealIRCd BotMOTD File");
fd = open(BPATH, _O_RDONLY|_O_BINARY);
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
if ((fd = open(BPATH, _O_RDONLY|_O_BINARY)) != -1) {
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
}
return (TRUE);
}
case WM_COMMAND:
@@ -657,16 +660,17 @@ LRESULT CALLBACK RulesDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
int fd,len;
char *buffer = '\0';
SetWindowText(hDlg, "UnrealIRCd Rules File");
fd = open(RPATH, _O_RDONLY|_O_BINARY);
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
if ((fd = open(RPATH, _O_RDONLY|_O_BINARY)) != -1) {
fstat(fd,&sb);
/* Only allocate the amount we need */
buffer = (char *)malloc(sb.st_size+1);
buffer[0] = 0;
len = read(fd, buffer, sb.st_size);
buffer[len] = 0;
SetDlgItemText(hDlg, IDC_TEXT, buffer);
close(fd);
free(buffer);
}
return (TRUE);
}
case WM_COMMAND:
@@ -846,6 +850,7 @@ void win_log(char *format, ...) {
buf2 = MyMalloc(strlen(errors)+strlen(buf)+1);
sprintf(buf2, "%s%s",errors,buf);
MyFree(errors);
errors = NULL;
}
else {
buf2 = MyMalloc(strlen(buf)+1);
@@ -866,6 +871,7 @@ LRESULT CALLBACK ConfigErrorDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
MessageBeep(MB_ICONEXCLAMATION);
SetDlgItemText(hDlg, IDC_CONFIGERROR, errors);
MyFree(errors);
errors = NULL;
return (TRUE);
case WM_COMMAND: