}
if (type == M_ABORT || type == M_ERROR_TERM) {
-#if !defined(HAVE_WIN32)
fputs(dt, stdout);
fputs(msg, stdout); /* print this here to INSURE that it is printed */
fflush(stdout);
-#endif
}
/* Now figure out where to send the message */
{
POOLMEM *cleanup = get_pool_memory(PM_MESSAGE);
int len = strlen(me->working_directory);
+#if defined(HAVE_WIN32)
+ pm_strcpy(cleanup, "del /q ");
+#else
pm_strcpy(cleanup, "/bin/rm -f ");
+#endif
pm_strcat(cleanup, me->working_directory);
- if (len > 0 && me->working_directory[len-1] != '/') {
+ if (len > 0 && me->working_directory[len-1] != '/'
+#if defined(HAVE_WIN32)
+ && me->working_directory[len-1] != '\\'
+#endif
+ ) {
pm_strcat(cleanup, "/");
}
pm_strcat(cleanup, my_name);
pm_strcat(cleanup, "*.spool");
run_program(cleanup, 0, NULL);
free_pool_memory(cleanup);
-}
+}
/*
t_SetProcessShutdownParameters p_SetProcessShutdownParameters = NULL;
-t_CreateFileA p_CreateFileA = NULL;
-t_CreateFileW p_CreateFileW = NULL;
-t_CreateDirectoryA p_CreateDirectoryA;
-t_CreateDirectoryW p_CreateDirectoryW;
+t_CreateFileA p_CreateFileA = NULL;
+t_CreateFileW p_CreateFileW = NULL;
+t_CreateDirectoryA p_CreateDirectoryA;
+t_CreateDirectoryW p_CreateDirectoryW;
-t_wunlink p_wunlink = NULL;
-t_wmkdir p_wmkdir = NULL;
+t_wunlink p_wunlink = NULL;
+t_wmkdir p_wmkdir = NULL;
t_GetFileAttributesA p_GetFileAttributesA = NULL;
t_GetFileAttributesW p_GetFileAttributesW = NULL;
t_SetFileAttributesW p_SetFileAttributesW = NULL;
t_BackupRead p_BackupRead = NULL;
t_BackupWrite p_BackupWrite = NULL;
-t_WideCharToMultiByte p_WideCharToMultiByte = NULL;
-t_MultiByteToWideChar p_MultiByteToWideChar = NULL;
+t_WideCharToMultiByte p_WideCharToMultiByte = NULL;
+t_MultiByteToWideChar p_MultiByteToWideChar = NULL;
-t_FindFirstFileA p_FindFirstFileA = NULL;
-t_FindFirstFileW p_FindFirstFileW = NULL;
+t_AttachConsole p_AttachConsole = NULL;
-t_FindNextFileA p_FindNextFileA = NULL;
-t_FindNextFileW p_FindNextFileW = NULL;
+t_FindFirstFileA p_FindFirstFileA = NULL;
+t_FindFirstFileW p_FindFirstFileW = NULL;
-t_SetCurrentDirectoryA p_SetCurrentDirectoryA = NULL;
-t_SetCurrentDirectoryW p_SetCurrentDirectoryW = NULL;
+t_FindNextFileA p_FindNextFileA = NULL;
+t_FindNextFileW p_FindNextFileW = NULL;
-t_GetCurrentDirectoryA p_GetCurrentDirectoryA = NULL;
-t_GetCurrentDirectoryW p_GetCurrentDirectoryW = NULL;
+t_SetCurrentDirectoryA p_SetCurrentDirectoryA = NULL;
+t_SetCurrentDirectoryW p_SetCurrentDirectoryW = NULL;
-t_GetVolumePathNameW p_GetVolumePathNameW = NULL;
+t_GetCurrentDirectoryA p_GetCurrentDirectoryA = NULL;
+t_GetCurrentDirectoryW p_GetCurrentDirectoryW = NULL;
+
+t_GetVolumePathNameW p_GetVolumePathNameW = NULL;
t_GetVolumeNameForVolumeMountPointW p_GetVolumeNameForVolumeMountPointW = NULL;
void
if (g_platform_id != VER_PLATFORM_WIN32_WINDOWS) {
p_CreateFileW = (t_CreateFileW)
- GetProcAddress(hLib, "CreateFileW");
+ GetProcAddress(hLib, "CreateFileW");
p_CreateDirectoryW = (t_CreateDirectoryW)
- GetProcAddress(hLib, "CreateDirectoryW");
+ GetProcAddress(hLib, "CreateDirectoryW");
/* backup calls */
p_BackupRead = (t_BackupRead)
p_SetFileAttributesW = (t_SetFileAttributesW)
GetProcAddress(hLib, "SetFileAttributesW");
p_FindFirstFileW = (t_FindFirstFileW)
- GetProcAddress(hLib, "FindFirstFileW");
+ GetProcAddress(hLib, "FindFirstFileW");
p_FindNextFileW = (t_FindNextFileW)
GetProcAddress(hLib, "FindNextFileW");
p_GetCurrentDirectoryW = (t_GetCurrentDirectoryW)
- GetProcAddress(hLib, "GetCurrentDirectoryW");
+ GetProcAddress(hLib, "GetCurrentDirectoryW");
p_SetCurrentDirectoryW = (t_SetCurrentDirectoryW)
- GetProcAddress(hLib, "SetCurrentDirectoryW");
+ GetProcAddress(hLib, "SetCurrentDirectoryW");
/* some special stuff we need for VSS
but statically linkage doesn't work on Win 9x */
GetProcAddress(hLib, "GetVolumePathNameW");
p_GetVolumeNameForVolumeMountPointW = (t_GetVolumeNameForVolumeMountPointW)
GetProcAddress(hLib, "GetVolumeNameForVolumeMountPointW");
+
+ p_AttachConsole = (t_AttachConsole)
+ GetProcAddress(hLib, "AttachConsole");
}
FreeLibrary(hLib);
extern void LogErrorMsg(char *msg);
// Standard command-line flag definitions
-const char BaculaSilent[] = "/silent";
+const char BaculaOptDebug[] = "/debug";
const char BaculaRunService[] = "/service";
const char BaculaRunAsUserApp[] = "/run";
const char BaculaShowHelp[] = "/help";
// Usage string
-const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/help]\n";
+const char BaculaUsageText[] = "Bacula [/debug] [/service] [/run] [/kill] [/install] [/remove] [/help]\n";
void LogErrorMsg(char *msg, char *fname, int lineno);
#define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
extern void d_msg(const char *, int, int, const char *, ...);
/* Globals */
-HINSTANCE hAppInstance;
-const char *szAppName = "Bacula-dir";
-DWORD mainthreadId;
-bool silent = false;
+HINSTANCE hAppInstance;
+const char *szAppName = "Bacula-dir";
+DWORD mainthreadId;
+bool opt_debug = false;
/* Imported variables */
extern DWORD g_servicethread;
char *szCmdLine = CmdLine;
char *wordPtr, *tempPtr;
int i, quote;
- DWORD dwCharsWritten;
/* Save the application instance and main thread id */
hAppInstance = hInstance;
/* Now check for command-line arguments */
- /* /silent install quietly -- no prompts */
- if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
- silent = true;
- i += sizeof(BaculaSilent) - 1;
+ /* /debug install quietly -- no prompts */
+ if (strnicmp(&szCmdLine[i], BaculaOptDebug, sizeof(BaculaOptDebug) - 1) == 0) {
+ opt_debug = true;
+ i += sizeof(BaculaOptDebug) - 1;
continue;
}
/* /run (this is the default if no command line arguments) */
if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
/* Bacula is being run as a user-level program */
- if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
- AllocConsole();
- }
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
-
return BaculaAppMain();
}
/* /install */
return 1;
}
- /* If no arguments were given then just run */
- if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
- AllocConsole();
- }
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
-
return BaculaAppMain();
}
{
/* DWORD dwThreadID; */
pthread_t tid;
+ DWORD dwCharsWritten;
InitWinAPIWrapper();
WSA_Init();
+ /* If no arguments were given then just run */
+ if (p_AttachConsole == NULL || !p_AttachConsole(ATTACH_PARENT_PROCESS)) {
+ if (opt_debug) {
+ AllocConsole();
+ }
+ }
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
/* Set this process to be the last application to be shut down. */
if (p_SetProcessShutdownParameters) {
p_SetProcessShutdownParameters(0x100, 0);
bacService init;
-extern bool silent;
+extern bool opt_debug;
// SERVICE-MODE ROUTINES
CloseServiceHandle(hservice);
// Everything went fine
- if (!silent) {
+ if (opt_debug) {
MessageBox(NULL,
_("The Bacula Director service was successfully installed.\n"
"The service may be started from the Control Panel and will\n"
// Now remove the service from the SCM
if(DeleteService(hservice)) {
- if (!silent) {
+ if (opt_debug) {
MessageBox(NULL, _("The Bacula Director service has been removed"), szAppName, MB_ICONINFORMATION | MB_OK);
}
} else {
BOOL VSSClientGeneric::Initialize(DWORD dwContext, BOOL bDuringRestore)
{
if (!(p_CreateVssBackupComponents && p_VssFreeSnapshotProperties)) {
+ Dmsg2(0, "VSSClientGeneric::Initialize: p_CreateVssBackupComponents = 0x%08X, p_VssFreeSnapshotProperties = 0x%08X\n", p_CreateVssBackupComponents, p_VssFreeSnapshotProperties);
errno = ENOSYS;
return FALSE;
}
HRESULT hr;
- // Initialize COM
- if (!m_bCoInitializeCalled) {
- if (FAILED(CoInitialize(NULL))) {
+ // Initialize COM
+ if (!m_bCoInitializeCalled) {
+ hr = CoInitialize(NULL);
+ if (FAILED(hr)) {
+ Dmsg1(0, "VSSClientGeneric::Initialize: CoInitialize returned 0x%08X\n", hr);
errno = b_errno_win32;
return FALSE;
}
NULL // Reserved parameter
);
- if (FAILED(hr)) {
+ if (FAILED(hr)) {
+ Dmsg1(0, "VSSClientGeneric::Initialize: CoInitializeSecurity returned 0x%08X\n", hr);
errno = b_errno_win32;
return FALSE;
}
- m_bCoInitializeSecurityCalled = true;
+ m_bCoInitializeSecurityCalled = true;
}
-
+
// Release the IVssBackupComponents interface
if (m_pVssObject) {
m_pVssObject->Release();
// Create the internal backup components object
hr = p_CreateVssBackupComponents((IVssBackupComponents**) &m_pVssObject);
- if (FAILED(hr)) {
+ if (FAILED(hr)) {
+ Dmsg1(0, "VSSClientGeneric::Initialize: CreateVssBackupComponents returned 0x%08X\n", hr);
errno = b_errno_win32;
return FALSE;
}
if (dwContext != VSS_CTX_BACKUP) {
hr = ((IVssBackupComponents*) m_pVssObject)->SetContext(dwContext);
if (FAILED(hr)) {
+ Dmsg1(0, "VSSClientGeneric::Initialize: IVssBackupComponents->SetContext returned 0x%08X\n", hr);
errno = b_errno_win32;
return FALSE;
}
#endif
if (!bDuringRestore) {
- // 1. InitializeForBackup
- hr = ((IVssBackupComponents*) m_pVssObject)->InitializeForBackup();
- if (FAILED(hr)) {
- errno = b_errno_win32;
- return FALSE;
- }
+ // 1. InitializeForBackup
+ hr = ((IVssBackupComponents*) m_pVssObject)->InitializeForBackup();
+ if (FAILED(hr)) {
+ Dmsg1(0, "VSSClientGeneric::Initialize: IVssBackupComponents->InitializeForBackup returned 0x%08X\n", hr);
+ errno = b_errno_win32;
+ return FALSE;
+ }
- // 2. SetBackupState
- hr = ((IVssBackupComponents*) m_pVssObject)->SetBackupState(true, true, VSS_BT_FULL, false);
- if (FAILED(hr)) {
- errno = b_errno_win32;
- return FALSE;
- }
-
- CComPtr<IVssAsync> pAsync1;
- // 3. GatherWriterMetaData
- hr = ((IVssBackupComponents*) m_pVssObject)->GatherWriterMetadata(&pAsync1.p);
- if (FAILED(hr)) {
- errno = b_errno_win32;
- return FALSE;
- }
- // Waits for the async operation to finish and checks the result
- WaitAndCheckForAsyncOperation(pAsync1.p);
- }
+ // 2. SetBackupState
+ hr = ((IVssBackupComponents*) m_pVssObject)->SetBackupState(true, true, VSS_BT_FULL, false);
+ if (FAILED(hr)) {
+ Dmsg1(0, "VSSClientGeneric::Initialize: IVssBackupComponents->SetBackupState returned 0x%08X\n", hr);
+ errno = b_errno_win32;
+ return FALSE;
+ }
+ CComPtr<IVssAsync> pAsync1;
+ // 3. GatherWriterMetaData
+ hr = ((IVssBackupComponents*) m_pVssObject)->GatherWriterMetadata(&pAsync1.p);
+ if (FAILED(hr)) {
+ Dmsg1(0, "VSSClientGeneric::Initialize: IVssBackupComponents->GatherWriterMetadata returned 0x%08X\n", hr);
+ errno = b_errno_win32;
+ return FALSE;
+ }
+ // Waits for the async operation to finish and checks the result
+ WaitAndCheckForAsyncOperation(pAsync1.p);
+ }
// We are during restore now?
m_bDuringRestore = bDuringRestore;
bstrncpy(str, "\"", sizeof(str));
wchar_2_UTF8(szBuf, bstrWriterName.p, sizeof(szBuf));
bstrncat(str, szBuf, sizeof(str));
- bstrncat(str, "\", State: 0x",sizeof(str));
+ bstrncat(str, "\", State: 0x", sizeof(str));
itoa(eWriterStatus, szBuf, sizeof(szBuf));
bstrncat(str, szBuf, sizeof(str));
bstrncat(str, " (", sizeof(str));
HINSTANCE hAppInstance;
const char *szAppName = "Bacula-fd";
DWORD mainthreadId;
-bool silent = false;
+bool opt_debug = false;
/* Imported variables */
extern DWORD g_servicethread;
char *szCmdLine = CmdLine;
char *wordPtr, *tempPtr;
int i, quote;
- DWORD dwCharsWritten;
/* Save the application instance and main thread id */
hAppInstance = hInstance;
if (*szCmdLine != '"' && *wordPtr == '"') {
szCmdLine = wordPtr + 1;
}
-// MessageBox(NULL, szCmdLine, "Cmdline", MB_OK);
/* Build Unix style argc *argv[] */
/* Now check for command-line arguments */
- /* /silent install quietly -- no prompts */
- if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
- silent = true;
- i += sizeof(BaculaSilent) - 1;
+ /* /debug - enable debugging facilities such as console message window */
+ if (strnicmp(&szCmdLine[i], BaculaOptDebug, sizeof(BaculaOptDebug) - 1) == 0) {
+ opt_debug = true;
+ i += sizeof(BaculaOptDebug) - 1;
continue;
}
/* /run (this is the default if no command line arguments) */
if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
/* Bacula is being run as a user-level program */
- if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
- AllocConsole();
- }
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
-
return BaculaAppMain();
}
/* /install */
return 1;
}
- /* If no arguments were given then just run */
- if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
- AllocConsole();
- }
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
-
return BaculaAppMain();
}
{
DWORD old_servicethread = g_servicethread;
-
pthread_detach(pthread_self());
/* Since we are the only thread with a message loop
{
/* DWORD dwThreadID; */
pthread_t tid;
+ DWORD dwCharsWritten;
InitWinAPIWrapper();
+
+ /* If no arguments were given then just run */
+ if (p_AttachConsole == NULL || !p_AttachConsole(ATTACH_PARENT_PROCESS)) {
+ if (opt_debug) {
+ AllocConsole();
+ }
+ }
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
VSSInit();
WSA_Init();
bacService init;
-extern bool silent;
+extern bool opt_debug;
bacService::bacService()
{
RegCloseKey(runservices);
// We have successfully installed the service!
- if (!silent) {
+ if (opt_debug) {
MessageBox(NULL,
_("The Bacula File service was successfully installed.\n"
"The service may be started by double clicking on the\n"
CloseServiceHandle(hservice);
// Everything went fine
- if (!silent) {
+ if (opt_debug) {
MessageBox(NULL,
_("The Bacula File service was successfully installed.\n"
"The service may be started from the Control Panel and will\n"
}
// We have successfully removed the service!
- if (!silent) {
+ if (opt_debug) {
MessageBox(NULL, _("The Bacula service has been removed"), szAppName, MB_ICONINFORMATION | MB_OK);
}
break;
// Now remove the service from the SCM
if (DeleteService(hservice)) {
- if (!silent) {
+ if (opt_debug) {
MessageBox(NULL, _("The Bacula file service has been removed"), szAppName, MB_ICONINFORMATION | MB_OK);
}
} else {
${EndIf}
${If} ${FileExists} "$OldInstallDir\bin\bacula-fd.exe"
- ${If} $InstallType <> ${MigrateInstall}
- nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /silent /kill' ; Shutdown any bacula that could be running
- Sleep 3000
- nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /silent /remove' ; Remove existing service
- ${Else}
- nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
- Sleep 3000
- nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /remove' ; Remove existing service
- ${EndIf}
+ nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
+ Sleep 3000
+ nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /remove' ; Remove existing service
${EndIf}
${If} ${FileExists} "$OldInstallDir\bin\bacula-sd.exe"
- nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /silent /kill' ; Shutdown any bacula that could be running
+ nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running
Sleep 3000
- nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /silent /remove' ; Remove existing service
+ nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /remove' ; Remove existing service
${EndIf}
${If} ${FileExists} "$OldInstallDir\bin\bacula-dir.exe"
- nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /silent /kill' ; Shutdown any bacula that could be running
+ nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /kill' ; Shutdown any bacula that could be running
Sleep 3000
- nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /silent /remove' ; Remove existing service
+ nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /remove' ; Remove existing service
${EndIf}
SectionEnd
Section "Uninstall"
; Shutdown any baculum that could be running
- nsExec::ExecToLog '"$INSTDIR\bin\bacula-fd.exe" /silent /kill'
- nsExec::ExecToLog '"$INSTDIR\bin\bacula-sd.exe" /silent /kill'
- nsExec::ExecToLog '"$INSTDIR\bin\bacula-dir.exe" /silent /kill'
+ nsExec::ExecToLog '"$INSTDIR\bin\bacula-fd.exe" /kill'
+ nsExec::ExecToLog '"$INSTDIR\bin\bacula-sd.exe" /kill'
+ nsExec::ExecToLog '"$INSTDIR\bin\bacula-dir.exe" /kill'
Sleep 3000
ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd"
${If} $R0 = 1
; Remove bacula service
- nsExec::ExecToLog '"$INSTDIR\bin\bacula-fd.exe" /silent /remove'
+ nsExec::ExecToLog '"$INSTDIR\bin\bacula-fd.exe" /remove'
${EndIf}
ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-sd"
${If} $R0 = 1
; Remove bacula service
- nsExec::ExecToLog '"$INSTDIR\bin\bacula-sd.exe" /silent /remove'
+ nsExec::ExecToLog '"$INSTDIR\bin\bacula-sd.exe" /remove'
${EndIf}
ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-dir"
${If} $R0 = 1
; Remove bacula service
- nsExec::ExecToLog '"$INSTDIR\bin\bacula-dir.exe" /silent /remove'
+ nsExec::ExecToLog '"$INSTDIR\bin\bacula-dir.exe" /remove'
${EndIf}
; remove registry keys
WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2
${If} $2 = 1
- nsExec::ExecToLog '"$INSTDIR\bin\$0.exe" /silent /install -c "$APPDATA\Bacula\$0.conf"'
+ nsExec::ExecToLog '"$INSTDIR\bin\$0.exe" /install -c "$APPDATA\Bacula\$0.conf"'
${If} $OsIsNT <> 1
File "Start.bat"
File "Stop.bat"
${EndIf}
- ; Start the service? (default skipped if silent, use /start to force starting)
+ ; Start the service?
${If} $3 = 1
${If} $OsIsNT = 1
RuntimeLibrary="3"\r
UsePrecompiledHeader="0"\r
WarningLevel="3"\r
- Detect64BitPortabilityProblems="false"\r
SuppressStartupBanner="true"\r
+ Detect64BitPortabilityProblems="false"\r
DebugInformationFormat="4"\r
/>\r
<Tool\r
SuppressStartupBanner="true"\r
AdditionalLibraryDirectories="..\..\..\..\depkgs-msvc\lib"\r
ModuleDefinitionFile="msvc\bacula.def"\r
- ImportLibrary="$(TargetDir)libbac.lib"\r
GenerateDebugInformation="true"\r
+ ImportLibrary="$(TargetDir)libbac.lib"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\lib\protos.h"\r
+ RelativePath="..\..\findlib\protos.h"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\findlib\protos.h"\r
+ RelativePath="..\..\lib\protos.h"\r
>\r
</File>\r
<File\r
RelativePath="..\..\lib\watchdog.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\winapi.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\compat\winconfig.h"\r
>\r
extern void LogErrorMsg(char *msg);
// Standard command-line flag definitions
-const char BaculaSilent[] = "/silent";
+const char BaculaOptDebug[] = "/debug";
const char BaculaRunService[] = "/service";
const char BaculaRunAsUserApp[] = "/run";
const char BaculaShowHelp[] = "/help";
// Usage string
-const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/about] [/status] [/help]\n";
+const char BaculaUsageText[] = "Bacula [/debug] [/service] [/run] [/kill] [/install] [/remove] [/about] [/status] [/help]\n";
void LogErrorMsg(char *msg, char *fname, int lineno);
#define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
extern void LogErrorMsg(char *msg);
// Standard command-line flag definitions
-const char BaculaSilent[] = "/silent";
+const char BaculaOptDebug[] = "/debug";
const char BaculaRunService[] = "/service";
const char BaculaRunAsUserApp[] = "/run";
const char BaculaShowHelp[] = "/help";
// Usage string
-const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/about] [/status] [/help]\n";
+const char BaculaUsageText[] = "Bacula [/debug] [/service] [/run] [/kill] [/install] [/remove] [/about] [/status] [/help]\n";
void LogErrorMsg(char *msg, char *fname, int lineno);
#define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
HINSTANCE hAppInstance;
const char *szAppName = "Bacula-sd";
DWORD mainthreadId;
-bool silent = false;
+bool opt_debug = false;
/* Imported variables */
extern DWORD g_servicethread;
char *szCmdLine = CmdLine;
char *wordPtr, *tempPtr;
int i, quote;
- DWORD dwCharsWritten;
/* Save the application instance and main thread id */
hAppInstance = hInstance;
/* Now check for command-line arguments */
- /* /silent install quietly -- no prompts */
- if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
- silent = true;
- i += sizeof(BaculaSilent) - 1;
+ /* /debug install quietly -- no prompts */
+ if (strnicmp(&szCmdLine[i], BaculaOptDebug, sizeof(BaculaOptDebug) - 1) == 0) {
+ opt_debug = true;
+ i += sizeof(BaculaOptDebug) - 1;
continue;
}
/* /run (this is the default if no command line arguments) */
if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
/* Bacula is being run as a user-level program */
- if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
- AllocConsole();
- }
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
-
return BaculaAppMain();
}
/* /install */
return 1;
}
- /* If no arguments were given then just run */
- if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
- AllocConsole();
- }
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
-
return BaculaAppMain();
}
{
/* DWORD dwThreadID; */
pthread_t tid;
+ DWORD dwCharsWritten;
InitWinAPIWrapper();
WSA_Init();
+ /* If no arguments were given then just run */
+ if (p_AttachConsole == NULL || !p_AttachConsole(ATTACH_PARENT_PROCESS)) {
+ if (opt_debug) {
+ AllocConsole();
+ }
+ }
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
/* Set this process to be the last application to be shut down. */
if (p_SetProcessShutdownParameters) {
p_SetProcessShutdownParameters(0x100, 0);
bacService init;
-extern bool silent;
+extern bool opt_debug;
bacService::bacService()
{
CloseServiceHandle(hservice);
// Everything went fine
- if (!silent) {
+ if (opt_debug) {
MessageBox(NULL,
_("The Bacula Storage service was successfully installed.\n"
"The service may be started from the Control Panel and will\n"
// Now remove the service from the SCM
if(DeleteService(hservice)) {
- if (!silent) {
+ if (opt_debug) {
MessageBox(NULL, _("The Bacula Storage service has been removed"), szAppName, MB_ICONINFORMATION | MB_OK);
}
} else {
typedef BOOL (WINAPI * t_GetVolumePathNameW) (LPCWSTR, LPWSTR, DWORD);
typedef BOOL (WINAPI * t_GetVolumeNameForVolumeMountPointW) (LPCWSTR, LPWSTR, DWORD);
-
+
+typedef BOOL (WINAPI * t_AttachConsole) (DWORD);
+
extern t_GetFileAttributesA DLL_IMP_EXP p_GetFileAttributesA;
extern t_GetFileAttributesW DLL_IMP_EXP p_GetFileAttributesW;
extern t_GetVolumePathNameW DLL_IMP_EXP p_GetVolumePathNameW;
extern t_GetVolumeNameForVolumeMountPointW DLL_IMP_EXP p_GetVolumeNameForVolumeMountPointW;
+extern t_AttachConsole DLL_IMP_EXP p_AttachConsole;
+
void InitWinAPIWrapper();
#endif
MSGS* msgs = (MSGS *)bmalloc(sizeof(MSGS));
memset(msgs, 0, sizeof(MSGS));
for (int i=1; i<=M_MAX; i++) {
-#ifndef HAVE_WIN32
add_msg_dest(msgs, MD_STDOUT, i, NULL, NULL);
-#endif
// add_msg_dest(msgs, MD_SYSLOG, i, NULL, NULL);
add_msg_dest(msgs, MD_CONSOLE, i, NULL, NULL);
}
11Oct06
kes Correct mtx-changer bug that I introduced in a recent commit, and
pointed out by Robert Nelson -- thanks.
+rbn Fix Windows' daemons so that messages print to stdout if not
+ running as a service.
+rbn Add daemon name to trace file name (eg bacula-dir.trace).
+rbn Fix environment variable expansion in directory names on Windows.
+rbn Fix autochanger support in fill command.
+rbn Update SQL scripts to match Unix versions.
+rbn Fix daemon usage displays.
+rbn Cleanup bacula-dir.conf template.
+rbn Install openssl.cnf so that the openssl.exe installed in the
+ Bacula\bin directory can be used to generate keys and
+ certificates for TLS and encryption.
+rbn Fix cleanup of spool files on Windows.
+rbn Remove /silent option from daemons on Windows. The new default
+ is the same as the old /silent. To enable the message boxes that
+ previously were suppressed by /silent you must add /debug instead.
+ NOTE: As a result of this change, the first time you upgrade from
+ a previous version of 1.39.x you will receive the message
+ boxes when the remove of the old services succeeds. This
+ is the same behaviour as when migrating from a version prior
+ to 1.39.0.
+ However, going forward, these message boxes will not appear on
+ upgrades or new installs.
+rbn Add new /debug option. This option enables the message boxes that
+ previously were suppressed by the /silent option. In addition the
+ daemons running as services will open a console window if this
+ option is used.
+rbn Fix bug with service not being removed on migrated installs. This
+ should correct those cases where the file daemon install was failing
+ when upgrading from versions prior to 1.39.x.
+
08Oct06
kes Turn on heap reporting in Dir with zero debug level.
kes Send a message to the sys log when Bacula forces a SEG FAULT, and
kes Correct a few Win32 errno returns in the VSS code so that hopefully
a resonable Win32 error message will be printed.
kes Convert a few strcat()... to bstrncat() in the Win32 code.
+06Oct06
+rbn Added Windows version of bsmtp.
+rbn Fixed path search for Windows so that Bacula\bin is automatically
+ searched for programs and scripts.
+rbn Fixed bugs in mtx-changer.cmd and made template bacula-sd.conf
+ Windows specific.
Version 1.39.24 released:
02Oct06