From: Kern Sibbald Date: Sun, 27 Jun 2004 11:23:25 +0000 (+0000) Subject: Win32 fixes + resources array fix X-Git-Tag: Release-1.35.1~87 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3035af4b5c14154e15033ac77cf1101d5ab0bf92;p=bacula%2Fbacula Win32 fixes + resources array fix git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1447 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/console/console_conf.c b/bacula/src/console/console_conf.c index 89c31d0705..4a377dfa66 100644 --- a/bacula/src/console/console_conf.c +++ b/bacula/src/console/console_conf.c @@ -47,7 +47,7 @@ */ int r_first = R_FIRST; int r_last = R_LAST; -static RES *sres_head[R_LAST - R_FIRST]; +static RES *sres_head[R_LAST - R_FIRST + 1]; RES **res_head = sres_head; /* Forward referenced subroutines */ diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index fa8d41568f..18591c256f 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -50,7 +50,7 @@ */ int r_first = R_FIRST; int r_last = R_LAST; -static RES *sres_head[R_LAST - R_FIRST]; +static RES *sres_head[R_LAST - R_FIRST + 1]; RES **res_head = sres_head; /* Imported subroutines */ diff --git a/bacula/src/filed/filed_conf.c b/bacula/src/filed/filed_conf.c index c4c62fe620..23d8e62780 100644 --- a/bacula/src/filed/filed_conf.c +++ b/bacula/src/filed/filed_conf.c @@ -51,7 +51,7 @@ */ int r_first = R_FIRST; int r_last = R_LAST; -static RES *sres_head[R_LAST - R_FIRST]; +static RES *sres_head[R_LAST - R_FIRST + 1]; RES **res_head = sres_head; diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 715a80af69..0c16b08460 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -306,7 +306,6 @@ static const char *level_to_str(int level) #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) #include -static char buf[100]; int bacstat = 0; struct s_win32_arg { @@ -325,8 +324,7 @@ static void win32_sendit(const char *msg, int len, void *marg) // when compiling with visual studio some strings are read-only // and cause access violations. So we creat a tmp copy. char *_msg = (char *)alloca(len); - strncpy(_msg, msg, len-1); - _msg[len-1] = 0; + bstrncpy(_msg, msg, len); msg = _msg; } SendDlgItemMessage(arg->hwnd, arg->idlist, LB_ADDSTRING, 0, (LONG)msg); @@ -346,45 +344,54 @@ void FillStatusBox(HWND hwnd, int idlist) do_status(win32_sendit, (void *)&arg); } -char *bac_status(int stat) +char *bac_status(char *buf, int buf_len) { JCR *njcr; const char *termstat = _("Bacula Idle"); struct s_last_job *job; + int stat = 0; /* Idle */ - bacstat = 0; if (!last_jobs) { - return _("Bacula Terminated"); + goto done; + } + Dmsg0(1000, "Begin bac_status jcr loop.\n"); + lock_jcr_chain(); + foreach_jcr(njcr) { + if (njcr->JobId != 0) { + stat = JS_Running; + termstat = _("Bacula Running"); + free_locked_jcr(njcr); + break; + } + free_locked_jcr(njcr); + } + unlock_jcr_chain(); + if (stat != 0) { + goto done; } if (last_jobs->size() > 0) { job = (struct s_last_job *)last_jobs->last(); + stat = job->JobStatus; switch (job->JobStatus) { case JS_Canceled: - bacstat = -1; termstat = _("Last Job Canceled"); break; case JS_ErrorTerminated: - bacstat = -1; termstat = _("Last Job Failed"); break; default: + if (job->Errors) { + termstat = _("Last Job had Errors"); + } break; } } - Dmsg0(1000, "Begin bac_status jcr loop.\n"); - lock_jcr_chain(); - foreach_jcr(njcr) { - if (njcr->JobId != 0) { - bacstat = 1; - termstat = _("Bacula Running"); - free_locked_jcr(njcr); - break; - } - free_locked_jcr(njcr); - } - unlock_jcr_chain(); Dmsg0(1000, "End bac_status jcr loop.\n"); - bstrncpy(buf, termstat, sizeof(buf)); +done: + bacstat = stat; + if (buf) { + bstrncpy(buf, termstat, sizeof(buf)); + } return buf; } diff --git a/bacula/src/filed/win32/Makefile.in b/bacula/src/filed/win32/Makefile.in index d25f21dd8a..d7b01e6b73 100755 --- a/bacula/src/filed/win32/Makefile.in +++ b/bacula/src/filed/win32/Makefile.in @@ -46,7 +46,7 @@ win32: winlib.a winlib.a: $(BACOBJS) winres.res ar rcs $@ $(BACOBJS) -winres.res: winres.rc bacula.ico winres.h idle.ico running.ico error.ico +winres.res: winres.rc bacula.ico winres.h idle.ico running.ico error.ico warn.ico windres $< -O coff -o $@ winmain.o: winmain.cpp winbacula.h diff --git a/bacula/src/filed/win32/Makefile.mingw b/bacula/src/filed/win32/Makefile.mingw index 978699c2d5..4a3e36ff77 100644 --- a/bacula/src/filed/win32/Makefile.mingw +++ b/bacula/src/filed/win32/Makefile.mingw @@ -46,7 +46,7 @@ win32: winlib.a winlib.a: $(BACOBJS) winres.res ar rcs $@ $(BACOBJS) -winres.res: winres.rc bacula.ico winres.h idle.ico running.ico error.ico +winres.res: winres.rc bacula.ico winres.h idle.ico running.ico error.ico warn.ico windres -DHAVE_MINGW $< -O coff -o $@ winmain.o: winmain.cpp winbacula.h diff --git a/bacula/src/filed/win32/warn.ico b/bacula/src/filed/win32/warn.ico new file mode 100644 index 0000000000..26e1d398bb Binary files /dev/null and b/bacula/src/filed/win32/warn.ico differ diff --git a/bacula/src/filed/win32/winmain.cpp b/bacula/src/filed/win32/winmain.cpp index 625146ae20..6cbf0309e1 100755 --- a/bacula/src/filed/win32/winmain.cpp +++ b/bacula/src/filed/win32/winmain.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2003 Kern Sibbald and John Walker + Copyright (C) 2000-2004 Kern Sibbald and John Walker This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -18,7 +18,6 @@ This file is patterned after the VNC Win32 code by ATT - Copyright (2000) Kern E. Sibbald */ #ifndef HAVE_WIN32 diff --git a/bacula/src/filed/win32/winres.h b/bacula/src/filed/win32/winres.h index a1f52e9f26..66a84c1b86 100755 --- a/bacula/src/filed/win32/winres.h +++ b/bacula/src/filed/win32/winres.h @@ -7,7 +7,9 @@ #define IDI_IDLE 101 #define IDI_RUNNING 102 #define IDI_JOB_ERROR 103 -#define IDR_TRAYMENU 104 +#define IDI_JOB_WARNING 104 +#define IDR_TRAYMENU 105 +#define IDB_BACULABMP 106 #define IDC_LIST 1000 #define IDC_NONYET_LABEL 1006 @@ -42,4 +44,3 @@ #define IDD_EVENTS 203 -#define IDB_BACULABMP 106 diff --git a/bacula/src/filed/win32/winres.rc b/bacula/src/filed/win32/winres.rc index e4e997b141..3c19cc85ef 100644 --- a/bacula/src/filed/win32/winres.rc +++ b/bacula/src/filed/win32/winres.rc @@ -14,6 +14,7 @@ IDI_BACULA ICON DISCARDABLE "bacula.ico" IDI_IDLE ICON DISCARDABLE "idle.ico" IDI_RUNNING ICON DISCARDABLE "running.ico" IDI_JOB_ERROR ICON DISCARDABLE "error.ico" +IDI_JOB_WARNING ICON DISCARDABLE "warn.ico" ///////////////////////////////////////////////////////////////////////////// // diff --git a/bacula/src/filed/win32/winservice.cpp b/bacula/src/filed/win32/winservice.cpp index 2bac945a27..0111087d2f 100755 --- a/bacula/src/filed/win32/winservice.cpp +++ b/bacula/src/filed/win32/winservice.cpp @@ -38,6 +38,7 @@ #include +#undef PASCAL #include "winbacula.h" #include "winservice.h" #include "wintray.h" diff --git a/bacula/src/filed/win32/wintray.cpp b/bacula/src/filed/win32/wintray.cpp index 933e613573..3105220eed 100755 --- a/bacula/src/filed/win32/wintray.cpp +++ b/bacula/src/filed/win32/wintray.cpp @@ -25,7 +25,7 @@ // by Kern E. Sibbald. Many thanks to ATT and James Weatherall, // the original author, for providing an excellent template. // -// Copyright (2000-2003) Kern E. Sibbald +// Copyright 2000-2004, Kern E. Sibbald // @@ -41,6 +41,8 @@ // Header #include "wintray.h" +#include "bacula.h" +#include "jcr.h" // Constants #ifdef properties_implemented @@ -55,7 +57,7 @@ const UINT MENU_ADD_CLIENT_MSG = RegisterWindowMessage("Bacula.AddClient.Message const char *MENU_CLASS_NAME = "Bacula Tray Icon"; extern void terminate_filed(int sig); -extern char *bac_status(int stat); +extern char *bac_status(char *buf, int buf_len); extern int bacstat; // Implementation @@ -102,9 +104,10 @@ bacMenu::bacMenu() SetTimer(m_hwnd, 1, 5000, NULL); // Load the icons for the tray - m_idle_icon = LoadIcon(hAppInstance, MAKEINTRESOURCE(IDI_IDLE)); + m_idle_icon = LoadIcon(hAppInstance, MAKEINTRESOURCE(IDI_IDLE)); m_running_icon = LoadIcon(hAppInstance, MAKEINTRESOURCE(IDI_RUNNING)); - m_error_icon = LoadIcon(hAppInstance, MAKEINTRESOURCE(IDI_JOB_ERROR)); + m_error_icon = LoadIcon(hAppInstance, MAKEINTRESOURCE(IDI_JOB_ERROR)); + m_warn_icon = LoadIcon(hAppInstance, MAKEINTRESOURCE(IDI_JOB_WARNING)); // Load the popup menu m_hmenu = LoadMenu(hAppInstance, MAKEINTRESOURCE(IDR_TRAYMENU)); @@ -139,23 +142,42 @@ bacMenu::DelTrayIcon() void bacMenu::UpdateTrayIcon(int bacstat) { - (void *)bac_status(0); + (void *)bac_status(NULL, 0); SendTrayMsg(NIM_MODIFY, bacstat); } void bacMenu::SendTrayMsg(DWORD msg, int bacstat) { + struct s_last_job *job; + // Create the tray icon message m_nid.hWnd = m_hwnd; m_nid.cbSize = sizeof(m_nid); m_nid.uID = IDI_BACULA; // never changes after construction - if (bacstat == 0) + switch (bacstat) { + case 0: m_nid.hIcon = m_idle_icon; - else if (bacstat == 1) + break; + case JS_Running: m_nid.hIcon = m_running_icon; - else if (bacstat < 0) + break; + case JS_ErrorTerminated: m_nid.hIcon = m_error_icon; + break; + default: + if (last_jobs->size() > 0) { + job = (struct s_last_job *)last_jobs->last(); + if (job->Errors) { + m_nid.hIcon = m_warn_icon; + } else { + m_nid.hIcon = m_idle_icon; + } + } else { + m_nid.hIcon = m_idle_icon; + } + break; + } m_nid.uFlags = NIF_ICON | NIF_MESSAGE; m_nid.uCallbackMessage = WM_TRAYNOTIFY; @@ -168,7 +190,7 @@ bacMenu::SendTrayMsg(DWORD msg, int bacstat) // Try to add the Bacula status to the tip string, if possible if (m_nid.uFlags & NIF_TIP) { - strncpy(m_nid.szTip, bac_status(0), (sizeof(m_nid.szTip)-1)); + bac_status(m_nid.szTip, sizeof(m_nid.szTip)); } // Send the message @@ -201,24 +223,12 @@ LRESULT CALLBACK bacMenu::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP if (bacService::RunningAsService()) { // Attempt to add the icon if it's not already there _this->AddTrayIcon(); - // Trigger a check of the current user -// PostMessage(hwnd, WM_USERCHANGED, 0, 0); } // Update the icon _this->UpdateTrayIcon(bacstat); break; -#ifdef xxx_needed - - // DEAL WITH NOTIFICATIONS FROM THE SERVER: - case WM_SRV_CLIENT_AUTHENTICATED: - case WM_SRV_CLIENT_DISCONNECT: - // Adjust the icon accordingly - _this->UpdateTrayIcon(bacstat); - return 0; -#endif - // STANDARD MESSAGE HANDLING case WM_CREATE: return 0; @@ -311,61 +321,32 @@ LRESULT CALLBACK bacMenu::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP return 0; case WM_QUERYENDSESSION: - // Are we running as a system service? - // Or is the system shutting down (in which case we should check anyway!) - if ((!bacService::RunningAsService()) || (lParam == 0)) { - // No, so we are about to be killed + // Are we running as a system service? + // Or is the system shutting down (in which case we should check anyway!) + if ((!bacService::RunningAsService()) || (lParam == 0)) { + // No, so we are about to be killed - // If there are remote connections then we should verify - // that the user is happy about killing them. + // If there are remote connections then we should verify + // that the user is happy about killing them. - // Finally, post a quit message, just in case - PostQuitMessage(0); - return TRUE; - } - - // Tell the OS that we've handled it anyway -// PostQuitMessage(0); - return TRUE; + // Finally, post a quit message, just in case + PostQuitMessage(0); + return TRUE; + } + return TRUE; default: - if (iMsg == MENU_ABOUTBOX_SHOW) { - // External request to show our About dialog - PostMessage(hwnd, WM_COMMAND, MAKELONG(ID_ABOUT, 0), 0); - return 0; - } - if (iMsg == MENU_STATUS_SHOW) { - // External request to show our status - PostMessage(hwnd, WM_COMMAND, MAKELONG(ID_STATUS, 0), 0); - return 0; - } - -#ifdef xxx_needed - if (iMsg == MENU_EVENTS_SHOW) { - // External request to show our Events dialogue - PostMessage(hwnd, WM_COMMAND, MAKELONG(ID_EVENTS, 0), 0); - return 0; - } - - if (iMsg == MENU_SERVICEHELPER_MSG) { - // External ServiceHelper message. - // This message holds a process id which we can use to - // impersonate a specific user. In doing so, we can load their - // preferences correctly - bacService::ProcessUserHelperMessage(wParam, lParam); - - // - Trigger a check of the current user - PostMessage(hwnd, WM_USERCHANGED, 0, 0); - return 0; - } - if (iMsg == MENU_ADD_CLIENT_MSG) { - // Add Client message. This message includes an IP address - // of a listening client, to which we should connect. - - return 0; - } -#endif + if (iMsg == MENU_ABOUTBOX_SHOW) { + // External request to show our About dialog + PostMessage(hwnd, WM_COMMAND, MAKELONG(ID_ABOUT, 0), 0); + return 0; + } + if (iMsg == MENU_STATUS_SHOW) { + // External request to show our status + PostMessage(hwnd, WM_COMMAND, MAKELONG(ID_STATUS, 0), 0); + return 0; + } } // Message not recognised diff --git a/bacula/src/filed/win32/wintray.h b/bacula/src/filed/win32/wintray.h index 0b210282af..54f418355b 100755 --- a/bacula/src/filed/win32/wintray.h +++ b/bacula/src/filed/win32/wintray.h @@ -72,21 +72,22 @@ protected: protected: // About dialog for this server - bacAbout m_about; + bacAbout m_about; // Status dialog for this server - bacStatus m_status; + bacStatus m_status; - bacEvents m_events; + bacEvents m_events; - HWND m_hwnd; - HMENU m_hmenu; - NOTIFYICONDATA m_nid; + HWND m_hwnd; + HMENU m_hmenu; + NOTIFYICONDATA m_nid; // The icon handles - HICON m_idle_icon; - HICON m_running_icon; - HICON m_error_icon; + HICON m_idle_icon; + HICON m_running_icon; + HICON m_error_icon; + HICON m_warn_icon; }; diff --git a/bacula/src/gnome2-console/console_conf.c b/bacula/src/gnome2-console/console_conf.c index 1e0b3daffc..44f81a5c31 100644 --- a/bacula/src/gnome2-console/console_conf.c +++ b/bacula/src/gnome2-console/console_conf.c @@ -49,7 +49,7 @@ */ int r_first = R_FIRST; int r_last = R_LAST; -static RES *sres_head[R_LAST - R_FIRST]; +static RES *sres_head[R_LAST - R_FIRST + 1]; RES **res_head = sres_head; /* Forward referenced subroutines */ diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 1c9471e9aa..dbb707663d 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -261,7 +261,7 @@ struct JCR { */ struct s_last_job { dlink link; - int xNumJobs; /* no longer used */ + int Errors; /* FD/SD errors */ int JobType; int JobStatus; int JobLevel; diff --git a/bacula/src/lib/bnet_server.c b/bacula/src/lib/bnet_server.c index 74903b83fc..f4cc057527 100644 --- a/bacula/src/lib/bnet_server.c +++ b/bacula/src/lib/bnet_server.c @@ -134,7 +134,7 @@ bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_w for (;!quit;) { fd_set sockset; FD_ZERO(&sockset); - FD_SET(sockfd, &sockset); + FD_SET((unsigned)sockfd, &sockset); errno = 0; if ((stat = select(sockfd+1, &sockset, NULL, NULL, NULL)) < 0) { if (errno == EINTR || errno == EAGAIN) { @@ -281,7 +281,7 @@ bnet_accept(BSOCK *bsock, char *who) * Wait for a connection from the client process. */ FD_ZERO(&sockset); - FD_SET(bsock->fd, &sockset); + FD_SET((unsigned)bsock->fd, &sockset); for (;;) { /* diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index eebb5244de..6fb681a661 100755 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -263,6 +263,7 @@ static void free_common_jcr(JCR *jcr) case JT_RESTORE: case JT_ADMIN: num_jobs_run++; + last_job.Errors = jcr->Errors; last_job.JobType = jcr->JobType; last_job.JobId = jcr->JobId; last_job.VolSessionId = jcr->VolSessionId; diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index b0f604c1dc..2cf95e805f 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -35,7 +35,7 @@ extern int debug_level; /* First and last resource ids */ int r_first = R_FIRST; int r_last = R_LAST; -static RES *sres_head[R_LAST - R_FIRST]; +static RES *sres_head[R_LAST - R_FIRST + 1]; RES **res_head = sres_head; diff --git a/bacula/src/win32/Makefile.in b/bacula/src/win32/Makefile.in index e50f33cda3..ad25c46f98 100644 --- a/bacula/src/win32/Makefile.in +++ b/bacula/src/win32/Makefile.in @@ -55,7 +55,7 @@ installer: winbacula.exe # Build installer # winbacula.exe: bacula - ${MAKENSIS} winbacula.nsi + ${MAKENSIS} /V2 winbacula.nsi Makefile: $(srcdir)/Makefile.in $(topdir)/config.status winbacula.nsi.in diff --git a/bacula/src/win32/baculafd/baculafd.dsp b/bacula/src/win32/baculafd/baculafd.dsp index de30b7555d..3eef2871f3 100644 --- a/bacula/src/win32/baculafd/baculafd.dsp +++ b/bacula/src/win32/baculafd/baculafd.dsp @@ -59,22 +59,22 @@ LINK32=link.exe # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" -# PROP Use_MFC 2 +# PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../compat" /I "../.." /I "../../../../depkgs-win32/pthreads" /I "../../../../depkgs-win32/zlib" /I "." /D "_DEBUG" /D "_WINMAIN_" /D "PTW32_BUILD" /D "_AFXDLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_WIN32" /FR /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../compat" /I "../.." /I "../../../../depkgs-win32/pthreads" /I "../../../../depkgs-win32/zlib" /I "." /D "_DEBUG" /D "_WINMAIN_" /D "PTW32_BUILD" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_WIN32" /FR /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 wsock32.lib pthreadVCE.lib zlib.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"Debug/bacula-fd.exe" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" +# ADD LINK32 user32.lib advapi32.lib gdi32.lib wsock32.lib shell32.lib pthreadVCE.lib zlib.lib kernel32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"MSVCRT.lib" /out:"Debug/bacula-fd.exe" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" !ENDIF diff --git a/bacula/src/win32/baculafd/baculafd.mak b/bacula/src/win32/baculafd/baculafd.mak index 6e8579d6ce..8dd3586b2d 100644 --- a/bacula/src/win32/baculafd/baculafd.mak +++ b/bacula/src/win32/baculafd/baculafd.mak @@ -25,6 +25,9 @@ NULL= NULL=nul !ENDIF +CPP=cl.exe +RSC=rc.exe + !IF "$(CFG)" == "baculafd - Win32 Release" OUTDIR=.\Release @@ -51,6 +54,7 @@ CLEAN : -@erase "$(INTDIR)\bshm.obj" -@erase "$(INTDIR)\bsys.obj" -@erase "$(INTDIR)\btime.obj" + -@erase "$(INTDIR)\btimers.obj" -@erase "$(INTDIR)\compat.obj" -@erase "$(INTDIR)\cram-md5.obj" -@erase "$(INTDIR)\crc32.obj" @@ -92,7 +96,6 @@ CLEAN : -@erase "$(INTDIR)\smartall.obj" -@erase "$(INTDIR)\status.obj" -@erase "$(INTDIR)\StdAfx.obj" - -@erase "$(INTDIR)\btimers.obj" -@erase "$(INTDIR)\tree.obj" -@erase "$(INTDIR)\util.obj" -@erase "$(INTDIR)\var.obj" @@ -114,47 +117,14 @@ CLEAN : "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" -CPP=cl.exe CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "../compat" /I "../.." /I "../../../../depkgs-win32/pthreads" /I "../../../../depkgs-win32/zlib" /I "." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_WIN32" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe RSC_PROJ=/l 0x409 /fo"$(INTDIR)\winres.res" /d "NDEBUG" BSC32=bscmake.exe BSC32_FLAGS=/nologo /o"$(OUTDIR)\baculafd.bsc" BSC32_SBRS= \ LINK32=link.exe -LINK32_FLAGS=user32.lib ADVAPI32.LIB gdi32.lib wsock32.lib shell32.lib pthreadVCE.lib zlib.lib /nologo /subsystem:windows /pdb:none /machine:I386 /nodefaultlib:"MSVCRT.lib" /out:"$(OUTDIR)\bacula-fd.exe" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" +LINK32_FLAGS=user32.lib advapi32.lib gdi32.lib wsock32.lib shell32.lib pthreadVCE.lib zlib.lib /nologo /subsystem:windows /pdb:none /machine:I386 /nodefaultlib:"MSVCRT.lib" /out:"$(OUTDIR)\bacula-fd.exe" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" LINK32_OBJS= \ "$(INTDIR)\alist.obj" \ "$(INTDIR)\alloc.obj" \ @@ -170,6 +140,7 @@ LINK32_OBJS= \ "$(INTDIR)\bshm.obj" \ "$(INTDIR)\bsys.obj" \ "$(INTDIR)\btime.obj" \ + "$(INTDIR)\btimers.obj" \ "$(INTDIR)\compat.obj" \ "$(INTDIR)\cram-md5.obj" \ "$(INTDIR)\crc32.obj" \ @@ -211,7 +182,6 @@ LINK32_OBJS= \ "$(INTDIR)\smartall.obj" \ "$(INTDIR)\status.obj" \ "$(INTDIR)\StdAfx.obj" \ - "$(INTDIR)\btimers.obj" \ "$(INTDIR)\tree.obj" \ "$(INTDIR)\util.obj" \ "$(INTDIR)\var.obj" \ @@ -273,6 +243,8 @@ CLEAN : -@erase "$(INTDIR)\bsys.sbr" -@erase "$(INTDIR)\btime.obj" -@erase "$(INTDIR)\btime.sbr" + -@erase "$(INTDIR)\btimers.obj" + -@erase "$(INTDIR)\btimers.sbr" -@erase "$(INTDIR)\compat.obj" -@erase "$(INTDIR)\compat.sbr" -@erase "$(INTDIR)\cram-md5.obj" @@ -355,8 +327,6 @@ CLEAN : -@erase "$(INTDIR)\status.sbr" -@erase "$(INTDIR)\StdAfx.obj" -@erase "$(INTDIR)\StdAfx.sbr" - -@erase "$(INTDIR)\btimers.obj" - -@erase "$(INTDIR)\btimers.sbr" -@erase "$(INTDIR)\tree.obj" -@erase "$(INTDIR)\tree.sbr" -@erase "$(INTDIR)\util.obj" @@ -394,41 +364,8 @@ CLEAN : "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../compat" /I "../.." /I "../../../../depkgs-win32/pthreads" /I "../../../../depkgs-win32/zlib" /I "." /D "_DEBUG" /D "_WINMAIN_" /D "PTW32_BUILD" /D "_AFXDLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_WIN32" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\winres.res" /d "_DEBUG" /d "_AFXDLL" +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "../compat" /I "../.." /I "../../../../depkgs-win32/pthreads" /I "../../../../depkgs-win32/zlib" /I "." /D "_DEBUG" /D "_WINMAIN_" /D "PTW32_BUILD" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_WIN32" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\winres.res" /d "_DEBUG" BSC32=bscmake.exe BSC32_FLAGS=/nologo /o"$(OUTDIR)\baculafd.bsc" BSC32_SBRS= \ @@ -446,6 +383,7 @@ BSC32_SBRS= \ "$(INTDIR)\bshm.sbr" \ "$(INTDIR)\bsys.sbr" \ "$(INTDIR)\btime.sbr" \ + "$(INTDIR)\btimers.sbr" \ "$(INTDIR)\compat.sbr" \ "$(INTDIR)\cram-md5.sbr" \ "$(INTDIR)\crc32.sbr" \ @@ -487,7 +425,6 @@ BSC32_SBRS= \ "$(INTDIR)\smartall.sbr" \ "$(INTDIR)\status.sbr" \ "$(INTDIR)\StdAfx.sbr" \ - "$(INTDIR)\btimers.sbr" \ "$(INTDIR)\tree.sbr" \ "$(INTDIR)\util.sbr" \ "$(INTDIR)\var.sbr" \ @@ -509,7 +446,7 @@ BSC32_SBRS= \ << LINK32=link.exe -LINK32_FLAGS=user32.lib ADVAPI32.LIB gdi32.lib shell32.lib wsock32.lib pthreadVCE.lib zlib.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"$(OUTDIR)\bacula-fd.exe" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" +LINK32_FLAGS=user32.lib advapi32.lib gdi32.lib shell32.lib wsock32.lib pthreadVCE.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"MSVCRT.lib" /out:"$(OUTDIR)\bacula-fd.exe" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" LINK32_OBJS= \ "$(INTDIR)\alist.obj" \ "$(INTDIR)\alloc.obj" \ @@ -525,6 +462,7 @@ LINK32_OBJS= \ "$(INTDIR)\bshm.obj" \ "$(INTDIR)\bsys.obj" \ "$(INTDIR)\btime.obj" \ + "$(INTDIR)\btimers.obj" \ "$(INTDIR)\compat.obj" \ "$(INTDIR)\cram-md5.obj" \ "$(INTDIR)\crc32.obj" \ @@ -566,7 +504,6 @@ LINK32_OBJS= \ "$(INTDIR)\smartall.obj" \ "$(INTDIR)\status.obj" \ "$(INTDIR)\StdAfx.obj" \ - "$(INTDIR)\btimers.obj" \ "$(INTDIR)\tree.obj" \ "$(INTDIR)\util.obj" \ "$(INTDIR)\var.obj" \ @@ -590,6 +527,36 @@ LINK32_OBJS= \ !ENDIF +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + !IF "$(NO_EXTERNAL_DEPS)" != "1" !IF EXISTS("baculafd.dep") @@ -851,6 +818,24 @@ SOURCE=..\lib\btime.cpp $(CPP) $(CPP_PROJ) $(SOURCE) +!ENDIF + +SOURCE=..\lib\btimers.cpp + +!IF "$(CFG)" == "baculafd - Win32 Release" + + +"$(INTDIR)\btimers.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "baculafd - Win32 Debug" + + +"$(INTDIR)\btimers.obj" "$(INTDIR)\btimers.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + !ENDIF SOURCE=..\compat\compat.cpp @@ -1587,24 +1572,6 @@ SOURCE=.\StdAfx.cpp "$(INTDIR)\StdAfx.obj" "$(INTDIR)\StdAfx.sbr" : $(SOURCE) "$(INTDIR)" -!ENDIF - -SOURCE=..\lib\btimers.cpp - -!IF "$(CFG)" == "baculafd - Win32 Release" - - -"$(INTDIR)\btimers.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "baculafd - Win32 Debug" - - -"$(INTDIR)\btimers.obj" "$(INTDIR)\btimers.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - !ENDIF SOURCE=..\lib\tree.cpp @@ -1800,7 +1767,7 @@ SOURCE=..\..\filed\win32\winres.rc "$(INTDIR)\winres.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\winres.res" /i "..\..\filed\win32" /d "_DEBUG" /d "_AFXDLL" $(SOURCE) + $(RSC) /l 0x409 /fo"$(INTDIR)\winres.res" /i "..\..\filed\win32" /d "_DEBUG" $(SOURCE) !ENDIF diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index 5c7823e2a3..9c30771b58 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -44,11 +44,6 @@ #include #include #include - -#ifdef HAVE_WXCONSOLE -//#include -#endif - #include #include #include @@ -78,15 +73,15 @@ #include "getopt.h" -#ifdef HAVE_MINGW #define HAVE_WIN32 1 -#else + +#ifndef HAVE_MINGW #ifdef HAVE_CYGWIN #error should not be used under cygwin... #else -#define HAVE_WIN32 1 #endif //HAVE_CYGWIN #endif //HAVE_MINGW + typedef UINT64 u_int64_t; typedef UINT64 uint64_t; typedef INT64 int64_t; @@ -98,6 +93,8 @@ typedef float float32_t; typedef unsigned short uint16_t; typedef signed short int16_t; typedef long time_t; +typedef signed char int8_t; + #if __STDC__ #ifndef HAVE_MINGW typedef _dev_t dev_t; @@ -109,13 +106,14 @@ typedef __int64 off_t; /* STDC=1 means we can define this */ #else typedef long _off_t; /* must be same as sys/types.h */ #endif -typedef signed char int8_t; + #ifndef HAVE_MINGW #ifndef HAVE_WXCONSOLE typedef int BOOL; #define bool BOOL #endif #endif + typedef double float64_t; typedef UINT32 u_int32_t; typedef unsigned char u_int8_t; @@ -202,6 +200,11 @@ struct stat #define S_IRUSR S_IREAD #define S_IWUSR S_IWRITE #define S_IXUSR S_IEXEC +#define S_ISREG(x) (((x) & S_IFREG) == S_IFREG) +#define S_ISDIR(x) (((x) & S_IFDIR) == S_IFDIR) +#define S_ISCHR(x) 0 +#define S_ISBLK(x) 0 +#define S_ISFIFO(x) 0 #endif //HAVE_MINGW #define S_IRGRP 000040 @@ -217,19 +220,9 @@ struct stat #define S_ISUID 004000 #define S_ISGID 002000 #define S_ISVTX 001000 - -#ifndef HAVE_MINGW -#define S_ISREG(x) (((x) & S_IFREG) == S_IFREG) -#define S_ISDIR(x) (((x) & S_IFDIR) == S_IFDIR) -#define S_ISCHR(x) 0 -#define S_ISBLK(x) 0 -#define S_ISFIFO(x) 0 -#endif //HAVE_MINGW - #define S_ISSOCK(x) 0 #define S_ISLNK(x) 0 - #if __STDC__ #define O_RDONLY _O_RDONLY #define O_WRONLY _O_WRONLY @@ -241,23 +234,13 @@ struct stat #define toascii __toascii #define iscsymf __iscsymf #define iscsym __iscsym - #endif -#define SIGUSR2 9999 + int umask(int); int lchown(const char *, uid_t uid, gid_t gid); int chown(const char *, uid_t uid, gid_t gid); int chmod(const char *, mode_t mode); -#ifndef HAVE_MINGW -int utime(const char *filename, struct utimbuf *buf); -int open(const char *, int, int); -#ifndef HAVE_WXCONSOLE -ssize_t read(int fd, void *, size_t nbytes); -ssize_t write(int fd, const void *, size_t nbytes); -#endif -int close(int fd); -#endif //HAVE_MINGW off_t lseek(int, off_t, int); int inet_aton(const char *cp, struct in_addr *inp); int kill(int pid, int signo); @@ -265,16 +248,10 @@ int pipe(int []); int fork(); int dup2(int, int); int waitpid(int, int *, int); -#define WNOHANG 0 -#define WIFEXITED(x) 0 -#define WEXITSTATUS(x) x -#define WIFSIGNALED(x) 0 - -#define SIGKILL 9 - -#define HAVE_OLD_SOCKOPT #ifndef HAVE_MINGW +int utime(const char *filename, struct utimbuf *buf); +int open(const char *, int, int); #define vsnprintf __vsnprintf int __vsnprintf(char *s, size_t count, const char *format, va_list args); @@ -286,11 +263,27 @@ int __snprintf(char *str, size_t count, const char *fmt, ...); #define sprintf __sprintf int __sprintf(char *str, const char *fmt, ...); + +#ifndef HAVE_WXCONSOLE +ssize_t read(int fd, void *, size_t nbytes); +ssize_t write(int fd, const void *, size_t nbytes); +#endif + +int close(int fd); #endif //HAVE_MINGW + +#define WNOHANG 0 +#define WIFEXITED(x) 0 +#define WEXITSTATUS(x) x +#define WIFSIGNALED(x) 0 +#define SIGKILL 9 +#define SIGUSR2 9999 + +#define HAVE_OLD_SOCKOPT + int readdir(unsigned int fd, struct dirent *dirp, unsigned int count); int nanosleep(const struct timespec*, struct timespec *); - struct tm *localtime_r(const time_t *, struct tm *); struct tm *gmtime_r(const time_t *, struct tm *); long int random(void); @@ -333,15 +326,12 @@ struct sigaction { #define mkdir(p, m) _mkdir(p) #define chdir win32_chdir - -#ifndef HAVE_MINGW -int stat(const char *, struct stat *); -#endif //HAVE_MINGW int syslog(int, const char *, const char *); #define LOG_DAEMON 0 #define LOG_ERR 0 #ifndef HAVE_MINGW +int stat(const char *, struct stat *); #ifdef __cplusplus #define access _access extern "C" _CRTIMP int __cdecl _access(const char *, int); diff --git a/bacula/src/win32/console/console.dep b/bacula/src/win32/console/console.dep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/wx-console/wx-console.dep b/bacula/src/win32/wx-console/wx-console.dep new file mode 100755 index 0000000000..e69de29bb2 diff --git a/bacula/src/wx-console/console_conf.c b/bacula/src/wx-console/console_conf.c index 6c78dbb9ec..e112c58e31 100644 --- a/bacula/src/wx-console/console_conf.c +++ b/bacula/src/wx-console/console_conf.c @@ -47,7 +47,7 @@ */ int r_first = R_FIRST; int r_last = R_LAST; -static RES *sres_head[R_LAST - R_FIRST]; +static RES *sres_head[R_LAST - R_FIRST + 1]; RES **res_head = sres_head; /* Forward referenced subroutines */