From a78588c3bb278a1e6e90ca34935385d253dc1c64 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Wed, 24 Jan 2007 01:59:13 +0000 Subject: [PATCH] Fix msvc build problems. Fix path quoting in SQLite scripts. Fix problems with SHGetFolderPath. Fix bacula.dll exports for msvc build. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.0@4033 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/lib/parse_conf.h | 2 +- bacula/src/lib/tls.c | 4 +- bacula/src/win32/bacula.sln | 1 + bacula/src/win32/build-depkgs-msvc.cmd | 7 +++ .../win32/cats/create_sqlite3_database.cmd | 2 +- .../src/win32/cats/drop_sqlite3_database.cmd | 2 +- .../cats/make_sqlite3_catalog_backup.cmd | 2 +- bacula/src/win32/compat/winapi.c | 25 +++----- bacula/src/win32/compat/winconfig.h | 2 +- bacula/src/win32/installer/winbacula.nsi | 60 +++++++++---------- bacula/src/win32/libbac/msvc/bacula.def | 10 ++-- 11 files changed, 58 insertions(+), 59 deletions(-) diff --git a/bacula/src/lib/parse_conf.h b/bacula/src/lib/parse_conf.h index b8adffe25f..75a8dd8d8c 100644 --- a/bacula/src/lib/parse_conf.h +++ b/bacula/src/lib/parse_conf.h @@ -30,7 +30,7 @@ */ struct RES_ITEM; /* Declare forward referenced structure */ -struct RES; /* Declare forware referenced structure */ +class RES; /* Declare forware referenced structure */ typedef void (MSG_RES_HANDLER)(LEX *lc, RES_ITEM *item, int index, int pass); /* This is the structure that defines diff --git a/bacula/src/lib/tls.c b/bacula/src/lib/tls.c index c0e64f4bec..8a17312ce8 100644 --- a/bacula/src/lib/tls.c +++ b/bacula/src/lib/tls.c @@ -241,7 +241,7 @@ bool tls_postconnect_verify_cn(TLS_CONNECTION *tls, alist *verify_list) SSL *ssl = tls->openssl; X509 *cert; X509_NAME *subject; - int auth_success = false; + bool auth_success = false; char data[256]; /* Check if peer provided a certificate */ @@ -280,7 +280,7 @@ bool tls_postconnect_verify_host(TLS_CONNECTION *tls, const char *host) SSL *ssl = tls->openssl; X509 *cert; X509_NAME *subject; - int auth_success = false; + bool auth_success = false; int extensions; char data[256]; int i, j; diff --git a/bacula/src/win32/bacula.sln b/bacula/src/win32/bacula.sln index a625e9a30b..8b114bd2fa 100644 --- a/bacula/src/win32/bacula.sln +++ b/bacula/src/win32/bacula.sln @@ -189,6 +189,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bsmtp", "tools\bsmtp\bsmtp. EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{40CADEE4-8D53-4157-AA36-B256F4934FC3}" ProjectSection(SolutionItems) = preProject + build-depkgs-msvc.cmd = build-depkgs-msvc.cmd scripts\disk-changer.cmd = scripts\disk-changer.cmd scripts\dvd-handler.cmd = scripts\dvd-handler.cmd scripts\mtx-changer.cmd = scripts\mtx-changer.cmd diff --git a/bacula/src/win32/build-depkgs-msvc.cmd b/bacula/src/win32/build-depkgs-msvc.cmd index 26cbd8cbe6..689a2f32db 100644 --- a/bacula/src/win32/build-depkgs-msvc.cmd +++ b/bacula/src/win32/build-depkgs-msvc.cmd @@ -175,6 +175,12 @@ REM do_patch pcre.patch :process_pthreads CALL :get_source %URL_PTHREADS% %DIR_PTHREADS% %MKD_PTHREADS% + FOR %%I IN ( %URL_PTHREADS% ) DO (SET ARCHIVE=%%~nxI) + IF EXIST %SRC_DIR%\nul GOTO :install_pthreads + ECHO Extracting %ARCHIVE% + 7z x -bd -y -o"%DIR_PTHREADS%" "%ARCHIVE%" 2>&1 > "%ARCHIVE%.log" +:install_pthreads + CD %DIR_PTHREADS% ECHO Installing pthreads XCOPY Pre-built\include\*.h %DEPPKG_DIR%\include\ /Y XCOPY Pre-built\lib\pthreadVCE.lib %DEPPKG_DIR%\lib\ /Y @@ -248,6 +254,7 @@ REM do_patch postgresql.patch CALL :do_nmake ../Makefile.msvc clean all ECHO Installing SQLite COPY sqlite3.exe %DEPPKG_DIR%\bin + COPY sqlite3.exe.manifest %DEPPKG_DIR%\bin COPY sqlite3.lib %DEPPKG_DIR%\lib COPY sqlite3.h %DEPPKG_DIR%\include EXIT /B 0 diff --git a/bacula/src/win32/cats/create_sqlite3_database.cmd b/bacula/src/win32/cats/create_sqlite3_database.cmd index 9ea7f5200b..c951597aac 100644 --- a/bacula/src/win32/cats/create_sqlite3_database.cmd +++ b/bacula/src/win32/cats/create_sqlite3_database.cmd @@ -2,5 +2,5 @@ REM REM Script to create Bacula SQLite tables -ECHO .databases | "@bin_dir_cmd@\sqlite3" %* @working_dir_cmd@\bacula.db +ECHO .databases | "@bin_dir_cmd@\sqlite3" %* "@working_dir_cmd@\bacula.db" EXIT /b 0 diff --git a/bacula/src/win32/cats/drop_sqlite3_database.cmd b/bacula/src/win32/cats/drop_sqlite3_database.cmd index 6be1689c1a..29719243ed 100644 --- a/bacula/src/win32/cats/drop_sqlite3_database.cmd +++ b/bacula/src/win32/cats/drop_sqlite3_database.cmd @@ -2,6 +2,6 @@ REM REM Script to drop Bacula SQLite tables -DEL @working_dir_cmd@\bacula.db +DEL "@working_dir_cmd@\bacula.db" ECHO SQLite database dropped. EXIT /b 0 diff --git a/bacula/src/win32/cats/make_sqlite3_catalog_backup.cmd b/bacula/src/win32/cats/make_sqlite3_catalog_backup.cmd index 9af7713558..90be3615c5 100644 --- a/bacula/src/win32/cats/make_sqlite3_catalog_backup.cmd +++ b/bacula/src/win32/cats/make_sqlite3_catalog_backup.cmd @@ -15,7 +15,7 @@ REM DEL /f "@working_dir_cmd@\%1.sql" 2>nul -ECHO .dump | "@bin_dir_cmd@\sqlite3" %1.db > "@working_dir_cmd@\%1.sql" +ECHO .dump | "@bin_dir_cmd@\sqlite3" "@working_dir_cmd@\%1.db" > "@working_dir_cmd@\%1.sql" @ECHO off REM diff --git a/bacula/src/win32/compat/winapi.c b/bacula/src/win32/compat/winapi.c index b713bad443..1a61144deb 100644 --- a/bacula/src/win32/compat/winapi.c +++ b/bacula/src/win32/compat/winapi.c @@ -176,8 +176,6 @@ InitWinAPIWrapper() p_AttachConsole = (t_AttachConsole) GetProcAddress(hLib, "AttachConsole"); } - - FreeLibrary(hLib); } if (g_platform_id != VER_PLATFORM_WIN32_WINDOWS) { @@ -189,8 +187,6 @@ InitWinAPIWrapper() /* wmkdir */ p_wmkdir = (t_wmkdir) GetProcAddress(hLib, "_wmkdir"); - - FreeLibrary(hLib); } hLib = LoadLibraryA("ADVAPI32.DLL"); @@ -201,25 +197,20 @@ InitWinAPIWrapper() GetProcAddress(hLib, "AdjustTokenPrivileges"); p_LookupPrivilegeValue = (t_LookupPrivilegeValue) GetProcAddress(hLib, "LookupPrivilegeValueA"); - FreeLibrary(hLib); } } - /* First try in SHFOLDER for older systems */ - hLib = LoadLibraryA("SHFOLDER.DLL"); - if (hLib) { - p_SHGetFolderPath = (t_SHGetFolderPath) - GetProcAddress(hLib, "SHGetFolderPath"); - FreeLibrary(hLib); - } - - /* Now try Shell32.dll for newer systems */ hLib = LoadLibraryA("SHELL32.DLL"); if (hLib) { p_SHGetFolderPath = (t_SHGetFolderPath) - GetProcAddress(hLib, "SHGetFolderPath"); - FreeLibrary(hLib); + GetProcAddress(hLib, "SHGetFolderPathA"); + } else { + /* If SHELL32 isn't found try SHFOLDER for older systems */ + hLib = LoadLibraryA("SHFOLDER.DLL"); + if (hLib) { + p_SHGetFolderPath = (t_SHGetFolderPath) + GetProcAddress(hLib, "SHGetFolderPathA"); + } } - atexit(Win32ConvCleanupCache); } diff --git a/bacula/src/win32/compat/winconfig.h b/bacula/src/win32/compat/winconfig.h index c87851db28..98cd69bb40 100644 --- a/bacula/src/win32/compat/winconfig.h +++ b/bacula/src/win32/compat/winconfig.h @@ -376,7 +376,7 @@ /* Enable NLS only if we are using the new VC++. * NLS should also work with VC++ 7.1, but the Makefiles are * not adapted to support it (include, lib...). */ -#define ENABLE_NLS 1 +//#define ENABLE_NLS 1 #endif #undef LOCALEDIR diff --git a/bacula/src/win32/installer/winbacula.nsi b/bacula/src/win32/installer/winbacula.nsi index ccd82a06cb..b71984c506 100644 --- a/bacula/src/win32/installer/winbacula.nsi +++ b/bacula/src/win32/installer/winbacula.nsi @@ -418,9 +418,9 @@ Section "-Initialize" Delete /REBOOTOK "$INSTDIR\bin\License.txt" FileOpen $R1 $PLUGINSDIR\config.sed w - FileWrite $R1 "s;@VERSION@;${VERSION};$\r$\n" - FileWrite $R1 "s;@DATE@;${__DATE__};$\r$\n" - FileWrite $R1 "s;@DISTNAME@;Windows;$\r$\n" + FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n" + FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n" + FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n" !If "$BUILD_TOOLS" == "MinGW" StrCpy $R2 "MinGW32" @@ -432,92 +432,92 @@ Section "-Initialize" Exch $R3 Pop $R3 - FileWrite $R1 "s;@DISTVER@;$R2;$\r$\n" + FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n" ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\\\" - FileWrite $R1 's;@working_dir@;$R2;$\r$\n' + FileWrite $R1 's;@working_dir@;$R2;g$\r$\n' ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\" - FileWrite $R1 's;@working_dir_cmd@;$R2;$\r$\n' + FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n' ${StrRep} $R2 "$INSTDIR\bin" "\" "\\\\" - FileWrite $R1 's;@bin_dir@;$R2;$\r$\n' + FileWrite $R1 's;@bin_dir@;$R2;g$\r$\n' ${StrRep} $R2 "$INSTDIR\bin" "\" "\\" FileWrite $R1 's;@bin_dir_cmd@;$R2;g$\r$\n' ${StrRep} $R2 "$INSTDIR" "\" "/" - FileWrite $R1 "s;@BUILD_DIR@;$R2;$\r$\n" + FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n" Call IsDirectorSelected Pop $R2 ${If} $R2 = 1 - FileWrite $R1 "s;@director_address@;$LocalHostAddress;$\r$\n" + FileWrite $R1 "s;@director_address@;$LocalHostAddress;g$\r$\n" ${Else} ${If} "$ConfigDirectorAddress" != "" - FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;$\r$\n" + FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n" ${EndIf} ${EndIf} - FileWrite $R1 "s;@client_address@;$LocalHostAddress;$\r$\n" - FileWrite $R1 "s;@storage_address@;$LocalHostAddress;$\r$\n" + FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n" + FileWrite $R1 "s;@storage_address@;$LocalHostAddress;g$\r$\n" ${If} "$ConfigClientName" != "" - FileWrite $R1 "s;@client_name@;$ConfigClientName;$\r$\n" + FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n" ${EndIf} ${If} "$ConfigClientPort" != "" - FileWrite $R1 "s;@client_port@;$ConfigClientPort;$\r$\n" + FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n" ${EndIf} ${If} "$ConfigClientMaxJobs" != "" - FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;$\r$\n" + FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n" ${EndIf} ${If} "$ConfigClientPassword" != "" - FileWrite $R1 "s;@client_password@;$ConfigClientPassword;$\r$\n" + FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n" ${EndIf} ${If} "$ConfigStorageName" != "" - FileWrite $R1 "s;@storage_name@;$ConfigStorageName;$\r$\n" + FileWrite $R1 "s;@storage_name@;$ConfigStorageName;g$\r$\n" ${EndIf} ${If} "$ConfigStoragePort" != "" - FileWrite $R1 "s;@storage_port@;$ConfigStoragePort;$\r$\n" + FileWrite $R1 "s;@storage_port@;$ConfigStoragePort;g$\r$\n" ${EndIf} ${If} "$ConfigStorageMaxJobs" != "" - FileWrite $R1 "s;@storage_maxjobs@;$ConfigStorageMaxJobs;$\r$\n" + FileWrite $R1 "s;@storage_maxjobs@;$ConfigStorageMaxJobs;g$\r$\n" ${EndIf} ${If} "$ConfigStoragePassword" != "" - FileWrite $R1 "s;@storage_password@;$ConfigStoragePassword;$\r$\n" + FileWrite $R1 "s;@storage_password@;$ConfigStoragePassword;g$\r$\n" ${EndIf} ${If} "$ConfigDirectorName" != "" - FileWrite $R1 "s;@director_name@;$ConfigDirectorName;$\r$\n" + FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n" ${EndIf} ${If} "$ConfigDirectorPort" != "" - FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;$\r$\n" + FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n" ${EndIf} ${If} "$ConfigDirectorMaxJobs" != "" - FileWrite $R1 "s;@director_maxjobs@;$ConfigDirectorMaxJobs;$\r$\n" + FileWrite $R1 "s;@director_maxjobs@;$ConfigDirectorMaxJobs;g$\r$\n" ${EndIf} ${If} "$ConfigDirectorPassword" != "" - FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;$\r$\n" + FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n" ${EndIf} ${If} "$ConfigDirectorMailServer" != "" - FileWrite $R1 "s;@smtp_host@;$ConfigDirectorMailServer;$\r$\n" + FileWrite $R1 "s;@smtp_host@;$ConfigDirectorMailServer;g$\r$\n" ${EndIf} ${If} "$ConfigDirectorMailAddress" != "" - FileWrite $R1 "s;@job_email@;$ConfigDirectorMailAddress;$\r$\n" + FileWrite $R1 "s;@job_email@;$ConfigDirectorMailAddress;g$\r$\n" ${EndIf} ${If} "$ConfigMonitorName" != "" - FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;$\r$\n" + FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n" ${EndIf} ${If} "$ConfigMonitorPassword" != "" - FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;$\r$\n" + FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n" ${EndIf} ${If} $ConfigDirectorDB = 1 ${If} $MySQLPath != "" ${StrRep} $R2 "$MySQLPath\bin" "\" "\\" - FileWrite $R1 "s;@SQL_BINDIR@;$R2;$\r$\n" + FileWrite $R1 "s;@SQL_BINDIR@;$R2;g$\r$\n" ${EndIf} ${ElseIf} $ConfigDirectorDB = 2 ${If} $PostgreSQLPath != "" ${StrRep} $R2 "$PostgreSQLPath\bin" "\" "\\" - FileWrite $R1 "s;@SQL_BINDIR@;$R2;$\r$\n" + FileWrite $R1 "s;@SQL_BINDIR@;$R2;g$\r$\n" ${EndIf} ${EndIf} diff --git a/bacula/src/win32/libbac/msvc/bacula.def b/bacula/src/win32/libbac/msvc/bacula.def index a6c15affdd..ea9deea165 100644 --- a/bacula/src/win32/libbac/msvc/bacula.def +++ b/bacula/src/win32/libbac/msvc/bacula.def @@ -353,13 +353,13 @@ fnmatch ?my_name_is@@YAXHQAPADPBD@Z ?get_db_type@@YAPBDXZ ?set_db_type@@YAXPBD@Z -?init_msg@@YAXPAVJCR@@PAUMSGS@@@Z +?init_msg@@YAXPAVJCR@@PAVMSGS@@@Z ?init_console_msg@@YAXPBD@Z -?add_msg_dest@@YAXPAUMSGS@@HHPAD1@Z -?rem_msg_dest@@YAXPAUMSGS@@HHPAD@Z +?add_msg_dest@@YAXPAVMSGS@@HHPAD1@Z +?rem_msg_dest@@YAXPAVMSGS@@HHPAD@Z ?close_msg@@YAXPAVJCR@@@Z ?set_errno@berrno@@QAEXH@Z -?free_msgs_res@@YAXPAUMSGS@@@Z +?free_msgs_res@@YAXPAVMSGS@@@Z ?term_msg@@YAXXZ ?dispatch_message@@YAXPAVJCR@@HJPAD@Z ?c_str@POOL_MEM@@QBEPADXZ @@ -464,7 +464,7 @@ fnmatch ?tree_cwd@@YAPAUs_tree_node@@PADPAUs_tree_root@@PAU1@@Z ; util.obj -?is_buf_zero@@YAHPADH@Z +?is_buf_zero@@YA_NPADH@Z ?lcase@@YAXPAD@Z ?bash_spaces@@YAXPAD@Z ?bash_spaces@@YAXAAVPOOL_MEM@@@Z -- 2.39.5