From 10cfd798ced2d27f61ead2de6fe9b1bcc8e3468d Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 25 Feb 2018 09:56:08 +0100 Subject: [PATCH] Restore win32 dir from Branch-5.2 and update it --- bacula/Makefile.in | 4 +- bacula/README | 4 +- bacula/autoconf/config.h.in | 6 + bacula/autoconf/configure.in | 11 + bacula/configure | 53 +- bacula/examples/sd-tool | 608 ++ bacula/manpages/Makefile.in | 4 +- bacula/src/baconfig.h | 4 + bacula/src/bacula.h | 5 + bacula/src/bsd | 4 + bacula/src/c | 2 +- bacula/src/cats/cats.h | 1 + bacula/src/console/console.c | 12 +- bacula/src/dird/bsr.c | 162 +- bacula/src/dird/getmsg.c | 6 +- bacula/src/dird/job.c | 9 +- bacula/src/dird/jobq.c | 7 +- bacula/src/filed/Makefile.in | 55 +- bacula/src/filed/backup.c | 13 +- bacula/src/filed/fd_plugins.c | 17 + bacula/src/filed/fd_plugins.h | 3 +- bacula/src/filed/filed.c | 5 +- bacula/src/filed/job.c | 316 +- bacula/src/filed/protos.h | 5 + bacula/src/filed/restore.c | 37 + bacula/src/filed/restore.h | 9 + bacula/src/filed/status.c | 124 +- bacula/src/filed/win_efs.c | 308 + bacula/src/findlib/Makefile.in | 2 +- bacula/src/findlib/attribs.c | 340 +- bacula/src/findlib/bfile.c | 669 +- bacula/src/findlib/bfile.h | 23 +- bacula/src/findlib/enable_priv.c | 113 + bacula/src/findlib/find.c | 17 +- bacula/src/findlib/find_one.c | 35 +- bacula/src/findlib/fstype.c | 130 +- bacula/src/findlib/match.c | 34 +- bacula/src/findlib/mkpath.c | 67 +- bacula/src/findlib/namedpipe.c | 338 + bacula/src/findlib/namedpipe.h | 48 + bacula/src/findlib/protos.h | 2 +- bacula/src/findlib/win32filter.c | 1 + bacula/src/findlib/win32filter.h | 30 +- bacula/src/jcr.h | 1 + bacula/src/lib/bnet.c | 75 +- bacula/src/lib/bpipe.c | 5 + bacula/src/lib/bsock.c | 73 +- bacula/src/lib/bsys.c | 11 +- bacula/src/lib/htable.c | 6 +- bacula/src/lib/openssl.c | 4 + bacula/src/lib/scan.c | 56 +- bacula/src/qt-console/make-win32 | 6 +- bacula/src/stored/dde_cmd.c | 45 + bacula/src/stored/stored.h | 2 + bacula/src/stored/win_file_dev.h | 31 + bacula/src/stored/win_tape_dev.h | 48 + bacula/src/version.h | 4 +- bacula/src/win32/External-mingw-w64 | 74 + bacula/src/win32/External-mingw32 | 70 + bacula/src/win32/External-msvc | 59 + bacula/src/win32/Makefile | 168 + bacula/src/win32/Makefile.full | 109 + bacula/src/win32/Makefile.inc.in | 161 + bacula/src/win32/Makefile.rules | 79 + bacula/src/win32/README.mingw | 376 + bacula/src/win32/README.vc8 | 246 + bacula/src/win32/bacula.sln | 403 + bacula/src/win32/bacula/bacula.vcproj | 225 + bacula/src/win32/build-depkgs-mingw-w64 | 451 ++ bacula/src/win32/build-depkgs-mingw32 | 659 ++ bacula/src/win32/cats/Makefile | 110 + bacula/src/win32/cats/bacula_cats.def | 273 + .../win32/cats/bacula_cats/bacula_cats.vcproj | 94 + .../win32/cats/cats_mysql/cats_mysql.vcproj | 428 ++ .../cats_postgresql/cats_postgresql.vcproj | 432 ++ .../cats/cats_sqlite3/cats_sqlite3.vcproj | 421 ++ .../src/win32/cats/create_mysql_database.cmd | 14 + .../win32/cats/create_postgresql_database.cmd | 23 + .../win32/cats/create_postgresql_database.sql | 2 + .../win32/cats/create_sqlite3_database.cmd | 6 + .../src/win32/cats/delete_catalog_backup.cmd | 5 + bacula/src/win32/cats/drop_mysql_database.cmd | 14 + bacula/src/win32/cats/drop_mysql_tables.cmd | 14 + bacula/src/win32/cats/drop_mysql_tables.sql | 26 + .../win32/cats/drop_postgresql_database.cmd | 14 + .../src/win32/cats/drop_postgresql_tables.cmd | 14 + .../src/win32/cats/drop_postgresql_tables.sql | 22 + .../src/win32/cats/drop_sqlite3_database.cmd | 7 + bacula/src/win32/cats/drop_sqlite3_tables.cmd | 8 + .../src/win32/cats/grant_mysql_privileges.cmd | 14 + .../src/win32/cats/grant_mysql_privileges.sql | 5 + .../cats/grant_postgresql_privileges.cmd | 15 + .../cats/grant_postgresql_privileges.sql | 37 + .../win32/cats/grant_sqlite3_privileges.cmd | 7 + bacula/src/win32/cats/make_def | 72 + .../win32/cats/make_mysql_catalog_backup.cmd | 41 + bacula/src/win32/cats/make_mysql_tables.cmd | 14 + bacula/src/win32/cats/make_mysql_tables.sql | 357 + .../cats/make_postgresql_catalog_backup.cmd | 41 + .../src/win32/cats/make_postgresql_tables.cmd | 14 + .../src/win32/cats/make_postgresql_tables.sql | 380 + .../cats/make_sqlite3_catalog_backup.cmd | 38 + bacula/src/win32/cats/make_sqlite3_tables.cmd | 7 + bacula/src/win32/cats/make_sqlite3_tables.sql | 384 + bacula/src/win32/compat/Makefile | 66 + bacula/src/win32/compat/alloca.h | 0 bacula/src/win32/compat/arpa/inet.h | 0 bacula/src/win32/compat/compat.cpp | 2989 ++++++++ bacula/src/win32/compat/compat.h | 469 ++ bacula/src/win32/compat/dirent.h | 0 bacula/src/win32/compat/dlfcn.h | 33 + bacula/src/win32/compat/getopt.c | 187 + bacula/src/win32/compat/getopt.h | 41 + bacula/src/win32/compat/grp.h | 0 bacula/src/win32/compat/mingwconfig.h | 439 ++ bacula/src/win32/compat/ms_atl.h | 53 + bacula/src/win32/compat/mswinver.h | 35 + bacula/src/win32/compat/netdb.h | 0 bacula/src/win32/compat/netinet/in.h | 0 bacula/src/win32/compat/netinet/tcp.h | 0 bacula/src/win32/compat/print.cpp | 734 ++ bacula/src/win32/compat/pwd.h | 0 bacula/src/win32/compat/stdint.h | 3 + bacula/src/win32/compat/strings.h | 0 bacula/src/win32/compat/sys/file.h | 2 + bacula/src/win32/compat/sys/ioctl.h | 1 + bacula/src/win32/compat/sys/mtio.h | 277 + bacula/src/win32/compat/sys/socket.h | 0 bacula/src/win32/compat/sys/stat.h | 1 + bacula/src/win32/compat/sys/time.h | 0 bacula/src/win32/compat/sys/wait.h | 0 bacula/src/win32/compat/syslog.h | 32 + bacula/src/win32/compat/unistd.h | 3 + bacula/src/win32/compat/winapi.c | 349 + bacula/src/win32/compat/winapi.h | 242 + bacula/src/win32/compat/winhdrs.h | 14 + bacula/src/win32/compat/winhost.h | 51 + bacula/src/win32/compat/winsock.h | 4 + bacula/src/win32/compat/xwinconfig.h | 645 ++ bacula/src/win32/console/Makefile | 59 + bacula/src/win32/console/console.vcproj | 293 + bacula/src/win32/cygwin.NET.bashrc | 63 + bacula/src/win32/dird/Makefile | 117 + bacula/src/win32/dird/bacula.rc | 1 + bacula/src/win32/dird/dird.vcproj | 1118 +++ bacula/src/win32/dird/main.cpp | 36 + bacula/src/win32/dird/service.cpp | 36 + bacula/src/win32/dird/who.h | 44 + bacula/src/win32/filed/Makefile | 123 + bacula/src/win32/filed/bacula-fd.manifest | 21 + bacula/src/win32/filed/bacula.rc | 1 + bacula/src/win32/filed/baculafd.vcproj | 610 ++ bacula/src/win32/filed/main.cpp | 24 + bacula/src/win32/filed/plugins/Makefile | 120 + bacula/src/win32/filed/plugins/alldrives-fd.c | 437 ++ .../src/win32/filed/plugins/alldrives-fd.def | 13 + bacula/src/win32/filed/plugins/api.c | 146 + bacula/src/win32/filed/plugins/api.h | 302 + bacula/src/win32/filed/plugins/bpipe-fd.c | 557 ++ bacula/src/win32/filed/plugins/bpipe-fd.def | 15 + bacula/src/win32/filed/plugins/comadmin.h | 878 +++ bacula/src/win32/filed/plugins/dbi_node.c | 292 + bacula/src/win32/filed/plugins/exch_api.c | 139 + bacula/src/win32/filed/plugins/exch_api.h | 293 + .../src/win32/filed/plugins/exch_dbi_node.c | 280 + .../src/win32/filed/plugins/exch_file_node.c | 229 + bacula/src/win32/filed/plugins/exch_node.c | 120 + bacula/src/win32/filed/plugins/exch_node.h | 159 + .../src/win32/filed/plugins/exch_root_node.c | 155 + .../win32/filed/plugins/exch_service_node.c | 223 + .../filed/plugins/exch_storage_group_node.c | 471 ++ .../src/win32/filed/plugins/exch_store_node.c | 237 + bacula/src/win32/filed/plugins/exchange-fd.c | 528 ++ .../src/win32/filed/plugins/exchange-fd.def | 15 + bacula/src/win32/filed/plugins/exchange-fd.h | 157 + bacula/src/win32/filed/plugins/file_node.c | 236 + bacula/src/win32/filed/plugins/node.c | 127 + bacula/src/win32/filed/plugins/node.h | 186 + bacula/src/win32/filed/plugins/root_node.c | 162 + bacula/src/win32/filed/plugins/service_node.c | 229 + .../win32/filed/plugins/storage_group_node.c | 511 ++ bacula/src/win32/filed/plugins/store_node.c | 249 + bacula/src/win32/filed/service.cpp | 25 + bacula/src/win32/filed/trayMonitor.cpp | 25 + bacula/src/win32/filed/vss.cpp | 589 ++ bacula/src/win32/filed/vss.h | 344 + bacula/src/win32/filed/vss_Vista.cpp | 4 + bacula/src/win32/filed/vss_W2K3.cpp | 13 + bacula/src/win32/filed/vss_XP.cpp | 4 + bacula/src/win32/filed/vss_generic.cpp | 847 +++ bacula/src/win32/filed/who.h | 33 + .../full_win32_installer/ConfigPage1.nsh | 294 + .../full_win32_installer/ConfigPage2.nsh | 454 ++ .../win32/full_win32_installer/DumpLog.nsh | 46 + .../full_win32_installer/InstallType.ini | 56 + .../full_win32_installer/InstallType.nsh | 102 + .../src/win32/full_win32_installer/Start.bat | 5 + .../src/win32/full_win32_installer/Stop.bat | 5 + .../full_win32_installer/WriteTemplates.ini | 48 + .../full_win32_installer/bacula-dir.conf.in | 380 + .../full_win32_installer/bacula-fd.conf.in | 44 + .../full_win32_installer/bacula-logo.bmp | Bin 0 -> 26046 bytes .../full_win32_installer/bacula-sd.conf.in | 115 + .../win32/full_win32_installer/bat.conf.in | 10 + .../full_win32_installer/bconsole.conf.in | 10 + .../full_win32_installer/build-installer.cmd | 70 + .../full_win32_installer/bwx-console.conf.in | 10 + .../win32/full_win32_installer/client.conf.in | 11 + .../full_win32_installer/installer.vcproj | 154 + .../full_win32_installer/storage.conf.in | 10 + .../win32/full_win32_installer/winbacula.nsi | 1466 ++++ bacula/src/win32/lib/Makefile | 181 + bacula/src/win32/lib/bacula32.def | 1017 +++ bacula/src/win32/lib/bacula64.def | 965 +++ bacula/src/win32/lib/make_def32 | 34 + bacula/src/win32/lib/make_def64 | 34 + bacula/src/win32/libbac/Makefile | 111 + bacula/src/win32/libbac/libbac.vcproj | 1733 +++++ bacula/src/win32/libbac/msvc/bacula.def | 510 ++ bacula/src/win32/libwin32/aboutDialog.cpp | 71 + bacula/src/win32/libwin32/aboutDialog.h | 39 + bacula/src/win32/libwin32/bacula.bmp | Bin 0 -> 3126 bytes bacula/src/win32/libwin32/bacula.ico | Bin 0 -> 766 bytes bacula/src/win32/libwin32/bacula.rc | 171 + bacula/src/win32/libwin32/error.ico | Bin 0 -> 766 bytes bacula/src/win32/libwin32/idle.ico | Bin 0 -> 766 bytes bacula/src/win32/libwin32/main.cpp | 666 ++ bacula/src/win32/libwin32/protos.h | 50 + bacula/src/win32/libwin32/res.h | 41 + bacula/src/win32/libwin32/running.ico | Bin 0 -> 766 bytes bacula/src/win32/libwin32/saving.ico | Bin 0 -> 766 bytes bacula/src/win32/libwin32/service.cpp | 586 ++ bacula/src/win32/libwin32/statusDialog.cpp | 165 + bacula/src/win32/libwin32/statusDialog.h | 45 + bacula/src/win32/libwin32/trayMonitor.cpp | 263 + bacula/src/win32/libwin32/trayMonitor.h | 59 + bacula/src/win32/libwin32/warn.ico | Bin 0 -> 766 bytes bacula/src/win32/libwin32/win32.h | 31 + bacula/src/win32/makeall | 7 + .../patches/binutils_texinfo_version.patch | 31 + bacula/src/win32/patches/dvd+rw-tools.patch | 264 + bacula/src/win32/patches/mingw-utils.patch | 6670 +++++++++++++++++ bacula/src/win32/patches/mt.patch | 1689 +++++ bacula/src/win32/patches/mtx-msvc1.patch | 75 + bacula/src/win32/patches/mtx-msvc2.patch | 40 + bacula/src/win32/patches/mtx.patch | 1576 ++++ bacula/src/win32/patches/nsis.patch | 428 ++ bacula/src/win32/patches/openssl-w64.patch | 2663 +++++++ bacula/src/win32/patches/openssl.patch | 309 + bacula/src/win32/patches/pcre.patch | 130 + bacula/src/win32/patches/postgresql.patch | 123 + bacula/src/win32/patches/pthreads-w64.patch | 970 +++ bacula/src/win32/patches/pthreads.patch | 95 + .../win32/patches/qt4-compilation-see.patch | 21 + .../src/win32/patches/qt4-compilation.patch | 45 + bacula/src/win32/patches/qt4-intrinsics.patch | 13 + bacula/src/win32/patches/qt4-widget-ui.patch | 12 + bacula/src/win32/patches/sed.patch | 15 + bacula/src/win32/patches/sed_msc.patch | 927 +++ bacula/src/win32/patches/sqlite.patch | 162 + bacula/src/win32/patches/sqlite_msc.patch | 768 ++ bacula/src/win32/patches/stab2cv.patch | 11 + bacula/src/win32/patches/wx.sed | 9 + bacula/src/win32/patches/wx1.patch | 37 + bacula/src/win32/patches/wx2.patch | 22 + bacula/src/win32/patches/wxWidgets.patch | 67 + bacula/src/win32/patches/zlib.patch | 150 + bacula/src/win32/pebuilder/Makefile.in | 55 + bacula/src/win32/pebuilder/README | 13 + bacula/src/win32/pebuilder/bacula/bacula.inf | 37 + .../win32/pebuilder/bacula/bacula_nu2menu.xml | 19 + bacula/src/win32/scripts/Makefile | 39 + bacula/src/win32/scripts/bsleep.c | 23 + bacula/src/win32/scripts/bsleep.vcproj | 199 + bacula/src/win32/scripts/disk-changer.cmd | 201 + bacula/src/win32/scripts/dvd-handler.cmd | 387 + bacula/src/win32/scripts/mtx-changer.cmd | 189 + bacula/src/win32/stored/Makefile | 182 + bacula/src/win32/stored/bacula.rc | 1 + bacula/src/win32/stored/baculasd.vcproj | 396 + bacula/src/win32/stored/bcopy/bcopy.vcproj | 230 + .../src/win32/stored/bextract/bextract.vcproj | 229 + bacula/src/win32/stored/bls/bls.vcproj | 229 + bacula/src/win32/stored/bscan/bscan.vcproj | 229 + bacula/src/win32/stored/btape/btape.vcproj | 228 + bacula/src/win32/stored/main.cpp | 24 + bacula/src/win32/stored/mtops.cpp | 1175 +++ bacula/src/win32/stored/postest/postest.cpp | 299 + .../src/win32/stored/postest/postest.vcproj | 213 + bacula/src/win32/stored/service.cpp | 25 + .../src/win32/stored/storelib/storelib.vcproj | 827 ++ bacula/src/win32/stored/trayMonitor.cpp | 25 + bacula/src/win32/stored/who.h | 31 + bacula/src/win32/stored/win_tape_device.cpp | 1142 +++ bacula/src/win32/tools/Makefile | 107 + bacula/src/win32/tools/ScsiDeviceList.cpp | 363 + bacula/src/win32/tools/ScsiDeviceList.h | 169 + bacula/src/win32/tools/bsmtp/bsmtp.vcproj | 229 + bacula/src/win32/tools/dbcheck/dbcheck.vcproj | 293 + .../win32/tools/drivetype/drivetype.vcproj | 228 + bacula/src/win32/tools/fstype/fstype.vcproj | 230 + bacula/src/win32/tools/scsilist.cpp | 119 + .../src/win32/tools/scsilist/scsilist.vcproj | 216 + .../src/win32/tools/testfind/testfind.vcproj | 289 + bacula/src/win32/tools/testls/testls.vcproj | 229 + .../src/win32/win32_installer/ConfigPage1.nsh | 294 + .../src/win32/win32_installer/ConfigPage2.nsh | 454 ++ bacula/src/win32/win32_installer/DumpLog.nsh | 48 + .../src/win32/win32_installer/InstallType.ini | 56 + .../src/win32/win32_installer/InstallType.nsh | 93 + bacula/src/win32/win32_installer/Makefile | 178 + bacula/src/win32/win32_installer/Readme.txt | 47 + bacula/src/win32/win32_installer/Start.bat | 5 + bacula/src/win32/win32_installer/Stop.bat | 5 + .../win32/win32_installer/WriteTemplates.ini | 30 + .../win32/win32_installer/bacula-dir.conf.in | 383 + .../win32/win32_installer/bacula-fd.conf.in | 47 + .../src/win32/win32_installer/bacula-logo.bmp | Bin 0 -> 26046 bytes .../win32/win32_installer/bacula-sd.conf.in | 118 + bacula/src/win32/win32_installer/bat.conf.in | 13 + .../win32/win32_installer/bconsole.conf.in | 13 + bacula/src/win32/win32_installer/bs-logo.bmp | Bin 0 -> 33654 bytes .../win32/win32_installer/build-installer.cmd | 70 + .../win32/win32_installer/bwx-console.conf.in | 13 + .../src/win32/win32_installer/client.conf.in | 15 + .../win32/win32_installer/installer.vcproj | 154 + .../src/win32/win32_installer/storage.conf.in | 14 + .../win32_installer/tray-monitor.conf.in | 30 + .../src/win32/win32_installer/winbacula.nsi | 1241 +++ bacula/src/win32/win32_installer/x64.nsh | 54 + .../src/win32/win64_installer/ConfigPage1.nsh | 294 + .../src/win32/win64_installer/ConfigPage2.nsh | 455 ++ bacula/src/win32/win64_installer/DumpLog.nsh | 48 + .../src/win32/win64_installer/InstallType.ini | 56 + .../src/win32/win64_installer/InstallType.nsh | 99 + bacula/src/win32/win64_installer/Makefile | 207 + bacula/src/win32/win64_installer/Readme.txt | 50 + bacula/src/win32/win64_installer/Start.bat | 5 + bacula/src/win32/win64_installer/Stop.bat | 5 + .../win32/win64_installer/WriteTemplates.ini | 30 + .../win32/win64_installer/bacula-dir.conf.in | 383 + .../win32/win64_installer/bacula-fd.conf.in | 47 + .../src/win32/win64_installer/bacula-logo.bmp | Bin 0 -> 26046 bytes .../win32/win64_installer/bacula-sd.conf.in | 118 + .../bacula-tray-monitor.conf.in | 34 + bacula/src/win32/win64_installer/bat.conf.in | 14 + .../win32/win64_installer/bconsole.conf.in | 14 + bacula/src/win32/win64_installer/bs-logo.bmp | Bin 0 -> 33654 bytes .../win32/win64_installer/bwx-console.conf.in | 14 + .../src/win32/win64_installer/client.conf.in | 15 + .../win32/win64_installer/installer.vcproj | 154 + .../src/win32/win64_installer/storage.conf.in | 14 + .../win64_installer/tray-monitor.conf.in | 34 + .../src/win32/win64_installer/winbacula.nsi | 1220 +++ bacula/src/win32/winapi.h | 215 + bacula/src/win32/wx-console/Makefile | 87 + .../src/win32/wx-console/bwx-console.manifest | 21 + bacula/src/win32/wx-console/w32api.h | 11 + bacula/src/win32/wx-console/wx-console.vcproj | 352 + 359 files changed, 72578 insertions(+), 312 deletions(-) create mode 100755 bacula/examples/sd-tool create mode 100644 bacula/src/bsd create mode 100644 bacula/src/filed/win_efs.c create mode 100644 bacula/src/findlib/namedpipe.c create mode 100644 bacula/src/findlib/namedpipe.h create mode 100644 bacula/src/stored/dde_cmd.c create mode 100644 bacula/src/stored/win_file_dev.h create mode 100644 bacula/src/stored/win_tape_dev.h create mode 100644 bacula/src/win32/External-mingw-w64 create mode 100644 bacula/src/win32/External-mingw32 create mode 100644 bacula/src/win32/External-msvc create mode 100644 bacula/src/win32/Makefile create mode 100644 bacula/src/win32/Makefile.full create mode 100644 bacula/src/win32/Makefile.inc.in create mode 100644 bacula/src/win32/Makefile.rules create mode 100644 bacula/src/win32/README.mingw create mode 100644 bacula/src/win32/README.vc8 create mode 100644 bacula/src/win32/bacula.sln create mode 100644 bacula/src/win32/bacula/bacula.vcproj create mode 100755 bacula/src/win32/build-depkgs-mingw-w64 create mode 100755 bacula/src/win32/build-depkgs-mingw32 create mode 100644 bacula/src/win32/cats/Makefile create mode 100644 bacula/src/win32/cats/bacula_cats.def create mode 100644 bacula/src/win32/cats/bacula_cats/bacula_cats.vcproj create mode 100644 bacula/src/win32/cats/cats_mysql/cats_mysql.vcproj create mode 100644 bacula/src/win32/cats/cats_postgresql/cats_postgresql.vcproj create mode 100644 bacula/src/win32/cats/cats_sqlite3/cats_sqlite3.vcproj create mode 100644 bacula/src/win32/cats/create_mysql_database.cmd create mode 100644 bacula/src/win32/cats/create_postgresql_database.cmd create mode 100644 bacula/src/win32/cats/create_postgresql_database.sql create mode 100644 bacula/src/win32/cats/create_sqlite3_database.cmd create mode 100644 bacula/src/win32/cats/delete_catalog_backup.cmd create mode 100644 bacula/src/win32/cats/drop_mysql_database.cmd create mode 100644 bacula/src/win32/cats/drop_mysql_tables.cmd create mode 100644 bacula/src/win32/cats/drop_mysql_tables.sql create mode 100644 bacula/src/win32/cats/drop_postgresql_database.cmd create mode 100644 bacula/src/win32/cats/drop_postgresql_tables.cmd create mode 100644 bacula/src/win32/cats/drop_postgresql_tables.sql create mode 100644 bacula/src/win32/cats/drop_sqlite3_database.cmd create mode 100644 bacula/src/win32/cats/drop_sqlite3_tables.cmd create mode 100644 bacula/src/win32/cats/grant_mysql_privileges.cmd create mode 100644 bacula/src/win32/cats/grant_mysql_privileges.sql create mode 100644 bacula/src/win32/cats/grant_postgresql_privileges.cmd create mode 100644 bacula/src/win32/cats/grant_postgresql_privileges.sql create mode 100644 bacula/src/win32/cats/grant_sqlite3_privileges.cmd create mode 100755 bacula/src/win32/cats/make_def create mode 100644 bacula/src/win32/cats/make_mysql_catalog_backup.cmd create mode 100644 bacula/src/win32/cats/make_mysql_tables.cmd create mode 100644 bacula/src/win32/cats/make_mysql_tables.sql create mode 100644 bacula/src/win32/cats/make_postgresql_catalog_backup.cmd create mode 100644 bacula/src/win32/cats/make_postgresql_tables.cmd create mode 100644 bacula/src/win32/cats/make_postgresql_tables.sql create mode 100644 bacula/src/win32/cats/make_sqlite3_catalog_backup.cmd create mode 100644 bacula/src/win32/cats/make_sqlite3_tables.cmd create mode 100644 bacula/src/win32/cats/make_sqlite3_tables.sql create mode 100644 bacula/src/win32/compat/Makefile create mode 100644 bacula/src/win32/compat/alloca.h create mode 100644 bacula/src/win32/compat/arpa/inet.h create mode 100644 bacula/src/win32/compat/compat.cpp create mode 100644 bacula/src/win32/compat/compat.h create mode 100644 bacula/src/win32/compat/dirent.h create mode 100644 bacula/src/win32/compat/dlfcn.h create mode 100644 bacula/src/win32/compat/getopt.c create mode 100644 bacula/src/win32/compat/getopt.h create mode 100644 bacula/src/win32/compat/grp.h create mode 100644 bacula/src/win32/compat/mingwconfig.h create mode 100644 bacula/src/win32/compat/ms_atl.h create mode 100644 bacula/src/win32/compat/mswinver.h create mode 100644 bacula/src/win32/compat/netdb.h create mode 100644 bacula/src/win32/compat/netinet/in.h create mode 100644 bacula/src/win32/compat/netinet/tcp.h create mode 100644 bacula/src/win32/compat/print.cpp create mode 100644 bacula/src/win32/compat/pwd.h create mode 100644 bacula/src/win32/compat/stdint.h create mode 100644 bacula/src/win32/compat/strings.h create mode 100644 bacula/src/win32/compat/sys/file.h create mode 100644 bacula/src/win32/compat/sys/ioctl.h create mode 100644 bacula/src/win32/compat/sys/mtio.h create mode 100644 bacula/src/win32/compat/sys/socket.h create mode 100644 bacula/src/win32/compat/sys/stat.h create mode 100644 bacula/src/win32/compat/sys/time.h create mode 100644 bacula/src/win32/compat/sys/wait.h create mode 100644 bacula/src/win32/compat/syslog.h create mode 100644 bacula/src/win32/compat/unistd.h create mode 100644 bacula/src/win32/compat/winapi.c create mode 100644 bacula/src/win32/compat/winapi.h create mode 100644 bacula/src/win32/compat/winhdrs.h create mode 100644 bacula/src/win32/compat/winhost.h create mode 100644 bacula/src/win32/compat/winsock.h create mode 100644 bacula/src/win32/compat/xwinconfig.h create mode 100644 bacula/src/win32/console/Makefile create mode 100644 bacula/src/win32/console/console.vcproj create mode 100644 bacula/src/win32/cygwin.NET.bashrc create mode 100644 bacula/src/win32/dird/Makefile create mode 100644 bacula/src/win32/dird/bacula.rc create mode 100644 bacula/src/win32/dird/dird.vcproj create mode 100644 bacula/src/win32/dird/main.cpp create mode 100644 bacula/src/win32/dird/service.cpp create mode 100644 bacula/src/win32/dird/who.h create mode 100644 bacula/src/win32/filed/Makefile create mode 100644 bacula/src/win32/filed/bacula-fd.manifest create mode 100644 bacula/src/win32/filed/bacula.rc create mode 100644 bacula/src/win32/filed/baculafd.vcproj create mode 100644 bacula/src/win32/filed/main.cpp create mode 100644 bacula/src/win32/filed/plugins/Makefile create mode 100644 bacula/src/win32/filed/plugins/alldrives-fd.c create mode 100644 bacula/src/win32/filed/plugins/alldrives-fd.def create mode 100644 bacula/src/win32/filed/plugins/api.c create mode 100644 bacula/src/win32/filed/plugins/api.h create mode 100644 bacula/src/win32/filed/plugins/bpipe-fd.c create mode 100644 bacula/src/win32/filed/plugins/bpipe-fd.def create mode 100644 bacula/src/win32/filed/plugins/comadmin.h create mode 100644 bacula/src/win32/filed/plugins/dbi_node.c create mode 100644 bacula/src/win32/filed/plugins/exch_api.c create mode 100644 bacula/src/win32/filed/plugins/exch_api.h create mode 100644 bacula/src/win32/filed/plugins/exch_dbi_node.c create mode 100644 bacula/src/win32/filed/plugins/exch_file_node.c create mode 100644 bacula/src/win32/filed/plugins/exch_node.c create mode 100644 bacula/src/win32/filed/plugins/exch_node.h create mode 100644 bacula/src/win32/filed/plugins/exch_root_node.c create mode 100644 bacula/src/win32/filed/plugins/exch_service_node.c create mode 100644 bacula/src/win32/filed/plugins/exch_storage_group_node.c create mode 100644 bacula/src/win32/filed/plugins/exch_store_node.c create mode 100644 bacula/src/win32/filed/plugins/exchange-fd.c create mode 100644 bacula/src/win32/filed/plugins/exchange-fd.def create mode 100644 bacula/src/win32/filed/plugins/exchange-fd.h create mode 100644 bacula/src/win32/filed/plugins/file_node.c create mode 100644 bacula/src/win32/filed/plugins/node.c create mode 100644 bacula/src/win32/filed/plugins/node.h create mode 100644 bacula/src/win32/filed/plugins/root_node.c create mode 100644 bacula/src/win32/filed/plugins/service_node.c create mode 100644 bacula/src/win32/filed/plugins/storage_group_node.c create mode 100644 bacula/src/win32/filed/plugins/store_node.c create mode 100644 bacula/src/win32/filed/service.cpp create mode 100644 bacula/src/win32/filed/trayMonitor.cpp create mode 100644 bacula/src/win32/filed/vss.cpp create mode 100644 bacula/src/win32/filed/vss.h create mode 100644 bacula/src/win32/filed/vss_Vista.cpp create mode 100644 bacula/src/win32/filed/vss_W2K3.cpp create mode 100644 bacula/src/win32/filed/vss_XP.cpp create mode 100644 bacula/src/win32/filed/vss_generic.cpp create mode 100644 bacula/src/win32/filed/who.h create mode 100644 bacula/src/win32/full_win32_installer/ConfigPage1.nsh create mode 100644 bacula/src/win32/full_win32_installer/ConfigPage2.nsh create mode 100644 bacula/src/win32/full_win32_installer/DumpLog.nsh create mode 100644 bacula/src/win32/full_win32_installer/InstallType.ini create mode 100644 bacula/src/win32/full_win32_installer/InstallType.nsh create mode 100644 bacula/src/win32/full_win32_installer/Start.bat create mode 100644 bacula/src/win32/full_win32_installer/Stop.bat create mode 100644 bacula/src/win32/full_win32_installer/WriteTemplates.ini create mode 100644 bacula/src/win32/full_win32_installer/bacula-dir.conf.in create mode 100644 bacula/src/win32/full_win32_installer/bacula-fd.conf.in create mode 100644 bacula/src/win32/full_win32_installer/bacula-logo.bmp create mode 100644 bacula/src/win32/full_win32_installer/bacula-sd.conf.in create mode 100644 bacula/src/win32/full_win32_installer/bat.conf.in create mode 100644 bacula/src/win32/full_win32_installer/bconsole.conf.in create mode 100644 bacula/src/win32/full_win32_installer/build-installer.cmd create mode 100644 bacula/src/win32/full_win32_installer/bwx-console.conf.in create mode 100644 bacula/src/win32/full_win32_installer/client.conf.in create mode 100644 bacula/src/win32/full_win32_installer/installer.vcproj create mode 100644 bacula/src/win32/full_win32_installer/storage.conf.in create mode 100644 bacula/src/win32/full_win32_installer/winbacula.nsi create mode 100644 bacula/src/win32/lib/Makefile create mode 100644 bacula/src/win32/lib/bacula32.def create mode 100644 bacula/src/win32/lib/bacula64.def create mode 100755 bacula/src/win32/lib/make_def32 create mode 100755 bacula/src/win32/lib/make_def64 create mode 100644 bacula/src/win32/libbac/Makefile create mode 100644 bacula/src/win32/libbac/libbac.vcproj create mode 100644 bacula/src/win32/libbac/msvc/bacula.def create mode 100644 bacula/src/win32/libwin32/aboutDialog.cpp create mode 100644 bacula/src/win32/libwin32/aboutDialog.h create mode 100644 bacula/src/win32/libwin32/bacula.bmp create mode 100644 bacula/src/win32/libwin32/bacula.ico create mode 100644 bacula/src/win32/libwin32/bacula.rc create mode 100644 bacula/src/win32/libwin32/error.ico create mode 100644 bacula/src/win32/libwin32/idle.ico create mode 100644 bacula/src/win32/libwin32/main.cpp create mode 100644 bacula/src/win32/libwin32/protos.h create mode 100644 bacula/src/win32/libwin32/res.h create mode 100644 bacula/src/win32/libwin32/running.ico create mode 100644 bacula/src/win32/libwin32/saving.ico create mode 100644 bacula/src/win32/libwin32/service.cpp create mode 100644 bacula/src/win32/libwin32/statusDialog.cpp create mode 100644 bacula/src/win32/libwin32/statusDialog.h create mode 100644 bacula/src/win32/libwin32/trayMonitor.cpp create mode 100644 bacula/src/win32/libwin32/trayMonitor.h create mode 100644 bacula/src/win32/libwin32/warn.ico create mode 100644 bacula/src/win32/libwin32/win32.h create mode 100755 bacula/src/win32/makeall create mode 100644 bacula/src/win32/patches/binutils_texinfo_version.patch create mode 100644 bacula/src/win32/patches/dvd+rw-tools.patch create mode 100644 bacula/src/win32/patches/mingw-utils.patch create mode 100644 bacula/src/win32/patches/mt.patch create mode 100644 bacula/src/win32/patches/mtx-msvc1.patch create mode 100644 bacula/src/win32/patches/mtx-msvc2.patch create mode 100644 bacula/src/win32/patches/mtx.patch create mode 100644 bacula/src/win32/patches/nsis.patch create mode 100644 bacula/src/win32/patches/openssl-w64.patch create mode 100644 bacula/src/win32/patches/openssl.patch create mode 100644 bacula/src/win32/patches/pcre.patch create mode 100644 bacula/src/win32/patches/postgresql.patch create mode 100644 bacula/src/win32/patches/pthreads-w64.patch create mode 100644 bacula/src/win32/patches/pthreads.patch create mode 100644 bacula/src/win32/patches/qt4-compilation-see.patch create mode 100644 bacula/src/win32/patches/qt4-compilation.patch create mode 100644 bacula/src/win32/patches/qt4-intrinsics.patch create mode 100644 bacula/src/win32/patches/qt4-widget-ui.patch create mode 100644 bacula/src/win32/patches/sed.patch create mode 100644 bacula/src/win32/patches/sed_msc.patch create mode 100644 bacula/src/win32/patches/sqlite.patch create mode 100644 bacula/src/win32/patches/sqlite_msc.patch create mode 100644 bacula/src/win32/patches/stab2cv.patch create mode 100644 bacula/src/win32/patches/wx.sed create mode 100644 bacula/src/win32/patches/wx1.patch create mode 100644 bacula/src/win32/patches/wx2.patch create mode 100644 bacula/src/win32/patches/wxWidgets.patch create mode 100644 bacula/src/win32/patches/zlib.patch create mode 100644 bacula/src/win32/pebuilder/Makefile.in create mode 100644 bacula/src/win32/pebuilder/README create mode 100644 bacula/src/win32/pebuilder/bacula/bacula.inf create mode 100644 bacula/src/win32/pebuilder/bacula/bacula_nu2menu.xml create mode 100644 bacula/src/win32/scripts/Makefile create mode 100644 bacula/src/win32/scripts/bsleep.c create mode 100644 bacula/src/win32/scripts/bsleep.vcproj create mode 100644 bacula/src/win32/scripts/disk-changer.cmd create mode 100644 bacula/src/win32/scripts/dvd-handler.cmd create mode 100644 bacula/src/win32/scripts/mtx-changer.cmd create mode 100644 bacula/src/win32/stored/Makefile create mode 100644 bacula/src/win32/stored/bacula.rc create mode 100644 bacula/src/win32/stored/baculasd.vcproj create mode 100644 bacula/src/win32/stored/bcopy/bcopy.vcproj create mode 100644 bacula/src/win32/stored/bextract/bextract.vcproj create mode 100644 bacula/src/win32/stored/bls/bls.vcproj create mode 100644 bacula/src/win32/stored/bscan/bscan.vcproj create mode 100644 bacula/src/win32/stored/btape/btape.vcproj create mode 100644 bacula/src/win32/stored/main.cpp create mode 100644 bacula/src/win32/stored/mtops.cpp create mode 100644 bacula/src/win32/stored/postest/postest.cpp create mode 100644 bacula/src/win32/stored/postest/postest.vcproj create mode 100644 bacula/src/win32/stored/service.cpp create mode 100644 bacula/src/win32/stored/storelib/storelib.vcproj create mode 100644 bacula/src/win32/stored/trayMonitor.cpp create mode 100644 bacula/src/win32/stored/who.h create mode 100644 bacula/src/win32/stored/win_tape_device.cpp create mode 100644 bacula/src/win32/tools/Makefile create mode 100644 bacula/src/win32/tools/ScsiDeviceList.cpp create mode 100644 bacula/src/win32/tools/ScsiDeviceList.h create mode 100644 bacula/src/win32/tools/bsmtp/bsmtp.vcproj create mode 100644 bacula/src/win32/tools/dbcheck/dbcheck.vcproj create mode 100644 bacula/src/win32/tools/drivetype/drivetype.vcproj create mode 100644 bacula/src/win32/tools/fstype/fstype.vcproj create mode 100644 bacula/src/win32/tools/scsilist.cpp create mode 100644 bacula/src/win32/tools/scsilist/scsilist.vcproj create mode 100644 bacula/src/win32/tools/testfind/testfind.vcproj create mode 100644 bacula/src/win32/tools/testls/testls.vcproj create mode 100644 bacula/src/win32/win32_installer/ConfigPage1.nsh create mode 100644 bacula/src/win32/win32_installer/ConfigPage2.nsh create mode 100644 bacula/src/win32/win32_installer/DumpLog.nsh create mode 100644 bacula/src/win32/win32_installer/InstallType.ini create mode 100644 bacula/src/win32/win32_installer/InstallType.nsh create mode 100644 bacula/src/win32/win32_installer/Makefile create mode 100755 bacula/src/win32/win32_installer/Readme.txt create mode 100644 bacula/src/win32/win32_installer/Start.bat create mode 100644 bacula/src/win32/win32_installer/Stop.bat create mode 100644 bacula/src/win32/win32_installer/WriteTemplates.ini create mode 100644 bacula/src/win32/win32_installer/bacula-dir.conf.in create mode 100644 bacula/src/win32/win32_installer/bacula-fd.conf.in create mode 100644 bacula/src/win32/win32_installer/bacula-logo.bmp create mode 100644 bacula/src/win32/win32_installer/bacula-sd.conf.in create mode 100644 bacula/src/win32/win32_installer/bat.conf.in create mode 100644 bacula/src/win32/win32_installer/bconsole.conf.in create mode 100644 bacula/src/win32/win32_installer/bs-logo.bmp create mode 100644 bacula/src/win32/win32_installer/build-installer.cmd create mode 100644 bacula/src/win32/win32_installer/bwx-console.conf.in create mode 100644 bacula/src/win32/win32_installer/client.conf.in create mode 100644 bacula/src/win32/win32_installer/installer.vcproj create mode 100644 bacula/src/win32/win32_installer/storage.conf.in create mode 100644 bacula/src/win32/win32_installer/tray-monitor.conf.in create mode 100644 bacula/src/win32/win32_installer/winbacula.nsi create mode 100644 bacula/src/win32/win32_installer/x64.nsh create mode 100644 bacula/src/win32/win64_installer/ConfigPage1.nsh create mode 100644 bacula/src/win32/win64_installer/ConfigPage2.nsh create mode 100644 bacula/src/win32/win64_installer/DumpLog.nsh create mode 100644 bacula/src/win32/win64_installer/InstallType.ini create mode 100644 bacula/src/win32/win64_installer/InstallType.nsh create mode 100644 bacula/src/win32/win64_installer/Makefile create mode 100755 bacula/src/win32/win64_installer/Readme.txt create mode 100644 bacula/src/win32/win64_installer/Start.bat create mode 100644 bacula/src/win32/win64_installer/Stop.bat create mode 100644 bacula/src/win32/win64_installer/WriteTemplates.ini create mode 100644 bacula/src/win32/win64_installer/bacula-dir.conf.in create mode 100644 bacula/src/win32/win64_installer/bacula-fd.conf.in create mode 100644 bacula/src/win32/win64_installer/bacula-logo.bmp create mode 100644 bacula/src/win32/win64_installer/bacula-sd.conf.in create mode 100644 bacula/src/win32/win64_installer/bacula-tray-monitor.conf.in create mode 100644 bacula/src/win32/win64_installer/bat.conf.in create mode 100644 bacula/src/win32/win64_installer/bconsole.conf.in create mode 100644 bacula/src/win32/win64_installer/bs-logo.bmp create mode 100644 bacula/src/win32/win64_installer/bwx-console.conf.in create mode 100644 bacula/src/win32/win64_installer/client.conf.in create mode 100644 bacula/src/win32/win64_installer/installer.vcproj create mode 100644 bacula/src/win32/win64_installer/storage.conf.in create mode 100644 bacula/src/win32/win64_installer/tray-monitor.conf.in create mode 100644 bacula/src/win32/win64_installer/winbacula.nsi create mode 100644 bacula/src/win32/winapi.h create mode 100755 bacula/src/win32/wx-console/Makefile create mode 100644 bacula/src/win32/wx-console/bwx-console.manifest create mode 100644 bacula/src/win32/wx-console/w32api.h create mode 100644 bacula/src/win32/wx-console/wx-console.vcproj diff --git a/bacula/Makefile.in b/bacula/Makefile.in index 64db60f03d..1a80577e87 100755 --- a/bacula/Makefile.in +++ b/bacula/Makefile.in @@ -160,8 +160,8 @@ Makefile: Makefile.in Makefiles: $(SHELL) config.status (cd scripts; \ - chmod 755 startmysql stopmysql bacula startit stopit btraceback \ - mtx-changer bconsole gconsole devel_bacula dvd-handler) + chmod 755 bacula sbtraceback \ + mtx-changer bconsole devel_bacula) (cd src/cats; \ chmod 755 create_bacula_database update_bacula_tables \ make_bacula_tables grant_bacula_privileges drop_bacula_tables \ diff --git a/bacula/README b/bacula/README index 01912f79ab..65b441d7b9 100644 --- a/bacula/README +++ b/bacula/README @@ -51,12 +51,12 @@ To start it: To start it (as a developer). This is not appropriate if you are installing Bacula. - ./startit + ./bacula start ./console To stop it: - ./stopit + ./bacula stop Well, it is all just a bit more complicated than that, but you should have the idea. diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index d8f1e03fd3..b10962811e 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -499,6 +499,9 @@ /* Define to 1 if you have the 'getproplist' function. */ #undef HAVE_GETPROPLIST +/* Define to 1 if you have the `getrlimit' function. */ +#undef HAVE_GETRLIMIT + /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT @@ -740,6 +743,9 @@ /* Set to enable readline support */ #undef HAVE_READLINE +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + /* Define to 1 if you have the header file. */ #undef HAVE_REGEX_H diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 4ddb8269ce..c1623a3779 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -19,6 +19,14 @@ AC_SUBST(TOP_DIR) AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf) AC_CONFIG_HEADERS(src/config.h:autoconf/config.h.in) +dnl minimal Win32 stuff for "make clean" +WIN32BUILDDIR=${BUILD_DIR}/src/win32 +WIN32MAINDIR=${BUILD_DIR} +WIN32TOPDIR=${TOP_DIR} +AC_SUBST(WIN32BUILDDIR) +AC_SUBST(WIN32MAINDIR) +AC_SUBST(WIN32TOPDIR) + dnl search for true and false programs. AC_PATH_PROGS(TRUEPRG, true, :) AC_PATH_PROGS(FALSEPRG, false, :) @@ -2249,6 +2257,8 @@ AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)]) AC_CHECK_FUNCS(posix_fadvise) AC_CHECK_FUNCS(posix_fallocate) AC_CHECK_FUNCS(fdatasync) +AC_CHECK_FUNCS(realpath) +AC_CHECK_FUNCS(getrlimit) AC_CHECK_FUNCS(chflags) @@ -3400,6 +3410,7 @@ AC_OUTPUT([autoconf/Make.common \ src/plugins/fd/Makefile \ src/plugins/sd/Makefile \ src/plugins/dir/Makefile \ + src/win32/Makefile.inc \ po/Makefile.in \ updatedb/update_mysql_tables \ updatedb/update_sqlite3_tables \ diff --git a/bacula/configure b/bacula/configure index 8ae8e33442..8e635ca950 100755 --- a/bacula/configure +++ b/bacula/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for bacula 9.0.6. +# Generated by GNU Autoconf 2.69 for bacula 9.0.7. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bacula' PACKAGE_TARNAME='bacula' -PACKAGE_VERSION='9.0.6' -PACKAGE_STRING='bacula 9.0.6' +PACKAGE_VERSION='9.0.7' +PACKAGE_STRING='bacula 9.0.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -896,6 +896,9 @@ DATE VERSION FALSEPRG TRUEPRG +WIN32TOPDIR +WIN32MAINDIR +WIN32BUILDDIR TOP_DIR BUILD_DIR target_alias @@ -1583,7 +1586,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bacula 9.0.6 to adapt to many kinds of systems. +\`configure' configures bacula 9.0.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1653,7 +1656,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bacula 9.0.6:";; + short | recursive ) echo "Configuration of bacula 9.0.7:";; esac cat <<\_ACEOF @@ -1852,7 +1855,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bacula configure 9.0.6 +bacula configure 9.0.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2787,7 +2790,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bacula $as_me 9.0.6, which was +It was created by bacula $as_me 9.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3178,6 +3181,13 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_config_headers="$ac_config_headers src/config.h:autoconf/config.h.in" +WIN32BUILDDIR=${BUILD_DIR}/src/win32 +WIN32MAINDIR=${BUILD_DIR} +WIN32TOPDIR=${TOP_DIR} + + + + for ac_prog in true do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -28635,6 +28645,28 @@ _ACEOF fi done +for ac_func in realpath +do : + ac_fn_c_check_func "$LINENO" "realpath" "ac_cv_func_realpath" +if test "x$ac_cv_func_realpath" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_REALPATH 1 +_ACEOF + +fi +done + +for ac_func in getrlimit +do : + ac_fn_c_check_func "$LINENO" "getrlimit" "ac_cv_func_getrlimit" +if test "x$ac_cv_func_getrlimit" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETRLIMIT 1 +_ACEOF + +fi +done + for ac_func in chflags do : @@ -31190,7 +31222,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then fi -ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/btraceback scripts/bconsole scripts/baculabackupreport scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/bat.desktop scripts/bat.desktop.xsu scripts/bat.desktop.consolehelper scripts/bat.console_apps scripts/bacula-tray-monitor.desktop src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/qt-console/bat.conf src/qt-console/bat.pro src/qt-console/bat.pro.mingw32 src/qt-console/bat.pro.mingw64 src/qt-console/install_conf_file src/qt-console/tray-monitor/tray-monitor.conf src/qt-console/tray-monitor/tray-monitor.pro src/qt-console/tray-monitor/tray-monitor.pro.mingw32 src/qt-console/tray-monitor/tray-monitor.pro.mingw64 src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/cats/Makefile src/cats/make_catalog_backup.pl src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/cats/install-default-backend src/findlib/Makefile src/tools/Makefile src/plugins/fd/Makefile src/plugins/sd/Makefile src/plugins/dir/Makefile po/Makefile.in updatedb/update_mysql_tables updatedb/update_sqlite3_tables updatedb/update_postgresql_tables updatedb/update_mysql_tables_9_to_10 updatedb/update_sqlite3_tables_9_to_10 updatedb/update_postgresql_tables_9_to_10 updatedb/update_mysql_tables_10_to_11 updatedb/update_sqlite3_tables_10_to_11 updatedb/update_postgresql_tables_10_to_11 updatedb/update_mysql_tables_11_to_12 updatedb/update_sqlite3_tables_11_to_12 updatedb/update_postgresql_tables_11_to_12 examples/nagios/check_bacula/Makefile platforms/rpms/redhat/bacula.spec platforms/rpms/redhat/bacula-bat.spec platforms/rpms/redhat/bacula-docs.spec platforms/rpms/redhat/bacula-mtx.spec platforms/rpms/suse/bacula.spec platforms/rpms/suse/bacula-bat.spec platforms/rpms/suse/bacula-docs.spec platforms/rpms/suse/bacula-mtx.spec $PFILES" +ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/btraceback scripts/bconsole scripts/baculabackupreport scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/bat.desktop scripts/bat.desktop.xsu scripts/bat.desktop.consolehelper scripts/bat.console_apps scripts/bacula-tray-monitor.desktop src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/qt-console/bat.conf src/qt-console/bat.pro src/qt-console/bat.pro.mingw32 src/qt-console/bat.pro.mingw64 src/qt-console/install_conf_file src/qt-console/tray-monitor/tray-monitor.conf src/qt-console/tray-monitor/tray-monitor.pro src/qt-console/tray-monitor/tray-monitor.pro.mingw32 src/qt-console/tray-monitor/tray-monitor.pro.mingw64 src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/cats/Makefile src/cats/make_catalog_backup.pl src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/cats/install-default-backend src/findlib/Makefile src/tools/Makefile src/plugins/fd/Makefile src/plugins/sd/Makefile src/plugins/dir/Makefile src/win32/Makefile.inc po/Makefile.in updatedb/update_mysql_tables updatedb/update_sqlite3_tables updatedb/update_postgresql_tables updatedb/update_mysql_tables_9_to_10 updatedb/update_sqlite3_tables_9_to_10 updatedb/update_postgresql_tables_9_to_10 updatedb/update_mysql_tables_10_to_11 updatedb/update_sqlite3_tables_10_to_11 updatedb/update_postgresql_tables_10_to_11 updatedb/update_mysql_tables_11_to_12 updatedb/update_sqlite3_tables_11_to_12 updatedb/update_postgresql_tables_11_to_12 examples/nagios/check_bacula/Makefile platforms/rpms/redhat/bacula.spec platforms/rpms/redhat/bacula-bat.spec platforms/rpms/redhat/bacula-docs.spec platforms/rpms/redhat/bacula-mtx.spec platforms/rpms/suse/bacula.spec platforms/rpms/suse/bacula-bat.spec platforms/rpms/suse/bacula-docs.spec platforms/rpms/suse/bacula-mtx.spec $PFILES" ac_config_commands="$ac_config_commands default" @@ -31701,7 +31733,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bacula $as_me 9.0.6, which was +This file was extended by bacula $as_me 9.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31767,7 +31799,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bacula config.status 9.0.6 +bacula config.status 9.0.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -32359,6 +32391,7 @@ do "src/plugins/fd/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/fd/Makefile" ;; "src/plugins/sd/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/sd/Makefile" ;; "src/plugins/dir/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/dir/Makefile" ;; + "src/win32/Makefile.inc") CONFIG_FILES="$CONFIG_FILES src/win32/Makefile.inc" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "updatedb/update_mysql_tables") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables" ;; "updatedb/update_sqlite3_tables") CONFIG_FILES="$CONFIG_FILES updatedb/update_sqlite3_tables" ;; diff --git a/bacula/examples/sd-tool b/bacula/examples/sd-tool new file mode 100755 index 0000000000..e2de65087c --- /dev/null +++ b/bacula/examples/sd-tool @@ -0,0 +1,608 @@ +#!/bin/bash + +# sd-tool - Tool to manipulate tapes and tape-changers +# Copyright (C) 2010, 2011 Dennis Leeuw +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +BACULA_PID_DIR="/opt/bacula/working" +MTX_DEV="/dev/tape/by-id/scsi-1ADIC_A0C0410012_LLA-changer" +DRIVES=(/dev/tape/by-id/scsi-3500308c0a08d1000-nst /dev/tape/by-id/scsi-3500308c0a08d1004-nst) + +function set_dte_data() { + # This function sets the DTE_voltag and DTE_slots arrays + echo -n "See what's in the drives... " + local tmp="" + for (( I=0; $I < ${#STATUS_ARRAY[*]}; I=$(($I+1)) )) + do + if [ "${STATUS_ARRAY[$I]#Data Transfer Element}" != "${STATUS_ARRAY[$I]}" ] + then + # Line looks like this: + # Data Transfer Element 1:Full (Storage Element 7 Loaded):VolumeTag = 000006 + DTE_number=${STATUS_ARRAY[$I]#Data Transfer Element } + DTE_number=${DTE_number%%:*} + + # Check Full fist + if [ "${STATUS_ARRAY[$I]#*:Full}" != "${STATUS_ARRAY[$I]}" ] + then + # We now know we are a DTE and we have a tape + tmp=${STATUS_ARRAY[$I]#*Storage Element } + tmp=${tmp%% *} + DTE_slots[$DTE_number]=${tmp} + tmp=${STATUS_ARRAY[$I]#*VolumeTag = } + DTE_voltag[$DTE_number]=`echo ${tmp}` + fi + fi + done + echo "done." + return 0 +} + +function set_ie_data() { + # This function sets the IE_voltag and IE_slots_empty and IE_slots_full arrays + echo -n "See what's in the Import/Export slots... " + local count_full=0 + local count_empty=0 + local tmp="" + for (( I=0; $I < ${#STATUS_ARRAY[*]}; I=$(($I+1)) )) + do + if [ "${STATUS_ARRAY[$I]# Storage Element}" != "${STATUS_ARRAY[$I]}" ] && + [ "${STATUS_ARRAY[$I]#*IMPORT/EXPORT}" != "${STATUS_ARRAY[$I]}" ] + then + # Line looks like this: + # Storage Element 36 IMPORT/EXPORT:Empty:VolumeTag= + + # Check Full fist + if [ "${STATUS_ARRAY[$I]#*:Full}" != "${STATUS_ARRAY[$I]}" ] + then + # We now know we are a IE and we have a tape + tmp=${STATUS_ARRAY[$I]#*Storage Element } + tmp=${tmp%% *} + IE_slots_full[$count_full]=${tmp} + tmp=${STATUS_ARRAY[$I]#*VolumeTag=} + IE_voltag[$count_full]=`echo ${tmp}` + count_full=$(($count_full+1)) + else + # Line is Empty + tmp=${STATUS_ARRAY[$I]#*Storage Element } + tmp=${tmp%% *} + IE_slots_empty[$count_empty]=${tmp} + count_empty=$(($count_empty+1)) + fi + fi + done + echo "done." + return 0 +} + +function set_se_data() { + # This function sets the SE_voltag and SE_slots_empty and SE_slots_full arrays + echo -n "See what's in the slots... " + local count_full=0 + local count_empty=0 + local tmp="" + for (( I=0; $I < ${#STATUS_ARRAY[*]}; I=$(($I+1)) )) + do + if [ "${STATUS_ARRAY[$I]# Storage Element}" != "${STATUS_ARRAY[$I]}" ] && + [ "${STATUS_ARRAY[$I]#*IMPORT/EXPORT}" = "${STATUS_ARRAY[$I]}" ] + then + # Line looks like this: + # Storage Element 30:Full :VolumeTag=000035 + + # Check Full fist + if [ "${STATUS_ARRAY[$I]#*:Full}" != "${STATUS_ARRAY[$I]}" ] + then + # We now know we are a SE and we have a tape + tmp=${STATUS_ARRAY[$I]#*Storage Element } + tmp=${tmp%%:*} + SE_slots_full[$count_full]=${tmp} + tmp=${STATUS_ARRAY[$I]#*VolumeTag=} + SE_voltag[$count_full]=`echo ${tmp}` + count_full=$(($count_full+1)) + else + # Line is Empty + tmp=${STATUS_ARRAY[$I]#*Storage Element } + tmp=${tmp%%:*} + + # Test if tape is in a drive + local full=0 + for (( N=0; $N < ${#DTE_slots[*]}; N=$(($N+1)) )) + do + if [ "$tmp" = "${DTE_slots[$N]}" ] + then + SE_slots_full[$count_full]=${tmp} + SE_voltag[$count_full]=${DTE_voltag[$N]} + full=1 + count_full=$(($count_full+1)) + fi + done + + # If it is not in a drive mark it as empty` + if [ "$full" = "0" ] + then + SE_slots_empty[$count_empty]=${tmp} + count_empty=$(($count_empty+1)) + fi + fi + count=$(($count+1)) + fi + done + IE_slots=$count + echo "done." + return 0 +} +function set_mtx_status() { + echo -n "Retrieving changer information... " + local IFS=$'\n' + STATUS_ARRAY=(`mtx -f ${MTX_DEV} status`) + echo "done." +} +function set_mtx_data() { + # Collect MTX data + set_mtx_status + + # Set data from MTX status + set_dte_data + set_se_data + set_ie_data + + return 0 +} +function error_handler() { + echo $2 + if [ "$1" = "fatal" ]; then + exit 1 + fi +} +function get_storage_from_pool() { + # Fetch the Storage name from the Pool resource + local storage=`echo "show pool=$1" | /opt/bacula/bin/bconsole | grep Storage:` + local err=$? + storage=${storage#*name=} + storage=${storage%% *} + echo $storage + return $err +} +function get_empty_drive() { + local drive_index=-1 + local my_storage=`get_storage_from_pool $pool` + + # Find the device(s) without writers + local IFS=$'\n' + local free_device=(`echo "status storage=${my_storage}" | /opt/bacula/bin/bconsole | grep -B1 writers=0| head -1`) + local err=$? + + # We only want 1, so we take the first one: + free_device=${free_device[0]##*(} + free_device=${free_device%)*} + for (( I=0; $I < ${#DRIVES[*]}; I=$(($I+1)) )); do + if [ "${DRIVES[$I]}" = "${free_device}" ]; then + drive_index=$I + fi + done + + if [ "${drive_index}" = "-1" ]; then + echo "No free drive available" + return 1 + fi + echo $drive_index + return $err +} +function update_slots() { + if [ "$1" != "" ]; then + pool=$1 + fi + + if [ "$pool" = "" ]; then + echo "update_slots: No 'pool' set" + exit 1 + fi + local my_storage=`get_storage_from_pool $pool` + if [ "$my_storage" = "" ]; then + echo "update_slots: No storage found for $pool" + exit 1 + fi + + echo -n "Updating slots... " + echo "update storage=${my_storage} drive=0 slots" | /opt/bacula/bin/bconsole 2>/dev/null 1>/dev/null + if [ $? = 0 ]; then + echo "done." + else + echo "failed." + # Continue after failed... should we? + fi +} +function unload_drive() { + local slot=$1 + local drive=$2 + echo "mtx -f $MTX_DEV unload $slot $drive" + mtx -f $MTX_DEV unload $slot $drive + return $? +} +function stop_sd() { + local sleep=0 + echo -n "Stopping bacula-sd... " + service bacula-sd stop 1>/dev/null 2>/dev/null + + while([ -f ${BACULA_PID_DIR}/bacula-sd.*.pid ]); do + sleep 2 + sleep=$(($sleep+2)) + + if [ $sleep = 10 ]; then + error_handler fatal "failed." + fi + done + + echo "done." + return 0 +} +function help__() { + # Call all help functions + help_show_ + help_remove_ + help_load_ + help_unload_ +} +function help_unload_() { + echo "Syntax: $0 unload from " + echo " unload from " + echo " a single volume or a space seperated list of volumes" + echo " the name of the pool the volumes should come from" +} + +function _unload_() { + for volname in $@ + do + + # Find volname in SE_voltag + # set org_slot from SE_slots + for (( N=0; $N < ${#SE_voltag[*]}; N=$(($N+1)) )) + do + if [ "$volname" = "${SE_voltag[$N]}" ] + then + org_slot="${SE_slots_full[$N]}" + fi + done + + # Set first (last) free export slot + dest_slot=${IE_slots_empty[${#IE_slots_empty[*]}-1]} + + unset IE_slots_empty[${#IE_slots_empty[*]}-1] + + echo -n "Unloading $volname from ${org_slot} to ${dest_slot}... " + mtx -f ${MTX_DEV} eepos 0 transfer ${org_slot} ${dest_slot} + if [ $? = 0 ]; then + echo "done." + else + echo "failed." + fi + done + + # Make sure the catalog knows about it + update_slots + return 0 +} +### LOAD ### +function _load_() { + # Make sure we have updated information + if [ "$pool" != "Scratch" ]; then + update_slots + fi + + # If no slots are filled, do nothing + if [ "${#IE_voltag[*]}" = 0 ]; then + # Check MTX again, just to be sure + set_mtx_status 2>/dev/null 1>/dev/null + set_mtx_data 2>/dev/null 1>/dev/null + if [ "${#IE_voltag[*]}" = 0 ]; then + echo "There is nothing in the Import/Export slots." + exit 0 + fi + fi + + # Per filled IE slot load the tape if there is room + slots_line="" + for (( N=0; $N < ${#IE_voltag[*]}; N=$(($N+1)) )) + do + # Reset test variables + known_volume="" + + # Figure out our destination slot + if [ "${#SE_slots_empty}" = "0" ]; then + error_handler fatal "There are no more empty slots." + fi + + dest_slot=${SE_slots_empty[${#SE_slots_empty[*]}-1]} + + unset SE_slots_empty[${#SE_slots_empty[*]}-1] + + # Is the volume already known to the catalog + known_volume=`echo "list media pool=$pool" | /opt/bacula/bin/bconsole | sed -e 's/ */ /g' | grep "| ${IE_voltag[$N]} |"` + + # Move tape from IE to slot + echo -n "Loading ${IE_voltag[$N]} from ${IE_slots_full[$N]} to ${dest_slot}... " + mtx -f ${MTX_DEV} eepos 0 transfer ${IE_slots_full[$N]} ${dest_slot} + if [ $? = 0 ]; then + echo "done." + if [ "$known_volume" = "" ]; then + slots_line="${slots_line},${dest_slot}" + fi + else + echo "failed." + fi + done + + # Let the catalog know + if [ "$pool" != "Scratch" ]; then + update_slots + fi + + # If slots line is empty, we have only loaded tapes that already were in the catalog + # So they must have a label... oeps assumption! + if [ "$slots_line" != "" ]; then + # Label them tapes + # FIXME this only works with barcode labeling + local my_free_drive=`get_empty_drive` + if [ $? != 0 ]; then + echo + echo "label storage=${my_storage} pool=${pool} slots=${slots_line#,} drive=${my_free_drive} barcodes" + error_handler fatal "No free drive found" + fi + local my_storage=`get_storage_from_pool $pool` + if [ $? != 0 ]; then + echo "label storage=${my_storage} pool=${pool} slots=${slots_line#,} drive=${my_free_drive} barcodes" + error_handler fatal "No valid free drive found" + fi + echo -n "Labeling new tapes, with: label storage=${my_storage} pool=${pool} slots=${slots_line#,} drive=${my_free_drive} barcodes" + echo -e "label storage=${my_storage} pool=${pool} slots=${slots_line#,} drive=${my_free_drive} barcodes\nyes" | /opt/bacula/bin/bconsole + #2>/dev/null 1>/dev/null + if [ $? = 0 ]; then + echo "done." + else + echo "failed." + fi + + # Better safe then sorry + if [ "$pool" != "Scratch" ]; then + update_slots + fi + fi + + return 0 +} + +function help_load_() { + echo "Syntax: $0 load into " + echo " Load all tapes from the IE-slots into " + echo " the name of the pool the volumes should be loaded into" +} +# END LOAD # +function help_show_() { + help_show_oldest +} + +function help_show_oldest() { + echo "Syntax: $0 show oldest [number] from " + echo " [number] amount of tapes to be unloaded, if no number is given then the amount of free IE slots is used" + echo " the name of the pool the volumes should come from" +} +function _show_oldest() { + # Provide amount of I/E slots we can use + # Script returns volumes + + # Check number + if [ "$number" = "" ]; then + free_slots=${#IE_slots_empty[*]} + else + free_slots=$number + fi + + # Check pool + if [ "$pool" = "" ]; then + error_handler fatal "No pool given" + fi + + # Global IFS setting + IFS=$'\n' + + # Make sure we get updated information + update_slots 1>/dev/null 2>/dev/null + + # Get all tapes that can be ejected + local N=0 + for line in `echo "list media pool=${pool}" | /opt/bacula/bin/bconsole | egrep -e 'Full|Error|Used'`; do + # Check if tape is in the drive + # We only want to unload loaded tapes + tmp=`echo ${line} | cut -d'|' -f11` + if [ "${tmp:$((${#tmp}-2)):1}" = "1" ]; then + loadedtape_list[$N]=$line + N=$(($N+1)) + fi + done + + # Sort on last written (get the oldest first) + local C=0 + for dateline in `for line in ${loadedtape_list[*]} + do + echo ${line} | cut -d'|' -f13 + done | sort`; do + + # Find the line with the date athand + for dataline in ${loadedtape_list[*]}; do + if [ ${dataline#*${dateline}} != ${dataline} ]; then + # Get volumes the tape is loaded in + my_vol=`echo $dataline | cut -d'|' -f3` + my_vol=${my_vol# } + echo -n "${my_vol%% *} " + C=$(($C+1)) + # If all free slots are filled exit + if [ "$C" = "$free_slots" ]; then + echo + exit + fi + fi + done + done + + echo +} +function help_remove_() { + help_remove_oldest + help_remove_label +} + +function help_remove_oldest() { + echo "Syntax: $0 remove oldest [number] from " + echo " Unload oldest [number] of tapes from into the IE slots" + echo " [number] amount of tapes to be unloaded, if no number is given then the amount of free IE slots is used" + echo " the name of the pool the volumes should come from" +} + +function help_remove_label() { + echo "Syntax: $0 remove label from " + echo " Removes the label from a tape and thus destroys" + echo " all data on that tape (use with care!)." + echo " a single volume or a space seperated list of volumes" +} +function _remove_oldest() { + volumes=`_show_oldest $number` + if [ "x$volumes" = "" ]; then + echo "No volumes to be unloaded" + exit 0 + fi + _unload_ $volumes +} +function _remove_label() { + local indrive=0 + local current_slot=-1 + local my_storage=`get_storage_from_pool $pool` + + # No running jobs, so stop SD + if [ `echo "status storage=${my_pool}" | /opt/bacula/bin/bconsole | grep "No Jobs running"` = "No Jobs running" ]; then + sd_stop + else + echo "There are still jobs running, so can not destroy labels" + exit 255 + fi + + # No jobs are running... so fixed drive index + # and bring that drive offline + echo -n "Bring ${DRIVES[${drive_index}]} offline... " + local drive_index=0 + mt -f ${DRIVES[${drive_index}]} offline + echo "done." + + # Destroy label(s) + for rm_name in ${remove_volumes}; do + # See if the tape is already in the drive + for (( I=0; $I < ${#DTE_voltag[*]}; I=$(($I+1)) )); do + if [ "$rm_name" = "${DTE_voltag[$I]}" ]; then + indrive=1 + fi + done + + echo -n "Make sure $rm_name is loaded... " + if [ $indrive = 0 ]; then + unload_drive ${DTE_slots[${drive_index}]} ${drive_index} + else + for (( I=0; $I < ${#SE_voltag[*]}; I=$(($I+1)) )); do + if [ "$rm_name" = "${SE_voltag[$I]}" ]; then + current_slot=${SE_slots_full[$I]} + mtx -f ${MTX_DEV} load ${current_slot} ${drive_index} + fi + done + fi + echo "done." + + echo -n "Destroy label on ${rm_name}... " + # Rewind the tape + mt -f ${DRIVES[${drive_index}]} rewind + if [ $? != 0 ]; then + error_handler fatal "rewind failed" + else + echo -n "rewind done, " + fi + + # Write EOF at the start of the tape + mt -f ${DRIVES[${my_free_drive}]} weof + if [ $? != 0 ]; then + error_handler fatal "EOF write failed" + else + echo "wrote EOF" + fi + + # Empty slot + unload_drive ${current_slot} ${drive_index} + done + + # Restore to initial state + mtx -f ${MTX_DEV} load ${DTE_slots[${drive_index}]} ${drive_index} + service bacula-sd start + + exit 0 +} +#------# +# Main # +#------# + +# If nothing is given... do help +if [ "$1" = "" ]; then + function=help +fi + +# Parse command line +until [ "$1" = "" ]; do + if [ $1 = help ]; then + function=$1 + elif [ $1 = show ] || \ + [ $1 = remove ] || \ + [ $1 = load ] || \ + [ $1 = unload ]; then + # Do list + do=$1 + elif [ $1 = label ] || \ + [ $1 = oldest ] || \ + [ $1 = show ] || \ + [ $1 = remove ] || \ + [ $1 = load ] || \ + [ $1 = unload ]; then + # What list + what=$1 + elif [ $1 = into ] || \ + [ $1 = from ]; then + # Pool + extra shift + pool=$2 + shift + elif [ "${1//[0-9]/}" = "" ]; then + number="${number} $1" + fi + + shift +done + +# Clean up number +number=${number# } + +# Set global vars +if [ "$function" != "help" ]; then + set_mtx_data +fi + +# Do function +${function}_${do}_${what} + +#-----# +# END # + diff --git a/bacula/manpages/Makefile.in b/bacula/manpages/Makefile.in index db38f6497b..7ec44f36f2 100644 --- a/bacula/manpages/Makefile.in +++ b/bacula/manpages/Makefile.in @@ -1,5 +1,5 @@ # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2018 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # @MCOMMON@ @@ -8,7 +8,7 @@ MAN8 = bacula.8 bacula-dir.8 bacula-fd.8 bacula-sd.8 \ bconsole.8 bcopy.8 bextract.8 bls.8 bscan.8 btape.8 \ - btraceback.8 dbcheck.8 bwild.8 bregex.8 + bregex.8 btraceback.8 dbcheck.8 bwild.8 MAN1 = bsmtp.1 bat.1 diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index aa6299b3a8..ba5db72ba0 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -253,6 +253,8 @@ enum { /* Size of crypto length stored at head of crypto buffer. Do NOT change! */ #define CRYPTO_LEN_SIZE ((int)sizeof(uint32_t)) +/* Plugin Features */ +#define PLUGIN_FEATURE_RESTORELISTFILES "RestoreListFiles" /** * This is for dumb compilers/libraries like Solaris. Linux GCC @@ -618,6 +620,8 @@ void t_msg(const char *file, int line, int64_t level, const char *fmt,...); * Windows */ #define PathSeparator '\\' +#define PathSeparatorUp "..\\" +#define PathSeparatorCur ".\\" inline bool IsPathSeparator(int ch) { return ch == '/' || ch == '\\'; } inline char *first_path_separator(char *path) { return strpbrk(path, "/\\"); } diff --git a/bacula/src/bacula.h b/bacula/src/bacula.h index b185983723..b4bca5176d 100644 --- a/bacula/src/bacula.h +++ b/bacula/src/bacula.h @@ -191,7 +191,12 @@ const bool have_dde_extra_check = false; #undef malloc #endif +#if defined(HAVE_WIN32) +#include "winapi.h" +#include "winhost.h" +#else #include "host.h" +#endif #ifndef HAVE_ZLIB_H #undef HAVE_LIBZ /* no good without headers */ diff --git a/bacula/src/bsd b/bacula/src/bsd new file mode 100644 index 0000000000..8a5960687b --- /dev/null +++ b/bacula/src/bsd @@ -0,0 +1,4 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# diff --git a/bacula/src/c b/bacula/src/c index 259218dd81..0cbbd850f7 100644 --- a/bacula/src/c +++ b/bacula/src/c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index acd88ff22e..a1223bab7c 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -242,6 +242,7 @@ struct ROBJECT_DBR { struct FILE_DBR { FileId_t FileId; uint32_t FileIndex; + uint32_t FileIndex2; JobId_t JobId; DBId_t FilenameId; DBId_t PathId; diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index 5890afe3dc..f02f5ff391 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,7 +11,7 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. @@ -133,7 +133,7 @@ PROG_COPYRIGHT " -u set command execution timeout to seconds\n" " -t test - read configuration and exit\n" " -? print this message.\n" -"\n"), 2000, "", HOST_OS, DISTNAME, DISTVER); +"\n"), 2000, BDEMO, HOST_OS, DISTNAME, DISTVER); } @@ -845,6 +845,7 @@ wait_for_data(int fd, int sec) int get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec) { + int len; if (!stop) { if (output == stdout || teeout) { sendit(prompt); @@ -857,19 +858,20 @@ again: case -1: return -1; /* error */ default: + len = sizeof_pool_memory(sock->msg) - 1; if (stop) { sleep(1); goto again; } #ifdef HAVE_CONIO if (bisatty(fileno(input))) { - input_line(sock->msg, sizeof_pool_memory(sock->msg)-1); + input_line(sock->msg, len); break; } #endif #ifdef HAVE_WIN32 /* use special console for input on win32 */ if (input == stdin) { - if (win32_cgets(sock->msg, sizeof_pool_memory(sock->msg)-1) == NULL) { + if (win32_cgets(sock->msg, len) == NULL) { return -1; } } diff --git a/bacula/src/dird/bsr.c b/bacula/src/dird/bsr.c index 3af5afd03d..61de96ddfe 100644 --- a/bacula/src/dird/bsr.c +++ b/bacula/src/dird/bsr.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,18 +11,20 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. */ /* + * * Bacula Director -- Bootstrap Record routines. * * BSR (bootstrap record) handling routines split from * ua_restore.c July MMIII * * Kern Sibbald, July MMII + * */ #include "bacula.h" @@ -600,3 +602,159 @@ void add_findex_all(rblist *bsr_list, uint32_t JobId, const char *fileregex) bsr->fi_list->insert(fi, search_fi); return; } + +#ifdef needed +/* Foreach files in currrent list, send "/path/fname\0LStat\0MD5\0Delta" to FD + * row[0]=Path, row[1]=Filename, row[2]=FileIndex + * row[3]=JobId row[4]=LStat row[5]=DeltaSeq row[6]=MD5 + */ +static int sendit(void *arg, int num_fields, char **row) +{ + JCR *jcr = (JCR *)arg; + + if (job_canceled(jcr)) { + return 1; + } + + if (row[2][0] == '0') { /* discard when file_index == 0 */ + return 0; + } + + /* sending with checksum */ + if (num_fields == 7 + && row[6][0] /* skip checksum = '0' */ + && row[6][1]) + { + jcr->file_bsock->fsend("%s%s%c%s%c%s%c%s", + row[0], row[1], 0, row[4], 0, row[6], 0, row[5]); + } else { + jcr->file_bsock->fsend("%s%s%c%s%c%c%s", + row[0], row[1], 0, row[4], 0, 0, row[5]); + } + return 0; +} +#endif + +/* We list all files for a given FI structure */ +static void scan_findex(JCR *jcr, RBSR *bsr, + int32_t FirstIndex, int32_t LastIndex, + int32_t &lastFileIndex, uint32_t &lastJobId) +{ + RBSR_FINDEX *fi; + FILE_DBR fdbr; + memset(&fdbr, 0, sizeof(fdbr)); + + fi = (RBSR_FINDEX *) bsr->fi_list->first(); + while (fi) { + int32_t findex, findex2; + + /* fi points to the first item of the list, or the next item that is not + * contigous to the previous group + */ + findex = fi->findex; + findex2 = fi->findex2; + + /* Sometime (with the restore command for example), the fi_list can + * contain false gaps (1-10, 11-11, 12-20 instead of 1-20). The for loop + * is here to merge blocks and reduce the bsr output. The next while(fi) + * iteration will use the next_fi that points to the last merged element. + */ + RBSR_FINDEX *next_fi; + for (next_fi = (RBSR_FINDEX*) bsr->fi_list->next(fi); + next_fi && next_fi->findex == (findex2+1); + next_fi = (RBSR_FINDEX *) bsr->fi_list->next(next_fi)) + { + findex2 = next_fi->findex2; + } + + /* next_fi points after the current block (or to the end of the list), so + * the next while() iteration will use the next value + */ + fi = next_fi; + + /* We look if the current FI block match the volume information */ + if ((findex >= FirstIndex && findex <= LastIndex) || + (findex2 >= FirstIndex && findex2 <= LastIndex) || + (findex < FirstIndex && findex2 > LastIndex)) { + + findex = findex < FirstIndex ? FirstIndex : findex; + findex2 = findex2 > LastIndex ? LastIndex : findex2; + + bool dolist=false; + /* Display only new files */ + if (findex != lastFileIndex || bsr->JobId != lastJobId) { + /* Not the same file, or not the same job */ + fdbr.FileIndex = findex; + //dolist = true; + + } else if (findex2 != lastFileIndex) { + /* We are in the same job, and the first index was already generated */ + fdbr.FileIndex = findex + 1; + //dolist = true; + } + + /* Keep the current values for the next loop */ + lastJobId = bsr->JobId; + lastFileIndex = findex2; + + /* Generate if needed the list of files */ + if (dolist) { + fdbr.FileIndex2 = findex2; + fdbr.JobId = bsr->JobId; + /* New code not working */ + //db_list_files(jcr, jcr->db, &fdbr, sendit, jcr); + } + } + } +} + +/* + * Scan bsr data for a single bsr record + */ +static void scan_bsr_item(JCR *jcr, RBSR *bsr) +{ + int32_t lastFileIndex=0; + uint32_t lastJobId=0; + /* + * For a given volume, loop over all the JobMedia records. + * VolCount is the number of JobMedia records. + */ + for (int i=0; i < bsr->VolCount; i++) { + if (!is_volume_selected(bsr->fi_list, + bsr->VolParams[i].FirstIndex, + bsr->VolParams[i].LastIndex)) + { + continue; + } + + scan_findex(jcr, bsr, + bsr->VolParams[i].FirstIndex, + bsr->VolParams[i].LastIndex, + lastFileIndex, lastJobId); + } +} + +/* + * We need to find all files from the BSR. All files are listed, this is used + * to send the list of the files to be restored to a plugin for example. + */ +void scan_bsr(JCR *jcr) +{ + char *p; + JobId_t JobId; + RBSR *bsr; + if (!jcr->JobIds || *jcr->JobIds == 0) { + foreach_rblist(bsr, jcr->bsr_list) { + scan_bsr_item(jcr, bsr); + } + return; + } + for (p=jcr->JobIds; get_next_jobid_from_list(&p, &JobId) > 0; ) { + foreach_rblist(bsr, jcr->bsr_list) { + if (JobId == bsr->JobId) { + scan_bsr_item(jcr, bsr); + } + } + } + return; +} diff --git a/bacula/src/dird/getmsg.c b/bacula/src/dird/getmsg.c index 7e5a73df33..18b54e961d 100644 --- a/bacula/src/dird/getmsg.c +++ b/bacula/src/dird/getmsg.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,7 +11,7 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. @@ -148,7 +148,7 @@ int bget_dirmsg(BSOCK *bs) for ( ; !bs->is_stop() && !bs->is_timed_out(); ) { n = bs->recv(); - Dmsg2(200, "bget_dirmsg %d: %s\n", n, bs->msg); + Dmsg4(200, "bget_dirmsg n=%d msglen=%ld is_stop=%d: %s\n", n, bs->msglen, bs->is_stop(), bs->msg); if (bs->is_stop() || bs->is_timed_out()) { return n; /* error or terminate */ diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index b5b39c7d5a..c3833ec657 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -1465,6 +1465,10 @@ void dird_free_jcr(JCR *jcr) Dmsg0(200, "Start dird free_jcr\n"); dird_free_jcr_pointers(jcr); + if (jcr->bsr_list) { + free_bsr(jcr->bsr_list); + jcr->bsr_list = NULL; + } if (jcr->wjcr) { free_jcr(jcr->wjcr); jcr->wjcr = NULL; @@ -1622,11 +1626,8 @@ void set_jcr_defaults(JCR *jcr, JOB *job) jcr->spool_size = job->spool_size; jcr->write_part_after_job = job->write_part_after_job; jcr->MaxRunSchedTime = job->MaxRunSchedTime; - if (jcr->RestoreBootstrap) { - free(jcr->RestoreBootstrap); - jcr->RestoreBootstrap = NULL; - } /* This can be overridden by Console program */ + bfree_and_null(jcr->RestoreBootstrap); if (job->RestoreBootstrap) { jcr->RestoreBootstrap = bstrdup(job->RestoreBootstrap); } diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index 6363d9a98d..4ba28a5f79 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -864,10 +864,13 @@ bool inc_read_store(JCR *jcr) P(rstore_mutex); int num = jcr->rstore->getNumConcurrentJobs(); int numread = jcr->rstore->getNumConcurrentReadJobs(); + int maxread = jcr->rstore->MaxConcurrentReadJobs; if (num < jcr->rstore->MaxConcurrentJobs && (jcr->getJobType() == JT_RESTORE || - numread == 0 || - numread < jcr->rstore->MaxConcurrentReadJobs)) { + numread == 0 || + maxread == 0 || /* No limit set */ + numread < maxread)) /* Below the limit */ + { num++; numread++; jcr->rstore->setNumConcurrentReadJobs(numread); diff --git a/bacula/src/filed/Makefile.in b/bacula/src/filed/Makefile.in index f0d117200a..643f410267 100644 --- a/bacula/src/filed/Makefile.in +++ b/bacula/src/filed/Makefile.in @@ -31,7 +31,7 @@ dummy: # SVRSRCS = filed.c authenticate.c backup.c crypto.c \ - estimate.c \ + win_efs.c estimate.c \ fd_plugins.c accurate.c \ filed_conf.c heartbeat.c hello.c job.c fd_snapshot.c \ restore.c status.c verify.c verify_vol.c \ @@ -50,6 +50,12 @@ ZLIBS = @ZLIBS@ LZO_LIBS = @LZO_LIBS@ LZO_INC= @LZO_INC@ +# extra items for linking on Win32 +WIN32OBJS = win32/winmain.o win32/winlib.a win32/winres.res +win32 = $(WIN32OBJS) -luser32 -lgdi32 + +WIN32LIBS = $(@WIN32@) + .SUFFIXES: .c .o .PHONY: .DONTCARE: @@ -59,7 +65,7 @@ LZO_INC= @LZO_INC@ @echo "Compiling $<" $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(LZO_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< #------------------------------------------------------------------------- -all: Makefile bacula-fd @STATIC_FD@ bfdjson +all: Makefile @WIN32@ bacula-fd @STATIC_FD@ bfdjson @echo "==== Make of filed is good ====" @echo " " @@ -67,10 +73,35 @@ bacl.o: bacl.c @echo "Compiling $<" $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(LZO_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $(AFS_CFLAGS) $< -bacula-fd: Makefile $(SVROBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) +win32/winlib.a: + @if test -f win32/Makefile -a "${GMAKE}" != "none"; then \ + (cd win32; $(GMAKE) DESTDIR=$(DESTDIR)); \ + fi + @rm -f bacula-fd.exe + +win32/winmain.o: + @if test -f win32/Makefile -a "${GMAKE}" != "none"; then \ + (cd win32; $(GMAKE) DESTDIR=$(DESTDIR)); \ + fi + @rm -f bacula-fd.exe + +win32/winres.res: + @if test -f win32/Makefile -a "${GMAKE}" != "none"; then \ + (cd win32; $(GMAKE) DESTDIR=$(DESTDIR)); \ + fi + @rm -f bacula-fd.exe + +# win32 libraries if needed +win32: $(WIN32OBJS) + @if test -f win32/Makefile -a "${GMAKE}" != "none"; then \ + (cd win32; $(GMAKE) DESTDIR=$(DESTDIR)); \ + fi + @rm -f bacula-fd.exe + +bacula-fd: Makefile $(SVROBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) @WIN32@ @echo "Linking $@ ..." $(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(SVROBJS) \ - $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \ + $(WIN32LIBS) $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \ $(DLIB) $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS) $(AFS_LIBS) $(LZO_LIBS) bfdjson: Makefile $(JSONOBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) @WIN32@ @@ -79,9 +110,9 @@ bfdjson: Makefile $(JSONOBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../l $(WIN32LIBS) $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \ $(DLIB) $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS) $(AFS_LIBS) $(LZO_LIBS) -static-bacula-fd: Makefile $(SVROBJS) ../findlib/libbacfind.a ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) +static-bacula-fd: Makefile $(SVROBJS) ../findlib/libbacfind.a ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) @WIN32@ $(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -L../findlib -o $@ $(SVROBJS) \ - $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \ + $(WIN32LIBS) $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \ $(DLIB) $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS) $(AFS_LIBS) $(LZO_LIBS) strip $@ @@ -95,6 +126,9 @@ libtool-clean: clean: libtool-clean @$(RMF) bacula-fd filed core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3 @$(RMF) static-bacula-fd + @if test -f win32/Makefile -a "${GMAKE}" != "none"; then \ + (cd win32; $(GMAKE) clean); \ + fi realclean: clean @$(RMF) tags bacula-fd.conf @@ -102,10 +136,16 @@ realclean: clean distclean: realclean if test $(srcdir) = .; then $(MAKE) realclean; fi (cd $(srcdir); $(RMF) Makefile) + @if test -f win32/Makefile -a "${GMAKE}" != "none"; then \ + (cd win32; $(GMAKE) distclean); \ + fi devclean: realclean if test $(srcdir) = .; then $(MAKE) realclean; fi (cd $(srcdir); $(RMF) Makefile) + @if test -f win32/Makefile -a "${GMAKE}" != "none"; then \ + (cd win32; $(GMAKE) devclean); \ + fi install: all $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) bacula-fd $(DESTDIR)$(sbindir)/bacula-fd @@ -127,7 +167,8 @@ install: all fi uninstall: - (cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-fd.conf bfdjson) + (cd $(DESTDIR)$(sbindir); $(RMF) bacula-fd bfdjson) + (cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-fd.conf) (cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-fd.conf.new) # Semi-automatic generation of dependencies: diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 1cba287010..95d70cb6b0 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -1425,20 +1425,21 @@ static void close_vss_backup_session(JCR *jcr) #if defined(WIN32_VSS) /* STOP VSS ON WIN32 */ /* tell vss to close the backup session */ - if (jcr->Snapshot) { - if (g_pVSSClient->CloseBackup()) { + if (jcr->Snapshot && jcr->pVSSClient) { + if (jcr->pVSSClient->CloseBackup()) { /* inform user about writer states */ - for (int i=0; i<(int)g_pVSSClient->GetWriterCount(); i++) { + for (int i=0; i<(int)jcr->pVSSClient->GetWriterCount(); i++) { int msg_type = M_INFO; - if (g_pVSSClient->GetWriterState(i) < 1) { + if (jcr->pVSSClient->GetWriterState(i) < 1) { msg_type = M_WARNING; jcr->JobErrors++; } - Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), g_pVSSClient->GetWriterInfo(i)); + Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), + jcr->pVSSClient->GetWriterInfo(i)); } } /* Generate Job global writer metadata */ - WCHAR *metadata = g_pVSSClient->GetMetadata(); + WCHAR *metadata = jcr->pVSSClient->GetMetadata(); if (metadata) { FF_PKT *ff_pkt = jcr->ff; ff_pkt->fname = (char *)"*all*"; /* for all plugins */ diff --git a/bacula/src/filed/fd_plugins.c b/bacula/src/filed/fd_plugins.c index 89f174b357..066541b2c5 100644 --- a/bacula/src/filed/fd_plugins.c +++ b/bacula/src/filed/fd_plugins.c @@ -31,7 +31,11 @@ extern DLL_IMP_EXP char *version; extern DLL_IMP_EXP char *dist_name; const int dbglvl = 150; +#ifdef HAVE_WIN32 +const char *plugin_type = "-fd.dll"; +#else const char *plugin_type = "-fd.so"; +#endif extern int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level); extern bool check_changes(JCR *jcr, FF_PKT *ff_pkt); @@ -1706,11 +1710,24 @@ static bRC baculaGetValue(bpContext *ctx, bVariable var, void *value) case bVarInteractiveSession: *(int *)value = (int)jcr->interactive_session; break; + case bVarFileIndex: + *(int *)value = (int)jcr->JobFiles; + break; case bVarFileSeen: break; /* a write only variable, ignore read request */ case bVarVssObject: +#ifdef HAVE_WIN32 + if (jcr->pVSSClient) { + *(void **)value = jcr->pVSSClient->GetVssObject(); + break; + } +#endif return bRC_Error; case bVarVssDllHandle: +#ifdef HAVE_WIN32 + *(void **)value = vsslib; + break; +#endif return bRC_Error; case bVarWhere: *(char **)value = jcr->where; diff --git a/bacula/src/filed/fd_plugins.h b/bacula/src/filed/fd_plugins.h index 19e69cb9bb..32566ce1e9 100644 --- a/bacula/src/filed/fd_plugins.h +++ b/bacula/src/filed/fd_plugins.h @@ -196,7 +196,8 @@ typedef enum { bVarPrevJobName = 20, bVarPrefixLinks = 21, bVarInteractiveSession = 22, - bVarReplace = 23, + bVarFileIndex = 23, + bVarReplace = 24 } bVariable; /* Events that are passed to plugin */ diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index 1ac05f9864..be146bbb96 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -82,8 +82,11 @@ static void usage() * Main Bacula Unix Client Program * */ +#if defined(HAVE_WIN32) +#define main BaculaMain +#endif -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { int ch; bool keep_readall_caps = false; diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 4d0cc0d348..735dce664a 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -25,6 +25,10 @@ #include "bacula.h" #include "filed.h" #include "ch.h" +#ifdef WIN32_VSS +#include "vss.h" +static pthread_mutex_t vss_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* Globals */ bool win32decomp = false; @@ -33,6 +37,12 @@ bool no_win32_write_errors = false; /* Static variables */ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +#ifdef HAVE_WIN32 +const bool have_win32 = true; +#else +const bool have_win32 = false; +#endif + #ifdef HAVE_ACL const bool have_acl = true; #else @@ -907,7 +917,11 @@ static int job_cmd(JCR *jcr) Mmsg(jcr->errmsg, "JobId=%d Job=%s", jcr->JobId, jcr->Job); new_plugins(jcr); /* instantiate plugins for this jcr */ generate_plugin_event(jcr, bEventJobStart, (void *)jcr->errmsg); - return dir->fsend(OKjob, VERSION, LSMDATE, HOST_OS, DISTNAME, DISTVER); +#ifdef HAVE_WIN32 + return dir->fsend(OKjob, VERSION, LSMDATE, win_os, DISTNAME, DISTVER); +#else + return dir->fsend(OKjob, VERSION, LSMDATE, HOST_OS, DISTNAME, DISTVER); +#endif } extern "C" char *job_code_callback_filed(JCR *jcr, const char* param, char *buf, int buflen) @@ -1174,7 +1188,20 @@ static void append_file(JCR *jcr, findINCEXE *incexe, const char *buf, bool is_file) { if (is_file) { +#ifdef HAVE_WIN32 + /* Special case for / under Win32, + * user is requesting to include all local drives + */ + if (strcmp(buf, "/") == 0) { + //list_drives(&incexe->name_list); + + } else { + incexe->name_list.append(new_dlistString(buf)); + } +#else incexe->name_list.append(new_dlistString(buf)); +#endif /* HAVE_WIN32 */ + } else if (me->plugin_directory) { generate_plugin_event(jcr, bEventPluginCommand, (void *)buf); incexe->plugin_list.append(new_dlistString(buf)); @@ -1830,7 +1857,11 @@ static int fileset_cmd(JCR *jcr) BSOCK *dir = jcr->dir_bsock; int rtnstat; +#if HAVE_WIN32 + jcr->Snapshot = (strstr(dir->msg, "vss=1") != NULL); +#else jcr->Snapshot = (strstr(dir->msg, "snap=1") != NULL); +#endif if (!init_fileset(jcr)) { return 0; } @@ -2174,6 +2205,185 @@ bail_out: return 0; } +#ifdef HAVE_WIN32 +/* TODO: merge find.c ? */ +static bool is_excluded(findFILESET *fileset, char *path) +{ + int fnm_flags=FNM_CASEFOLD; + int fnmode=0; + + /* Now apply the Exclude { } directive */ + for (int i=0; iexclude_list.size(); i++) { + findINCEXE *incexe = (findINCEXE *)fileset->exclude_list.get(i); + dlistString *node; + + foreach_dlist(node, &incexe->name_list) { + char *fname = node->c_str(); + Dmsg2(DT_VOLUME|50, "Testing %s against %s\n", path, fname); + if (fnmatch(fname, path, fnmode|fnm_flags) == 0) { + Dmsg1(050, "Reject wild2: %s\n", path); + return true; + } + /* On windows, the path separator is a bit complex to handle. For + * example, in fnmatch(), \ is written as \\\\ in the config file / is + * different from \ So we have our own little strcmp for filenames + */ + char *p; + bool same=true; + for (p = path; *p && *fname && same ; p++, fname++) { + if (!((IsPathSeparator(*p) && IsPathSeparator(*fname)) || + (tolower(*p) == tolower(*fname)))) { + same = false; /* Stop after the first one */ + } + } + + if (same) { + /* End of the for loop, strings looks to be identical */ + Dmsg1(DT_VOLUME|50, "Reject: %s\n", path); + return true; + } + + /* Looks to be the same string, but with a trailing slash */ + if (fname[0] && IsPathSeparator(fname[0]) && fname[1] == '\0' + && p[0] == '\0') + { + Dmsg1(DT_VOLUME|50, "Reject: %s\n", path); + return true; + } + } + } + return false; +} + +/* + * For VSS we need to know which windows drives + * are used, because we create a snapshot of all used + * drives before operation + * + */ +static int +get_win32_driveletters(JCR *jcr, FF_PKT *ff, char* szDrives) +{ + int nCount = 0; + + findFILESET *fileset = ff->fileset; + int flags = 0; + char drive[4]; + + MTab mtab; + mtab.get(); /* read the disk structure */ + + /* Keep this part for compatibility reasons */ + strcpy(drive, "c:\\"); + for (int i=0; szDrives[i] ; i++) { + drive[0] = szDrives[i]; + if (mtab.addInSnapshotSet(drive)) { /* When all volumes are selected, we can stop */ + Dmsg0(DT_VOLUME|50, "All Volumes are marked, stopping the loop here\n"); + goto all_included; + } + } + + if (fileset) { + dlistString *node; + + for (int i=0; iinclude_list.size(); i++) { + + findFOPTS *fo; + findINCEXE *incexe = (findINCEXE *)fileset->include_list.get(i); + + /* look through all files */ + foreach_dlist(node, &incexe->name_list) { + char *fname = node->c_str(); + if (mtab.addInSnapshotSet(fname)) { + /* When all volumes are selected, we can stop */ + Dmsg0(DT_VOLUME|50, "All Volumes are marked, stopping the loop here\n"); + goto all_included; + } + } + + foreach_alist(fo, &incexe->opts_list) { + flags |= fo->flags; /* We are looking for FO_MULTIFS and recurse */ + } + } + + /* TODO: it needs to be done Include by Include, but in the worst case, + * we take too much snapshots... + */ + if (flags & FO_MULTIFS) { + /* Need to add subdirectories */ + POOLMEM *fn = get_pool_memory(PM_FNAME); + MTabEntry *elt, *elt2; + int len; + + Dmsg0(DT_VOLUME|50, "OneFS is set, looking for remaining volumes\n"); + + foreach_rblist(elt, mtab.entries) { + if (elt->in_SnapshotSet) { + continue; /* Already in */ + } + /* A volume can have multiple mount points */ + for (wchar_t *p = elt->first() ; p && *p ; p = elt->next(p)) { + wchar_2_UTF8(&fn, p); + + Dmsg1(DT_VOLUME|50, "Looking for path %s\n", fn); + + /* First case, root drive (c:/, e:/, d:/), not a submount point */ + len = strlen(fn); + if (len <= 3) { + Dmsg1(DT_VOLUME|50, "Skiping %s\n", fn); + continue; + } + + /* First thing is to look in the exclude list to see if this directory + * is explicitely excluded + */ + if (is_excluded(fileset, fn)) { + Dmsg1(DT_VOLUME|50, "Looks to be excluded %s\n", fn); + continue; + } + + /* c:/vol/vol2/vol3 + * will look c:/, then c:/vol/, then c:/vol2/ and if one of them + * is selected, the sub volume will be directly marked. + */ + for (char *p1 = fn ; *p1 && !elt->in_SnapshotSet ; p1++) { + if (IsPathSeparator(*p1)) { + + char c = *(p1 + 1); + *(p1 + 1) = 0; + + /* We look for the previous directory, and if marked, we mark + * the current one as well + */ + Dmsg1(DT_VOLUME|50, "Looking for %s\n", fn); + elt2 = mtab.search(fn); + if (elt2 && elt2->in_SnapshotSet) { + Dmsg0(DT_VOLUME|50, "Put volume in SnapshotSet\n"); + elt->setInSnapshotSet(); + } + + *(p1 + 1) = c; /* restore path separator */ + } + } + } + } + free_pool_memory(fn); + } + all_included: + /* Now, we look the volume list to know which one to include */ + MTabEntry *elt; + foreach_rblist(elt, mtab.entries) { + if (elt->in_SnapshotSet) { + Dmsg1(DT_VOLUME|50,"Adding volume in mount_points list %ls\n",elt->volumeName); + nCount++; + ff->mount_points.append(bwcsdup(elt->volumeName)); + } + } + } + + return nCount; +} +#endif /* HAVE_WIN32 */ /* * Do a backup. @@ -2195,7 +2405,7 @@ static int backup_cmd(JCR *jcr) * If explicitly requesting FO_ACL or FO_XATTR, fail job if it * is not available on Client machine */ - if (jcr->ff->flags & FO_ACL && !(have_acl)) { + if (jcr->ff->flags & FO_ACL && !(have_acl||have_win32)) { Jmsg(jcr, M_FATAL, 0, _("ACL support not configured for Client.\n")); goto cleanup; } @@ -2253,9 +2463,47 @@ static int backup_cmd(JCR *jcr) generate_plugin_event(jcr, bEventStartBackupJob); if (jcr->Snapshot) { +#if defined(WIN32_VSS) + P(vss_mutex); + /* START VSS ON WIN32 */ + jcr->pVSSClient = VSSInit(); + if (jcr->pVSSClient->InitializeForBackup(jcr)) { + generate_plugin_event(jcr, bEventVssBackupAddComponents); + /* tell vss which drives to snapshot */ + char szWinDriveLetters[27]; + *szWinDriveLetters=0; + generate_plugin_event(jcr, bEventVssPrepareSnapshot, szWinDriveLetters); + if (get_win32_driveletters(jcr, jcr->ff, szWinDriveLetters)) { + Jmsg(jcr, M_INFO, 0, _("Generate VSS snapshots. Driver=\"%s\"\n"), + jcr->pVSSClient->GetDriverName()); + + if (!jcr->pVSSClient->CreateSnapshots(&jcr->ff->mount_points)) { + berrno be; + Jmsg(jcr, M_FATAL, 0, _("VSS CreateSnapshots failed. ERR=%s\n"), + be.bstrerror()); + } else { + /* inform user about writer states */ + for (int i=0; i < (int)jcr->pVSSClient->GetWriterCount(); i++) { + if (jcr->pVSSClient->GetWriterState(i) < 1) { + Jmsg(jcr, M_INFO, 0, _("VSS Writer (PrepareForBackup): %s\n"), + jcr->pVSSClient->GetWriterInfo(i)); + } + } + } + } else { + Jmsg(jcr, M_WARNING, 0, _("No drive letters found for generating VSS snapshots.\n")); + } + } else { + berrno be; + Jmsg(jcr, M_FATAL, 0, _("VSS was not initialized properly. ERR=%s\n"), + be.bstrerror()); + } + V(vss_mutex); +#else Dmsg0(10, "Open a snapshot session\n"); /* TODO: See if we abort the job */ jcr->Snapshot = open_snapshot_backup_session(jcr); +#endif } /* Call RunScript just after the Snapshot creation, usually, we restart services */ run_scripts(jcr, jcr->RunScripts, "ClientAfterVSS"); @@ -2315,6 +2563,14 @@ static int backup_cmd(JCR *jcr) } cleanup: +#if defined(WIN32_VSS) + if (jcr->Snapshot) { + Win32ConvCleanupCache(); + if (jcr->pVSSClient) { + jcr->pVSSClient->DestroyWriterInfo(); + } + } +#endif generate_plugin_event(jcr, bEventEndBackupJob); return 0; /* return and stop command loop */ } @@ -2417,6 +2673,14 @@ static int restore_cmd(JCR *jcr) * Scan WHERE (base directory for restore) from command */ Dmsg0(100, "restore command\n"); +#if defined(WIN32_VSS) + + /** + * No need to enable VSS for restore if we do not have plugin + * data to restore + */ + jcr->Snapshot = jcr->got_metadata; +#endif /* Pickup where string */ args = get_memory(dir->msglen+1); @@ -2462,6 +2726,7 @@ static int restore_cmd(JCR *jcr) Jmsg(jcr, M_FATAL, 0, _("Bad replace command. CMD=%s\n"), jcr->errmsg); goto free_mempool; } + jcr->RegexWhere = bstrdup(args); *args = 0; /* No where argument */ } else { use_regexwhere = true; @@ -2516,6 +2781,19 @@ static int restore_cmd(JCR *jcr) generate_daemon_event(jcr, "JobStart"); generate_plugin_event(jcr, bEventStartRestoreJob); +#if defined(WIN32_VSS) + /* START VSS ON WIN32 */ + if (jcr->Snapshot) { + jcr->pVSSClient = VSSInit(); + if (!jcr->pVSSClient->InitializeForRestore(jcr)) { + berrno be; + Jmsg(jcr, M_WARNING, 0, _("VSS was not initialized properly. VSS support is disabled. ERR=%s\n"), be.bstrerror()); + } + //free_and_null_pool_memory(jcr->job_metadata); + run_scripts(jcr, jcr->RunScripts, "ClientAfterVSS"); + } +#endif + if (!jcr->is_canceled()) { do_restore(jcr); } @@ -2538,8 +2816,39 @@ static int restore_cmd(JCR *jcr) /* Inform Storage daemon that we are done */ sd->signal(BNET_TERMINATE); +#if defined(WIN32_VSS) + /* STOP VSS ON WIN32 */ + /* tell vss to close the restore session */ + Dmsg0(100, "About to call CloseRestore\n"); + if (jcr->Snapshot) { +#if 0 + generate_plugin_event(jcr, bEventVssBeforeCloseRestore); +#endif + Dmsg0(100, "Really about to call CloseRestore\n"); + if (jcr->pVSSClient->CloseRestore()) { + Dmsg0(100, "CloseRestore success\n"); +#if 0 + /* inform user about writer states */ + for (int i=0; i<(int)jcr->pVSSClient->GetWriterCount(); i++) { + int msg_type = M_INFO; + if (jcr->pVSSClient->GetWriterState(i) < 1) { + //msg_type = M_WARNING; + //jcr->JobErrors++; + } + Jmsg(jcr, msg_type, 0, _("VSS Writer (RestoreComplete): %s\n"), + jcr->pVSSClient->GetWriterInfo(i)); + } +#endif + } + else { + Dmsg1(100, "CloseRestore fail - %08x\n", errno); + } + } +#endif + bail_out: bfree_and_null(jcr->where); + bfree_and_null(jcr->RegexWhere); if (jcr->JobErrors) { jcr->setJobStatus(JS_ErrorTerminated); @@ -2656,6 +2965,9 @@ static void filed_free_jcr(JCR *jcr) if (jcr->last_fname) { free_pool_memory(jcr->last_fname); } +#ifdef WIN32_VSS + VSSCleanup(jcr->pVSSClient); +#endif free_plugins(jcr); /* release instantiated plugins */ free_runscripts(jcr->RunScripts); delete jcr->RunScripts; diff --git a/bacula/src/filed/protos.h b/bacula/src/filed/protos.h index ed2e5fe431..46e6c4a7f3 100644 --- a/bacula/src/filed/protos.h +++ b/bacula/src/filed/protos.h @@ -75,3 +75,8 @@ findINCEXE *new_include(JCR *jcr); /* from snapshot.c */ int snapshot_cmd(JCR *jcr); + +#ifdef HAVE_WIN32 +void VSSCleanup(VSSClient *c); +VSSClient *VSSInit(); +#endif diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index c4cb40cef5..7f4c212d6c 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -1134,6 +1134,12 @@ ok_out: delete rctx.delayed_streams; } + if (rctx.efs) { + rctx.efs->stop(); + rctx.efs->destroy(); + free(rctx.efs); + rctx.efs = NULL; + } Dsm_check(200); bclose(&rctx.forkbfd); bclose(&rctx.bfd); @@ -1324,6 +1330,31 @@ static bool store_data(r_ctx &rctx, char *data, const int32_t length, bool win32 if (jcr->crypto.digest) { crypto_digest_update(jcr->crypto.digest, (uint8_t *)data, length); } +#ifdef TEST_WORKER + if (!test_write_efs_data(rctx, data, length)) { + berrno be; + Jmsg2(jcr, M_ERROR, 0, _("Write error on %s: ERR=%s\n"), + jcr->last_fname, be.bstrerror(bfd->berrno)); + return false; + } + return true; +#endif + +#ifdef HAVE_WIN32 + if (bfd->fattrs & FILE_ATTRIBUTE_ENCRYPTED) { + if (!p_WriteEncryptedFileRaw) { + Jmsg0(jcr, M_FATAL, 0, _("Windows Encrypted data not supported on this OS.\n")); + return false; + } + if (!win_write_efs_data(rctx, data, length)) { + berrno be; + Jmsg2(jcr, M_ERROR, 0, _("Encrypted file write error on %s: ERR=%s\n"), + jcr->last_fname, be.bstrerror(bfd->berrno)); + return false; + } + return true; + } +#endif if (win32_decomp) { if (!processWin32BackupAPIBlock(bfd, data, length)) { berrno be; @@ -1507,6 +1538,12 @@ static bool close_previous_stream(r_ctx &rctx) deallocate_fork_cipher(rctx); } + if (rctx.efs) { + rctx.efs->finish_work(); + bclose(&rctx.bfd); + rctx.count = 0; + } + if (rctx.jcr->plugin) { plugin_set_attributes(rctx.jcr, rctx.attr, &rctx.bfd); } else { diff --git a/bacula/src/filed/restore.h b/bacula/src/filed/restore.h index 2d0ec0ba9c..91aae066fa 100644 --- a/bacula/src/filed/restore.h +++ b/bacula/src/filed/restore.h @@ -53,6 +53,7 @@ struct r_ctx { ATTR *attr; /* Pointer to attributes */ bool extract; /* set when extracting */ alist *delayed_streams; /* streams that should be restored as last */ + worker *efs; /* Windows EFS worker thread */ int32_t count; /* Debug count */ SIGNATURE *sig; /* Cryptographic signature (if any) for file */ @@ -62,3 +63,11 @@ struct r_ctx { }; #endif + +#ifdef TEST_WORKER +bool test_write_efs_data(r_ctx &rctx, char *data, const int32_t length); +#endif + +#ifdef HAVE_WIN32 +bool win_write_efs_data(r_ctx &rctx, char *data, const int32_t length); +#endif diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 0327a82b36..504e5a723b 100644 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -20,6 +20,7 @@ * Bacula File Daemon Status routines * * Kern Sibbald, August MMI + * */ #include "bacula.h" @@ -42,6 +43,16 @@ static char qstatus2[] = ".status %127s api=%d api_opts=%127s"; static char OKqstatus[] = "2000 OK .status\n"; static char DotStatusJob[] = "JobId=%d JobStatus=%c JobErrors=%d\n"; +#if defined(HAVE_WIN32) +static int privs = 0; +#endif +#ifdef WIN32_VSS +#include "vss.h" +#define VSS " VSS" +#else +#define VSS "" +#endif + /* * General status generator */ @@ -52,6 +63,13 @@ void output_status(STATUS_PKT *sp) list_terminated_jobs(sp); /* defined in lib/status.h */ } +#if defined(HAVE_LZO) +static const bool have_lzo = true; +#else +static const bool have_lzo = false; +#endif + + static void api_list_status_header(STATUS_PKT *sp) { char *p; @@ -59,6 +77,12 @@ static void api_list_status_header(STATUS_PKT *sp) OutputWriter wt(sp->api_opts); *buf = 0; +#if defined(HAVE_WIN32) + if (!GetWindowsVersionString(buf, sizeof(buf))) { + *buf = 0; + } +#endif + wt.start_group("header"); wt.get_output( OT_STRING, "name", my_name, @@ -90,14 +114,72 @@ static void list_status_header(STATUS_PKT *sp) return; } - len = Mmsg(msg, _("%s %sVersion: %s (%s) %s %s %s\n"), - my_name, "", VERSION, BDATE, HOST_OS, + len = Mmsg(msg, _("%s %sVersion: %s (%s) %s %s %s %s\n"), + my_name, BDEMO, VERSION, BDATE, VSS, HOST_OS, DISTNAME, DISTVER); sendit(msg.c_str(), len, sp); bstrftime_nc(dt, sizeof(dt), daemon_start_time); len = Mmsg(msg, _("Daemon started %s. Jobs: run=%d running=%d.\n"), dt, num_jobs_run, job_count()); sendit(msg.c_str(), len, sp); +#if defined(HAVE_WIN32) + char buf[300]; + if (GetWindowsVersionString(buf, sizeof(buf))) { + len = Mmsg(msg, "%s\n", buf); + sendit(msg.c_str(), len, sp); + } + memused = get_memory_info(buf, sizeof(buf)); + if (debug_level > 0) { + if (!privs) { + privs = enable_backup_privileges(NULL, 1); + } + len = Mmsg(msg, "Priv 0x%x\n", privs); + sendit(msg.c_str(), len, sp); + + /* Display detailed information that we got from get_memory_info() */ + len = Mmsg(msg, "Memory: %s\n", buf); + sendit(msg.c_str(), len, sp); + + len = Mmsg(msg, "APIs=%sOPT,%sATP,%sLPV,%sCFA,%sCFW,\n", + p_OpenProcessToken?"":"!", + p_AdjustTokenPrivileges?"":"!", + p_LookupPrivilegeValue?"":"!", + p_CreateFileA?"":"!", + p_CreateFileW?"":"!"); + sendit(msg.c_str(), len, sp); + len = Mmsg(msg, " %sWUL,%sWMKD,%sGFAA,%sGFAW,%sGFAEA,%sGFAEW,%sSFAA,%sSFAW,%sBR,%sBW,%sSPSP,\n", + p_wunlink?"":"!", + p_wmkdir?"":"!", + p_GetFileAttributesA?"":"!", + p_GetFileAttributesW?"":"!", + p_GetFileAttributesExA?"":"!", + p_GetFileAttributesExW?"":"!", + p_SetFileAttributesA?"":"!", + p_SetFileAttributesW?"":"!", + p_BackupRead?"":"!", + p_BackupWrite?"":"!", + p_SetProcessShutdownParameters?"":"!"); + sendit(msg.c_str(), len, sp); + len = Mmsg(msg, " %sWC2MB,%sMB2WC,%sFFFA,%sFFFW,%sFNFA,%sFNFW,%sSCDA,%sSCDW,\n", + p_WideCharToMultiByte?"":"!", + p_MultiByteToWideChar?"":"!", + p_FindFirstFileA?"":"!", + p_FindFirstFileW?"":"!", + p_FindNextFileA?"":"!", + p_FindNextFileW?"":"!", + p_SetCurrentDirectoryA?"":"!", + p_SetCurrentDirectoryW?"":"!"); + sendit(msg.c_str(), len, sp); + len = Mmsg(msg, " %sGCDA,%sGCDW,%sGVPNW,%sGVNFVMPW,%sLZO,%sEFS\n", + p_GetCurrentDirectoryA?"":"!", + p_GetCurrentDirectoryW?"":"!", + p_GetVolumePathNameW?"":"!", + p_GetVolumeNameForVolumeMountPointW?"":"!", + have_lzo?"":"!", + "!"); + sendit(msg.c_str(), len, sp); + } +#endif len = Mmsg(msg, _(" Heap: heap=%s smbytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"), edit_uint64_with_commas(memused, b1), edit_uint64_with_commas(sm_bytes, b2), @@ -154,6 +236,12 @@ static void list_running_jobs_plain(STATUS_PKT *sp) len = Mmsg(msg, _("\nRunning Jobs:\n")); sendit(msg.c_str(), len, sp); foreach_jcr(njcr) { + const char *vss = ""; +#ifdef WIN32_VSS + if (njcr->pVSSClient && njcr->pVSSClient->IsInitialized()) { + vss = "VSS "; + } +#endif bstrftime_nc(dt, sizeof(dt), njcr->start_time); if (njcr->JobId == 0) { len = Mmsg(msg, _("Director connected %sat: %s\n"), @@ -163,8 +251,8 @@ static void list_running_jobs_plain(STATUS_PKT *sp) len = Mmsg(msg, _("JobId %d Job %s is running.\n"), njcr->JobId, njcr->Job); sendit(msg.c_str(), len, sp); - len = Mmsg(msg, _(" %s %s Job started: %s\n"), - job_level_to_str(njcr->getJobLevel()), + len = Mmsg(msg, _(" %s%s %s Job started: %s\n"), + vss, job_level_to_str(njcr->getJobLevel()), job_type_to_str(njcr->getJobType()), dt); } sendit(msg.c_str(), len, sp); @@ -201,11 +289,17 @@ static void list_running_jobs_plain(STATUS_PKT *sp) edit_uint64_with_commas(njcr->ReadBytes, b6)); sendit(msg.c_str(), len, sp); - if (njcr->is_JobType(JT_RESTORE) && njcr->ExpectedFiles > 0) { - len = Mmsg(msg, _(" Files: Restored=%s Expected=%s Completed=%d%%\n"), - edit_uint64_with_commas(njcr->num_files_examined, b1), - edit_uint64_with_commas(njcr->ExpectedFiles, b2), - (100*njcr->num_files_examined)/njcr->ExpectedFiles); + if (njcr->is_JobType(JT_RESTORE)) { + if (njcr->ExpectedFiles > 0) { + len = Mmsg(msg, _(" Files: Restored=%s Expected=%s Completed=%d%%\n"), + edit_uint64_with_commas(njcr->num_files_examined, b1), + edit_uint64_with_commas(njcr->ExpectedFiles, b2), + (100*njcr->num_files_examined)/njcr->ExpectedFiles); + + } else { + len = Mmsg(msg, _(" Files: Restored=%s\n"), + edit_uint64_with_commas(njcr->num_files_examined, b1)); + } } else { len = Mmsg(msg, _(" Files: Examined=%s Backed up=%s\n"), edit_uint64_with_commas(njcr->num_files_examined, b1), @@ -260,6 +354,12 @@ static void list_running_jobs_api(STATUS_PKT *sp) /* API v1, edit with comma, space before the name, sometime ' ' as separator */ foreach_jcr(njcr) { + int vss = 0; +#ifdef WIN32_VSS + if (njcr->pVSSClient && njcr->pVSSClient->IsInitialized()) { + vss = 1; + } +#endif p = ow.get_output(OT_CLEAR, OT_START_OBJ, OT_END); if (njcr->JobId == 0) { @@ -270,6 +370,7 @@ static void list_running_jobs_api(STATUS_PKT *sp) } else { ow.get_output(OT_INT32, "JobId", njcr->JobId, OT_STRING, "Job", njcr->Job, + OT_INT, "VSS", vss, OT_JOBLEVEL,"Level", njcr->getJobLevel(), OT_JOBTYPE, "Type", njcr->getJobType(), OT_JOBSTATUS, "Status", njcr->getJobStatus(), @@ -313,9 +414,10 @@ static void list_running_jobs_api(STATUS_PKT *sp) } if (njcr->store_bsock) { + int val = (njcr->store_bsock->tls)?1:0; ow.get_output(OT_INT64, "SDReadSeqNo", (int64_t)njcr->store_bsock->read_seqno, OT_INT, "fd", njcr->store_bsock->m_fd, - OT_INT, "SDtls", (njcr->store_bsock->tls)?1:0, + OT_INT, "SDtls", val, OT_END); } else { ow.get_output(OT_STRING, "SDSocket", "closed", OT_END); diff --git a/bacula/src/filed/win_efs.c b/bacula/src/filed/win_efs.c new file mode 100644 index 0000000000..860a21af15 --- /dev/null +++ b/bacula/src/filed/win_efs.c @@ -0,0 +1,308 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2014 Bacula Systems SA + All rights reserved. + + The main author of Bacula is Kern Sibbald, with contributions from many + others, a complete list can be found in the file AUTHORS. + + Licensees holding a valid Bacula Systems SA license may use this file + and others of this release in accordance with the proprietary license + agreement provided in the LICENSE file. Redistribution of any part of + this release is not permitted. + + Bacula® is a registered trademark of Kern Sibbald. +*/ +/* + * Bacula File Daemon Windows EFS restore + * + * Kern Sibbald, September MMXIV + * + */ + +#include "bacula.h" +#include "filed.h" +#include "ch.h" +#include "restore.h" +#include "backup.h" + +#ifdef TEST_WORKER +/* + * This is the test version of the worker routines, which simulates + * Windows EFS backup on Linux. + * + * This subroutine is called back from the Windows + * WriteEncryptedFileRaw and returns a single buffer of data or + * sets ulLength = 0 to indicate the end. + */ +static uint32_t test_write_efs_data_cb(char *pbData, void *arctx, uint32_t *len) +{ + r_ctx *rctx = (r_ctx *)arctx; + worker *wrk = (worker *)rctx->efs; + char *head, *buf; + uint32_t data_len; + int32_t count; + + head = (char *)wrk->dequeue(); /* dequeue buffer to write */ + Dmsg1(200, "dequeue buffer. head=%p\n", head); + if (!head) { + *len = 0; + Dmsg0(200, "cb got NULL.\n"); + } else { + data_len = *(int32_t *)head; + Dmsg1(200, "data_len=%d\n", data_len); + if (data_len == 0) { + Dmsg0(200, "Length is zero.\n"); + wrk->push_free_buffer(head); + return ERROR_BUFFER_OVERFLOW; + } + if (data_len > *len) { + Dmsg2(200, "Restore data %ld bytes too long for Microsoft buffer %ld bytes.\n", + data_len, *len); + *len = 0; + errno = b_errno_win32; + wrk->push_free_buffer(head); + return ERROR_BUFFER_OVERFLOW; + } else { + buf = head + sizeof(uint32_t); /* Point to buffer */ + count = *(int32_t *)buf; + buf += sizeof(int32_t); + memcpy(pbData, buf, data_len); + *len = data_len; + Dmsg2(200, "Got count=%d len=%d\n", count, data_len); + wrk->push_free_buffer(head); + } + } + return ERROR_SUCCESS; +} + +/* + * Thread created to run the WriteEncryptedFileRaw code + */ +static void *test_efs_write_thread(void *awrk) +{ + ssize_t wstat; + worker *wrk = (worker *)awrk; + r_ctx *rctx; + uint32_t len; + uint32_t size = 100000; + char *buf = (char *)malloc(size); /* allocate working buffer */ + + rctx = (r_ctx *)wrk->get_ctx(); + Dmsg2(200, "rctx=%p wrk=%p\n", rctx, wrk); + wrk->set_running(); + + while (!wrk->is_quit_state()) { + if (wrk->is_wait_state()) { /* wait if so requested */ + Dmsg0(200, "Enter wait state\n"); + wrk->wait(); + Dmsg0(200, "Leave wait state\n"); + continue; + } + len = size; + if (test_write_efs_data_cb(buf, rctx, &len) != 0) { /* get a buffer */ + berrno be; + Qmsg2(rctx->jcr, M_FATAL, 0, _("Restore data %ld bytes too long for Microsoft buffer %ld bytes.\n"), + len, size); + break; + } + if (len == 0) { /* done? */ + Dmsg0(200, "Got len 0 set_wait_state.\n"); + continue; /* yes */ + } + Dmsg2(200, "Write buf=%p len=%d\n", buf, len); + if ((wstat=bwrite(&rctx->bfd, buf, len)) != (ssize_t)len) { + Dmsg4(000, "bwrite of %d error %d open=%d on file=%s\n", + len, wstat, is_bopen(&rctx->bfd), rctx->jcr->last_fname); + continue; + } + } + Dmsg0(200, "worker thread quiting\n"); + free(buf); + return NULL; +} + +/* + * If the writer thread is not created, create it, then queue + * a buffer to be written by the thread. + */ +bool test_write_efs_data(r_ctx &rctx, char *data, const int32_t length) +{ + POOLMEM *buf, *head; + + if (!rctx.efs) { + rctx.efs = New(worker(10)); + Dmsg2(200, "Start test_efs_write_thread rctx=%p work=%p\n", &rctx, rctx.efs); + rctx.efs->start(test_efs_write_thread, &rctx); + } + head = (POOLMEM *)rctx.efs->pop_free_buffer(); + if (!head) { + head = get_memory(length + 2*sizeof(int32_t)+1); + } else { + head = check_pool_memory_size(head, length+2*sizeof(int32_t)+1); + } + buf = head; + *(int32_t *)buf = length; + buf += sizeof(int32_t); + *(int32_t *)buf = ++rctx.count; + buf += sizeof(int32_t); + memcpy(buf, data, length); + Dmsg3(200, "Put count=%d len=%d head=%p\n", rctx.count, length, head); + rctx.efs->queue(head); + rctx.efs->set_run_state(); + return true; +} +#endif + + +#ifdef HAVE_WIN32 + +/* ============================================================= + * + * Win EFS functions for restore + * + * ============================================================= + */ + +/* + * This subroutine is called back from the Windows + * WriteEncryptedFileRaw. + */ +static DWORD WINAPI write_efs_data_cb(PBYTE pbData, PVOID arctx, PULONG ulLength) +{ + r_ctx *rctx = (r_ctx *)arctx; + worker *wrk = (worker *)rctx->efs; + char *data; + char *buf; + uint32_t data_len; + JCR *jcr = rctx->jcr; + + data = (char *)rctx->efs->dequeue(); /* dequeue buffer to write */ + Dmsg1(200, "dequeue buffer. head=%p\n", data); + if (jcr->is_job_canceled()) { + return ERROR_CANCELLED; + } + if (!data) { + *ulLength = 0; + Dmsg0(200, "cb got NULL.\n"); + } else { + data_len = *(int32_t *)data; + if (data_len > *ulLength) { + Qmsg2(rctx->jcr, M_FATAL, 0, _("Restore data %ld bytes too long for Microsoft buffer %lld bytes.\n"), + data_len, *ulLength); + *ulLength = 0; + } else { + buf = data + sizeof(uint32_t); + memcpy(pbData, buf, data_len); + *ulLength = (ULONG)data_len; + Dmsg1(200, "Got len=%d\n", data_len); + } + wrk->push_free_buffer(data); + } + return ERROR_SUCCESS; +} + +/* + * Thread created to run the WriteEncryptedFileRaw code + */ +static void *efs_write_thread(void *awrk) +{ + worker *wrk = (worker *)awrk; + r_ctx *rctx; + + rctx = (r_ctx *)wrk->get_ctx(); + wrk->set_running(); + + while (!wrk->is_quit_state() && !rctx->jcr->is_job_canceled()) { + if (wrk->is_wait_state()) { /* wait if so requested */ + Dmsg0(200, "Enter wait state\n"); + wrk->wait(); + Dmsg0(200, "Leave wait state\n"); + continue; + } + if (p_WriteEncryptedFileRaw((PFE_IMPORT_FUNC)write_efs_data_cb, rctx, + rctx->bfd.pvContext)) { + berrno be; + Qmsg1(rctx->jcr, M_FATAL, 0, _("WriteEncryptedFileRaw failure: ERR=%s\n"), + be.bstrerror(b_errno_win32)); + return NULL; + } + Dmsg0(200, "Got return from WriteEncryptedFileRaw\n"); + } + return NULL; +} + +/* + * Called here from Bacula to write a block to a Windows EFS file. + * Since the Windows WriteEncryptedFileRaw function uses a callback + * subroutine to get the blocks to write, we create a writer thread, + * and queue the blocks (buffers) we get in this routine. That + * writer thread then hangs on the WriteEncryptedRaw file, calling + * back to the callback subroutine which then dequeues the blocks + * we have queued. + * + * If the writer thread is not created, create it, then queue + * a buffer to be written by the thread. + */ +bool win_write_efs_data(r_ctx &rctx, char *data, const int32_t length) +{ + POOLMEM *buf; + + if (!rctx.efs) { + rctx.efs = New(worker(10)); + rctx.efs->start(efs_write_thread, &rctx); + } + buf = (POOLMEM *)rctx.efs->pop_free_buffer(); + if (!buf) { + buf = get_memory(length + sizeof(int32_t)+1); + } else { + buf = check_pool_memory_size(buf, length+sizeof(int32_t)+1); + } + *(int32_t *)buf = length; + memcpy(buf+sizeof(int32_t), data, length); + Dmsg2(200, "Put len=%d head=%p\n", length, buf); + rctx.efs->queue(buf); + rctx.efs->set_run_state(); + return true; +} + +/* + * The ReadEncryptedFileRaw from bacula.c calls us back here + */ +DWORD WINAPI read_efs_data_cb(PBYTE pbData, PVOID pvCallbackContext, ULONG ulLength) +{ + bctx_t *ctx = (bctx_t *)pvCallbackContext; /* get our context */ + BSOCK *sd = ctx->jcr->store_bsock; + ULONG ulSent = 0; + + if (ctx->jcr->is_job_canceled()) { + return ERROR_CANCELLED; + } + if (ulLength == 0) { + Dmsg0(200, "ulLen=0 => done.\n"); + return ERROR_SUCCESS; /* all done */ + } + while (ulLength > 0) { + /* Get appropriate block length */ + if (ulLength <= (ULONG)ctx->rsize) { + sd->msglen = ulLength; + } else { + sd->msglen = (ULONG)ctx->rsize; + } + Dmsg5(200, "ctx->rbuf=%p msg=%p msgbuflen=%d ulSent=%d len=%d\n", + ctx->rbuf, sd->msg, ctx->rsize, ulSent, sd->msglen); + /* Copy data into Bacula buffer */ + memcpy(ctx->rbuf, pbData + ulSent, sd->msglen); + /* Update sent count and remaining count */ + ulSent += sd->msglen; + ulLength -= sd->msglen; + /* Send the data off to the SD */ + if (!process_and_send_data(*ctx)) { + return ERROR_UNEXP_NET_ERR; + } + } + return ERROR_SUCCESS; +} + +#endif diff --git a/bacula/src/findlib/Makefile.in b/bacula/src/findlib/Makefile.in index 1b47d900e9..2b92e33742 100644 --- a/bacula/src/findlib/Makefile.in +++ b/bacula/src/findlib/Makefile.in @@ -30,7 +30,7 @@ INCLUDE_FILES = bfile.h find.h protos.h win32filter.h # LIBBACFIND_SRCS = find.c match.c find_one.c attribs.c create_file.c \ bfile.c drivetype.c enable_priv.c fstype.c mkpath.c \ - savecwd.c win32filter.c + savecwd.c namedpipe.c win32filter.c LIBBACFIND_OBJS = $(LIBBACFIND_SRCS:.c=.o) LIBBACFIND_LOBJS = $(LIBBACFIND_SRCS:.c=.lo) diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 651547b306..abd971997d 100644 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -36,6 +36,15 @@ static uid_t my_uid = 1; static gid_t my_gid = 1; static bool uid_set = false; +#ifdef HAVE_WIN32 +/* Forward referenced Windows subroutines */ +static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd); +void unix_name_to_win32(POOLMEM **win32_name, const char *name); +void win_error(JCR *jcr, int type, const char *prefix, POOLMEM *ofile); +void win_error(JCR *jcr, const char *prefix, POOLMEM *ofile); +HANDLE bget_handle(BFILE *bfd); +#endif /* HAVE_WIN32 */ + /* * For old systems that don't have lchown() or lchmod() */ @@ -65,7 +74,30 @@ static bool uid_set = false; * root should not get errors. Errors for users causes * too much output. */ -#define print_error (chk_dbglvl(100) || my_uid == 0) +#define print_error(jcr) (chk_dbglvl(100) || (my_uid == 0 && (!jcr || jcr->job_uid == 0))) + +/* + * Restore the owner and permissions (mode) of a Directory. + * See attribs.c for the equivalent for files. + */ +void set_own_mod(ATTR *attr, char *path, uid_t owner, gid_t group, mode_t mode) +{ + if (lchown(path, owner, group) != 0 && print_error(attr->jcr) +#ifdef AFS + && errno != EPERM +#endif + ) { + berrno be; + Jmsg4(attr->jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s %d %d\n"), + path, be.bstrerror(), getuid(), attr->jcr->job_uid); + } + if (lchmod(path, mode) != 0 && print_error(attr->jcr)) { + berrno be; + Jmsg2(attr->jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"), + path, be.bstrerror()); + } +} + bool set_mod_own_time(JCR *jcr, BFILE *ofd, ATTR *attr) { @@ -79,9 +111,9 @@ bool set_mod_own_time(JCR *jcr, BFILE *ofd, ATTR *attr) * way we can ensure this works on older systems. */ #ifdef HAVE_FCHOWN - if (fchown(ofd->fid, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) { + if (fchown(ofd->fid, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error(jcr)) { #else - if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) { + if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error(jcr)) { #endif berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"), @@ -90,9 +122,9 @@ bool set_mod_own_time(JCR *jcr, BFILE *ofd, ATTR *attr) } #ifdef HAVE_FCHMOD - if (fchmod(ofd->fid, attr->statp.st_mode) < 0 && print_error) { + if (fchmod(ofd->fid, attr->statp.st_mode) < 0 && print_error(jcr)) { #else - if (lchmod(attr->ofname, attr->statp.st_mode) < 0 && print_error) { + if (lchmod(attr->ofname, attr->statp.st_mode) < 0 && print_error(jcr)) { #endif berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"), @@ -106,12 +138,12 @@ bool set_mod_own_time(JCR *jcr, BFILE *ofd, ATTR *attr) times[0].tv_usec = 0; times[1].tv_sec = attr->statp.st_mtime; times[1].tv_usec = 0; - if (futimes(ofd->fid, times) < 0 && print_error) { + if (futimes(ofd->fid, times) < 0 && print_error(jcr)) { #else ut.actime = attr->statp.st_atime; ut.modtime = attr->statp.st_mtime; //bclose(ofd); - if (utime(attr->ofname, &ut) < 0 && print_error) { + if (utime(attr->ofname, &ut) < 0 && print_error(jcr)) { #endif berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"), @@ -119,13 +151,13 @@ bool set_mod_own_time(JCR *jcr, BFILE *ofd, ATTR *attr) ok = false; } } else { - if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) { + if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error(jcr)) { berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"), attr->ofname, be.bstrerror()); ok = false; } - if (lchmod(attr->ofname, attr->statp.st_mode) < 0 && print_error) { + if (lchmod(attr->ofname, attr->statp.st_mode) < 0 && print_error(jcr)) { berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"), attr->ofname, be.bstrerror()); @@ -137,7 +169,7 @@ bool set_mod_own_time(JCR *jcr, BFILE *ofd, ATTR *attr) ut.actime = attr->statp.st_atime; ut.modtime = attr->statp.st_mtime; - if (utime(attr->ofname, &ut) < 0 && print_error) { + if (utime(attr->ofname, &ut) < 0 && print_error(jcr)) { berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"), attr->ofname, be.bstrerror()); @@ -547,6 +579,32 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) uid_set = true; } +#ifdef HAVE_WIN32 + if (attr->stream == STREAM_UNIX_ATTRIBUTES_EX && + set_win32_attributes(jcr, attr, ofd)) { + if (is_bopen(ofd)) { + bclose(ofd); + } + pm_strcpy(attr->ofname, "*none*"); + return true; + } + if (attr->data_stream == STREAM_WIN32_DATA || + attr->data_stream == STREAM_WIN32_GZIP_DATA || + attr->data_stream == STREAM_WIN32_COMPRESSED_DATA) { + if (is_bopen(ofd)) { + bclose(ofd); + } + pm_strcpy(attr->ofname, "*none*"); + return true; + } + + /* + * If Windows stuff failed, e.g. attempt to restore Unix file + * to Windows, simply fall through and we will do it the + * universal way. + */ +#endif /* HAVE_WIN32 */ + old_mask = umask(0); if (is_bopen(ofd)) { char ec1[50], ec2[50]; @@ -575,7 +633,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) if (attr->type == FT_LNK) { #ifdef HAVE_LCHOWN /* Change owner of link, not of real file */ - if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) { + if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error(jcr)) { berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"), attr->ofname, be.bstrerror()); @@ -588,7 +646,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) times[0].tv_usec = 0; times[1].tv_sec = attr->statp.st_mtime; times[1].tv_usec = 0; - if (lutimes(attr->ofname, times) < 0 && print_error) { + if (lutimes(attr->ofname, times) < 0 && print_error(jcr)) { berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"), attr->ofname, be.bstrerror()); @@ -609,7 +667,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) * but if the immutable bit is set, it will make the utimes() * fail. */ - if (chflags(attr->ofname, attr->statp.st_flags) < 0 && print_error) { + if (chflags(attr->ofname, attr->statp.st_flags) < 0 && print_error(jcr)) { berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file flags %s: ERR=%s\n"), attr->ofname, be.bstrerror()); @@ -670,3 +728,259 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) } #endif + + + +/*=============================================================*/ +/* */ +/* * * * W i n 3 2 * * * * */ +/* */ +/*=============================================================*/ + +#ifdef HAVE_WIN32 + +int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) +{ + char *p = attribsEx; + WIN32_FILE_ATTRIBUTE_DATA atts; + ULARGE_INTEGER li; + + attribsEx[0] = 0; /* no extended attributes */ + + if (jcr->cmd_plugin || ff_pkt->type == FT_DELETED) { + return STREAM_UNIX_ATTRIBUTES; + } + + unix_name_to_win32(&ff_pkt->sys_fname, ff_pkt->fname); + + /* try unicode version */ + if (p_GetFileAttributesExW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, ff_pkt->fname); + + BOOL b=p_GetFileAttributesExW((LPCWSTR)pwszBuf, GetFileExInfoStandard, + (LPVOID)&atts); + free_pool_memory(pwszBuf); + + if (!b) { + win_error(jcr, "GetFileAttributesExW:", ff_pkt->sys_fname); + return STREAM_UNIX_ATTRIBUTES; + } + } + else { + if (!p_GetFileAttributesExA) + return STREAM_UNIX_ATTRIBUTES; + + if (!p_GetFileAttributesExA(ff_pkt->sys_fname, GetFileExInfoStandard, + (LPVOID)&atts)) { + win_error(jcr, "GetFileAttributesExA:", ff_pkt->sys_fname); + return STREAM_UNIX_ATTRIBUTES; + } + } + + p += to_base64((uint64_t)atts.dwFileAttributes, p); + *p++ = ' '; /* separate fields with a space */ + li.LowPart = atts.ftCreationTime.dwLowDateTime; + li.HighPart = atts.ftCreationTime.dwHighDateTime; + p += to_base64((uint64_t)li.QuadPart, p); + *p++ = ' '; + li.LowPart = atts.ftLastAccessTime.dwLowDateTime; + li.HighPart = atts.ftLastAccessTime.dwHighDateTime; + p += to_base64((uint64_t)li.QuadPart, p); + *p++ = ' '; + li.LowPart = atts.ftLastWriteTime.dwLowDateTime; + li.HighPart = atts.ftLastWriteTime.dwHighDateTime; + p += to_base64((uint64_t)li.QuadPart, p); + *p++ = ' '; + p += to_base64((uint64_t)atts.nFileSizeHigh, p); + *p++ = ' '; + p += to_base64((uint64_t)atts.nFileSizeLow, p); + *p = 0; + return STREAM_UNIX_ATTRIBUTES_EX; +} + +/* Define attributes that are legal to set with SetFileAttributes() */ +#define SET_ATTRS ( \ + FILE_ATTRIBUTE_ARCHIVE| \ + FILE_ATTRIBUTE_HIDDEN| \ + FILE_ATTRIBUTE_NORMAL| \ + FILE_ATTRIBUTE_NOT_CONTENT_INDEXED| \ + FILE_ATTRIBUTE_OFFLINE| \ + FILE_ATTRIBUTE_READONLY| \ + FILE_ATTRIBUTE_SYSTEM| \ + FILE_ATTRIBUTE_TEMPORARY) + +/* + * Set Extended File Attributes for Win32 + * + * fname is the original filename + * ofile is the output filename (may be in a different directory) + * + * Returns: true on success + * false on failure + */ +static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) +{ + char *p = attr->attrEx; + int64_t val; + WIN32_FILE_ATTRIBUTE_DATA atts; + ULARGE_INTEGER li; + POOLMEM *win32_ofile; + + /* if we have neither Win ansi nor wchar API, get out */ + if (!(p_SetFileAttributesW || p_SetFileAttributesA)) { + return false; + } + + if (!p || !*p) { /* we should have attributes */ + Dmsg2(100, "Attributes missing. of=%s ofd=%d\n", attr->ofname, ofd->fid); + if (is_bopen(ofd)) { + bclose(ofd); + } + return false; + } else { + Dmsg2(100, "Attribs %s = %s\n", attr->ofname, attr->attrEx); + } + + p += from_base64(&val, p); + plug(atts.dwFileAttributes, val); + p++; /* skip space */ + p += from_base64(&val, p); + li.QuadPart = val; + atts.ftCreationTime.dwLowDateTime = li.LowPart; + atts.ftCreationTime.dwHighDateTime = li.HighPart; + p++; /* skip space */ + p += from_base64(&val, p); + li.QuadPart = val; + atts.ftLastAccessTime.dwLowDateTime = li.LowPart; + atts.ftLastAccessTime.dwHighDateTime = li.HighPart; + p++; /* skip space */ + p += from_base64(&val, p); + li.QuadPart = val; + atts.ftLastWriteTime.dwLowDateTime = li.LowPart; + atts.ftLastWriteTime.dwHighDateTime = li.HighPart; + p++; + p += from_base64(&val, p); + plug(atts.nFileSizeHigh, val); + p++; + p += from_base64(&val, p); + plug(atts.nFileSizeLow, val); + + /* Convert to Windows path format */ + win32_ofile = get_pool_memory(PM_FNAME); + unix_name_to_win32(&win32_ofile, attr->ofname); + + /* At this point, we have reconstructed the WIN32_FILE_ATTRIBUTE_DATA pkt */ + + if (!is_bopen(ofd)) { + Dmsg1(100, "File not open: %s\n", attr->ofname); + bopen(ofd, attr->ofname, O_WRONLY|O_BINARY, 0); /* attempt to open the file */ + } + + if (is_bopen(ofd)) { + Dmsg1(100, "SetFileTime %s\n", attr->ofname); + if (!SetFileTime(bget_handle(ofd), + &atts.ftCreationTime, + &atts.ftLastAccessTime, + &atts.ftLastWriteTime)) { + win_error(jcr, M_WARNING, "SetFileTime:", win32_ofile); + } + + /* + * Inform win32 api that the given file is a sparse file + */ + if (atts.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) { + DWORD bytesReturned; + + Dmsg1(100, "Set FILE_ATTRIBUTE_SPARSE_FILE on %s\n", attr->ofname); + if (!DeviceIoControl(bget_handle(ofd), FSCTL_SET_SPARSE, + NULL, 0, NULL, 0, &bytesReturned, NULL)) + { + /* Not sure we really want to have a Warning for such attribute */ + win_error(jcr, M_WARNING, "set SPARSE_FILE:", win32_ofile); + } + } + + /* + * Restore the file as compressed. + */ + if (atts.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) { + int fmt = COMPRESSION_FORMAT_DEFAULT; + DWORD bytesReturned; + + Dmsg1(100, "Set FILE_ATTRIBUTE_COMPRESSED on %s\n", attr->ofname); + if (!DeviceIoControl(bget_handle(ofd), FSCTL_SET_COMPRESSION, + &fmt, sizeof(fmt), NULL, 0, &bytesReturned, NULL)) + { + /* Not sure we really want to have a Warning for such attribute */ + win_error(jcr, M_WARNING, "set COMPRESSED:", win32_ofile); + } + } + + bclose(ofd); + } + + Dmsg1(100, "SetFileAtts %s\n", attr->ofname); + if (!(atts.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + if (p_SetFileAttributesW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, attr->ofname); + + BOOL b=p_SetFileAttributesW((LPCWSTR)pwszBuf, atts.dwFileAttributes & SET_ATTRS); + free_pool_memory(pwszBuf); + + if (!b) + win_error(jcr, M_WARNING, "SetFileAttributesW:", win32_ofile); + } + else { + if (!p_SetFileAttributesA(win32_ofile, atts.dwFileAttributes & SET_ATTRS)) { + win_error(jcr, M_WARNING, "SetFileAttributesA:", win32_ofile); + } + } + } + free_pool_memory(win32_ofile); + return true; +} + +void win_error(JCR *jcr, int type, const char *prefix, POOLMEM *win32_ofile) +{ + DWORD lerror = GetLastError(); + LPTSTR msg; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER| + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + lerror, + 0, + (LPTSTR)&msg, + 0, + NULL); + Dmsg3(100, "Error in %s on file %s: ERR=%s\n", prefix, win32_ofile, msg); + strip_trailing_junk(msg); + Jmsg3(jcr, type, 0, _("Error in %s file %s: ERR=%s\n"), prefix, win32_ofile, msg); + LocalFree(msg); +} + +void win_error(JCR *jcr, const char *prefix, POOLMEM *win32_ofile) +{ + win_error(jcr, M_ERROR, prefix, win32_ofile); +} + +void win_error(JCR *jcr, const char *prefix, DWORD lerror) +{ + LPTSTR msg; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER| + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + lerror, + 0, + (LPTSTR)&msg, + 0, + NULL); + strip_trailing_junk(msg); + if (jcr) { + Jmsg2(jcr, M_ERROR, 0, _("Error in %s: ERR=%s\n"), prefix, msg); + MessageBox(NULL, msg, prefix, MB_OK); + } + LocalFree(msg); +} +#endif /* HAVE_WIN32 */ diff --git a/bacula/src/findlib/bfile.c b/bacula/src/findlib/bfile.c index 3c6e611874..5b2bbab1eb 100644 --- a/bacula/src/findlib/bfile.c +++ b/bacula/src/findlib/bfile.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,7 +11,7 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. @@ -262,101 +262,609 @@ void int32_LE2BE(int32_t* pBE, const int32_t v) */ bool processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, ssize_t dwSize) { - /* pByte contains the buffer - dwSize the len to be processed. function assumes to be - called in successive incremental order over the complete - BackupRead stream beginning at pos 0 and ending at the end. - */ + int64_t len = dwSize; + char *dat=(char *)pBuffer; + int64_t use_len; - PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT* pContext = &(bfd->win32DecompContext); - bool bContinue = false; - int64_t dwDataOffset = 0; - int64_t dwDataLen; + while (len>0 && bfd->win32filter.have_data(&dat, &len, &use_len)) { + if (bwrite(bfd, dat, use_len) != (ssize_t)use_len) { + return false; + } + dat+=use_len; + } + return true; +} - /* Win32 Stream Header size without name of stream. - * = sizeof (WIN32_STREAM_ID)- sizeof(WCHAR*); - */ - int32_t dwSizeHeader = 20; +/* =============================================================== + * + * W I N D O W S + * + * =============================================================== + */ - do { - if (pContext->liNextHeader >= dwSize) { - dwDataLen = dwSize-dwDataOffset; - bContinue = false; /* 1 iteration is enough */ - } else { - dwDataLen = pContext->liNextHeader-dwDataOffset; - bContinue = true; /* multiple iterations may be necessary */ +#if defined(HAVE_WIN32) + +void unix_name_to_win32(POOLMEM **win32_name, const char *name); +extern "C" HANDLE get_osfhandle(int fd); + + +void binit(BFILE *bfd) +{ + memset(bfd, 0, sizeof(BFILE)); + bfd->fid = -1; + bfd->mode = BF_CLOSED; + bfd->use_backup_api = have_win32_api(); + bfd->cmd_plugin = false; +} + +/* + * Enables using the Backup API (win32_data). + * Returns 1 if function worked + * Returns 0 if failed (i.e. do not have Backup API on this machine) + */ +bool set_win32_backup(BFILE *bfd) +{ + /* We enable if possible here */ + bfd->use_backup_api = have_win32_api(); + return bfd->use_backup_api; +} + +void set_fattrs(BFILE *bfd, struct stat *statp) +{ + bfd->fattrs = statp->st_fattrs; + Dmsg1(200, "set_fattrs 0x%x\n", bfd->fattrs); +} + +bool set_portable_backup(BFILE *bfd) +{ + bfd->use_backup_api = false; + return true; +} + +bool set_cmd_plugin(BFILE *bfd, JCR *jcr) +{ + bfd->cmd_plugin = true; + bfd->jcr = jcr; + return true; +} + +/* + * Return 1 if we are NOT using Win32 BackupWrite() + * return 0 if are + */ +bool is_portable_backup(BFILE *bfd) +{ + return !bfd->use_backup_api; +} + +bool have_win32_api() +{ + return p_BackupRead && p_BackupWrite; +} + + +/* + * Return true if we support the stream + * false if we do not support the stream + * + * This code is running under Win32, so we + * do not need #ifdef on MACOS ... + */ +bool is_restore_stream_supported(int stream) +{ + switch (stream) { + +/* Streams known not to be supported */ +#ifndef HAVE_LIBZ + case STREAM_GZIP_DATA: + case STREAM_SPARSE_GZIP_DATA: + case STREAM_WIN32_GZIP_DATA: +#endif +#ifndef HAVE_LZO + case STREAM_COMPRESSED_DATA: + case STREAM_SPARSE_COMPRESSED_DATA: + case STREAM_WIN32_COMPRESSED_DATA: + case STREAM_ENCRYPTED_FILE_COMPRESSED_DATA: + case STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA: +#endif + case STREAM_MACOS_FORK_DATA: + case STREAM_HFSPLUS_ATTRIBUTES: + case STREAM_ENCRYPTED_MACOS_FORK_DATA: + return false; + + /* Known streams */ +#ifdef HAVE_LIBZ + case STREAM_GZIP_DATA: + case STREAM_SPARSE_GZIP_DATA: + case STREAM_WIN32_GZIP_DATA: +#endif +#ifdef HAVE_LZO + case STREAM_COMPRESSED_DATA: + case STREAM_SPARSE_COMPRESSED_DATA: + case STREAM_WIN32_COMPRESSED_DATA: +#endif + case STREAM_WIN32_DATA: + case STREAM_UNIX_ATTRIBUTES: + case STREAM_FILE_DATA: + case STREAM_MD5_DIGEST: + case STREAM_UNIX_ATTRIBUTES_EX: + case STREAM_SPARSE_DATA: + case STREAM_PROGRAM_NAMES: + case STREAM_PROGRAM_DATA: + case STREAM_SHA1_DIGEST: +#ifdef HAVE_SHA2 + case STREAM_SHA256_DIGEST: + case STREAM_SHA512_DIGEST: +#endif +#ifdef HAVE_CRYPTO + case STREAM_SIGNED_DIGEST: + case STREAM_ENCRYPTED_FILE_DATA: + case STREAM_ENCRYPTED_FILE_GZIP_DATA: + case STREAM_ENCRYPTED_WIN32_DATA: + case STREAM_ENCRYPTED_WIN32_GZIP_DATA: +#ifdef HAVE_LZO + case STREAM_ENCRYPTED_FILE_COMPRESSED_DATA: + case STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA: +#endif +#endif /* !HAVE_CRYPTO */ + case 0: /* compatibility with old tapes */ + return true; + } + return false; +} + +HANDLE bget_handle(BFILE *bfd) +{ + return bfd->fh; +} + +/* + * The following code was contributed by Graham Keeling from his + * burp project. August 2014 + */ +static int encrypt_bopen(BFILE *bfd, const char *fname, uint64_t flags, mode_t mode) +{ + ULONG ulFlags = 0; + POOLMEM *win32_fname; + POOLMEM *win32_fname_wchar; + + bfd->mode = BF_CLOSED; + bfd->fid = -1; + + if (!(p_OpenEncryptedFileRawA || p_OpenEncryptedFileRawW)) { + Dmsg0(50, "No OpenEncryptedFileRawA and no OpenEncryptedFileRawW APIs!!!\n"); + return -1; + } + + /* Convert to Windows path format */ + win32_fname = get_pool_memory(PM_FNAME); + win32_fname_wchar = get_pool_memory(PM_FNAME); + + unix_name_to_win32(&win32_fname, (char *)fname); + + if (p_CreateFileW && p_MultiByteToWideChar) { + make_win32_path_UTF8_2_wchar(&win32_fname_wchar, fname); + } + + if ((flags & O_CREAT) || (flags & O_WRONLY)) { + ulFlags = CREATE_FOR_IMPORT | OVERWRITE_HIDDEN; + if (bfd->fattrs & FILE_ATTRIBUTE_DIRECTORY) { + mkdir(fname, 0777); + ulFlags |= CREATE_FOR_DIR; } + bfd->mode = BF_WRITE; + Dmsg0(200, "encrypt_bopen for write.\n"); + } else { + /* Open existing for read */ + ulFlags = CREATE_FOR_EXPORT; + bfd->mode = BF_READ; + Dmsg0(200, "encrypt_bopen for read.\n"); + } - /* flush */ - /* copy block of real DATA */ - if (pContext->bIsInData) { - if (bwrite(bfd, ((char *)pBuffer)+dwDataOffset, dwDataLen) != (ssize_t)dwDataLen) - return false; + if (p_OpenEncryptedFileRawW && p_MultiByteToWideChar) { + /* unicode open */ + if (p_OpenEncryptedFileRawW((LPCWSTR)win32_fname_wchar, + ulFlags, &(bfd->pvContext))) { + bfd->mode = BF_CLOSED; + errno = b_errno_win32; + bfd->berrno = b_errno_win32; + } + } else { + /* ascii open */ + if (p_OpenEncryptedFileRawA(win32_fname, ulFlags, &(bfd->pvContext))) { + bfd->mode = BF_CLOSED; + errno = b_errno_win32; + bfd->berrno = b_errno_win32; } + } + free_pool_memory(win32_fname_wchar); + free_pool_memory(win32_fname); + bfd->fid = (bfd->mode == BF_CLOSED) ? -1 : 0; + return bfd->mode==BF_CLOSED ? -1: 1; +} - if (pContext->liNextHeader < dwSize) {/* is a header in this block ? */ - int32_t dwOffsetTarget; - int32_t dwOffsetSource; +static int encrypt_bclose(BFILE *bfd) +{ + Dmsg0(200, "encrypt_bclose\n"); + if (p_CloseEncryptedFileRaw) { + p_CloseEncryptedFileRaw(bfd->pvContext); + } + bfd->pvContext = NULL; + bfd->mode = BF_CLOSED; + bfd->fattrs = 0; + bfd->fid = -1; + return 0; +} - if (pContext->liNextHeader < 0) { - /* start of header was before this block, so we - * continue with the part in the current block - */ - dwOffsetTarget = -pContext->liNextHeader; - dwOffsetSource = 0; - } else { - /* start of header is inside of this block */ - dwOffsetTarget = 0; - dwOffsetSource = pContext->liNextHeader; - } +/* Windows */ +int bopen(BFILE *bfd, const char *fname, uint64_t flags, mode_t mode) +{ + POOLMEM *win32_fname; + POOLMEM *win32_fname_wchar; + + DWORD dwaccess, dwflags, dwshare; - int32_t dwHeaderPartLen = dwSizeHeader-dwOffsetTarget; - bool bHeaderIsComplete; + if (bfd->fattrs & FILE_ATTRIBUTE_ENCRYPTED) { + return encrypt_bopen(bfd, fname, flags, mode); + } + + /* Convert to Windows path format */ + win32_fname = get_pool_memory(PM_FNAME); + win32_fname_wchar = get_pool_memory(PM_FNAME); - if (dwHeaderPartLen <= dwSize-dwOffsetSource) { - /* header (or rest of header) is completely available - in current block - */ - bHeaderIsComplete = true; + unix_name_to_win32(&win32_fname, (char *)fname); + + if (bfd->cmd_plugin && plugin_bopen) { + int rtnstat; + Dmsg1(50, "call plugin_bopen fname=%s\n", fname); + rtnstat = plugin_bopen(bfd, fname, flags, mode); + Dmsg1(50, "return from plugin_bopen status=%d\n", rtnstat); + if (rtnstat >= 0) { + if (flags & O_CREAT || flags & O_WRONLY) { /* Open existing for write */ + Dmsg1(50, "plugin_open for write OK file=%s.\n", fname); + bfd->mode = BF_WRITE; } else { - /* header will continue in next block */ - bHeaderIsComplete = false; - dwHeaderPartLen = dwSize-dwOffsetSource; + Dmsg1(50, "plugin_open for read OK file=%s.\n", fname); + bfd->mode = BF_READ; } + bfd->fid = -1; /* The file descriptor is invalid */ + } else { + bfd->mode = BF_CLOSED; + bfd->fid = -1; + Dmsg1(000, "==== plugin_bopen returned bad status=%d\n", rtnstat); + } + free_pool_memory(win32_fname_wchar); + free_pool_memory(win32_fname); + return bfd->mode == BF_CLOSED ? -1 : 1; + } + Dmsg0(100, "=== NO plugin\n"); + + if (!(p_CreateFileA || p_CreateFileW)) { + Dmsg0(50, "No CreateFileA and no CreateFileW!!!!!\n"); + return 0; + } + + if (p_CreateFileW && p_MultiByteToWideChar) { + make_win32_path_UTF8_2_wchar(&win32_fname_wchar, fname); + } - /* copy the available portion of header to persistent copy */ - memcpy(((char *)&pContext->header_stream)+dwOffsetTarget, ((char *)pBuffer)+dwOffsetSource, dwHeaderPartLen); + if (flags & O_CREAT) { /* Create */ + if (bfd->use_backup_api) { + dwaccess = GENERIC_WRITE|FILE_ALL_ACCESS|WRITE_OWNER|WRITE_DAC|ACCESS_SYSTEM_SECURITY; + dwflags = FILE_FLAG_BACKUP_SEMANTICS; + } else { + dwaccess = GENERIC_WRITE; + dwflags = 0; + } - /* recalculate position of next header */ - if (bHeaderIsComplete) { - /* convert stream name size (32 bit little endian) to machine type */ - int32_t dwNameSize; - int32_LE2BE (&dwNameSize, pContext->header_stream.dwStreamNameSize); - dwDataOffset = dwNameSize+pContext->liNextHeader+dwSizeHeader; + if (p_CreateFileW && p_MultiByteToWideChar) { + // unicode open for create write + Dmsg1(100, "Create CreateFileW=%ls\n", win32_fname_wchar); + bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar, + dwaccess, /* Requested access */ + 0, /* Shared mode */ + NULL, /* SecurityAttributes */ + CREATE_ALWAYS, /* CreationDisposition */ + dwflags, /* Flags and attributes */ + NULL); /* TemplateFile */ + } else { + // ascii open + Dmsg1(100, "Create CreateFileA=%s\n", win32_fname); + bfd->fh = p_CreateFileA(win32_fname, + dwaccess, /* Requested access */ + 0, /* Shared mode */ + NULL, /* SecurityAttributes */ + CREATE_ALWAYS, /* CreationDisposition */ + dwflags, /* Flags and attributes */ + NULL); /* TemplateFile */ + } - /* convert stream size (64 bit little endian) to machine type */ - int64_LE2BE (&(pContext->liNextHeader), pContext->header_stream.Size); - pContext->liNextHeader += dwDataOffset; + bfd->mode = BF_WRITE; - pContext->bIsInData = pContext->header_stream.dwStreamId == WIN32_BACKUP_DATA; - if (dwDataOffset == dwSize) - bContinue = false; + } else if (flags & O_WRONLY) { /* Open existing for write */ + if (bfd->use_backup_api) { + dwaccess = GENERIC_READ|GENERIC_WRITE|WRITE_OWNER|WRITE_DAC; + /* If deduped we do not want to open the reparse point */ + if (bfd->fattrs & FILE_ATTRIBUTE_DEDUP) { + dwflags = FILE_FLAG_BACKUP_SEMANTICS; } else { - /* stop and continue with next block */ - bContinue = false; - pContext->bIsInData = false; + dwflags = FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT; } + } else { + dwaccess = GENERIC_READ|GENERIC_WRITE; + dwflags = 0; + } + + if (p_CreateFileW && p_MultiByteToWideChar) { + // unicode open for open existing write + Dmsg1(100, "Write only CreateFileW=%s\n", win32_fname); + bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar, + dwaccess, /* Requested access */ + 0, /* Shared mode */ + NULL, /* SecurityAttributes */ + OPEN_EXISTING, /* CreationDisposition */ + dwflags, /* Flags and attributes */ + NULL); /* TemplateFile */ + } else { + // ascii open + Dmsg1(100, "Write only CreateFileA=%s\n", win32_fname); + bfd->fh = p_CreateFileA(win32_fname, + dwaccess, /* Requested access */ + 0, /* Shared mode */ + NULL, /* SecurityAttributes */ + OPEN_EXISTING, /* CreationDisposition */ + dwflags, /* Flags and attributes */ + NULL); /* TemplateFile */ + + } + + bfd->mode = BF_WRITE; + + } else { /* Read */ + if (bfd->use_backup_api) { + dwaccess = GENERIC_READ|READ_CONTROL|ACCESS_SYSTEM_SECURITY; + dwflags = FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_SEQUENTIAL_SCAN | + FILE_FLAG_OPEN_REPARSE_POINT; + dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE; + } else { + dwaccess = GENERIC_READ; + dwflags = 0; + dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE; + } + + if (p_CreateFileW && p_MultiByteToWideChar) { + // unicode open for open existing read + Dmsg1(100, "Read CreateFileW=%ls\n", win32_fname_wchar); + bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar, + dwaccess, /* Requested access */ + dwshare, /* Share modes */ + NULL, /* SecurityAttributes */ + OPEN_EXISTING, /* CreationDisposition */ + dwflags, /* Flags and attributes */ + NULL); /* TemplateFile */ + } else { + // ascii open + Dmsg1(100, "Read CreateFileA=%s\n", win32_fname); + bfd->fh = p_CreateFileA(win32_fname, + dwaccess, /* Requested access */ + dwshare, /* Share modes */ + NULL, /* SecurityAttributes */ + OPEN_EXISTING, /* CreationDisposition */ + dwflags, /* Flags and attributes */ + NULL); /* TemplateFile */ + } + + bfd->mode = BF_READ; + } + + if (bfd->fh == INVALID_HANDLE_VALUE) { + berrno be; + bfd->lerror = GetLastError(); + bfd->berrno = b_errno_win32; + errno = b_errno_win32; + bfd->mode = BF_CLOSED; + Dmsg1(100, "Open failed: %s\n", be.bstrerror()); + } + bfd->block = 0; + bfd->total_bytes = 0; + bfd->errmsg = NULL; + bfd->lpContext = NULL; + bfd->win32filter.init(); + free_pool_memory(win32_fname_wchar); + free_pool_memory(win32_fname); + bfd->fid = (bfd->mode == BF_CLOSED) ? -1 : 0; + return bfd->mode == BF_CLOSED ? -1 : 1; +} + +/* + * Returns 0 on success + * -1 on error + */ +/* Windows */ +int bclose(BFILE *bfd) +{ + int stat = 0; + + if (bfd->mode == BF_CLOSED) { + Dmsg0(50, "=== BFD already closed.\n"); + return 0; + } + + if (bfd->cmd_plugin && plugin_bclose) { + stat = plugin_bclose(bfd); + Dmsg0(50, "==== BFD closed!!!\n"); + goto all_done; + } + + if (bfd->fattrs & FILE_ATTRIBUTE_ENCRYPTED) { + return encrypt_bclose(bfd); + } + + /* + * We need to tell the API to release the buffer it + * allocated in lpContext. We do so by calling the + * API one more time, but with the Abort bit set. + */ + if (bfd->use_backup_api && bfd->mode == BF_READ) { + BYTE buf[10]; + if (bfd->lpContext && !p_BackupRead(bfd->fh, + buf, /* buffer */ + (DWORD)0, /* bytes to read */ + &bfd->rw_bytes, /* bytes read */ + 1, /* Abort */ + 1, /* ProcessSecurity */ + &bfd->lpContext)) { /* Read context */ + errno = b_errno_win32; + stat = -1; + } + } else if (bfd->use_backup_api && bfd->mode == BF_WRITE) { + BYTE buf[10]; + if (bfd->lpContext && !p_BackupWrite(bfd->fh, + buf, /* buffer */ + (DWORD)0, /* bytes to read */ + &bfd->rw_bytes, /* bytes written */ + 1, /* Abort */ + 1, /* ProcessSecurity */ + &bfd->lpContext)) { /* Write context */ + errno = b_errno_win32; + stat = -1; + } + } + if (!CloseHandle(bfd->fh)) { + stat = -1; + errno = b_errno_win32; + } + +all_done: + if (bfd->errmsg) { + free_pool_memory(bfd->errmsg); + bfd->errmsg = NULL; + } + bfd->mode = BF_CLOSED; + bfd->fattrs = 0; + bfd->fid = -1; + bfd->lpContext = NULL; + bfd->cmd_plugin = false; + return stat; +} + +/* Returns: bytes read on success + * 0 on EOF + * -1 on error + */ +/* Windows */ +ssize_t bread(BFILE *bfd, void *buf, size_t count) +{ + bfd->rw_bytes = 0; + + if (bfd->cmd_plugin && plugin_bread) { + return plugin_bread(bfd, buf, count); + } + + if (bfd->use_backup_api) { + if (!p_BackupRead(bfd->fh, + (BYTE *)buf, + count, + &bfd->rw_bytes, + 0, /* no Abort */ + 1, /* Process Security */ + &bfd->lpContext)) { /* Context */ + berrno be; + bfd->lerror = GetLastError(); + bfd->berrno = b_errno_win32; + errno = b_errno_win32; + Dmsg1(100, "Read failed: %s\n", be.bstrerror()); + return -1; } - } while (bContinue); + } else { + if (!ReadFile(bfd->fh, + buf, + count, + &bfd->rw_bytes, + NULL)) { + bfd->lerror = GetLastError(); + bfd->berrno = b_errno_win32; + errno = b_errno_win32; + return -1; + } + } + bfd->block++; + if (bfd->rw_bytes > 0) { + bfd->total_bytes += bfd->rw_bytes; + } + return (ssize_t)bfd->rw_bytes; +} + +/* Windows */ +ssize_t bwrite(BFILE *bfd, void *buf, size_t count) +{ + bfd->rw_bytes = 0; + + if (bfd->cmd_plugin && plugin_bwrite) { + return plugin_bwrite(bfd, buf, count); + } - /* set "NextHeader" relative to the beginning of the next block */ - pContext->liNextHeader-= dwSize; + if (bfd->use_backup_api) { + if (!p_BackupWrite(bfd->fh, + (BYTE *)buf, + count, + &bfd->rw_bytes, + 0, /* No abort */ + 1, /* Process Security */ + &bfd->lpContext)) { /* Context */ + berrno be; + bfd->lerror = GetLastError(); + bfd->berrno = b_errno_win32; + errno = b_errno_win32; + Dmsg1(100, "Write failed: %s\n", be.bstrerror()); + return -1; + } + } else { + if (!WriteFile(bfd->fh, + buf, + count, + &bfd->rw_bytes, + NULL)) { + bfd->lerror = GetLastError(); + bfd->berrno = b_errno_win32; + errno = b_errno_win32; + return -1; + } + } + bfd->block++; + if (bfd->rw_bytes > 0) { + bfd->total_bytes += bfd->rw_bytes; + } + return (ssize_t)bfd->rw_bytes; +} - return TRUE; +/* Windows */ +bool is_bopen(BFILE *bfd) +{ + return bfd->mode != BF_CLOSED; } +/* Windows */ +boffset_t blseek(BFILE *bfd, boffset_t offset, int whence) +{ + LONG offset_low = (LONG)offset; + LONG offset_high = (LONG)(offset >> 32); + DWORD dwResult; + + if (bfd->cmd_plugin && plugin_blseek) { + return plugin_blseek(bfd, offset, whence); + } + + dwResult = SetFilePointer(bfd->fh, offset_low, &offset_high, whence); + + if (dwResult == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { + return (boffset_t)-1; + } + return ((boffset_t)offset_high << 32) | dwResult; +} +#else /* Unix systems */ /* =============================================================== * @@ -506,7 +1014,7 @@ int bopen(BFILE *bfd, const char *fname, uint64_t flags, mode_t mode) Dmsg1(dbglvl, "open file %s\n", fname); /* We use fnctl to set O_NOATIME if requested to avoid open error */ - bfd->fid = open(fname, (flags | O_CLOEXEC) & ~O_NOATIME, mode); + bfd->fid = open(fname, flags & ~O_NOATIME, mode); /* Set O_NOATIME if possible */ if (bfd->fid != -1 && flags & O_NOATIME) { @@ -532,8 +1040,7 @@ int bopen(BFILE *bfd, const char *fname, uint64_t flags, mode_t mode) Dmsg1(400, "Open file %d\n", bfd->fid); errno = bfd->berrno; - bfd->win32DecompContext.bIsInData = false; - bfd->win32DecompContext.liNextHeader = 0; + bfd->win32filter.init(); #if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED) /* If not RDWR or WRONLY must be Read Only */ @@ -582,7 +1089,6 @@ int bclose(BFILE *bfd) stat = plugin_bclose(bfd); bfd->fid = -1; bfd->cmd_plugin = false; - return stat; } #if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED) @@ -627,13 +1133,10 @@ ssize_t bwrite(BFILE *bfd, void *buf, size_t count) ssize_t stat; if (bfd->cmd_plugin && plugin_bwrite) { - stat = plugin_bwrite(bfd, buf, count); - - } else { - stat = write(bfd->fid, buf, count); - bfd->berrno = errno; + return plugin_bwrite(bfd, buf, count); } - + stat = write(bfd->fid, buf, count); + bfd->berrno = errno; bfd->block++; if (stat > 0) { bfd->total_bytes += stat; @@ -659,3 +1162,5 @@ boffset_t blseek(BFILE *bfd, boffset_t offset, int whence) bfd->berrno = errno; return pos; } + +#endif diff --git a/bacula/src/findlib/bfile.h b/bacula/src/findlib/bfile.h index eba4082344..78e3b58a3b 100644 --- a/bacula/src/findlib/bfile.h +++ b/bacula/src/findlib/bfile.h @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -27,21 +27,7 @@ #ifndef __BFILE_H #define __BFILE_H - -/* this should physically correspond to WIN32_STREAM_ID - * from winbase.h on Win32. We didn't inlcude cStreamName - * as we don't use it and don't need it for a correct struct size. - */ - -#define WIN32_BACKUP_DATA 1 - -typedef struct _BWIN32_STREAM_ID { - int32_t dwStreamId; - int32_t dwStreamAttributes; - int64_t Size; - int32_t dwStreamNameSize; -} BWIN32_STREAM_ID, *LPBWIN32_STREAM_ID ; - +#include "win32filter.h" typedef struct _PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT { int64_t liNextHeader; @@ -73,6 +59,7 @@ public: HANDLE fh; /* Win32 file handle */ int fid; /* fd if doing Unix style */ LPVOID lpContext; /* BackupRead/Write context */ + PVOID pvContext; /* Windows encryption (EFS) context */ POOLMEM *errmsg; /* error message buffer */ DWORD rw_bytes; /* Bytes read or written */ DWORD lerror; /* Last error code */ @@ -82,7 +69,7 @@ public: uint64_t total_bytes; /* bytes written */ boffset_t offset; /* Delta offset */ JCR *jcr; /* jcr for editing job codes */ - PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT win32DecompContext; /* context for decomposition of win32 backup streams */ + Win32Filter win32filter; /* context for decomposition of win32 backup streams */ int use_backup_decomp; /* set if using BackupRead Stream Decomposition */ bool reparse_point; /* set if reparse point */ bool cmd_plugin; /* set if we have a command plugin */ @@ -115,7 +102,7 @@ struct BFILE { uint64_t total_bytes; /* bytes written */ boffset_t offset; /* Delta offset */ JCR *jcr; /* jcr for editing job codes */ - PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT win32DecompContext; /* context for decomposition of win32 backup streams */ + Win32Filter win32filter; /* context for decomposition of win32 backup streams */ int use_backup_decomp; /* set if using BackupRead Stream Decomposition */ bool reparse_point; /* not used in Unix */ bool cmd_plugin; /* set if we have a command plugin */ diff --git a/bacula/src/findlib/enable_priv.c b/bacula/src/findlib/enable_priv.c index 9d5be01200..a324cf89b7 100644 --- a/bacula/src/findlib/enable_priv.c +++ b/bacula/src/findlib/enable_priv.c @@ -41,3 +41,116 @@ int enable_backup_privileges(JCR *jcr, int ignore_errors) #endif + + + +/*=============================================================*/ +/* */ +/* * * * W i n 3 2 * * * * */ +/* */ +/*=============================================================*/ + +#if defined(HAVE_WIN32) + +void win_error(JCR *jcr, const char *prefix, DWORD lerror); + +static int +enable_priv(JCR *jcr, HANDLE hToken, const char *name, int ignore_errors) +{ + TOKEN_PRIVILEGES tkp; + DWORD lerror; + + if (!(p_LookupPrivilegeValue && p_AdjustTokenPrivileges)) { + return 0; /* not avail on this OS */ + } + + // Get the LUID for the security privilege. + if (!p_LookupPrivilegeValue(NULL, name, &tkp.Privileges[0].Luid)) { + win_error(jcr, "LookupPrivilegeValue", GetLastError()); + return 0; + } + + /* Set the security privilege for this process. */ + tkp.PrivilegeCount = 1; + tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + p_AdjustTokenPrivileges(hToken, FALSE, &tkp, sizeof(TOKEN_PRIVILEGES), NULL, NULL); + lerror = GetLastError(); + if (lerror != ERROR_SUCCESS) { + if (!ignore_errors) { + char buf[200]; + strcpy(buf, _("AdjustTokenPrivileges set ")); + bstrncat(buf, name, sizeof(buf)); + win_error(jcr, buf, lerror); + } + return 0; + } + return 1; +} + +/* + * Setup privileges we think we will need. We probably do not need + * the SE_SECURITY_NAME, but since nothing seems to be working, + * we get it hoping to fix the problems. + */ +int enable_backup_privileges(JCR *jcr, int ignore_errors) +{ + HANDLE hToken, hProcess; + int stat = 0; + + if (!p_OpenProcessToken) { + return 0; /* No avail on this OS */ + } + + hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId()); + + // Get a token for this process. + if (!p_OpenProcessToken(hProcess, + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { + if (!ignore_errors) { + win_error(jcr, "OpenProcessToken", GetLastError()); + } + /* Forge on anyway */ + } + + /* Return a bit map of permissions set. */ + if (enable_priv(jcr, hToken, SE_BACKUP_NAME, ignore_errors)) { + stat |= 1<<1; + } + if (enable_priv(jcr, hToken, SE_RESTORE_NAME, ignore_errors)) { + stat |= 1<<2; + } + if (enable_priv(jcr, hToken, SE_SECURITY_NAME, ignore_errors)) { + stat |= 1<<0; + } + if (enable_priv(jcr, hToken, SE_TAKE_OWNERSHIP_NAME, ignore_errors)) { + stat |= 1<<3; + } + if (enable_priv(jcr, hToken, SE_ASSIGNPRIMARYTOKEN_NAME, ignore_errors)) { + stat |= 1<<4; + } + if (enable_priv(jcr, hToken, SE_SYSTEM_ENVIRONMENT_NAME, ignore_errors)) { + stat |= 1<<5; + } + if (enable_priv(jcr, hToken, SE_CREATE_TOKEN_NAME, ignore_errors)) { + stat |= 1<<6; + } + if (enable_priv(jcr, hToken, SE_MACHINE_ACCOUNT_NAME, ignore_errors)) { + stat |= 1<<7; + } + if (enable_priv(jcr, hToken, SE_TCB_NAME, ignore_errors)) { + stat |= 1<<8; + } + if (enable_priv(jcr, hToken, SE_CREATE_PERMANENT_NAME, ignore_errors)) { + stat |= 1<<10; + } + + if (stat) { + stat |= 1<<9; + } + + CloseHandle(hToken); + CloseHandle(hProcess); + return stat; +} + +#endif /* HAVE_WIN32 */ diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index 573a37ea77..47d7812376 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -141,9 +141,20 @@ find_files(JCR *jcr, FF_PKT *ff, int file_save(JCR *jcr, FF_PKT *ff_pkt, bool to */ for (j=0; jopts_list.size(); j++) { findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j); + /* TODO options are "simply" reset by Options block that come next + * For example : + * Options { IgnoreCase = yes } + * ATTN: some plugins use AddOptions() that create extra Option block + * Also see accept_file() below that could suffer of the same problem + */ ff->flags |= fo->flags; - ff->Compress_algo = fo->Compress_algo; - ff->Compress_level = fo->Compress_level; + /* If the compress option was set in the previous block, overwrite the + * algorithm only if defined + */ + if ((ff->flags & FO_COMPRESS) && fo->Compress_algo != 0) { + ff->Compress_algo = fo->Compress_algo; + ff->Compress_level = fo->Compress_level; + } ff->strip_path = fo->strip_path; ff->fstypes = fo->fstype; ff->drivetypes = fo->drivetype; @@ -159,7 +170,7 @@ find_files(JCR *jcr, FF_PKT *ff, int file_save(JCR *jcr, FF_PKT *ff_pkt, bool to bstrncpy(ff->BaseJobOpts, fo->BaseJobOpts, sizeof(ff->BaseJobOpts)); } } - Dmsg4(50, "Verify=<%s> Accurate=<%s> BaseJob=<%s> flags=<%d>\n", + Dmsg4(50, "Verify=<%s> Accurate=<%s> BaseJob=<%s> flags=<%lld>\n", ff->VerifyOpts, ff->AccurateOpts, ff->BaseJobOpts, ff->flags); dlistString *node; foreach_dlist(node, &incexe->name_list) { diff --git a/bacula/src/findlib/find_one.c b/bacula/src/findlib/find_one.c index 051230281e..8e4beb9312 100644 --- a/bacula/src/findlib/find_one.c +++ b/bacula/src/findlib/find_one.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,7 +11,7 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. @@ -606,6 +606,30 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, * We have set st_rdev to 1 if it is a reparse point, otherwise 0, * if st_rdev is 2, it is a mount point */ +#if defined(HAVE_WIN32) + /* + * A reparse point (WIN32_REPARSE_POINT) + * is something special like one of the following: + * IO_REPARSE_TAG_DFS 0x8000000A + * IO_REPARSE_TAG_DFSR 0x80000012 + * IO_REPARSE_TAG_HSM 0xC0000004 + * IO_REPARSE_TAG_HSM2 0x80000006 + * IO_REPARSE_TAG_SIS 0x80000007 + * IO_REPARSE_TAG_SYMLINK 0xA000000C + * + * A junction point is a: + * IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 + * which can be either a link to a Volume (WIN32_MOUNT_POINT) + * or a link to a directory (WIN32_JUNCTION_POINT) + * + * Ignore WIN32_REPARSE_POINT and WIN32_JUNCTION_POINT + */ + if (ff_pkt->statp.st_rdev == WIN32_REPARSE_POINT) { + ff_pkt->type = FT_REPARSE; + } else if (ff_pkt->statp.st_rdev == WIN32_JUNCTION_POINT) { + ff_pkt->type = FT_JUNCTION; + } +#endif /* * Note, we return the directory to the calling program (handle_file) * when we first see the directory (FT_DIRBEGIN. @@ -645,6 +669,9 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, * file systems. */ bool is_win32_mount_point = false; +#if defined(HAVE_WIN32) + is_win32_mount_point = ff_pkt->statp.st_rdev == WIN32_MOUNT_POINT; +#endif if (!top_level && ff_pkt->flags & FO_NO_RECURSION) { ff_pkt->type = FT_NORECURSE; recurse = false; @@ -700,7 +727,7 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, * before traversing it. */ rtn_stat = 1; - entry = (struct dirent *)malloc(sizeof(struct dirent) + name_max + 1000); + entry = (struct dirent *)malloc(sizeof(struct dirent) + name_max + 100); for ( ; !job_canceled(jcr); ) { char *p, *q; int i; @@ -764,7 +791,7 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, * a block device, we do a raw backup of it or if it is * a fifo, we simply read it. */ -#if defined(HAVE_FREEBSD_OS) || defined(__FreeBSD_kernel__) +#ifdef HAVE_FREEBSD_OS /* * On FreeBSD, all block devices are character devices, so * to be able to read a raw disk, we need the check for diff --git a/bacula/src/findlib/fstype.c b/bacula/src/findlib/fstype.c index a61886c59f..9478463fb2 100644 --- a/bacula/src/findlib/fstype.c +++ b/bacula/src/findlib/fstype.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,7 +11,7 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. @@ -67,10 +67,9 @@ static int compare_mtab_items(void *item1, void *item2) return 0; } -#if defined(HAVE_LINUX_OS) -static void add_mtab_item(void *user_ctx, struct stat *st, const char *fstype, - const char *mountpoint, const char *mntopts, - const char *fsname) +void add_mtab_item(void *user_ctx, struct stat *st, const char *fstype, + const char *mountpoint, const char *mntopts, + const char *fsname) { rblist *mtab_list = (rblist *)user_ctx; mtab_item *item, *ritem; @@ -85,17 +84,7 @@ static void add_mtab_item(void *user_ctx, struct stat *st, const char *fstype, free(item); } } -#endif -/* Compare directly the FS from a fname with a string */ -bool fstype_cmp(FF_PKT *ff_pkt, const char *fsname) -{ - char buf[256]; - if (fstype(ff_pkt, buf, sizeof(buf))) { - return (strcmp(buf, fsname) == 0); - } - return false; -} /* * These functions should be implemented for each OS @@ -104,7 +93,6 @@ bool fstype_cmp(FF_PKT *ff_pkt, const char *fsname) */ #if defined(HAVE_DARWIN_OS) \ || defined(HAVE_FREEBSD_OS ) \ - || defined(HAVE_KFREEBSD_OS ) \ || defined(HAVE_OPENBSD_OS) #include @@ -192,7 +180,7 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) ff_pkt->last_fstype = st.f_type; bstrncpy(ff_pkt->last_fstypename, item->fstype, sizeof(ff_pkt->last_fstypename)); bstrncpy(fs, ff_pkt->last_fstypename, fslen); - return true; + return true; } /* * Values obtained from statfs(2), testing and @@ -274,7 +262,7 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) case 0x858458f6: fstype = "tmpfs"; break; /* RAMFS_MAGIC */ case 0x01021994: fstype = "tmpfs"; break; /* TMPFS_MAGIC */ #endif - + default: Dmsg2(10, "Unknown file system type \"0x%x\" for \"%s\".\n", st.f_type, fname); @@ -293,7 +281,6 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) #include #include -#include bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) { @@ -306,7 +293,8 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) /* Tru64 */ #include #include - +#include + bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) { char *fname = ff_pkt->fname; @@ -327,6 +315,35 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) } /* Tru64 */ +#elif defined (HAVE_WIN32) +/* Windows */ +bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) +{ + char *fname = ff_pkt->fname; + DWORD componentlength; + DWORD fsflags; + CHAR rootpath[4]; + UINT oldmode; + BOOL result; + + /* Copy Drive Letter, colon, and backslash to rootpath */ + bstrncpy(rootpath, fname, sizeof(rootpath)); + + /* We don't want any popups if there isn't any media in the drive */ + oldmode = SetErrorMode(SEM_FAILCRITICALERRORS); + result = GetVolumeInformation(rootpath, NULL, 0, NULL, &componentlength, &fsflags, fs, fslen); + SetErrorMode(oldmode); + + if (result) { + /* Windows returns NTFS, FAT, etc. Make it lowercase to be consistent with other OSes */ + lcase(fs); + } else { + Dmsg2(10, "GetVolumeInformation() failed for \"%s\", Error = %d.\n", rootpath, GetLastError()); + } + return result != 0; +} +/* Windows */ + #else /* No recognised OS */ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) @@ -340,41 +357,7 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) /* Read mtab entries */ bool read_mtab(mtab_handler_t *mtab_handler, void *user_ctx) { -/* Debian stretch GNU/KFreeBSD has both getmntinfo and getmntent, but - only the first seems to work, so ordering is important here */ -#ifdef HAVE_GETMNTINFO - struct stat st; -#if defined(ST_NOWAIT) - int flags = ST_NOWAIT; -#elif defined(MNT_NOWAIT) - int flags = MNT_NOWAIT; -#else - int flags = 0; -#endif -#if defined(HAVE_NETBSD_OS) - struct statvfs *mntinfo; -#else - struct statfs *mntinfo; -#endif - int nument; - - P(mutex); - if ((nument = getmntinfo(&mntinfo, flags)) > 0) { - while (nument-- > 0) { - if (is_rootfs(mntinfo->f_fstypename)) { - continue; - } - if (stat(mntinfo->f_mntonname, &st) < 0) { - continue; - } - mtab_handler(user_ctx, &st, mntinfo->f_mntfromname, - mntinfo->f_mntonname, mntinfo->f_fstypename, NULL); - mntinfo++; - } - } - V(mutex); -/* HAVE_GETMNTINFO */ -#elif defined(HAVE_GETMNTENT) +#ifdef HAVE_GETMNTENT FILE *mntfp; struct stat st; @@ -426,9 +409,42 @@ bool read_mtab(mtab_handler_t *mtab_handler, void *user_ctx) #endif #endif /* HAVE_GETMNTENT */ + +#ifdef HAVE_GETMNTINFO + struct stat st; +#if defined(ST_NOWAIT) + int flags = ST_NOWAIT; +#elif defined(MNT_NOWAIT) + int flags = MNT_NOWAIT; +#else + int flags = 0; +#endif +#if defined(HAVE_NETBSD_OS) + struct statvfs *mntinfo; +#else + struct statfs *mntinfo; +#endif + int nument; + + P(mutex); + if ((nument = getmntinfo(&mntinfo, flags)) > 0) { + while (nument-- > 0) { + if (is_rootfs(mntinfo->f_fstypename)) { + continue; + } + if (stat(mntinfo->f_mntonname, &st) < 0) { + continue; + } + mtab_handler(user_ctx, &st, mntinfo->f_mntfromname, + mntinfo->f_mntonname, mntinfo->f_fstypename, NULL); + mntinfo++; + } + } + V(mutex); +#endif /* HAVE_GETMNTINFO */ return true; } - + #ifdef TEST_PROGRAM int main(int argc, char **argv) { diff --git a/bacula/src/findlib/match.c b/bacula/src/findlib/match.c index a6cd72c6d1..b1214f3ebf 100644 --- a/bacula/src/findlib/match.c +++ b/bacula/src/findlib/match.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,7 +11,7 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. @@ -42,7 +42,11 @@ #endif /* Fold case in fnmatch() on Win32 */ +#ifdef HAVE_WIN32 +static const int fnmode = FNM_CASEFOLD; +#else static const int fnmode = 0; +#endif #undef bmalloc @@ -223,6 +227,14 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, const char *fname) break; } } +#if defined(HAVE_WIN32) + /* Convert any \'s into /'s */ + for (p=inc->fname; *p; p++) { + if (*p == '\\') { + *p = '/'; + } + } +#endif inc->next = NULL; /* Chain this one on the end of the list */ if (!ff->included_files_list) { @@ -262,6 +274,14 @@ void add_fname_to_exclude_list(FF_PKT *ff, const char *fname) exc->next = *list; exc->len = len; strcpy(exc->fname, fname); +#if defined(HAVE_WIN32) + /* Convert any \'s into /'s */ + for (char *p=exc->fname; *p; p++) { + if (*p == '\\') { + *p = '/'; + } + } +#endif *list = exc; } @@ -358,6 +378,16 @@ int file_is_excluded(FF_PKT *ff, const char *file) { const char *p; +#if defined(HAVE_WIN32) + /* + * ***NB*** this removes the drive from the exclude + * rule. Why????? + */ + if (file[1] == ':') { + file += 2; + } +#endif + if (file_in_excluded_list(ff->excluded_paths_list, file)) { return 1; } diff --git a/bacula/src/findlib/mkpath.c b/bacula/src/findlib/mkpath.c index 6b5cbffbbb..e1e19be289 100644 --- a/bacula/src/findlib/mkpath.c +++ b/bacula/src/findlib/mkpath.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,12 +11,11 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. */ - /* * Kern Sibbald, September MMVII * @@ -45,6 +44,8 @@ #define lchmod chmod #endif +/* Defined in attribs.c */ +void set_own_mod(ATTR *attr, char *path, uid_t owner, gid_t group, mode_t mode); typedef struct PrivateCurDir { hlink link; @@ -166,28 +167,6 @@ static bool makedir(JCR *jcr, char *path, mode_t mode, int *created) return true; } -/* - * Restore the owner and permissions (mode) of a Directory. - * See attribs.c for the equivalent for files. - */ -static void set_own_mod(ATTR *attr, char *path, uid_t owner, gid_t group, mode_t mode) -{ - if (lchown(path, owner, group) != 0 && attr->uid == 0 -#ifdef AFS - && errno != EPERM -#endif - ) { - berrno be; - Jmsg2(attr->jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"), - path, be.bstrerror()); - } - if (lchmod(path, mode) != 0 && attr->uid == 0) { - berrno be; - Jmsg2(attr->jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"), - path, be.bstrerror()); - } -} - /* * mode is the mode bits to use in creating a new directory * @@ -243,7 +222,32 @@ bool makepath(ATTR *attr, const char *apath, mode_t mode, mode_t parent_mode, */ tmode = 0777; +#if defined(HAVE_WIN32) + /* Validate drive letter */ + if (path[1] == ':') { + char drive[4] = "X:\\"; + + drive[0] = path[0]; + + UINT drive_type = GetDriveType(drive); + + if (drive_type == DRIVE_UNKNOWN || drive_type == DRIVE_NO_ROOT_DIR) { + Jmsg1(jcr, M_ERROR, 0, _("%c: is not a valid drive.\n"), path[0]); + goto bail_out; + } + + if (path[2] == '\0') { /* attempt to create a drive */ + ok = true; + goto bail_out; /* OK, it is already there */ + } + + p = &path[3]; + } else { + p = path; + } +#else p = path; +#endif /* Skip leading slash(es) */ while (IsPathSeparator(*p)) { @@ -276,7 +280,20 @@ bool makepath(ATTR *attr, const char *apath, mode_t mode, mode_t parent_mode, } /* Now set the proper owner and modes */ +#if defined(HAVE_WIN32) + + /* Don't propagate the hidden or encrypted attributes to parent directories */ + parent_mode &= ~S_ISVTX; + parent_mode &= ~S_ISGID; + + if (path[1] == ':') { + p = &path[3]; + } else { + p = path; + } +#else p = path; +#endif /* Skip leading slash(es) */ while (IsPathSeparator(*p)) { p++; diff --git a/bacula/src/findlib/namedpipe.c b/bacula/src/findlib/namedpipe.c new file mode 100644 index 0000000000..92b25589e5 --- /dev/null +++ b/bacula/src/findlib/namedpipe.c @@ -0,0 +1,338 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ + +#ifdef HAVE_WIN32 + +# include +# include +# include + +#else /* !HAVE_WIN32 */ + +# include +# include +# include +# include +# include + +#endif /* HAVE_WIN32 */ + +/* Common include */ +#include +#include +#include + +#include "namedpipe.h" + +#ifdef TEST_PROGRAM +# define Dmsg(level, ...) printf(__VA_ARGS__ ) +#endif + +#ifdef HAVE_WIN32 + +void namedpipe_init(NamedPipe *self) +{ + self->fd = INVALID_HANDLE_VALUE; + self->ifd = -1; +} + +void namedpipe_free(NamedPipe *self) +{ + if (self->fd != INVALID_HANDLE_VALUE) { + CloseHandle(self->fd); + self->fd = INVALID_HANDLE_VALUE; + self->ifd = -1; + } +} +#define BUFSIZE 8192 +int namedpipe_create(NamedPipe *self, const char *path, mode_t mode) +{ + /* On windows, */ + self->fd = CreateNamedPipeA( + path, // pipe name + PIPE_ACCESS_DUPLEX, // read/write access + PIPE_TYPE_MESSAGE | // message type pipe + PIPE_READMODE_MESSAGE | // message-read mode + PIPE_WAIT, // blocking mode + PIPE_UNLIMITED_INSTANCES, // max. instances + BUFSIZE, // output buffer size + BUFSIZE, // input buffer size + 0, // client time-out + NULL); // default security attribute + + if (self->fd == INVALID_HANDLE_VALUE) { + Dmsg(10, "CreateNamedPipe failed, ERR=%d.\n", (int)GetLastError()); + return -1; + } + + return 0; +} + +int namedpipe_open(NamedPipe *self, const char *path, mode_t mode) +{ + bool fConnected=false; + int retry = 30; + + if (self->fd != INVALID_HANDLE_VALUE) { /* server mode */ + + fConnected = ConnectNamedPipe(self->fd, NULL) ? + TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); + + } else { /* client mode */ + + /* Need to wait for creation */ + while (retry-- > 0) + { + self->fd = CreateFileA( + path, // pipe name + GENERIC_WRITE | GENERIC_READ, + 0, // no sharing + NULL, // default security attributes + OPEN_EXISTING, // opens existing pipe + 0, // default attributes + NULL); // no template file + + // Break if the pipe handle is valid. + if (self->fd != INVALID_HANDLE_VALUE) { + break; + } + + /* Wait a little bit for the other side to create the fifo */ + if (GetLastError() == ERROR_FILE_NOT_FOUND) { + Dmsg(10, "File not found, ERR=%d.\n", (int)GetLastError()); + Sleep(20000); + continue; + } + + // Exit if an error other than ERROR_PIPE_BUSY occurs. + if (GetLastError() != ERROR_PIPE_BUSY) { + Dmsg(10, "CreateFile failed, ERR=%d.\n", + (int)GetLastError()); + return -1; + } + + // All pipe instances are busy, so wait for 20 seconds. + if (!WaitNamedPipeA(path, 20000)) { + Dmsg(10, "WaitNamedPipe failed, ERR=%d.\n", + (int)GetLastError()); + return -1; + } + } + } + + DWORD dwMode = PIPE_READMODE_MESSAGE; + + fConnected = SetNamedPipeHandleState( + self->fd, // pipe handle + &dwMode, // new pipe mode + NULL, // don't set maximum bytes + NULL); // don't set maximum time + + if (!fConnected) { + Dmsg(10, "SetNamedPipeHandleState failed, ERR=%d.\n", + (int)GetLastError()); + } + + if (fConnected) { + int m = 0; + if (mode & O_WRONLY || mode & O_APPEND) { + m |= O_APPEND; + + } else if (mode & O_RDONLY) { + m |= O_RDONLY; + } + self->ifd = _open_osfhandle((intptr_t)self->fd, m); + } + + return self->ifd; +} + + +#else /* !HAVE_WIN32 */ + +void namedpipe_init(NamedPipe *self) +{ + self->fd = -1; + self->ifd = -1; + self->name = NULL; +} + +void namedpipe_free(NamedPipe *self) +{ + if (self->fd != -1) { + close(self->fd); + self->fd = -1; + self->ifd = -1; + } + if (self->name) { + unlink(self->name); + free(self->name); + self->name = NULL; + } +} + +int namedpipe_create(NamedPipe *self, const char *path, mode_t mode) +{ + self->name = (char *)malloc(strlen(path) + 1); + strcpy(self->name, path); + + if (mkfifo(path, mode) < 0 && errno != EEXIST) { + return -1; + } + + return 0; +} + +int namedpipe_open(NamedPipe *self, const char *path, mode_t mode) +{ + self->ifd = self->fd = open(path, mode); + return self->fd; +} + +#endif /* HAVE_WIN32 */ + +#ifdef TEST_PROGRAM + +#include +#include + +#define BUF "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + +int main(int argc, char **argv) +{ + FILE *fp; + NamedPipe p; + char buf[65*1024], file[128]; + int fd; + int mode; + int n, m, o; + if (argc < 4) { + printf("Usage: %s client|server pipe file\n", argv[0]); + exit(3); + } + + namedpipe_init(&p); + + if (strcmp(argv[1], "server") == 0) { + mode = O_WRONLY; + if (namedpipe_create(&p, argv[2], 0600) < 0) { + exit(2); + } + + } else { + mode = O_RDONLY; + } + + printf("Trying to open %s mode=%d\n", argv[2], mode); + fd = namedpipe_open(&p, argv[2], mode); + + if (fd < 0) { + printf("Unable to open pipe\n"); + exit(1); + } + + if (strcmp(argv[1], "server") == 0) { + if (write(fd, BUF, strlen(BUF)+1) != strlen(BUF)+1) { + printf("Unable to write data\n"); + exit(4); + } + + if (write(fd, BUF, strlen(BUF)+1) != strlen(BUF)+1) { + printf("Unable to write data\n"); + exit(4); + } + + fp = fopen(argv[3], "rb"); + if (!fp) { + printf("Unable to open %s for reading\n", argv[3]); + exit(4); + } + + fseek(fp, 0, SEEK_END); + m = ftell(fp); + fseek(fp, 0, SEEK_SET); + + snprintf(buf, sizeof(buf), "%.10d\n", m); + write(fd, buf, strlen(buf)+1); + + while (m > 0 && !feof(fp)) { + n = fread(buf, 1, sizeof(buf), fp); + Dmsg(000, "read %d from file\n", n); + if (write(fd, buf, n) != n) { + printf("Unable to write data from file\n"); + exit(5); + } + m -= n; + } + Dmsg(000, "EOF found\n"); + fclose(fp); + + } else { + if ((n = read(fd, buf, sizeof(buf))) != strlen(BUF)+1) { + Dmsg(000, "read failed (%d != %d), ERR=%d.\n", n, + (int)strlen(BUF)+1, errno); + exit(4); + } + if (read(fd, buf, sizeof(buf)) != strlen(BUF)+1) { + Dmsg(000, "read failed, ERR=%d.\n", errno); + exit(4); + } + + printf("buf=[%s]\n", buf); + + snprintf(file, sizeof(file), "%s.out", argv[3]); + fp = fopen(file, "wb"); + if (!fp) { + printf("Unable to open %s for writing\n", buf); + exit(4); + } + + if ((n = read(fd, buf, sizeof(buf))) != 12) { + Dmsg(000, "read failed (%d != %d), ERR=%d.\n", n, 12, errno); + exit(4); + } + + m = atoi(buf); + Dmsg(000, "will read %d from fifo\n", m); + + while (m > 0) { + n = read(fd, buf, sizeof(buf)); + Dmsg(000, "Got %d bytes\n", n); + if ((o = fwrite(buf, n, 1, fp)) != 1) { + Dmsg(000, "write to file failed (%d != %d) ERR=%d.\n", o, n, errno); + exit(4); + } + m -= n; + } + fclose(fp); + } + + namedpipe_free(&p); + + exit(0); +} +#endif diff --git a/bacula/src/findlib/namedpipe.h b/bacula/src/findlib/namedpipe.h new file mode 100644 index 0000000000..7e6757a3d7 --- /dev/null +++ b/bacula/src/findlib/namedpipe.h @@ -0,0 +1,48 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + Basic abstraction for named pipe between windows and linux + */ + +#ifndef NAMEDPIPE_H +#define NAMEDPIPE_H + +#ifdef HAVE_WIN32 +#include +#endif + +#include + +typedef struct { +#ifdef HAVE_WIN32 + HANDLE fd; +#else + char *name; + int fd; +#endif + int ifd; +} NamedPipe; + + +void namedpipe_init(NamedPipe *self); +void namedpipe_free(NamedPipe *self); +int namedpipe_create(NamedPipe *self, const char *path, mode_t mode); +int namedpipe_open(NamedPipe *self, const char *path, mode_t mode); + +#endif diff --git a/bacula/src/findlib/protos.h b/bacula/src/findlib/protos.h index b6b8acff82..90eb6da75a 100644 --- a/bacula/src/findlib/protos.h +++ b/bacula/src/findlib/protos.h @@ -82,7 +82,7 @@ bool path_list_add(JCR *jcr, uint32_t len, char *fname); /* from fstype.c */ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen); -bool fstype_cmp(FF_PKT *ff_pkt, const char *fstype_name); +bool fstype_equals(const char *fname, const char *fstype_name); /* from drivetype.c */ bool drivetype(const char *fname, char *fs, int fslen); diff --git a/bacula/src/findlib/win32filter.c b/bacula/src/findlib/win32filter.c index f6533f3c6c..1766bc8954 100644 --- a/bacula/src/findlib/win32filter.c +++ b/bacula/src/findlib/win32filter.c @@ -36,6 +36,7 @@ bool Win32Filter::have_data(char **raw, int64_t *raw_len, int64_t *use_len) { int64_t size; char *orig=*raw; + initialized = true; Dmsg1(100, "have_data(%lld)\n", *raw_len); while (*raw_len > 0) { /* In this rec, we could have multiple streams of data and headers diff --git a/bacula/src/findlib/win32filter.h b/bacula/src/findlib/win32filter.h index 048ce9406a..d65f073d6f 100644 --- a/bacula/src/findlib/win32filter.h +++ b/bacula/src/findlib/win32filter.h @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,21 +11,37 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. */ -#ifndef WIN32FILTER_H -#define WIN32FILTER_H +/* Pulled from other files by Alain Spineux */ + +#ifndef WIN32FILTER_H_ +#define WIN32FILTER_H_ #include "bacula.h" -#include "bfile.h" /* for BWIN32_STREAM_ID */ + +/* this should physically correspond to WIN32_STREAM_ID + * from winbase.h on Win32. We didn't inlcude cStreamName + * as we don't use it and don't need it for a correct struct size. + */ + +#define WIN32_BACKUP_DATA 1 + +typedef struct _BWIN32_STREAM_ID { + int32_t dwStreamId; + int32_t dwStreamAttributes; + int64_t Size; + int32_t dwStreamNameSize; +} BWIN32_STREAM_ID, *LPBWIN32_STREAM_ID ; class Win32Filter { public: + bool initialized; int64_t skip_size; /* how many bytes we have to skip before next header */ int64_t data_size; /* how many data are expected in the stream */ int header_pos; /* the part of the header that was filled in by previous record */ @@ -37,6 +53,7 @@ public: }; void init() { + initialized = false; skip_size = 0; data_size = 0; header_pos = 0; @@ -48,6 +65,9 @@ public: data_size = f->data_size; header_pos = f->header_pos; header = f->header; + initialized = (skip_size != 0 || + data_size != 0 || + header_pos != 0); }; /* If the stream is HHHDDDDD, you can call have_data("HHHDDDDD", 8, ) diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 231de35950..405632676a 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -379,6 +379,7 @@ public: POOLMEM *wstore_source; /* Where write storage came from */ POOLMEM *catalog_source; /* Where catalog came from */ POOLMEM *next_vol_list; /* Volumes previously requested */ + rblist *bsr_list; /* Bootstrap that can be needed during restore */ int32_t replace; /* Replace option */ int32_t NumVols; /* Number of Volume used in pool */ int32_t reschedule_count; /* Number of times rescheduled */ diff --git a/bacula/src/lib/bnet.c b/bacula/src/lib/bnet.c index be59e422a2..584388d165 100644 --- a/bacula/src/lib/bnet.c +++ b/bacula/src/lib/bnet.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,7 +11,7 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. @@ -527,33 +527,64 @@ const char *bnet_sig_to_ascii(int32_t msglen) static char buf[30]; switch (msglen) { case BNET_EOD: - return "BNET_EOD"; /* end of data stream */ + return "BNET_EOD"; /* End of data stream, new data may follow */ case BNET_EOD_POLL: - return "BNET_EOD_POLL"; + return "BNET_EOD_POLL"; /* End of data and poll all in one */ case BNET_STATUS: - return "BNET_STATUS"; + return "BNET_STATUS"; /* Send full status */ case BNET_TERMINATE: - return "BNET_TERMINATE"; /* terminate connection */ + return "BNET_TERMINATE"; /* Conversation terminated, doing close() */ case BNET_POLL: - return "BNET_POLL"; + return "BNET_POLL"; /* Poll request, I'm hanging on a read */ case BNET_HEARTBEAT: - return "BNET_HEARTBEAT"; + return "BNET_HEARTBEAT"; /* Heartbeat Response requested */ case BNET_HB_RESPONSE: - return "BNET_HB_RESPONSE"; - case BNET_SUB_PROMPT: - return "BNET_SUB_PROMPT"; - case BNET_TEXT_INPUT: - return "BNET_TEXT_INPUT"; - case BNET_FDCALLED: - return "BNET_FDCALLED"; + return "BNET_HB_RESPONSE"; /* Only response permited to HB */ + case BNET_BTIME: + return "BNET_BTIME"; /* Send UTC btime */ + case BNET_BREAK: + return "BNET_BREAK"; /* Stop current command -- ctl-c */ + case BNET_START_SELECT: + return "BNET_START_SELECT"; /* Start of a selection list */ + case BNET_END_SELECT: + return "BNET_END_SELECT"; /* End of a select list */ + case BNET_INVALID_CMD: + return "BNET_INVALID_CMD"; /* Invalid command sent */ + case BNET_CMD_FAILED: + return "BNET_CMD_FAILED"; /* Command failed */ case BNET_CMD_OK: - return "BNET_CMD_OK"; + return "BNET_CMD_OK"; /* Command succeeded */ case BNET_CMD_BEGIN: - return "BNET_CMD_BEGIN"; + return "BNET_CMD_BEGIN"; /* Start command execution */ + case BNET_MSGS_PENDING: + return "BNET_MSGS_PENDING"; /* Messages pending */ case BNET_MAIN_PROMPT: - return "BNET_MAIN_PROMPT"; + return "BNET_MAIN_PROMPT"; /* Server ready and waiting */ + case BNET_SELECT_INPUT: + return "BNET_SELECT_INPUT"; /* Return selection input */ + case BNET_WARNING_MSG: + return "BNET_WARNING_MSG"; /* Warning message */ case BNET_ERROR_MSG: - return "BNET_ERROR_MSG"; + return "BNET_ERROR_MSG"; /* Error message -- command failed */ + case BNET_INFO_MSG: + return "BNET_INFO_MSG"; /* Info message -- status line */ + case BNET_RUN_CMD: + return "BNET_RUN_CMD"; /* Run command follows */ + case BNET_YESNO: + return "BNET_YESNO"; /* Request yes no response */ + case BNET_START_RTREE: + return "BNET_START_RTREE"; /* Start restore tree mode */ + case BNET_END_RTREE: + return "BNET_END_RTREE"; /* End restore tree mode */ + case BNET_SUB_PROMPT: + return "BNET_SUB_PROMPT"; /* Indicate we are at a subprompt */ + case BNET_TEXT_INPUT: + return "BNET_TEXT_INPUT"; /* Get text input from user */ + case BNET_EXT_TERMINATE: + return "BNET_EXT_TERMINATE"; /* A Terminate condition has been met and + already reported somewhere else */ + case BNET_FDCALLED : + return "BNET_FDCALLED"; /* The FD should keep the connection for a new job */ default: bsnprintf(buf, sizeof(buf), _("Unknown sig %d"), (int)msglen); return buf; @@ -637,14 +668,12 @@ int set_socket_errno(int sockstat) /* Handle errrors from prior connections as EAGAIN */ switch (errno) { case ENETDOWN: -#ifdef EPROTO case EPROTO: -#endif + case ENOPROTOOPT: + case EHOSTDOWN: #ifdef ENONET case ENONET: #endif - case ENOPROTOOPT: - case EHOSTDOWN: case EHOSTUNREACH: case EOPNOTSUPP: case ENETUNREACH: diff --git a/bacula/src/lib/bpipe.c b/bacula/src/lib/bpipe.c index b28068522f..95e9f471fa 100644 --- a/bacula/src/lib/bpipe.c +++ b/bacula/src/lib/bpipe.c @@ -26,7 +26,12 @@ #include "bacula.h" #include "jcr.h" +#ifdef HAVE_GETRLIMIT #include +#else +/* If not available, use a wrapper that will not use it */ +#define getrlimit(a,b) -1 +#endif int execvp_errors[] = { EACCES, diff --git a/bacula/src/lib/bsock.c b/bacula/src/lib/bsock.c index d2a521b0cd..42393153c2 100644 --- a/bacula/src/lib/bsock.c +++ b/bacula/src/lib/bsock.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -35,10 +35,22 @@ #if !defined(SOL_TCP) /* Not defined on some systems */ #define SOL_TCP IPPROTO_TCP #endif - + +#ifdef HAVE_WIN32 +#include +#define socketRead(fd, buf, len) ::recv(fd, buf, len, 0) +#define socketWrite(fd, buf, len) ::send(fd, buf, len, 0) +#define socketClose(fd) ::closesocket(fd) +static void win_close_wait(int fd); +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 0 +#endif +#else #define socketRead(fd, buf, len) ::read(fd, buf, len) #define socketWrite(fd, buf, len) ::write(fd, buf, len) #define socketClose(fd) ::close(fd) +#endif + /* * make a nice dump of a message @@ -1117,6 +1129,7 @@ bool BSOCK::set_buffer_size(uint32_t size, int rw) */ int BSOCK::set_nonblocking() { +#ifndef HAVE_WIN32 int oflags; /* Get current flags */ @@ -1133,6 +1146,16 @@ int BSOCK::set_nonblocking() m_blocking = 0; return oflags; +#else + int flags; + u_long ioctlArg = 1; + + flags = m_blocking; + ioctlsocket(m_fd, FIONBIO, &ioctlArg); + m_blocking = 0; + + return flags; +#endif } /* @@ -1141,6 +1164,7 @@ int BSOCK::set_nonblocking() */ int BSOCK::set_blocking() { +#ifndef HAVE_WIN32 int oflags; /* Get current flags */ if ((oflags = fcntl(m_fd, F_GETFL, 0)) < 0) { @@ -1156,6 +1180,16 @@ int BSOCK::set_blocking() m_blocking = 1; return oflags; +#else + int flags; + u_long ioctlArg = 0; + + flags = m_blocking; + ioctlsocket(m_fd, FIONBIO, &ioctlArg); + m_blocking = 1; + + return flags; +#endif } void BSOCK::set_killable(bool killable) @@ -1170,12 +1204,19 @@ void BSOCK::set_killable(bool killable) */ void BSOCK::restore_blocking (int flags) { +#ifndef HAVE_WIN32 if ((fcntl(m_fd, F_SETFL, flags)) < 0) { berrno be; Qmsg1(get_jcr(), M_ABORT, 0, _("fcntl F_SETFL error. ERR=%s\n"), be.bstrerror()); } m_blocking = (flags & O_NONBLOCK) ? true : false; +#else + u_long ioctlArg = flags; + + ioctlsocket(m_fd, FIONBIO, &ioctlArg); + m_blocking = 1; +#endif } /* @@ -1287,9 +1328,15 @@ void BSOCK::close() bsock->tls = NULL; } +#ifdef HAVE_WIN32 + if (!bsock->is_timed_out()) { + win_close_wait(bsock->m_fd); /* Ensure that data is not discarded */ + } +#else if (bsock->is_timed_out()) { shutdown(bsock->m_fd, SHUT_RDWR); /* discard any pending I/O */ } +#endif /* On Windows this discards data if we did not do a close_wait() */ socketClose(bsock->m_fd); /* normal close */ } @@ -1494,3 +1541,25 @@ void BSOCK::control_bwlimit(int bytes) m_last_tick = now; } } + +#ifdef HAVE_WIN32 +/* + * closesocket is supposed to do a graceful disconnect under Window + * but it doesn't. Comments on http://msdn.microsoft.com/en-us/li + * confirm this behaviour. DisconnectEx is required instead, but + * that function needs to be retrieved via WS IOCTL + */ +static void +win_close_wait(int fd) +{ + int ret; + GUID disconnectex_guid = WSAID_DISCONNECTEX; + DWORD bytes_returned; + LPFN_DISCONNECTEX DisconnectEx; + ret = WSAIoctl(fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &disconnectex_guid, sizeof(disconnectex_guid), &DisconnectEx, sizeof(DisconnectEx), &bytes_returned, NULL, NULL); + Dmsg1(100, "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, WSAID_DISCONNECTEX) ret = %d\n", ret); + if (!ret) { + DisconnectEx(fd, NULL, 0, 0); + } +} +#endif diff --git a/bacula/src/lib/bsys.c b/bacula/src/lib/bsys.c index 916357493b..4a4569ad53 100644 --- a/bacula/src/lib/bsys.c +++ b/bacula/src/lib/bsys.c @@ -1029,15 +1029,7 @@ void stack_trace() {} int fs_get_free_space(const char *path, int64_t *freeval, int64_t *totalval) { - -/* For Windows must have statvfs */ -#if defined(HAVE_WIN32) - #if !defined(HAVE_SYS_STATVFS_H) - *totalval = *freeval = 0; - return -1; - #endif -#endif - +#ifndef HAVE_WIN32 struct statvfs st; if (statvfs(path, &st) == 0) { @@ -1045,6 +1037,7 @@ int fs_get_free_space(const char *path, int64_t *freeval, int64_t *totalval) *totalval = (uint64_t)st.f_blocks * (uint64_t)st.f_frsize; return 0; } +#endif *totalval = *freeval = 0; return -1; diff --git a/bacula/src/lib/htable.c b/bacula/src/lib/htable.c index 8f4624a672..9fe280f2b8 100644 --- a/bacula/src/lib/htable.c +++ b/bacula/src/lib/htable.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -215,7 +215,9 @@ void htable::stats() printf("buckets=%d num_items=%d max_items=%d\n", buckets, num_items, max_items); printf("max hits in a bucket = %d\n", max); #ifdef BIG_MALLOC - printf("total bytes malloced = %lld\n", (lli)total_size); + char ed1[100]; + edit_uint64(total_size, ed1); + printf("total bytes malloced = %s\n", ed1); printf("total blocks malloced = %d\n", blocks); #endif } diff --git a/bacula/src/lib/openssl.c b/bacula/src/lib/openssl.c index 23ac946cfa..558868b520 100644 --- a/bacula/src/lib/openssl.c +++ b/bacula/src/lib/openssl.c @@ -85,6 +85,9 @@ struct CRYPTO_dynlock_value { */ static unsigned long get_openssl_thread_id(void) { +#ifdef HAVE_WIN32 + return (unsigned long)GetCurrentThreadId(); +#else /* * Comparison without use of pthread_equal() is mandated by the OpenSSL API * @@ -92,6 +95,7 @@ static unsigned long get_openssl_thread_id(void) * emulation code, which defines pthread_t as a structure. */ return ((unsigned long)pthread_self()); +#endif } /* diff --git a/bacula/src/lib/scan.c b/bacula/src/lib/scan.c index 3eafcd9bf5..77fb50c86a 100644 --- a/bacula/src/lib/scan.c +++ b/bacula/src/lib/scan.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2017 Kern Sibbald + Copyright (C) 2000-2018 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -11,7 +11,7 @@ Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. - This notice must be preserved when any source code is + This notice must be preserved when any source code is conveyed and/or propagated. Bacula(R) is a registered trademark of Kern Sibbald. @@ -492,6 +492,58 @@ switch_top: return count; } +/* + * Return next name from a comma separated list. Note, this + * routine is destructive because it stored 0 at the end + * of each argument. + * Called with pointer to pointer to command line. This + * pointer is updated to point to the remainder of the + * command line. + * + * Returns pointer to next name -- don't store the result + * in the pointer you passed as an argument ... + * The next argument is terminated by a , unless within + * quotes. Double quote characters (unless preceded by a \) are + * stripped. + * + */ +char *next_name(char **s) +{ + char *p, *q, *n; + bool in_quote = false; + + if (s == NULL || *s == NULL || **s == '\0') { + return NULL; + } + p = *s; + Dmsg1(900, "Next name=%s\n", p); + for (n = q = p; *p ; ) { + if (*p == '\\') { /* slash? */ + p++; /* yes, skip it */ + if (*p) { + *q++ = *p++; + } else { + *q++ = *p; + } + continue; + } + if (*p == '"') { /* start or end of quote */ + p++; + in_quote = !in_quote; /* change state */ + continue; + } + if (!in_quote && *p == ',') { /* end of field */ + p++; + break; + } + *q++ = *p++; + } + *q = 0; + *s = p; + Dmsg2(900, "End arg=%s next=%s\n", n, p); + return n; +} + #ifdef TEST_PROGRAM int main(int argc, char *argv[]) { diff --git a/bacula/src/qt-console/make-win32 b/bacula/src/qt-console/make-win32 index 9ee9a3dd86..d064ba9400 100755 --- a/bacula/src/qt-console/make-win32 +++ b/bacula/src/qt-console/make-win32 @@ -2,6 +2,10 @@ # # Used to build the Win32/Win64 version of bat # +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# prepare_bat_build () { @@ -70,4 +74,4 @@ if test -e ../config.h.orig ; then mv -f ../config.h.orig ../config.h fi -prepare_tray_monitor_build ${BUILD_ARCH:-64} +#prepare_tray_monitor_build ${BUILD_ARCH:-64} diff --git a/bacula/src/stored/dde_cmd.c b/bacula/src/stored/dde_cmd.c new file mode 100644 index 0000000000..6c473fdec5 --- /dev/null +++ b/bacula/src/stored/dde_cmd.c @@ -0,0 +1,45 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ + +#include "bacula.h" +#include "stored.h" + + +bool dde_is_unavailable(JCR *jcr) +{ + BSOCK *dir = jcr->dir_bsock; + dir->fsend("3900 DDE is unavailable\n"); + dir->signal(BNET_EOD); + return true; +} + +bool dedupscrub_cmd(JCR *jcr) +{ + return dde_is_unavailable(jcr); +} + +bool dedupsetvar_cmd(JCR *jcr) +{ + return dde_is_unavailable(jcr); +} + +bool deduptuneidxmem_cmd(JCR *jcr) +{ + return dde_is_unavailable(jcr); +} diff --git a/bacula/src/stored/stored.h b/bacula/src/stored/stored.h index 682ce58b0a..abb2f8db1f 100644 --- a/bacula/src/stored/stored.h +++ b/bacula/src/stored/stored.h @@ -92,6 +92,8 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); #include "vtape_dev.h" #include "cloud_dev.h" #include "aligned_dev.h" +#include "win_file_dev.h" +#include "win_tape_dev.h" #include "sd_plugins.h" /* Daemon globals from stored.c */ diff --git a/bacula/src/stored/win_file_dev.h b/bacula/src/stored/win_file_dev.h new file mode 100644 index 0000000000..2cb1f2df7c --- /dev/null +++ b/bacula/src/stored/win_file_dev.h @@ -0,0 +1,31 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Inspired by vtape.h + */ +#ifndef __WIN_FILE_DEV_H_ +#define __WIN_FILE_DEV_H_ + +class win_file_dev : public file_dev { +public: + + win_file_dev() { }; + ~win_file_dev() { m_fd = -1; }; +}; +#endif diff --git a/bacula/src/stored/win_tape_dev.h b/bacula/src/stored/win_tape_dev.h new file mode 100644 index 0000000000..89b5ff16f8 --- /dev/null +++ b/bacula/src/stored/win_tape_dev.h @@ -0,0 +1,48 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Inspired by vtape.h + */ +#ifndef __WIN_TAPE_DEV_H_ +#define __WIN_TAPE_DEV_H_ + +class win_tape_dev : public DEVICE { +public: + + win_tape_dev() { }; + ~win_tape_dev() { }; + + /* interface from DEVICE */ + int d_close(int); + int d_open(const char *pathname, int flags); + int d_ioctl(int fd, ioctl_req_t request, char *op=NULL); + ssize_t d_read(int, void *buffer, size_t count); + ssize_t d_write(int, const void *buffer, size_t count); + + boffset_t lseek(DCR *dcr, off_t offset, int whence) { return -1; }; + boffset_t lseek(int fd, off_t offset, int whence); + bool open_device(DCR *dcr, int omode); + + int tape_op(struct mtop *mt_com); + int tape_get(struct mtget *mt_com); + int tape_pos(struct mtpos *mt_com); + +}; + +#endif /* __WIN_TAPE_DEV_H_ */ diff --git a/bacula/src/version.h b/bacula/src/version.h index df709b725e..5ca1bb7a87 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -11,7 +11,7 @@ #define RELEASE 1 /* Use ONLY in rpms */ -#define PROG_COPYRIGHT "Copyright (C) %d-2019 Kern Sibbald.\n" +#define PROG_COPYRIGHT "Copyright (C) %d-2018 Kern Sibbald.\n" #define BYEAR "2018" /* year for copyright messages in progs */ /* @@ -139,6 +139,8 @@ /* #define DEBUG_MUTEX 1 */ /* #define DEBUG_BLOCK_CHECKSUM 1 */ +#define BDEMO "" + /* * Set SMALLOC_SANITY_CHECK to zero to turn off, otherwise * it is the maximum memory malloced before Bacula will diff --git a/bacula/src/win32/External-mingw-w64 b/bacula/src/win32/External-mingw-w64 new file mode 100644 index 0000000000..c16b98b4fe --- /dev/null +++ b/bacula/src/win32/External-mingw-w64 @@ -0,0 +1,74 @@ +# +# This file provides information about the External dependencies required by +# Bacula. +# +# There are four fields delimited by |. Only the first two fields are +# required. The other two are used when the top level directory of the +# archive is not the same as the file name with any suffixes removed. +# +# Field 1 is the name of the dependency. It is used to define the +# name of the three variables which are assigned the values of fields 2 to 4. +# +# Field 2 is the URL of the archive. It is assigned to the variable +# URL_[field1]. +# +# Field 3 is the top directory of the archive or the name of a directory that +# must be created and the archive extracted into it. It is assigned to the +# variable DIR_[field1]. +# +# Field 4 indicates if the directory specified in field 3 must be created +# first and the archive extracted into it. It is assigned to the variable +# MKD_[field1] +# +CMD_UTILS|https://www.bacula.org/downloads/depkgs-mingw32/cmd-utils-0.1.tar.gz +MT|http://old.bacula.org/downloads/depkgs-mingw32/mt-st-0.9b.tar.gz +MTX|http://www.bacula.org/downloads/depkgs-mingw32/mtx-1.3.9.tar.gz +SCONS|http://www.bacula.org/downloads/depkgs-mingw32/scons-0.96.92.tar.gz +SED|https://www.bacula.org/downloads/depkgs-mingw32/sed-4.2k.tar.gz +LZO|https://www.bacula.org/downloads/depkgs-mingw32/lzo-2.10.tar.gz +ZLIB|https://www.bacula.org/downloads/depkgs-mingw32/zlib-1.2.8.tar.gz +RSYNC|https://www.bacula.org/downloads/depkgs-mingw32/librsync-0.9.7b.tar.gz +OPENSSL|https://www.bacula.org/downloads/depkgs-mingw32/openssl-1.0.2k.tar.gz +PCRE|https://www.bacula.org/downloads/depkgs-mingw32/pcre-6.3.tar.bz2 +PTHREADS|https://www.bacula.org/downloads/depkgs-mingw32/pthreads-w32-2-9-1-release.tar.gz +Qt4|https://www.bacula.org/downloads/depkgs-mingw32/qt-everywhere-opensource-src-4.8.4.tar.gz +MSSQL|https://www.bacula.org/downloads/depkgs-mingw32/depkgs-mssql-08Jun17.tar.gz + +#POSTGRESQL|http://www.bacula.org/depkgs-mingw32/postgresql-base-8.1.4.tar.bz2|postgresql-8.1.4 +#DVD_RW_TOOLS|http://www.bacula.org/depkgs-mingw32/dvd+rw-tools-7.0.tar.gz +#MKISOFS|http://www.bacula.org/depkgs-mingw32/mkisofs.exe +#MYSQL|http://www.bacula.org/depkgs-mingw32/mysql-noinstall-5.0.27-win32.zip|mysql-5.0.27-win32 +#NSIS_BIN|http://www.bacula.org/depkgs-mingw32/nsis-2.17.zip +#NSIS_SRC|http://www.bacula.org/depkgs-mingw32/nsis-2.17-src.tar.bz2 +#SCONS|http://www.bacula.org/depkgs-mingw32/scons-0.96.92.tar.gz +#SQLITE|http://www.bacula.org/depkgs-mingw32/sqlite-3.3.17.tar.gz +#STAB2CV|http://www.bacula.org/depkgs-mingw32/stab2cv-0.1.tar.bz2 +#WX|http://www.bacula.org/depkgs-mingw32/wxWidgets-2.8.7.tar.gz +#DB|http://www.bacula.org/depkgs-mingw32/db-4.7.25.tar.gz +# +# +# Original file locations +# +# CDRTOOLS|ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-2.01.01a22.tar.bz2 +# CMD_UTILS|http://superb-west.dl.sourceforge.net/sourceforge/cmd-utils/cmd-utils-0.1.tar.gz +# DVD_RW_TOOLS|http://fy.chalmers.se/~appro/linux/DVD+RW/tools/dvd+rw-tools-7.0.tar.gz +# MKISOFS|http://fy.chalmers.se/~appro/linux/DVD+RW/tools/win32/mkisofs.exe +# MT|http://www.ibiblio.org/pub/linux/system/backup/mt-st-0.9b.tar.gz +# MTX|http://superb-west.dl.sourceforge.net/sourceforge/mtx/mtx-1.3.9.tar.gz +# MYSQL|http://mirror.x10.com/mirror/mysql/Downloads/MySQL-5.0/mysql-noinstall-5.0.27-win32.zip|mysql-5.0.27-win32 +# NSIS_BIN|http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17.zip +# NSIS_SRC|http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17-src.tar.bz2 +# OPENSSL|http://www.openssl.org/source/openssl-0.9.8b.tar.gz +# PCRE|http://superb-west.dl.sourceforge.net/sourceforge/pcre/pcre-6.3.tar.bz2 +# POSTGRESQL|ftp://ftp2.us.postgresql.org/postgresql/source/v8.1.4/postgresql-base-8.1.4.tar.bz2|postgresql-8.1.4 +# PTHREADS|ftp://sources.redhat.com/pub/pthreads-win32/pthreads-snap-2004-06-22.tar.gz +# Qt4|ftp://ftp.trolltech.com/qt/source/qt-win-opensource-src-4.3.0.zip +# SCONS|http://superb-west.dl.sourceforge.net/sourceforge/scons/scons-0.96.92.tar.gz +# SED|ftp://mirrors.kernel.org/gnu/sed/sed-4.1.5.tar.gz +# SQLITE|http://www.sqlite.org/sqlite-3.3.8.tar.gz +# SQLITE|http://www.sqlite.org/sqlite-3.3.17.tar.gz +# STAB2CV|http://superb-west.dl.sourceforge.net/sourceforge/stab2cv/stab2cv-0.1.tar.bz2 +# WX|http://superb-west.dl.sourceforge.net/sourceforge/wxwindows/wxWidgets-2.7.0.tar.gz +# ZLIB|http://www.zlib.net/zlib-1.2.3.tar.gz +# DB|http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz +# LZO|http://www.oberhumer.com/opensource/lzo/download/lzo-2.05.tar.gz diff --git a/bacula/src/win32/External-mingw32 b/bacula/src/win32/External-mingw32 new file mode 100644 index 0000000000..ff6f55f53c --- /dev/null +++ b/bacula/src/win32/External-mingw32 @@ -0,0 +1,70 @@ +# +# This file provides information about the External dependencies required by +# Bacula. +# +# There are four fields delimited by |. Only the first two fields are +# required. The other two are used when the top level directory of the +# archive is not the same as the file name with any suffixes removed. +# +# Field 1 is the name of the dependency. It is used to define the +# name of the three variables which are assigned the values of fields 2 to 4. +# +# Field 2 is the URL of the archive. It is assigned to the variable +# URL_[field1]. +# +# Field 3 is the top directory of the archive or the name of a directory that +# must be created and the archive extracted into it. It is assigned to the +# variable DIR_[field1]. +# +# Field 4 indicates if the directory specified in field 3 must be created +# first and the archive extracted into it. It is assigned to the variable +# MKD_[field1] +# +CMD_UTILS|https://www.bacula.org/downloads/depkgs-mingw32/cmd-utils-0.1.tar.gz +MT|https://www.bacula.org/downloads/depkgs-mingw32/mt-st-0.9b.tar.gz +MTX|https://www.bacula.org/downloads/depkgs-mingw32/mtx-1.3.9.tar.gz +MYSQL|https://www.bacula.org/downloads/depkgs-mingw32/mysql-noinstall-5.0.27-win32.zip|mysql-5.0.27-win32 +NSIS_BIN|https://www.bacula.org/downloads/depkgs-mingw32/nsis-2.17.zip +NSIS_SRC|https://www.bacula.org/downloads/depkgs-mingw32/nsis-2.17-src.tar.bz2 +OPENSSL|https://www.bacula.org/downloads/depkgs-mingw32/openssl-1.0.2k.tar.gz +PCRE|https://www.bacula.org/downloads/depkgs-mingw32/pcre-6.3.tar.bz2 +POSTGRESQL|https://www.bacula.org/downloads/depkgs-mingw32/postgresql-base-8.1.4.tar.bz2|postgresql-8.1.4 +PTHREADS|https://www.bacula.org/downloads/depkgs-mingw32/pthreads-w32-2-9-1-release.tar.gz +Qt4|https://www.bacula.org/downloads/depkgs-mingw32/qt-everywhere-opensource-src-4.8.4.tar.gz +SCONS|https://www.bacula.org/downloads/depkgs-mingw32/scons-0.96.92.tar.gz +SED|https://www.bacula.org/downloads/depkgs-mingw32/sed-4.2k.tar.gz +STAB2CV|https://www.bacula.org/downloads/depkgs-mingw32/stab2cv-0.1.tar.bz2 +WX|https://www.bacula.org/downloads/depkgs-mingw32/wxWidgets-2.8.7.tar.gz +ZLIB|https://www.bacula.org/downloads/depkgs-mingw32/zlib-1.2.8.tar.gz +RSYNC|https://www.bacula.org/downloads/depkgs-mingw32/librsync-0.9.7b.tar.gz +DB|https://www.bacula.org/downloads/depkgs-mingw32/db-4.7.25.tar.gz +LZO|https://www.bacula.org/downloads/depkgs-mingw32/lzo-2.10.tar.gz +MSSQL|https://www.bacula.org/downloads/depkgs-mingw32/depkgs-mssql-08Jun17.tar.gz +# +#DVD_RW_TOOLS|https://www.bacula.org/downloads/depkgs-mingw32/dvd+rw-tools-7.0.tar.gz +# +# Original file locations +# +# CDRTOOLS|ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-2.01.01a22.tar.bz2 +# CMD_UTILS|http://superb-west.dl.sourceforge.net/sourceforge/cmd-utils/cmd-utils-0.1.tar.gz +# DVD_RW_TOOLS|http://fy.chalmers.se/~appro/linux/DVD+RW/tools/dvd+rw-tools-7.0.tar.gz +# MKISOFS|http://fy.chalmers.se/~appro/linux/DVD+RW/tools/win32/mkisofs.exe +# MT|http://www.ibiblio.org/pub/linux/system/backup/mt-st-0.9b.tar.gz +# MTX|http://superb-west.dl.sourceforge.net/sourceforge/mtx/mtx-1.3.9.tar.gz +# MYSQL|http://mirror.x10.com/mirror/mysql/Downloads/MySQL-5.0/mysql-noinstall-5.0.27-win32.zip|mysql-5.0.27-win32 +# NSIS_BIN|http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17.zip +# NSIS_SRC|http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17-src.tar.bz2 +# OPENSSL|http://www.openssl.org/source/openssl-0.9.8b.tar.gz +# PCRE|http://superb-west.dl.sourceforge.net/sourceforge/pcre/pcre-6.3.tar.bz2 +# POSTGRESQL|ftp://ftp2.us.postgresql.org/postgresql/source/v8.1.4/postgresql-base-8.1.4.tar.bz2|postgresql-8.1.4 +# PTHREADS|ftp://sources.redhat.com/pub/pthreads-win32/pthreads-snap-2004-06-22.tar.gz +# Qt4|ftp://ftp.trolltech.com/qt/source/qt-win-opensource-src-4.3.0.zip +# SCONS|http://superb-west.dl.sourceforge.net/sourceforge/scons/scons-0.96.92.tar.gz +# SED|ftp://mirrors.kernel.org/gnu/sed/sed-4.1.5.tar.gz +# SQLITE|http://www.sqlite.org/sqlite-3.3.8.tar.gz +# SQLITE|http://www.sqlite.org/sqlite-3.3.17.tar.gz +# STAB2CV|http://superb-west.dl.sourceforge.net/sourceforge/stab2cv/stab2cv-0.1.tar.bz2 +# WX|http://superb-west.dl.sourceforge.net/sourceforge/wxwindows/wxWidgets-2.7.0.tar.gz +# ZLIB|http://www.zlib.net/zlib-1.2.3.tar.gz +# DB|http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz +# LZO|http://www.oberhumer.com/opensource/lzo/download/lzo-2.05.tar.gz diff --git a/bacula/src/win32/External-msvc b/bacula/src/win32/External-msvc new file mode 100644 index 0000000000..8808128e8c --- /dev/null +++ b/bacula/src/win32/External-msvc @@ -0,0 +1,59 @@ +# This file provides information about the External dependencies required by +# Bacula. +# +# There are four fields delimited by |. Only the first two fields are +# required. The other two are used when the top level directory of the +# archive is not the same as the file name with any suffixes removed. +# +# Field 1 is the name of the dependency. It is used to define the +# name of the three variables which are assigned the values of fields 2 to 4. +# +# Field 2 is the URL of the archive. It is assigned to the variable +# URL_[field1]. +# +# Field 3 is the top directory of the archive or the name of a directory that +# must be created and the archive extracted into it. It is assigned to the +# variable DIR_[field1]. +# +# Field 4 indicates if the directory specified in field 3 must be created +# first and the archive extracted into it. It is assigned to the variable +# MKD_[field1] +# +# +CMD_UTILS|http://www.bacula.org/depkgs-mingw32/cmd-utils-0.1.tar.gz +DVD_RW_TOOLS|http://www.bacula.org/depkgs-mingw32/dvd+rw-tools-7.0.tar.gz +MKISOFS|http://www.bacula.org/depkgs-mingw32/mkisofs.exe +MT|http://www.bacula.org/depkgs-mingw32/mt-st-0.9b.tar.gz +MTX|http://www.bacula.org/depkgs-mingw32/mtx-1.3.9.tar.gz +MYSQL|http://www.bacula.org/depkgs-mingw32/mysql-noinstall-5.0.27-win32.zip|mysql-5.0.27-win32 +NSIS_BIN|http://www.bacula.org/depkgs-mingw32/nsis-2.17.zip +OPENSSL|http://www.bacula.org/depkgs-mingw32/openssl-0.9.8b.tar.gz +PCRE|http://www.bacula.org/depkgs-mingw32/pcre-6.3.tar.bz2 +POSTGRESQL|http://www.bacula.org/depkgs-mingw32/postgresql-8.1.9-1-binaries-no-installer.zip|pgsql +POSTGRESQL_SRC|http://www.bacula.org/depkgs-mingw32/postgresql-8.1.9.tar.bz2 +PTHREADS|http://www.bacula.org/depkgs-mingw32/pthreads-2004-06-22x.exe|pthreads-2004-06-22x|true +SED|http://www.bacula.org/depkgs-mingw32/sed-4.1.5.tar.gz +SQLITE|http://www.bacula.org/depkgs-mingw32/sqlite-3.3.17.tar.gz +WX|http://www.bacula.org/depkgs-mingw32/wxWidgets-2.7.0.zip +ZLIB|http://www.bacula.org/depkgs-mingw32/zlib123.zip|zlib123|true +# +# +# Original locations +# +# ZLIB|http://www.zlib.net/zlib123.zip|zlib123|true +# PCRE|http://superb-west.dl.sourceforge.net/sourceforge/pcre/pcre-6.3.tar.bz2 +# PTHREADS|ftp://sources.redhat.com/pub/pthreads-win32/pthreads-2004-06-22x.exe|pthreads-2004-06-22x|true +# OPENSSL|http://www.openssl.org/source/openssl-0.9.8b.tar.gz +# MYSQL|http://mirror.x10.com/mirror/mysql/Downloads/MySQL-5.0/mysql-noinstall-5.0.27-win32.zip|mysql-5.0.27-win32 +# POSTGRESQL|ftp://ftp2.us.postgresql.org/postgresql/binary/v8.1.6/win32/postgresql-8.1.6-1-binaries-no-installer.zip|pgsql +# POSTGRESQL_SRC|ftp://ftp4.us.postgresql.org/pub/postgresql/source/v8.1.6/postgresql-8.1.6.tar.bz2 +# SQLITE|http://www.sqlite.org/sqlite-3.3.8.tar.gz +# WX|http://superb-west.dl.sourceforge.net/sourceforge/wxwindows/wxWidgets-2.7.0.zip +# NSIS_BIN|http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17.zip +# MTX|http://superb-west.dl.sourceforge.net/sourceforge/mtx/mtx-1.3.9.tar.gz +# MT|ftp://ftp.ibiblio.org/pub/linux/system/backup/mt-st-0.9b.tar.gz +# SED|ftp://mirrors.kernel.org/gnu/sed/sed-4.1.5.tar.gz +# CMD_UTILS|http://superb-west.dl.sourceforge.net/sourceforge/cmd-utils/cmd-utils-0.1.tar.gz +# #CDRTOOLS|ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-2.01.01a22.tar.bz2 +# MKISOFS|http://fy.chalmers.se/~appro/linux/DVD+RW/tools/win32/mkisofs.exe +# DVD_RW_TOOLS|http://fy.chalmers.se/~appro/linux/DVD+RW/tools/dvd+rw-tools-7.0.tar.gz diff --git a/bacula/src/win32/Makefile b/bacula/src/win32/Makefile new file mode 100644 index 0000000000..22626d45e1 --- /dev/null +++ b/bacula/src/win32/Makefile @@ -0,0 +1,168 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# +# Makefile for Win32/Win64 Bacula File daemon +# +# If called make win64=yes the Win64 version will be built +# otherwise the Win32 version will be built. +# +# If called with bat=no, bat will not be built, otherwise it will be +# built. +# + +ECHO_CMD=@ + +WIN32_DIRS=lib filed filed/plugins console scripts stored +WIN64_DIRS=lib filed filed/plugins console scripts stored + +ifeq ($(win64),yes) + DIRS=$(WIN64_DIRS) + INSTALLER=win64_installer + SPECIAL=bat64 bsmtp +else + DIRS=$(WIN32_DIRS) + INSTALLER=win32_installer + SPECIAL=bat32 bsmtp +endif + +ifeq ($(bat),no) + SPECIAL=bsmtp +endif + +.PHONY: $(DIRS) clean all Makefile.inc win32_installer full_win32_installer \ + win64_installer bsmtp distclean + +all: Makefile.inc $(DIRS) $(SPECIAL) $(INSTALLER) + +distclean: clean + +clean: $(DIRS) win32_installer win64_installer + $(MAKE) -C tools clean + $(ECHO_CMD)-rm -rf release32 release64 + $(ECHO_CMD)-rm -rf ../qt-console/obj32 ../qt-console/obj64 + $(ECHO_CMD)-rm -f ../qt-console/release/bat.exe ../qt-console/debug/bat.exe + $(ECHO_CMD)-rm -rf ../qt-console/tray-monitor/obj32 ../qt-console/tray-monitor/obj64 + $(ECHO_CMD)-rm -f ../qt-console/tray-monitor/release/bacula-tray-monitor.exe ../qt-console/tray-monitor/debug/bacula-tray-monitor.exe + +is_depkgs_set: + @if test -z $${DEPKGS} ; then \ + echo "variable DEPKGS not set" ; \ + echo "You probably want DEPKGS=\"`(cd ../../..;pwd)`\"" ; \ + exit 1; \ + fi ; \ + +release32/bat.exe: is_depkgs_set + ( cd ../qt-console; ./make-win32 "32" ) + test -f release32/bat.exe + +bat32: release32/bat.exe + +release64/bat.exe: is_depkgs_set + ( cd ../qt-console; ./make-win32 "64" ) + test -f release64/bat.exe + +bat64: release64/bat.exe + +full_win32_installer: + @if test -f Makefile.inc; then \ + if $(MAKE) -C $@ $(MAKECMDGOALS); then \ + echo "\n===== Make of $@ succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + +win32_installer: + echo "Making 32 bit version" + @if test -f Makefile.inc; then \ + if $(MAKE) -C $@ $(MAKECMDGOALS); then \ + echo "\n===== Make of $@ succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + +win64_installer: + echo "Making 64 bit version" + @if test -f Makefile.inc; then \ + if $(MAKE) -C $@ $(MAKECMDGOALS); then \ + echo "\n===== Make of $@ succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + + +$(DIRS): + @if test -f Makefile.inc; then \ + if $(MAKE) -C $@ $(MAKECMDGOALS); then \ + echo "\n===== Make of $@ succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + +bsmtp: + @if test -f Makefile.inc; then \ + if $(MAKE) -C tools bsmtp $(MAKECMDGOALS); then \ + echo "\n===== Make of tools/bsmtp succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of tools/bsmtp failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + + + +Makefile.inc: + @echo Creating $@ + $(ECHO_CMD)TOPDIR=`(cd ../../..;pwd)`; \ + TOPDIR=$${DEPKGS:-$${TOPDIR}}; \ + if test "$(win64)" = yes -a -e $${TOPDIR}/cross-tools/mingw-w64/bin/x86_64-pc-mingw32-gcc; then \ + BINDIR=$${TOPDIR}/cross-tools/mingw-w64/bin; \ + INCDIR=$${TOPDIR}/cross-tools/mingw-w64/x86_64-pc-mingw32/include; \ + DLLDIR=$${TOPDIR}/cross-tools/mingw-w64/x86_64-pc-mingw32/bin; \ + DEPKGSDIR=depkgs-mingw-w64; \ + DEPKGSDIR32=depkgs-mingw32; \ + MINGWBASE=x86_64-pc-mingw32; \ + elif test -e $${TOPDIR}/cross-tools/mingw32/bin/mingw32-gcc; then \ + BINDIR=$${TOPDIR}/cross-tools/mingw32/bin; \ + INCDIR=$${TOPDIR}/cross-tools/mingw32/mingw32/include; \ + DLLDIR=$${TOPDIR}/cross-tools/mingw32/mingw32/bin; \ + DEPKGSDIR=depkgs-mingw32; \ + DEPKGSDIR32=depkgs-mingw32; \ + MINGWBASE=mingw32; \ + elif test "$(win64)" = yes && which x86_64-w64-mingw32-g++ ; then \ + BINDIR=; \ + INCDIR=; \ + DLLDIR=; \ + DEPKGSDIR=depkgs-mingw-w64; \ + DEPKGSDIR32=depkgs-mingw32; \ + MINGWBASE=x86_64-w64-mingw32; \ + elif which i686-w64-mingw32-g++ ; then \ + BINDIR=; \ + INCDIR=; \ + DLLDIR=; \ + DEPKGSDIR=depkgs-mingw32; \ + DEPKGSDIR32=depkgs-mingw32; \ + MINGWBASE=i686-w64-mingw32; \ + else \ + echo "\nThe GCC cross compiler isn't installed."; \ + echo "You must run build-win32-cross-tools and build-dependencies first.\n"; \ + exit 1; \ + fi ; \ + BUILDDIR=`(pwd)`; \ + MAINDIR=`(cd ../..;pwd)`; \ + sed \ + -e "s^@MINGWBASE@^$${MINGWBASE}^" \ + -e "s^@WIN64@^$${win64}^" \ + -e "s^@BAT@^$${bat}^" \ + -e "s^@WIN32DEPKGS@^$${DEPKGSDIR}^" \ + -e "s^@WIN32DEPKGS32@^$${DEPKGSDIR32}^" \ + -e "s^@WIN32BUILDDIR@^$${BUILDDIR}^" \ + -e "s^@WIN32MAINDIR@^$${MAINDIR}^" \ + -e "s^@WIN32TOPDIR@^$${TOPDIR}^" \ + -e "s^@WIN32BINDIR@^$${BINDIR}^" \ + -e "s^@WIN32INCDIR@^$${INCDIR}^" \ + -e "s^@WIN32DLLDIR@^$${DLLDIR}^" < Makefile.inc.in > $@ diff --git a/bacula/src/win32/Makefile.full b/bacula/src/win32/Makefile.full new file mode 100644 index 0000000000..3e9a3e37ba --- /dev/null +++ b/bacula/src/win32/Makefile.full @@ -0,0 +1,109 @@ +ECHO_CMD=@ + +WIN32_DIRS=lib cats filed filed/plugins dird stored \ + console wx-console tools scripts + +WIN64_DIRS=lib filed filed/plugins console scripts + +ifeq ($(WIN64),yes) + DIRS=$(WIN64_DIRS) + INSTALLER=win64_installer + SPECIAL=bsmtp +else + DIRS=$(WIN32_DIRS) + INSTALLER=win32_installer + SPECIAL=bat +endif + +.PHONY: $(DIRS) clean all Makefile.inc win32_installer full_win32_installer \ + win64_installer bsmtp + +all: Makefile.inc $(DIRS) $(SPECIAL) $(INSTALLER) + +clean: $(DIRS) win32_installer win64_installer + $(ECHO_CMD)-rm -rf release32 release64 + +bat: + (cd ../qt-console; ./make-win32) + +full_win32_installer: + @if test -f Makefile.inc; then \ + if $(MAKE) -C $@ $(MAKECMDGOALS); then \ + echo "\n===== Make of $@ succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + +win32_installer: + @if test -f Makefile.inc; then \ + if $(MAKE) -C $@ $(MAKECMDGOALS); then \ + echo "\n===== Make of $@ succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + +win64_installer: + @if test -f Makefile.inc; then \ + if $(MAKE) -C $@ $(MAKECMDGOALS); then \ + echo "\n===== Make of $@ succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + + +$(DIRS): + @if test -f Makefile.inc; then \ + if $(MAKE) -C $@ $(MAKECMDGOALS); then \ + echo "\n===== Make of $@ succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + +bsmtp: + @if test -f Makefile.inc; then \ + if $(MAKE) -C tools bsmtp $(MAKECMDGOALS); then \ + echo "\n===== Make of tools/bsmtp succeeded =====\n\n" ; \ + else \ + echo "\n!!!!! Make of tools/bsmtp failed !!!!!\n\n" ; exit 1; \ + fi ; \ + fi + + + +Makefile.inc: + @echo Creating $@ + $(ECHO_CMD)TOPDIR=`(cd ../../..;pwd)`; \ + TOPDIR=$${DEPKGS:-$${TOPDIR}}; \ + if test "$(WIN64)" = yes -a -e $${TOPDIR}/cross-tools/mingw-w64/bin/x86_64-pc-mingw32-gcc; then \ + BINDIR=$${TOPDIR}/cross-tools/mingw-w64/bin; \ + INCDIR=$${TOPDIR}/cross-tools/mingw-w64/x86_64-pc-mingw32/include; \ + DLLDIR=$${TOPDIR}/cross-tools/mingw-w64/x86_64-pc-mingw32/bin; \ + DEPKGSDIR=depkgs-mingw-w64; \ + DEPKGSDIR32=depkgs-mingw32; \ + elif test -e $${TOPDIR}/cross-tools/mingw32/bin/mingw32-gcc; then \ + BINDIR=$${TOPDIR}/cross-tools/mingw32/bin; \ + INCDIR=$${TOPDIR}/cross-tools/mingw32/mingw32/include; \ + DLLDIR=$${TOPDIR}/cross-tools/mingw32/mingw32/bin; \ + DEPKGSDIR=depkgs-mingw32; \ + DEPKGSDIR32=depkgs-mingw32; \ + else \ + echo "\nThe GCC cross compiler isn't installed."; \ + echo "You must run build-win32-cross-tools and build-dependencies first.\n"; \ + exit 1; \ + fi ; \ + BUILDDIR=`(pwd)`; \ + MAINDIR=`(cd ../..;pwd)`; \ + sed \ + -e "s^@WIN64@^$${WIN64}^" \ + -e "s^@WIN32DEPKGS@^$${DEPKGSDIR}^" \ + -e "s^@WIN32DEPKGS32@^$${DEPKGSDIR32}^" \ + -e "s^@WIN32BUILDDIR@^$${BUILDDIR}^" \ + -e "s^@WIN32MAINDIR@^$${MAINDIR}^" \ + -e "s^@WIN32TOPDIR@^$${TOPDIR}^" \ + -e "s^@WIN32BINDIR@^$${BINDIR}^" \ + -e "s^@WIN32INCDIR@^$${INCDIR}^" \ + -e "s^@WIN32DLLDIR@^$${DLLDIR}^" < Makefile.inc.in > $@ diff --git a/bacula/src/win32/Makefile.inc.in b/bacula/src/win32/Makefile.inc.in new file mode 100644 index 0000000000..53918abd52 --- /dev/null +++ b/bacula/src/win32/Makefile.inc.in @@ -0,0 +1,161 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Author: Robert Nelson +# Copyright (C), Kern Sibbald 2006-2018 +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Written by Robert Nelson, June 2006 +# +# Absolute paths used in place of relative paths +# Kern Sibbald, October 2008 +# Split Win32 and Win64 objects and binaries. However +# the clean is a significant kludge -- hard coded. +# The object directories are deleted during make clean, +# so don't point them to any source directory. +# + +# Global Configuration + +ECHO_CMD = @ + +# Main Bacula source dir +MAINDIR := @WIN32MAINDIR@ +# +# Build dir -- i.e. normally src/win32 +BUILDDIR := @WIN32BUILDDIR@ +# +# Dir above Bacula where we find depkgs +TOPDIR := @WIN32TOPDIR@ +# +# where we find depkgs +DEPKGS32 := $(TOPDIR)/@WIN32DEPKGS32@ + +DOCDIR := $(TOPDIR)/docs + +MINGW_BASE := @MINGWBASE@ + +MINGW_BIN := @WIN32BINDIR@ +MINGW_INCLUDE := @WIN32INCDIR@ +MINGW_DLLDIR := @WIN32DLLDIR@ + +# Point only to GCC (CC is already used for g++...) +# Used to compile libobk for windows (just need simple gcc) +GCC = $(MINGW_BIN)$(MINGW_BASE)-gcc + +CC = $(MINGW_BIN)$(MINGW_BASE)-g++ $(DEFINES) $(INCLUDES) +CXX = $(MINGW_BIN)$(MINGW_BASE)-g++ $(DEFINES) $(INCLUDES) +AR := $(MINGW_BIN)$(MINGW_BASE)-ar +RANLIB := $(MINGW_BIN)$(MINGW_BASE)-ranlib +WINDRES := $(MINGW_BIN)$(MINGW_BASE)-windres +DLLTOOL := $(MINGW_BIN)$(MINGW_BASE)-dlltool +OBJCPY := $(MINGW_BIN)-objcopy +STAB2CV := $(DEPKGS32)/tools/bin/stab2cv + +WIN64=@WIN64@ + +ifeq ($(WIN64),yes) + DEPKGS := $(TOPDIR)/@WIN32DEPKGS@ + CFLAGS := -g -Wall -mthreads -O3 -fno-strict-aliasing -DHAVE_VSS64 -Wno-unknown-pragmas -Wno-builtin-macro-redefined + LIBS_NETWORK := -lws2_32 + WIN_VERSION := 64 + BINDIR := $(BUILDDIR)/release64 + LIBDIR := $(BUILDDIR)/release64 + OBJDIR := obj64 +else + DEPKGS := $(TOPDIR)/@WIN32DEPKGS32@ +# CFLAGS := -g -Wall -mno-cygwin -m32 -mwin32 -mthreads -O3 -fno-strict-aliasing -Wno-unknown-pragmas + CFLAGS := -g -Wall -m32 -mwin32 -mthreads -O3 -fno-strict-aliasing -Wno-unknown-pragmas -Wno-builtin-macro-redefined + LIBS_NETWORK := -lwsock32 + WIN_VERSION := 32 + BINDIR := $(BUILDDIR)/release32 + LIBDIR := $(BUILDDIR)/release32 + OBJDIR := obj32 +endif + +LDFLAGS := -g -Wall + +ifeq ($(MINGW_BASE),i686-w64-mingw32) + CFLAGS += -DHAVE_MINGW_W64 + WINDRESFLAGS := -DHAVE_MINGW_W64 + LIBS_PTHREADS := $(DEPKGS)/lib/libpthreadGCE2.a + +else ifeq ($(MINGW_BASE),x86_64-w64-mingw32) + CFLAGS += -DHAVE_MINGW_W64 + WINDRESFLAGS := -DHAVE_MINGW_W64 + LIBS_PTHREADS := $(DEPKGS)/lib/libpthreadGCE2.a + +else + # old mingw + LIBS_PTHREADS := $(DEPKGS)/lib/libpthreadGCE.a + LDFLAGS += -mno-cygwin -Wl,--disable-auto-import +endif + +bat=@BAT@ + +ifeq ($(bat),no) + BUILD_BAT=no +else + BUILD_BAT=yes +endif + +OBJDIRS := obj32 obj64 + +INCLUDE_DDK := -I$(MINGW_INCLUDE)/ddk +INCLUDE_BACULA := -I$(MAINDIR)/src -I$(BUILDDIR)/compat +INCLUDE_PTHREADS := -I$(DEPKGS)/include/pthreads +INCLUDE_ZLIB := -I$(DEPKGS)/include +INCLUDE_VSS := -I$(DEPKGS)/vss +INCLUDE_ICONS := -I../libwin32 +INCLUDE_OPENSSL := -I$(DEPKGS)/include +INCLUDE_WX := -I$(DEPKGS)/lib/wx_dll/msw -I$(DEPKGS)/include +INCLUDE_MYSQL := -I$(DEPKGS)/include/mysql +INCLUDE_RSYNC := -I$(DEPKGS)/include + +LIBS_DB := \ + $(DEPKGS)/lib/libdb.a + +LIBS_RSYNC := $(DEPKGS)/lib/librsync.a + +LIBS_ZLIB := \ + $(DEPKGS)/lib/libz.a + +LIBS_LZO := \ + $(DEPKGS)/lib/liblzo2.a + +LIBS_MYSQL := \ + $(DEPKGS)/lib/libmysql.a + +LIBS_POSTGRESQL := \ + $(DEPKGS)/lib/libpq.a + +LIBS_SQLITE := \ + $(DEPKGS)/lib/libsqlite3.a + +LIBS_SSL := \ + $(DEPKGS)/lib/libssl.dll.a + +LIBS_CRYPTO := \ + $(DEPKGS)/lib/libcrypto.dll.a + +LIBS_WX := \ + $(DEPKGS)/lib/wx_dll/libwxmsw28_core.a \ + $(DEPKGS)/lib/wx_dll/libwxbase28.a + +LIBS_CATS := \ + $(LIBDIR)/libcats.a + +LIBS_BACULA := \ + $(LIBDIR)/libbacula.a + +HAVES := \ + -DHAVE_WIN32 \ + -DHAVE_MINGW \ + -DHAVE_ZLIB_H \ + -DHAVE_LZO \ + -DHAVE_LIBZ \ + -DHAVE_CRYPTO \ + -DHAVE_OPENSSL \ + -DHAVE_TLS \ + $(HAVES) diff --git a/bacula/src/win32/Makefile.rules b/bacula/src/win32/Makefile.rules new file mode 100644 index 0000000000..b41d7b5b81 --- /dev/null +++ b/bacula/src/win32/Makefile.rules @@ -0,0 +1,79 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written by Robert Nelson, June 2006 +# + +define clean_obj + $(ECHO_CMD)rm -f $(1) $(patsubst %.o,%.d,$(filter-out %.res,$(1))) + $(ECHO_CMD)rm -f $(1) $(addsuffix .d.*,$(basename $(1))) +endef + +define clean_exe + $(ECHO_CMD)rm -f $(1) $(addsuffix .dbg,$(basename $(1))) +endef + +define checkdir + @if [ ! -e $(dir $(1)) ]; then mkdir -p $(dir $(1)); fi +endef + +define makedep + @echo "Generating dependencies for $<" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ +endef + +define link_conapp + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(CFLAGS) $(LDFLAGS) -mconsole $^ $(1) -o $@ +endef + +define link_winapp + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(CFLAGS) $(LDFLAGS) -mwindows $^ $(1) -o $@ +endef + +define makedbg + @echo "Stripping debug info from $@" + $(call checkdir,$@) + $(ECHO_CMD)$(OBJCPY) --only-keep-debug $@ $(addsuffix .dbg,$(basename $@)) ; \ + $(OBJCPY) --strip-debug $@ ; \ + $(OBJCPY) --add-gnu-debuglink=$(addsuffix .dbg,$(basename $@)) $@ +endef + +$(OBJDIR)/%.o: %.c + @echo "Compiling $<" + $(call checkdir, $@) + $(ECHO_CMD)$(CXX) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.cpp + @echo "Compiling $<" + $(call checkdir, $@) + $(ECHO_CMD)$(CXX) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/%.res: %.rc + @echo "Compiling $<" + $(call checkdir, $@) + $(ECHO_CMD)$(WINDRES) $(WINDRESFLAGS) -O coff $< -o $@ + +$(OBJDIR)/%.d: %.c + $(call checkdir, $@) + $(makedep) + +$(OBJDIR)/%.d: %.cpp + $(call checkdir, $@) + $(makedep) + +ifneq ($(ALL_OBJS),) +ifneq ($(MAKECMDGOALS),clean) +include $(patsubst %.o,%.d,$(filter-out %.res,$(ALL_OBJS))) +endif +endif diff --git a/bacula/src/win32/README.mingw b/bacula/src/win32/README.mingw new file mode 100644 index 0000000000..a62c516cbf --- /dev/null +++ b/bacula/src/win32/README.mingw @@ -0,0 +1,376 @@ + +Instructions for cross compiling the Win32/64 FD on Linux +======================================================= +This part of the file documents the tools (scripts) we use for building Bacula for +Microsoft Windows using the cross-compiler tools on a Linux system. We +use Ubuntu 14.04 so building on that system should definitely work. But there +shouldn't be any issues on other Linux distributions. + +We don't officially support this method, but it is what we use, and it should +build on any Linux machine if you carefully follow the instructions and have +all the prerequisite programs loaded on your machine. + +We expect that there may be problems on systems other than Linux where you +are pretty much on your own. However, we will try to provide responses to +your questions on the bacula-devel list, but we can't guarantee anything. + +Note: the environment variable DEPKGS must point to a directory that +contains: depkgs-mingw32 depkgs-mingw-w64 and cross-tools + +Directory Structure +===================== +The new directory structure is: + + xxx (any directory) + bacula Top level Bacula source directory -- any name + src + win32 Main directory where Windows version is built. + + docs Top level Bacula documentation directory + + yyy (any directory, but pointed to by the DEPKGS environment variable) + depkgs-mingw32 (MinGW32) 3rd Party Dependencies for MinGW32 build + bin -- NOTE! depkgs-msvc is no longer suppored + include | + lib | + man | Created by script + nsis |-- .../bacula/src/win32/build-depkgs-mingw32 + scons | + share | + src | + ssl -- + vss + inc A copy of the Windows VSS/inc directory + + + depkgs-mingw-w64 (MinGW64) 3rd Party Dependencies for MinGW64 build + bin -- + include | + lib | + man | Created by script + nsis |-- .../bacula/src/win32/build-depkgs-mingw-w64 + scons | + share | + src | + ssl -- + vss + inc A copy of the Windows VSS/inc directory + +One-time Setup +============== + +If you're reading this file you've probably already cloned the GIT source tree or +extracted the contents of the source tar. If not you need to do that first. + +You also need to download one of the doc tar balls and extract to your +top level Bacula directory. + +The extracted doc directory name will be bacula-docs-version where version +is the version number. The directory must be renamed to docs (ie remove +the leading bacula- and the -version portion of the name). + +An alternative to setting up the old documents that are needed by the Win32 +installer, you may comment out the following lines in +src/win32/win32_installer/Makefile: + +#DOC_FILES := \ +# manual/bacula.pdf \ +# manual/bacula/*.html \ +# manual/bacula/*.png \ +# manual/bacula/*.css + +Note, a number of packages must be installed to build the the depkgs files. +Most are rather standard such as gcc, g++, +make, ... However a few that you may not have are: + + wget + texinfo + flex + bison + patch (Debian) + m4 + postgresql (at least client) + mysql (at least client) + SQLite3 (from depkgs or as package) + readline (readlineN-dev on Debian) + ... + +NB: On Debian, I had to remove /usr/bin/lorder for +postresql to build correctly. + +Install the cross compiler and makensis + apt-get install g++-mingw-w64-i686 g++-mingw-w64-x86-64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 nsis + +For OpenSSL 1.0.2n, I have commented out the fstat() definition in /usr/share/mingw-w64/include/sys/stat.h +with #ifdef 0 / #endif + +Download and build the 3rd party dependencies + ./build-depkgs-mingw32 + ./build-depkgs-mingw64 + +Files are also available on bsweb:/var/www/dl/Depkgs-mingw32-6.6-paa9aiMa/ + + +Make sure that libgcc and libstdc++ mingw files are copied to depkgs-mingw32/bin and depkgs-mingw-w64/bin + /usr/lib/gcc/i686-w64-mingw32/*-posix/libgcc_s_sjlj-1.dll + /usr/lib/gcc/i686-w64-mingw32/*-posix/libstdc++-6.dll + /usr/i686-w64-mingw32/lib/libwinpthread-1.dll + + /usr/lib/gcc/x86_64-w64-mingw32/*-posix/libgcc_s_seh-1.dll + /usr/lib/gcc/x86_64-w64-mingw32/*-posix/libstdc++-6.dll + /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll + +Note, that during the build process you will see a moderate amount of +output and some warnings. If something more serious happens +and the build fails, it is probably because you don't have one +of the build dependencies (hopefully all mentioned above) loaded on your +system. To find out what is going wrong, do the following: + + cd .../depkgs-mingw32/src/ + +where is where the package is unpacked and built. Normally +it is relatively obvious when looking at the src directory. + +In that directory, you should find a make.log, which has the full details +of the compiles, links, and installs done for that package. + +=== + +For the QT part, you must download QT binaries from +QT website + +the http://download.qt-project.org/archive/qt/4.8/4.8.4/ + +Then, copy Qt*dll files to depkgs-mingw32/bin and headers to +depkgs-mingw32/include + +=== + +See External-mingw-w64 for download location + +You need the header files from the Microsoft VSS SDK. Unfortunately the SDK +can only be downloaded and installed on a Windows system. We do not have +the right to distribute it, so you must download it yourself. +You can find it on Microsoft's web-site at: + +http://www.microsoft.com/downloads/details.aspx?FamilyID=0b4f56e4-0ccc-4626-826a-ed2c4c95c871&DisplayLang=en + +If that link doesn't work then go to http://www.microsoft.com and search for + + "download volume shadow copy service sdk" + +we are currently using version 7.2 released 8/3/2005 (a bit old, but it +works). + +Normally the files will be installed in: + + c:\Program Files\Microsoft\VSSSDK72 + +You only need to copy everything under the c:\Program Files\Microsoft\VSSSDK72\inc +directory into .../depkgs-mingw32/vss/inc. and .../depkgs-mingw-w64/vss/inc +In doing so, please ensure that +the case in maintained on the directory and filenames -- some contain uppercase +characters !!! + +Some definitions are already defined in other headers, it produces warnings +and the depkgs-mingw-w64.tar.bz2 archive contains fixes with #ifndef + +The above only needs to be done once unless we change the cross-tools +or the dependencies versions. In general, you can run the script multiple +times with no problem. For it to work, you must have at a minimum the +following: + + gcc + g++ + patch + wget + texinfo + bison + flex + python + unzip + tar + +and possibly other packages. + + +Building +======== + +Finally, to build the Microsoft Windows version of Bacula, do the following: + + cd .../bacula/src/win32 + make clean + ./makeall + +or + cd .../bacula/src/win32 + make clean + make + make win64=yes + +This builds both the 32 bit version and the 64 bit version. +The binaries are in the release32 and release64 directories. + + + +Updating the 3rd party package patches +====================================== + +If one of the patches changes in .../bacula/src/win32/patches, you will +need to update the corresponding dependency. + +Adding a new global function or global data +=========================================== + +bacula.dll +---------- + +The code from the following directories is built into bacula.dll: + + .../bacula/src/lib + .../bacula/src/libfind + .../bacula/src/win32/compat + +A new function or data variable which must be accessed from outside +of bacula.dll requires special treatment. It must be specifically +exported. + +New data variables are exported by adding the macro DLL_IMP_EXP to +the variable declaration in the header file. All exported variables +must be declared in a header file and MUST NOT be declared in a +source file referencing the variable. Example, src/lib/runscript.h: + +extern DLL_IMP_EXP bool (*console_command)(JCR *jcr, const char *cmd); + +or src/jcr.h + +extern int DLL_IMP_EXP num_jobs_run; +extern DLL_IMP_EXP dlist * last_jobs; +... + + +Exporting functions is now more or less automated. If you find that +a function name has been added, changed, or an argument modified, +simply do the following: + + cd .../bacula/src/win32/lib + make (to build the .o files, note the link will fail) + ./make_def >bacula64.def or >bacula64.def + +This should rebuild the bacula.def file, but it uses relative paths +and assumes you have the directory structure noted above. If you +are using something different, you can set the NM variable at the +top of the make_def file to use an absolute path to the correct +directory. + +===== manual changing of bacula32.def or bacula64.def no longer necessary ===== +If you want to do it manually, please see below: +Exporting a function requires a bit more work. You must determine the +C++ mangled name of the new function. + + strings .../bacula/src/win32/lib/.o | grep + +Note, strings often will not show the desired symbol. In that case, +use: + + nm .../bacula/src/win32/lib/.o + +Replace with the base part of the name of the source code file +which contains the new function. Replace with the name of +the new function. Remove the leading underscore and place the result +in the file + + .../bacula/src/win32/lib/bacula64.def +=== end manual changing of bacula64.def ========== + +If you add a new file, you will need to specify its name in + + .../bacula/src/win32/lib/Makefile +and + .../bacula/src/win32/libbac/Makefile + + +Running gdb on the Win32 files +================================================== +You can use the mingw64 gdb to debug Bacula on Win64 by downloading +it from Source Forge: + +http://sourceforge.net/project/showfiles.php?group_id=202880&package_id=311650 + + +Download one of their .exe versions, which is an installer that you +can run on Win32 to install gdb. This gdb is built with mingw64 so will +run independently of any cygwin installation. Note, not all the releases +come with an installer. I had to go back 3 or 4 versions to find it. Otherwise +you can download the source and build it. Thanks to Eric Bollengier for +this tip. + +Build Trial version +=================== + +To build trial version, just add the HAVES=-DBEEF_DEMO_ENABLED=1 environment +variable before compiling everything. + +Structure of the MinGW64/32 build environment +========================================== + +The basic strategy is each Makefile in the various subdirectories includes +Makefile.inc, defines variables and rules specific to what is being built, +then includes Makefile.rules which defines all the rules. + +Makefile.inc defines the locations of all the dependencies and the compiler +and linker flags. It is automatically created from Makefile.inc.in. Any +changes must be made to Makefile.inc.in not Makefile.inc or they will be +overwritten the next time Makefile.inc.in is updated. + +Makefile.rules defines a bunch of macros to simplify building. It also +includes all the basic rules for building objects, GUI and console +executables, etc. + +Makefile.template is a template for creating new Makefiles, if you are +creating a new directory, copy Makefile.template to Makefile in that +directory and edit to suit. + +Upgrading the system mingw +================================== +Every time you upgrade the system mingw, for example when changing from +Ubuntu 12.04 to Ubuntu 14.04, you much update the system library dll +files in your build environment. + +Do so by running from src/win32 + +./build-depkgs-mingw32 mingw +./build-depkgs-mingw-w64 mingw + +All that does is copy the system .dll files into the appropriate +depkgs directory. Then while building the installer, these files +are copied from the depkgs directory into the installer binary. + +Alternatively, you can look at the build-depkgs-xxx script and +manually run the code in the function process_mingw(). + + +Upgrading your depkgs mingw +==================================== + +mkdir old +mv cross-tools old +mv depkgs-mingw32 old +mv depkgs-mingw-w64 old + +# from src/win32 +./build-depkgs-mingw32 +./build-depkgs-mingw-w64 + +# from new depkgs-mingw32 dir +cp ../old/depkgs-mingw32/bin/libgcc_s_dw2-1.dll bin/ +cp ../old/depkgs-mingw32/bin/Qt* bin/ +cp -r ../old/depkgs-mingw32/lib/qt lib +cp -r ../old/depkgs-mingw32/include/qt include/ +cp -r ../old/depkgs-mingw32/include/src include/ +cp -r ../old/depkgs-mingw32/vss . + + +# from new depkgs-mingw-w64 +cp -r ../old/depkgs-mingw-w64/vss . diff --git a/bacula/src/win32/README.vc8 b/bacula/src/win32/README.vc8 new file mode 100644 index 0000000000..c810f9ad7f --- /dev/null +++ b/bacula/src/win32/README.vc8 @@ -0,0 +1,246 @@ +Instructions to build Bacula with Microsoft Visual C++ 2005 +=========================================================== + +NOTE: These instructions are probably quite accurate as several people +have used them. However, the project no longer maintains the files necessary +to build using MSVC. As a consequence, some of the file and scripts may +be out of date, and you will almost surely need to manually update the +MSVC project files. We do not supply any support on this. + +The project uses Mingw to cross-compile. Those files are kept up to date though +during development, they may sometimes be broken for a few days ... + +Using the Express Edition (free version) +---------------------------------------- + Download instructions: + - Visual C++ 2005 Express Edition (2MB + 66MB) + http://msdn.microsoft.com/vstudio/express/visualc/download/ + NOTE: You may want to download the whole CD for offline usage + instead of the web installer, as Microsoft will + start to charge for VC++ one year after the product launch + (launch was in November 2005, see VC++ FAQ). + NOTE: last modifications in order to compile have been tested with + Visual C++ Standard Edition, not with Express Edition, but this shouldn't change anything. + + - Microsoft VSS SDK. You can find it on Microsoft's web-site at: + http://www.microsoft.com/downloads/details.aspx?FamilyID=0b4f56e4-0ccc-4626-826a-ed2c4c95c871&DisplayLang=en + If that link doesn't work then go to http://www.microsoft.com and search for + "download volume shadow copy service sdk" + + - Windows Server 2003 SP1 Platform SDK Full Download (385MB) + http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en + NOTE: choose "Full Download" version on the bottom of that page. + + Installation instructions: + - Visual C++ Express Edition Beta 2: + + Run vcsetup.exe. + + When asked for Installation Options, only check "Graphical IDE" + (MSDN Library is NOT needed). + + Remember where you install it (e.g. E:\Microsoft Visual Studio 8\) + + - Windows Server 2003 SP1 Platform SDK Full Download + + Run psdk-full.exe, type the directory where you downloaded the cab + files. + + In a command prompt, run "PSDK-full.bat " + (e.g. "PSDK-full.bat E:\temp") + + Run \setup.exe + + When asked for the installation directory, choose + \VC\PlatformSDK (e.g. + E:\Microsoft Visual Studio 8\VC\PlatformSDK\) + + When asked for components, you can safely remove documentation, + samples, and all 64-bit tools and libs if you want to save disk + space. + NOTE: Just after having installed "Windows® Server 2003 SP1 Platform SDK Full Download", + my XP was no more considered as "genuine". You are warned. + That's why it is recommended to download "volume shadow copy service sdk" before installing SDK + + - Microsoft VSS SDK + + Normally the files will be installed in: C:\Program Files\Microsoft\VSSSDK72 + + You only need to copy everything under the C:\Program Files\Microsoft\VSSSDK72\inc + directory into .../depkgs-msvc/vss/inc. + + - Verify what you've got in your system variables : + + %INCLUDE% (echo %INCLUDE%) must contain + \VC\include;\VC\PlatformSDK\Include; + + %LIB% (echo %LIB%) must contain + \VC\lib;\VC\PlatformSDK\Lib + +One-time Setup +============== + +If you're reading this file you've probably already enlisted in the CVS +tree or extracted the contents of the source tar. If not you need to do +that first. + +You also need to download one of the doc tar balls and extract to your +top level Bacula directory. It is referred to as bacula-top in the +diagram located in README.win32. It will be signified in this file as ... + +The extracted doc directory name will be bacula-docs-version where +version is the version number. The directory must be renamed to docs +(ie remove the leading bacula- and the trailing -version portion of the +name). + +The script build-depkgs-msvc.cmd is used to download and build all the +third party dependencies required by Bacula. In order to build the +dependencies you need the following utilities. Only the binaries listed +in parenthesis are required. Perl must be listed in the PATH, the other +utilities can either be on the PATH or copied to ...\depkgs-msvc\tools. + + Perl (Normal Install, with binaries in the PATH) + http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.819-MSWin32-x86-267479.msi + + 7-Zip (7z.exe) + http://prdownloads.sourceforge.net/sevenzip/7za443.zip?download + + NASM (nasmw.exe) + http://prdownloads.sourceforge.net/nasm/nasm-0.98.39-win32.zip?download + + patch (patch.exe) + http://prdownloads.sourceforge.net/gnuwin32/patch-2.5.9-6-bin.zip?download + + sed (sed.exe) Depends on libintl, libiconv + http://prdownloads.sourceforge.net/gnuwin32/sed-4.1.4-bin.zip?download + + tee (tee.exe) Depends on libintl, libiconv + http://prdownloads.sourceforge.net/gnuwin32/coreutils-5.3.0-bin.zip?download + + wget (wget.exe) Depends on libintl, libiconv, openssl + http://prdownloads.sourceforge.net/gnuwin32/wget-1.10.1-bin.zip?download + + libintl (libintl3.dll) Dependency of sed, tee, wget + http://prdownloads.sourceforge.net/gnuwin32/libintl-0.14.4-bin.zip?download + + libiconv (libiconv2.dll) Dependency of sed, tee, wget + http://prdownloads.sourceforge.net/gnuwin32/libiconv-1.9.2-1-bin.zip?download + + openssl (libeay32.dll, ssleay32.dll) Dependency of wget + http://prdownloads.sourceforge.net/gnuwin32/openssl-0.9.7c-bin.zip?download + +Once the utilities are installed continue with the next steps. + +Start VC++ 2005 command prompt (in the start menu) + + cd ...\bacula\src\win32 directory. + +Only if you are using Microsoft Visual C++ Express + + "%VCINSTALLDIR%\PlatformSDK\SetEnv" + +The following step should only need to be done the first time and +whenever the dependencies change. + + build-depkgs-msvc + +At this point all of the dependencies should have been downloaded and +built. +The above only needs to be done once unless we change the cross-tools or +the dependencies versions. In general, you can run the script multiple +times with no problem. + + +Building +======== + +Start VC++ 2005 command prompt (in the start menu) + + cd ...\bacula\src\win32 + +If you are using Microsoft Visual C++ Express + + "%VCINSTALLDIR%\PlatformSDK\SetEnv" + +To build the debug version + + build-msvc "Debug|Win32" + +To build the release version + + build-msvc "Release|Win32" + +To cleanup all the built files + + build-msvc /c + +To cleanup only the debug built files + + build-msvc /c "Debug|Win32" + +To rebuild the debug version + + build-msvc /r "Debug|Win32" + + +Updating the 3rd party package patches +====================================== + +If one of the patches changes in ...\bacula\src\win32\patches, you will +need to update the corresponding dependency. You can install new patches +by doing the following (we assume the patch in question is for openssl). + + cd ...\bacula\src\win32 + set CLOBBER_SOURCE=true + build-depkgs-msvc openssl + set CLOBBER_SOURCE= + +NOTE: Setting CLOBBER_SOURCE=true means that any local changes to the + source code in the .../depkgs-msvc/src directory will be lost. + The source will be reextracted from the archive and the current + patches will be applied. + + +Adding a new global function or global data +=========================================== + +bacula.dll +---------- + +The code from the following directories is built into bacula.dll: + + .../bacula/src/lib + .../bacula/src/libfind + .../bacula/src/win32/compat + +A new function or data variable which must be accessed from outside +of bacula.dll requires special treatment. It must be specifically +exported. + +New data variables are exported by adding the macro DLL_IMP_EXP to +the variable declaration in the header file. All exported variables +must be declared in a header file and MUST NOT be declared in a +source file referencing the variable. + +Exporting a function requires a bit more work. You must determine the +C++ mangled name of the new function. Fortunately it is displayed in +parentheses in the linker error message. Place it in the +.../bacula/src/win32/libbac/bacula.def file. + +In .../bacula/src/win32/libbac/msvc there is a shell "make_def_msvc" that creates +a def file (not really clean way). +In cygwin, one has to type ./make_def_msvc > bacula.def + +bacula_cats.dll +--------------- + +The code from the src/cats directory is built into database provider +specific libraries of the form cats_.dll. + +The database specific portion is mysql for MySQL, pgsql for +PostgreSQL, sqlite for SQLite, and bdb for the built-in Bacula database. + +During installation of the Director, one of the database libraries is +copied to the system and renamed bacula_cats.dll. + +A new function or data variable which must be accessed from outside +of bacula_cats.dll requires special treatment. It must be specifically +exported. + +New data variables and functions are exported by placing their mangled +name in the file .../bacula/src/win32/cats/bacula_cats/bacula_cats.def. + +The mangled name is printed, surrounded by parentheses, in the Linker +error message. + +In .../bacula/src/win32/bacula_cats/ there is a shell "make_def_msvc" that creates +a def file (not really clean way). +In cygwin, one has to type ./make_def_msvc > bacula_cats.def diff --git a/bacula/src/win32/bacula.sln b/bacula/src/win32/bacula.sln new file mode 100644 index 0000000000..a81b5edd3d --- /dev/null +++ b/bacula/src/win32/bacula.sln @@ -0,0 +1,403 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wx-console", "wx-console\wx-console.vcproj", "{9BA8E10D-0D82-4B25-8543-DE34641FBC10}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "console", "console\console.vcproj", "{A0F65E06-9F18-40AC-81F6-A080852F1104}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fstype", "tools\fstype\fstype.vcproj", "{AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbac", "libbac\libbac.vcproj", "{374BF775-AF68-4A88-814A-48F692DFFE5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drivetype", "tools\drivetype\drivetype.vcproj", "{E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testfind", "tools\testfind\testfind.vcproj", "{558838F9-D792-4F56-AAB2-99C03687C5FF}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testls", "tools\testls\testls.vcproj", "{28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baculafd", "filed\baculafd.vcproj", "{6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{825DFFD0-4747-43CA-8326-529655E31935}" + ProjectSection(SolutionItems) = preProject + build-depkgs-mingw32 = build-depkgs-mingw32 + build-msvc.cmd = build-msvc.cmd + build-win32-cross-tools = build-win32-cross-tools + External-mingw32 = External-mingw32 + README.mingw32 = README.mingw32 + README.vc8 = README.vc8 + README.win32 = README.win32 + ..\..\technotes-1.39 = ..\..\technotes-1.39 + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Header Files", "Header Files", "{C8301485-CFD1-43D4-827C-8EA050C8E256}" + ProjectSection(SolutionItems) = preProject + ..\baconfig.h = ..\baconfig.h + ..\bacula.h = ..\bacula.h + ..\bc_types.h = ..\bc_types.h + ..\jcr.h = ..\jcr.h + ..\version.h = ..\version.h + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baculadird", "dird\dird.vcproj", "{D03415F7-654E-42F4-B0E9-CB8FBE3F22FA}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} = {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baculasd", "stored\baculasd\baculasd.vcproj", "{F5F063F8-11A1-475A-82E2-19759BB40B25}" + ProjectSection(ProjectDependencies) = postProject + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bcopy", "stored\bcopy\bcopy.vcproj", "{614CE916-0972-4126-9392-CD9FC0ADD7DE}" + ProjectSection(ProjectDependencies) = postProject + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bextract", "stored\bextract\bextract.vcproj", "{6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}" + ProjectSection(ProjectDependencies) = postProject + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bls", "stored\bls\bls.vcproj", "{F8AF7D74-2918-422B-A7B6-4D98566B7160}" + ProjectSection(ProjectDependencies) = postProject + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bscan", "stored\bscan\bscan.vcproj", "{56EADEDB-FBED-4758-8B54-7B0B47ABDABF}" + ProjectSection(ProjectDependencies) = postProject + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "btape", "stored\btape\btape.vcproj", "{496415E0-AF44-4AD8-8C99-91B837DDF469}" + ProjectSection(ProjectDependencies) = postProject + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "storelib", "stored\storelib\storelib.vcproj", "{CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} = {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "postest", "stored\postest\postest.vcproj", "{208D3989-794B-47A2-9D04-D7AEE1524078}" + ProjectSection(ProjectDependencies) = postProject + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{0377E151-3352-487B-A5CF-24BCDC9EC43F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test Tools", "Test Tools", "{D6767108-F420-41C0-A834-2E6F487E1AB3}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Daemons", "Daemons", "{B9099DDA-18C9-4DE0-AECB-5D8139EA619F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{37F903FE-3474-4C93-AD5B-987CB6A92E62}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Consoles", "Consoles", "{C66C8B3B-C156-4498-91E9-CA9A24CF9051}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bacula", "bacula\bacula.vcproj", "{2D729599-C008-4154-BCCB-53E6A260F220}" + ProjectSection(ProjectDependencies) = postProject + {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cats_mysql", "cats\cats_mysql\cats_mysql.vcproj", "{B52BD53B-0E57-4E9A-A601-8E8171BA1CFC}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} = {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bacula_cats", "cats\bacula_cats\bacula_cats.vcproj", "{8B79A2B5-8889-43D4-9B92-9AE8A6F00413}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dbcheck", "tools\dbcheck\dbcheck.vcproj", "{85696E20-777A-41F6-BC00-2E7AB375B171}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} = {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cats_postgresql", "cats\cats_postgresql\cats_postgresql.vcproj", "{2FB961E5-213C-4475-8CB3-72F904D40752}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scsilist", "tools\scsilist\scsilist.vcproj", "{56D8C233-610E-4EE4-A73A-72CEF1C6A33A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer\installer.vcproj", "{6D1B0964-FB32-4916-A61C-49D7F715EAD8}" + ProjectSection(ProjectDependencies) = postProject + {A0F65E06-9F18-40AC-81F6-A080852F1104} = {A0F65E06-9F18-40AC-81F6-A080852F1104} + {9BA8E10D-0D82-4B25-8543-DE34641FBC10} = {9BA8E10D-0D82-4B25-8543-DE34641FBC10} + {614CE916-0972-4126-9392-CD9FC0ADD7DE} = {614CE916-0972-4126-9392-CD9FC0ADD7DE} + {85696E20-777A-41F6-BC00-2E7AB375B171} = {85696E20-777A-41F6-BC00-2E7AB375B171} + {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F} = {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F} + {56D8C233-610E-4EE4-A73A-72CEF1C6A33A} = {56D8C233-610E-4EE4-A73A-72CEF1C6A33A} + {23BFE838-5682-4F39-969F-0B40366D4D98} = {23BFE838-5682-4F39-969F-0B40366D4D98} + {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC} = {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC} + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} + {F8AF7D74-2918-422B-A7B6-4D98566B7160} = {F8AF7D74-2918-422B-A7B6-4D98566B7160} + {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A} + {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA} = {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA} + {AB67F297-8491-4515-8E52-BFF5340EC242} = {AB67F297-8491-4515-8E52-BFF5340EC242} + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + {0F56AEB0-14DA-4A80-8962-1F85A17339D0} = {0F56AEB0-14DA-4A80-8962-1F85A17339D0} + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} = {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} + {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B} = {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B} + {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF} = {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF} + {56EADEDB-FBED-4758-8B54-7B0B47ABDABF} = {56EADEDB-FBED-4758-8B54-7B0B47ABDABF} + {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E} = {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E} + {496415E0-AF44-4AD8-8C99-91B837DDF469} = {496415E0-AF44-4AD8-8C99-91B837DDF469} + {2FB961E5-213C-4475-8CB3-72F904D40752} = {2FB961E5-213C-4475-8CB3-72F904D40752} + {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA} = {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA} + {F5F063F8-11A1-475A-82E2-19759BB40B25} = {F5F063F8-11A1-475A-82E2-19759BB40B25} + {558838F9-D792-4F56-AAB2-99C03687C5FF} = {558838F9-D792-4F56-AAB2-99C03687C5FF} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bsleep", "scripts\bsleep.vcproj", "{0F56AEB0-14DA-4A80-8962-1F85A17339D0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bsmtp", "tools\bsmtp\bsmtp.vcproj", "{AB67F297-8491-4515-8E52-BFF5340EC242}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +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 + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cats_sqlite3", "cats\cats_sqlite3\cats_sqlite3.vcproj", "{23BFE838-5682-4F39-969F-0B40366D4D98}" + ProjectSection(ProjectDependencies) = postProject + {2D729599-C008-4154-BCCB-53E6A260F220} = {2D729599-C008-4154-BCCB-53E6A260F220} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Win32 = Debug|Win32 + Release|Any CPU = Release|Any CPU + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Debug|Win32.ActiveCfg = Debug|Win32 + {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Debug|Win32.Build.0 = Debug|Win32 + {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Release|Any CPU.ActiveCfg = Release|Win32 + {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Release|Win32.ActiveCfg = Release|Win32 + {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Release|Win32.Build.0 = Release|Win32 + {A0F65E06-9F18-40AC-81F6-A080852F1104}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {A0F65E06-9F18-40AC-81F6-A080852F1104}.Debug|Win32.ActiveCfg = Debug|Win32 + {A0F65E06-9F18-40AC-81F6-A080852F1104}.Debug|Win32.Build.0 = Debug|Win32 + {A0F65E06-9F18-40AC-81F6-A080852F1104}.Release|Any CPU.ActiveCfg = Release|Win32 + {A0F65E06-9F18-40AC-81F6-A080852F1104}.Release|Win32.ActiveCfg = Release|Win32 + {A0F65E06-9F18-40AC-81F6-A080852F1104}.Release|Win32.Build.0 = Release|Win32 + {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}.Debug|Win32.ActiveCfg = Debug|Win32 + {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}.Debug|Win32.Build.0 = Debug|Win32 + {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}.Release|Any CPU.ActiveCfg = Release|Win32 + {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}.Release|Win32.ActiveCfg = Release|Win32 + {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}.Release|Win32.Build.0 = Release|Win32 + {374BF775-AF68-4A88-814A-48F692DFFE5A}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {374BF775-AF68-4A88-814A-48F692DFFE5A}.Debug|Win32.ActiveCfg = Debug|Win32 + {374BF775-AF68-4A88-814A-48F692DFFE5A}.Debug|Win32.Build.0 = Debug|Win32 + {374BF775-AF68-4A88-814A-48F692DFFE5A}.Release|Any CPU.ActiveCfg = Release|Win32 + {374BF775-AF68-4A88-814A-48F692DFFE5A}.Release|Win32.ActiveCfg = Release|Win32 + {374BF775-AF68-4A88-814A-48F692DFFE5A}.Release|Win32.Build.0 = Release|Win32 + {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}.Debug|Win32.ActiveCfg = Debug|Win32 + {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}.Debug|Win32.Build.0 = Debug|Win32 + {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}.Release|Any CPU.ActiveCfg = Release|Win32 + {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}.Release|Win32.ActiveCfg = Release|Win32 + {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}.Release|Win32.Build.0 = Release|Win32 + {558838F9-D792-4F56-AAB2-99C03687C5FF}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {558838F9-D792-4F56-AAB2-99C03687C5FF}.Debug|Win32.ActiveCfg = Debug|Win32 + {558838F9-D792-4F56-AAB2-99C03687C5FF}.Debug|Win32.Build.0 = Debug|Win32 + {558838F9-D792-4F56-AAB2-99C03687C5FF}.Release|Any CPU.ActiveCfg = Release|Win32 + {558838F9-D792-4F56-AAB2-99C03687C5FF}.Release|Win32.ActiveCfg = Release|Win32 + {558838F9-D792-4F56-AAB2-99C03687C5FF}.Release|Win32.Build.0 = Release|Win32 + {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}.Debug|Win32.ActiveCfg = Debug|Win32 + {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}.Debug|Win32.Build.0 = Debug|Win32 + {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}.Release|Any CPU.ActiveCfg = Release|Win32 + {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}.Release|Win32.ActiveCfg = Release|Win32 + {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}.Release|Win32.Build.0 = Release|Win32 + {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}.Debug|Win32.ActiveCfg = Debug|Win32 + {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}.Debug|Win32.Build.0 = Debug|Win32 + {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}.Release|Any CPU.ActiveCfg = Release|Win32 + {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}.Release|Win32.ActiveCfg = Release|Win32 + {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}.Release|Win32.Build.0 = Release|Win32 + {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA}.Debug|Win32.ActiveCfg = Debug|Win32 + {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA}.Debug|Win32.Build.0 = Debug|Win32 + {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA}.Release|Any CPU.ActiveCfg = Release|Win32 + {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA}.Release|Win32.ActiveCfg = Release|Win32 + {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA}.Release|Win32.Build.0 = Release|Win32 + {F5F063F8-11A1-475A-82E2-19759BB40B25}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {F5F063F8-11A1-475A-82E2-19759BB40B25}.Debug|Win32.ActiveCfg = Debug|Win32 + {F5F063F8-11A1-475A-82E2-19759BB40B25}.Debug|Win32.Build.0 = Debug|Win32 + {F5F063F8-11A1-475A-82E2-19759BB40B25}.Release|Any CPU.ActiveCfg = Release|Win32 + {F5F063F8-11A1-475A-82E2-19759BB40B25}.Release|Win32.ActiveCfg = Release|Win32 + {F5F063F8-11A1-475A-82E2-19759BB40B25}.Release|Win32.Build.0 = Release|Win32 + {614CE916-0972-4126-9392-CD9FC0ADD7DE}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {614CE916-0972-4126-9392-CD9FC0ADD7DE}.Debug|Win32.ActiveCfg = Debug|Win32 + {614CE916-0972-4126-9392-CD9FC0ADD7DE}.Debug|Win32.Build.0 = Debug|Win32 + {614CE916-0972-4126-9392-CD9FC0ADD7DE}.Release|Any CPU.ActiveCfg = Release|Win32 + {614CE916-0972-4126-9392-CD9FC0ADD7DE}.Release|Win32.ActiveCfg = Release|Win32 + {614CE916-0972-4126-9392-CD9FC0ADD7DE}.Release|Win32.Build.0 = Release|Win32 + {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}.Debug|Win32.ActiveCfg = Debug|Win32 + {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}.Debug|Win32.Build.0 = Debug|Win32 + {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}.Release|Any CPU.ActiveCfg = Release|Win32 + {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}.Release|Win32.ActiveCfg = Release|Win32 + {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}.Release|Win32.Build.0 = Release|Win32 + {F8AF7D74-2918-422B-A7B6-4D98566B7160}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {F8AF7D74-2918-422B-A7B6-4D98566B7160}.Debug|Win32.ActiveCfg = Debug|Win32 + {F8AF7D74-2918-422B-A7B6-4D98566B7160}.Debug|Win32.Build.0 = Debug|Win32 + {F8AF7D74-2918-422B-A7B6-4D98566B7160}.Release|Any CPU.ActiveCfg = Release|Win32 + {F8AF7D74-2918-422B-A7B6-4D98566B7160}.Release|Win32.ActiveCfg = Release|Win32 + {F8AF7D74-2918-422B-A7B6-4D98566B7160}.Release|Win32.Build.0 = Release|Win32 + {56EADEDB-FBED-4758-8B54-7B0B47ABDABF}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {56EADEDB-FBED-4758-8B54-7B0B47ABDABF}.Debug|Win32.ActiveCfg = Debug|Win32 + {56EADEDB-FBED-4758-8B54-7B0B47ABDABF}.Debug|Win32.Build.0 = Debug|Win32 + {56EADEDB-FBED-4758-8B54-7B0B47ABDABF}.Release|Any CPU.ActiveCfg = Release|Win32 + {56EADEDB-FBED-4758-8B54-7B0B47ABDABF}.Release|Win32.ActiveCfg = Release|Win32 + {56EADEDB-FBED-4758-8B54-7B0B47ABDABF}.Release|Win32.Build.0 = Release|Win32 + {496415E0-AF44-4AD8-8C99-91B837DDF469}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {496415E0-AF44-4AD8-8C99-91B837DDF469}.Debug|Win32.ActiveCfg = Debug|Win32 + {496415E0-AF44-4AD8-8C99-91B837DDF469}.Debug|Win32.Build.0 = Debug|Win32 + {496415E0-AF44-4AD8-8C99-91B837DDF469}.Release|Any CPU.ActiveCfg = Release|Win32 + {496415E0-AF44-4AD8-8C99-91B837DDF469}.Release|Win32.ActiveCfg = Release|Win32 + {496415E0-AF44-4AD8-8C99-91B837DDF469}.Release|Win32.Build.0 = Release|Win32 + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}.Debug|Win32.ActiveCfg = Debug|Win32 + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}.Debug|Win32.Build.0 = Debug|Win32 + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}.Release|Any CPU.ActiveCfg = Release|Win32 + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}.Release|Win32.ActiveCfg = Release|Win32 + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}.Release|Win32.Build.0 = Release|Win32 + {208D3989-794B-47A2-9D04-D7AEE1524078}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {208D3989-794B-47A2-9D04-D7AEE1524078}.Debug|Win32.ActiveCfg = Debug|Win32 + {208D3989-794B-47A2-9D04-D7AEE1524078}.Release|Any CPU.ActiveCfg = Release|Win32 + {208D3989-794B-47A2-9D04-D7AEE1524078}.Release|Win32.ActiveCfg = Release|Win32 + {2D729599-C008-4154-BCCB-53E6A260F220}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {2D729599-C008-4154-BCCB-53E6A260F220}.Debug|Win32.ActiveCfg = Debug|Win32 + {2D729599-C008-4154-BCCB-53E6A260F220}.Debug|Win32.Build.0 = Debug|Win32 + {2D729599-C008-4154-BCCB-53E6A260F220}.Release|Any CPU.ActiveCfg = Release|Win32 + {2D729599-C008-4154-BCCB-53E6A260F220}.Release|Win32.ActiveCfg = Release|Win32 + {2D729599-C008-4154-BCCB-53E6A260F220}.Release|Win32.Build.0 = Release|Win32 + {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC}.Debug|Win32.ActiveCfg = Debug|Win32 + {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC}.Debug|Win32.Build.0 = Debug|Win32 + {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC}.Release|Any CPU.ActiveCfg = Release|Win32 + {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC}.Release|Win32.ActiveCfg = Release|Win32 + {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC}.Release|Win32.Build.0 = Release|Win32 + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413}.Debug|Win32.ActiveCfg = Debug|Win32 + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413}.Debug|Win32.Build.0 = Debug|Win32 + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413}.Release|Any CPU.ActiveCfg = Release|Win32 + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413}.Release|Win32.ActiveCfg = Release|Win32 + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413}.Release|Win32.Build.0 = Release|Win32 + {85696E20-777A-41F6-BC00-2E7AB375B171}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {85696E20-777A-41F6-BC00-2E7AB375B171}.Debug|Win32.ActiveCfg = Debug|Win32 + {85696E20-777A-41F6-BC00-2E7AB375B171}.Debug|Win32.Build.0 = Debug|Win32 + {85696E20-777A-41F6-BC00-2E7AB375B171}.Release|Any CPU.ActiveCfg = Release|Win32 + {85696E20-777A-41F6-BC00-2E7AB375B171}.Release|Win32.ActiveCfg = Release|Win32 + {85696E20-777A-41F6-BC00-2E7AB375B171}.Release|Win32.Build.0 = Release|Win32 + {2FB961E5-213C-4475-8CB3-72F904D40752}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {2FB961E5-213C-4475-8CB3-72F904D40752}.Debug|Win32.ActiveCfg = Debug|Win32 + {2FB961E5-213C-4475-8CB3-72F904D40752}.Debug|Win32.Build.0 = Debug|Win32 + {2FB961E5-213C-4475-8CB3-72F904D40752}.Release|Any CPU.ActiveCfg = Release|Win32 + {2FB961E5-213C-4475-8CB3-72F904D40752}.Release|Win32.ActiveCfg = Release|Win32 + {2FB961E5-213C-4475-8CB3-72F904D40752}.Release|Win32.Build.0 = Release|Win32 + {56D8C233-610E-4EE4-A73A-72CEF1C6A33A}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {56D8C233-610E-4EE4-A73A-72CEF1C6A33A}.Debug|Win32.ActiveCfg = Debug|Win32 + {56D8C233-610E-4EE4-A73A-72CEF1C6A33A}.Debug|Win32.Build.0 = Debug|Win32 + {56D8C233-610E-4EE4-A73A-72CEF1C6A33A}.Release|Any CPU.ActiveCfg = Release|Win32 + {56D8C233-610E-4EE4-A73A-72CEF1C6A33A}.Release|Win32.ActiveCfg = Release|Win32 + {56D8C233-610E-4EE4-A73A-72CEF1C6A33A}.Release|Win32.Build.0 = Release|Win32 + {6D1B0964-FB32-4916-A61C-49D7F715EAD8}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {6D1B0964-FB32-4916-A61C-49D7F715EAD8}.Debug|Win32.ActiveCfg = Debug|Win32 + {6D1B0964-FB32-4916-A61C-49D7F715EAD8}.Debug|Win32.Build.0 = Debug|Win32 + {6D1B0964-FB32-4916-A61C-49D7F715EAD8}.Release|Any CPU.ActiveCfg = Release|Win32 + {6D1B0964-FB32-4916-A61C-49D7F715EAD8}.Release|Win32.ActiveCfg = Release|Win32 + {6D1B0964-FB32-4916-A61C-49D7F715EAD8}.Release|Win32.Build.0 = Release|Win32 + {0F56AEB0-14DA-4A80-8962-1F85A17339D0}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {0F56AEB0-14DA-4A80-8962-1F85A17339D0}.Debug|Win32.ActiveCfg = Debug|Win32 + {0F56AEB0-14DA-4A80-8962-1F85A17339D0}.Debug|Win32.Build.0 = Debug|Win32 + {0F56AEB0-14DA-4A80-8962-1F85A17339D0}.Release|Any CPU.ActiveCfg = Release|Win32 + {0F56AEB0-14DA-4A80-8962-1F85A17339D0}.Release|Win32.ActiveCfg = Release|Win32 + {0F56AEB0-14DA-4A80-8962-1F85A17339D0}.Release|Win32.Build.0 = Release|Win32 + {AB67F297-8491-4515-8E52-BFF5340EC242}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {AB67F297-8491-4515-8E52-BFF5340EC242}.Debug|Win32.ActiveCfg = Debug|Win32 + {AB67F297-8491-4515-8E52-BFF5340EC242}.Debug|Win32.Build.0 = Debug|Win32 + {AB67F297-8491-4515-8E52-BFF5340EC242}.Release|Any CPU.ActiveCfg = Release|Win32 + {AB67F297-8491-4515-8E52-BFF5340EC242}.Release|Win32.ActiveCfg = Release|Win32 + {AB67F297-8491-4515-8E52-BFF5340EC242}.Release|Win32.Build.0 = Release|Win32 + {23BFE838-5682-4F39-969F-0B40366D4D98}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {23BFE838-5682-4F39-969F-0B40366D4D98}.Debug|Win32.ActiveCfg = Debug|Win32 + {23BFE838-5682-4F39-969F-0B40366D4D98}.Debug|Win32.Build.0 = Debug|Win32 + {23BFE838-5682-4F39-969F-0B40366D4D98}.Release|Any CPU.ActiveCfg = Release|Win32 + {23BFE838-5682-4F39-969F-0B40366D4D98}.Release|Win32.ActiveCfg = Release|Win32 + {23BFE838-5682-4F39-969F-0B40366D4D98}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {A0F65E06-9F18-40AC-81F6-A080852F1104} = {C66C8B3B-C156-4498-91E9-CA9A24CF9051} + {9BA8E10D-0D82-4B25-8543-DE34641FBC10} = {C66C8B3B-C156-4498-91E9-CA9A24CF9051} + {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F} = {D6767108-F420-41C0-A834-2E6F487E1AB3} + {558838F9-D792-4F56-AAB2-99C03687C5FF} = {D6767108-F420-41C0-A834-2E6F487E1AB3} + {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF} = {D6767108-F420-41C0-A834-2E6F487E1AB3} + {208D3989-794B-47A2-9D04-D7AEE1524078} = {D6767108-F420-41C0-A834-2E6F487E1AB3} + {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E} = {D6767108-F420-41C0-A834-2E6F487E1AB3} + {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {0377E151-3352-487B-A5CF-24BCDC9EC43F} + {374BF775-AF68-4A88-814A-48F692DFFE5A} = {0377E151-3352-487B-A5CF-24BCDC9EC43F} + {2D729599-C008-4154-BCCB-53E6A260F220} = {0377E151-3352-487B-A5CF-24BCDC9EC43F} + {B52BD53B-0E57-4E9A-A601-8E8171BA1CFC} = {0377E151-3352-487B-A5CF-24BCDC9EC43F} + {8B79A2B5-8889-43D4-9B92-9AE8A6F00413} = {0377E151-3352-487B-A5CF-24BCDC9EC43F} + {2FB961E5-213C-4475-8CB3-72F904D40752} = {0377E151-3352-487B-A5CF-24BCDC9EC43F} + {23BFE838-5682-4F39-969F-0B40366D4D98} = {0377E151-3352-487B-A5CF-24BCDC9EC43F} + {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA} = {B9099DDA-18C9-4DE0-AECB-5D8139EA619F} + {F5F063F8-11A1-475A-82E2-19759BB40B25} = {B9099DDA-18C9-4DE0-AECB-5D8139EA619F} + {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B} = {B9099DDA-18C9-4DE0-AECB-5D8139EA619F} + {C8301485-CFD1-43D4-827C-8EA050C8E256} = {825DFFD0-4747-43CA-8326-529655E31935} + {40CADEE4-8D53-4157-AA36-B256F4934FC3} = {825DFFD0-4747-43CA-8326-529655E31935} + {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + {F8AF7D74-2918-422B-A7B6-4D98566B7160} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + {56EADEDB-FBED-4758-8B54-7B0B47ABDABF} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + {496415E0-AF44-4AD8-8C99-91B837DDF469} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + {614CE916-0972-4126-9392-CD9FC0ADD7DE} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + {85696E20-777A-41F6-BC00-2E7AB375B171} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + {56D8C233-610E-4EE4-A73A-72CEF1C6A33A} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + {0F56AEB0-14DA-4A80-8962-1F85A17339D0} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + {AB67F297-8491-4515-8E52-BFF5340EC242} = {37F903FE-3474-4C93-AD5B-987CB6A92E62} + EndGlobalSection +EndGlobal diff --git a/bacula/src/win32/bacula/bacula.vcproj b/bacula/src/win32/bacula/bacula.vcproj new file mode 100644 index 0000000000..ae9fe374a2 --- /dev/null +++ b/bacula/src/win32/bacula/bacula.vcproj @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/build-depkgs-mingw-w64 b/bacula/src/win32/build-depkgs-mingw-w64 new file mode 100755 index 0000000000..b688e6e63f --- /dev/null +++ b/bacula/src/win32/build-depkgs-mingw-w64 @@ -0,0 +1,451 @@ +#!/bin/sh +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# This file may help you build the dependency packages that +# are needed to cross compile the Win64 bit version of the Bacula +# File daemon. This file is provided as is, and we don't guarantee +# that it will work. We run it only on Ubuntu Hardy. Trying to use +# it on any other GNU/Linux distro will probably require changes. +# +# This file is driven by the parameters that are defined in +# the file External-mingw-w64 +# + +usage() +{ + echo "usage: $0 [-h] [-C] [] [] ..." + echo " -h Displays this usage" + echo " -C Clobbers (overwrites) the source code by " + echo " reextracting the archive and reapplying the" + echo " patches." + echo "" + echo " Optional dependency, If none are given then all" + echo " of them will be built." + echo "" + echo "Valid dependencies are:" + grep -v '^#' < External-mingw-w64 | cut -d'|' -f1 | cut -d'_' -f1 | tr A-Z a-z | sort -u | awk '{ print " " $1 }' +} + +CLOBBER_SOURCE= + +while getopts "hHC" opt; do + case ${opt} in + H|h|\?) usage;exit 1;; + C) CLOBBER_SOURCE=true;; + esac +done + +[ ${OPTIND} -gt 1 ] && shift `expr ${OPTIND} - 1` + +cwd=`pwd` +cd `dirname $0` +SCRIPT_DIR=`pwd` + +cd ../../.. +TOP_DIR=`pwd` +TOP_DIR=${DEPKGS:-${TOP_DIR}} + +if [ -e ${TOP_DIR}/cross-tools/mingw-w64/bin/x86_64-pc-mingw32-gcc ] +then + cd ${TOP_DIR}/cross-tools/mingw-w64/bin + BIN_DIR=`pwd` + +elif which x86_64-w64-mingw32-gcc > /dev/null; then + BIN_DIR= + BASE=x86_64-w64-mingw32 + +else + echo "The GCC cross compiler is not installed." + echo "You must run build-win64-cross-tools first" + exit 1 +fi + +[ ! -e ${TOP_DIR}/depkgs-mingw-w64 ] && mkdir ${TOP_DIR}/depkgs-mingw-w64 +cd ${TOP_DIR}/depkgs-mingw-w64 +DEPPKG_DIR=`pwd` + +export PATH=${BIN_DIR}:${PATH} + +[ ! -e bin ] && mkdir bin +[ ! -e src ] && mkdir src +[ ! -e include ] && mkdir include +[ ! -e lib ] && mkdir lib + +OLD_IFS=${IFS};IFS="|"; +while read package url dir mkd; do + echo "Got package ${package}" + case ${package} in + \#*) ;; + *) eval "URL_${package}=${url};DIR_${package}=${dir};MKD_${package}=${mkd}";; + esac +done < ${SCRIPT_DIR}/External-mingw-w64 +IFS=${OLD_IFS};unset OLD_IFS + +get_source() +{ + URL=$1 + SRC_DIR=$2 + MAKE_DIR=$3 + echo "Processing ${URL}" + ARCHIVE=`basename ${URL}` + + case ${ARCHIVE} in + *.tar.gz) ARCHIVER="tar xzf"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.tar\.gz'`;; + *.tar.bz2) ARCHIVER="tar xjf"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.tar\.bz2'`;; + *.zip) ARCHIVER="unzip -d ."; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.zip'`;; + *.exe) ARCHIVER=""; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.zip'`;; + *) echo Unsupported archive type - $ARCHIVE; exit 1;; + esac + + cd ${DEPPKG_DIR}/src + + if [ ! -e "${ARCHIVE}" ] + then + echo Downloading "${URL}" + if wget --passive-ftp "${URL}" + then + : + else + echo Unable to download ${ARCHIVE} + exit 1 + fi + fi + + [ -z "${ARCHIVER}" ] && return 0 + + if [ ! -e "${SRC_DIR}" -o "${CLOBBER_SOURCE}" = "true" ] + then + rm -rf ${SRC_DIR} + echo Extracting ${ARCHIVE} + if [ "${MAKE_DIR}" = "true" ] + then + mkdir ${SRC_DIR} + cd ${SRC_DIR} + ${ARCHIVER} ../${ARCHIVE} > ../${ARCHIVE}.log 2>&1 + else + ${ARCHIVER} ${ARCHIVE} > ${ARCHIVE}.log 2>&1 + cd ${SRC_DIR} + fi + return 0 + fi + + cd ${SRC_DIR} + return 1 +} + +parse_output() +{ + sed -ne '/\\$/N' -e 's/\\\n//' -e 's/\t\+/ /g' -e 's/ \+/ /g' \ + -e '/ error: /p' \ + -e "s%.*Entering directory[ ]\\+.${DEPPKG_DIR}/\\([^ ]\+\).%Entering \\1%p" \ + -e "s%.*Leaving directory[ ]\\+.${DEPPKG_DIR}/\\([^ ]\+.\).%Leaving \\1%p" \ + -e '/gcc \|g\+\+ \|ar /!d' \ + -e 's/ \(\.\.\/\)\+/ /g' \ + -e 's/.* \([^ ]\+\(\.c\|\.cpp\|\.cc\|\.cxx\)\)\( .*\|\)$/Compiling \1/p' \ + -e 's/.* \([^ ]\+\.s\)\( .*\|\)$/Assembling \1/p' \ + -e 's/.*ar [^ ]\+ \([^ ]\+\)\(\( [^ ]\+\.o\)\+\)/Updating \1 -\2/p' \ + -e 's/.* -o \([^ ]\+\)\( .*\|\)$/Linking \1/p' +} + +do_patch() +{ + PATCH_FILE=${SCRIPT_DIR}/patches/$1; shift + + if patch -f -p0 "$@" >>patch.log < ${PATCH_FILE} + then + : + else + echo "Patch failed - Check `pwd`/patch.log" > /dev/tty + exit 1 + fi +} + +do_make() +{ + if make -f "$@" 2>&1 + then + : + else + echo "Make failed - Check `pwd`/make.log" > /dev/tty + exit 1 + fi | tee -a make.log | parse_output +} + +process_rsync() +{ + get_source "${URL_RSYNC}" "${DIR_RSYNC}" "${MKD_RSYNC}" + ./configure --host=${BASE} + make -k # rdiff.exe has a problem + cp .libs/librsync.a ${DEPPKG_DIR}/lib + cp librsync*h ${DEPPKG_DIR}/include +} + +process_zlib() +{ + if get_source "${URL_ZLIB}" "${DIR_ZLIB}" "${MKD_ZLIB}" + then + true + fi + echo Building zlib + > make.log + do_make win32/Makefile.gcc PREFIX=${BASE}- DESTDIR=${DEPPKG_DIR}/ all + echo Installing zlib + do_make win32/Makefile.gcc PREFIX=${BASE}- DESTDIR=${DEPPKG_DIR}/ LIBRARY_PATH=lib BINARY_PATH=bin INCLUDE_PATH=include SHARED_MODE=1 install +} + +process_pcre() +{ + if get_source "${URL_PCRE}" "${DIR_PCRE}" "${MKD_PCRE}" + then + echo Patching PCRE + >patch.log + do_patch pcre.patch + echo Configuring PCRE + ./configure CC_FOR_BUILD=gcc \ + CXX_FOR_BUILD=g++ \ + --host=${BASE} \ + --prefix=${DEPPKG_DIR} \ + --enable-utf8 \ + --enable-unicode-properties >make.log 2>&1 + fi + echo Building PCRE + do_make Makefile PREFIX=${DEPPKG_DIR} all + echo Installing PCRE + do_make Makefile PREFIX=${DEPPKG_DIR} install +} + +process_db() +{ + if get_source "${URL_DB}" "${DIR_DB}" "${MKD_DB}" + then + echo "No patch needed for this package" + fi + cd build_unix + ../dist/configure --host=${BASE} --enable-mingw --prefix=${DEPPKG_DIR} + > make.log + echo Building DB + do_make Makefile + echo Installing DB + do_make Makefile install_setup install_include install_lib +} + +process_pthreads() +{ + if get_source "${URL_PTHREADS}" "${DIR_PTHREADS}" "${MKD_PTHREADS}" + then + echo "No patch needed for this package" + fi + echo Building pthreads + cd pthreads.2 + > make.log + do_make GNUmakefile CROSS=${BASE}- clean GCE-inlined + echo Installing pthreads + rm -rf ${DEPPKG_DIR}/include/pthreads + mkdir ${DEPPKG_DIR}/include/pthreads + cp -p *.h ${DEPPKG_DIR}/include/pthreads + cp -p *.dll ${DEPPKG_DIR}/bin + cp -p *.a ${DEPPKG_DIR}/lib +} + +process_openssl() +{ + if get_source "${URL_OPENSSL}" "${DIR_OPENSSL}" "${MKD_OPENSSL}" + then + echo Configuring openssl + CROSS_COMPILE=${BASE}- ./Configure --prefix=${DEPPKG_DIR} \ + shared zlib-dynamic \ + threads \ + --with-zlib-include=${DEPPKG_DIR}/include \ + mingw64 > make.log 2>&1 + fi + echo Building openssl + do_make Makefile all + echo Installing openssl + do_make Makefile -k install_sw install + cp *.dll ${DEPPKG_DIR}/bin +} + +process_lzo() +{ + if get_source "${URL_LZO}" "${DIR_LZO}" "${MKD_LZO}" + then + sed -i s/-lwinmm// configure + fi + echo Building lzo + ./configure --host=${BASE} --prefix=${DEPPKG_DIR}/ + echo Installing lzo + do_make Makefile -k PREFIX=${DEPPKG_DIR}/ all + do_make Makefile -k PREFIX=${DEPPKG_DIR}/ install +} + +process_qt4() +{ + if get_source "${URL_Qt4}" "${DIR_Qt4}" "${MKD_Qt4}" + then + echo Patching Qt4 + >patch.log + patch -p1 < ${SCRIPT_DIR}/patches/qt4-intrinsics.patch + patch -p1 < ${SCRIPT_DIR}/patches/qt4-widget-ui.patch + patch -p1 < ${SCRIPT_DIR}/patches/qt4-compilation-see.patch + patch -p1 < ${SCRIPT_DIR}/patches/qt4-compilation.patch + fi + echo "Configuring Qt4" + ./configure -opensource -confirm-license -fast -xplatform win32-g++-4.6 \ + -device-option CROSS_COMPILE=x86_64-w64-mingw32- -device-option \ + PKG_CONFIG='x86_64-w64-mingw32-pkg-config' -force-pkg-config -release \ + -exceptions -shared -prefix ${DEPPKG_DIR}/qt-out -prefix-install -no-script \ + -no-iconv -no-webkit -no-glib -no-gstreamer -no-phonon -no-phonon-backend \ + -accessibility -no-reduce-exports -no-rpath -make libs -nomake demos \ + -nomake docs -nomake examples -system-zlib -no-mitshm -no-libjpeg \ + -no-libmng -no-libtiff -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci \ + -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 \ + -no-sql-sqlite_symbian -no-sql-symsql -no-sql-tds -no-nis -no-cups -no-dbus \ + -no-openvg -no-openssl -no-nas-sound -no-audio-backend -no-sm -no-opengl \ + -no-javascript-jit -no-qt3support -nomake tools \ + -no-xmlpatterns -no-multimedia -nomake tools -silent + + local qt_source_dir=`pwd` + # Required libz.dll.a, zlib.h and zconf.h for proper Qt build purpose + process_zlib + cd "${qt_source_dir}" + local zlib_dir=`basename "${URL_ZLIB}" | sed 's/.tar.gz//'` + cp "../${zlib_dir}/libz.dll.a" ./lib/ + cp "../${zlib_dir}/zlib.h" ./include/ + cp "../${zlib_dir}/zconf.h" ./include/ + + make + + echo "Installing Qt4" + rm -rf ${DEPPKG_DIR}/include/qt ${DEPPKG_DIR}/lib/qt + mkdir -p ${DEPPKG_DIR}/include/qt ${DEPPKG_DIR}/lib/qt + cp -rf include/* ${DEPPKG_DIR}/include/qt + cp -rf lib/* ${DEPPKG_DIR}/lib/qt + cp -rf src/corelib ${DEPPKG_DIR}/src/ + cp -rf src/gui ${DEPPKG_DIR}/src/ + cp -rf lib/QtCore4.dll lib/QtGui4.dll ${DEPPKG_DIR}/bin/ + cp -rf lib/QtCore4.dll lib/QtGui4.dll ${DEPPKG_DIR}/lib/qt/ +} + + +process_mingw() +{ + if test -f /usr/lib/gcc/${BASE}/*posix/libstdc++-6.dll; then + cp -f /usr/lib/gcc/${BASE}/*posix/libstdc++-6.dll ${DEPPKG_DIR}/bin + cp -f /usr/lib/gcc/${BASE}/*posix/libgcc*dll ${DEPPKG_DIR}/bin + elif test -f /usr/lib/gcc/${BASE}/*/libstdc++-6.dll; then + cp -f /usr/${BASE}/lib/libstdc++-6.dll ${DEPPKG_DIR}/bin + cp -f /usr/${BASE}/lib/libgcc*dll ${DEPPKG_DIR}/bin + else + echo "ERROR: Unable to find ${BASE} on this system" + fi + if test -f /usr/$BASE/lib/libwinpthread-1.dll; then + cp -f /usr/$BASE/lib/libwinpthread-1.dll ${DEPPKG_DIR}/bin + fi +} + +process_mtx() +{ + if get_source "${URL_MTX}" "${DIR_MTX}" "${MKD_MTX}" + then + echo Patching mtx + # We can't run configure in a cross-compile environment so we + # patch the files to the correct values + cp -f config.h.in config.h + cp -f Makefile.in Makefile + rm -f configure + >patch.log + do_patch mtx.patch + fi + echo Building mtx + do_make Makefile prefix=${DEPPKG_DIR} all + echo Installing mtx + do_make Makefile prefix=${DEPPKG_DIR} install +} + +process_mt() +{ + if get_source "${URL_MT}" "${DIR_MT}" "${MKD_MT}" + then + echo "Patching mt" + >patch.log + do_patch mt.patch + fi + echo "Building mt" + do_make Makefile PREFIX=${DEPPKG_DIR} all + echo Installing mt + do_make Makefile PREFIX=${DEPPKG_DIR} install +} + +process_sed() +{ + if get_source "${URL_SED}" "${DIR_SED}" "${MKD_SED}" + then + echo Patching sed + >patch.log + # patch not needed for 4.2k which is already updated + # do_patch sed.patch + echo Configuring sed + ./configure --host=$BASE \ + --prefix=${DEPPKG_DIR} \ + --disable-nls >make.log 2>&1 + fi + echo Building sed + do_make Makefile all + echo Installing sed + do_make Makefile install +} + +process_cmd_utils() +{ + if get_source "${URL_CMD_UTILS}" "${DIR_CMD_UTILS}" "${MKD_CMD_UTILS}" + then + # echo Patching cmd-utils + # >patch.log + # do_patch cmd-utils.patch + sed -i "s:strrchr:NULL;//:" expr64/expr64.cpp + echo Configuring cmd-utils + ./configure --host=$BASE \ + --prefix=${DEPPKG_DIR} \ + >make.log 2>&1 + fi + echo Building cmd-utils + do_make Makefile + echo Installing cmd-utils + do_make Makefile install +} + +# MSSQL dlls are created from Visual Studio +process_mssql() +{ + get_source "${URL_MSSQL}" "${DIR_MSSQL}" "${MKD_MSSQL}" + echo Installing MSSQL driver + cp include/*.h ${DEPPKG_DIR}/include + cp x64/mssql-driver.dll ${DEPPKG_DIR}/bin + cp x64/mssql-regression.exe ${DEPPKG_DIR}/bin +} + +if [ "$#" -eq 0 ] +then + process_mingw + process_rsync + process_lzo + process_zlib +# process_pcre + process_pthreads + process_openssl + process_qt4 + process_sed + process_cmd_utils + process_mssql +# process_mtx +# process_mt +else + for dependency in "$@" + do + eval "process_${dependency}" + done +fi +#vss +#Need to download from Microsoft diff --git a/bacula/src/win32/build-depkgs-mingw32 b/bacula/src/win32/build-depkgs-mingw32 new file mode 100755 index 0000000000..285e7cabd1 --- /dev/null +++ b/bacula/src/win32/build-depkgs-mingw32 @@ -0,0 +1,659 @@ +#!/bin/sh +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# +# This file is driven by the parameters that are defined in +# the file External-mingw32 +# + +usage() +{ + echo "usage: $0 [-h] [-C] [] [] ..." + echo " -h Displays this usage" + echo " -C Clobbers (overwrites) the source code by " + echo " reextracting the archive and reapplying the" + echo " patches." + echo " -A Rebuild everything (wipes out most of depkgs)" + echo "" + echo " Optional dependency, If none are given then all" + echo " of them will be built." + echo "" + echo "Valid dependencies are:" + grep -v '^#' < External-mingw32 | cut -d'|' -f1 | cut -d'_' -f1 | tr A-Z a-z | sort -u | awk '{ print " " $1 }' +} + +CLOBBER_SOURCE= +CLOBBER_ALL= + +while getopts "hHCA" opt; do + case ${opt} in + H|h|\?) usage;exit 1;; + C) CLOBBER_SOURCE=true;; + A) CLOBBER_ALL=true;; + esac +done + +[ ${OPTIND} -gt 1 ] && shift `expr ${OPTIND} - 1` + +cwd=`pwd` +cd `dirname $0` +SCRIPT_DIR=`pwd` + +cd ../../.. +TOP_DIR=`pwd` +TOP_DIR=${DEPKGS:-${TOP_DIR}} + +if [ -e ${TOP_DIR}/cross-tools/mingw32/bin/mingw32-gcc ]; then + cd ${TOP_DIR}/cross-tools/mingw32/bin + BIN_DIR=`pwd` + BASE=mingw32 +elif [ -e /mingw/bin/mingw32-gcc ]; then + BIN_DIR=/mingw/bin + BASE=mingw32 + +elif which i686-w64-mingw32-gcc > /dev/null; then + BIN_DIR= + BASE=i686-w64-mingw32 + +else + echo "The GCC cross compiler is not installed." + echo "You must run build-win32-cross-tools first" + exit 1 +fi + +[ ! -e ${TOP_DIR}/depkgs-mingw32 ] && mkdir ${TOP_DIR}/depkgs-mingw32 +cd ${TOP_DIR}/depkgs-mingw32 +DEPPKG_DIR=`pwd` + +if [ "${CLOBBER_ALL}" = "true" ] +then + echo "Clobbering ${DEPPKG_DIR}" + echo "rm -rf bin include info lib man qt-out/ share src tools" + rm -rf bin include info lib man qt-out/ share src tools +fi + +export PATH=${BIN_DIR}:${PATH} + +[ ! -e bin ] && mkdir bin +[ ! -e src ] && mkdir src +[ ! -e include ] && mkdir include +[ ! -e lib ] && mkdir lib + +OLD_IFS=${IFS};IFS="|"; +while read package url dir mkd; do +# echo "Got package ${package}" + case ${package} in + \#*) ;; + *) eval "URL_${package}=${url};DIR_${package}=${dir};MKD_${package}=${mkd}";; + esac +done < ${SCRIPT_DIR}/External-mingw32 +IFS=${OLD_IFS};unset OLD_IFS + + +get_source() +{ + URL=$1 + SRC_DIR=$2 + MAKE_DIR=$3 + echo "Processing ${URL}" + ARCHIVE=`basename ${URL}` + + case ${ARCHIVE} in + *.tar.gz) ARCHIVER="tar xzf"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.tar\.gz'`;; + *.tar.bz2) ARCHIVER="tar xjf"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.tar\.bz2'`;; + *.zip) ARCHIVER="unzip -q"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.zip'`;; + *.exe) ARCHIVER=""; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.zip'`;; + *) echo Unsupported archive type - $ARCHIVE; exit 1;; + esac + + cd ${DEPPKG_DIR}/src + + if [ ! -e "${ARCHIVE}" ] + then + echo Downloading "${URL}" + if wget --passive-ftp "${URL}" + then + : + else + echo Unable to download ${ARCHIVE} + exit 1 + fi + fi + + [ -z "${ARCHIVER}" ] && return 0 + + if [ ! -e "${SRC_DIR}" -o "${CLOBBER_SOURCE}" = "true" ] + then + rm -rf ${SRC_DIR} + echo Extracting ${ARCHIVE} + if [ "${MAKE_DIR}" = "true" ] + then + mkdir ${SRC_DIR} + cd ${SRC_DIR} + ${ARCHIVER} ../${ARCHIVE} > ../${ARCHIVE}.log 2>&1 + else + ${ARCHIVER} ${ARCHIVE} > ${ARCHIVE}.log 2>&1 + cd ${SRC_DIR} + fi + return 0 + fi + + cd ${SRC_DIR} + return 1 +} + +parse_output() +{ + sed -ne '/\\$/N' -e 's/\\\n//' -e 's/\t\+/ /g' -e 's/ \+/ /g' \ + -e '/ error: /p' \ + -e "s%.*Entering directory[ ]\\+.${DEPPKG_DIR}/\\([^ ]\+\).%Entering \\1%p" \ + -e "s%.*Leaving directory[ ]\\+.${DEPPKG_DIR}/\\([^ ]\+.\).%Leaving \\1%p" \ + -e '/gcc \|g\+\+ \|ar /!d' \ + -e 's/ \(\.\.\/\)\+/ /g' \ + -e 's/.* \([^ ]\+\(\.c\|\.cpp\|\.cc\|\.cxx\)\)\( .*\|\)$/Compiling \1/p' \ + -e 's/.* \([^ ]\+\.s\)\( .*\|\)$/Assembling \1/p' \ + -e 's/.*ar [^ ]\+ \([^ ]\+\)\(\( [^ ]\+\.o\)\+\)/Updating \1 -\2/p' \ + -e 's/.* -o \([^ ]\+\)\( .*\|\)$/Linking \1/p' +} + +do_patch() +{ + PATCH_FILE=${SCRIPT_DIR}/patches/$1; shift + + if patch -f -p0 "$@" >>patch.log < ${PATCH_FILE} + then + : + else + echo "Patch failed - Check `pwd`/patch.log" > /dev/tty + exit 1 + fi +} + +do_make() +{ + if make -f "$@" 2>&1 + then + : + else + echo "Make failed - Check `pwd`/make.log" > /dev/tty + exit 1 + fi | tee -a make.log | parse_output +} + +process_lzo() +{ + if get_source "${URL_LZO}" "${DIR_LZO}" "${MKD_LZO}" + then + true + fi + echo Building lzo + ./configure --host=$BASE --prefix=${DEPPKG_DIR}/ + echo Installing lzo + do_make Makefile PREFIX=${DEPPKG_DIR}/ all + do_make Makefile PREFIX=${DEPPKG_DIR}/ install +} + +process_zlib() +{ + if get_source "${URL_ZLIB}" "${DIR_ZLIB}" "${MKD_ZLIB}" + then + true + fi + echo Building zlib + > make.log + do_make win32/Makefile.gcc PREFIX=${BASE}- DESTDIR=${DEPPKG_DIR}/ all + echo Installing zlib + do_make win32/Makefile.gcc PREFIX=${BASE}- DESTDIR=${DEPPKG_DIR}/ LIBRARY_PATH=lib BINARY_PATH=bin INCLUDE_PATH=include SHARED_MODE=1 install +} + + +process_rsync() +{ + get_source "${URL_RSYNC}" "${DIR_RSYNC}" "${MKD_RSYNC}" + ./configure --host=$BASE --with-pic + echo Building librsync + do_make Makefile + echo Installing lib and headers + cp .libs/librsync.a ${DEPPKG_DIR}/lib + cp librsync*h ${DEPPKG_DIR}/include +} + +process_pcre() +{ + if get_source "${URL_PCRE}" "${DIR_PCRE}" "${MKD_PCRE}" + then + echo Patching PCRE + >patch.log + do_patch pcre.patch + echo Configuring PCRE + ./configure CC_FOR_BUILD=gcc \ + CXX_FOR_BUILD=g++ \ + --host=$BASE \ + --prefix=${DEPPKG_DIR} \ + --enable-utf8 \ + --enable-unicode-properties >make.log 2>&1 + fi + echo Building PCRE + do_make Makefile PREFIX=${DEPPKG_DIR} all + echo Installing PCRE + do_make Makefile PREFIX=${DEPPKG_DIR} install +} + +process_db() +{ + if get_source "${URL_DB}" "${DIR_DB}" "${MKD_DB}" + then + echo No Patch + fi + cd build_unix + ../dist/configure --host=$BASE --enable-mingw --prefix=${DEPPKG_DIR} + > make.log + echo Building DB + do_make Makefile + echo Installing DB + do_make Makefile install_setup install_include install_lib +} + +process_pthreads() +{ + if get_source "${URL_PTHREADS}" "${DIR_PTHREADS}" "${MKD_PTHREADS}" + then + sed -i '140 s/INLINE//' pthread_mutex_consistent.c + fi + echo Building pthreads + > make.log + do_make GNUmakefile CROSS=${BASE}- clean GCE + echo Installing pthreads + rm -rf ${DEPPKG_DIR}/include/pthreads + mkdir ${DEPPKG_DIR}/include/pthreads + cp -p *.h ${DEPPKG_DIR}/include/pthreads + cp -p *.dll ${DEPPKG_DIR}/bin + cp -p *.a ${DEPPKG_DIR}/lib +} + +process_openssl() +{ + if get_source "${URL_OPENSSL}" "${DIR_OPENSSL}" "${MKD_OPENSSL}" + then + true + fi + echo Configuring openssl + CROSS_COMPILE=${BASE}- ./Configure --prefix=${DEPPKG_DIR} \ + shared zlib-dynamic \ + threads \ + --with-zlib-include=${DEPPKG_DIR}/include \ + mingw > make.log 2>&1 + do_make Makefile all + echo Installing openssl + do_make Makefile install_sw +} + +process_mysql() +{ + get_source "${URL_MYSQL}" "${DIR_MYSQL}" "${DIR_MYSQL}" "${MKD_MYSQL}" + echo Converting mysql lib file + if [ -e ${BIN_DIR}/reimp ] + then + reimp --dlltool ${BIN_DIR}/${BASE}-dlltool --as ${BIN_DIR}/${BASE}-as lib/opt/libmysql.lib + else + ${BIN_DIR}/../mingw32/bin/reimp --dlltool ${BIN_DIR}/${BASE}-dlltool --as ${BIN_DIR}/${BASE}-as lib/opt/libmysql.lib + fi + echo Installing mysql + cp -p liblibmysql.a ../../lib/libmysql.a + rm -rf ../../include/mysql + mkdir ../../include/mysql + cp -p include/* ../../include/mysql 2>&1 | grep -v 'omitting directory' + cp -p lib/opt/libmysql.dll ../../bin +} + +process_postgresql() +{ + if get_source "${URL_POSTGRESQL}" "${DIR_POSTGRESQL}" "${MKD_POSTGRESQL}" + then + echo Patching postgreSQL + >patch.log + do_patch postgresql.patch + + # We need a native version of zic to build the timezone tables. + echo Configuring postgreSQL to build native zic + ./configure > make.log 2>&1 + + echo Building native zic + cd src/timezone + do_make Makefile >> make.log 2>&1 + cp zic ../.. + cd ../.. + do_make GNUmakefile distclean >> make.log 2>&1 + + echo Configuring postgreSQL for MinGW32 + + ./configure --host=$BASE \ + --enable-shared \ + --enable-thread-safety \ + --prefix=${DEPPKG_DIR} \ + --with-includes=${DEPPKG_DIR}/include:${DEPPKG_DIR}/include/pthreads \ + --with-libraries=${DEPPKG_DIR}/lib >> make.log 2>&1 + fi + echo Building postgreSQL + ZIC=`pwd`/zic + do_make GNUmakefile AR=$BASE-ar DLLTOOL=$BASE-dlltool DLLWRAP=$BASE-dllwrap WINDRES=$BASE-windres PTHREAD_LIBS=-lpthreadGCE ZIC=${ZIC} + echo Installing postgreSQL + do_make GNUmakefile AR=$BASE-ar DLLTOOL=$BASE-dlltool DLLWRAP=$BASE-dllwrap WINDRES=$BASE-windres PTHREAD_LIBS=-lpthreadGCE ZIC=${ZIC} install +} + +process_sqlite() +{ + if get_source "${URL_SQLITE}" "${DIR_SQLITE}" "${MKD_SQLITE}" + then + echo Patching SQLite + >patch.log + do_patch sqlite.patch + fi + echo Building SQLite + [ ! -e bld ] && mkdir bld + cd bld + > make.log + do_make ../Makefile.mingw32 CROSSTOOLS=${BIN_DIR} TLIBS="-L${DEPPKG_DIR}/lib" TCL_FLAGS="-I${DEPPKG_DIR}/include" + echo Installing SQLite + cp -p sqlite3.exe ${DEPPKG_DIR}/bin + cp -p libsqlite3.a ${DEPPKG_DIR}/lib + cp -p sqlite3.h ${DEPPKG_DIR}/include +} + +process_wx() +{ + if get_source "${URL_WX}" "${DIR_WX}" "${MKD_WX}" + then + echo Patching wxWidgets + >patch.log + cp build/msw/config.gcc build/msw/config.mingw32 + do_patch wxWidgets.patch + find . -name makefile.gcc -exec sh -c "sed -f ${SCRIPT_DIR}/patches/wx.sed {} > \`echo {} | sed -e 's/\.gcc$/\.mingw32/'\`" \; + fi + echo Building wxWidgets + cd build/msw + > make.log + do_make makefile.mingw32 SHARED=1 VENDOR=bacula DEBUG_INFO=1 + echo Installing wxWidgets + cd ../.. + rm -rf ../../include/wx + mkdir ../../include/wx + cp -p include/wx/* ../../include/wx 2>&1 | grep -v 'omitting directory' + mkdir ../../include/wx/generic + cp -p include/wx/generic/* ../../include/wx/generic 2>&1 | grep -v 'omitting directory' + mkdir ../../include/wx/msw + cp -p include/wx/msw/* ../../include/wx/msw 2>&1 | grep -v 'omitting directory' + mkdir ../../include/wx/msw/ole + cp -p include/wx/msw/ole/* ../../include/wx/msw/ole 2>&1 | grep -v 'omitting directory' + cp -p lib/gcc_dll/*.dll ../../bin + rm -rf ../../lib/wx_dll + mkdir ../../lib/wx_dll + cp -p lib/gcc_dll/*.a ../../lib/wx_dll + mkdir ../../lib/wx_dll/msw + cp -p lib/gcc_dll/msw/* ../../lib/wx_dll/msw 2>&1 | grep -v 'omitting directory' + mkdir ../../lib/wx_dll/msw/wx + cp -p lib/gcc_dll/msw/wx/* ../../lib/wx_dll/msw/wx 2>&1 | grep -v 'omitting directory' + mkdir ../../lib/wx_dll/msw/wx/msw + cp -p lib/gcc_dll/msw/wx/msw/* ../../lib/wx_dll/msw/wx/msw 2>&1 | grep -v 'omitting directory' +} + +process_scons() +{ + get_source "${URL_SCONS}" "${DIR_SCONS}" "${MKD_SCONS}" + echo "Installing scons" + if python setup.py install --prefix=${DEPPKG_DIR}/scons > make.log 2>&1 + then + : + else + echo "Make failed - Check `pwd`/make.log" + exit 1 + fi +} + +process_nsis() +{ + get_source "${URL_NSIS_BIN}" "${DIR_NSIS_BIN}" "${MKD_NSIS_BIN}" + cd .. + rm -rf ../nsis + mv nsis-2.17 ../nsis + if get_source "${URL_NSIS_SRC}" "${DIR_NSIS_SRC}" "${MKD_NSIS_SRC}" + then + echo "Patching nsis" + >patch.log + do_patch nsis.patch + fi + echo "Building nsis" + if ../../scons/bin/scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all \ + PREFIX=${DEPPKG_DIR}/nsis PREFIX_BIN=${DEPPKG_DIR}/nsis/Bin \ + PREFIX_CONF=${DEPPKG_DIR}/nsis PREFIX_DATA=${DEPPKG_DIR}/nsis \ + PREFIX_DOC=${DEPPKG_DIR}/nsis/Docs 2>&1 | tee make.log | parse_output + then + : + else + echo "Scons failed - Check `pwd`/make.log" + exit 1 + fi + echo "Installing nsis" + cp -p build/release/makensis/makensis ../../nsis +} + +process_mtx() +{ + if get_source "${URL_MTX}" "${DIR_MTX}" "${MKD_MTX}" + then + echo Patching mtx + # We can't run configure in a cross-compile environment so we + # patch the files to the correct values + cp -f config.h.in config.h + cp -f Makefile.in Makefile + rm -f configure + >patch.log + do_patch mtx.patch + fi + echo Building mtx + do_make Makefile prefix=${DEPPKG_DIR} all + echo Installing mtx + do_make Makefile prefix=${DEPPKG_DIR} install +} + +process_mt() +{ + if get_source "${URL_MT}" "${DIR_MT}" "${MKD_MT}" + then + echo "Patching mt" + >patch.log + do_patch mt.patch + fi + echo "Building mt" + do_make Makefile PREFIX=${DEPPKG_DIR} all + echo Installing mt + do_make Makefile PREFIX=${DEPPKG_DIR} install +} + +process_sed() +{ + if get_source "${URL_SED}" "${DIR_SED}" "${MKD_SED}" + then + echo Patching sed + >patch.log + # patch not needed for 4.2k which is already updated + # do_patch sed.patch + echo Configuring sed + ./configure --host=$BASE \ + --prefix=${DEPPKG_DIR} \ + --disable-nls >make.log 2>&1 + fi + echo Building sed + do_make Makefile all + echo Installing sed + do_make Makefile install +} + +process_stab2cv() +{ + if get_source "${URL_STAB2CV}" "${DIR_STAB2CV}" "${MKD_STAB2CV}" + then + echo Patching stab2cv + >patch.log + do_patch stab2cv.patch + echo Configuring stab2cv + ./configure --prefix=${DEPPKG_DIR}/tools \ + >make.log 2>&1 + fi + echo Building stab2cv + do_make Makefile + echo Installing stab2cv + do_make Makefile install +} + +process_cmd_utils() +{ + if get_source "${URL_CMD_UTILS}" "${DIR_CMD_UTILS}" "${MKD_CMD_UTILS}" + then + # echo Patching cmd-utils + # >patch.log + # do_patch cmd-utils.patch + sed -i "s:strrchr:NULL;//:" expr64/expr64.cpp + echo Configuring cmd-utils + ./configure --host=$BASE \ + --prefix=${DEPPKG_DIR} \ + >make.log 2>&1 + fi + echo Building cmd-utils + do_make Makefile + echo Installing cmd-utils + do_make Makefile install +} + +process_mkisofs() +{ + get_source "${URL_MKISOFS}" "${DIR_MKISOFS}" "${MKD_MKISOFS}" + echo Installing mkisofs + cp `basename ${URL_MKISOFS}` ${DEPPKG_DIR}/bin +} + +process_dvd_rw_tools() +{ + if get_source "${URL_DVD_RW_TOOLS}" "${DIR_DVD_RW_TOOLS}" "${MKD_DVD_RW_TOOLS}" + then + echo Patching dvd+rw-tools + >patch.log + do_patch dvd+rw-tools.patch + fi + echo "Building dvd+rw-tools" + m4 -DOS=XMINGW32 Makefile.m4 | make -f - dvd+rw-tools >make.log 2>&1 + echo "Installing dvd+rw-tools" + m4 -DOS=XMINGW32 Makefile.m4 | make -f - prefix=${DEPPKG_DIR} manprefix=${DEPPKG_DIR} install >>make.log 2>&1 +} + +process_qt4() +{ + if get_source "${URL_Qt4}" "${DIR_Qt4}" "${MKD_Qt4}" + then + echo Patching Qt4 + >patch.log + patch -p1 < ${SCRIPT_DIR}/patches/qt4-intrinsics.patch + patch -p1 < ${SCRIPT_DIR}/patches/qt4-widget-ui.patch + patch -p1 < ${SCRIPT_DIR}/patches/qt4-compilation-see.patch + patch -p1 < ${SCRIPT_DIR}/patches/qt4-compilation.patch + fi + echo "Configuring Qt4" + ./configure -opensource -confirm-license -fast -xplatform win32-g++-4.6 \ + -device-option CROSS_COMPILE=i686-w64-mingw32- -device-option \ + PKG_CONFIG='i686-w64-mingw32-pkg-config' -force-pkg-config -release \ + -exceptions -shared -prefix ${DEPPKG_DIR}/qt-out -prefix-install -no-script \ + -no-iconv -no-webkit -no-glib -no-gstreamer -no-phonon -no-phonon-backend \ + -accessibility -no-reduce-exports -no-rpath -make libs -nomake demos \ + -nomake docs -nomake examples -system-zlib -no-mitshm -no-libjpeg \ + -no-libmng -no-libtiff -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci \ + -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 \ + -no-sql-sqlite_symbian -no-sql-symsql -no-sql-tds -no-nis -no-cups -no-dbus \ + -no-openvg -no-openssl -no-nas-sound -no-audio-backend -no-sm -no-opengl \ + -no-javascript-jit -no-qt3support -nomake tools \ + -no-xmlpatterns -no-multimedia -nomake tools -silent + + local qt_source_dir=`pwd` + # Required libz.dll.a, zlib.h and zconf.h for proper Qt build purpose + process_zlib + cd "${qt_source_dir}" + local zlib_dir=`basename "${URL_ZLIB}" | sed 's/.tar.gz//'` + cp "../${zlib_dir}/libz.dll.a" ./lib/ + cp "../${zlib_dir}/zlib.h" ./include/ + cp "../${zlib_dir}/zconf.h" ./include/ + + make + + echo "Installing Qt4" + rm -rf ${DEPPKG_DIR}/include/qt ${DEPPKG_DIR}/lib/qt + mkdir -p ${DEPPKG_DIR}/include/qt ${DEPPKG_DIR}/lib/qt + cp -rf include/* ${DEPPKG_DIR}/include/qt + cp -rf lib/* ${DEPPKG_DIR}/lib/qt + cp -rf src/corelib ${DEPPKG_DIR}/src/ + cp -rf src/gui ${DEPPKG_DIR}/src/ + cp -rf lib/QtCore4.dll lib/QtGui4.dll ${DEPPKG_DIR}/bin/ + cp -rf lib/QtCore4.dll lib/QtGui4.dll ${DEPPKG_DIR}/lib/qt/ +} + +process_mingw() +{ + if test -f /usr/lib/gcc/$BASE/*posix/libstdc++-6.dll; then + echo "Installing MinGW libs" + cp -f /usr/lib/gcc/$BASE/*posix/libstdc++-6.dll ${DEPPKG_DIR}/bin + cp -f /usr/lib/gcc/$BASE/*posix/libgcc*dll ${DEPPKG_DIR}/bin + elif test -f /usr/lib/gcc/$BASE/*/libstdc++-6.dll; then + echo "Installing MinGW libs" + cp -f /usr/$BASE/lib/libstdc++-6.dll ${DEPPKG_DIR}/bin + cp -f /usr/$BASE/lib/libgcc*dll ${DEPPKG_DIR}/bin + else + echo "ERROR: Unable to find $BASE on this system" + fi + + if test -f /usr/$BASE/lib/libwinpthread-1.dll; then + cp -f /usr/$BASE/lib/libwinpthread-1.dll ${DEPPKG_DIR}/bin + fi +} + +# MSSQL dlls are created from Visual Studio +process_mssql() +{ + get_source "${URL_MSSQL}" "${DIR_MSSQL}" "${MKD_MSSQL}" + echo Installing MSSQL driver + cp include/*.h ${DEPPKG_DIR}/include + cp x86/mssql-driver.dll ${DEPPKG_DIR}/bin + cp x86/mssql-regression.exe ${DEPPKG_DIR}/bin +} + +if [ "$#" -eq 0 ] +then + process_mingw + process_lzo + process_zlib + process_rsync + process_pthreads + process_openssl + process_stab2cv + process_sed + process_cmd_utils + process_mssql +# process_pcre +# process_mysql +# process_sqlite +# process_postgresql +# process_wx +# process_scons +# process_nsis +# process_mtx +# process_mt +# process_mkisofs +# process_dvd_rw_tools + process_qt4 +else + for dependency in "$@" + do + eval "process_${dependency}" + done +fi +#vss +#Need to download from Microsoft diff --git a/bacula/src/win32/cats/Makefile b/bacula/src/win32/cats/Makefile new file mode 100644 index 0000000000..3429d53c5b --- /dev/null +++ b/bacula/src/win32/cats/Makefile @@ -0,0 +1,110 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# +# Author: Robert Nelson +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Written by Robert Nelson, June 2006 +# + +include ../Makefile.inc + +INCLUDES = \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_OPENSSL) \ + $(INCLUDE_MYSQL) + +DEFINES = \ + $(HAVES) + +vpath %.c $(MAINDIR)/src/cats +vpath %.cpp $(MAINDIR)/src/cats + +###################################################################### + +# Files files in src/lib + +SQL_OBJS = \ + sql.o \ + sql_cmds.o \ + sql_create.o \ + sql_delete.o \ + sql_find.o \ + sql_get.o \ + sql_glue.o \ + sql_list.o \ + sql_update.o \ + cats.o \ + bvfs.o + +LIBS_DLL = \ + $(LIBS_BACULA) + +###################################################################### + +# Targets + +.PHONY: all clean + +#all: $(LIBDIR)/libcats.a $(BINDIR)/cats_mysql.dll $(BINDIR)/cats_postgresql.dll $(BINDIR)/cats_sqlite3.dll +all: $(LIBDIR)/libcats.a $(BINDIR)/cats_postgresql.dll + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(addprefix $(OBJDIR)/cats_mysql/,mysql.o $(SQL_OBJS))) + $(call clean_obj,$(addprefix $(OBJDIR)/cats_postgresql/,postgresql.o $(SQL_OBJS))) + $(call clean_obj,$(addprefix $(OBJDIR)/cats_sqlite3/,sqlite.o $(SQL_OBJS))) + $(call clean_exe,$(BINDIR)/cats_mysql.dll) + $(call clean_exe,$(BINDIR)/cats_postgresql.dll) + $(call clean_exe,$(BINDIR)/cats_sqlite3.dll) + $(ECHO_CMD)rm -f $(OBJDIR)/libcats.exp $(LIBDIR)/libcats.a + $(ECHO_CMD)rm -rf $(OBJDIRS) + +$(LIBDIR)/libcats.a $(OBJDIR)/libcats.exp: bacula_cats.def + $(call checkdir,$@) + @mkdir -p $(OBJDIRS) + $(DLLTOOL) --dllname bacula_cats.dll --no-export-all-symbols --input-def bacula_cats.def --output-exp $(OBJDIR)/libcats.exp --output-lib $(LIBDIR)/libcats.a $^ + +$(BINDIR)/cats_mysql.dll: $(addprefix $(OBJDIR)/cats_mysql/,mysql.o $(SQL_OBJS)) $(OBJDIR)/libcats.exp + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(LDFLAGS) -mdll -mwindows $^ $(LIBS_MYSQL) $(LIBS_DLL) -o $@ + +$(BINDIR)/cats_postgresql.dll: $(addprefix $(OBJDIR)/cats_postgresql/,postgresql.o $(SQL_OBJS)) $(OBJDIR)/libcats.exp + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(LDFLAGS) -mdll -mwindows $^ $(LIBS_POSTGRESQL) $(LIBS_DLL) -o $@ + +$(BINDIR)/cats_sqlite3.dll: $(addprefix $(OBJDIR)/cats_sqlite3/,sqlite.o $(SQL_OBJS)) $(OBJDIR)/libcats.exp + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(LDFLAGS) -mdll -mwindows $^ $(LIBS_SQLITE) $(LIBS_DLL) -o $@ + +# +# Rules for generating from ../cats +# + +include ../Makefile.rules + +define Link_Dll +$(OBJDIR)/$(1)/%.o: %.c + @echo "Compiling $$<" + $$(call checkdir,$$@) + $(ECHO_CMD)$(CXX) -D_BDB_PRIV_INTERFACE_ -DBUILDING_CATS -DUSING_DLL -DHAVE_$(2) $(CFLAGS) -c $$< -o $$@ + +$(OBJDIR)/$(1)/%.o: %.cpp + @echo "Compiling $$<" + $$(call checkdir,$$@) + $(ECHO_CMD)$(CXX) -D_BDB_PRIV_INTERFACE_ -DBUILDING_CATS -DUSING_DLL -DHAVE_$(2) $(CFLAGS) -c $$< -o $$@ + +endef + +$(eval $(call Link_Dll,cats_mysql,MYSQL)) + +$(eval $(call Link_Dll,cats_postgresql,POSTGRESQL)) + +$(eval $(call Link_Dll,cats_sqlite3,SQLITE3)) diff --git a/bacula/src/win32/cats/bacula_cats.def b/bacula/src/win32/cats/bacula_cats.def new file mode 100644 index 0000000000..57e4ebcb32 --- /dev/null +++ b/bacula/src/win32/cats/bacula_cats.def @@ -0,0 +1,273 @@ +LIBRARY bacula_cats.dll +EXPORTS + +; sql.o +_Z11db_strerrorP4B_DB +_Z11list_dashesP4B_DBPFvPvPKcES1_ +_Z11list_resultP3JCRP4B_DBPFvPvPKcES3_11e_list_type +_Z11list_resultPviPPc +_Z12check_limitsP3JCRP4B_DB +_Z14db_debug_printP3JCRP6_iobuf +_Z14db_int_handlerPviPPc +_Z15db_list_handlerPviPPc +_Z16db_int64_handlerPviPPc +_Z18db_strtime_handlerPviPPc +_Z18get_sql_record_maxP3JCRP4B_DB +_Z19split_path_and_fileP3JCRP4B_DBPKc +_Z20check_tables_versionP3JCRP4B_DB +_Z22db_string_list_handlerPviPPc +_Z23db_open_batch_connexionP3JCRP4B_DB +_Z24db_check_max_connectionsP3JCRP4B_DBj +_Z7QueryDBPKciP3JCRP4B_DBPc +_Z8DeleteDBPKciP3JCRP4B_DBPc +_Z8InsertDBPKciP3JCRP4B_DBPc +_Z8UpdateDBPKciP3JCRP4B_DBPc +_ZN9dbid_listC1Ev +_ZN9dbid_listC2Ev +_ZN9dbid_listD1Ev +_ZN9dbid_listD2Ev + +; sql_create.o +_Z20db_create_job_recordP3JCRP4B_DBP7JOB_DBR +_Z21db_create_path_recordP3JCRP4B_DBP8ATTR_DBR +_Z21db_create_pool_recordP3JCRP4B_DBP8POOL_DBR +_Z22db_create_media_recordP3JCRP4B_DBP9MEDIA_DBR +_Z23db_create_client_recordP3JCRP4B_DBP10CLIENT_DBR +_Z23db_create_device_recordP3JCRP4B_DBP10DEVICE_DBR +_Z23db_disable_batch_insertb +_Z24db_create_base_file_listP3JCRP4B_DBPc +_Z24db_create_counter_recordP3JCRP4B_DBP11COUNTER_DBR +_Z24db_create_fileset_recordP3JCRP4B_DBP11FILESET_DBR +_Z24db_create_storage_recordP3JCRP4B_DBP11STORAGE_DBR +_Z25db_create_jobmedia_recordP3JCRP4B_DBP12JOBMEDIA_DBR +_Z26db_create_mediatype_recordP3JCRP4B_DBP13MEDIATYPE_DBR +_Z27db_create_attributes_recordP3JCRP4B_DBP8ATTR_DBR +_Z27db_write_batch_file_recordsP3JCR +_Z31db_create_restore_object_recordP3JCRP4B_DBP11ROBJECT_DBR +_Z32db_create_file_attributes_recordP3JCRP4B_DBP8ATTR_DBR +_Z37db_commit_base_file_attributes_recordP3JCRP4B_DB +_Z37db_create_base_file_attributes_recordP3JCRP4B_DBP8ATTR_DBR +_Z38db_create_batch_file_attributes_recordP3JCRP4B_DBP8ATTR_DBR +_ZN8POOL_MEMD1Ev + +; sql_delete.o +_Z21db_delete_pool_recordP3JCRP4B_DBP8POOL_DBR +_Z21db_purge_media_recordP3JCRP4B_DBP9MEDIA_DBR +_Z22db_delete_media_recordP3JCRP4B_DBP9MEDIA_DBR + +; sql_find.o +_Z18db_find_last_jobidP3JCRP4B_DBPKcP7JOB_DBR +_Z19db_find_next_volumeP3JCRP4B_DBibP9MEDIA_DBR +_Z22db_find_job_start_timeP3JCRP4B_DBP7JOB_DBRPPcS5_ +_Z24db_find_failed_job_sinceP3JCRP4B_DBP7JOB_DBRPcRi +_Z27db_find_last_job_start_timeP3JCRP4B_DBP7JOB_DBRPPcS5_i + +; sql_get.o +_Z15db_get_pool_idsP3JCRP4B_DBPiPPj +_Z16db_get_file_listP3JCRP4B_DBPcbbPFiPviPS3_ES4_ +_Z16db_get_media_idsP3JCRP4B_DBP9MEDIA_DBRPiPPj +_Z17db_get_base_jobidP3JCRP4B_DBP7JOB_DBRPj +_Z17db_get_client_idsP3JCRP4B_DBPiPPj +_Z17db_get_job_recordP3JCRP4B_DBP7JOB_DBR +_Z18db_get_path_recordP3JCRP4B_DB +_Z18db_get_pool_recordP3JCRP4B_DBP8POOL_DBR +_Z18db_get_query_dbidsP3JCRP4B_DBR8POOL_MEMR9dbid_list +_Z19db_get_media_recordP3JCRP4B_DBP9MEDIA_DBR +_Z19db_get_pool_numvolsP3JCRP4B_DBP8POOL_DBR +_Z20db_get_client_recordP3JCRP4B_DBP10CLIENT_DBR +_Z20db_get_volume_jobidsP3JCRP4B_DBP9MEDIA_DBRP11db_list_ctx +_Z21db_get_base_file_listP3JCRP4B_DBbPFiPviPPcES3_ +_Z21db_get_counter_recordP3JCRP4B_DBP11COUNTER_DBR +_Z21db_get_fileset_recordP3JCRP4B_DBP11FILESET_DBR +_Z22db_accurate_get_jobidsP3JCRP4B_DBP7JOB_DBRP11db_list_ctx +_Z23db_get_job_volume_namesP3JCRP4B_DBjPPc +_Z23db_get_num_pool_recordsP3JCRP4B_DB +_Z23db_get_used_base_jobidsP3JCRP4B_DBPcP11db_list_ctx +_Z24db_get_num_media_recordsP3JCRP4B_DB +_Z27db_get_restoreobject_recordP3JCRP4B_DBP11ROBJECT_DBR +_Z28db_free_restoreobject_recordP3JCRP11ROBJECT_DBR +_Z28db_get_job_volume_parametersP3JCRP4B_DBjPP10VOL_PARAMS +_Z29db_get_file_attributes_recordP3JCRP4B_DBPcP7JOB_DBRP8FILE_DBR +_ZN8POOL_MEMD1Ev + +; sql_list.o +_Z17db_list_sql_queryP3JCRP4B_DBPKcPFvPvS4_ES5_i11e_list_type +_Z18db_list_job_totalsP3JCRP4B_DBP7JOB_DBRPFvPvPKcES5_ +_Z19db_list_job_recordsP3JCRP4B_DBP7JOB_DBRPFvPvPKcES5_11e_list_type +_Z20db_list_pool_recordsP3JCRP4B_DBP8POOL_DBRPFvPvPKcES5_11e_list_type +_Z21db_list_files_for_jobP3JCRP4B_DBjPFvPvPKcES3_ +_Z21db_list_media_recordsP3JCRP4B_DBP9MEDIA_DBRPFvPvPKcES5_11e_list_type +_Z22db_list_client_recordsP3JCRP4B_DBPFvPvPKcES3_11e_list_type +_Z22db_list_copies_recordsP3JCRP4B_DBjPcPFvPvPKcES4_11e_list_type +_Z22db_list_joblog_recordsP3JCRP4B_DBjPFvPvPKcES3_11e_list_type +_Z23db_list_restore_objectsP3JCRP4B_DBP11ROBJECT_DBRPFvPvPKcES5_11e_list_type +_Z24db_list_jobmedia_recordsP3JCRP4B_DBjPFvPvPKcES3_11e_list_type +_Z26db_list_base_files_for_jobP3JCRP4B_DBjPFvPvPKcES3_ +_ZN8POOL_MEMD1Ev + +; sql_update.o +_Z15db_update_statsP3JCRP4B_DBx +_Z19db_mark_file_recordP3JCRP4B_DByj +_Z21db_update_pool_recordP3JCRP4B_DBP8POOL_DBR +_Z22db_update_media_recordP3JCRP4B_DBP9MEDIA_DBR +_Z23db_update_client_recordP3JCRP4B_DBP10CLIENT_DBR +_Z24db_make_inchanger_uniqueP3JCRP4B_DBP9MEDIA_DBR +_Z24db_update_counter_recordP3JCRP4B_DBP11COUNTER_DBR +_Z24db_update_job_end_recordP3JCRP4B_DBP7JOB_DBR +_Z24db_update_media_defaultsP3JCRP4B_DBP9MEDIA_DBR +_Z24db_update_storage_recordP3JCRP4B_DBP11STORAGE_DBR +_Z26db_update_job_start_recordP3JCRP4B_DBP7JOB_DBR +_Z28db_add_digest_to_file_recordP3JCRP4B_DByPci + +; bvfs.o +_Z15bvfs_parent_dirPc +_Z17bvfs_basename_dirPc +_Z17bvfs_update_cacheP3JCRP4B_DB +_Z20build_ls_files_queryP4B_DBR8POOL_MEMPKcS4_S4_xx +_Z20bvfs_update_fv_cacheP3JCRP4B_DBPc +_Z32bvfs_update_path_hierarchy_cacheP3JCRP4B_DBPc +_ZN4Bvfs10set_jobidsEPc +_ZN4Bvfs11clear_cacheEv +_ZN4Bvfs11escape_listEP5alist +_ZN4Bvfs11get_volumesEy +_ZN4Bvfs12_handle_pathEPviPPc +_ZN4Bvfs12filter_jobidEv +_ZN4Bvfs12update_cacheEv +_ZN4Bvfs15fv_update_cacheEv +_ZN4Bvfs15ls_special_dirsEv +_ZN4Bvfs16fv_get_big_filesExxi +_ZN4Bvfs17drop_restore_listEPc +_ZN4Bvfs20compute_restore_listEPcS0_S0_S0_ +_ZN4Bvfs20insert_missing_deltaEPcPx +_ZN4Bvfs21fv_get_size_and_countExPxS0_ +_ZN4Bvfs21get_all_file_versionsEjyPKc +_ZN4Bvfs24fv_update_size_and_countExxx +_ZN4Bvfs25fv_compute_size_and_countExPxS0_ +_ZN4Bvfs29fv_get_current_size_and_countExPxS0_ +_ZN4Bvfs6ch_dirEPKc +_ZN4Bvfs7ls_dirsEv +_ZN4Bvfs8get_rootEv +_ZN4Bvfs8ls_filesEv +_ZN4Bvfs9set_jobidEj +_ZN4BvfsC1EP3JCRP4B_DB +_ZN4BvfsC2EP3JCRP4B_DB +_ZN4BvfsD0Ev +_ZN4BvfsD1Ev +_ZN4BvfsD2Ev +_ZN8POOL_MEMD1Ev + +; sql_glue.o +_Z11db_get_typeP4B_DB +_Z12db_sql_queryP4B_DBPKcPFiPviPPcES3_ +_Z12db_sql_queryP4B_DBPKci +_Z12sql_num_rowsP4B_DB +_Z12sql_strerrorP4B_DB +_Z13sql_batch_endP3JCRP4B_DBPKc +_Z13sql_data_seekP4B_DBi +_Z13sql_fetch_rowP4B_DB +_Z14sql_field_seekP4B_DBi +_Z14sql_num_fieldsP4B_DB +_Z15sql_batch_startP3JCRP4B_DB +_Z15sql_fetch_fieldP4B_DB +_Z15sql_free_resultP4B_DB +_Z16db_big_sql_queryP4B_DBPKcPFiPviPPcES3_ +_Z16db_escape_objectP3JCRP4B_DBPci +_Z16db_escape_stringP3JCRP4B_DBPcS3_i +_Z16db_open_databaseP3JCRP4B_DB +_Z16sql_batch_insertP3JCRP4B_DBP8ATTR_DBR +_Z17db_close_databaseP3JCRP4B_DB +_Z17db_get_type_indexP4B_DB +_Z17db_match_databaseP4B_DBPKcS2_S2_i +_Z17db_thread_cleanupP4B_DB +_Z17sql_affected_rowsP4B_DB +_Z18db_end_transactionP3JCRP4B_DB +_Z18db_unescape_objectP3JCRP4B_DBPciPS3_Pi +_Z20db_start_transactionP3JCRP4B_DB +_Z20sql_field_is_numericP4B_DBi +_Z21sql_field_is_not_nullP4B_DBi +_Z25sql_insert_autokey_recordP4B_DBPKcS2_ +_Z28db_clone_database_connectionP4B_DBP3JCRb +_Z9sql_queryP4B_DBPKci + +; cats.o +_ZN4B_DB10_db_unlockEPKci +_ZN4B_DB11db_get_typeEv +_ZN4B_DB12db_sql_queryEPKci +_ZN4B_DB15print_lock_infoEP6_iobuf +_ZN4B_DB17db_match_databaseEPKcS1_S1_i +_ZN4B_DB28db_clone_database_connectionEP3JCRb +_ZN4B_DB8_db_lockEPKci + +; postgresql.o +_Z16db_init_databaseP3JCRPKcS2_S2_S2_S2_iS2_bb +_ZN15B_DB_POSTGRESQL12db_sql_queryEPKcPFiPviPPcES2_ +_ZN15B_DB_POSTGRESQL12sql_strerrorEv +_ZN15B_DB_POSTGRESQL13sql_batch_endEP3JCRPKc +_ZN15B_DB_POSTGRESQL13sql_data_seekEi +_ZN15B_DB_POSTGRESQL13sql_fetch_rowEv +_ZN15B_DB_POSTGRESQL15sql_batch_startEP3JCR +_ZN15B_DB_POSTGRESQL15sql_fetch_fieldEv +_ZN15B_DB_POSTGRESQL15sql_free_resultEv +_ZN15B_DB_POSTGRESQL16db_big_sql_queryEPKcPFiPviPPcES2_ +_ZN15B_DB_POSTGRESQL16db_escape_objectEP3JCRPci +_ZN15B_DB_POSTGRESQL16db_escape_stringEP3JCRPcS2_i +_ZN15B_DB_POSTGRESQL16db_open_databaseEP3JCR +_ZN15B_DB_POSTGRESQL16sql_batch_insertEP3JCRP8ATTR_DBR +_ZN15B_DB_POSTGRESQL17db_close_databaseEP3JCR +_ZN15B_DB_POSTGRESQL17db_thread_cleanupEv +_ZN15B_DB_POSTGRESQL17sql_affected_rowsEv +_ZN15B_DB_POSTGRESQL18db_end_transactionEP3JCR +_ZN15B_DB_POSTGRESQL18db_unescape_objectEP3JCRPciPS2_Pi +_ZN15B_DB_POSTGRESQL20db_start_transactionEP3JCR +_ZN15B_DB_POSTGRESQL20sql_field_is_numericEi +_ZN15B_DB_POSTGRESQL21sql_field_is_not_nullEi +_ZN15B_DB_POSTGRESQL25sql_insert_autokey_recordEPKcS1_ +_ZN15B_DB_POSTGRESQL9sql_queryEPKci +_ZN15B_DB_POSTGRESQLC1EP3JCRPKcS3_S3_S3_S3_iS3_bb +_ZN15B_DB_POSTGRESQLC2EP3JCRPKcS3_S3_S3_S3_iS3_bb +_ZN15B_DB_POSTGRESQLD0Ev +_ZN15B_DB_POSTGRESQLD1Ev +_ZN15B_DB_POSTGRESQLD2Ev +_ZN4B_DB16db_big_sql_queryEPKcPFiPviPPcES2_ +_ZN4B_DBD0Ev +_ZN4B_DBD1Ev +_ZN9B_DB_PRIVD0Ev +_ZN9B_DB_PRIVD1Ev + +client_backups DATA +list_pool DATA +drop_deltabs DATA +create_deltabs DATA +sel_JobMedia DATA +uar_list_jobs DATA +uar_file DATA +uar_count_files DATA +uar_sel_files DATA +uar_del_temp DATA +uar_del_temp1 DATA +uar_create_temp DATA +uar_create_temp1 DATA +uar_last_full DATA +uar_full DATA +uar_inc DATA +uar_list_temp DATA +uar_sel_all_temp1 DATA +uar_sel_fileset DATA +uar_jobid_fileindex DATA +uar_dif DATA +uar_sel_all_temp DATA +uar_count_files DATA +uar_jobids_fileindex DATA +uar_jobid_fileindex_from_dir DATA +uar_jobid_fileindex_from_table DATA +cleanup_created_job DATA +cleanup_running_job DATA +get_restore_objects DATA +get_restore_objects DATA +uar_sel_filesetid DATA +create_delindex DATA +expired_volumes DATA +uap_upgrade_copies_oldest_job DATA +uar_print_jobs DATA +get_restore_objects DATA +uar_sel_jobid_temp DATA diff --git a/bacula/src/win32/cats/bacula_cats/bacula_cats.vcproj b/bacula/src/win32/cats/bacula_cats/bacula_cats.vcproj new file mode 100644 index 0000000000..294b2fc0cc --- /dev/null +++ b/bacula/src/win32/cats/bacula_cats/bacula_cats.vcproj @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/cats/cats_mysql/cats_mysql.vcproj b/bacula/src/win32/cats/cats_mysql/cats_mysql.vcproj new file mode 100644 index 0000000000..c863fa5764 --- /dev/null +++ b/bacula/src/win32/cats/cats_mysql/cats_mysql.vcproj @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/cats/cats_postgresql/cats_postgresql.vcproj b/bacula/src/win32/cats/cats_postgresql/cats_postgresql.vcproj new file mode 100644 index 0000000000..78b46d9342 --- /dev/null +++ b/bacula/src/win32/cats/cats_postgresql/cats_postgresql.vcproj @@ -0,0 +1,432 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/cats/cats_sqlite3/cats_sqlite3.vcproj b/bacula/src/win32/cats/cats_sqlite3/cats_sqlite3.vcproj new file mode 100644 index 0000000000..7eb1bc579e --- /dev/null +++ b/bacula/src/win32/cats/cats_sqlite3/cats_sqlite3.vcproj @@ -0,0 +1,421 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/cats/create_mysql_database.cmd b/bacula/src/win32/cats/create_mysql_database.cmd new file mode 100644 index 0000000000..550c83bb94 --- /dev/null +++ b/bacula/src/win32/cats/create_mysql_database.cmd @@ -0,0 +1,14 @@ +@ECHO off +REM +REM Script to create Bacula database(s) +REM + +"@SQL_BINDIR@\mysql" %* -e "CREATE DATABASE bacula;" +SET RESULT=%ERRORLEVEL% +IF %RESULT% GTR 0 GOTO :ERROR +ECHO Creation of bacula database succeeded. +EXIT /b 0 + +:ERROR +ECHO Creation of bacula database failed. +EXIT /b %RESULT% diff --git a/bacula/src/win32/cats/create_postgresql_database.cmd b/bacula/src/win32/cats/create_postgresql_database.cmd new file mode 100644 index 0000000000..90b029cb67 --- /dev/null +++ b/bacula/src/win32/cats/create_postgresql_database.cmd @@ -0,0 +1,23 @@ +@ECHO off +REM +REM Script to create Bacula database(s) +REM + +REM use SQL_ASCII to be able to put any filename into +REM the database even those created with unusual character sets +SET ENCODING=ENCODING 'SQL_ASCII' + +REM use UTF8 if you are using standard Unix/Linux LANG specifications +REM that use UTF8 -- this is normally the default and *should* be +REM your standard. Bacula consoles work correctly *only* with UTF8. +REM SET ENCODING=ENCODING 'UTF8' + +"@SQL_BINDIR@\psql" -f "@bin_dir_cmd@\create_postgresql_database.sql" -d template1 %* +IF ERRORLEVEL 1 GOTO :ERROR +ECHO Creation of bacula database succeeded. +EXIT /b 0 +GOTO :EOF + +:ERROR +ECHO Creation of bacula database failed. +EXIT /b 1 diff --git a/bacula/src/win32/cats/create_postgresql_database.sql b/bacula/src/win32/cats/create_postgresql_database.sql new file mode 100644 index 0000000000..bebc25138d --- /dev/null +++ b/bacula/src/win32/cats/create_postgresql_database.sql @@ -0,0 +1,2 @@ +CREATE DATABASE bacula ENCODING 'SQL_ASCII'; +ALTER DATABASE bacula SET datestyle TO 'ISO, YMD'; diff --git a/bacula/src/win32/cats/create_sqlite3_database.cmd b/bacula/src/win32/cats/create_sqlite3_database.cmd new file mode 100644 index 0000000000..a2f24d264f --- /dev/null +++ b/bacula/src/win32/cats/create_sqlite3_database.cmd @@ -0,0 +1,6 @@ +@ECHO off +REM +REM Script to create Bacula SQLite tables + +ECHO .databases | "@bin_dir_cmd@\sqlite3" %* "@working_dir_cmd@\bacula.db" +EXIT /b 0 diff --git a/bacula/src/win32/cats/delete_catalog_backup.cmd b/bacula/src/win32/cats/delete_catalog_backup.cmd new file mode 100644 index 0000000000..30c84a213a --- /dev/null +++ b/bacula/src/win32/cats/delete_catalog_backup.cmd @@ -0,0 +1,5 @@ +REM +REM This script deletes a catalog dump +REM +DEL /f "@working_dir_cmd@\bacula.sql" +EXIT /b 0 diff --git a/bacula/src/win32/cats/drop_mysql_database.cmd b/bacula/src/win32/cats/drop_mysql_database.cmd new file mode 100644 index 0000000000..a6cd0a9d12 --- /dev/null +++ b/bacula/src/win32/cats/drop_mysql_database.cmd @@ -0,0 +1,14 @@ +@ECHO off +REM +REM Script to drop Bacula database(s) +REM + +"@SQL_BINDIR@\mysql" %* -f -e "DROP DATABASE bacula;" +SET RESULT=%ERRORLEVEL% +IF %RESULT% GTR 0 GOTO :ERROR +ECHO Drop of bacula database succeeded. +EXIT /b 0 + +:ERROR +ECHO Drop of bacula database failed. +EXIT /b %RESULT% diff --git a/bacula/src/win32/cats/drop_mysql_tables.cmd b/bacula/src/win32/cats/drop_mysql_tables.cmd new file mode 100644 index 0000000000..fd7cc332b8 --- /dev/null +++ b/bacula/src/win32/cats/drop_mysql_tables.cmd @@ -0,0 +1,14 @@ +@ECHO off +REM +REM Script to delete Bacula tables for MySQL +REM + +"@SQL_BINDIR@\mysql" %* < "@bin_dir_cmd@\drop_mysql_tables.sql" +SET RESULT=%ERRORLEVEL% +IF %RESULT% GTR 0 goto :ERROR +ECHO Deletion of Bacula MySQL tables succeeded. +EXIT /b 0 + +:ERROR +ECHO Deletion of Bacula MySQL tables failed. +EXIT /b %RESULT% diff --git a/bacula/src/win32/cats/drop_mysql_tables.sql b/bacula/src/win32/cats/drop_mysql_tables.sql new file mode 100644 index 0000000000..b57d7e5029 --- /dev/null +++ b/bacula/src/win32/cats/drop_mysql_tables.sql @@ -0,0 +1,26 @@ +USE bacula; +DROP TABLE IF EXISTS Filename; +DROP TABLE IF EXISTS Path; +DROP TABLE IF EXISTS LongName; +DROP TABLE IF EXISTS Device; +DROP TABLE IF EXISTS Storage; +DROP TABLE IF EXISTS MediaType; +DROP TABLE IF EXISTS File; +DROP TABLE IF EXISTS Client; +DROP TABLE IF EXISTS Job; +DROP TABLE IF EXISTS Media; +DROP TABLE IF EXISTS JobMedia; +DROP TABLE IF EXISTS Pool; +DROP TABLE IF EXISTS MultiVolume; +DROP TABLE IF EXISTS FileSave; +DROP TABLE IF EXISTS FileSet; +DROP TABLE IF EXISTS Version; +DROP TABLE IF EXISTS Counters; +DROP TABLE IF EXISTS BaseFiles; +DROP TABLE IF EXISTS UnsavedFiles; +DROP TABLE IF EXISTS CDImages; +DROP TABLE IF EXISTS Status; +DROP TABLE IF EXISTS MAC; +DROP TABLE IF EXISTS Log; +DROP TABLE IF EXISTS Location; +DROP TABLE IF EXISTS LocationLog; diff --git a/bacula/src/win32/cats/drop_postgresql_database.cmd b/bacula/src/win32/cats/drop_postgresql_database.cmd new file mode 100644 index 0000000000..f5979a52d0 --- /dev/null +++ b/bacula/src/win32/cats/drop_postgresql_database.cmd @@ -0,0 +1,14 @@ +@ECHO off +REM +REM Script to drop Bacula database(s) +REM + +"@SQL_BINDIR@\dropdb" %* bacula +IF ERRORLEVEL 1 GOTO :ERROR +ECHO Drop of bacula database succeeded. +EXIT /b 0 +GOTO :EOF + +:ERROR +ECHO Drop of bacula database failed. +EXIT /b 1 diff --git a/bacula/src/win32/cats/drop_postgresql_tables.cmd b/bacula/src/win32/cats/drop_postgresql_tables.cmd new file mode 100644 index 0000000000..ae6215cade --- /dev/null +++ b/bacula/src/win32/cats/drop_postgresql_tables.cmd @@ -0,0 +1,14 @@ +@ECHO off +REM +REM Script to delete Bacula tables for PostgreSQL +REM + +"@SQL_BINDIR@\psql" -f "@bin_dir_cmd@\drop_postgresql_tables.sql" -d bacula %* +IF ERRORLEVEL 1 GOTO :ERROR +ECHO Deletion of Bacula PostgreSQL tables succeeded. +EXIT /b 0 +GOTO :EOF + +:ERROR +ECHO Deletion of Bacula PostgreSQL tables failed. +EXIT /b 1 diff --git a/bacula/src/win32/cats/drop_postgresql_tables.sql b/bacula/src/win32/cats/drop_postgresql_tables.sql new file mode 100644 index 0000000000..4057b920ce --- /dev/null +++ b/bacula/src/win32/cats/drop_postgresql_tables.sql @@ -0,0 +1,22 @@ +drop table unsavedfiles; +drop table basefiles; +drop table jobmedia; +drop table file; +drop table job; +drop table media; +drop table client; +drop table pool; +drop table fileset; +drop table path; +drop table filename; +drop table counters; +drop table version; +drop table CDImages; +drop table Device; +drop table Storage; +drop table MediaType; +drop table Status; +drop table MAC; +drop table log; +drop table Location; +drop table locationlog; diff --git a/bacula/src/win32/cats/drop_sqlite3_database.cmd b/bacula/src/win32/cats/drop_sqlite3_database.cmd new file mode 100644 index 0000000000..654ca6f0eb --- /dev/null +++ b/bacula/src/win32/cats/drop_sqlite3_database.cmd @@ -0,0 +1,7 @@ +@ECHO off +REM +REM Script to drop Bacula SQLite tables + +DEL "@working_dir_cmd@\bacula.db" +ECHO SQLite database dropped. +EXIT /b 0 diff --git a/bacula/src/win32/cats/drop_sqlite3_tables.cmd b/bacula/src/win32/cats/drop_sqlite3_tables.cmd new file mode 100644 index 0000000000..ac5975fc5e --- /dev/null +++ b/bacula/src/win32/cats/drop_sqlite3_tables.cmd @@ -0,0 +1,8 @@ +@ECHO off +REM +REM Script to delete the SQLite Bacula database (same as deleting +REM the tables) +REM + +DEL "@working_dir_cmd@\bacula.db" +EXIT /b 0 diff --git a/bacula/src/win32/cats/grant_mysql_privileges.cmd b/bacula/src/win32/cats/grant_mysql_privileges.cmd new file mode 100644 index 0000000000..c37c5d8ac6 --- /dev/null +++ b/bacula/src/win32/cats/grant_mysql_privileges.cmd @@ -0,0 +1,14 @@ +@ECHO off +REM +REM Script to grant privileges to the bacula database +REM + +"@SQL_BINDIR@\mysql" -u root -f %* < "@bin_dir_cmd@\grant_mysql_privileges.sql" +SET RESULT=%ERRORLEVEL% +IF %RESULT% GTR 0 GOTO :ERROR +ECHO Privileges for bacula granted. +EXIT /b 0 + +:ERROR +ECHO Error creating privileges. +EXIT /b %RESULT% diff --git a/bacula/src/win32/cats/grant_mysql_privileges.sql b/bacula/src/win32/cats/grant_mysql_privileges.sql new file mode 100644 index 0000000000..1b9d371eef --- /dev/null +++ b/bacula/src/win32/cats/grant_mysql_privileges.sql @@ -0,0 +1,5 @@ +use mysql +grant all privileges on bacula.* to bacula@localhost; +grant all privileges on bacula.* to bacula@"%"; +select * from user; +flush privileges; diff --git a/bacula/src/win32/cats/grant_postgresql_privileges.cmd b/bacula/src/win32/cats/grant_postgresql_privileges.cmd new file mode 100644 index 0000000000..69e8076833 --- /dev/null +++ b/bacula/src/win32/cats/grant_postgresql_privileges.cmd @@ -0,0 +1,15 @@ +@ECHO off +REM +REM Script to grant privileges to the bacula database +REM +USER=bacula + +"@SQL_BINDIR@\psql" -f "@bin_dir_cmd@\grant_postgresql_privileges.sql" -d bacula %* +IF ERRORLEVEL 1 GOTO :ERROR +ECHO Error creating privileges. +EXIT /b 0 +GOTO :EOF + +:ERROR +ECHO Drop of bacula database failed. +EXIT /b 1 diff --git a/bacula/src/win32/cats/grant_postgresql_privileges.sql b/bacula/src/win32/cats/grant_postgresql_privileges.sql new file mode 100644 index 0000000000..3a73f6d2c5 --- /dev/null +++ b/bacula/src/win32/cats/grant_postgresql_privileges.sql @@ -0,0 +1,37 @@ +create user bacula; + +-- for tables +grant all on unsavedfiles to bacula; +grant all on basefiles to bacula; +grant all on jobmedia to bacula; +grant all on file to bacula; +grant all on job to bacula; +grant all on media to bacula; +grant all on client to bacula; +grant all on pool to bacula; +grant all on fileset to bacula; +grant all on path to bacula; +grant all on filename to bacula; +grant all on counters to bacula; +grant all on version to bacula; +grant all on cdimages to bacula; +grant all on mediatype to bacula; +grant all on storage to bacula; +grant all on device to bacula; +grant all on status to bacula; + +-- for sequences on those tables + +grant select, update on filename_filenameid_seq to bacula; +grant select, update on path_pathid_seq to bacula; +grant select, update on fileset_filesetid_seq to bacula; +grant select, update on pool_poolid_seq to bacula; +grant select, update on client_clientid_seq to bacula; +grant select, update on media_mediaid_seq to bacula; +grant select, update on job_jobid_seq to bacula; +grant select, update on file_fileid_seq to bacula; +grant select, update on jobmedia_jobmediaid_seq to bacula; +grant select, update on basefiles_baseid_seq to bacula; +grant select, update on storage_storageid_seq to bacula; +grant select, update on mediatype_mediatypeid_seq to bacula; +grant select, update on device_deviceid_seq to bacula; diff --git a/bacula/src/win32/cats/grant_sqlite3_privileges.cmd b/bacula/src/win32/cats/grant_sqlite3_privileges.cmd new file mode 100644 index 0000000000..a824a34c30 --- /dev/null +++ b/bacula/src/win32/cats/grant_sqlite3_privileges.cmd @@ -0,0 +1,7 @@ +@ECHO off +REM +REM Script to grant privileges to the bacula database +REM + +REM nothing to do here +EXIT /b 0 diff --git a/bacula/src/win32/cats/make_def b/bacula/src/win32/cats/make_def new file mode 100755 index 0000000000..1b539b2abf --- /dev/null +++ b/bacula/src/win32/cats/make_def @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Make the stupid bacula.def file so that we don't have to do it +# manually +# +# Kern Sibbald, June 2007 +# + +echo "LIBRARY bacula_cats.dll" +echo "EXPORTS" +echo " " + +TOPDIR=`(cd ../../..;pwd)` +TOPDIR=${DEPKGS:-${TOPDIR}} +NM=i686-w64-mingw32-nm + +OBJS="sql.o sql_create.o sql_delete.o sql_find.o sql_get.o \ + sql_list.o sql_update.o bvfs.o sql_glue.o cats.o postgresql.o" + +# +# The data could be automated too +# +DATA="\ + client_backups \ + list_pool \ + drop_deltabs \ + create_deltabs \ + sel_JobMedia \ + uar_list_jobs \ + uar_file \ + uar_count_files \ + uar_sel_files \ + uar_del_temp \ + uar_del_temp1 \ + uar_create_temp \ + uar_create_temp1 \ + uar_last_full \ + uar_full \ + uar_inc \ + uar_list_temp \ + uar_sel_all_temp1 \ + uar_sel_fileset \ + uar_jobid_fileindex \ + uar_dif \ + uar_sel_all_temp \ + uar_count_files \ + uar_jobids_fileindex \ + uar_jobid_fileindex_from_dir \ + uar_jobid_fileindex_from_table \ + cleanup_created_job \ + cleanup_running_job \ + get_restore_objects \ + get_restore_objects \ + uar_sel_filesetid \ + create_delindex \ + expired_volumes \ + uap_upgrade_copies_oldest_job \ + uar_print_jobs \ + get_restore_objects \ + uar_sel_jobid_temp" + + +cd obj32/cats_postgresql +for i in ${OBJS}; do \ + echo "; $i"; \ + ${NM} $i | grep "^[0-9a-f]* T _" | cut -c13-; \ + echo " "; \ +done + +for i in ${DATA}; do \ + echo "$i DATA"; \ +done diff --git a/bacula/src/win32/cats/make_mysql_catalog_backup.cmd b/bacula/src/win32/cats/make_mysql_catalog_backup.cmd new file mode 100644 index 0000000000..abf55e18e3 --- /dev/null +++ b/bacula/src/win32/cats/make_mysql_catalog_backup.cmd @@ -0,0 +1,41 @@ +@ECHO off +REM +REM This script dumps your Bacula catalog in ASCII format +REM It works for MySQL, SQLite, and PostgreSQL +REM +REM %1 is the name of the database to be backed up and the name +REM of the output file (default = bacula +REM %2 is the user name with which to access the database +REM (default = bacula). +REM %3 is the password with which to access the database or "" if no password +REM (default "") +REM +REM +@ECHO on + +DEL /f "@working_dir_cmd@\%1.sql" 2>nul + +set MYSQLPASSWORD= + +IF NOT "%3"=="" SET MYSQLPASSWORD=--password=%3 +"@SQL_BINDIR@\mysqldump" -u %2 %MYSQLPASSWORD% -f --opt %1 > "@working_dir_cmd@\%1.sql" + +@ECHO off +REM +REM To read back a MySQL database use: +REM cd @working_dir_cmd@ +REM rd /s /q @SQL_BINDIR@\..\data\bacula +REM mysql < bacula.sql +REM +REM To read back a SQLite database use: +REM cd @working_dir_cmd@ +REM del /f bacula.db +REM sqlite bacula.db < bacula.sql +REM +REM To read back a PostgreSQL database use: +REM cd @working_dir_cmd@ +REM dropdb bacula +REM createdb -T template0 -E SQL_ASCII bacula +REM psql bacula < bacula.sql +REM +EXIT /b 0 diff --git a/bacula/src/win32/cats/make_mysql_tables.cmd b/bacula/src/win32/cats/make_mysql_tables.cmd new file mode 100644 index 0000000000..bab38d865d --- /dev/null +++ b/bacula/src/win32/cats/make_mysql_tables.cmd @@ -0,0 +1,14 @@ +@ECHO off +REM +REM Script to create Bacula MySQL tables +REM + +"@SQL_BINDIR@\mysql" -f %* < "@bin_dir_cmd@\make_mysql_tables.sql" +SET RESULT=%ERRORLEVEL% +IF %RESULT% GTR 0 GOTO :ERROR +ECHO Creation of Bacula MySQL tables succeeded. +EXIT /b 0 + +:ERROR +ECHO Creation of Bacula MySQL tables failed. +EXIT /b %RESULT% diff --git a/bacula/src/win32/cats/make_mysql_tables.sql b/bacula/src/win32/cats/make_mysql_tables.sql new file mode 100644 index 0000000000..86a3c8b484 --- /dev/null +++ b/bacula/src/win32/cats/make_mysql_tables.sql @@ -0,0 +1,357 @@ +USE ${db_name}; +-- +-- Note, we use BLOB rather than TEXT because in MySQL, +-- BLOBs are identical to TEXT except that BLOB is case +-- sensitive in sorts, which is what we want, and TEXT +-- is case insensitive. +-- +CREATE TABLE Filename ( + FilenameId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Name BLOB NOT NULL, + PRIMARY KEY(FilenameId), + INDEX (Name(255)) + ); + +CREATE TABLE Path ( + PathId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Path BLOB NOT NULL, + PRIMARY KEY(PathId), + INDEX (Path(255)) + ); + + +CREATE TABLE File ( + FileId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + FileIndex INTEGER UNSIGNED DEFAULT 0, + JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, + PathId INTEGER UNSIGNED NOT NULL REFERENCES Path, + FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename, + MarkId INTEGER UNSIGNED DEFAULT 0, + LStat TINYBLOB NOT NULL, + MD5 TINYBLOB, + PRIMARY KEY(FileId), + INDEX (JobId), + INDEX (JobId, PathId, FilenameId) + ); + +-- +-- Possibly add one or more of the following indexes +-- to the above File table if your Verifies are +-- too slow. +-- +-- INDEX (PathId), +-- INDEX (FilenameId), +-- INDEX (FilenameId, PathId) +-- INDEX (JobId), +-- + +CREATE TABLE MediaType ( + MediaTypeId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + MediaType TINYBLOB NOT NULL, + ReadOnly TINYINT DEFAULT 0, + PRIMARY KEY(MediaTypeId) + ); + +CREATE TABLE Storage ( + StorageId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Name TINYBLOB NOT NULL, + AutoChanger TINYINT DEFAULT 0, + PRIMARY KEY(StorageId) + ); + +CREATE TABLE Device ( + DeviceId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Name TINYBLOB NOT NULL, + MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType, + StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage, + DevMounts INTEGER UNSIGNED DEFAULT 0, + DevReadBytes BIGINT UNSIGNED DEFAULT 0, + DevWriteBytes BIGINT UNSIGNED DEFAULT 0, + DevReadBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevWriteBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevReadTime BIGINT UNSIGNED DEFAULT 0, + DevWriteTime BIGINT UNSIGNED DEFAULT 0, + DevReadTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevWriteTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0, + CleaningDate DATETIME DEFAULT 0, + CleaningPeriod BIGINT UNSIGNED DEFAULT 0, + PRIMARY KEY(DeviceId) + ); + + +CREATE TABLE Job ( + JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Job TINYBLOB NOT NULL, + Name TINYBLOB NOT NULL, + Type BINARY(1) NOT NULL, + Level BINARY(1) NOT NULL, + ClientId INTEGER DEFAULT 0 REFERENCES Client, + JobStatus BINARY(1) NOT NULL, + SchedTime DATETIME DEFAULT 0, + StartTime DATETIME DEFAULT 0, + EndTime DATETIME DEFAULT 0, + RealEndTime DATETIME DEFAULT 0, + JobTDate BIGINT UNSIGNED DEFAULT 0, + VolSessionId INTEGER UNSIGNED DEFAULT 0, + VolSessionTime INTEGER UNSIGNED DEFAULT 0, + JobFiles INTEGER UNSIGNED DEFAULT 0, + JobBytes BIGINT UNSIGNED DEFAULT 0, + ReadBytes BIGINT UNSIGNED DEFAULT 0, + JobErrors INTEGER UNSIGNED DEFAULT 0, + JobMissingFiles INTEGER UNSIGNED DEFAULT 0, + PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + FileSetId INTEGER UNSIGNED DEFAULT 0 REFERENCES FileSet, + PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job, + PurgedFiles TINYINT DEFAULT 0, + HasBase TINYINT DEFAULT 0, + PRIMARY KEY(JobId), + INDEX (Name(128)) + ); + +-- Create a table like Job for long term statistics +CREATE TABLE JobHisto ( + JobId INTEGER UNSIGNED NOT NULL, + Job TINYBLOB NOT NULL, + Name TINYBLOB NOT NULL, + Type BINARY(1) NOT NULL, + Level BINARY(1) NOT NULL, + ClientId INTEGER DEFAULT 0, + JobStatus BINARY(1) NOT NULL, + SchedTime DATETIME DEFAULT 0, + StartTime DATETIME DEFAULT 0, + EndTime DATETIME DEFAULT 0, + RealEndTime DATETIME DEFAULT 0, + JobTDate BIGINT UNSIGNED DEFAULT 0, + VolSessionId INTEGER UNSIGNED DEFAULT 0, + VolSessionTime INTEGER UNSIGNED DEFAULT 0, + JobFiles INTEGER UNSIGNED DEFAULT 0, + JobBytes BIGINT UNSIGNED DEFAULT 0, + ReadBytes BIGINT UNSIGNED DEFAULT 0, + JobErrors INTEGER UNSIGNED DEFAULT 0, + JobMissingFiles INTEGER UNSIGNED DEFAULT 0, + PoolId INTEGER UNSIGNED DEFAULT 0, + FileSetId INTEGER UNSIGNED DEFAULT 0, + PriorJobId INTEGER UNSIGNED DEFAULT 0, + PurgedFiles TINYINT DEFAULT 0, + HasBase TINYINT DEFAULT 0, + INDEX (StartTime) + ); + +CREATE TABLE Location ( + LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Location TINYBLOB NOT NULL, + Cost INTEGER DEFAULT 0, + Enabled TINYINT, + PRIMARY KEY(LocationId) + ); + +CREATE TABLE LocationLog ( + LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Date DATETIME DEFAULT 0, + Comment BLOB NOT NULL, + MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media, + LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location, + NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged', + 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL, + NewEnabled TINYINT, + PRIMARY KEY(LocLogId) +); + + +CREATE TABLE FileSet ( + FileSetId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + FileSet TINYBLOB NOT NULL, + MD5 TINYBLOB, + CreateTime DATETIME DEFAULT 0, + PRIMARY KEY(FileSetId) + ); + +CREATE TABLE JobMedia ( + JobMediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, + MediaId INTEGER UNSIGNED NOT NULL REFERENCES Media, + FirstIndex INTEGER UNSIGNED DEFAULT 0, + LastIndex INTEGER UNSIGNED DEFAULT 0, + StartFile INTEGER UNSIGNED DEFAULT 0, + EndFile INTEGER UNSIGNED DEFAULT 0, + StartBlock INTEGER UNSIGNED DEFAULT 0, + EndBlock INTEGER UNSIGNED DEFAULT 0, + VolIndex INTEGER UNSIGNED DEFAULT 0, + Copy INTEGER UNSIGNED DEFAULT 0, + Stripe INTEGER UNSIGNED DEFAULT 0, + PRIMARY KEY(JobMediaId), + INDEX (JobId, MediaId) + ); + + +CREATE TABLE Media ( + MediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + VolumeName TINYBLOB NOT NULL, + Slot INTEGER DEFAULT 0, + PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + MediaType TINYBLOB NOT NULL, + MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType, + LabelType TINYINT DEFAULT 0, + FirstWritten DATETIME DEFAULT 0, + LastWritten DATETIME DEFAULT 0, + LabelDate DATETIME DEFAULT 0, + VolJobs INTEGER UNSIGNED DEFAULT 0, + VolFiles INTEGER UNSIGNED DEFAULT 0, + VolBlocks INTEGER UNSIGNED DEFAULT 0, + VolMounts INTEGER UNSIGNED DEFAULT 0, + VolBytes BIGINT UNSIGNED DEFAULT 0, + VolParts INTEGER UNSIGNED DEFAULT 0, + VolErrors INTEGER UNSIGNED DEFAULT 0, + VolWrites INTEGER UNSIGNED DEFAULT 0, + VolCapacityBytes BIGINT UNSIGNED DEFAULT 0, + VolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged', + 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL, + Enabled TINYINT DEFAULT 1, + Recycle TINYINT DEFAULT 0, + ActionOnPurge TINYINT DEFAULT 0, + VolRetention BIGINT UNSIGNED DEFAULT 0, + VolUseDuration BIGINT UNSIGNED DEFAULT 0, + MaxVolJobs INTEGER UNSIGNED DEFAULT 0, + MaxVolFiles INTEGER UNSIGNED DEFAULT 0, + MaxVolBytes BIGINT UNSIGNED DEFAULT 0, + InChanger TINYINT DEFAULT 0, + StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage, + DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device, + MediaAddressing TINYINT DEFAULT 0, + VolReadTime BIGINT UNSIGNED DEFAULT 0, + VolWriteTime BIGINT UNSIGNED DEFAULT 0, + EndFile INTEGER UNSIGNED DEFAULT 0, + EndBlock INTEGER UNSIGNED DEFAULT 0, + LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location, + RecycleCount INTEGER UNSIGNED DEFAULT 0, + InitialWrite DATETIME DEFAULT 0, + ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + Comment BLOB, + PRIMARY KEY(MediaId), + UNIQUE (VolumeName(128)), + INDEX (PoolId) + ); + +CREATE TABLE Pool ( + PoolId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Name TINYBLOB NOT NULL, + NumVols INTEGER UNSIGNED DEFAULT 0, + MaxVols INTEGER UNSIGNED DEFAULT 0, + UseOnce TINYINT DEFAULT 0, + UseCatalog TINYINT DEFAULT 0, + AcceptAnyVolume TINYINT DEFAULT 0, + VolRetention BIGINT UNSIGNED DEFAULT 0, + VolUseDuration BIGINT UNSIGNED DEFAULT 0, + MaxVolJobs INTEGER UNSIGNED DEFAULT 0, + MaxVolFiles INTEGER UNSIGNED DEFAULT 0, + MaxVolBytes BIGINT UNSIGNED DEFAULT 0, + AutoPrune TINYINT DEFAULT 0, + Recycle TINYINT DEFAULT 0, + ActionOnPurge TINYINT DEFAULT 0, + PoolType ENUM('Backup', 'Copy', 'Cloned', 'Archive', 'Migration', 'Scratch') NOT NULL, + LabelType TINYINT DEFAULT 0, + LabelFormat TINYBLOB, + Enabled TINYINT DEFAULT 1, + ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + NextPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + MigrationHighBytes BIGINT UNSIGNED DEFAULT 0, + MigrationLowBytes BIGINT UNSIGNED DEFAULT 0, + MigrationTime BIGINT UNSIGNED DEFAULT 0, + UNIQUE (Name(128)), + PRIMARY KEY (PoolId) + ); + + +CREATE TABLE Client ( + ClientId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Name TINYBLOB NOT NULL, + Uname TINYBLOB NOT NULL, /* full uname -a of client */ + AutoPrune TINYINT DEFAULT 0, + FileRetention BIGINT UNSIGNED DEFAULT 0, + JobRetention BIGINT UNSIGNED DEFAULT 0, + UNIQUE (Name(128)), + PRIMARY KEY(ClientId) + ); + +CREATE TABLE Log ( + LogId INTEGER UNSIGNED AUTO_INCREMENT, + JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job, + Time DATETIME DEFAULT 0, + LogText BLOB NOT NULL, + PRIMARY KEY(LogId), + INDEX (JobId) + ); + + +CREATE TABLE BaseFiles ( + BaseId INTEGER UNSIGNED AUTO_INCREMENT, + BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job, + JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, + FileId BIGINT UNSIGNED NOT NULL REFERENCES File, + FileIndex INTEGER UNSIGNED, + PRIMARY KEY(BaseId) + ); + +CREATE TABLE UnsavedFiles ( + UnsavedId INTEGER UNSIGNED AUTO_INCREMENT, + JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, + PathId INTEGER UNSIGNED NOT NULL REFERENCES Path, + FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename, + PRIMARY KEY (UnsavedId) + ); + + + +CREATE TABLE Counters ( + Counter TINYBLOB NOT NULL, + MinValue INTEGER DEFAULT 0, + MaxValue INTEGER DEFAULT 0, + CurrentValue INTEGER DEFAULT 0, + WrapCounter TINYBLOB NOT NULL, + PRIMARY KEY (Counter(128)) + ); + +CREATE TABLE CDImages ( + MediaId INTEGER UNSIGNED NOT NULL, + LastBurn DATETIME NOT NULL, + PRIMARY KEY (MediaId) + ); + +CREATE TABLE Status ( + JobStatus CHAR(1) BINARY NOT NULL, + JobStatusLong BLOB, + PRIMARY KEY (JobStatus) + ); + +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('C', 'Created, not yet running'), + ('R', 'Running'), + ('B', 'Blocked'), + ('T', 'Completed successfully'), + ('E', 'Terminated with errors'), + ('e', 'Non-fatal error'), + ('f', 'Fatal error'), + ('D', 'Verify found differences'), + ('A', 'Canceled by user'), + ('F', 'Waiting for Client'), + ('S', 'Waiting for Storage daemon'), + ('m', 'Waiting for new media'), + ('M', 'Waiting for media mount'), + ('s', 'Waiting for storage resource'), + ('j', 'Waiting for job resource'), + ('c', 'Waiting for client resource'), + ('d', 'Waiting on maximum jobs'), + ('t', 'Waiting on start time'), + ('p', 'Waiting on higher priority jobs'), + ('i', 'Doing batch insert file records'), + ('a', 'SD despooling attributes'); + +CREATE TABLE Version ( + VersionId INTEGER UNSIGNED NOT NULL + ); + +-- Initialize Version +INSERT INTO Version (VersionId) VALUES (11); + diff --git a/bacula/src/win32/cats/make_postgresql_catalog_backup.cmd b/bacula/src/win32/cats/make_postgresql_catalog_backup.cmd new file mode 100644 index 0000000000..759a1011fe --- /dev/null +++ b/bacula/src/win32/cats/make_postgresql_catalog_backup.cmd @@ -0,0 +1,41 @@ +@ECHO off +REM +REM This script dumps your Bacula catalog in ASCII format +REM It works for MySQL, SQLite, and PostgreSQL +REM +REM %1 is the name of the database to be backed up and the name +REM of the output file (default = bacula +REM %2 is the user name with which to access the database +REM (default = bacula). +REM %3 is the password with which to access the database or "" if no password +REM (default "") +REM +REM +@ECHO on + +DEL /f "@working_dir_cmd@\%1.sql" 2>nul + +SET PGPASSWORD= + +IF NOT "%3"=="" SET PGPASSWORD=--password=%3 +"@SQL_BINDIR@\pg_dump" -c -U %2 %1 >"@working_dir_cmd@\%1.sql" + +@ECHO off +REM +REM To read back a MySQL database use: +REM cd @working_dir_cmd@ +REM rd /s /q @SQL_BINDIR@\..\data\bacula +REM mysql < bacula.sql +REM +REM To read back a SQLite database use: +REM cd @working_dir_cmd@ +REM del /f bacula.db +REM sqlite bacula.db < bacula.sql +REM +REM To read back a PostgreSQL database use: +REM cd @working_dir_cmd@ +REM dropdb bacula +REM createdb -T template0 -E SQL_ASCII bacula +REM psql bacula < bacula.sql +REM +EXIT /b 0 diff --git a/bacula/src/win32/cats/make_postgresql_tables.cmd b/bacula/src/win32/cats/make_postgresql_tables.cmd new file mode 100644 index 0000000000..0dae458541 --- /dev/null +++ b/bacula/src/win32/cats/make_postgresql_tables.cmd @@ -0,0 +1,14 @@ +@ECHO off +REM +REM Script to create Bacula PostgreSQL tables +REM + +"@SQL_BINDIR@\psql" -f "@bin_dir_cmd@\make_postgresql_tables.sql" -d bacula %* +IF ERRORLEVEL 1 GOTO :ERROR +ECHO Creation of Bacula PostgreSQL tables succeeded. +EXIT /b 0 +GOTO :EOF + +:ERROR +ECHO Creation of Bacula PostgreSQL tables failed. +EXIT /b 1 diff --git a/bacula/src/win32/cats/make_postgresql_tables.sql b/bacula/src/win32/cats/make_postgresql_tables.sql new file mode 100644 index 0000000000..e7d0d86a0a --- /dev/null +++ b/bacula/src/win32/cats/make_postgresql_tables.sql @@ -0,0 +1,380 @@ + +CREATE TABLE filename +( + filenameid serial not null, + name text not null, + primary key (filenameid) +); + +ALTER TABLE filename ALTER COLUMN name SET STATISTICS 1000; +CREATE UNIQUE INDEX filename_name_idx on filename (name); + +CREATE TABLE path +( + pathid serial not null, + path text not null, + primary key (pathid) +); + +ALTER TABLE path ALTER COLUMN path SET STATISTICS 1000; +CREATE UNIQUE INDEX path_name_idx on path (path); + +CREATE TABLE file +( + fileid bigserial not null, + fileindex integer not null default 0, + jobid integer not null, + pathid integer not null, + filenameid integer not null, + markid integer not null default 0, + lstat text not null, + md5 text not null, + primary key (fileid) +); + +CREATE INDEX file_jobid_idx on file (jobid); +CREATE INDEX file_fp_idx on file (filenameid, pathid); + +-- +-- Add this if you have a good number of job +-- that run at the same time +-- ALTER SEQUENCE file_fileid_seq CACHE 1000; + +-- +-- Possibly add one or more of the following indexes +-- if your Verifies are too slow. +-- +-- CREATE INDEX file_pathid_idx on file(pathid); +-- CREATE INDEX file_filenameid_idx on file(filenameid); +-- CREATE INDEX file_jpfid_idx on file (jobid, pathid, filenameid); + +CREATE TABLE job +( + jobid serial not null, + job text not null, + name text not null, + type char(1) not null, + level char(1) not null, + clientid integer default 0, + jobstatus char(1) not null, + schedtime timestamp without time zone, + starttime timestamp without time zone, + endtime timestamp without time zone, + realendtime timestamp without time zone, + jobtdate bigint default 0, + volsessionid integer default 0, + volsessiontime integer default 0, + jobfiles integer default 0, + jobbytes bigint default 0, + readbytes bigint default 0, + joberrors integer default 0, + jobmissingfiles integer default 0, + poolid integer default 0, + filesetid integer default 0, + purgedfiles smallint default 0, + hasbase smallint default 0, + priorjobid integer default 0, + primary key (jobid) +); + +CREATE INDEX job_name_idx on job (name); + +-- Create a table like Job for long term statistics +CREATE TABLE JobHisto (LIKE Job); +CREATE INDEX jobhisto_idx ON jobhisto ( starttime ); + + +CREATE TABLE Location ( + LocationId serial not null, + Location text not null, + Cost integer default 0, + Enabled smallint, + primary key (LocationId) +); + + +CREATE TABLE fileset +( + filesetid serial not null, + fileset text not null, + md5 text not null, + createtime timestamp without time zone not null, + primary key (filesetid) +); + +CREATE INDEX fileset_name_idx on fileset (fileset); + +CREATE TABLE jobmedia +( + jobmediaid serial not null, + jobid integer not null, + mediaid integer not null, + firstindex integer default 0, + lastindex integer default 0, + startfile integer default 0, + endfile integer default 0, + startblock bigint default 0, + endblock bigint default 0, + volindex integer default 0, + copy integer default 0, + primary key (jobmediaid) +); + +CREATE INDEX job_media_job_id_media_id_idx on jobmedia (jobid, mediaid); + +CREATE TABLE media +( + mediaid serial not null, + volumename text not null, + slot integer default 0, + poolid integer default 0, + mediatype text not null, + mediatypeid integer default 0, + labeltype integer default 0, + firstwritten timestamp without time zone, + lastwritten timestamp without time zone, + labeldate timestamp without time zone, + voljobs integer default 0, + volfiles integer default 0, + volblocks integer default 0, + volmounts integer default 0, + volbytes bigint default 0, + volparts integer default 0, + volerrors integer default 0, + volwrites integer default 0, + volcapacitybytes bigint default 0, + volstatus text not null + check (volstatus in ('Full','Archive','Append', + 'Recycle','Purged','Read-Only','Disabled', + 'Error','Busy','Used','Cleaning','Scratch')), + enabled smallint default 1, + recycle smallint default 0, + ActionOnPurge smallint default 0, + volretention bigint default 0, + voluseduration bigint default 0, + maxvoljobs integer default 0, + maxvolfiles integer default 0, + maxvolbytes bigint default 0, + inchanger smallint default 0, + StorageId integer default 0, + DeviceId integer default 0, + mediaaddressing smallint default 0, + volreadtime bigint default 0, + volwritetime bigint default 0, + endfile integer default 0, + endblock bigint default 0, + LocationId integer default 0, + recyclecount integer default 0, + initialwrite timestamp without time zone, + scratchpoolid integer default 0, + recyclepoolid integer default 0, + comment text, + primary key (mediaid) +); + +create unique index media_volumename_id on media (volumename); + + +CREATE TABLE MediaType ( + MediaTypeId SERIAL, + MediaType TEXT NOT NULL, + ReadOnly INTEGER DEFAULT 0, + PRIMARY KEY(MediaTypeId) + ); + +CREATE TABLE Storage ( + StorageId SERIAL, + Name TEXT NOT NULL, + AutoChanger INTEGER DEFAULT 0, + PRIMARY KEY(StorageId) + ); + +CREATE TABLE Device ( + DeviceId SERIAL, + Name TEXT NOT NULL, + MediaTypeId INTEGER NOT NULL, + StorageId INTEGER NOT NULL, + DevMounts INTEGER NOT NULL DEFAULT 0, + DevReadBytes BIGINT NOT NULL DEFAULT 0, + DevWriteBytes BIGINT NOT NULL DEFAULT 0, + DevReadBytesSinceCleaning BIGINT NOT NULL DEFAULT 0, + DevWriteBytesSinceCleaning BIGINT NOT NULL DEFAULT 0, + DevReadTime BIGINT NOT NULL DEFAULT 0, + DevWriteTime BIGINT NOT NULL DEFAULT 0, + DevReadTimeSinceCleaning BIGINT NOT NULL DEFAULT 0, + DevWriteTimeSinceCleaning BIGINT NOT NULL DEFAULT 0, + CleaningDate timestamp without time zone, + CleaningPeriod BIGINT NOT NULL DEFAULT 0, + PRIMARY KEY(DeviceId) + ); + + +CREATE TABLE pool +( + poolid serial not null, + name text not null, + numvols integer default 0, + maxvols integer default 0, + useonce smallint default 0, + usecatalog smallint default 0, + acceptanyvolume smallint default 0, + volretention bigint default 0, + voluseduration bigint default 0, + maxvoljobs integer default 0, + maxvolfiles integer default 0, + maxvolbytes bigint default 0, + autoprune smallint default 0, + recycle smallint default 0, + ActionOnPurge smallint default 0, + pooltype text + check (pooltype in ('Backup','Copy','Cloned','Archive','Migration','Scratch')), + labeltype integer default 0, + labelformat text not null, + enabled smallint default 1, + scratchpoolid integer default 0, + recyclepoolid integer default 0, + NextPoolId integer default 0, + MigrationHighBytes BIGINT DEFAULT 0, + MigrationLowBytes BIGINT DEFAULT 0, + MigrationTime BIGINT DEFAULT 0, + primary key (poolid) +); + +CREATE INDEX pool_name_idx on pool (name); + +CREATE TABLE client +( + clientid serial not null, + name text not null, + uname text not null, + autoprune smallint default 0, + fileretention bigint default 0, + jobretention bigint default 0, + primary key (clientid) +); + +create unique index client_name_idx on client (name); + +CREATE TABLE Log +( + LogId serial not null, + JobId integer not null, + Time timestamp without time zone, + LogText text not null, + primary key (LogId) +); +create index log_name_idx on Log (JobId); + +CREATE TABLE LocationLog ( + LocLogId SERIAL NOT NULL, + Date timestamp without time zone, + Comment TEXT NOT NULL, + MediaId INTEGER DEFAULT 0, + LocationId INTEGER DEFAULT 0, + newvolstatus text not null + check (newvolstatus in ('Full','Archive','Append', + 'Recycle','Purged','Read-Only','Disabled', + 'Error','Busy','Used','Cleaning','Scratch')), + newenabled smallint, + PRIMARY KEY(LocLogId) +); + + + +CREATE TABLE counters +( + counter text not null, + minvalue integer default 0, + maxvalue integer default 0, + currentvalue integer default 0, + wrapcounter text not null, + primary key (counter) +); + + + +CREATE TABLE basefiles +( + baseid serial not null, + jobid integer not null, + fileid bigint not null, + fileindex integer , + basejobid integer , + primary key (baseid) +); + +CREATE TABLE unsavedfiles +( + UnsavedId integer not null, + jobid integer not null, + pathid integer not null, + filenameid integer not null, + primary key (UnsavedId) +); + +CREATE TABLE CDImages +( + MediaId integer not null, + LastBurn timestamp without time zone not null, + primary key (MediaId) +); + + +CREATE TABLE version +( + versionid integer not null +); + +CREATE TABLE Status ( + JobStatus CHAR(1) NOT NULL, + JobStatusLong TEXT, + PRIMARY KEY (JobStatus) + ); + +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('C', 'Created, not yet running'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('R', 'Running'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('B', 'Blocked'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('T', 'Completed successfully'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('E', 'Terminated with errors'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('e', 'Non-fatal error'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('f', 'Fatal error'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('D', 'Verify found differences'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('A', 'Canceled by user'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('F', 'Waiting for Client'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('S', 'Waiting for Storage daemon'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('m', 'Waiting for new media'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('M', 'Waiting for media mount'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('s', 'Waiting for storage resource'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('j', 'Waiting for job resource'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('c', 'Waiting for client resource'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('d', 'Waiting on maximum jobs'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('t', 'Waiting on start time'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('p', 'Waiting on higher priority jobs'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('a', 'SD despooling attributes'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('i', 'Doing batch insert file records'); + +INSERT INTO Version (VersionId) VALUES (11); + +-- Make sure we have appropriate permissions + diff --git a/bacula/src/win32/cats/make_sqlite3_catalog_backup.cmd b/bacula/src/win32/cats/make_sqlite3_catalog_backup.cmd new file mode 100644 index 0000000000..4c968614ff --- /dev/null +++ b/bacula/src/win32/cats/make_sqlite3_catalog_backup.cmd @@ -0,0 +1,38 @@ +@ECHO off +REM +REM This script dumps your Bacula catalog in ASCII format +REM It works for MySQL, SQLite, and PostgreSQL +REM +REM %1 is the name of the database to be backed up and the name +REM of the output file (default = bacula +REM %2 is the user name with which to access the database +REM (default = bacula). +REM %3 is the password with which to access the database or "" if no password +REM (default "") +REM +REM +@ECHO on + +DEL /f "@working_dir_cmd@\%1.sql" 2>nul + +ECHO .dump | "@bin_dir_cmd@\sqlite3" "@working_dir_cmd@\%1.db" > "@working_dir_cmd@\%1.sql" + +@ECHO off +REM +REM To read back a MySQL database use: +REM cd @working_dir_cmd@ +REM rd /s /q @SQL_BINDIR@\..\data\bacula +REM mysql < bacula.sql +REM +REM To read back a SQLite database use: +REM cd @working_dir_cmd@ +REM del /f bacula.db +REM sqlite bacula.db < bacula.sql +REM +REM To read back a PostgreSQL database use: +REM cd @working_dir_cmd@ +REM dropdb bacula +REM createdb -T template0 -E SQL_ASCII bacula +REM psql bacula < bacula.sql +REM +EXIT /b 0 diff --git a/bacula/src/win32/cats/make_sqlite3_tables.cmd b/bacula/src/win32/cats/make_sqlite3_tables.cmd new file mode 100644 index 0000000000..aa73980636 --- /dev/null +++ b/bacula/src/win32/cats/make_sqlite3_tables.cmd @@ -0,0 +1,7 @@ +@ECHO off +REM +REM Script to create Bacula SQLite tables + +"@bin_dir_cmd@\sqlite3" %* "@working_dir_cmd@\bacula.db" < "@bin_dir_cmd@\make_sqlite3_tables.sql" + +EXIT /b 0 diff --git a/bacula/src/win32/cats/make_sqlite3_tables.sql b/bacula/src/win32/cats/make_sqlite3_tables.sql new file mode 100644 index 0000000000..83a4e4ca2f --- /dev/null +++ b/bacula/src/win32/cats/make_sqlite3_tables.sql @@ -0,0 +1,384 @@ + +CREATE TABLE Filename ( + FilenameId INTEGER, + Name TEXT DEFAULT '', + PRIMARY KEY(FilenameId) + ); + +CREATE INDEX inx1 ON Filename (Name); + +CREATE TABLE Path ( + PathId INTEGER, + Path TEXT DEFAULT '', + PRIMARY KEY(PathId) + ); + +CREATE INDEX inx2 ON Path (Path); + + +CREATE TABLE File ( + FileId INTEGER, + FileIndex INTEGER UNSIGNED NOT NULL, + JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + PathId INTEGER UNSIGNED REFERENCES Path NOT NULL, + FilenameId INTEGER UNSIGNED REFERENCES Filename NOT NULL, + MarkId INTEGER UNSIGNED DEFAULT 0, + LStat VARCHAR(255) NOT NULL, + MD5 VARCHAR(255) NOT NULL, + PRIMARY KEY(FileId) + ); + +CREATE INDEX inx3 ON File (JobId); +CREATE INDEX inx4 ON File (FilenameId, PathId); +-- +-- Possibly add one or more of the following indexes +-- if your Verifies are too slow. +-- +-- CREATE INDEX inx4 ON File (PathId); +-- CREATE INDEX inx5 ON File (FileNameId); +-- CREATE INDEX inx9 ON File (JobId, PathId, FilenameId); + +CREATE TABLE Job ( + JobId INTEGER, + Job VARCHAR(128) NOT NULL, + Name VARCHAR(128) NOT NULL, + Type CHAR(1) NOT NULL, + Level CHAR(1) NOT NULL, + ClientId INTEGER REFERENCES Client DEFAULT 0, + JobStatus CHAR(1) NOT NULL, + SchedTime DATETIME NOT NULL, + StartTime DATETIME DEFAULT 0, + EndTime DATETIME DEFAULT 0, + RealEndTime DATETIME DEFAULT 0, + JobTDate BIGINT UNSIGNED DEFAULT 0, + VolSessionId INTEGER UNSIGNED DEFAULT 0, + VolSessionTime INTEGER UNSIGNED DEFAULT 0, + JobFiles INTEGER UNSIGNED DEFAULT 0, + JobBytes BIGINT UNSIGNED DEFAULT 0, + ReadBytes BIGINT UNSIGNED DEFAULT 0, + JobErrors INTEGER UNSIGNED DEFAULT 0, + JobMissingFiles INTEGER UNSIGNED DEFAULT 0, + PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + FileSetId INTEGER UNSIGNED REFERENCES FileSet DEFAULT 0, + PriorJobId INTEGER UNSIGNED REFERENCES Job DEFAULT 0, + PurgedFiles TINYINT DEFAULT 0, + HasBase TINYINT DEFAULT 0, + PRIMARY KEY(JobId) + ); +CREATE INDEX inx6 ON Job (Name); + +-- Create a table like Job for long term statistics +CREATE TABLE JobHisto ( + JobId INTEGER, + Job VARCHAR(128) NOT NULL, + Name VARCHAR(128) NOT NULL, + Type CHAR(1) NOT NULL, + Level CHAR(1) NOT NULL, + ClientId INTEGER DEFAULT 0, + JobStatus CHAR(1) NOT NULL, + SchedTime DATETIME NOT NULL, + StartTime DATETIME DEFAULT 0, + EndTime DATETIME DEFAULT 0, + RealEndTime DATETIME DEFAULT 0, + JobTDate BIGINT UNSIGNED DEFAULT 0, + VolSessionId INTEGER UNSIGNED DEFAULT 0, + VolSessionTime INTEGER UNSIGNED DEFAULT 0, + JobFiles INTEGER UNSIGNED DEFAULT 0, + JobBytes BIGINT UNSIGNED DEFAULT 0, + ReadBytes BIGINT UNSIGNED DEFAULT 0, + JobErrors INTEGER UNSIGNED DEFAULT 0, + JobMissingFiles INTEGER UNSIGNED DEFAULT 0, + PoolId INTEGER UNSIGNED DEFAULT 0, + FileSetId INTEGER UNSIGNED DEFAULT 0, + PriorJobId INTEGER UNSIGNED DEFAULT 0, + PurgedFiles TINYINT DEFAULT 0, + HasBase TINYINT DEFAULT 0 + ); +CREATE INDEX inx61 ON JobHisto (StartTime); + +CREATE TABLE Location ( + LocationId INTEGER, + Location TEXT NOT NULL, + Cost INTEGER DEFAULT 0, + Enabled TINYINT, + PRIMARY KEY(LocationId) + ); + +CREATE TABLE LocationLog ( + LocLogId INTEGER, + Date DATETIME NOT NULL, + Comment TEXT NOT NULL, + MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0, + LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0, + NewVolStatus VARCHAR(20) NOT NULL, + NewEnabled TINYINT NOT NULL, + PRIMARY KEY(LocLogId) +); + + +CREATE TABLE Log ( + LogId INTEGER, + JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + Time DATETIME NOT NULL, + LogText TEXT NOT NULL, + PRIMARY KEY(LogId) + ); +CREATE INDEX LogInx1 ON Log (JobId); + + +CREATE TABLE FileSet ( + FileSetId INTEGER, + FileSet VARCHAR(128) NOT NULL, + MD5 VARCHAR(25) NOT NULL, + CreateTime DATETIME DEFAULT 0, + PRIMARY KEY(FileSetId) + ); + +CREATE TABLE JobMedia ( + JobMediaId INTEGER, + JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + MediaId INTEGER UNSIGNED REFERENCES Media NOT NULL, + FirstIndex INTEGER UNSIGNED NOT NULL, + LastIndex INTEGER UNSIGNED NOT NULL, + StartFile INTEGER UNSIGNED DEFAULT 0, + EndFile INTEGER UNSIGNED DEFAULT 0, + StartBlock INTEGER UNSIGNED DEFAULT 0, + EndBlock INTEGER UNSIGNED DEFAULT 0, + VolIndex INTEGER UNSIGNED DEFAULT 0, + Copy INTEGER UNSIGNED DEFAULT 0, + PRIMARY KEY(JobMediaId) + ); + +CREATE INDEX inx7 ON JobMedia (JobId, MediaId); + + +CREATE TABLE Media ( + MediaId INTEGER, + VolumeName VARCHAR(128) NOT NULL, + Slot INTEGER DEFAULT 0, + PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + MediaType VARCHAR(128) NOT NULL, + MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0, + LabelType TINYINT DEFAULT 0, + FirstWritten DATETIME DEFAULT 0, + LastWritten DATETIME DEFAULT 0, + LabelDate DATETIME DEFAULT 0, + VolJobs INTEGER UNSIGNED DEFAULT 0, + VolFiles INTEGER UNSIGNED DEFAULT 0, + VolBlocks INTEGER UNSIGNED DEFAULT 0, + VolMounts INTEGER UNSIGNED DEFAULT 0, + VolBytes BIGINT UNSIGNED DEFAULT 0, + VolParts INTEGER UNSIGNED DEFAULT 0, + VolErrors INTEGER UNSIGNED DEFAULT 0, + VolWrites INTEGER UNSIGNED DEFAULT 0, + VolCapacityBytes BIGINT UNSIGNED DEFAULT 0, + VolStatus VARCHAR(20) NOT NULL, + Enabled TINYINT DEFAULT 1, + Recycle TINYINT DEFAULT 0, + ActionOnPurge TINYINT DEFAULT 0, + VolRetention BIGINT UNSIGNED DEFAULT 0, + VolUseDuration BIGINT UNSIGNED DEFAULT 0, + MaxVolJobs INTEGER UNSIGNED DEFAULT 0, + MaxVolFiles INTEGER UNSIGNED DEFAULT 0, + MaxVolBytes BIGINT UNSIGNED DEFAULT 0, + InChanger TINYINT DEFAULT 0, + StorageId INTEGER UNSIGNED REFERENCES Storage DEFAULT 0, + DeviceId INTEGER UNSIGNED REFERENCES Device DEFAULT 0, + MediaAddressing TINYINT DEFAULT 0, + VolReadTime BIGINT UNSIGNED DEFAULT 0, + VolWriteTime BIGINT UNSIGNED DEFAULT 0, + EndFile INTEGER UNSIGNED DEFAULT 0, + EndBlock INTEGER UNSIGNED DEFAULT 0, + LocationId INTEGER UNSIGNED REFERENCES Location DEFAULT 0, + RecycleCount INTEGER UNSIGNED DEFAULT 0, + InitialWrite DATETIME DEFAULT 0, + ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + Comment TEXT, + PRIMARY KEY(MediaId) + ); + +CREATE INDEX inx8 ON Media (PoolId); + +CREATE TABLE MediaType ( + MediaTypeId INTEGER, + MediaType VARCHAR(128) NOT NULL, + ReadOnly TINYINT DEFAULT 0, + PRIMARY KEY(MediaTypeId) + ); + +CREATE TABLE Storage ( + StorageId INTEGER, + Name VARCHAR(128) NOT NULL, + AutoChanger TINYINT DEFAULT 0, + PRIMARY KEY(StorageId) + ); + +CREATE TABLE Device ( + DeviceId INTEGER, + Name VARCHAR(128) NOT NULL, + MediaTypeId INTEGER UNSIGNED REFERENCES MediaType NOT NULL, + StorageId INTEGER UNSIGNED REFERENCES Storage, + DevMounts INTEGER UNSIGNED DEFAULT 0, + DevReadBytes BIGINT UNSIGNED DEFAULT 0, + DevWriteBytes BIGINT UNSIGNED DEFAULT 0, + DevReadBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevWriteBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevReadTime BIGINT UNSIGNED DEFAULT 0, + DevWriteTime BIGINT UNSIGNED DEFAULT 0, + DevReadTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevWriteTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0, + CleaningDate DATETIME DEFAULT 0, + CleaningPeriod BIGINT UNSIGNED DEFAULT 0, + PRIMARY KEY(DeviceId) + ); + + +CREATE TABLE Pool ( + PoolId INTEGER, + Name VARCHAR(128) NOT NULL, + NumVols INTEGER UNSIGNED DEFAULT 0, + MaxVols INTEGER UNSIGNED DEFAULT 0, + UseOnce TINYINT DEFAULT 0, + UseCatalog TINYINT DEFAULT 1, + AcceptAnyVolume TINYINT DEFAULT 0, + VolRetention BIGINT UNSIGNED DEFAULT 0, + VolUseDuration BIGINT UNSIGNED DEFAULT 0, + MaxVolJobs INTEGER UNSIGNED DEFAULT 0, + MaxVolFiles INTEGER UNSIGNED DEFAULT 0, + MaxVolBytes BIGINT UNSIGNED DEFAULT 0, + AutoPrune TINYINT DEFAULT 0, + Recycle TINYINT DEFAULT 0, + ActionOnPurge TINYINT DEFAULT 0, + PoolType VARCHAR(20) NOT NULL, + LabelType TINYINT DEFAULT 0, + LabelFormat VARCHAR(128) NOT NULL, + Enabled TINYINT DEFAULT 1, + ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + NextPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + MigrationHighBytes BIGINT UNSIGNED DEFAULT 0, + MigrationLowBytes BIGINT UNSIGNED DEFAULT 0, + MigrationTime BIGINT UNSIGNED DEFAULT 0, + UNIQUE (Name), + PRIMARY KEY (PoolId) + ); + + +CREATE TABLE Client ( + ClientId INTEGER, + Name VARCHAR(128) NOT NULL, + Uname VARCHAR(255) NOT NULL, -- uname -a field + AutoPrune TINYINT DEFAULT 0, + FileRetention BIGINT UNSIGNED DEFAULT 0, + JobRetention BIGINT UNSIGNED DEFAULT 0, + UNIQUE (Name), + PRIMARY KEY(ClientId) + ); + +CREATE TABLE BaseFiles ( + BaseId INTEGER, + BaseJobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + FileId INTEGER UNSIGNED REFERENCES File NOT NULL, + FileIndex INTEGER UNSIGNED, + PRIMARY KEY(BaseId) + ); + +CREATE TABLE UnsavedFiles ( + UnsavedId INTEGER, + JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + PathId INTEGER UNSIGNED REFERENCES Path NOT NULL, + FilenameId INTEGER UNSIGNED REFERENCES Filename NOT NULL, + PRIMARY KEY (UnsavedId) + ); + + +CREATE TABLE NextId ( + id INTEGER UNSIGNED DEFAULT 0, + TableName TEXT NOT NULL, + PRIMARY KEY (TableName) + ); + + + +-- Initialize JobId to start at 1 +INSERT INTO NextId (id, TableName) VALUES (1, 'Job'); + +CREATE TABLE Version ( + VersionId INTEGER UNSIGNED NOT NULL + ); + + +CREATE TABLE Counters ( + Counter TEXT NOT NULL, + MinValue INTEGER DEFAULT 0, + MaxValue INTEGER DEFAULT 0, + CurrentValue INTEGER DEFAULT 0, + WrapCounter TEXT NOT NULL, + PRIMARY KEY (Counter) + ); + +CREATE TABLE CDImages ( + MediaId INTEGER UNSIGNED NOT NULL, + LastBurn DATETIME NOT NULL, + PRIMARY KEY (MediaId) + ); + + +CREATE TABLE Status ( + JobStatus CHAR(1) NOT NULL, + JobStatusLong BLOB, + PRIMARY KEY (JobStatus) + ); + +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('C', 'Created, not yet running'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('R', 'Running'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('B', 'Blocked'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('T', 'Completed successfully'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('E', 'Terminated with errors'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('e', 'Non-fatal error'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('f', 'Fatal error'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('D', 'Verify found differences'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('A', 'Canceled by user'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('F', 'Waiting for Client'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('S', 'Waiting for Storage daemon'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('m', 'Waiting for new media'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('M', 'Waiting for media mount'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('s', 'Waiting for storage resource'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('j', 'Waiting for job resource'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('c', 'Waiting for client resource'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('d', 'Waiting on maximum jobs'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('t', 'Waiting on start time'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('p', 'Waiting on higher priority jobs'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('a', 'SD despooling attributes'); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('i', 'Doing batch insert file records'); + + +-- Initialize Version +INSERT INTO Version (VersionId) VALUES (11); + + +PRAGMA default_cache_size = 100000; +PRAGMA synchronous = NORMAL; diff --git a/bacula/src/win32/compat/Makefile b/bacula/src/win32/compat/Makefile new file mode 100644 index 0000000000..d1fa6772ad --- /dev/null +++ b/bacula/src/win32/compat/Makefile @@ -0,0 +1,66 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# +# Author: Howard Thomson +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Written for Bacula by Howard Thomson, April 2006 +# + +include ../Makefile.inc + +INCLUDES = \ + $(INCLUDE_GCC) \ + $(INCLUDE_MINGW) \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_VSS) \ + $(INCLUDE_ICONS) \ + $(INCLUDE_OPENSSL) + +DEFINES = \ + -DWIN32 \ + $(HAVES) + +###################################################################### + +# Files files in src/win32/compat + +LIB_OBJS = \ + $(OBJDIR)/compat.o \ + $(OBJDIR)/getopt.o \ + $(OBJDIR)/print.o \ + $(OBJDIR)/vss.o \ + $(OBJDIR)/vss_XP.o \ + $(OBJDIR)/vss_W2K3.o \ + $(OBJDIR)/vss_Vista.o + +###################################################################### + +# Targets + +.PHONY: all clean + +all: $(LIBDIR)/libcompat.a + +clean: + @echo "Cleaning `pwd`" + $(ECHO_CMD)rm -f $(OBJDIR)/*.[od] $(LIBDIR)/libcompat.a + +# +# Rules +# + +$(LIBDIR)/libcompat.a: $(LIB_OBJS) + @echo "Updating archive $@" + $(call checkdir,$@) + $(ECHO_CMD)$(AR) rs $@ $^ + +include ../Makefile.rules + +ifneq ($(MAKECMDGOALS),clean) +include $(patsubst %.o,%.d,$(filter-out %.res,$(LIB_OBJS))) +endif diff --git a/bacula/src/win32/compat/alloca.h b/bacula/src/win32/compat/alloca.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/arpa/inet.h b/bacula/src/win32/compat/arpa/inet.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp new file mode 100644 index 0000000000..f16e479fb1 --- /dev/null +++ b/bacula/src/win32/compat/compat.cpp @@ -0,0 +1,2989 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +// -*- Mode: C++ -*- +// compat.cpp -- compatibilty layer to make bacula-fd run +// natively under windows +// +// Copyright transferred from Raider Solutions, Inc to +// Kern Sibbald and John Walker by express permission. +// +// Author : Christopher S. Hull +// Created On : Sat Jan 31 15:55:00 2004 + +#include "bacula.h" +#include "compat.h" +#include "jcr.h" +#include "findlib/find.h" + +/* Note, if you want to see what Windows variables and structures + * are defined, bacula.h includes , which is found in: + * + * cross-tools/mingw32/mingw32/include + * or + * cross-tools/mingw-w64/x86_64-pc-mingw32/include + * + * depending on whether we are building the 32 bit version or + * the 64 bit version. + */ + +static const int dbglvl = 500; + +#define b_errno_win32 (1<<29) + +#define MAX_PATHLENGTH 1024 + +/** + UTF-8 to UCS2 path conversion is expensive, + so we cache the conversion. During backup the + conversion is called 3 times (lstat, attribs, open), + by using the cache this is reduced to 1 time + */ +static POOLMEM *g_pWin32ConvUTF8Cache = NULL; +static POOLMEM *g_pWin32ConvUCS2Cache = NULL; +static DWORD g_dwWin32ConvUTF8strlen = 0; +static pthread_mutex_t Win32Convmutex = PTHREAD_MUTEX_INITIALIZER; + +/* Forward referenced functions */ +static const char *errorString(void); + +/* The following functions are available only in the FileDaemon with VSS + * These functions uses the VSSObject to resolve a Path to a Snapshot Path, + * the VSSObject is available "per job", and some jobs such as Restore or Verify + * may not have a VSSObject. + */ + +static BOOL default_VSSPathConverter() +{ + return false; +} + +static t_pVSSPathConvert g_pVSSPathConvert = NULL; +static t_pVSSPathConvertW g_pVSSPathConvertW = NULL; +static t_pVSSPathConverter g_pVSSPathConverter = default_VSSPathConverter; /* To know if we can use the VSSPath functions */ + + +void SetVSSPathConvert(t_pVSSPathConverter pPathConverter, t_pVSSPathConvert pPathConvert, t_pVSSPathConvertW pPathConvertW) +{ + g_pVSSPathConvert = pPathConvert; + g_pVSSPathConvertW = pPathConvertW; + g_pVSSPathConverter = pPathConverter; +} + +static void Win32ConvInitCache() +{ + if (g_pWin32ConvUTF8Cache) { + return; + } + g_pWin32ConvUTF8Cache = get_pool_memory(PM_FNAME); + g_pWin32ConvUCS2Cache = get_pool_memory(PM_FNAME); +} + +void Win32ConvCleanupCache() +{ + P(Win32Convmutex); + if (g_pWin32ConvUTF8Cache) { + free_pool_memory(g_pWin32ConvUTF8Cache); + g_pWin32ConvUTF8Cache = NULL; + } + + if (g_pWin32ConvUCS2Cache) { + free_pool_memory(g_pWin32ConvUCS2Cache); + g_pWin32ConvUCS2Cache = NULL; + } + + g_dwWin32ConvUTF8strlen = 0; + V(Win32Convmutex); +} + + +/* to allow the usage of the original version in this file here */ +#undef fputs + + +//#define USE_WIN32_COMPAT_IO 1 +#define USE_WIN32_32KPATHCONVERSION 1 + +extern DWORD g_platform_id; +extern DWORD g_MinorVersion; + +/* From Microsoft SDK (KES) is the diff between Jan 1 1601 and Jan 1 1970 */ +#ifdef HAVE_MINGW +#define WIN32_FILETIME_ADJUST 0x19DB1DED53E8000ULL +#else +#define WIN32_FILETIME_ADJUST 0x19DB1DED53E8000I64 +#endif + +#define WIN32_FILETIME_SCALE 10000000 // 100ns/second + +/** + * Convert from UTF-8 to VSS Windows path/file + * Used by compatibility layer for Unix system calls + */ +static void conv_unix_to_vss_win32_path(const char *name, char *win32_name, DWORD dwSize) +{ + const char *fname = name; + char *tname = win32_name; + + Dmsg0(dbglvl, "Enter convert_unix_to_win32_path\n"); + + if (IsPathSeparator(name[0]) && + IsPathSeparator(name[1]) && + name[2] == '.' && + IsPathSeparator(name[3])) { + + *win32_name++ = '\\'; + *win32_name++ = '\\'; + *win32_name++ = '.'; + *win32_name++ = '\\'; + + name += 4; + } else if (g_platform_id != VER_PLATFORM_WIN32_WINDOWS && !g_pVSSPathConverter()) { + /* allow path to be 32767 bytes */ + *win32_name++ = '\\'; + *win32_name++ = '\\'; + *win32_name++ = '?'; + *win32_name++ = '\\'; + } + + while (*name) { + /** Check for Unix separator and convert to Win32 */ + if (name[0] == '/' && name[1] == '/') { /* double slash? */ + name++; /* yes, skip first one */ + } + if (*name == '/') { + *win32_name++ = '\\'; /* convert char */ + /* If Win32 separator that is "quoted", remove quote */ + } else if (*name == '\\' && name[1] == '\\') { + *win32_name++ = '\\'; + name++; /* skip first \ */ + } else { + *win32_name++ = *name; /* copy character */ + } + name++; + } + /** Strip any trailing slash, if we stored something + * but leave "c:\" with backslash (root directory case + */ + if (*fname != 0 && win32_name[-1] == '\\' && strlen (fname) != 3) { + win32_name[-1] = 0; + } else { + *win32_name = 0; + } + + /** here we convert to VSS specific file name which + can get longer because VSS will make something like + \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy1\\bacula\\uninstall.exe + from c:\bacula\uninstall.exe + */ + Dmsg1(dbglvl, "path=%s\n", tname); + if (g_pVSSPathConverter()) { + POOLMEM *pszBuf = get_pool_memory (PM_FNAME); + pszBuf = check_pool_memory_size(pszBuf, dwSize); + bstrncpy(pszBuf, tname, strlen(tname)+1); + g_pVSSPathConvert(pszBuf, tname, dwSize); + free_pool_memory(pszBuf); + } + + Dmsg1(dbglvl, "Leave cvt_u_to_win32_path path=%s\n", tname); +} + +/** Conversion of a Unix filename to a Win32 filename */ +void unix_name_to_win32(POOLMEM **win32_name, const char *name) +{ + /* One extra byte should suffice, but we double it */ + /* add MAX_PATH bytes for VSS shadow copy name */ + DWORD dwSize = 2*strlen(name)+MAX_PATH; + *win32_name = check_pool_memory_size(*win32_name, dwSize); + conv_unix_to_vss_win32_path(name, *win32_name, dwSize); +} + + +/** + * This function expects an UCS-encoded standard wchar_t in pszUCSPath and + * will complete the input path to an absolue path of the form \\?\c:\path\file + * + * With this trick, it is possible to have 32K characters long paths. + * + * Optionally one can use pBIsRawPath to determine id pszUCSPath contains a path + * to a raw windows partition. + * + * created 02/27/2006 Thorsten Engel + */ +static POOLMEM* +make_wchar_win32_path(POOLMEM *pszUCSPath, BOOL *pBIsRawPath /*= NULL*/) +{ + + Dmsg0(dbglvl, "Enter wchar_win32_path\n"); + if (pBIsRawPath) { + *pBIsRawPath = FALSE; /* Initialize, set later */ + } + + if (!p_GetCurrentDirectoryW) { + Dmsg0(dbglvl, "Leave wchar_win32_path no change \n"); + return pszUCSPath; + } + + wchar_t *name = (wchar_t *)pszUCSPath; + + /* if it has already the desired form, exit without changes */ + if (wcslen(name) > 3 && wcsncmp(name, L"\\\\?\\", 4) == 0) { + Dmsg0(dbglvl, "Leave wchar_win32_path no change \n"); + return pszUCSPath; + } + + wchar_t *pwszBuf = (wchar_t *)get_pool_memory(PM_FNAME); + wchar_t *pwszCurDirBuf = (wchar_t *)get_pool_memory(PM_FNAME); + DWORD dwCurDirPathSize = 0; + + /* get buffer with enough size (name+max 6. wchars+1 null terminator */ + DWORD dwBufCharsNeeded = (wcslen(name)+7); + pwszBuf = (wchar_t *)check_pool_memory_size((POOLMEM *)pwszBuf, dwBufCharsNeeded*sizeof(wchar_t)); + + /* add \\?\ to support 32K long filepaths + it is important to make absolute paths, so we add drive and + current path if necessary */ + + BOOL bAddDrive = TRUE; + BOOL bAddCurrentPath = TRUE; + BOOL bAddPrefix = TRUE; + + /* does path begin with drive? if yes, it is absolute */ + if (iswalpha(name[0]) && name[1] == ':' && IsPathSeparator(name[2])) { + bAddDrive = FALSE; + bAddCurrentPath = FALSE; + } + + /* is path absolute? */ + if (IsPathSeparator(name[0])) + bAddCurrentPath = FALSE; + + /* is path relative to itself?, if yes, skip ./ */ + if (name[0] == '.' && IsPathSeparator(name[1])) { + name += 2; + } + + /* is path of form '//./'? */ + if (IsPathSeparator(name[0]) && + IsPathSeparator(name[1]) && + name[2] == '.' && + IsPathSeparator(name[3])) { + bAddDrive = FALSE; + bAddCurrentPath = FALSE; + bAddPrefix = FALSE; + if (pBIsRawPath) { + *pBIsRawPath = TRUE; + } + } + + int nParseOffset = 0; + + /* add 4 bytes header */ + if (bAddPrefix) { + nParseOffset = 4; + wcscpy(pwszBuf, L"\\\\?\\"); + } + + /* get current path if needed */ + if (bAddDrive || bAddCurrentPath) { + dwCurDirPathSize = p_GetCurrentDirectoryW(0, NULL); + if (dwCurDirPathSize > 0) { + /* get directory into own buffer as it may either return c:\... or \\?\C:\.... */ + pwszCurDirBuf = (wchar_t *)check_pool_memory_size((POOLMEM *)pwszCurDirBuf, (dwCurDirPathSize+1)*sizeof(wchar_t)); + p_GetCurrentDirectoryW(dwCurDirPathSize, pwszCurDirBuf); + } else { + /* we have no info for doing so */ + bAddDrive = FALSE; + bAddCurrentPath = FALSE; + } + } + + + /* add drive if needed */ + if (bAddDrive && !bAddCurrentPath) { + wchar_t szDrive[3]; + + if (IsPathSeparator(pwszCurDirBuf[0]) && + IsPathSeparator(pwszCurDirBuf[1]) && + pwszCurDirBuf[2] == '?' && + IsPathSeparator(pwszCurDirBuf[3])) { + /* copy drive character */ + szDrive[0] = pwszCurDirBuf[4]; + } else { + /* copy drive character */ + szDrive[0] = pwszCurDirBuf[0]; + } + + szDrive[1] = ':'; + szDrive[2] = 0; + + wcscat(pwszBuf, szDrive); + nParseOffset +=2; + } + + /* add path if needed */ + if (bAddCurrentPath) { + /* the 1 add. character is for the eventually added backslash */ + dwBufCharsNeeded += dwCurDirPathSize+1; + pwszBuf = (wchar_t *)check_pool_memory_size((POOLMEM *)pwszBuf, dwBufCharsNeeded*sizeof(wchar_t)); + /* get directory into own buffer as it may either return c:\... or \\?\C:\.... */ + + if (IsPathSeparator(pwszCurDirBuf[0]) && + IsPathSeparator(pwszCurDirBuf[1]) && + pwszCurDirBuf[2] == '?' && + IsPathSeparator(pwszCurDirBuf[3])) { + /* copy complete string */ + wcscpy(pwszBuf, pwszCurDirBuf); + } else { + /* append path */ + wcscat(pwszBuf, pwszCurDirBuf); + } + + nParseOffset = wcslen((LPCWSTR) pwszBuf); + + /* check if path ends with backslash, if not, add one */ + if (!IsPathSeparator(pwszBuf[nParseOffset-1])) { + wcscat(pwszBuf, L"\\"); + nParseOffset++; + } + } + + wchar_t *win32_name = &pwszBuf[nParseOffset]; + wchar_t *name_start = name; + + while (*name) { + /* Check for Unix separator and convert to Win32, eliminating + * duplicate separators. + */ + if (IsPathSeparator(*name)) { + *win32_name++ = '\\'; /* convert char */ + + /* Eliminate consecutive slashes, but not at the start so that + * \\.\ still works. + */ + if (name_start != name && IsPathSeparator(name[1])) { + name++; + } + } else { + *win32_name++ = *name; /* copy character */ + } + name++; + } + + /* null terminate string */ + *win32_name = 0; + + /* here we convert to VSS specific file name which + * can get longer because VSS will make something like + * \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy1\\bacula\\uninstall.exe + * from c:\bacula\uninstall.exe + */ + if (g_pVSSPathConvertW != NULL && g_pVSSPathConverter()) { + /* is output buffer large enough? */ + pwszBuf = (wchar_t *)check_pool_memory_size((POOLMEM *)pwszBuf, + (dwBufCharsNeeded+MAX_PATH)*sizeof(wchar_t)); + /* create temp. buffer */ + wchar_t *pszBuf = (wchar_t *)get_pool_memory(PM_FNAME); + pszBuf = (wchar_t *)check_pool_memory_size((POOLMEM *)pszBuf, + (dwBufCharsNeeded+MAX_PATH)*sizeof(wchar_t)); + if (bAddPrefix) + nParseOffset = 4; + else + nParseOffset = 0; + wcsncpy(pszBuf, &pwszBuf[nParseOffset], wcslen(pwszBuf)+1-nParseOffset); + g_pVSSPathConvertW(pszBuf, pwszBuf, dwBufCharsNeeded+MAX_PATH); + free_pool_memory((POOLMEM *)pszBuf); + } + + free_pool_memory(pszUCSPath); + free_pool_memory((POOLMEM *)pwszCurDirBuf); + + Dmsg1(dbglvl, "Leave wchar_win32_path=%s\n", pwszBuf); + return (POOLMEM *)pwszBuf; +} + +/* + * Convert from WCHAR (UCS) to UTF-8 + */ +int +wchar_2_UTF8(POOLMEM **pszUTF, const wchar_t *pszUCS) +{ + /** + * The return value is the number of bytes written to the buffer. + * The number includes the byte for the null terminator. + */ + + if (p_WideCharToMultiByte) { + int nRet = p_WideCharToMultiByte(CP_UTF8,0,pszUCS,-1,NULL,0,NULL,NULL); + *pszUTF = check_pool_memory_size(*pszUTF, nRet); + return p_WideCharToMultiByte(CP_UTF8,0,pszUCS,-1,*pszUTF,nRet,NULL,NULL); + + } + return 0; +} + +/* + * Convert from WCHAR (UCS) to UTF-8 + */ +int +wchar_2_UTF8(char *pszUTF, const wchar_t *pszUCS, int cchChar) +{ + /** + * The return value is the number of bytes written to the buffer. + * The number includes the byte for the null terminator. + */ + + if (p_WideCharToMultiByte) { + int nRet = p_WideCharToMultiByte(CP_UTF8,0,pszUCS,-1,pszUTF,cchChar,NULL,NULL); + ASSERT (nRet > 0); + return nRet; + } + return 0; +} + +int +UTF8_2_wchar(POOLMEM **ppszUCS, const char *pszUTF) +{ + /* the return value is the number of wide characters written to the buffer. */ + /* convert null terminated string from utf-8 to ucs2, enlarge buffer if necessary */ + + if (p_MultiByteToWideChar) { + /* strlen of UTF8 +1 is enough */ + DWORD cchSize = (strlen(pszUTF)+1); + *ppszUCS = check_pool_memory_size(*ppszUCS, cchSize*sizeof (wchar_t)); + + int nRet = p_MultiByteToWideChar(CP_UTF8, 0, pszUTF, -1, (LPWSTR) *ppszUCS,cchSize); + ASSERT (nRet > 0); + return nRet; + } + return 0; +} + + +void +wchar_win32_path(const char *name, wchar_t *win32_name) +{ + const char *fname = name; + while (*name) { + /* Check for Unix separator and convert to Win32 */ + if (*name == '/') { + *win32_name++ = '\\'; /* convert char */ + /* If Win32 separated that is "quoted", remove quote */ + } else if (*name == '\\' && name[1] == '\\') { + *win32_name++ = '\\'; + name++; /* skip first \ */ + } else { + *win32_name++ = *name; /* copy character */ + } + name++; + } + /* Strip any trailing slash, if we stored something */ + if (*fname != 0 && win32_name[-1] == '\\') { + win32_name[-1] = 0; + } else { + *win32_name = 0; + } +} + +int +make_win32_path_UTF8_2_wchar(POOLMEM **pszUCS, const char *pszUTF, BOOL* pBIsRawPath /*= NULL*/) +{ + P(Win32Convmutex); + /* if we find the utf8 string in cache, we use the cached ucs2 version. + we compare the stringlength first (quick check) and then compare the content. + */ + if (!g_pWin32ConvUTF8Cache) { + Win32ConvInitCache(); + } else if (g_dwWin32ConvUTF8strlen == strlen(pszUTF)) { + if (bstrcmp(pszUTF, g_pWin32ConvUTF8Cache)) { + /* Return cached value */ + int32_t nBufSize = sizeof_pool_memory(g_pWin32ConvUCS2Cache); + *pszUCS = check_pool_memory_size(*pszUCS, nBufSize); + wcscpy((LPWSTR) *pszUCS, (LPWSTR)g_pWin32ConvUCS2Cache); + V(Win32Convmutex); + return nBufSize / sizeof (WCHAR); + } + } + + /* helper to convert from utf-8 to UCS-2 and to complete a path for 32K path syntax */ + int nRet = UTF8_2_wchar(pszUCS, pszUTF); + +#ifdef USE_WIN32_32KPATHCONVERSION + /* add \\?\ to support 32K long filepaths */ + *pszUCS = make_wchar_win32_path(*pszUCS, pBIsRawPath); +#else + if (pBIsRawPath) + *pBIsRawPath = FALSE; +#endif + + /* populate cache */ + g_pWin32ConvUCS2Cache = check_pool_memory_size(g_pWin32ConvUCS2Cache, sizeof_pool_memory(*pszUCS)); + wcscpy((LPWSTR) g_pWin32ConvUCS2Cache, (LPWSTR) *pszUCS); + + g_dwWin32ConvUTF8strlen = strlen(pszUTF); + g_pWin32ConvUTF8Cache = check_pool_memory_size(g_pWin32ConvUTF8Cache, g_dwWin32ConvUTF8strlen+2); + bstrncpy(g_pWin32ConvUTF8Cache, pszUTF, g_dwWin32ConvUTF8strlen+1); + V(Win32Convmutex); + + return nRet; +} + +#if !defined(_MSC_VER) || (_MSC_VER < 1400) // VC8+ +int umask(int) +{ + return 0; +} +#endif + +#ifndef LOAD_WITH_ALTERED_SEARCH_PATH +#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008 +#endif + +void *dlopen(const char *file, int mode) +{ + void *handle; + + handle = LoadLibraryEx(file, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + return handle; +} + +void *dlsym(void *handle, const char *name) +{ + void *symaddr; + symaddr = (void *)GetProcAddress((HMODULE)handle, name); + return symaddr; +} + +int dlclose(void *handle) +{ + if (handle && !FreeLibrary((HMODULE)handle)) { + errno = b_errno_win32; + return 1; /* failed */ + } + return 0; /* OK */ +} + +char *dlerror(void) +{ + static char buf[200]; + const char *err = errorString(); + bstrncpy(buf, (char *)err, sizeof(buf)); + LocalFree((void *)err); + return buf; +} + +int fcntl(int fd, int cmd) +{ + return 0; +} + +int chown(const char *k, uid_t, gid_t) +{ + return 0; +} + +int lchown(const char *k, uid_t, gid_t) +{ + return 0; +} + +long int +random(void) +{ + return rand(); +} + +void +srandom(unsigned int seed) +{ + srand(seed); +} +// ///////////////////////////////////////////////////////////////// +// convert from Windows concept of time to Unix concept of time +// ///////////////////////////////////////////////////////////////// +void +cvt_utime_to_ftime(const time_t &time, FILETIME &wintime) +{ + uint64_t mstime = time; + mstime *= WIN32_FILETIME_SCALE; + mstime += WIN32_FILETIME_ADJUST; + +#if defined(_MSC_VER) + wintime.dwLowDateTime = (DWORD)(mstime & 0xffffffffI64); +#else + wintime.dwLowDateTime = (DWORD)(mstime & 0xffffffffUL); +#endif + wintime.dwHighDateTime = (DWORD) ((mstime>>32)& 0xffffffffUL); +} + +time_t +cvt_ftime_to_utime(const FILETIME &time) +{ + uint64_t mstime = time.dwHighDateTime; + mstime <<= 32; + mstime |= time.dwLowDateTime; + + mstime -= WIN32_FILETIME_ADJUST; + mstime /= WIN32_FILETIME_SCALE; // convert to seconds. + + return (time_t) (mstime & 0xffffffff); +} + +static const char *errorString(void) +{ + LPVOID lpMsgBuf; + + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default lang + (LPTSTR) &lpMsgBuf, + 0, + NULL); + + /* Strip any \r or \n */ + char *rval = (char *) lpMsgBuf; + char *cp = strchr(rval, '\r'); + if (cp != NULL) { + *cp = 0; + } else { + cp = strchr(rval, '\n'); + if (cp != NULL) + *cp = 0; + } + return rval; +} + + +/* + * This is only called for directories, and is used to get the directory + * attributes and find out if we have a junction point or a mount point + * or other kind of "funny" directory. + */ +static int +statDir(const char *file, struct stat *sb, POOLMEM **readlnk=NULL) +{ + WIN32_FIND_DATAW info_w; // window's file info + WIN32_FIND_DATAA info_a; // window's file info + + // cache some common vars to make code more transparent + DWORD *pdwFileAttributes; + DWORD *pnFileSizeHigh; + DWORD *pnFileSizeLow; + DWORD *pdwReserved0; + FILETIME *pftLastAccessTime; + FILETIME *pftLastWriteTime; + HANDLE h = INVALID_HANDLE_VALUE; + + /* + * Oh, cool, another exception: Microsoft doesn't let us do + * FindFile operations on a Drive, so simply fake root attibutes. + */ + if (file[1] == ':' && file[2] == 0) { + time_t now = time(NULL); + Dmsg1(dbglvl, "faking ROOT attrs(%s).\n", file); + sb->st_mode = S_IFDIR; + sb->st_mode |= S_IREAD|S_IEXEC|S_IWRITE; + sb->st_ctime = now; /* File change time (inode change...) */ + sb->st_mtime = now; /* File modify time */ + sb->st_atime = now; /* File access time */ + sb->st_rdev = 0; + return 0; + } + + + // use unicode + if (p_FindFirstFileW) { + POOLMEM* pwszBuf = get_pool_memory (PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, file); + + Dmsg1(dbglvl, "FindFirstFileW=%s\n", file); + h = p_FindFirstFileW((LPCWSTR)pwszBuf, &info_w); + free_pool_memory(pwszBuf); + + pdwFileAttributes = &info_w.dwFileAttributes; + pdwReserved0 = &info_w.dwReserved0; + pnFileSizeHigh = &info_w.nFileSizeHigh; + pnFileSizeLow = &info_w.nFileSizeLow; + pftLastAccessTime = &info_w.ftLastAccessTime; + pftLastWriteTime = &info_w.ftLastWriteTime; + + // use ASCII + } else if (p_FindFirstFileA) { + Dmsg1(dbglvl, "FindFirstFileA=%s\n", file); + h = p_FindFirstFileA(file, &info_a); + + pdwFileAttributes = &info_a.dwFileAttributes; + pdwReserved0 = &info_a.dwReserved0; + pnFileSizeHigh = &info_a.nFileSizeHigh; + pnFileSizeLow = &info_a.nFileSizeLow; + pftLastAccessTime = &info_a.ftLastAccessTime; + pftLastWriteTime = &info_a.ftLastWriteTime; + } else { + Dmsg0(dbglvl, "No findFirstFile A or W found\n"); + } + + if (h == INVALID_HANDLE_VALUE) { + const char *err = errorString(); + /* + * Note, in creating leading paths, it is normal that + * the file does not exist. + */ + Dmsg2(2099, "FindFirstFile(%s):%s\n", file, err); + LocalFree((void *)err); + errno = b_errno_win32; + return -1; + } + + FindClose(h); + + sb->st_mode = 0777; /* start with everything */ + if (*pdwFileAttributes & FILE_ATTRIBUTE_READONLY) + sb->st_mode &= ~(S_IRUSR|S_IRGRP|S_IROTH); + if (*pdwFileAttributes & FILE_ATTRIBUTE_SYSTEM) + sb->st_mode &= ~S_IRWXO; /* remove everything for other */ + if (*pdwFileAttributes & FILE_ATTRIBUTE_HIDDEN) + sb->st_mode |= S_ISVTX; /* use sticky bit -> hidden */ + if (*pdwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) + sb->st_mode |= S_ISGID; /* use set group ID -> encrypted */ + sb->st_mode |= S_IFDIR; + sb->st_fattrs = *pdwFileAttributes; + Dmsg1(200, "Fattrs=0x%x\n", sb->st_fattrs); + /* + * Store reparse/mount point info in st_rdev. Note a + * Win32 reparse point (junction point) is like a link + * though it can have many properties (directory link, + * soft link, hard link, HSM, ... + * A mount point is a reparse point where another volume + * is mounted, so it is like a Unix mount point (change of + * filesystem). + */ + if (*pdwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { + sb->st_rdev = WIN32_MOUNT_POINT; + } else { + sb->st_rdev = 0; + } + /* This is a lot of work just to know that it is deduped */ + if (*pdwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && + (*pdwReserved0 & IO_REPARSE_TAG_DEDUP)) { + sb->st_fattrs |= FILE_ATTRIBUTE_DEDUP; /* add our own bit */ + } + if ((*pdwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && + (*pdwReserved0 & IO_REPARSE_TAG_MOUNT_POINT)) { + sb->st_rdev = WIN32_MOUNT_POINT; /* mount point */ + /* + * Now to find out if the directory is a mount point or + * a reparse point, we must do a song and a dance. + * Explicitly open the file to read the reparse point, then + * call DeviceIoControl to find out if it points to a Volume + * or to a directory. + */ + h = INVALID_HANDLE_VALUE; + if (p_GetFileAttributesW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, file); + if (p_CreateFileW) { + h = CreateFileW((LPCWSTR)pwszBuf, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + } + free_pool_memory(pwszBuf); + } else if (p_GetFileAttributesA) { + h = CreateFileA(file, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + } + if (h != INVALID_HANDLE_VALUE) { + char dummy[1000]; + REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER *)dummy; + rdb->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; + DWORD bytes; + bool ok; + ok = DeviceIoControl(h, FSCTL_GET_REPARSE_POINT, + NULL, 0, /* in buffer, bytes */ + (LPVOID)rdb, (DWORD)sizeof(dummy), /* out buffer, btyes */ + (LPDWORD)&bytes, (LPOVERLAPPED)0); + if (ok) { + POOLMEM *utf8 = get_pool_memory(PM_NAME); + wchar_2_UTF8(&utf8, (wchar_t *)rdb->SymbolicLinkReparseBuffer.PathBuffer); + Dmsg2(dbglvl, "Junction %s points to: %s\n", file, utf8); + if (strncasecmp(utf8, "\\??\\volume{", 11) == 0) { + sb->st_rdev = WIN32_MOUNT_POINT; + } else { + /* It points to a directory so we ignore it. */ + sb->st_rdev = WIN32_JUNCTION_POINT; + } + /* If requested, store the link for future use */ + if (readlnk) { + pm_strcpy(readlnk, utf8); + } + free_pool_memory(utf8); + } + CloseHandle(h); + } else { + Dmsg1(dbglvl, "Invalid handle from CreateFile(%s)\n", file); + } + } + Dmsg2(dbglvl, "st_rdev=%d file=%s\n", sb->st_rdev, file); + sb->st_size = *pnFileSizeHigh; + sb->st_size <<= 32; + sb->st_size |= *pnFileSizeLow; + sb->st_blksize = 4096; + sb->st_blocks = (uint32_t)(sb->st_size + 4095)/4096; + + sb->st_atime = cvt_ftime_to_utime(*pftLastAccessTime); + sb->st_mtime = cvt_ftime_to_utime(*pftLastWriteTime); + sb->st_ctime = MAX(sb->st_mtime, sb->st_ctime); + /* Note ctime is last change time -- not creation time */ + Dmsg1(200, "Fattrs=0x%x\n", sb->st_fattrs); + + return 0; +} + +/* On success, readlink() returns the number of bytes placed in buf. On + * error, -1 is returned and errno is set to indicate the error. + * + * TODO: Still need to activate the readlink() call in find_one.c + * by returning a S_ISLNK(st_mode) compatible flag, probably + * in statDir(); + */ +int +readlink(const char *path, char *buf, int bufsiz) +{ + int ret=-1; + struct stat sb; + POOLMEM *lnk = get_pool_memory(PM_FNAME); + *lnk = 0; + if (statDir(path, &sb, &lnk) == 0) { + ret = bstrncpy(buf, lnk, bufsiz) - buf - 1; // Don't count the last \0 + } + free_pool_memory(lnk); + return ret; +} + +/* symlink() shall return 0; otherwise, it shall return -1 and set errno to + * indicate the error. + */ +int +symlink(const char *path1, const char *path2) +{ + int ret=0; + struct stat st; + DWORD isdir=0; + POOLMEM* pwszBuf = NULL; + POOLMEM* pwszBuf2 = NULL; + + if (stat(path1, &st) == 0) { + if (st.st_mode & S_IFDIR) { + isdir=1; + } + } else { + Dmsg1(200, "Canot find the source directory %s\n", path1); + return -1; + } + + if (p_CreateSymbolicLinkW) { + pwszBuf = get_pool_memory (PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, path1); + + pwszBuf2 = get_pool_memory (PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf2, path2); + + Dmsg2(dbglvl, "Trying to symlink (%ls -> %ls)\n", pwszBuf, pwszBuf2); + + if (!p_CreateSymbolicLinkW((LPCWSTR)pwszBuf2, (LPCWSTR)pwszBuf, isdir)) { + const char *err = errorString(); + Dmsg3(200, "Cannot create symlink (%ls -> %ls):%s\n", pwszBuf, pwszBuf2, err); + LocalFree((void *)err); + errno = b_errno_win32; + ret = -1; + } + + } else if (p_CreateSymbolicLinkA) { + + if (!p_CreateSymbolicLinkA(path2, path1, isdir)) { + const char *err = errorString(); + Dmsg3(200, "Cannot create symlink (%s -> %s):%s\n", path1, path2, err); + LocalFree((void *)err); + errno = b_errno_win32; + ret = -1; + } + + } else { + Dmsg0(200, "No implementation of CreateSymbolicLink available\n"); + ret = -1; + } + + if (pwszBuf) { + free_pool_memory(pwszBuf2); + free_pool_memory(pwszBuf); + } + + return ret; +} + +/* Do a stat() on a valid HANDLE (opened with CreateFile()) */ +int hstat(HANDLE h, struct stat *sb) +{ + BY_HANDLE_FILE_INFORMATION info; + + if (!GetFileInformationByHandle(h, &info)) { + const char *err = errorString(); + Dmsg1(dbglvl, "GetfileInformationByHandle: %s\n", err); + LocalFree((void *)err); + errno = b_errno_win32; + return -1; + } + + /* We should modify only variables that are modified in stat() + * everything else should be carefully tested. + */ + + /* When turned on, we wee a lot of messages such as + * C:/PerfLogs is a different filesystem. Will not descend from C:/ into it. + */ + //sb->st_dev = info.dwVolumeSerialNumber; + + /* The st_ino is not used in stat() */ + sb->st_ino = info.nFileIndexHigh; + sb->st_ino <<= 32; + sb->st_ino |= info.nFileIndexLow; + + sb->st_nlink = 1; +#if 0 // We don't have the link() call right now + // TODO: something with CreateHardLinkFunc() + sb->st_nlink = (short)info.nNumberOfLinks; + if (sb->st_nlink > 1) { + Dmsg1(dbglvl, "st_nlink=%d\n", sb->st_nlink); + } +#endif + sb->st_mode = 0777; /* start with everything */ + if (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) + sb->st_mode &= ~(S_IRUSR|S_IRGRP|S_IROTH); + if (info.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) + sb->st_mode &= ~S_IRWXO; /* remove everything for other */ + if (info.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) + sb->st_mode |= S_ISVTX; /* use sticky bit -> hidden */ + if (info.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) + sb->st_mode |= S_ISGID; /* use set group ID -> encrypted */ + if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + sb->st_mode |= S_IFDIR; + } else { + sb->st_mode |= S_IFREG; + } + sb->st_fattrs = info.dwFileAttributes; + + /* Use st_rdev to store reparse attribute */ + if (info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { + sb->st_rdev = WIN32_REPARSE_POINT; + } + Dmsg3(dbglvl, "st_rdev=%d sizino=%d ino=%lld\n", sb->st_rdev, sizeof(sb->st_ino), + (long long)sb->st_ino); + + sb->st_size = info.nFileSizeHigh; + sb->st_size <<= 32; + sb->st_size |= info.nFileSizeLow; + sb->st_blksize = 4096; + sb->st_blocks = (uint32_t)(sb->st_size + 4095)/4096; + sb->st_atime = cvt_ftime_to_utime(info.ftLastAccessTime); + sb->st_mtime = cvt_ftime_to_utime(info.ftLastWriteTime); + sb->st_ctime = cvt_ftime_to_utime(info.ftCreationTime); + + /* Get the ChangeTime information with an other API, when attributes are modified + * the ChangeTime is modified while CreationTime and WriteTime are not + */ + FILE_BASIC_INFO file_basic_info; + if (p_GetFileInformationByHandleEx && + p_GetFileInformationByHandleEx(h, FileBasicInfo, &file_basic_info, sizeof(file_basic_info))) { + FILETIME *pftChangeTime = (FILETIME *)&file_basic_info.ChangeTime; + sb->st_ctime = cvt_ftime_to_utime(*pftChangeTime); + } + + Dmsg1(200, "Fattrs=0x%x\n", sb->st_fattrs); + return 0; +} + + +/* Emulate unix stat() call on windows */ +static int stat2(const char *file, struct stat *sb) +{ + int rval = 0; + HANDLE h = INVALID_HANDLE_VALUE; + POOLMEM *fname; + + errno = 0; + memset(sb, 0, sizeof(*sb)); + + /* We cannot stat a drive */ + if (file[1] == ':' && (file[2] == 0 || (IsPathSeparator(file[2]) && file[3] == 0))) { + return statDir(file, sb); + } + + fname = get_pool_memory(PM_FNAME); + unix_name_to_win32(&fname, file); + + if (p_CreateFileW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, fname); + + h = p_CreateFileW((LPCWSTR)pwszBuf, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + free_pool_memory(pwszBuf); + + } else { + h = CreateFileA(fname, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + } + + if (h == INVALID_HANDLE_VALUE) { + const char *err = errorString(); + Dmsg2(dbglvl, "Cannot open file for stat (%s):%s\n", fname, err); + LocalFree((void *)err); + errno = b_errno_win32; + rval = -1; + goto bail_out; + } + + rval = hstat(h, sb); + CloseHandle(h); + + if (sb->st_mode & S_IFDIR && + file[1] == ':' && file[2] != 0) { + rval = statDir(file, sb); + // TODO: See if we really need statDir(), we can probably take only + // the code for the ReparsePoint + } +bail_out: + free_pool_memory(fname); + return rval; +} + +int +stat(const char *file, struct stat *sb) +{ + int ret; + WIN32_FILE_ATTRIBUTE_DATA data; + + errno = 0; + memset(sb, 0, sizeof(*sb)); + + /* We do the first try with a file HANDLER, because we want to use the + * ChangeTime that is only available with GetFileInformationByHandleEx + */ + ret = stat2(file, sb); + + if (!ret) { + return ret; + } + + /* We were not able to open a filehandler on the file to get attributes, so + * so we try with the name. It may happen of example with encrypted files. + */ + + if (p_GetFileAttributesExW) { + /* dynamically allocate enough space for UCS2 filename */ + POOLMEM *pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, file); + + BOOL b = p_GetFileAttributesExW((LPCWSTR)pwszBuf, GetFileExInfoStandard, &data); + free_pool_memory(pwszBuf); + + if (!b) { + const char *err = errorString(); + Dmsg2(10, "GetFileAttributesExW(%s):%s\n", file, err); + LocalFree((void *)err); + return -1; + } + + } else if (p_GetFileAttributesExA) { + if (!p_GetFileAttributesExA(file, GetFileExInfoStandard, &data)) { + const char *err = errorString(); + Dmsg2(10, "GetFileAttributesExW(%s):%s\n", file, err); + LocalFree((void *)err); + return -1; + } + } else { + return -1; // Not implemented + } + + sb->st_mode = 0777; /* start with everything */ + if (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) { + sb->st_mode &= ~(S_IRUSR|S_IRGRP|S_IROTH); + } + if (data.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) { + sb->st_mode &= ~S_IRWXO; /* remove everything for other */ + } + if (data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) { + sb->st_mode |= S_ISVTX; /* use sticky bit -> hidden */ + } + if (data.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) { + sb->st_mode |= S_ISGID; /* use set group ID -> encrypted */ + } + if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + sb->st_mode |= S_IFDIR; + } else { + sb->st_mode |= S_IFREG; + } + sb->st_fattrs = data.dwFileAttributes; + + /* Use st_rdev to store reparse attribute */ + sb->st_rdev = (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) ? 1 : 0; + + sb->st_nlink = 1; + sb->st_size = data.nFileSizeHigh; + sb->st_size <<= 32; + sb->st_size |= data.nFileSizeLow; + sb->st_blksize = 4096; + sb->st_blocks = (uint32_t)(sb->st_size + 4095)/4096; + sb->st_atime = cvt_ftime_to_utime(data.ftLastAccessTime); + sb->st_mtime = cvt_ftime_to_utime(data.ftLastWriteTime); + sb->st_ctime = sb->st_mtime; + + /* + * If we are not at the root, then to distinguish a reparse + * point from a mount point, we must call FindFirstFile() to + * get the WIN32_FIND_DATA, which has the bit that indicates + * that this directory is a mount point -- aren't Win32 APIs + * wonderful? (sarcasm). The code exists in the statDir + * subroutine. + */ + if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && + file[1] == ':' && file[2] != 0) { + statDir(file, sb); + } + Dmsg3(dbglvl, "sizino=%d ino=%lld file=%s\n", sizeof(sb->st_ino), + (long long)sb->st_ino, file); + Dmsg1(200, "Fattrs=0x%x\n", sb->st_fattrs); + return 0; +} + +int +fstat(intptr_t fd, struct stat *sb) +{ + return hstat((HANDLE)_get_osfhandle(fd), sb); +} + +/* + * We write our own ftruncate because the one in the + * Microsoft library mrcrt.dll does not truncate + * files greater than 2GB. + * KES - May 2007 + */ +int win32_ftruncate(int fd, int64_t length) +{ + /* Set point we want to truncate file */ + __int64 pos = _lseeki64(fd, (__int64)length, SEEK_SET); + + if (pos != (__int64)length) { + errno = EACCES; /* truncation failed, get out */ + return -1; + } + + /* Truncate file */ + if (SetEndOfFile((HANDLE)_get_osfhandle(fd)) == 0) { + errno = b_errno_win32; + return -1; + } + errno = 0; + return 0; +} + +int fcntl(int fd, int cmd, long arg) +{ + int rval = 0; + + switch (cmd) { + case F_GETFL: + rval = O_NONBLOCK; + break; + + case F_SETFL: + rval = 0; + break; + + default: + errno = EINVAL; + rval = -1; + break; + } + + return rval; +} + +int +lstat(const char *file, struct stat *sb) +{ + return stat(file, sb); +} + +void +sleep(int sec) +{ + Sleep(sec * 1000); +} + +int +geteuid(void) +{ + return 0; +} + +int +execvp(const char *, char *[]) { + errno = ENOSYS; + return -1; +} + + +int +fork(void) +{ + errno = ENOSYS; + return -1; +} + +int +pipe(int[]) +{ + errno = ENOSYS; + return -1; +} + +int +waitpid(int, int*, int) +{ + errno = ENOSYS; + return -1; +} + +#ifndef HAVE_MINGW +int +strcasecmp(const char *s1, const char *s2) +{ + register int ch1, ch2; + + if (s1==s2) + return 0; /* strings are equal if same object. */ + else if (!s1) + return -1; + else if (!s2) + return 1; + do { + ch1 = *s1; + ch2 = *s2; + s1++; + s2++; + } while (ch1 != 0 && tolower(ch1) == tolower(ch2)); + + return(ch1 - ch2); +} +#endif //HAVE_MINGW + +int +strncasecmp(const char *s1, const char *s2, int len) +{ + register int ch1 = 0, ch2 = 0; + + if (s1==s2) + return 0; /* strings are equal if same object. */ + else if (!s1) + return -1; + else if (!s2) + return 1; + + while (len--) { + ch1 = *s1; + ch2 = *s2; + s1++; + s2++; + if (ch1 == 0 || tolower(ch1) != tolower(ch2)) break; + } + + return (ch1 - ch2); +} + +int +gettimeofday(struct timeval *tv, struct timezone *) +{ + SYSTEMTIME now; + FILETIME tmp; + + GetSystemTime(&now); + + if (tv == NULL) { + errno = EINVAL; + return -1; + } + if (!SystemTimeToFileTime(&now, &tmp)) { + errno = b_errno_win32; + return -1; + } + + int64_t _100nsec = tmp.dwHighDateTime; + _100nsec <<= 32; + _100nsec |= tmp.dwLowDateTime; + _100nsec -= WIN32_FILETIME_ADJUST; + + tv->tv_sec = (long)(_100nsec / 10000000); + tv->tv_usec = (long)((_100nsec % 10000000)/10); + return 0; + +} + +/* + * Write in Windows System log + */ +void syslog(int type, const char *fmt, ...) +{ + va_list arg_ptr; + int len, maxlen; + POOLMEM *msg; + + msg = get_pool_memory(PM_EMSG); + + for (;;) { + maxlen = sizeof_pool_memory(msg) - 1; + va_start(arg_ptr, fmt); + len = bvsnprintf(msg, maxlen, fmt, arg_ptr); + va_end(arg_ptr); + if (len < 0 || len >= (maxlen-5)) { + msg = realloc_pool_memory(msg, maxlen + maxlen/2); + continue; + } + break; + } + LogErrorMsg((const char *)msg); + free_memory(msg); +} + +void +closelog() +{ +} + +struct passwd * +getpwuid(uid_t) +{ + return NULL; +} + +struct group * +getgrgid(uid_t) +{ + return NULL; +} + +// implement opendir/readdir/closedir on top of window's API + +typedef struct _dir +{ + WIN32_FIND_DATAA data_a; // window's file info (ansii version) + WIN32_FIND_DATAW data_w; // window's file info (wchar version) + const char *spec; // the directory we're traversing + HANDLE dirh; // the search handle + BOOL valid_a; // the info in data_a field is valid + BOOL valid_w; // the info in data_w field is valid + UINT32 offset; // pseudo offset for d_off +} _dir; + +DIR * +opendir(const char *path) +{ + /* enough space for VSS !*/ + int max_len = strlen(path) + MAX_PATH; + char *tspec = NULL; + _dir *rval = NULL; + if (path == NULL) { + errno = ENOENT; + return NULL; + } + + Dmsg1(dbglvl, "Opendir path=%s\n", path); + rval = (_dir *)malloc(sizeof(_dir)); + if (!rval) { + goto err; + } + memset (rval, 0, sizeof (_dir)); + + tspec = (char *)malloc(max_len); + if (!tspec) { + goto err; + } + + conv_unix_to_vss_win32_path(path, tspec, max_len); + Dmsg1(dbglvl, "win32 path=%s\n", tspec); + + // add backslash only if there is none yet (think of c:\) + if (tspec[strlen(tspec)-1] != '\\') + bstrncat(tspec, "\\*", max_len); + else + bstrncat(tspec, "*", max_len); + + rval->spec = tspec; + + // convert to wchar_t + if (p_FindFirstFileW) { + POOLMEM* pwcBuf = get_pool_memory(PM_FNAME);; + make_win32_path_UTF8_2_wchar(&pwcBuf, rval->spec); + + rval->dirh = p_FindFirstFileW((LPCWSTR)pwcBuf, &rval->data_w); + + free_pool_memory(pwcBuf); + + if (rval->dirh != INVALID_HANDLE_VALUE) + rval->valid_w = 1; + } else if (p_FindFirstFileA) { + rval->dirh = p_FindFirstFileA(rval->spec, &rval->data_a); + + if (rval->dirh != INVALID_HANDLE_VALUE) + rval->valid_a = 1; + } else goto err; + + + Dmsg3(dbglvl, "opendir(%s)\n\tspec=%s,\n\tFindFirstFile returns %d\n", + path, rval->spec, rval->dirh); + + rval->offset = 0; + if (rval->dirh == INVALID_HANDLE_VALUE) + goto err; + + if (rval->valid_w) { + Dmsg1(dbglvl, "\tFirstFile=%s\n", rval->data_w.cFileName); + } + + if (rval->valid_a) { + Dmsg1(dbglvl, "\tFirstFile=%s\n", rval->data_a.cFileName); + } + + return (DIR *)rval; + +err: + if (rval) { + free(rval); + } + if (tspec) { + free(tspec); + } + errno = b_errno_win32; + return NULL; +} + +int +closedir(DIR *dirp) +{ + _dir *dp = (_dir *)dirp; + FindClose(dp->dirh); + free((void *)dp->spec); + free((void *)dp); + return 0; +} + +/* + typedef struct _WIN32_FIND_DATA { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD dwReserved0; + DWORD dwReserved1; + TCHAR cFileName[MAX_PATH]; + TCHAR cAlternateFileName[14]; +} WIN32_FIND_DATA, *PWIN32_FIND_DATA; +*/ + +static int +copyin(struct dirent &dp, const char *fname) +{ + dp.d_ino = 0; + dp.d_reclen = 0; + char *cp = dp.d_name; + while (*fname) { + *cp++ = *fname++; + dp.d_reclen++; + } + *cp = 0; + return dp.d_reclen; +} + +int +readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) +{ + _dir *dp = (_dir *)dirp; + if (dp->valid_w || dp->valid_a) { + entry->d_off = dp->offset; + + // copy unicode + if (dp->valid_w) { + POOLMEM *szBuf = get_pool_memory(PM_NAME); + wchar_2_UTF8(&szBuf, dp->data_w.cFileName); + dp->offset += copyin(*entry, szBuf); + free_pool_memory(szBuf); + } else if (dp->valid_a) { // copy ansi (only 1 will be valid) + dp->offset += copyin(*entry, dp->data_a.cFileName); + } + + *result = entry; /* return entry address */ + Dmsg4(dbglvl, "readdir_r(%p, { d_name=\"%s\", d_reclen=%d, d_off=%d\n", + dirp, entry->d_name, entry->d_reclen, entry->d_off); + } else { +// Dmsg0(dbglvl, "readdir_r !valid\n"); + errno = b_errno_win32; + return -1; + } + + // get next file, try unicode first + if (p_FindNextFileW) + dp->valid_w = p_FindNextFileW(dp->dirh, &dp->data_w); + else if (p_FindNextFileA) + dp->valid_a = p_FindNextFileA(dp->dirh, &dp->data_a); + else { + dp->valid_a = FALSE; + dp->valid_w = FALSE; + } + + return 0; +} + +/* + * Dotted IP address to network address + * + * Returns 1 if OK + * 0 on error + */ +int +inet_aton(const char *a, struct in_addr *inp) +{ + const char *cp = a; + uint32_t acc = 0, tmp = 0; + int dotc = 0; + + if (!isdigit(*cp)) { /* first char must be digit */ + return 0; /* error */ + } + do { + if (isdigit(*cp)) { + tmp = (tmp * 10) + (*cp -'0'); + } else if (*cp == '.' || *cp == 0) { + if (tmp > 255) { + return 0; /* error */ + } + acc = (acc << 8) + tmp; + dotc++; + tmp = 0; + } else { + return 0; /* error */ + } + } while (*cp++ != 0); + if (dotc != 4) { /* want 3 .'s plus EOS */ + return 0; /* error */ + } + inp->s_addr = htonl(acc); /* store addr in network format */ + return 1; +} + + +/* + * Convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + */ +int +binet_pton(int af, const char *src, void *dst) +{ + switch (af) { + case AF_INET: + case AF_INET6: + if (p_InetPton) { + return p_InetPton(af, src, dst); + } + return 0; + default: + return 0; + } +} + + +int +nanosleep(const struct timespec *req, struct timespec *rem) +{ + if (rem) + rem->tv_sec = rem->tv_nsec = 0; + Sleep((req->tv_sec * 1000) + (req->tv_nsec/1000000)); + return 0; +} + +void +init_signals(void terminate(int sig)) +{ + +} + +void +init_stack_dump(void) +{ + +} + + +long +pathconf(const char *path, int name) +{ + switch(name) { + case _PC_PATH_MAX : + if (strncmp(path, "\\\\?\\", 4) == 0) + return 32767; + case _PC_NAME_MAX : + return 255; + } + errno = ENOSYS; + return -1; +} + +int +WSA_Init(void) +{ + WORD wVersionRequested = MAKEWORD(2, 2); + WSADATA wsaData; + + int err = WSAStartup(wVersionRequested, &wsaData); + if (err != 0) { + wVersionRequested = MAKEWORD(2, 0); + err = WSAStartup(wVersionRequested, &wsaData); + if (err != 0) { + wVersionRequested = MAKEWORD(1, 1); + err = WSAStartup(wVersionRequested, &wsaData); + } + } + + if (err != 0) { + printf("Can not start Windows Sockets\n"); + errno = ENOSYS; + return -1; + } + + return 0; +} + +static DWORD fill_attribute(DWORD attr, mode_t mode) +{ + Dmsg1(dbglvl, " before attr=%lld\n", (uint64_t) attr); + /* Use Bacula mappings define in stat() above */ + if (mode & (S_IRUSR|S_IRGRP|S_IROTH)) { // If file is readable + attr &= ~FILE_ATTRIBUTE_READONLY; // then this is not READONLY + } else { + attr |= FILE_ATTRIBUTE_READONLY; + } + if (mode & S_ISVTX) { // The sticky bit <=> HIDDEN + attr |= FILE_ATTRIBUTE_HIDDEN; + } else { + attr &= ~FILE_ATTRIBUTE_HIDDEN; + } + if (mode & S_ISGID) { // The set group ID <=> ENCRYPTED + attr |= FILE_ATTRIBUTE_ENCRYPTED; + } else { + attr &= ~FILE_ATTRIBUTE_ENCRYPTED; + } + if (mode & S_IRWXO) { // Other can read/write/execute ? + attr &= ~FILE_ATTRIBUTE_SYSTEM; // => Not system + } else { + attr |= FILE_ATTRIBUTE_SYSTEM; + } + Dmsg1(dbglvl, " after attr=%lld\n", (uint64_t)attr); + return attr; +} + +int win32_chmod(const char *path, mode_t mode) +{ + bool ret=false; + DWORD attr; + + Dmsg2(dbglvl, "win32_chmod(path=%s mode=%lld)\n", path, (uint64_t)mode); + if (p_GetFileAttributesW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, path); + + attr = p_GetFileAttributesW((LPCWSTR) pwszBuf); + if (attr != INVALID_FILE_ATTRIBUTES) { + /* Use Bacula mappings define in stat() above */ + attr = fill_attribute(attr, mode); + ret = p_SetFileAttributesW((LPCWSTR)pwszBuf, attr); + } + free_pool_memory(pwszBuf); + Dmsg0(dbglvl, "Leave win32_chmod. AttributesW\n"); + } else if (p_GetFileAttributesA) { + attr = p_GetFileAttributesA(path); + if (attr != INVALID_FILE_ATTRIBUTES) { + attr = fill_attribute(attr, mode); + ret = p_SetFileAttributesA(path, attr); + } + Dmsg0(dbglvl, "Leave win32_chmod did AttributesA\n"); + } else { + Dmsg0(dbglvl, "Leave win32_chmod did nothing\n"); + } + + if (!ret) { + const char *err = errorString(); + Dmsg2(dbglvl, "Get/SetFileAttributes(%s): %s\n", path, err); + LocalFree((void *)err); + errno = b_errno_win32; + return -1; + } + return 0; +} + + +int +win32_chdir(const char *dir) +{ + if (p_SetCurrentDirectoryW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, dir); + + BOOL b=p_SetCurrentDirectoryW((LPCWSTR)pwszBuf); + + free_pool_memory(pwszBuf); + + if (!b) { + errno = b_errno_win32; + return -1; + } + } else if (p_SetCurrentDirectoryA) { + if (0 == p_SetCurrentDirectoryA(dir)) { + errno = b_errno_win32; + return -1; + } + } else { + return -1; + } + + return 0; +} + +int +win32_mkdir(const char *dir) +{ + Dmsg1(dbglvl, "enter win32_mkdir. dir=%s\n", dir); + if (p_wmkdir){ + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, dir); + + int n = p_wmkdir((LPCWSTR)pwszBuf); + free_pool_memory(pwszBuf); + Dmsg0(dbglvl, "Leave win32_mkdir did wmkdir\n"); + return n; + } + + Dmsg0(dbglvl, "Leave win32_mkdir did _mkdir\n"); + return _mkdir(dir); +} + + +char * +win32_getcwd(char *buf, int maxlen) +{ + int n=0; + + if (p_GetCurrentDirectoryW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + pwszBuf = check_pool_memory_size (pwszBuf, maxlen*sizeof(wchar_t)); + + n = p_GetCurrentDirectoryW(maxlen, (LPWSTR) pwszBuf); + if (n!=0) + n = wchar_2_UTF8 (buf, (wchar_t *)pwszBuf, maxlen)-1; + free_pool_memory(pwszBuf); + + } else if (p_GetCurrentDirectoryA) + n = p_GetCurrentDirectoryA(maxlen, buf); + + if (n <= 0 || n > maxlen) return NULL; + + if (n+1 > maxlen) return NULL; + if (n != 3) { + buf[n] = '\\'; + buf[n+1] = 0; + } + return buf; +} + +int +win32_fputs(const char *string, FILE *stream) +{ + /* we use WriteConsoleA / WriteConsoleA + so we can be sure that unicode support works on win32. + with fallback if something fails + */ + + HANDLE hOut = GetStdHandle (STD_OUTPUT_HANDLE); + if (hOut && (hOut != INVALID_HANDLE_VALUE) && p_WideCharToMultiByte && + p_MultiByteToWideChar && (stream == stdout)) { + + POOLMEM* pwszBuf = get_pool_memory(PM_MESSAGE); + + DWORD dwCharsWritten; + DWORD dwChars; + + dwChars = UTF8_2_wchar(&pwszBuf, string); + + /* try WriteConsoleW */ + if (WriteConsoleW (hOut, pwszBuf, dwChars-1, &dwCharsWritten, NULL)) { + free_pool_memory(pwszBuf); + return dwCharsWritten; + } + + /* convert to local codepage and try WriteConsoleA */ + POOLMEM* pszBuf = get_pool_memory(PM_MESSAGE); + pszBuf = check_pool_memory_size(pszBuf, dwChars+1); + + dwChars = p_WideCharToMultiByte(GetConsoleOutputCP(),0,(LPCWSTR)pwszBuf,-1,pszBuf,dwChars,NULL,NULL); + free_pool_memory(pwszBuf); + + if (WriteConsoleA (hOut, pszBuf, dwChars-1, &dwCharsWritten, NULL)) { + free_pool_memory(pszBuf); + return dwCharsWritten; + } + free_pool_memory(pszBuf); + } + /* Fall back */ + return fputs(string, stream); +} + +char* +win32_cgets (char* buffer, int len) +{ + /* we use console ReadConsoleA / ReadConsoleW to be able to read unicode + from the win32 console and fallback if seomething fails */ + + HANDLE hIn = GetStdHandle (STD_INPUT_HANDLE); + if (hIn && (hIn != INVALID_HANDLE_VALUE) && p_WideCharToMultiByte && p_MultiByteToWideChar) { + DWORD dwRead; + wchar_t wszBuf[1024]; + char szBuf[1024]; + + /* nt and unicode conversion */ + if (ReadConsoleW (hIn, wszBuf, 1024, &dwRead, NULL)) { + + /* null terminate at end */ + if (wszBuf[dwRead-1] == L'\n') { + wszBuf[dwRead-1] = L'\0'; + dwRead --; + } + + if (wszBuf[dwRead-1] == L'\r') { + wszBuf[dwRead-1] = L'\0'; + dwRead --; + } + + wchar_2_UTF8(buffer, wszBuf, len); + return buffer; + } + + /* win 9x and unicode conversion */ + if (ReadConsoleA (hIn, szBuf, 1024, &dwRead, NULL)) { + + /* null terminate at end */ + if (szBuf[dwRead-1] == L'\n') { + szBuf[dwRead-1] = L'\0'; + dwRead --; + } + + if (szBuf[dwRead-1] == L'\r') { + szBuf[dwRead-1] = L'\0'; + dwRead --; + } + + /* convert from ansii to wchar_t */ + p_MultiByteToWideChar(GetConsoleCP(), 0, szBuf, -1, wszBuf,1024); + /* convert from wchar_t to UTF-8 */ + if (wchar_2_UTF8(buffer, wszBuf, len)) + return buffer; + } + } + + /* fallback */ + if (fgets(buffer, len, stdin)) + return buffer; + else + return NULL; +} + +int +win32_unlink(const char *filename) +{ + int nRetCode; + if (p_wunlink) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, filename); + + nRetCode = _wunlink((LPCWSTR) pwszBuf); + + /* + * special case if file is readonly, + * we retry but unset attribute before + */ + if (nRetCode == -1 && errno == EACCES && p_SetFileAttributesW && p_GetFileAttributesW) { + DWORD dwAttr = p_GetFileAttributesW((LPCWSTR)pwszBuf); + if (dwAttr != INVALID_FILE_ATTRIBUTES) { + if (p_SetFileAttributesW((LPCWSTR)pwszBuf, dwAttr & ~FILE_ATTRIBUTE_READONLY)) { + nRetCode = _wunlink((LPCWSTR) pwszBuf); + /* reset to original if it didn't help */ + if (nRetCode == -1) + p_SetFileAttributesW((LPCWSTR)pwszBuf, dwAttr); + } + } + } + free_pool_memory(pwszBuf); + } else { + nRetCode = _unlink(filename); + + /* special case if file is readonly, + we retry but unset attribute before */ + if (nRetCode == -1 && errno == EACCES && p_SetFileAttributesA && p_GetFileAttributesA) { + DWORD dwAttr = p_GetFileAttributesA(filename); + if (dwAttr != INVALID_FILE_ATTRIBUTES) { + if (p_SetFileAttributesA(filename, dwAttr & ~FILE_ATTRIBUTE_READONLY)) { + nRetCode = _unlink(filename); + /* reset to original if it didn't help */ + if (nRetCode == -1) + p_SetFileAttributesA(filename, dwAttr); + } + } + } + } + return nRetCode; +} + + +#include "mswinver.h" + +char WIN_VERSION_LONG[64]; +char WIN_VERSION[32]; +char WIN_RAWVERSION[32]; + +class winver { +public: + winver(void); +}; + +static winver INIT; // cause constructor to be called before main() + + +winver::winver(void) +{ + const char *version = ""; + const char *platform = ""; + OSVERSIONINFO osvinfo; + osvinfo.dwOSVersionInfoSize = sizeof(osvinfo); + + // Get the current OS version + if (!GetVersionEx(&osvinfo)) { + version = "Unknown"; + platform = "Unknown"; + } + const int ver = _mkversion(osvinfo.dwPlatformId, + osvinfo.dwMajorVersion, + osvinfo.dwMinorVersion); + snprintf(WIN_RAWVERSION, sizeof(WIN_RAWVERSION), "Windows %#08x", ver); + switch (ver) + { + case MS_WINDOWS_95: (version = "Windows 95"); break; + case MS_WINDOWS_98: (version = "Windows 98"); break; + case MS_WINDOWS_ME: (version = "Windows ME"); break; + case MS_WINDOWS_NT4:(version = "Windows NT 4.0"); platform = "NT"; break; + case MS_WINDOWS_2K: (version = "Windows 2000");platform = "NT"; break; + case MS_WINDOWS_XP: (version = "Windows XP");platform = "NT"; break; + case MS_WINDOWS_S2003: (version = "Windows Server 2003");platform = "NT"; break; + default: version = WIN_RAWVERSION; break; + } + + bstrncpy(WIN_VERSION_LONG, version, sizeof(WIN_VERSION_LONG)); + snprintf(WIN_VERSION, sizeof(WIN_VERSION), "%s %lu.%lu.%lu", + platform, osvinfo.dwMajorVersion, osvinfo.dwMinorVersion, osvinfo.dwBuildNumber); + +#if 0 + HANDLE h = CreateFile("G:\\foobar", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + CloseHandle(h); +#endif +#if 0 + BPIPE *b = open_bpipe("ls -l", 10, "r"); + char buf[1024]; + while (!feof(b->rfd)) { + fgets(buf, sizeof(buf), b->rfd); + } + close_bpipe(b); +#endif +} + +BOOL CreateChildProcess(VOID); +VOID WriteToPipe(VOID); +VOID ReadFromPipe(VOID); +VOID ErrorExit(LPCSTR); +VOID ErrMsg(LPTSTR, BOOL); + +/** + * Check for a quoted path, if an absolute path name is given and it contains + * spaces it will need to be quoted. i.e. "c:/Program Files/foo/bar.exe" + * CreateProcess() says the best way to ensure proper results with executables + * with spaces in path or filename is to quote the string. + */ +const char * +getArgv0(const char *cmdline) +{ + + int inquote = 0; + const char *cp; + for (cp = cmdline; *cp; cp++) + { + if (*cp == '"') { + inquote = !inquote; + } + if (!inquote && isspace(*cp)) + break; + } + + + int len = cp - cmdline; + char *rval = (char *)malloc(len+1); + + cp = cmdline; + char *rp = rval; + + while (len--) + *rp++ = *cp++; + + *rp = 0; + return rval; +} + +/* + * Extracts the executable or script name from the first string in + * cmdline. + * + * If the name contains blanks then it must be quoted with double quotes, + * otherwise quotes are optional. If the name contains blanks then it + * will be converted to a short name. + * + * The optional quotes will be removed. The result is copied to a malloc'ed + * buffer and returned through the pexe argument. The pargs parameter is set + * to the address of the character in cmdline located after the name. + * + * The malloc'ed buffer returned in *pexe must be freed by the caller. + */ +bool +GetApplicationName(const char *cmdline, char **pexe, const char **pargs) +{ + const char *pExeStart = NULL; /* Start of executable name in cmdline */ + const char *pExeEnd = NULL; /* Character after executable name (separator) */ + + const char *pBasename = NULL; /* Character after last path separator */ + const char *pExtension = NULL; /* Period at start of extension */ + + const char *current = cmdline; + + bool bQuoted = false; + + /* Skip initial whitespace */ + + while (*current == ' ' || *current == '\t') + { + current++; + } + + /* Calculate start of name and determine if quoted */ + + if (*current == '"') { + pExeStart = ++current; + bQuoted = true; + } else { + pExeStart = current; + bQuoted = false; + } + + *pargs = NULL; + *pexe = NULL; + + /* + * Scan command line looking for path separators (/ and \\) and the + * terminator, either a quote or a blank. The location of the + * extension is also noted. + */ + + for ( ; *current != '\0'; current++) + { + if (*current == '.') { + pExtension = current; + } else if (IsPathSeparator(*current) && current[1] != '\0') { + pBasename = ¤t[1]; + pExtension = NULL; + } + + /* Check for terminator, either quote or blank */ + if (bQuoted) { + if (*current != '"') { + continue; + } + } else { + if (*current != ' ') { + continue; + } + } + + /* + * Hit terminator, remember end of name (address of terminator) and + * start of arguments + */ + pExeEnd = current; + + if (bQuoted && *current == '"') { + *pargs = ¤t[1]; + } else { + *pargs = current; + } + + break; + } + + if (pBasename == NULL) { + pBasename = pExeStart; + } + + if (pExeEnd == NULL) { + pExeEnd = current; + } + + if (*pargs == NULL) + { + *pargs = current; + } + + bool bHasPathSeparators = pExeStart != pBasename; + + /* We have pointers to all the useful parts of the name */ + + /* Default extensions in the order cmd.exe uses to search */ + + static const char ExtensionList[][5] = { ".com", ".exe", ".bat", ".cmd" }; + DWORD dwBasePathLength = pExeEnd - pExeStart; + + DWORD dwAltNameLength = 0; + char *pPathname = (char *)alloca(MAX_PATHLENGTH + 1); + char *pAltPathname = (char *)alloca(MAX_PATHLENGTH + 1); + + pPathname[MAX_PATHLENGTH] = '\0'; + pAltPathname[MAX_PATHLENGTH] = '\0'; + + memcpy(pPathname, pExeStart, dwBasePathLength); + pPathname[dwBasePathLength] = '\0'; + + if (pExtension == NULL) { + /* Try appending extensions */ + for (int index = 0; index < (int)(sizeof(ExtensionList) / sizeof(ExtensionList[0])); index++) { + + if (!bHasPathSeparators) { + /* There are no path separators, search in the standard locations */ + dwAltNameLength = SearchPath(NULL, pPathname, ExtensionList[index], MAX_PATHLENGTH, pAltPathname, NULL); + if (dwAltNameLength > 0 && dwAltNameLength <= MAX_PATHLENGTH) { + memcpy(pPathname, pAltPathname, dwAltNameLength); + pPathname[dwAltNameLength] = '\0'; + break; + } + } else { + bstrncpy(&pPathname[dwBasePathLength], ExtensionList[index], MAX_PATHLENGTH - dwBasePathLength); + if (GetFileAttributes(pPathname) != INVALID_FILE_ATTRIBUTES) { + break; + } + pPathname[dwBasePathLength] = '\0'; + } + } + } else if (!bHasPathSeparators) { + /* There are no path separators, search in the standard locations */ + dwAltNameLength = SearchPath(NULL, pPathname, NULL, MAX_PATHLENGTH, pAltPathname, NULL); + if (dwAltNameLength > 0 && dwAltNameLength < MAX_PATHLENGTH) { + memcpy(pPathname, pAltPathname, dwAltNameLength); + pPathname[dwAltNameLength] = '\0'; + } + } + + if (strchr(pPathname, ' ') != NULL) { + dwAltNameLength = GetShortPathName(pPathname, pAltPathname, MAX_PATHLENGTH); + + if (dwAltNameLength > 0 && dwAltNameLength <= MAX_PATHLENGTH) { + *pexe = (char *)malloc(dwAltNameLength + 1); + if (*pexe == NULL) { + return false; + } + memcpy(*pexe, pAltPathname, dwAltNameLength + 1); + } + } + + if (*pexe == NULL) { + DWORD dwPathnameLength = strlen(pPathname); + *pexe = (char *)malloc(dwPathnameLength + 1); + if (*pexe == NULL) { + return false; + } + memcpy(*pexe, pPathname, dwPathnameLength + 1); + } + + return true; +} + +/** + * Create the process with WCHAR API + */ +static BOOL +CreateChildProcessW(const char *comspec, const char *cmdLine, + PROCESS_INFORMATION *hProcInfo, + HANDLE in, HANDLE out, HANDLE err) +{ + STARTUPINFOW siStartInfo; + BOOL bFuncRetn = FALSE; + + // Set up members of the STARTUPINFO structure. + ZeroMemory( &siStartInfo, sizeof(siStartInfo) ); + siStartInfo.cb = sizeof(siStartInfo); + // setup new process to use supplied handles for stdin,stdout,stderr + + siStartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + siStartInfo.wShowWindow = SW_SHOWMINNOACTIVE; + + siStartInfo.hStdInput = in; + siStartInfo.hStdOutput = out; + siStartInfo.hStdError = err; + + // Convert argument to WCHAR + POOLMEM *cmdLine_wchar = get_pool_memory(PM_FNAME); + POOLMEM *comspec_wchar = get_pool_memory(PM_FNAME); + + UTF8_2_wchar(&cmdLine_wchar, cmdLine); + UTF8_2_wchar(&comspec_wchar, comspec); + + // Create the child process. + Dmsg2(dbglvl, "Calling CreateProcess(%s, %s, ...)\n", comspec_wchar, cmdLine_wchar); + + // try to execute program + bFuncRetn = p_CreateProcessW((WCHAR*)comspec_wchar, + (WCHAR*)cmdLine_wchar,// command line + NULL, // process security attributes + NULL, // primary thread security attributes + TRUE, // handles are inherited + 0, // creation flags + NULL, // use parent's environment + NULL, // use parent's current directory + &siStartInfo, // STARTUPINFO pointer + hProcInfo); // receives PROCESS_INFORMATION + free_pool_memory(cmdLine_wchar); + free_pool_memory(comspec_wchar); + + return bFuncRetn; +} + + +/** + * Create the process with ANSI API + */ +static BOOL +CreateChildProcessA(const char *comspec, char *cmdLine, + PROCESS_INFORMATION *hProcInfo, + HANDLE in, HANDLE out, HANDLE err) +{ + STARTUPINFOA siStartInfo; + BOOL bFuncRetn = FALSE; + + // Set up members of the STARTUPINFO structure. + ZeroMemory( &siStartInfo, sizeof(siStartInfo) ); + siStartInfo.cb = sizeof(siStartInfo); + // setup new process to use supplied handles for stdin,stdout,stderr + siStartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + siStartInfo.wShowWindow = SW_SHOWMINNOACTIVE; + + siStartInfo.hStdInput = in; + siStartInfo.hStdOutput = out; + siStartInfo.hStdError = err; + + // Create the child process. + Dmsg2(dbglvl, "Calling CreateProcess(%s, %s, ...)\n", comspec, cmdLine); + + // try to execute program + bFuncRetn = p_CreateProcessA(comspec, + cmdLine, // command line + NULL, // process security attributes + NULL, // primary thread security attributes + TRUE, // handles are inherited + 0, // creation flags + NULL, // use parent's environment + NULL, // use parent's current directory + &siStartInfo,// STARTUPINFO pointer + hProcInfo);// receives PROCESS_INFORMATION + return bFuncRetn; +} + +/** + * OK, so it would seem CreateProcess only handles true executables: + * .com or .exe files. So grab $COMSPEC value and pass command line to it. + */ +HANDLE +CreateChildProcess(const char *cmdline, HANDLE in, HANDLE out, HANDLE err) +{ + static const char *comspec = NULL; + PROCESS_INFORMATION piProcInfo; + BOOL bFuncRetn = FALSE; + + if (!p_CreateProcessA || !p_CreateProcessW) + return INVALID_HANDLE_VALUE; + + if (comspec == NULL) + comspec = getenv("COMSPEC"); + if (comspec == NULL) // should never happen + return INVALID_HANDLE_VALUE; + + // Set up members of the PROCESS_INFORMATION structure. + ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) ); + + // if supplied handles are not used the send a copy of our STD_HANDLE + // as appropriate + if (in == INVALID_HANDLE_VALUE) + in = GetStdHandle(STD_INPUT_HANDLE); + + if (out == INVALID_HANDLE_VALUE) + out = GetStdHandle(STD_OUTPUT_HANDLE); + + if (err == INVALID_HANDLE_VALUE) + err = GetStdHandle(STD_ERROR_HANDLE); + + char *exeFile; + const char *argStart; + + if (!GetApplicationName(cmdline, &exeFile, &argStart)) { + return INVALID_HANDLE_VALUE; + } + + POOL_MEM cmdLine(PM_FNAME); + Mmsg(cmdLine, "%s /c %s%s", comspec, exeFile, argStart); + + free(exeFile); + + // New function disabled + if (p_CreateProcessW && p_MultiByteToWideChar) { + bFuncRetn = CreateChildProcessW(comspec, cmdLine.c_str(), &piProcInfo, + in, out, err); + } else { + bFuncRetn = CreateChildProcessA(comspec, cmdLine.c_str(), &piProcInfo, + in, out, err); + } + + if (bFuncRetn == 0) { + ErrorExit("CreateProcess failed\n"); + Dmsg2(dbglvl, " CreateProcess(%s, %s) failed\n",comspec,cmdLine.c_str()); + return INVALID_HANDLE_VALUE; + } + // we don't need a handle on the process primary thread so we close + // this now. + CloseHandle(piProcInfo.hThread); + return piProcInfo.hProcess; +} + +void +ErrorExit (LPCSTR lpszMessage) +{ + const char *err = errorString(); + Dmsg2(dbglvl, "%s: %s", lpszMessage, err); + LocalFree((void *)err); + errno = b_errno_win32; +} + + +/* +typedef struct s_bpipe { + pid_t worker_pid; + time_t worker_stime; + int wait; + btimer_t *timer_id; + FILE *rfd; + FILE *wfd; +} BPIPE; +*/ + +static void +CloseHandleIfValid(HANDLE handle) +{ + if (handle != INVALID_HANDLE_VALUE) { + CloseHandle(handle); + } +} + +BPIPE * +open_bpipe(char *prog, int wait, const char *mode, char *envp[]) +{ + HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup, + hChildStdoutRd, hChildStdoutWr, hChildStdoutRdDup, + hInputFile; + + SECURITY_ATTRIBUTES saAttr; + + BOOL fSuccess; + + hChildStdinRd = hChildStdinWr = hChildStdinWrDup = + hChildStdoutRd = hChildStdoutWr = hChildStdoutRdDup = + hInputFile = INVALID_HANDLE_VALUE; + + BPIPE *bpipe = (BPIPE *)malloc(sizeof(BPIPE)); + memset((void *)bpipe, 0, sizeof(BPIPE)); + + int mode_read = (mode[0] == 'r'); + int mode_write = (mode[0] == 'w' || mode[1] == 'w'); + + + // Set the bInheritHandle flag so pipe handles are inherited. + + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + saAttr.bInheritHandle = TRUE; + saAttr.lpSecurityDescriptor = NULL; + + if (mode_read) { + + // Create a pipe for the child process's STDOUT. + if (! CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0)) { + ErrorExit("Stdout pipe creation failed\n"); + goto cleanup; + } + // Create noninheritable read handle and close the inheritable read + // handle. + + fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdoutRd, + GetCurrentProcess(), &hChildStdoutRdDup , 0, + FALSE, + DUPLICATE_SAME_ACCESS); + if ( !fSuccess ) { + ErrorExit("DuplicateHandle failed"); + goto cleanup; + } + + CloseHandle(hChildStdoutRd); + hChildStdoutRd = INVALID_HANDLE_VALUE; + } + + if (mode_write) { + + // Create a pipe for the child process's STDIN. + + if (!CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0)) { + ErrorExit("Stdin pipe creation failed\n"); + goto cleanup; + } + + // Duplicate the write handle to the pipe so it is not inherited. + fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdinWr, + GetCurrentProcess(), &hChildStdinWrDup, + 0, + FALSE, // not inherited + DUPLICATE_SAME_ACCESS); + if (!fSuccess) { + ErrorExit("DuplicateHandle failed"); + goto cleanup; + } + + CloseHandle(hChildStdinWr); + hChildStdinWr = INVALID_HANDLE_VALUE; + } + // spawn program with redirected handles as appropriate + bpipe->worker_pid = (pid_t) + CreateChildProcess(prog, // commandline + hChildStdinRd, // stdin HANDLE + hChildStdoutWr, // stdout HANDLE + hChildStdoutWr); // stderr HANDLE + + if ((HANDLE) bpipe->worker_pid == INVALID_HANDLE_VALUE) { + ErrorExit("CreateChildProcess failed"); + goto cleanup; + } + + bpipe->wait = wait; + bpipe->worker_stime = time(NULL); + + if (mode_read) { + CloseHandle(hChildStdoutWr); // close our write side so when + // process terminates we can + // detect eof. + // ugly but convert WIN32 HANDLE to FILE* + int rfd = _open_osfhandle((intptr_t)hChildStdoutRdDup, O_RDONLY | O_BINARY); + if (rfd >= 0) { + bpipe->rfd = _fdopen(rfd, "rb"); + } + } + if (mode_write) { + CloseHandle(hChildStdinRd); // close our read side so as not + // to interfre with child's copy + // ugly but convert WIN32 HANDLE to FILE* + int wfd = _open_osfhandle((intptr_t)hChildStdinWrDup, O_WRONLY | O_BINARY); + if (wfd >= 0) { + bpipe->wfd = _fdopen(wfd, "wb"); + } + } + + if (wait > 0) { + bpipe->timer_id = start_child_timer(NULL, bpipe->worker_pid, wait); + } + + return bpipe; + +cleanup: + + CloseHandleIfValid(hChildStdoutWr); + CloseHandleIfValid(hChildStdoutRd); + CloseHandleIfValid(hChildStdoutRdDup); + CloseHandleIfValid(hChildStdinWr); + CloseHandleIfValid(hChildStdinRd); + CloseHandleIfValid(hChildStdinWrDup); + + free((void *)bpipe); + errno = b_errno_win32; /* do GetLastError() for error code */ + return NULL; +} + + +int +kill(pid_t pid, int signal) +{ + int rval = 0; + if (!TerminateProcess((HANDLE)pid, (UINT)signal)) { + rval = -1; + errno = b_errno_win32; + } + CloseHandle((HANDLE)pid); + return rval; +} + + +int +close_bpipe(BPIPE *bpipe) +{ + int rval = 0; + int32_t remaining_wait = bpipe->wait; + + /* Close pipes */ + if (bpipe->rfd) { + fclose(bpipe->rfd); + bpipe->rfd = NULL; + } + if (bpipe->wfd) { + fclose(bpipe->wfd); + bpipe->wfd = NULL; + } + + if (remaining_wait == 0) { /* wait indefinitely */ + remaining_wait = INT32_MAX; + } + for ( ;; ) { + DWORD exitCode; + if (!GetExitCodeProcess((HANDLE)bpipe->worker_pid, &exitCode)) { + const char *err = errorString(); + rval = b_errno_win32; + Dmsg1(dbglvl, "GetExitCode error %s\n", err); + LocalFree((void *)err); + break; + } + if (exitCode == STILL_ACTIVE) { + if (remaining_wait <= 0) { + rval = ETIME; /* timed out */ + break; + } + bmicrosleep(1, 0); /* wait one second */ + remaining_wait--; + } else if (exitCode != 0) { + /* Truncate exit code as it doesn't seem to be correct */ + rval = (exitCode & 0xFF) | b_errno_exit; + break; + } else { + break; /* Shouldn't get here */ + } + } + + if (bpipe->timer_id) { + stop_child_timer(bpipe->timer_id); + } + if (bpipe->rfd) fclose(bpipe->rfd); + if (bpipe->wfd) fclose(bpipe->wfd); + free((void *)bpipe); + return rval; +} + +int +close_wpipe(BPIPE *bpipe) +{ + int result = 1; + + if (bpipe->wfd) { + fflush(bpipe->wfd); + if (fclose(bpipe->wfd) != 0) { + result = 0; + } + bpipe->wfd = NULL; + } + return result; +} + +#ifndef MINGW64 +int +utime(const char *fname, struct utimbuf *times) +{ + FILETIME acc, mod; + char tmpbuf[5000]; + + conv_unix_to_vss_win32_path(fname, tmpbuf, 5000); + + cvt_utime_to_ftime(times->actime, acc); + cvt_utime_to_ftime(times->modtime, mod); + + HANDLE h = INVALID_HANDLE_VALUE; + + if (p_CreateFileW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, tmpbuf); + + h = p_CreateFileW((LPCWSTR)pwszBuf, + FILE_WRITE_ATTRIBUTES, + FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, // required for directories + NULL); + + free_pool_memory(pwszBuf); + } else if (p_CreateFileA) { + h = p_CreateFileA(tmpbuf, + FILE_WRITE_ATTRIBUTES, + FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, // required for directories + NULL); + } + + if (h == INVALID_HANDLE_VALUE) { + const char *err = errorString(); + Dmsg2(dbglvl, "Cannot open file \"%s\" for utime(): ERR=%s", tmpbuf, err); + LocalFree((void *)err); + errno = b_errno_win32; + return -1; + } + + int rval = SetFileTime(h, NULL, &acc, &mod) ? 0 : -1; + CloseHandle(h); + if (rval == -1) { + errno = b_errno_win32; + } + return rval; +} +#endif + +#if 0 +int +file_open(const char *file, int flags, int mode) +{ + DWORD access = 0; + DWORD shareMode = 0; + DWORD create = 0; + DWORD msflags = 0; + HANDLE foo = INVALID_HANDLE_VALUE; + const char *remap = file; + + if (flags & O_WRONLY) access = GENERIC_WRITE; + else if (flags & O_RDWR) access = GENERIC_READ|GENERIC_WRITE; + else access = GENERIC_READ; + + if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) + create = CREATE_NEW; + else if ((flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) + create = CREATE_ALWAYS; + else if (flags & O_CREAT) + create = OPEN_ALWAYS; + else if (flags & O_TRUNC) + create = TRUNCATE_EXISTING; + else + create = OPEN_EXISTING; + + shareMode = 0; + + if (flags & O_APPEND) { + printf("open...APPEND not implemented yet."); + exit(-1); + } + + if (p_CreateFileW) { + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + make_win32_path_UTF8_2_wchar(&pwszBuf, file); + + foo = p_CreateFileW((LPCWSTR) pwszBuf, access, shareMode, NULL, create, msflags, NULL); + free_pool_memory(pwszBuf); + } else if (p_CreateFileA) + foo = CreateFile(file, access, shareMode, NULL, create, msflags, NULL); + + if (INVALID_HANDLE_VALUE == foo) { + errno = b_errno_win32; + return (int)-1; + } + return (int)foo; + +} + + +int +file_close(int fd) +{ + if (!CloseHandle((HANDLE)fd)) { + errno = b_errno_win32; + return -1; + } + + return 0; +} + +ssize_t +file_write(int fd, const void *data, ssize_t len) +{ + BOOL status; + DWORD bwrite; + status = WriteFile((HANDLE)fd, data, len, &bwrite, NULL); + if (status) return bwrite; + errno = b_errno_win32; + return -1; +} + + +ssize_t +file_read(int fd, void *data, ssize_t len) +{ + BOOL status; + DWORD bread; + + status = ReadFile((HANDLE)fd, data, len, &bread, NULL); + if (status) return bread; + errno = b_errno_win32; + return -1; +} + +boffset_t +file_seek(int fd, boffset_t offset, int whence) +{ + DWORD method = 0; + DWORD val; + LONG offset_low = (LONG)offset; + LONG offset_high = (LONG)(offset >> 32); + + switch (whence) { + case SEEK_SET : + method = FILE_BEGIN; + break; + case SEEK_CUR: + method = FILE_CURRENT; + break; + case SEEK_END: + method = FILE_END; + break; + default: + errno = EINVAL; + return -1; + } + + + if ((val=SetFilePointer((HANDLE)fd, offset_low, &offset_high, method)) == INVALID_SET_FILE_POINTER) { + errno = b_errno_win32; + return -1; + } + /* ***FIXME*** I doubt this works right */ + return val; +} + +int +file_dup2(int, int) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifdef xxx +/* + * Emulation of mmap and unmmap for tokyo dbm + */ +void *mmap(void *start, size_t length, int prot, int flags, + int fd, off_t offset) +{ + DWORD fm_access = 0; + DWORD mv_access = 0; + HANDLE h; + HANDLE mv; + + if (length == 0) { + return MAP_FAILED; + } + if (!fd) { + return MAP_FAILED; + } + + if (flags & PROT_WRITE) { + fm_access |= PAGE_READWRITE; + } else if (flags & PROT_READ) { + fm_access |= PAGE_READONLY; + } + + if (flags & PROT_READ) { + mv_access |= FILE_MAP_READ; + } + if (flags & PROT_WRITE) { + mv_access |= FILE_MAP_WRITE; + } + + h = CreateFileMapping((HANDLE)_get_osfhandle (fd), + NULL /* security */, + fm_access, + 0 /* MaximumSizeHigh */, + 0 /* MaximumSizeLow */, + NULL /* name of the file mapping object */); + + if (!h || h == INVALID_HANDLE_VALUE) { + return MAP_FAILED; + } + + mv = MapViewOfFile(h, mv_access, + 0 /* offset hi */, + 0 /* offset lo */, + length); + CloseHandle(h); + + if (!mv || mv == INVALID_HANDLE_VALUE) { + return MAP_FAILED; + } + + return (void *) mv; +} + +int munmap(void *start, size_t length) +{ + if (!start) { + return -1; + } + UnmapViewOfFile(start); + return 0; +} +#endif + +#ifdef HAVE_MINGW +/* syslog function, added by Nicolas Boichat */ +void openlog(const char *ident, int option, int facility) {} +#endif //HAVE_MINGW + +/* Log an error message */ +void LogErrorMsg(const char *message) +{ + HANDLE eventHandler; + const char *strings[2]; + + /* Use the OS event logging to log the error */ + eventHandler = RegisterEventSource(NULL, "Bacula"); + + strings[0] = _("\n\nBacula ERROR: "); + strings[1] = message; + + if (eventHandler) { + ReportEvent(eventHandler, EVENTLOG_ERROR_TYPE, + 0, /* category */ + 0, /* ID */ + NULL, /* SID */ + 2, /* Number of strings */ + 0, /* raw data size */ + (const char **)strings, /* error strings */ + NULL); /* raw data */ + DeregisterEventSource(eventHandler); + } +} + +/* + * Don't allow OS to suspend while backup running + * Note, the OS automatically tracks these for each thread + */ +void prevent_os_suspensions() +{ + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); +} + +void allow_os_suspensions() +{ + SetThreadExecutionState(ES_CONTINUOUS); +} + +int mkstemp(char *t) +{ + char *filename = mktemp(t); + if (filename == NULL) { + return -1; + } + return open(filename, O_RDWR | O_CREAT, 0600); +} + +void malloc_trim(int) +{ + if (p_EmptyWorkingSet) { + HANDLE hProcess = GetCurrentProcess(); + if (!p_EmptyWorkingSet(hProcess)) { + const char *err = errorString(); + Dmsg1(dbglvl, "EmptyWorkingSet() = %s\n", err); + LocalFree((void *)err); + } + CloseHandle( hProcess ); + } +} + +uint64_t get_memory_info(char *buf, int buflen) +{ + char ed1[50], ed2[50], ed3[50], ed4[50]; + uint64_t ret=0; + HANDLE hProcess = GetCurrentProcess(); + PROCESS_MEMORY_COUNTERS pmc; + buf[0] = '\0'; + + if (p_GetProcessMemoryInfo) { + if (p_GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc))) { + bsnprintf(buf, buflen, + "WorkingSetSize: %s QuotaPagedPoolUsage: %s QuotaNonPagedPoolUsage: %s PagefileUsage: %s", + edit_uint64_with_commas(pmc.WorkingSetSize, ed1), + edit_uint64_with_commas(pmc.QuotaPagedPoolUsage, ed2), + edit_uint64_with_commas(pmc.QuotaNonPagedPoolUsage, ed3), + edit_uint64_with_commas(pmc.PagefileUsage, ed4)); + ret = pmc.WorkingSetSize; + + } else { + const char *err = errorString(); + bsnprintf(buf, buflen, "%s", err); + LocalFree((void *)err); + } + } + + CloseHandle( hProcess ); + return ret; +} diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h new file mode 100644 index 0000000000..7e7286e81f --- /dev/null +++ b/bacula/src/win32/compat/compat.h @@ -0,0 +1,469 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* -*- Mode: C -*- + * compat.h -- + */ +// Copyright transferred from Raider Solutions, Inc to +// Kern Sibbald and John Walker by express permission. +// +/* + * Author : Christopher S. Hull + * Created On : Fri Jan 30 13:00:51 2004 + */ + +#include +#include + +#if !defined(__COMPAT_H_) +#define __COMPAT_H_ +#if !defined(_STAT_H) +#define _STAT_H /* don't pull in MinGW stat.h */ +#endif + +#ifndef _STAT_DEFINED +#define _STAT_DEFINED 1 /* don't pull in MinGW struct stat from wchar.h */ +#endif + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) // VC8+ +#pragma warning(disable : 4996) // Either disable all deprecation warnings, +// #define _CRT_SECURE_NO_DEPRECATE // Or just turn off warnings about the newly deprecated CRT functions. +#elif !defined(HAVE_MINGW) && !defined(HAVE_WXCONSOLE) +#define __STDC__ 1 +#endif + +#include + +#ifdef HAVE_MINGW_W64 +/* Was defined in pthread.h before */ +# define localtime_r( _clock, _result ) \ + ( *(_result) = *localtime( (_clock) ), \ + (_result) ) + +# define strtok_r( _s, _sep, _lasts ) \ + ( *(_lasts) = strtok( (_s), (_sep) ) ) + +# define asctime_r( _tm, _buf ) \ + ( strcpy( (_buf), asctime( (_tm) ) ), \ + (_buf) ) + +# define ctime_r( _clock, _buf ) \ + ( strcpy( (_buf), ctime( (_clock) ) ), \ + (_buf) ) + +# define gmtime_r( _clock, _result ) \ + ( *(_result) = *gmtime( (_clock) ), \ + (_result) ) + +#define rand_r( _seed ) \ + ( _seed == _seed? rand() : rand() ) + +#endif +#ifdef MINGW64 +#include +#include +#define _declspec __declspec +#endif + +#include + +#ifdef _WIN64 +# define GWL_USERDATA GWLP_USERDATA +#endif + +#ifndef INT64 +#define INT64 long long int +#endif + +typedef UINT64 u_int64_t; +typedef UINT64 uint64_t; +typedef INT64 int64_t; +typedef UINT32 uint32_t; +typedef INT64 intmax_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef signed short int16_t; +typedef signed char int8_t; +typedef int __daddr_t; + +#if !defined(HAVE_MINGW) +typedef long int32_t; +typedef float float32_t; +typedef double float64_t; +#endif + +#if !defined(_MSC_VER) || (_MSC_VER < 1400) // VC8+ +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +typedef long time_t; +#endif +#endif + +#if __STDC__ && !defined(HAVE_MINGW) +typedef _dev_t dev_t; +#if !defined(HAVE_WXCONSOLE) +typedef __int64 ino_t; +#endif +#endif + +typedef UINT32 u_int32_t; +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; + +#if !defined(HAVE_MINGW) +#undef uint32_t +#endif + +void sleep(int); + +typedef UINT32 key_t; + +#if defined(HAVE_MINGW) +#if !defined(uid_t) +typedef UINT32 uid_t; +typedef UINT32 gid_t; +#endif +#else +typedef UINT32 uid_t; +typedef UINT32 gid_t; +typedef UINT32 mode_t; +typedef INT32 ssize_t; +typedef UINT32 size_t; +#define HAVE_SSIZE_T 1 + +#endif /* HAVE_MINGW */ + +struct dirent { + uint64_t d_ino; + uint32_t d_off; + uint16_t d_reclen; + char d_name[256]; +}; +typedef void DIR; + + +#if !defined(__cplusplus) +#if !defined(true) +#define true 1 +#endif +#if !defined(false) +#define false 0 +#endif +#endif + +#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ +#define _TIMEZONE_DEFINED +struct timezone { + int foo; +}; +#endif + +int strcasecmp(const char*, const char *); +int gettimeofday(struct timeval *, struct timezone *); + +#if !defined(EETXTBUSY) +#define EETXTBUSY 26 +#endif + +#if !defined(ETIMEDOUT) +#define ETIMEDOUT 55 +#endif + +#if !defined(ENOMEDIUM) +#define ENOMEDIUM 123 +#endif + +#if !defined(ENODATA) +#define ENODATA 61 +#endif + +/* + * Stat packet that we use for Windows + */ +struct stat +{ + _dev_t st_dev; + uint64_t st_ino; + uint16_t st_mode; + int16_t st_nlink; + uint32_t st_uid; + uint32_t st_gid; + _dev_t st_rdev; + uint64_t st_size; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; + uint32_t st_blksize; + uint64_t st_blocks; + uint32_t st_fattrs; /* Windows file attributes */ +}; + +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 0x00000000 +#endif + +#undef S_IFMT +#define S_IFMT 0170000 /* file type mask */ +#undef S_IFDIR +#define S_IFDIR 0040000 /* directory */ +#define S_IFCHR 0020000 /* character special */ +#define S_IFBLK 0060000 /* block special */ +#define S_IFIFO 0010000 /* pipe */ +#undef S_IFREG +#define S_IFREG 0100000 /* regular */ +#define S_IREAD 0000400 /* read permission, owner */ +#define S_IWRITE 0000200 /* write permission, owner */ +#define S_IEXEC 0000100 /* execute/search permission, owner */ + +#define S_IRUSR S_IREAD +#define S_IWUSR S_IWRITE +#define S_IXUSR S_IEXEC +#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) +#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) +#define S_ISCHR(x) 0 +#define S_ISBLK(x) (((x) & S_IFMT) == S_IFBLK) +#define S_ISFIFO(x) 0 + +#define S_IRGRP 000040 +#define S_IWGRP 000020 +#define S_IXGRP 000010 + +#define S_IROTH 00004 +#define S_IWOTH 00002 +#define S_IXOTH 00001 + +#define S_IRWXO 000007 +#define S_IRWXG 000070 +#define S_ISUID 004000 +#define S_ISGID 002000 +#define S_ISVTX 001000 +#define S_ISSOCK(x) 0 +#define S_ISLNK(x) 0 + +#if __STDC__ +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC + +#define isascii __isascii +#define toascii __toascii +#define iscsymf __iscsymf +#define iscsym __iscsym +#endif + +typedef BOOL (*t_pVSSPathConvert)(const char *szFilePath, char *szShadowPath, int nBuflen); +typedef BOOL (*t_pVSSPathConvertW)(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen); +/* To know if we can use the VSSPathConvert function */ +typedef BOOL (*t_pVSSPathConverter)(); + +void SetVSSPathConvert(t_pVSSPathConverter pPathConverter, t_pVSSPathConvert pPathConvert, t_pVSSPathConvertW pPathConvertW); + +int lchown(const char *, uid_t uid, gid_t gid); +int chown(const char *, uid_t uid, gid_t gid); +#if !defined(HAVE_MINGW) +int chmod(const char *, mode_t mode); +#endif +#define O_NONBLOCK 04000 +#define F_GETFL 3 +#define F_SETFL 4 + +#ifndef MINGW64 +#define open _open +#endif + +int fcntl(int fd, int cmd, long arg); +int fstat(intptr_t fd, struct stat *sb); + +int inet_aton(const char *cp, struct in_addr *inp); +int binet_pton(int af, const char *src, void *dst); +int kill(pid_t pid, int signo); +int pipe(int []); +int fork(); +int waitpid(int, int *, int); + +#if !defined(HAVE_MINGW) +#define strncasecmp strnicmp +//int strncasecmp(const char*, const char *, int); +int utime(const char *filename, struct utimbuf *buf); +#define vsnprintf _vsnprintf +#define snprintf _snprintf +#endif //HAVE_MINGW + + +#define WNOHANG 0 +#define WIFEXITED(x) 0 +#define WEXITSTATUS(x) x +#define WIFSIGNALED(x) 0 +#define WTERMSIG(x) x +#define SIGKILL 9 +#define SIGUSR2 9999 + +#define HAVE_OLD_SOCKOPT + +struct timespec; +int readdir(unsigned int fd, struct dirent *dirp, unsigned int count); +int nanosleep(const struct timespec*, struct timespec *); +long int random(void); +void srandom(unsigned int seed); +int lstat(const char *, struct stat *); +int stat(const char *file, struct stat *sb); +long pathconf(const char *, int); +int readlink(const char *, char *, int); +int symlink(const char *path1, const char *path2); +#define _PC_PATH_MAX 1 +#define _PC_NAME_MAX 2 + +int geteuid(); + +DIR *opendir(const char *name); +int closedir(DIR *dir); + +struct passwd { + char *foo; +}; + +struct group { + char *foo; +}; + +struct passwd *getpwuid(uid_t); +struct group *getgrgid(uid_t); + +#ifdef xxx_needed +struct sigaction { + int sa_flags; + void (*sa_handler)(int); +}; +#define sigfillset(x) +#define sigaction(a, b, c) +#endif + +#define mkdir(p, m) win32_mkdir(p) +#define unlink win32_unlink +#define chdir win32_chdir +#define chmod win32_chmod +extern void syslog(int type, const char *fmt, ...); +#if !defined(LOG_DAEMON) +#define LOG_DAEMON 0 +#endif + +#if !defined(HAVE_MINGW) +#define R_OK 04 +#define W_OK 02 +int stat(const char *, struct stat *); +#if defined(__cplusplus) +#define access _access +extern "C" _CRTIMP int __cdecl _access(const char *, int); +int execvp(const char *, char *[]); +extern "C" void * __cdecl _alloca(size_t); +#endif +#endif //HAVE_MINGW + +#define getpid _getpid + +#define getppid() 0 +#define gethostid() 0 +#define getuid() 0 +#define getgid() 0 + +#define getcwd win32_getcwd +#define chdir win32_chdir +#define chmod win32_chmod +#define fputs win32_fputs +char *win32_getcwd(char *buf, int maxlen); +int win32_chdir(const char *buf); +int win32_mkdir(const char *buf); +int win32_fputs(const char *string, FILE *stream); +int win32_unlink(const char *filename); +int win32_chmod(const char *, mode_t); + + +char* win32_cgets (char* buffer, int len); + +int WSA_Init(void); +void Win32ConvCleanupCache(); + +#if defined(HAVE_MINGW) +void closelog(); +void openlog(const char *ident, int option, int facility); +#endif //HAVE_MINGW + +typedef DWORD EXECUTION_STATE; +#ifndef ES_CONTINUOUS +#define ES_CONTINUOUS 0x80000000 +#endif +#ifndef ES_SYSTEM_REQUIRED +#define ES_SYSTEM_REQUIRED 0x00000001 +#endif +#ifndef ES_DISPLAY_REQUIRED +#define ES_DISPLAY_REQUIRED 0x00000002 +#endif +#ifndef ES_USER_PRESENT +# define ES_USER_PRESENT 0x00000004 +#endif + +WINBASEAPI EXECUTION_STATE WINAPI SetThreadExecutionState(EXECUTION_STATE esFlags); + + +extern void LogErrorMsg(const char *message); + +#if !defined(INVALID_FILE_ATTRIBUTES) +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif + +/* + * Since the FileAttributes flag in Windows does not hold the + * dedup bit, we simplify the code by defining our own + * bit. + */ +#define FILE_ATTRIBUTE_DEDUP 0x80000000 +#define CREATE_FOR_EXPORT 0 /* default in OpenEncryptedFileRaw */ + +#if defined(_MSC_VER) +inline unsigned long ffs(unsigned long word) +{ + unsigned long index; + + if (_BitScanForward(&index, word) != 0) + return index + 1; + else + return 0; +} + +#else +#define ffs __builtin_ffs +#endif + + +int win32_ftruncate(int fd, int64_t length); +int mkstemp(char *t); + +void malloc_trim(int); +uint64_t get_memory_info(char *buf, int buflen); + +#undef ftruncate +#define ftruncate win32_ftruncate + +#ifndef O_DIRECTORY +#define O_DIRECTORY 0100000000 +#endif +#define O_ENCRYPTED 0200000000 + +#endif /* __COMPAT_H_ */ diff --git a/bacula/src/win32/compat/dirent.h b/bacula/src/win32/compat/dirent.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/dlfcn.h b/bacula/src/win32/compat/dlfcn.h new file mode 100644 index 0000000000..035eb7cfd8 --- /dev/null +++ b/bacula/src/win32/compat/dlfcn.h @@ -0,0 +1,33 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by Kern Sibbald, February 2008 + */ + +#ifndef __DLFCN_H_ +#define __DLFCN_H_ + +#define RTDL_NOW 2 + +void *dlopen(const char *file, int mode); +void *dlsym(void *handle, const char *name); +int dlclose(void *handle); +char *dlerror(void); + +#endif /* __DLFCN_H_ */ diff --git a/bacula/src/win32/compat/getopt.c b/bacula/src/win32/compat/getopt.c new file mode 100644 index 0000000000..ea293b12aa --- /dev/null +++ b/bacula/src/win32/compat/getopt.c @@ -0,0 +1,187 @@ +/***************************************************************************** + * + * MODULE NAME : GETOPT.C + * + * COPYRIGHTS: + * This module contains code made available by IBM + * Corporation on an AS IS basis. Any one receiving the + * module is considered to be licensed under IBM copyrights + * to use the IBM-provided source code in any way he or she + * deems fit, including copying it, compiling it, modifying + * it, and redistributing it, with or without + * modifications. No license under any IBM patents or + * patent applications is to be implied from this copyright + * license. + * + * A user of the module should understand that IBM cannot + * provide technical support for the module and will not be + * responsible for any consequences of use of the program. + * + * Any notices, including this one, are not to be removed + * from the module without the prior written consent of + * IBM. + * + * AUTHOR: Original author: + * G. R. Blair (BOBBLAIR at AUSVM1) + * Internet: bobblair@bobblair.austin.ibm.com + * + * Extensively revised by: + * John Q. Walker II, Ph.D. (JOHHQ at RALVM6) + * Internet: johnq@ralvm6.vnet.ibm.com + * + * Tweaked by Kern Sibbald for use in Bacula September 2007 + * + *****************************************************************************/ + +/****************************************************************************** + * getopt() + * + * The getopt() function is a command line parser. It returns the next + * option character in argv that matches an option character in opstring. + * + * The argv argument points to an array of argc+1 elements containing argc + * pointers to character strings followed by a null pointer. + * + * The opstring argument points to a string of option characters; if an + * option character is followed by a colon, the option is expected to have + * an argument that may or may not be separated from it by white space. + * The external variable optarg is set to point to the start of the option + * argument on return from getopt(). + * + * The getopt() function places in optind the argv index of the next argument + * to be processed. The system initializes the external variable optind to + * 1 before the first call to getopt(). + * + * When all options have been processed (that is, up to the first nonoption + * argument), getopt() returns EOF. The special option "--" may be used to + * delimit the end of the options; EOF will be returned, and "--" will be + * skipped. + * + * The getopt() function returns a question mark (?) when it encounters an + * option character not included in opstring. This error message can be + * disabled by setting opterr to zero. Otherwise, it returns the option + * character that was detected. + * + * If the special option "--" is detected, or all options have been + * processed, EOF is returned. + * + * Options are marked by either a minus sign (-) or a slash (/) if + * GETOPT_USE_SLASH is defined. + * + * No errors are defined. + *****************************************************************************/ + +#include /* for EOF */ +#include /* for strchr() */ +#include "getopt.h" + + +/* static (global) variables that are specified as exported by getopt() */ +char *optarg = NULL; /* pointer to the start of the option argument */ +int optind = 1; /* number of the next argv[] to be evaluated */ +int opterr = 1; /* non-zero if a question mark should be returned + when a non-valid option character is detected */ +int optopt = '?'; /* Not used */ + +/* handle possible future character set concerns by putting this in a macro */ +#define _next_char(string) (char)(*(string+1)) + +int getopt(int argc, char *const argv[], const char *opstring) +{ + static char *pIndexPosition = NULL; /* place inside current argv string */ + char *pArgString = NULL; /* where to start from next */ + char *pOptString; /* the string in our program */ + + + if (pIndexPosition != NULL) { + /* we last left off inside an argv string */ + if (*(++pIndexPosition)) { + /* there is more to come in the most recent argv */ + pArgString = pIndexPosition; + } + } + + if (pArgString == NULL) { + /* we didn't leave off in the middle of an argv string */ + if (optind >= argc) { + /* more command-line arguments than the argument count */ + pIndexPosition = NULL; /* not in the middle of anything */ + return EOF; /* used up all command-line arguments */ + } + + /*--------------------------------------------------------------------- + * If the next argv[] is not an option, there can be no more options. + *-------------------------------------------------------------------*/ + pArgString = argv[optind++]; /* set this to the next argument ptr */ + +#ifdef GETOPT_USE_SLASH + if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */ + ('-' != *pArgString)) { + --optind; /* point to current arg once we're done */ + optarg = NULL; /* no argument follows the option */ + pIndexPosition = NULL; /* not in the middle of anything */ + return EOF; /* used up all the command-line flags */ + } +#else + if ('-' != *pArgString) { /* doesn't start with a dash? */ + --optind; /* point to current arg once we're done */ + optarg = NULL; /* no argument follows the option */ + pIndexPosition = NULL; /* not in the middle of anything */ + return EOF; /* used up all the command-line flags */ + } +#endif + + /* check for special end-of-flags markers */ + if ((strcmp(pArgString, "-") == 0) || + (strcmp(pArgString, "--") == 0)) { + optarg = NULL; /* no argument follows the option */ + pIndexPosition = NULL; /* not in the middle of anything */ + return EOF; /* encountered the special flag */ + } + + pArgString++; /* look past the / or - */ + } + + if (':' == *pArgString) { /* is it a colon? */ + /*--------------------------------------------------------------------- + * Rare case: if opterr is non-zero, return a question mark; + * otherwise, just return the colon we're on. + *-------------------------------------------------------------------*/ + return (opterr ? (int) '?' : (int) ':'); + } else if ((pOptString = strchr(opstring, *pArgString)) == 0) { + /*--------------------------------------------------------------------- + * The letter on the command-line wasn't any good. + *-------------------------------------------------------------------*/ + optarg = NULL; /* no argument follows the option */ + pIndexPosition = NULL; /* not in the middle of anything */ + return (opterr ? (int) '?' : (int) *pArgString); + } else { + /*--------------------------------------------------------------------- + * The letter on the command-line matches one we expect to see + *-------------------------------------------------------------------*/ + if (':' == _next_char(pOptString)) { /* is the next letter a colon? */ + /* It is a colon. Look for an argument string. */ + if ('\0' != _next_char(pArgString)) { /* argument in this argv? */ + optarg = &pArgString[1]; /* Yes, it is */ + } else { + /*------------------------------------------------------------- + * The argument string must be in the next argv. + * But, what if there is none (bad input from the user)? + * In that case, return the letter, and optarg as NULL. + *-----------------------------------------------------------*/ + if (optind < argc) + optarg = argv[optind++]; + else { + optarg = NULL; + return (opterr ? (int) '?' : (int) *pArgString); + } + } + pIndexPosition = NULL; /* not in the middle of anything */ + } else { + /* it's not a colon, so just return the letter */ + optarg = NULL; /* no argument follows the option */ + pIndexPosition = pArgString; /* point to the letter we're on */ + } + return (int) *pArgString; /* return the letter that matched */ + } +} diff --git a/bacula/src/win32/compat/getopt.h b/bacula/src/win32/compat/getopt.h new file mode 100644 index 0000000000..df1bf384d6 --- /dev/null +++ b/bacula/src/win32/compat/getopt.h @@ -0,0 +1,41 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, September, MMVII + * + * Written from man page definitions + */ + +#ifndef _GETOPT_H_ +#define _GETOPT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int getopt(int argc, char * const argv[], const char *optstring); + +extern char *optarg; +extern int optind, opterr, optopt; + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H_ */ diff --git a/bacula/src/win32/compat/grp.h b/bacula/src/win32/compat/grp.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/mingwconfig.h b/bacula/src/win32/compat/mingwconfig.h new file mode 100644 index 0000000000..c14a3e2b3f --- /dev/null +++ b/bacula/src/win32/compat/mingwconfig.h @@ -0,0 +1,439 @@ +/* + * This file was originally generated by configure, but has been edited + * to provide the correct defines for the Native Win32 build under + * Visual Studio. + * + * Note!!! We normally build the Windows versions with this header + * file. We use the Mingw environment. + */ +/* ------------------------------------------------------------------------- */ +/* -- CONFIGURE SPECIFIED FEATURES -- */ +/* ------------------------------------------------------------------------- */ + +#ifndef __MINGWCONFIG_H +#define __MINGWCONFIG_H + +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0602 +#undef _WIN32_IE +#define _WIN32_IE 0x7000 + +/* To compile with the new mingw-w64*/ +#ifdef HAVE_MINGW_W64 +# define HAVE_FSEEKO 1 +# define MINGW64 +# define HAVE_OPENSSLv1 +# define __MIDL_user_allocate_free_DEFINED__ +#endif + +#define HAVE_SHA2 + +#undef USE_LOCKMGR + +/* Define if you want SmartAlloc debug code enabled */ +#define SMARTALLOC 1 + +/* Use EmptyWorkSet as malloc_trim emulation */ +#define HAVE_MALLOC_TRIM 1 + +/* Define if you want to use Batch Mode */ +/* #define HAVE_BATCH_FILE_INSERT 1 */ + +/* Define if you need function prototypes */ +#define PROTOTYPES 1 + +/* Define if you have GCC */ +#define HAVE_GCC 1 + +/* Define to 1 if utime.h exists and declares struct utimbuf. */ +#define HAVE_UTIME_H 1 + +/* Data types */ +#define HAVE_U_INT 1 +#define HAVE_INTXX_T 1 +#define HAVE_U_INTXX_T 1 +/* #undef HAVE_UINTXX_T */ +#define HAVE_INT64_T 1 +#define HAVE_U_INT64_T 1 +#define HAVE_UINT64_T 1 +#define HAVE_INTMAX_T 1 +/* #undef HAVE_U_INTMAX_T */ +#define HAVE_UINTPTR_T 1 +#define HAVE_INTPTR_T 1 + +/* Define if you want TCP Wrappers support */ +/* #undef HAVE_LIBWRAP */ + +/* Define if you have sys/bitypes.h */ +/* #undef HAVE_SYS_BITYPES_H */ + +/* Define if you have zlib */ +#define HAVE_LIBZ 1 + +/* Define if you have lzo lib */ +#define HAVE_LZO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LZO_LZOCONF_H 1 + + +/* File daemon specif libraries */ +#define FDLIBS 1 + + +/* What kind of signals we have */ +/*#define HAVE_POSIX_SIGNALS 1 */ +/* #undef HAVE_BSD_SIGNALS */ +/* #undef HAVE_USG_SIGHOLD */ + + +/* Set to correct scanf value for long long int */ +#define lld "lld" +#define llu "llu" +/* #define USE_BSNPRINTF */ + +#define HAVE_STRTOLL 1 + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 +#ifndef HAVE_MINGW +#define alloca _alloca +#endif + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `gethostid' function. */ +#define HAVE_GETHOSTID 1 + +/* Define to 1 if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the `getmntent' function. */ +/*#define HAVE_GETMNTENT 1 */ + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 +#define getpid _getpid + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_GRP_H 1*/ + +/* Define to 1 if you have the `inet_pton' function. */ +/* #undef HAVE_INET_PTON */ + +/* Define to 1 if you have the `inet_pton' function. */ +/* #undef HAVE_INET_NTOP */ + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getnameinfo' function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MTIO_H */ + +/* Define to 1 if you have the `nanosleep' function. */ +#define HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_PWD_H 1*/ + +/* Define to 1 if you have the `readdir_r' function. */ +/* #undef HAVE_READDIR_R */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_RESOLV_H 1*/ + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `setenv' function. */ +/* #undef HAVE_SETENV */ + +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#if (defined _MSC_VER) && (_MSC_VER >= 1400) // VC8+ +/* 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 +#endif + +#undef LOCALEDIR +#define LOCALEDIR "." + +#undef HAVE_NL_LANGINFO + +/* Define to 1 if you have the `setpgid' function. */ +#define HAVE_SETPGID 1 + +/* Define to 1 if you have the `setpgrp' function. */ +#define HAVE_SETPGRP 1 + +/* Define to 1 if you have the `setsid' function. */ +#define HAVE_SETSID 1 + +/* Define to 1 if you have the `signal' function. */ +/*#define HAVE_SIGNAL 1 */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncmp' function. */ +#define HAVE_STRNCMP 1 + +/* Define to 1 if you have the `strncpy' function. */ +#define HAVE_STRNCPY 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if `tm_zone' is member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM_TM_ZONE */ + +/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ +#define HAVE_ST_BLKSIZE 1 + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +#define HAVE_ST_BLOCKS 1 + +/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use + `HAVE_STRUCT_STAT_ST_RDEV' instead. */ +#define HAVE_ST_RDEV 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BYTEORDER_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MTIO_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `tcgetattr' function. */ +#define HAVE_TCGETATTR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +/* #undef HAVE_TM_ZONE */ + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +#define HAVE_TZNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VARARGS_H */ + +/* Define to 1 if you have the `vfprintf' function. */ +#define HAVE_VFPRINTF 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to 1 if the `setpgrp' function takes no argument. */ +#define SETPGRP_VOID 1 + +/* The size of a `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `int *', as computed by sizeof. */ +#define SIZEOF_INT_P 4 + +/* The size of a `long int', as computed by sizeof. */ +#define SIZEOF_LONG_INT 4 + +/* The size of a `long long int', as computed by sizeof. */ +#define SIZEOF_LONG_LONG_INT 8 + +/* The size of a `short int', as computed by sizeof. */ +#define SIZEOF_SHORT_INT 2 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Use long unsigned int for ioctl request */ +#define HAVE_IOCTL_ULINT_REQUEST + +/* For now, we only support Little endian on Win32 */ +#define HAVE_LITTLE_ENDIAN 1 + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define to make fseeko etc. visible, on some hosts. */ +#define _LARGEFILE_SOURCE 1 + +/* Define for large files, on AIX-style hosts. */ +#define _LARGE_FILES 1 + +/* Whether to enable IPv6 support */ +#define HAVE_IPV6 1 + +/* Set the default configuration file */ +#undef SYSCONFDIR +#define SYSCONFDIR "C:/Program Files/Bacula" + +#define O_CLOEXEC 0 + +#endif /* __MINGWNCONFIG_H */ diff --git a/bacula/src/win32/compat/ms_atl.h b/bacula/src/win32/compat/ms_atl.h new file mode 100644 index 0000000000..937821151e --- /dev/null +++ b/bacula/src/win32/compat/ms_atl.h @@ -0,0 +1,53 @@ +/* + * Minimal replacement for class CComPtr and CComBSTR + * Based on common public IUnknown interface only + */ + +template class CComPtr +{ + +public: + +/* Attribute(s) ... */ + T* p; + +/* Creation ... */ + CComPtr() + { + p = NULL; + } + +/* Destructor ... */ + ~CComPtr() + { + if (p) + p->Release(); + } +}; + +class CComBSTR +{ + +public: + + BSTR p; + +/* Creation ... */ + CComBSTR() + { + p = NULL; + } + +/* Destructor ... */ + ~CComBSTR() + { + ::SysFreeString(p); + } + +/* Address-of operator */ + BSTR* operator&() + { + return &p; + } + +}; diff --git a/bacula/src/win32/compat/mswinver.h b/bacula/src/win32/compat/mswinver.h new file mode 100644 index 0000000000..730ac91971 --- /dev/null +++ b/bacula/src/win32/compat/mswinver.h @@ -0,0 +1,35 @@ +#ifndef __MSWINVER_H_ +#define __MSWINVER_H_ + +#define MS_MAJOR_WINDOWS_3 3 +#define MS_MAJOR_WINDOWS_95 4 +#define MS_MAJOR_WINDOWS_98 4 +#define MS_MAJOR_WINDOWS_ME 4 +#define MS_MAJOR_WINDOWS_NT4 4 +#define MS_MAJOR_WINDOWS_2K 5 +#define MS_MAJOR_WINDOWS_XP 5 +#define MS_MAJOR_WINDOWS_S2003 5 + + +#define MS_MINOR_WINDOWS_3 51 +#define MS_MINOR_WINDOWS_95 0 +#define MS_MINOR_WINDOWS_98 10 +#define MS_MINOR_WINDOWS_ME 90 +#define MS_MINOR_WINDOWS_NT4 0 +#define MS_MINOR_WINDOWS_2K 0 +#define MS_MINOR_WINDOWS_XP 1 +#define MS_MINOR_WINDOWS_S2003 2 + + +#define _mkversion(p, m, r) (((p)<<24)|((m)<<8)|(r)) + +#define MS_WINDOWS_95 _mkversion(VER_PLATFORM_WIN32_WINDOWS, MS_MAJOR_WINDOWS_95, MS_MINOR_WINDOWS_95) +#define MS_WINDOWS_98 _mkversion(VER_PLATFORM_WIN32_WINDOWS, MS_MAJOR_WINDOWS_98, MS_MINOR_WINDOWS_98) +#define MS_WINDOWS_ME _mkversion(VER_PLATFORM_WIN32_WINDOWS, MS_MAJOR_WINDOWS_ME, MS_MINOR_WINDOWS_ME) +#define MS_WINDOWS_NT4 _mkversion(VER_PLATFORM_WIN32_NT, MS_MAJOR_WINDOWS_NT4, MS_MINOR_WINDOWS_NT4) +#define MS_WINDOWS_2K _mkversion(VER_PLATFORM_WIN32_NT, MS_MAJOR_WINDOWS_2K, MS_MINOR_WINDOWS_2K) +#define MS_WINDOWS_XP _mkversion(VER_PLATFORM_WIN32_NT, MS_MAJOR_WINDOWS_XP, MS_MINOR_WINDOWS_XP) +#define MS_WINDOWS_S2003 _mkversion(VER_PLATFORM_WIN32_NT, MS_MAJOR_WINDOWS_S2003, MS_MINOR_WINDOWS_S2003) + + +#endif diff --git a/bacula/src/win32/compat/netdb.h b/bacula/src/win32/compat/netdb.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/netinet/in.h b/bacula/src/win32/compat/netinet/in.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/netinet/tcp.h b/bacula/src/win32/compat/netinet/tcp.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/print.cpp b/bacula/src/win32/compat/print.cpp new file mode 100644 index 0000000000..78b0271a8c --- /dev/null +++ b/bacula/src/win32/compat/print.cpp @@ -0,0 +1,734 @@ +/************************************************************** + * Original: + * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 + * A bombproof version of doprnt(dopr) included. + * Sigh. This sort of thing is always nasty do deal with. Note that + * the version here does not include floating point... + * + * snprintf() is used instead of sprintf() as it does limit checks + * for string length. This covers a nasty loophole. + * + * The other functions are there to prevent NULL pointers from + * causing nast effects. + * + * More Recently: + * Brandon Long 9/15/96 for mutt 0.43 + * This was ugly. It is still ugly. I opted out of floating point + * numbers, but the formatter understands just about everything + * from the normal C string format, at least as far as I can tell from + * the Solaris 2.5 printf(3S) man page. + * + * Brandon Long 10/22/97 for mutt 0.87.1 + * Ok, added some minimal floating point support, which means this + * probably requires libm on most operating systems. Don't yet + * support the exponent(e, E) and sigfig(g, G). Also, fmtint() + * was pretty badly broken, it just wasn't being exercised in ways + * which showed it, so that's been fixed. Also, formated the code + * to mutt conventions, and removed dead code left over from the + * original. Also, there is now a builtin-test, just compile with: + * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm + * and run snprintf for results. + * + * Thomas Roessler 01/27/98 for mutt 0.89i + * The PGP code was using unsigned hexadecimal formats. + * Unfortunately, unsigned formats simply didn't work. + * + * Michael Elkins 03/05/98 for mutt 0.90.8 + * The original code assumed that both snprintf() and vsnprintf() were + * missing. Some systems only have snprintf() but not vsnprintf(), so + * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF. + * + * Ben Lindstrom 09/27/00 for OpenSSH + * Welcome to the world of %lld and %qd support. With other + * long long support. This is needed for sftp-server to work + * right. + * + * Ben Lindstrom 02/12/01 for OpenSSH + * Removed all hint of VARARGS stuff and banished it to the void, + * and did a bit of KNF style work to make things a bit more + * acceptable. Consider stealing from mutt or enlightenment. + **************************************************************/ + +#include "bacula.h" +#include "compat.h" + +typedef void (prfun)(char *, size_t *, size_t, int); + +int +dopr(char *buffer, size_t maxlen, const char *format, va_list args, prfun); + + +static void +fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, + int min, int max, prfun); + +static void +fmtint(char *buffer, size_t *currlen, size_t maxlen, INT64 value, int base, + int min, int max, int flags, prfun); + +static void +fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue, + int min, int max, int flags, prfun); + +static void +dopr_outch(char *buffer, size_t *currlen, size_t maxlen, int c); + +/* + * dopr(): poor man's version of doprintf + */ + +#ifndef MAX +#define MAX(a,b) ((a)>(b)?(a):(b)) +#endif + +/* format read states */ +#define DP_S_DEFAULT 0 +#define DP_S_FLAGS 1 +#define DP_S_MIN 2 +#define DP_S_DOT 3 +#define DP_S_MAX 4 +#define DP_S_MOD 5 +#define DP_S_CONV 6 +#define DP_S_DONE 7 + +/* format flags - Bits */ +#define DP_F_MINUS (1 << 0) +#define DP_F_PLUS (1 << 1) +#define DP_F_SPACE (1 << 2) +#define DP_F_NUM (1 << 3) +#define DP_F_ZERO (1 << 4) +#define DP_F_UP (1 << 5) +#define DP_F_UNSIGNED (1 << 6) + +/* Conversion Flags */ +#define DP_C_SHORT 1 +#define DP_C_LONG 2 +#define DP_C_LDOUBLE 3 +#define DP_C_LONG_LONG 4 + +#define char_to_int(p) (p - '0') +#define abs_val(p) (p < 0 ? -p : p) + +static const char digitval[] = "0123456789abcdef0123456789ABCDEF"; + +int +dopr(char *buffer, size_t maxlen, const char *format, va_list args, prfun outch) +{ + char *strvalue; + char ch; + INT64 value; + long double fvalue; + int min = 0; + int max = -1; + int state = DP_S_DEFAULT; + int flags = 0; + int cflags = 0; + size_t currlen = 0; + + ch = *format++; + + while (state != DP_S_DONE) + { + if ((ch == '\0') || (currlen >= maxlen)) + state = DP_S_DONE; + + switch (state) + { + case DP_S_DEFAULT: + if (ch == '%') + state = DP_S_FLAGS; + else + outch(buffer, &currlen, maxlen, ch); + ch = *format++; + break; + case DP_S_FLAGS: + switch (ch) + { + case '-': + flags |= DP_F_MINUS; + ch = *format++; + break; + case '+': + flags |= DP_F_PLUS; + ch = *format++; + break; + case ' ': + flags |= DP_F_SPACE; + ch = *format++; + break; + case '#': + flags |= DP_F_NUM; + ch = *format++; + break; + case '0': + flags |= DP_F_ZERO; + ch = *format++; + break; + default: + state = DP_S_MIN; + break; + } + break; + case DP_S_MIN: + if (isdigit((unsigned char)ch)) + { + min = 10*min + char_to_int(ch); + ch = *format++; + } + else if (ch == '*') + { + min = va_arg(args, int); + ch = *format++; + state = DP_S_DOT; + } + else + state = DP_S_DOT; + break; + case DP_S_DOT: + if (ch == '.') + { + state = DP_S_MAX; + ch = *format++; + } + else + state = DP_S_MOD; + break; + case DP_S_MAX: + if (isdigit((unsigned char)ch)) + { + if (max < 0) + max = 0; + max = 10*max + char_to_int(ch); + ch = *format++; + } + else if (ch == '*') + { + max = va_arg(args, int); + ch = *format++; + state = DP_S_MOD; + } + else + state = DP_S_MOD; + break; + case DP_S_MOD: + switch (ch) + { + case 'h': + cflags = DP_C_SHORT; + ch = *format++; + break; + case 'l': + cflags = DP_C_LONG; + ch = *format++; + if (ch == 'l') + { + cflags = DP_C_LONG_LONG; + ch = *format++; + } + break; + case 'q': + cflags = DP_C_LONG_LONG; + ch = *format++; + break; + case 'L': + cflags = DP_C_LDOUBLE; + ch = *format++; + break; + default: + break; + } + state = DP_S_CONV; + break; + case DP_S_CONV: + switch (ch) + { + case 'b': + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg(args, unsigned int); + else if (cflags == DP_C_LONG) + value = va_arg(args, unsigned long int); + else if (cflags == DP_C_LONG_LONG) + value = va_arg(args, UINT64); + else + value = va_arg(args, unsigned int); + fmtint(buffer, &currlen, maxlen, value, 2, min, max, flags, outch); + break; + case 'd': + case 'i': + if (cflags == DP_C_SHORT) + value = va_arg(args, int); + else if (cflags == DP_C_LONG) + value = va_arg(args, long int); + else if (cflags == DP_C_LONG_LONG) + value = va_arg(args, INT64); + else + value = va_arg(args, int); + fmtint(buffer, &currlen, maxlen, value, 10, min, max, flags, outch); + break; + case 'o': + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg(args, unsigned int); + else if (cflags == DP_C_LONG) + value = va_arg(args, unsigned long int); + else if (cflags == DP_C_LONG_LONG) + value = va_arg(args, UINT64); + else + value = va_arg(args, unsigned int); + fmtint(buffer, &currlen, maxlen, value, 8, min, max, flags, outch); + break; + case 'u': + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg(args, unsigned int); + else if (cflags == DP_C_LONG) + value = va_arg(args, unsigned long int); + else if (cflags == DP_C_LONG_LONG) + value = va_arg(args, UINT64); + else + value = va_arg(args, unsigned int); + fmtint(buffer, &currlen, maxlen, value, 10, min, max, flags, outch); + break; + case 'X': + flags |= DP_F_UP; + case 'x': + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg(args, unsigned int); + else if (cflags == DP_C_LONG) + value = va_arg(args, unsigned long int); + else if (cflags == DP_C_LONG_LONG) + value = va_arg(args, UINT64); + else + value = va_arg(args, unsigned int); + fmtint(buffer, &currlen, maxlen, value, 16, min, max, flags, outch); + break; + case 'f': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg(args, long double); + else + fvalue = va_arg(args, double); + /* um, floating point? */ + fmtfp(buffer, &currlen, maxlen, fvalue, min, max, flags, outch); + break; + case 'E': + flags |= DP_F_UP; + case 'e': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg(args, long double); + else + fvalue = va_arg(args, double); + break; + case 'G': + flags |= DP_F_UP; + case 'g': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg(args, long double); + else + fvalue = va_arg(args, double); + break; + case 'c': + outch(buffer, &currlen, maxlen, va_arg(args, int)); + break; + case 's': + strvalue = va_arg(args, char *); + if (max < 0) { + max = maxlen; /* ie, no max */ + } + fmtstr(buffer, &currlen, maxlen, strvalue, flags, min, max, outch); + break; + case 'p': + flags |= DP_F_UNSIGNED; + if (sizeof(char *) == 4) { + value = va_arg(args, uint32_t); + } else if (sizeof(char *) == 8) { + value = va_arg(args, uint64_t); + } else { + value = 0; /* we have a problem */ + } + fmtint(buffer, &currlen, maxlen, value, 16, min, max, + flags, outch); + break; + case 'n': + if (cflags == DP_C_SHORT) + { + short int *num; + num = va_arg(args, short int *); + *num = currlen; + } + else if (cflags == DP_C_LONG) + { + long int *num; + num = va_arg(args, long int *); + *num = currlen; + } + else if (cflags == DP_C_LONG_LONG) + { + INT64 *num; + num = va_arg(args, INT64 *); + *num = currlen; + } + else + { + int *num; + num = va_arg(args, int *); + *num = currlen; + } + break; + case '%': + outch(buffer, &currlen, maxlen, ch); + break; + case 'w': /* not supported yet, treat as next char */ + ch = *format++; + break; + default: /* Unknown, skip */ + break; + } + ch = *format++; + state = DP_S_DEFAULT; + flags = cflags = min = 0; + max = -1; + break; + case DP_S_DONE: + break; + default: /* hmm? */ + break; /* some picky compilers need this */ + } + } + outch(buffer, &currlen, maxlen, -1); + return currlen; +} + +static void +fmtstr(char *buffer, size_t *currlen, size_t maxlen, + char *value, int flags, int min, int max, prfun outch) +{ + int padlen, strln; /* amount to pad */ + int cnt = 0; + + if (value == NULL) + value = (char *)""; + + for (strln = 0; value[strln]; ++strln); /* strlen */ + padlen = min - strln; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justify */ + + while ((padlen > 0) && (cnt < max)) { + outch(buffer, currlen, maxlen, ' '); + --padlen; + ++cnt; + } + while (*value && (cnt < max)) { + outch(buffer, currlen, maxlen, *value++); + ++cnt; + } + while ((padlen < 0) && (cnt < max)) { + outch(buffer, currlen, maxlen, ' '); + ++padlen; + ++cnt; + } +} + +/* Have to handle DP_F_NUM(ie 0x and 0 alternates) */ + +static void +fmtint(char *buffer, size_t *currlen, size_t maxlen, + INT64 value, int base, int min, int max, int flags, prfun outch) +{ + UINT64 uvalue; + char convert[20]; + int signvalue = 0; + int place = 0; + int spadlen = 0; /* amount to space pad */ + int zpadlen = 0; /* amount to zero pad */ + int caps = 0; + + if (max < 0) + max = 0; + + uvalue = value; + + if (!(flags & DP_F_UNSIGNED)) { + if (value < 0) { + signvalue = '-'; + uvalue = -value; + } + else if (flags & DP_F_PLUS) /* Do a sign(+/i) */ + signvalue = '+'; + else if (flags & DP_F_SPACE) + signvalue = ' '; + } + + if (flags & DP_F_UP) + caps = 16; /* Should characters be upper case? */ + + do { + convert[place++] = digitval[(uvalue%base)+caps]; + uvalue = (uvalue / (unsigned)base); + } while (uvalue && (place < 20)); + + if (place == 20) + place--; + + convert[place] = 0; + + zpadlen = max - place; + spadlen = min - MAX(max, place) - (signvalue ? 1 : 0); + + if (zpadlen < 0) + zpadlen = 0; + if (spadlen < 0) + spadlen = 0; + if (flags & DP_F_ZERO) { + zpadlen = MAX(zpadlen, spadlen); + spadlen = 0; + } + if (flags & DP_F_MINUS) + spadlen = -spadlen; /* Left Justifty */ + + + /* Spaces */ + while (spadlen > 0) { + outch(buffer, currlen, maxlen, ' '); + --spadlen; + } + + /* Sign */ + if (signvalue) + outch(buffer, currlen, maxlen, signvalue); + + /* Zeros */ + if (zpadlen > 0) { + while (zpadlen > 0) { + outch(buffer, currlen, maxlen, '0'); + --zpadlen; + } + } + + /* Digits */ + while (place > 0) + outch(buffer, currlen, maxlen, convert[--place]); + + /* Left Justified spaces */ + while (spadlen < 0) { + outch(buffer, currlen, maxlen, ' '); + ++spadlen; + } +} + +static long double +pow10(int exp) +{ + long double result = 1; + + while (exp) + { + result *= 10; + exp--; + } + + return result; +} + +static long +round(long double value) +{ + long intpart = (long)value; + + value -= intpart; + if (value >= 0.5) + intpart++; + + return intpart; +} + +static void +fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue, + int min, int max, int flags, prfun outch) +{ + char iconvert[20]; + char fconvert[20]; + int signvalue = 0; + int iplace = 0; + int fplace = 0; + int padlen = 0; /* amount to pad */ + int zpadlen = 0; + long intpart; + long fracpart; + long double ufvalue; + + /* + * AIX manpage says the default is 0, but Solaris says the default + * is 6, and sprintf on AIX defaults to 6 + */ + if (max < 0) + max = 6; + + ufvalue = abs_val(fvalue); + + if (fvalue < 0) + signvalue = '-'; + else if (flags & DP_F_PLUS) /* Do a sign(+/i) */ + signvalue = '+'; + else if (flags & DP_F_SPACE) + signvalue = ' '; + + intpart = (long)ufvalue; + + /* + * Sorry, we only support 9 digits past the decimal because of our + * conversion method + */ + if (max > 9) + max = 9; + + /* We "cheat" by converting the fractional part to integer by + * multiplying by a factor of 10 + */ + fracpart = round((pow10 (max)) * (ufvalue - intpart)); + + if (fracpart >= pow10 (max)) + { + intpart++; + fracpart -= (long)pow10 (max); + } + + /* Convert integer part */ + do + { + iconvert[iplace++] = digitval[intpart % 10]; + intpart = (intpart / 10); + } while (intpart && (iplace < 20)); + + if (iplace == 20) + iplace--; + + iconvert[iplace] = 0; + + /* Convert fractional part */ + do + { + fconvert[fplace++] = digitval[fracpart % 10]; + fracpart = (fracpart / 10); + } while (fracpart && (fplace < 20)); + + if (fplace == 20) + fplace--; + + fconvert[fplace] = 0; + + /* -1 for decimal point, another -1 if we are printing a sign */ + padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); + zpadlen = max - fplace; + if (zpadlen < 0) + zpadlen = 0; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justifty */ + + if ((flags & DP_F_ZERO) && (padlen > 0)) + { + if (signvalue) + { + outch(buffer, currlen, maxlen, signvalue); + --padlen; + signvalue = 0; + } + while (padlen > 0) + { + outch(buffer, currlen, maxlen, '0'); + --padlen; + } + } + + while (padlen > 0) + { + outch(buffer, currlen, maxlen, ' '); + --padlen; + } + + if (signvalue) + outch(buffer, currlen, maxlen, signvalue); + + while (iplace > 0) + outch(buffer, currlen, maxlen, iconvert[--iplace]); + + /* + * Decimal point. This should probably use locale to find the correct + * char to print out. + */ + outch(buffer, currlen, maxlen, '.'); + + while (fplace > 0) + outch(buffer, currlen, maxlen, fconvert[--fplace]); + + while (zpadlen > 0) + { + outch(buffer, currlen, maxlen, '0'); + --zpadlen; + } + + while (padlen < 0) + { + outch(buffer, currlen, maxlen, ' '); + ++padlen; + } +} + +static void +dopr_outch(char *buffer, size_t *currlen, size_t maxlen, int c) +{ + if (c == -1) + { + if (*currlen < maxlen - 1) + buffer[*currlen] = '\0'; + else + buffer[maxlen - 1] = '\0'; + } + else if (*currlen < maxlen) + buffer[(*currlen)++] = c; +} + +int +__sprintf(char *str, const char *fmt, ...) +{ + int rval; + va_list ap; + va_start(ap, fmt); + rval = vsnprintf(str, 128*1024, fmt, ap); + va_end(ap); + return rval; +} + + +int +__snprintf(char *str, size_t count, const char *fmt, ...) +{ + int rval; + va_list ap; + + va_start(ap, fmt); + rval = vsnprintf(str, count, fmt, ap); + va_end(ap); + + return rval; +} + +int +__vsprintf(char *s, const char *format, va_list args) +{ + s[0] = 0; + return dopr(s, 0xfffff, format, args, dopr_outch); +} + +int +__vsnprintf(char *s, size_t count, const char *format, va_list args) +{ + s[0] = 0; + return dopr(s, count, format, args, dopr_outch); +} diff --git a/bacula/src/win32/compat/pwd.h b/bacula/src/win32/compat/pwd.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/stdint.h b/bacula/src/win32/compat/stdint.h new file mode 100644 index 0000000000..048a4541bc --- /dev/null +++ b/bacula/src/win32/compat/stdint.h @@ -0,0 +1,3 @@ +#if defined(__GNUC__) +#include_next +#endif diff --git a/bacula/src/win32/compat/strings.h b/bacula/src/win32/compat/strings.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/sys/file.h b/bacula/src/win32/compat/sys/file.h new file mode 100644 index 0000000000..36508054a9 --- /dev/null +++ b/bacula/src/win32/compat/sys/file.h @@ -0,0 +1,2 @@ + +#include "compat.h" diff --git a/bacula/src/win32/compat/sys/ioctl.h b/bacula/src/win32/compat/sys/ioctl.h new file mode 100644 index 0000000000..c09d6d9634 --- /dev/null +++ b/bacula/src/win32/compat/sys/ioctl.h @@ -0,0 +1 @@ +extern int ioctl(int __fd, unsigned long int __request, ...); diff --git a/bacula/src/win32/compat/sys/mtio.h b/bacula/src/win32/compat/sys/mtio.h new file mode 100644 index 0000000000..51fa550cd4 --- /dev/null +++ b/bacula/src/win32/compat/sys/mtio.h @@ -0,0 +1,277 @@ +/* Structures and definitions for magnetic tape I/O control commands. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Written by H. Bergman . */ + +#ifndef _SYS_MTIO_H +#define _SYS_MTIO_H 1 + +/* Get necessary definitions from system and kernel headers. */ +#include +#include + + +/* Structure for MTIOCTOP - magnetic tape operation command. */ +struct mtop + { + short int mt_op; /* Operations defined below. */ + int mt_count; /* How many of them. */ + }; +#define _IOT_mtop /* Hurd ioctl type field. */ \ + _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0) + +/* Magnetic Tape operations [Not all operations supported by all drivers]. */ +#define MTRESET 0 /* +reset drive in case of problems. */ +#define MTFSF 1 /* Forward space over FileMark, + * position at first record of next file. */ +#define MTBSF 2 /* Backward space FileMark (position before FM). */ +#define MTFSR 3 /* Forward space record. */ +#define MTBSR 4 /* Backward space record. */ +#define MTWEOF 5 /* Write an end-of-file record (mark). */ +#define MTREW 6 /* Rewind. */ +#define MTOFFL 7 /* Rewind and put the drive offline (eject?). */ +#define MTNOP 8 /* No op, set status only (read with MTIOCGET). */ +#define MTRETEN 9 /* Retension tape. */ +#define MTBSFM 10 /* +backward space FileMark, position at FM. */ +#define MTFSFM 11 /* +forward space FileMark, position at FM. */ +#define MTEOM 12 /* Goto end of recorded media (for appending files). + MTEOM positions after the last FM, ready for + appending another file. */ +#define MTERASE 13 /* Erase tape -- be careful! */ + +#define MTRAS1 14 /* Run self test 1 (nondestructive). */ +#define MTRAS2 15 /* Run self test 2 (destructive). */ +#define MTRAS3 16 /* Reserved for self test 3. */ + +#define MTSETBLK 20 /* Set block length (SCSI). */ +#define MTSETDENSITY 21 /* Set tape density (SCSI). */ +#define MTSEEK 22 /* Seek to block (Tandberg, etc.). */ +#define MTTELL 23 /* Tell block (Tandberg, etc.). */ +#define MTSETDRVBUFFER 24 /* Set the drive buffering according to SCSI-2. + Ordinary buffered operation with code 1. */ +#define MTFSS 25 /* Space forward over setmarks. */ +#define MTBSS 26 /* Space backward over setmarks. */ +#define MTWSM 27 /* Write setmarks. */ + +#define MTLOCK 28 /* Lock the drive door. */ +#define MTUNLOCK 29 /* Unlock the drive door. */ +#define MTLOAD 30 /* Execute the SCSI load command. */ +#define MTUNLOAD 31 /* Execute the SCSI unload command. */ +#define MTCOMPRESSION 32/* Control compression with SCSI mode page 15. */ +#define MTSETPART 33 /* Change the active tape partition. */ +#define MTMKPART 34 /* Format the tape with one or two partitions. */ + +/* structure for MTIOCGET - mag tape get status command */ + +struct mtget + { + long int mt_type; /* Type of magtape device. */ + long int mt_resid; /* Residual count: (not sure) + number of bytes ignored, or + number of files not skipped, or + number of records not skipped. */ + /* The following registers are device dependent. */ + long int mt_dsreg; /* Status register. */ + long int mt_gstat; /* Generic (device independent) status. */ + long int mt_erreg; /* Error register. */ + /* The next two fields are not always used. */ + __daddr_t mt_fileno; /* Number of current file on tape. */ + __daddr_t mt_blkno; /* Current block number. */ + }; +#define _IOT_mtget /* Hurd ioctl type field. */ \ + _IOT (_IOTS (long), 7, 0, 0, 0, 0) + + +/* Constants for mt_type. Not all of these are supported, and + these are not all of the ones that are supported. */ +#define MT_ISUNKNOWN 0x01 +#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer. */ +#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02. */ +#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02?. */ +#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?). */ +#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24. */ +#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02. */ +#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L. */ +#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L. */ +#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller. */ +#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features. */ +#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24. */ +#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, + Teac DC-1 card (Wangtek type). */ +#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40). */ +#define MT_ISDDS1 0x51 /* DDS device without partitions. */ +#define MT_ISDDS2 0x52 /* DDS device with partitions. */ +#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit. */ +#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit. */ + +/* QIC-40/80/3010/3020 ftape supported drives. + 20bit vendor ID + 0x800000 (see vendors.h in ftape distribution). */ +#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ +#define MT_ISFTAPE_FLAG 0x800000 + +struct mt_tape_info + { + long int t_type; /* Device type id (mt_type). */ + char *t_name; /* Descriptive name. */ + }; + +#define MT_TAPE_INFO \ + { \ + {MT_ISUNKNOWN, "Unknown type of tape device"}, \ + {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ + {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \ + {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ + {MT_ISCMSJ500, "CMS Jumbo 500"}, \ + {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ + {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ + {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \ + {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ + {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ + {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ + {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ + {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ + {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ + {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ + {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ + {0, NULL} \ + } + + +/* Structure for MTIOCPOS - mag tape get position command. */ + +struct mtpos + { + long int mt_blkno; /* Current block number. */ + }; +#define _IOT_mtpos /* Hurd ioctl type field. */ \ + _IOT_SIMPLE (long) + + +/* Structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended + as an interim solution for QIC-02 until DDI is fully implemented. */ +struct mtconfiginfo + { + long int mt_type; /* Drive type. */ + long int ifc_type; /* Interface card type. */ + unsigned short int irqnr; /* IRQ number to use. */ + unsigned short int dmanr; /* DMA channel to use. */ + unsigned short int port; /* IO port base address. */ + + unsigned long int debug; /* Debugging flags. */ + + unsigned have_dens:1; + unsigned have_bsf:1; + unsigned have_fsr:1; + unsigned have_bsr:1; + unsigned have_eod:1; + unsigned have_seek:1; + unsigned have_tell:1; + unsigned have_ras1:1; + unsigned have_ras2:1; + unsigned have_ras3:1; + unsigned have_qfa:1; + + unsigned pad1:5; + char reserved[10]; + }; +#define _IOT_mtconfiginfo /* Hurd ioctl type field. */ \ + _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1) /* XXX wrong */ + + +/* Magnetic tape I/O control commands. */ +#define MTIOCTOP _IOW('m', 1, struct mtop) /* Do a mag tape op. */ +#define MTIOCGET _IOR('m', 2, struct mtget) /* Get tape status. */ +#define MTIOCPOS _IOR('m', 3, struct mtpos) /* Get tape position.*/ + +/* The next two are used by the QIC-02 driver for runtime reconfiguration. + See tpqic02.h for struct mtconfiginfo. */ +#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* Get tape config.*/ +#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* Set tape config.*/ + +/* Generic Mag Tape (device independent) status macros for examining + mt_gstat -- HP-UX compatible. + There is room for more generic status bits here, but I don't + know which of them are reserved. At least three or so should + be added to make this really useful. */ +#define GMT_EOF(x) ((x) & 0x80000000) +#define GMT_BOT(x) ((x) & 0x40000000) +#define GMT_EOT(x) ((x) & 0x20000000) +#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ +#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ +#define GMT_WR_PROT(x) ((x) & 0x04000000) +/* #define GMT_ ? ((x) & 0x02000000) */ +#define GMT_ONLINE(x) ((x) & 0x01000000) +#define GMT_D_6250(x) ((x) & 0x00800000) +#define GMT_D_1600(x) ((x) & 0x00400000) +#define GMT_D_800(x) ((x) & 0x00200000) +/* #define GMT_ ? ((x) & 0x00100000) */ +/* #define GMT_ ? ((x) & 0x00080000) */ +#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* Door open (no tape). */ +/* #define GMT_ ? ((x) & 0x00020000) */ +#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* Immediate report mode.*/ +/* 16 generic status bits unused. */ + + +/* SCSI-tape specific definitions. Bitfield shifts in the status */ +#define MT_ST_BLKSIZE_SHIFT 0 +#define MT_ST_BLKSIZE_MASK 0xffffff +#define MT_ST_DENSITY_SHIFT 24 +#define MT_ST_DENSITY_MASK 0xff000000 + +#define MT_ST_SOFTERR_SHIFT 0 +#define MT_ST_SOFTERR_MASK 0xffff + +/* Bitfields for the MTSETDRVBUFFER ioctl. */ +#define MT_ST_OPTIONS 0xf0000000 +#define MT_ST_BOOLEANS 0x10000000 +#define MT_ST_SETBOOLEANS 0x30000000 +#define MT_ST_CLEARBOOLEANS 0x40000000 +#define MT_ST_WRITE_THRESHOLD 0x20000000 +#define MT_ST_DEF_BLKSIZE 0x50000000 +#define MT_ST_DEF_OPTIONS 0x60000000 + +#define MT_ST_BUFFER_WRITES 0x1 +#define MT_ST_ASYNC_WRITES 0x2 +#define MT_ST_READ_AHEAD 0x4 +#define MT_ST_DEBUGGING 0x8 +#define MT_ST_TWO_FM 0x10 +#define MT_ST_FAST_MTEOM 0x20 +#define MT_ST_AUTO_LOCK 0x40 +#define MT_ST_DEF_WRITES 0x80 +#define MT_ST_CAN_BSR 0x100 +#define MT_ST_NO_BLKLIMS 0x200 +#define MT_ST_CAN_PARTITIONS 0x400 +#define MT_ST_SCSI2LOGICAL 0x800 + +/* The mode parameters to be controlled. Parameter chosen with bits 20-28. */ +#define MT_ST_CLEAR_DEFAULT 0xfffff +#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) +#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) +#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) + +/* The offset for the arguments for the special HP changer load command. */ +#define MT_ST_HPLOADER_OFFSET 10000 + + +/* Specify default tape device. */ +#ifndef DEFTAPE +# define DEFTAPE "/dev/tape" +#endif + +#endif /* mtio.h */ diff --git a/bacula/src/win32/compat/sys/socket.h b/bacula/src/win32/compat/sys/socket.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/sys/stat.h b/bacula/src/win32/compat/sys/stat.h new file mode 100644 index 0000000000..7273fef6de --- /dev/null +++ b/bacula/src/win32/compat/sys/stat.h @@ -0,0 +1 @@ +#include "compat.h" diff --git a/bacula/src/win32/compat/sys/time.h b/bacula/src/win32/compat/sys/time.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/sys/wait.h b/bacula/src/win32/compat/sys/wait.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/src/win32/compat/syslog.h b/bacula/src/win32/compat/syslog.h new file mode 100644 index 0000000000..fbe2cf1989 --- /dev/null +++ b/bacula/src/win32/compat/syslog.h @@ -0,0 +1,32 @@ +#ifndef _SYSLOG_H +#define _SYSLOG_H + +#define LOG_DAEMON 0 +#define LOG_ERR 1 +#define LOG_CRIT 2 +#define LOG_ALERT 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_LOCAL0 10 +#define LOG_LOCAL1 11 +#define LOG_LOCAL2 12 +#define LOG_LOCAL3 13 +#define LOG_LOCAL4 14 +#define LOG_LOCAL5 15 +#define LOG_LOCAL6 16 +#define LOG_LOCAL7 17 +#define LOG_LPR 20 +#define LOG_MAIL 21 +#define LOG_NEWS 22 +#define LOG_UUCP 23 +#define LOG_USER 24 +#define LOG_CONS 0 +#define LOG_PID 0 + + +extern void syslog(int type, const char *fmt, ...); +void openlog(const char *app, int, int); +void closelog(void); + +#endif /* _SYSLOG_H */ diff --git a/bacula/src/win32/compat/unistd.h b/bacula/src/win32/compat/unistd.h new file mode 100644 index 0000000000..beb96285ed --- /dev/null +++ b/bacula/src/win32/compat/unistd.h @@ -0,0 +1,3 @@ +#if defined(__GNUC__) +#include_next +#endif diff --git a/bacula/src/win32/compat/winapi.c b/bacula/src/win32/compat/winapi.c new file mode 100644 index 0000000000..32001d5f40 --- /dev/null +++ b/bacula/src/win32/compat/winapi.c @@ -0,0 +1,349 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Windows APIs that are different for each system. + * We use pointers to the entry points so that a + * single binary will run on all Windows systems. + * + * Kern Sibbald MMIII + */ + +#include "bacula.h" + + +#ifdef HAVE_VSS64 +/* 64 bit entrypoint name */ +#define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YAJPEAPEAVIVssBackupComponents@@@Z" +#define VSSVMETA_ENTRY "?CreateVssExamineWriterMetadata@@YAJPEAGPEAPEAVIVssExamineWriterMetadata@@@Z" +#else +/* 32 bit entrypoint name */ +#define VSSVMETA_ENTRY "?CreateVssExamineWriterMetadata@@YGJPAGPAPAVIVssExamineWriterMetadata@@@Z" +#define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z" +#endif + + +// init with win9x, but maybe set to NT in InitWinAPI +DWORD g_platform_id = VER_PLATFORM_WIN32_WINDOWS; +DWORD g_MinorVersion = 0; +DWORD g_MajorVersion = 0; + +/* API Pointers */ + +t_OpenProcessToken p_OpenProcessToken = NULL; +t_AdjustTokenPrivileges p_AdjustTokenPrivileges = NULL; +t_LookupPrivilegeValue p_LookupPrivilegeValue = NULL; + +t_SetProcessShutdownParameters p_SetProcessShutdownParameters = NULL; + +t_CreateFileA p_CreateFileA = NULL; +t_CreateFileW p_CreateFileW = NULL; + +t_OpenEncryptedFileRawA p_OpenEncryptedFileRawA = NULL; +t_OpenEncryptedFileRawW p_OpenEncryptedFileRawW = NULL; +t_ReadEncryptedFileRaw p_ReadEncryptedFileRaw = NULL; +t_WriteEncryptedFileRaw p_WriteEncryptedFileRaw = NULL; +t_CloseEncryptedFileRaw p_CloseEncryptedFileRaw = NULL; + + +t_CreateDirectoryA p_CreateDirectoryA; +t_CreateDirectoryW p_CreateDirectoryW; + +t_GetFileInformationByHandleEx p_GetFileInformationByHandleEx = NULL; + +t_wunlink p_wunlink = NULL; +t_wmkdir p_wmkdir = NULL; + +t_GetFileAttributesA p_GetFileAttributesA = NULL; +t_GetFileAttributesW p_GetFileAttributesW = NULL; + +t_GetFileAttributesExA p_GetFileAttributesExA = NULL; +t_GetFileAttributesExW p_GetFileAttributesExW = NULL; + +t_SetFileAttributesA p_SetFileAttributesA = 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_AttachConsole p_AttachConsole = NULL; + +t_FindFirstFileA p_FindFirstFileA = NULL; +t_FindFirstFileW p_FindFirstFileW = NULL; + +t_FindNextFileA p_FindNextFileA = NULL; +t_FindNextFileW p_FindNextFileW = NULL; + +t_SetCurrentDirectoryA p_SetCurrentDirectoryA = NULL; +t_SetCurrentDirectoryW p_SetCurrentDirectoryW = NULL; + +t_GetCurrentDirectoryA p_GetCurrentDirectoryA = NULL; +t_GetCurrentDirectoryW p_GetCurrentDirectoryW = NULL; + +t_GetVolumePathNameW p_GetVolumePathNameW = NULL; +t_GetVolumeNameForVolumeMountPointW p_GetVolumeNameForVolumeMountPointW = NULL; + +t_SHGetFolderPath p_SHGetFolderPath = NULL; + +t_CreateProcessA p_CreateProcessA = NULL; +t_CreateProcessW p_CreateProcessW = NULL; + +t_CreateSymbolicLinkA p_CreateSymbolicLinkA = NULL; +t_CreateSymbolicLinkW p_CreateSymbolicLinkW = NULL; +t_InetPton p_InetPton = NULL; +t_GetProcessMemoryInfo p_GetProcessMemoryInfo = NULL; +t_EmptyWorkingSet p_EmptyWorkingSet = NULL; + +HMODULE vsslib = NULL; +t_CreateVssBackupComponents p_CreateVssBackupComponents = NULL; +t_VssFreeSnapshotProperties p_VssFreeSnapshotProperties = NULL; +t_CreateVssExamineWriterMetadata p_CreateVssExamineWriterMetadata; + + +static void atexit_handler() +{ + CoUninitialize(); +} + +/* http://thrysoee.dk/InsideCOM+/ch18d.htm + * The COM+ security infrastructure is initialized on a per-process basis at + * start-up. The CoInitializeSecurity function sets the default security values + * for the process. If an application does not call CoInitializeSecurity, COM+ + * calls the function automatically the first time an interface pointer is + * marshaled into or out of an apartment (or context) in the + * process. Attempting to call CoInitializeSecurity after marshaling takes + * place yields the infamous RPC_E_TOO_LATE error. Thus, programs that want to + * call CoInitializeSecurity explicitly are advised to do so immediately after + * calling CoInitializeEx. Note that CoInitializeSecurity is called only once per + * process, not in each thread that calls CoInitializeEx. +*/ +static void InitComInterface() +{ + /* Setup ComSecurity */ + HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); + if (FAILED(hr)) { + Dmsg1(0, "CoInitializeEx returned 0x%08X\n", hr); + + } else { + // Initialize COM security + hr = + CoInitializeSecurity( + NULL, // Allow *all* VSS writers to communicate back! + -1, // Default COM authentication service + NULL, // Default COM authorization service + NULL, // reserved parameter + RPC_C_AUTHN_LEVEL_PKT_PRIVACY, // Strongest COM authentication level + RPC_C_IMP_LEVEL_IDENTIFY, // Minimal impersonation abilities + NULL, // Default COM authentication settings + EOAC_NONE, // No special options + NULL // Reserved parameter + ); + if (FAILED(hr) && (hr != RPC_E_TOO_LATE)) { + Dmsg1(0, "CoInitializeSecurity returned 0x%08X\n", hr); + } + atexit(atexit_handler); + } +} + +void +InitWinAPIWrapper() +{ + OSVERSIONINFO osversioninfo = { sizeof(OSVERSIONINFO) }; + + // Get the current OS version + if (!GetVersionEx(&osversioninfo)) { + g_platform_id = 0; + } else { + g_platform_id = osversioninfo.dwPlatformId; + g_MinorVersion = osversioninfo.dwMinorVersion; + g_MajorVersion = osversioninfo.dwMajorVersion; + } + + HMODULE hLib = LoadLibraryA("KERNEL32.DLL"); + if (hLib) { + /* Might be defined in Kernel32.dll or PSAPI.DLL */ + p_GetProcessMemoryInfo = (t_GetProcessMemoryInfo) + GetProcAddress(hLib, "K32GetProcessMemoryInfo"); + + /* Might be defined in Kernel32.dll or PSAPI.DLL */ + p_EmptyWorkingSet = (t_EmptyWorkingSet) + GetProcAddress(hLib, "K32EmptyWorkingSet"); + + /* Not defined before win2008 */ + p_CreateSymbolicLinkA = (t_CreateSymbolicLinkA) + GetProcAddress(hLib, "CreateSymbolicLinkA"); + p_CreateSymbolicLinkW = (t_CreateSymbolicLinkW) + GetProcAddress(hLib, "CreateSymbolicLinkW"); + + /* create process calls */ + p_CreateProcessA = (t_CreateProcessA) + GetProcAddress(hLib, "CreateProcessA"); + p_CreateProcessW = (t_CreateProcessW) + GetProcAddress(hLib, "CreateProcessW"); + + /* create file calls */ + p_CreateFileA = (t_CreateFileA)GetProcAddress(hLib, "CreateFileA"); + p_CreateDirectoryA = (t_CreateDirectoryA)GetProcAddress(hLib, "CreateDirectoryA"); + + p_GetFileInformationByHandleEx = (t_GetFileInformationByHandleEx) + GetProcAddress(hLib, "GetFileInformationByHandleEx"); + + /* attribute calls */ + p_GetFileAttributesA = (t_GetFileAttributesA)GetProcAddress(hLib, "GetFileAttributesA"); + p_GetFileAttributesExA = (t_GetFileAttributesExA)GetProcAddress(hLib, "GetFileAttributesExA"); + p_SetFileAttributesA = (t_SetFileAttributesA)GetProcAddress(hLib, "SetFileAttributesA"); + + /* process calls */ + p_SetProcessShutdownParameters = (t_SetProcessShutdownParameters) + GetProcAddress(hLib, "SetProcessShutdownParameters"); + + /* char conversion calls */ + p_WideCharToMultiByte = (t_WideCharToMultiByte) + GetProcAddress(hLib, "WideCharToMultiByte"); + p_MultiByteToWideChar = (t_MultiByteToWideChar) + GetProcAddress(hLib, "MultiByteToWideChar"); + + /* find files */ + p_FindFirstFileA = (t_FindFirstFileA)GetProcAddress(hLib, "FindFirstFileA"); + p_FindNextFileA = (t_FindNextFileA)GetProcAddress(hLib, "FindNextFileA"); + + /* get and set directory */ + p_GetCurrentDirectoryA = (t_GetCurrentDirectoryA) + GetProcAddress(hLib, "GetCurrentDirectoryA"); + p_SetCurrentDirectoryA = (t_SetCurrentDirectoryA) + GetProcAddress(hLib, "SetCurrentDirectoryA"); + + if (g_platform_id != VER_PLATFORM_WIN32_WINDOWS) { + p_CreateFileW = (t_CreateFileW) + GetProcAddress(hLib, "CreateFileW"); + p_CreateDirectoryW = (t_CreateDirectoryW) + GetProcAddress(hLib, "CreateDirectoryW"); + + /* backup calls */ + p_BackupRead = (t_BackupRead)GetProcAddress(hLib, "BackupRead"); + p_BackupWrite = (t_BackupWrite)GetProcAddress(hLib, "BackupWrite"); + + p_GetFileAttributesW = (t_GetFileAttributesW) + GetProcAddress(hLib, "GetFileAttributesW"); + p_GetFileAttributesExW = (t_GetFileAttributesExW) + GetProcAddress(hLib, "GetFileAttributesExW"); + p_SetFileAttributesW = (t_SetFileAttributesW) + GetProcAddress(hLib, "SetFileAttributesW"); + p_FindFirstFileW = (t_FindFirstFileW) + GetProcAddress(hLib, "FindFirstFileW"); + p_FindNextFileW = (t_FindNextFileW) + GetProcAddress(hLib, "FindNextFileW"); + p_GetCurrentDirectoryW = (t_GetCurrentDirectoryW) + GetProcAddress(hLib, "GetCurrentDirectoryW"); + p_SetCurrentDirectoryW = (t_SetCurrentDirectoryW) + GetProcAddress(hLib, "SetCurrentDirectoryW"); + + /* some special stuff we need for VSS + but static linkage doesn't work on Win 9x */ + p_GetVolumePathNameW = (t_GetVolumePathNameW) + GetProcAddress(hLib, "GetVolumePathNameW"); + p_GetVolumeNameForVolumeMountPointW = (t_GetVolumeNameForVolumeMountPointW) + GetProcAddress(hLib, "GetVolumeNameForVolumeMountPointW"); + + p_AttachConsole = (t_AttachConsole) + GetProcAddress(hLib, "AttachConsole"); + } + } + + if (g_platform_id != VER_PLATFORM_WIN32_WINDOWS) { + hLib = LoadLibraryA("MSVCRT.DLL"); + if (hLib) { + /* unlink */ + p_wunlink = (t_wunlink) + GetProcAddress(hLib, "_wunlink"); + /* wmkdir */ + p_wmkdir = (t_wmkdir) + GetProcAddress(hLib, "_wmkdir"); + } + + hLib = LoadLibraryA("ADVAPI32.DLL"); + if (hLib) { + p_OpenProcessToken = (t_OpenProcessToken) + GetProcAddress(hLib, "OpenProcessToken"); + p_AdjustTokenPrivileges = (t_AdjustTokenPrivileges) + GetProcAddress(hLib, "AdjustTokenPrivileges"); + p_LookupPrivilegeValue = (t_LookupPrivilegeValue) + GetProcAddress(hLib, "LookupPrivilegeValueA"); + + p_OpenEncryptedFileRawA = (t_OpenEncryptedFileRawA) + GetProcAddress(hLib, "OpenEncryptedFileRawA"); + p_OpenEncryptedFileRawW = (t_OpenEncryptedFileRawW) + GetProcAddress(hLib, "OpenEncryptedFileRawW"); + p_ReadEncryptedFileRaw = (t_ReadEncryptedFileRaw) + GetProcAddress(hLib, "ReadEncryptedFileRaw"); + p_WriteEncryptedFileRaw = (t_WriteEncryptedFileRaw) + GetProcAddress(hLib, "WriteEncryptedFileRaw"); + p_CloseEncryptedFileRaw = (t_CloseEncryptedFileRaw) + GetProcAddress(hLib, "CloseEncryptedFileRaw"); + } + } + + hLib = LoadLibraryA("SHELL32.DLL"); + if (hLib) { + p_SHGetFolderPath = (t_SHGetFolderPath) + 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"); + } + } + hLib = LoadLibraryA("WS2_32.DLL"); + if (hLib) { + p_InetPton = (t_InetPton)GetProcAddress(hLib, "InetPtonA"); + } + if (!p_GetProcessMemoryInfo) { + hLib = LoadLibraryA("PSAPI.DLL"); + if (hLib) { + p_GetProcessMemoryInfo = (t_GetProcessMemoryInfo)GetProcAddress(hLib, "GetProcessMemoryInfo"); + p_EmptyWorkingSet = (t_EmptyWorkingSet) GetProcAddress(hLib, "EmptyWorkingSet"); + } + } + + vsslib = LoadLibraryA("VSSAPI.DLL"); + if (vsslib) { + p_CreateVssBackupComponents = (t_CreateVssBackupComponents) + GetProcAddress(vsslib, VSSVBACK_ENTRY); + p_VssFreeSnapshotProperties = (t_VssFreeSnapshotProperties) + GetProcAddress(vsslib, "VssFreeSnapshotProperties"); + p_CreateVssExamineWriterMetadata = (t_CreateVssExamineWriterMetadata) + GetProcAddress(vsslib, VSSVMETA_ENTRY); + } + + /* In recent version of windows, the function is in Kernel32 */ + if (!p_GetFileInformationByHandleEx) { + hLib = LoadLibraryA("FileExtd.lib"); + if (hLib) { + p_GetFileInformationByHandleEx = (t_GetFileInformationByHandleEx) + GetProcAddress(hLib, "GetFileInformationByHandleEx"); + } + } + + atexit(Win32ConvCleanupCache); + + /* Setup Com Object security interface (called once per process) */ + InitComInterface(); +} diff --git a/bacula/src/win32/compat/winapi.h b/bacula/src/win32/compat/winapi.h new file mode 100644 index 0000000000..2a76c5e63d --- /dev/null +++ b/bacula/src/win32/compat/winapi.h @@ -0,0 +1,242 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Windows APIs that are different for each system. + * We use pointers to the entry points so that a + * single binary will run on all Windows systems. + * + * Kern Sibbald MMIII + */ + +#ifndef __WINAPI_H +#define __WINAPI_H + +#ifndef POOLMEM +typedef char POOLMEM; +#endif + +// unicode enabling of win 32 needs some defines and functions + +// using an average of 3 bytes per character is probably fine in +// practice but I believe that Windows actually uses UTF-16 encoding +// as opposed to UCS2 which means characters 0x10000-0x10ffff are +// valid and result in 4 byte UTF-8 encodings. +#define MAX_PATH_UTF8 MAX_PATH*4 // strict upper bound on UTF-16 to UTF-8 conversion + +// from +// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getfileattributesex.asp +// In the ANSI version of this function, the name is limited to +// MAX_PATH characters. To extend this limit to 32,767 wide +// characters, call the Unicode version of the function and prepend +// "\\?\" to the path. For more information, see Naming a File. +#define MAX_PATH_W 32767 + +int wchar_2_UTF8(POOLMEM **pszUTF, const wchar_t *pszUCS); +int wchar_2_UTF8(char *pszUTF, const WCHAR *pszUCS, int cchChar = MAX_PATH_UTF8); +int UTF8_2_wchar(POOLMEM **pszUCS, const char *pszUTF); +int make_win32_path_UTF8_2_wchar(POOLMEM **pszUCS, const char *pszUTF, BOOL* pBIsRawPath = NULL); + +// init with win9x, but maybe set to NT in InitWinAPI +extern DWORD DLL_IMP_EXP g_platform_id; +extern DWORD DLL_IMP_EXP g_MinorVersion; +extern DWORD DLL_IMP_EXP g_MajorVersion; + +/* In ADVAPI32.DLL */ +typedef BOOL (WINAPI * t_OpenProcessToken)(HANDLE, DWORD, PHANDLE); +typedef BOOL (WINAPI * t_AdjustTokenPrivileges)(HANDLE, BOOL, + PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); +typedef BOOL (WINAPI * t_LookupPrivilegeValue)(LPCTSTR, LPCTSTR, PLUID); + +extern t_OpenProcessToken DLL_IMP_EXP p_OpenProcessToken; +extern t_AdjustTokenPrivileges DLL_IMP_EXP p_AdjustTokenPrivileges; +extern t_LookupPrivilegeValue DLL_IMP_EXP p_LookupPrivilegeValue; + +/* In MSVCRT.DLL */ +typedef int (__cdecl * t_wunlink) (const wchar_t *); +typedef int (__cdecl * t_wmkdir) (const wchar_t *); +typedef int (__cdecl * t_wopen) (const wchar_t *, int, ...); + +extern t_wunlink DLL_IMP_EXP p_wunlink; +extern t_wmkdir DLL_IMP_EXP p_wmkdir; + +/* In KERNEL32.DLL */ +typedef BOOL (WINAPI * t_GetFileAttributesExA)(LPCSTR, GET_FILEEX_INFO_LEVELS, + LPVOID); +typedef BOOL (WINAPI * t_GetFileAttributesExW)(LPCWSTR, GET_FILEEX_INFO_LEVELS, + LPVOID); + +typedef DWORD (WINAPI * t_GetFileAttributesA)(LPCSTR); +typedef DWORD (WINAPI * t_GetFileAttributesW)(LPCWSTR); +typedef BOOL (WINAPI * t_SetFileAttributesA)(LPCSTR, DWORD); +typedef BOOL (WINAPI * t_SetFileAttributesW)(LPCWSTR, DWORD); + +typedef HANDLE (WINAPI * t_CreateFileA) (LPCSTR, DWORD ,DWORD, LPSECURITY_ATTRIBUTES, + DWORD , DWORD, HANDLE); +typedef HANDLE (WINAPI * t_CreateFileW) (LPCWSTR, DWORD ,DWORD, LPSECURITY_ATTRIBUTES, + DWORD , DWORD, HANDLE); + +typedef DWORD (WINAPI * t_OpenEncryptedFileRawA) (LPCSTR, ULONG, PVOID); +typedef DWORD (WINAPI * t_OpenEncryptedFileRawW) (LPCWSTR, ULONG, PVOID); +typedef DWORD (WINAPI * t_ReadEncryptedFileRaw) (PFE_EXPORT_FUNC, PVOID, PVOID); +typedef DWORD (WINAPI * t_WriteEncryptedFileRaw) (PFE_IMPORT_FUNC, PVOID, PVOID); +typedef void (WINAPI * t_CloseEncryptedFileRaw) (PVOID); + +typedef BOOL (WINAPI * t_CreateDirectoryA) (LPCSTR, LPSECURITY_ATTRIBUTES); +typedef BOOL (WINAPI * t_CreateDirectoryW) (LPCWSTR, LPSECURITY_ATTRIBUTES); + +typedef DWORD (WINAPI * t_GetFileInformationByHandleEx)(HANDLE, FILE_INFO_BY_HANDLE_CLASS, LPVOID, DWORD); + +typedef BOOL (WINAPI * t_SetProcessShutdownParameters)(DWORD, DWORD); +typedef BOOL (WINAPI * t_BackupRead)(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*); +typedef BOOL (WINAPI * t_BackupWrite)(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*); + +typedef int (WINAPI * t_WideCharToMultiByte) (UINT CodePage, DWORD , LPCWSTR, int, + LPSTR, int, LPCSTR, LPBOOL); + +typedef int (WINAPI * t_MultiByteToWideChar) (UINT, DWORD, LPCSTR, int, LPWSTR, int); +typedef HANDLE (WINAPI * t_FindFirstFileA) (LPCSTR, LPWIN32_FIND_DATAA); +typedef HANDLE (WINAPI * t_FindFirstFileW) (LPCWSTR, LPWIN32_FIND_DATAW); + +typedef BOOL (WINAPI * t_FindNextFileA) (HANDLE, LPWIN32_FIND_DATAA); +typedef BOOL (WINAPI * t_FindNextFileW) (HANDLE, LPWIN32_FIND_DATAW); + +typedef BOOL (WINAPI * t_SetCurrentDirectoryA) (LPCSTR); +typedef BOOL (WINAPI * t_SetCurrentDirectoryW) (LPCWSTR); + +typedef DWORD (WINAPI * t_GetCurrentDirectoryA) (DWORD, LPSTR); +typedef DWORD (WINAPI * t_GetCurrentDirectoryW) (DWORD, LPWSTR); + +typedef BOOL (WINAPI * t_GetVolumePathNameW) (LPCWSTR, LPWSTR, DWORD); +typedef BOOL (WINAPI * t_GetVolumeNameForVolumeMountPointW) (LPCWSTR, LPWSTR, DWORD); + +typedef BOOL (WINAPI * t_CreateSymbolicLinkA) (LPCSTR, LPCSTR, DWORD); +typedef BOOL (WINAPI * t_CreateSymbolicLinkW) (LPCWSTR, LPCWSTR, DWORD); +/* See: http://msdn.microsoft.com/en-us/library/windows/desktop/cc805844%28v=vs.85%29.aspx */ +typedef int (WSAAPI * t_InetPton)(int, const char *, void *); + + +typedef BOOL (WINAPI * t_AttachConsole) (DWORD); + +typedef BOOL (WINAPI *t_CreateProcessA) ( + LPCSTR, + LPSTR, + LPSECURITY_ATTRIBUTES, + LPSECURITY_ATTRIBUTES, + BOOL, + DWORD, + PVOID, + LPCSTR, + LPSTARTUPINFOA, + LPPROCESS_INFORMATION); +typedef BOOL (WINAPI *t_CreateProcessW) ( + LPCWSTR, + LPWSTR, + LPSECURITY_ATTRIBUTES, + LPSECURITY_ATTRIBUTES, + BOOL, + DWORD, + PVOID, + LPCWSTR, + LPSTARTUPINFOW, + LPPROCESS_INFORMATION); + +typedef BOOL (WINAPI *t_GetProcessMemoryInfo) ( + HANDLE Process, + PPROCESS_MEMORY_COUNTERS ppsmemCounters, + DWORD cb); + +typedef BOOL (WINAPI *t_EmptyWorkingSet) (HANDLE hProcess); + +typedef struct _VSS_SNAPSHOT_PROP VSS_SNAPSHOT_PROP; +class IVssBackupComponents; +class IVssExamineWriterMetadata; + +typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(IVssBackupComponents **); +typedef void (APIENTRY* t_VssFreeSnapshotProperties)(VSS_SNAPSHOT_PROP*); +typedef HRESULT (WINAPI* t_CreateVssExamineWriterMetadata)(BSTR, IVssExamineWriterMetadata **); + +extern t_CreateVssBackupComponents DLL_IMP_EXP p_CreateVssBackupComponents; +extern t_VssFreeSnapshotProperties DLL_IMP_EXP p_VssFreeSnapshotProperties; +extern t_CreateVssExamineWriterMetadata DLL_IMP_EXP p_CreateVssExamineWriterMetadata; + +extern t_EmptyWorkingSet DLL_IMP_EXP p_EmptyWorkingSet; +extern t_GetProcessMemoryInfo DLL_IMP_EXP p_GetProcessMemoryInfo; +extern t_CreateProcessA DLL_IMP_EXP p_CreateProcessA; +extern t_CreateProcessW DLL_IMP_EXP p_CreateProcessW; + +extern t_GetFileAttributesA DLL_IMP_EXP p_GetFileAttributesA; +extern t_GetFileAttributesW DLL_IMP_EXP p_GetFileAttributesW; + +extern t_GetFileAttributesExA DLL_IMP_EXP p_GetFileAttributesExA; +extern t_GetFileAttributesExW DLL_IMP_EXP p_GetFileAttributesExW; + +extern t_SetFileAttributesA DLL_IMP_EXP p_SetFileAttributesA; +extern t_SetFileAttributesW DLL_IMP_EXP p_SetFileAttributesW; + +extern t_CreateFileA DLL_IMP_EXP p_CreateFileA; +extern t_CreateFileW DLL_IMP_EXP p_CreateFileW; + +extern t_OpenEncryptedFileRawA DLL_IMP_EXP p_OpenEncryptedFileRawA; +extern t_OpenEncryptedFileRawW DLL_IMP_EXP p_OpenEncryptedFileRawW; +extern t_ReadEncryptedFileRaw DLL_IMP_EXP p_ReadEncryptedFileRaw; +extern t_WriteEncryptedFileRaw DLL_IMP_EXP p_WriteEncryptedFileRaw; +extern t_CloseEncryptedFileRaw DLL_IMP_EXP p_CloseEncryptedFileRaw; + +extern t_CreateDirectoryA DLL_IMP_EXP p_CreateDirectoryA; +extern t_CreateDirectoryW DLL_IMP_EXP p_CreateDirectoryW; + +extern t_GetFileInformationByHandleEx DLL_IMP_EXP p_GetFileInformationByHandleEx; + +extern t_SetProcessShutdownParameters DLL_IMP_EXP p_SetProcessShutdownParameters; +extern t_BackupRead DLL_IMP_EXP p_BackupRead; +extern t_BackupWrite DLL_IMP_EXP p_BackupWrite; + +extern t_WideCharToMultiByte DLL_IMP_EXP p_WideCharToMultiByte; +extern t_MultiByteToWideChar DLL_IMP_EXP p_MultiByteToWideChar; + +extern t_FindFirstFileA DLL_IMP_EXP p_FindFirstFileA; +extern t_FindFirstFileW DLL_IMP_EXP p_FindFirstFileW; + +extern t_FindNextFileA DLL_IMP_EXP p_FindNextFileA; +extern t_FindNextFileW DLL_IMP_EXP p_FindNextFileW; + +extern t_SetCurrentDirectoryA DLL_IMP_EXP p_SetCurrentDirectoryA; +extern t_SetCurrentDirectoryW DLL_IMP_EXP p_SetCurrentDirectoryW; + +extern t_GetCurrentDirectoryA DLL_IMP_EXP p_GetCurrentDirectoryA; +extern t_GetCurrentDirectoryW DLL_IMP_EXP p_GetCurrentDirectoryW; + +extern t_GetVolumePathNameW DLL_IMP_EXP p_GetVolumePathNameW; +extern t_GetVolumeNameForVolumeMountPointW DLL_IMP_EXP p_GetVolumeNameForVolumeMountPointW; + +extern t_AttachConsole DLL_IMP_EXP p_AttachConsole; + +extern t_CreateSymbolicLinkW DLL_IMP_EXP p_CreateSymbolicLinkW; +extern t_CreateSymbolicLinkA DLL_IMP_EXP p_CreateSymbolicLinkA; +extern t_InetPton DLL_IMP_EXP p_InetPton; + +extern HMODULE DLL_IMP_EXP vsslib; + +void InitWinAPIWrapper(); + +/* In SHFolder.dll on older systems, and now Shell32.dll */ +typedef BOOL (WINAPI * t_SHGetFolderPath)(HWND, int, HANDLE, DWORD, LPTSTR); +extern t_SHGetFolderPath DLL_IMP_EXP p_SHGetFolderPath; + +#endif /* __WINAPI_H */ diff --git a/bacula/src/win32/compat/winhdrs.h b/bacula/src/win32/compat/winhdrs.h new file mode 100644 index 0000000000..b8884351d5 --- /dev/null +++ b/bacula/src/win32/compat/winhdrs.h @@ -0,0 +1,14 @@ + +#ifndef __WINHDRS_H_ +#define __WINHDRS_H_ + +#include "mingwconfig.h" +#include +#include +#include +#ifdef HAVE_IPV6 +#include +#endif +#include + +#endif diff --git a/bacula/src/win32/compat/winhost.h b/bacula/src/win32/compat/winhost.h new file mode 100644 index 0000000000..3a077b9719 --- /dev/null +++ b/bacula/src/win32/compat/winhost.h @@ -0,0 +1,51 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Define Host machine + */ + + +#include "host.h" +#undef HOST_OS +#undef DISTNAME +#undef DISTVER + +#ifdef HAVE_MINGW +extern char win_os[]; +#define HOST_OS "Linux" +#define DISTNAME "Cross-compile" +#ifndef BACULA +#define BACULA "Bacula" +#endif +#ifdef _WIN64 +# define DISTVER "Win64" +#else +# define DISTVER "Win32" +#endif + +#else + +extern DLL_IMP_EXP char WIN_VERSION_LONG[]; +extern DLL_IMP_EXP char WIN_VERSION[]; + +#define HOST_OS WIN_VERSION_LONG +#define DISTNAME "MVS" +#define DISTVER WIN_VERSION + +#endif diff --git a/bacula/src/win32/compat/winsock.h b/bacula/src/win32/compat/winsock.h new file mode 100644 index 0000000000..8cb0067fbe --- /dev/null +++ b/bacula/src/win32/compat/winsock.h @@ -0,0 +1,4 @@ +#include +#ifdef HAVE_IPV6 +#include +#endif diff --git a/bacula/src/win32/compat/xwinconfig.h b/bacula/src/win32/compat/xwinconfig.h new file mode 100644 index 0000000000..7a41edc58d --- /dev/null +++ b/bacula/src/win32/compat/xwinconfig.h @@ -0,0 +1,645 @@ +/* + * This file was originally generated by configure, but has been edited + * to provide the correct defines for the Native Win32 build under + * Visual Studio. + * + * Note!!! We normally do NOT build the Windows versions with this header + * file. We use the Mingw environment defined in mingwconfig.h. + */ +/* ------------------------------------------------------------------------- */ +/* -- CONFIGURE SPECIFIED FEATURES -- */ +/* ------------------------------------------------------------------------- */ + +#ifndef __WINCONFIG_H +#define __WINCONFIG_H + +#define HAVE_OPENSSL 1 +#define HAVE_CRYPTO 1 +#define HAVE_TLS 1 + +/* Define if you want to use MySQL as Catalog database */ +/* #undef USE_MYSQL_DB */ + +/* Define if you want SmartAlloc debug code enabled */ +#define SMARTALLOC 1 + +/* Define to `int' if doesn't define. */ +/* #undef daddr_t */ + +/* Define to `int' if doesn't define. */ +#define major_t int + +/* Define to `int' if doesn't define. */ +#define minor_t int + +/* Define to `int' if doesn't define. */ +/* #undef ssize_t */ + +/* Define if you want to use MySQL */ +/* #define HAVE_MYSQL 1 */ + +/* Define if you want to use embedded MySQL */ +/* #undef HAVE_EMBEDDED_MYSQL */ + +/* Define if you want to use SQLite3 */ +/* #undef HAVE_SQLITE3 */ + +/* Define if you want to use Berkeley DB */ +/* #undef HAVE_BERKELEY_DB */ + + +/* Define if you want to use PostgreSQL */ +/* #undef HAVE_PGSQL */ + +/* ------------------------------------------------------------------------- */ +/* -- CONFIGURE DETECTED FEATURES -- */ +/* ------------------------------------------------------------------------- */ + +/* Define if you need function prototypes */ +#define PROTOTYPES 1 + +/* Define if you have XPointer typedef */ +/* #undef HAVE_XPOINTER */ + +/* Define if you have _GNU_SOURCE getpt() */ +/* #undef HAVE_GETPT */ + +/* Define if you have GCC */ +/* #undef HAVE_GCC 1 */ + +/* Define if you have the Andrew File System. */ +/* #undef AFS */ + +/* Define If you want find -nouser and -nogroup to make tables of + used UIDs and GIDs at startup instead of using getpwuid or + getgrgid when needed. Speeds up -nouser and -nogroup unless you + are running NIS or Hesiod, which make password and group calls + very expensive. */ +/* #undef CACHE_IDS */ + +/* Define to use SVR4 statvfs to get filesystem type. */ +/* #undef FSTYPE_STATVFS */ + +/* Define to use SVR3.2 statfs to get filesystem type. */ +/* #undef FSTYPE_USG_STATFS */ + +/* Define to use AIX3 statfs to get filesystem type. */ +/* #undef FSTYPE_AIX_STATFS */ + +/* Define to use 4.3BSD getmntent to get filesystem type. */ +/* #undef FSTYPE_MNTENT 1 */ + +/* Define to use 4.4BSD and TRU64 statfs to get filesystem type. */ +/* #undef FSTYPE_STATFS */ + +/* Define to use Ultrix getmnt to get filesystem type. */ +/* #undef FSTYPE_GETMNT */ + +/* Define to `unsigned long' if doesn't define. */ +/* #undef dev_t */ + +/* Define to `unsigned long' if doesn't define. */ +/* #undef ino_t */ + +/* Define to 1 if utime.h exists and declares struct utimbuf. */ +#ifdef HAVE_MINGW +#define HAVE_UTIME_H 1 +#endif + +/* Data types */ +#define HAVE_U_INT 1 +#define HAVE_INTXX_T 1 +#define HAVE_U_INTXX_T 1 +/* #undef HAVE_UINTXX_T */ +#define HAVE_INT64_T 1 +#define HAVE_U_INT64_T 1 +#define HAVE_INTMAX_T 1 +/* #undef HAVE_U_INTMAX_T */ + +/* Define if you want TCP Wrappers support */ +/* #undef HAVE_LIBWRAP */ + +/* Define if you have sys/bitypes.h */ +/* #undef HAVE_SYS_BITYPES_H */ + +/* Directory for PID files */ +/* #define _PATH_BACULA_PIDDIR "/var/run" */ +#undef _PATH_BACULA_PIDDIR + +/* Define if you have zlib */ +#define HAVE_LIBZ 1 + +/* General libs */ +/* #undef LIBS */ + +/* File daemon specif libraries */ +#define FDLIBS 1 + +/* Path to Sendmail program */ +/* #undef SENDMAIL_PATH */ + +/* What kind of signals we have */ +/*#define HAVE_POSIX_SIGNALS 1 */ +/* #undef HAVE_BSD_SIGNALS */ +/* #undef HAVE_USG_SIGHOLD */ + +/* Operating systems */ +/* OSes */ +/* #undef HAVE_LINUX_OS */ +/* #undef HAVE_FREEBSD_OS */ +/* #undef HAVE_NETBSD_OS */ +/* #undef HAVE_OPENBSD_OS */ +/* #undef HAVE_BSDI_OS */ +/* #undef HAVE_HPUX_OS */ +/* #undef HAVE_SUN_OS */ +/* #undef HAVE_IRIX_OS */ +/* #undef HAVE_AIX_OS */ +/* #undef HAVE_SGI_OS */ +/* #define HAVE_CYGWIN 1 */ +/* #undef HAVE_OSF1_OS */ +/* #undef HAVE_DARWIN_OS */ + +/* Set to correct scanf value for long long int */ +#define lld "lld" +#define llu "llu" + +/*#define HAVE_READLINE 1 */ + +/* #undef HAVE_GMP */ + +/* #undef HAVE_CWEB */ + +/* #define HAVE_FCHDIR 1 */ + +/* #undef HAVE_GETOPT_LONG */ + +/* #undef HAVE_LIBSM */ + +/* Check for thread safe routines */ +/*#define HAVE_LOCALTIME_R 1 */ +/* #undef HAVE_READDIR_R */ +/*#define HAVE_STRERROR_R 1*/ +/* #undef HAVE_GETHOSTBYNAME_R */ + +#define HAVE_STRTOLL 1 +/* #undef HAVE_INET_PTON */ + +/*#define HAVE_SOCKLEN_T 1 */ + +/* #undef HAVE_OLD_SOCKOPT */ + +/* #undef HAVE_BIGENDIAN */ + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +/* #undef CLOSEDIR_VOID */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 +#ifndef HAVE_MINGW +#define alloca _alloca +#endif +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_ARPA_NAMESER_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `chflags' function. */ +/* #undef HAVE_CHFLAGS */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if you have the `fchdir' function. */ +/*#define HAVE_FCHDIR 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if your system has a working POSIX `fnmatch' function. */ +/*#define HAVE_FNMATCH 1 */ + +/* Define to 1 if you have the `fork' function. */ +/*#define HAVE_FORK 1 */ + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getdomainname' function. */ +/*#define HAVE_GETDOMAINNAME 1 */ + +/* Define to 1 if you have the `gethostbyname_r' function. */ +/* #undef HAVE_GETHOSTBYNAME_R */ + +/* Define to 1 if you have the `gethostid' function. */ +#define HAVE_GETHOSTID 1 + +/* Define to 1 if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the `getmntent' function. */ +/*#define HAVE_GETMNTENT 1 */ + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 +#define getpid _getpid + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_GRP_H 1*/ + +/* Define to 1 if you have the `inet_pton' function. */ +/* #undef HAVE_INET_PTON */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBC_H */ + +/* Define to 1 if you have the `inet' library (-linet). */ +/* #undef HAVE_LIBINET */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `sun' library (-lsun). */ +/* #undef HAVE_LIBSUN */ + +/* Define to 1 if you have the `xnet' library (-lxnet). */ +/* #undef HAVE_LIBXNET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MTIO_H */ + +/* Define to 1 if you have the `nanosleep' function. */ +#define HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_PWD_H 1*/ + +/* Define to 1 if you have the `readdir_r' function. */ +/* #undef HAVE_READDIR_R */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_RESOLV_H 1*/ + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#if (defined _MSC_VER) && (_MSC_VER >= 1400) // VC8+ +/* 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 +#endif + +#undef LOCALEDIR +#define LOCALEDIR "." + +#undef HAVE_NL_LANGINFO + +/* Define to 1 if you have the `setpgid' function. */ +#define HAVE_SETPGID 1 + +/* Define to 1 if you have the `setpgrp' function. */ +#define HAVE_SETPGRP 1 + +/* Define to 1 if you have the `setsid' function. */ +#define HAVE_SETSID 1 + +/* Define to 1 if you have the `signal' function. */ +/*#define HAVE_SIGNAL 1 */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 +#define HAVE_SNPRINTF_DECL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_STDINT_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +/*#define HAVE_STRCASECMP 1*/ + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncmp' function. */ +#define HAVE_STRNCMP 1 + +/* Define to 1 if you have the `strncpy' function. */ +#define HAVE_STRNCPY 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if `tm_zone' is member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM_TM_ZONE */ + +/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ +#define HAVE_ST_BLKSIZE 1 + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +#define HAVE_ST_BLOCKS 1 + +/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use + `HAVE_STRUCT_STAT_ST_RDEV' instead. */ +#define HAVE_ST_RDEV 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BYTEORDER_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MTIO_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `tcgetattr' function. */ +#define HAVE_TCGETATTR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +/* #undef HAVE_TM_ZONE */ + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +#define HAVE_TZNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VARARGS_H */ + +/* Define to 1 if you have the `vfprintf' function. */ +#define HAVE_VFPRINTF 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 +#define HAVE_VSNPRINTF_DECL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + +#define HAVE_LZO 1 +/* Define to 1 if you have the header file. */ +#define HAVE_LZO_LZO1X_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_LZO_LZOCONF_H 1 + + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to 1 if the `setpgrp' function takes no argument. */ +#define SETPGRP_VOID 1 + +/* The size of a `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `int *', as computed by sizeof. */ +#define SIZEOF_INT_P 4 + +/* The size of a `long int', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of a `long int', as computed by sizeof. */ +#define SIZEOF_LONG_INT 4 + +/* The size of a `long long int', as computed by sizeof. */ +#define SIZEOF_LONG_LONG_INT 8 + +/* The size of a `short int', as computed by sizeof. */ +#define SIZEOF_SHORT_INT 2 + +/* The size of a `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 4 + +/* The size of a `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define to 1 if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `long' if does not define. */ +/* #undef daddr_t */ + +/* Define to `unsigned long' if does not define. */ +/* #undef dev_t */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define to `unsigned long' if does not define. */ +/* #undef ino_t */ + +/* Define to `int' if does not define. */ +#define major_t int + +/* Define to `int' if does not define. */ +#define minor_t int + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long' if does not define. */ +/* #undef off_t */ + +/* Define to `int' if does not define. */ +/* #undef pid_t */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if does not define. */ +/* #undef ssize_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + +/* Use long unsigned int for ioctl request */ +#define HAVE_IOCTL_ULINT_REQUEST + +/* Little Endian */ +#define HAVE_LITTLE_ENDIAN 1 + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define to make fseeko etc. visible, on some hosts. */ +#define _LARGEFILE_SOURCE 1 + +/* Define for large files, on AIX-style hosts. */ +#define _LARGE_FILES 1 + +#endif /* __WINCONFIG_H */ diff --git a/bacula/src/win32/console/Makefile b/bacula/src/win32/console/Makefile new file mode 100644 index 0000000000..c44f343191 --- /dev/null +++ b/bacula/src/win32/console/Makefile @@ -0,0 +1,59 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Author: Robert Nelson +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Written by Robert Nelson, June 2006 +# + +include ../Makefile.inc + +INCLUDES = \ + $(INCLUDE_BACULA) \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_OPENSSL) + +DEFINES = \ + -DUSING_DLL \ + $(HAVES) + +vpath %.c $(MAINDIR)/src/console +vpath %.cpp $(MAINDIR)/src/console + +########################################################################## + +CONSOLE_OBJS = \ + $(OBJDIR)/authenticate.o \ + $(OBJDIR)/console.o \ + $(OBJDIR)/console_conf.o + +ALL_OBJS = $(CONSOLE_OBJS) + +CONSOLE_LIBS = $(LIBS_NETWORK) + +###################################################################### + +# Targets + +.PHONY: all clean distclean + +all: $(BINDIR)/bconsole.exe + +distclean: clean + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(ALL_OBJS)) + $(call clean_exe,$(BINDIR)/bconsole.exe) + $(ECHO_CMD)rm -rf $(OBJDIRS) + +# +# Rules +# + +$(BINDIR)/bconsole.exe: $(CONSOLE_OBJS) $(LIBS_BACULA) + $(call link_conapp,$(CONSOLE_LIBS)) + +include ../Makefile.rules diff --git a/bacula/src/win32/console/console.vcproj b/bacula/src/win32/console/console.vcproj new file mode 100644 index 0000000000..57bbea9c91 --- /dev/null +++ b/bacula/src/win32/console/console.vcproj @@ -0,0 +1,293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/cygwin.NET.bashrc b/bacula/src/win32/cygwin.NET.bashrc new file mode 100644 index 0000000000..07f4c639c2 --- /dev/null +++ b/bacula/src/win32/cygwin.NET.bashrc @@ -0,0 +1,63 @@ +export ALLUSERSPROFILE='C:\Documents and Settings\All Users' +export APPDATA='C:\Documents and Settings\Rick\Application Data' +export BASEMAKE='C:\Program Files\Microsoft SDK\Include\BKOffice.Mak' +export BASH=/usr/bin/bash +export BKOFFICE='C:\Program Files\Microsoft SDK\.' +export CLIENTNAME=Console +export COLORFGBG='0;default;15' +export COLORTERM=rxvt-xpm +export COLUMNS=70 +export COMMONPROGRAMFILES='C:\Program Files\Common Files' +export COMPUTERNAME=RICK_LPATOP +export COMSPEC='C:\WINDOWS\system32\cmd.exe' +export CYGWIN=notty +export DIRSTACK=() +export DISPLAY=:0 +export GROUPS=() +export HISTFILE=/cygdrive/c/home/Rick/.bash_history +export HISTFILESIZE=500 +export HISTSIZE=500 +export HOME=/cygdrive/c/home/Rick +export HOMEDRIVE=C: +export HOMEPATH='\Documents and Settings\Rick' +export HOSTNAME=RICK-LPATOP +export HOSTTYPE=i686 +export IFS=$' \t\n' +export INCLUDE='C:\Program Files\Microsoft SDK\Include\.;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\atlmfc\include;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\include' +export INETSDK='C:\Program Files\Microsoft SDK\.' +export LIB='C:\Program Files\Microsoft SDK\Lib\.;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\atlmfc\lib;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib' +export LINES=65 +export LOGONSERVER='\\RICK-LPATOP' +export MACHTYPE=i686-pc-cygwin +export MAILCHECK=60 +export MAKE_MODE=UNIX +export MSSDK='C:\Program Files\Microsoft SDK\.' +export MSTOOLS='C:\Program Files\Microsoft SDK\.' +export NUMBER_OF_PROCESSORS=1 +export OLDPWD=/home/Rick/bacula +export OPTERR=1 +export OPTIND=1 +export OS=Windows_NT +export OSTYPE=cygwin +export PATH='/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/VC7/Bin:/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/VC7:/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/Common/Tools/Bin:/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/Common/Tools:/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/Common7/IDE:c:/cygwin/bin:/usr/bin:/home/sbarn/bin:/sbin:/usr/sbin:' +export PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH' +export PROCESSOR_ARCHITECTURE=x86 +export PROCESSOR_IDENTIFIER='x86 Family 6 Model 8 Stepping 10, GenuineIntel' +export PROGRAMFILES='C:\Program Files' +export PROMPT='$P$G' +export PWD=/home/Rick +export SESSIONNAME=Console +export SHELL=/usr/bin/bash +export SHLVL=1 +export SYSTEMDRIVE=C: +export SYSTEMROOT='C:\WINDOWS' +export TEMP=/cygdrive/c/DOCUME~1/Rick/LOCALS~1/Temp +export TERM=xterm +export TMP=/cygdrive/c/DOCUME~1/Rick/LOCALS~1/Temp +export USERDOMAIN=RICK-LPATOP +export USERNAME=rick +export USERPROFILE='C:\Documents and Settings\Rick' +export WINDIR='C:\WINDOWS' +export WINDOWID=168050736 +export WXWIN='c:\cygwin\home\Rick\bacula\depkgs-win32\wx' + diff --git a/bacula/src/win32/dird/Makefile b/bacula/src/win32/dird/Makefile new file mode 100644 index 0000000000..5febebc016 --- /dev/null +++ b/bacula/src/win32/dird/Makefile @@ -0,0 +1,117 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# +# Author: Robert Nelson +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Written by Robert Nelson, June 2006 +# + +include ../Makefile.inc + +INCLUDES = \ + -I. \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_OPENSSL) \ + $(INCLUDE_ICONS) + +DEFINES = \ + -DUSING_DLL \ + -DUSING_CATS \ + -DWINVER=0x500 \ + $(HAVES) + +vpath %.c $(MAINDIR)/src/dird $(BUILDDIR)/libwin32 +vpath %.cpp $(MAINDIR)/src/dird $(BUILDDIR)/libwin32 + +########################################################################## + +DIRD_OBJS = \ + $(OBJDIR)/admin.o \ + $(OBJDIR)/authenticate.o \ + $(OBJDIR)/autoprune.o \ + $(OBJDIR)/backup.o \ + $(OBJDIR)/bsr.o \ + $(OBJDIR)/catreq.o \ + $(OBJDIR)/dir_plugins.o \ + $(OBJDIR)/dird.o \ + $(OBJDIR)/dird_conf.o \ + $(OBJDIR)/expand.o \ + $(OBJDIR)/fd_cmds.o \ + $(OBJDIR)/getmsg.o \ + $(OBJDIR)/inc_conf.o \ + $(OBJDIR)/job.o \ + $(OBJDIR)/jobq.o \ + $(OBJDIR)/mountreq.o \ + $(OBJDIR)/msgchan.o \ + $(OBJDIR)/newvol.o \ + $(OBJDIR)/next_vol.o \ + $(OBJDIR)/recycle.o \ + $(OBJDIR)/restore.o \ + $(OBJDIR)/run_conf.o \ + $(OBJDIR)/scheduler.o \ + $(OBJDIR)/ua_acl.o \ + $(OBJDIR)/ua_cmds.o \ + $(OBJDIR)/ua_dotcmds.o \ + $(OBJDIR)/ua_input.o \ + $(OBJDIR)/ua_label.o \ + $(OBJDIR)/ua_output.o \ + $(OBJDIR)/ua_prune.o \ + $(OBJDIR)/ua_purge.o \ + $(OBJDIR)/ua_query.o \ + $(OBJDIR)/ua_restore.o \ + $(OBJDIR)/ua_run.o \ + $(OBJDIR)/ua_select.o \ + $(OBJDIR)/ua_server.o \ + $(OBJDIR)/ua_status.o \ + $(OBJDIR)/ua_tree.o \ + $(OBJDIR)/ua_update.o \ + $(OBJDIR)/ua_dde.o \ + $(OBJDIR)/vbackup.o \ + $(OBJDIR)/verify.o \ + $(OBJDIR)/service.o \ + $(OBJDIR)/mac_sql.o \ + $(OBJDIR)/mac.o \ + $(OBJDIR)/main.o \ + $(OBJDIR)/bacula.res + +ALL_OBJS = $(DIRD_OBJS) + + +DIRD_LIBS = \ + $(LIBS_PTHREADS) \ + $(LIBS_NETWORK) \ + -lole32 \ + -loleaut32 \ + -luuid \ + -lcomctl32 + +###################################################################### + +# Targets + +.PHONY: all clean + +all: $(BINDIR)/bacula-dir.exe + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(ALL_OBJS)) + $(call clean_exe,$(BINDIR)/bacula-dir.exe) + $(ECHO_CMD)rm -rf $(OBJDIRS) + +# +# Rules +# + +$(BINDIR)/bacula-dir.exe: $(DIRD_OBJS) $(LIBS_CATS) $(LIBS_BACULA) + $(call link_winapp,$(DIRD_LIBS)) + +$(OBJDIR)/winres.res: winres.rc + $(WINDRES) $(INCLUDE_ICONS) -O coff $< -o $@ + +include ../Makefile.rules diff --git a/bacula/src/win32/dird/bacula.rc b/bacula/src/win32/dird/bacula.rc new file mode 100644 index 0000000000..92b889cb41 --- /dev/null +++ b/bacula/src/win32/dird/bacula.rc @@ -0,0 +1 @@ +#include "../libwin32/bacula.rc" diff --git a/bacula/src/win32/dird/dird.vcproj b/bacula/src/win32/dird/dird.vcproj new file mode 100644 index 0000000000..4a11e26435 --- /dev/null +++ b/bacula/src/win32/dird/dird.vcproj @@ -0,0 +1,1118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/dird/main.cpp b/bacula/src/win32/dird/main.cpp new file mode 100644 index 0000000000..a39c61bd83 --- /dev/null +++ b/bacula/src/win32/dird/main.cpp @@ -0,0 +1,36 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Kern Sibbald, August 2007 + * + * Version $Id$ + * + */ + +#include "who.h" +#include "../libwin32/main.cpp" diff --git a/bacula/src/win32/dird/service.cpp b/bacula/src/win32/dird/service.cpp new file mode 100644 index 0000000000..e108c65407 --- /dev/null +++ b/bacula/src/win32/dird/service.cpp @@ -0,0 +1,36 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Kern Sibbald, August 2007 + * + * Version $Id$ + * + */ + +#include "who.h" +#include "../libwin32/service.cpp" diff --git a/bacula/src/win32/dird/who.h b/bacula/src/win32/dird/who.h new file mode 100644 index 0000000000..b5da126553 --- /dev/null +++ b/bacula/src/win32/dird/who.h @@ -0,0 +1,44 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Kern Sibbald, August 2007 + * + * Version $Id$ + * + * This file is pulled in by certain generic routines in libwin32 + * to define the names of the daemon that is being built. + */ + +#define APP_NAME "Bacula-dir" +#define LC_APP_NAME "bacula-dir" +#define APP_DESC "Bacula Director Service" + +#define terminate_app(x) terminate_dird(x) +extern void terminate_dird(int sig); + +#define VSSInit() diff --git a/bacula/src/win32/filed/Makefile b/bacula/src/win32/filed/Makefile new file mode 100644 index 0000000000..c83357a52b --- /dev/null +++ b/bacula/src/win32/filed/Makefile @@ -0,0 +1,123 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Author: Robert Nelson +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Written by Robert Nelson, June 2006 +# + +# +# Change the following depending on where this directory is located +# in the Bacula tree. It should point to the src/win32 directory. +BUILDDIR = .. + + +include $(BUILDDIR)/Makefile.inc + +INCLUDES = \ + -I. \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_VSS) \ + $(INCLUDE_OPENSSL) \ + $(INCLUDE_ICONS) + +DEFINES = \ + -DUSING_DLL \ + -DWIN32_VSS \ + -DWINVER=0x500 \ + $(HAVES) + +# -DHAVE_TRAY_MONITOR \ + + +vpath %.c $(MAINDIR)/src/filed $(BUILDDIR)/libwin32 +vpath %.cpp $(MAINDIR)/src/filed $(BUILDDIR)/libwin32 + +########################################################################## + +FILED_OBJS = \ + $(OBJDIR)/accurate.o \ + $(OBJDIR)/authenticate.o \ + $(OBJDIR)/backup.o \ + $(OBJDIR)/crypto.o \ + $(OBJDIR)/win_efs.o \ + $(OBJDIR)/estimate.o \ + $(OBJDIR)/fd_plugins.o \ + $(OBJDIR)/fd_snapshot.o \ + $(OBJDIR)/filed.o \ + $(OBJDIR)/filed_conf.o \ + $(OBJDIR)/heartbeat.o \ + $(OBJDIR)/hello.o \ + $(OBJDIR)/job.o \ + $(OBJDIR)/restore.o \ + $(OBJDIR)/status.o \ + $(OBJDIR)/verify.o \ + $(OBJDIR)/verify_vol.o \ + $(OBJDIR)/vss.o \ + $(OBJDIR)/vss_XP.o \ + $(OBJDIR)/vss_W2K3.o \ + $(OBJDIR)/vss_Vista.o \ + $(OBJDIR)/service.o \ + $(OBJDIR)/main.o \ + $(OBJDIR)/bacl.o \ + $(OBJDIR)/bacl_linux.o \ + $(OBJDIR)/bacl_solaris.o \ + $(OBJDIR)/bxattr_freebsd.o \ + $(OBJDIR)/bxattr_osx.o \ + $(OBJDIR)/bacl_freebsd.o \ + $(OBJDIR)/bacl_osx.o \ + $(OBJDIR)/bxattr.o \ + $(OBJDIR)/bxattr_linux.o \ + $(OBJDIR)/bxattr_solaris.o \ + $(OBJDIR)/bacula.res + +# $(OBJDIR)/trayMonitor.o \ +# $(OBJDIR)/aboutDialog.o \ +# $(OBJDIR)/statusDialog.o \ + + +ALL_OBJS = $(FILED_OBJS) + +FILED_LIBS = \ + $(LIBS_PTHREADS) \ + $(LIBS_ZLIB) \ + $(LIBS_LZO) \ + $(LIBS_NETWORK) \ + -lole32 \ + -loleaut32 \ + -luuid \ + -lcomctl32 + +###################################################################### + +# Targets + +.PHONY: all clean distclean + +all: $(BINDIR)/bacula-fd.exe + +distclean: clean + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(ALL_OBJS)) + $(call clean_exe,$(BINDIR)/bacula-fd.exe) + $(ECHO_CMD)rm -rf $(OBJDIRS) + +# +# Rules +# + +$(BINDIR)/bacula-fd.exe: $(FILED_OBJS) $(LIBS_BACULA) + $(call link_winapp,$(FILED_LIBS)) + +$(OBJDIR)/winres.res: $(BUILDDIR)/libwin32/winres.rc + @echo "Compiling $@" + $(call checkdir,$@) + $(ECHO_CMD)$(WINDRES) $(INCLUDE_ICONS) -DMINGW64 -O coff $< -o $@ + +include $(BUILDDIR)/Makefile.rules diff --git a/bacula/src/win32/filed/bacula-fd.manifest b/bacula/src/win32/filed/bacula-fd.manifest new file mode 100644 index 0000000000..bf1c6746ff --- /dev/null +++ b/bacula/src/win32/filed/bacula-fd.manifest @@ -0,0 +1,21 @@ + + + + Bacula File daemon for Win32 + + + + + + + diff --git a/bacula/src/win32/filed/bacula.rc b/bacula/src/win32/filed/bacula.rc new file mode 100644 index 0000000000..92b889cb41 --- /dev/null +++ b/bacula/src/win32/filed/bacula.rc @@ -0,0 +1 @@ +#include "../libwin32/bacula.rc" diff --git a/bacula/src/win32/filed/baculafd.vcproj b/bacula/src/win32/filed/baculafd.vcproj new file mode 100644 index 0000000000..3a0aecada8 --- /dev/null +++ b/bacula/src/win32/filed/baculafd.vcproj @@ -0,0 +1,610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/filed/main.cpp b/bacula/src/win32/filed/main.cpp new file mode 100644 index 0000000000..a20a657adb --- /dev/null +++ b/bacula/src/win32/filed/main.cpp @@ -0,0 +1,24 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#include "who.h" +#include "../libwin32/main.cpp" diff --git a/bacula/src/win32/filed/plugins/Makefile b/bacula/src/win32/filed/plugins/Makefile new file mode 100644 index 0000000000..f68a0df582 --- /dev/null +++ b/bacula/src/win32/filed/plugins/Makefile @@ -0,0 +1,120 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written by James Harper, October 2008 +# Patterned after a Makefile by Robert Nelson, June 2006 +# + +# +# Change the following depending on where this directory is located +# in the Bacula tree. It should point to the src/win32 directory. +BUILDDIR = ../.. + +include $(BUILDDIR)/Makefile.inc + +INCLUDES = \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_OPENSSL) \ + $(INCLUDE_VSS) \ + -I$(MAINDIR)/src \ + -I$(MAINDIR)/src/filed \ + -I$(MAINDIR)/src/win32/filed + +DEFINES = \ + $(HAVES) + +#vpath %.c $(BUILDDIR)/compat $(MAINDIR)/src/findlib $(MAINDIR)/src/lib +#vpath %.cpp $(BUILDDIR)/compat $(MAINDIR)/src/findlib $(MAINDIR)/src/lib + +###################################################################### + +# Files files in src/win32/filed/plugins + +EXCHANGE_OBJS = \ + $(OBJDIR)/exchange-fd.o \ + $(OBJDIR)/exch_api.o \ + $(OBJDIR)/exch_node.o \ + $(OBJDIR)/exch_root_node.o \ + $(OBJDIR)/exch_service_node.o \ + $(OBJDIR)/exch_storage_group_node.o \ + $(OBJDIR)/exch_store_node.o \ + $(OBJDIR)/exch_dbi_node.o \ + $(OBJDIR)/exch_file_node.o + +BPIPE_OBJS = \ + $(OBJDIR)/bpipe-fd.o + +LIBS_DLL = \ + $(LIBS_SSL) \ + $(LIBS_CRYPTO) \ + $(LIBS_PTHREADS) \ + $(LIBS_ZLIB) \ + $(LIBS_NETWORK) \ + -lole32 \ + -loleaut32 \ + -luuid + +###################################################################### + +# Targets + +.PHONY: all clean distclean + +all: $(BINDIR)/exchange-fd.dll $(BINDIR)/bpipe-fd.dll $(BINDIR)/alldrives-fd.dll + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(EXCHANGE_OBJS)) + $(call clean_exe,$(BINDIR)/exchange-fd.dll) + $(ECHO_CMD)rm -f $(OBJDIR)/exchange-fd.a $(LIBDIR)/libexchange-fd.a + $(ECHO_CMD)rm -rf $(OBJDIRS) + +distclean: clean + +# +# Rules for generating from ../lib +# + +#$(LIBDIR)/libexchange-fd.a: DLL_DEFINE=USING_DLL + +#$(LIBDIR)/libexchange-fd.a: $(BINDIR)/exchange-fd.dll $(STATIC_OBJS) +# @echo "Updating archive $@" +# $(call checkdir,$@) +# $(ECHO_CMD)cp $(OBJDIR)/exchange-fd.a $@ +# $(ECHO_CMD)$(AR) rsv $@ $(filter %.o,$^) + +$(BINDIR)/exchange-fd.dll: DLL_DEFINE=BUILDING_DLL + +$(BINDIR)/exchange-fd.dll: $(EXCHANGE_OBJS) exchange-fd.def + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(LDFLAGS) -mdll -mwindows -Wl,--out-implib,$(OBJDIR)/exchange-fd.a $^ $(LIBS_DLL) -o $@ + +$(BINDIR)/bpipe-fd.dll: DLL_DEFINE=BUILDING_DLL + +$(BINDIR)/bpipe-fd.dll: $(BPIPE_OBJS) bpipe-fd.def $(LIBS_BACULA) + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(CFLAGS) $(LDFLAGS) -mdll -mwindows -Wl,--out-implib,$(OBJDIR)/bpipe-fd.a $^ $(LIBS_DLL) -o $@ + +$(BINDIR)/alldrives-fd.dll: DLL_DEFINE=BUILDING_DLL + +$(BINDIR)/alldrives-fd.dll: $(OBJDIR)/alldrives-fd.o $(LIBS_BACULA) + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(CFLAGS) $(LDFLAGS) -mdll -mwindows -Wl,--out-implib,$(OBJDIR)/alldrives-fd.a $^ $(LIBS_DLL) -o $@ + +include $(BUILDDIR)/Makefile.rules + +$(OBJDIR)/%.o: %.c + @echo "Compiling $<" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) -D$(DLL_DEFINE) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.cpp + @echo "Compiling $<" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) -D$(DLL_DEFINE) $(CFLAGS) -c $< -o $@ diff --git a/bacula/src/win32/filed/plugins/alldrives-fd.c b/bacula/src/win32/filed/plugins/alldrives-fd.c new file mode 100644 index 0000000000..f93e83b30f --- /dev/null +++ b/bacula/src/win32/filed/plugins/alldrives-fd.c @@ -0,0 +1,437 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ + +#ifndef BUILDING_DLL +# define BUILDING_DLL +#endif +#define BUILD_PLUGIN + +#include "bacula.h" +#include "fd_plugins.h" +#include "lib/mem_pool.h" + +/* from lib/scan.c */ +extern int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, + char **argk, char **argv, int max_args); +#define Dmsg(context, level, message, ...) bfuncs->DebugMessage(context, __FILE__, __LINE__, level, message, ##__VA_ARGS__) + +#ifdef __cplusplus +extern "C" { +#endif + +#define PLUGIN_LICENSE "Bacula" +#define PLUGIN_AUTHOR "Eric Bollengier" +#define PLUGIN_DATE "Oct 2013" +#define PLUGIN_VERSION "1.2" +#define PLUGIN_DESCRIPTION "Select all local drives" + +/* Forward referenced functions */ +static bRC newPlugin(bpContext *ctx); +static bRC freePlugin(bpContext *ctx); +static bRC getPluginValue(bpContext *ctx, pVariable var, void *value); +static bRC setPluginValue(bpContext *ctx, pVariable var, void *value); +static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value); +static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp); +static bRC endBackupFile(bpContext *ctx); +static bRC pluginIO(bpContext *ctx, struct io_pkt *io); +static bRC startRestoreFile(bpContext *ctx, const char *cmd); +static bRC endRestoreFile(bpContext *ctx); +static bRC createFile(bpContext *ctx, struct restore_pkt *rp); +static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp); + + +/* Pointers to Bacula functions */ +static bFuncs *bfuncs = NULL; +static bInfo *binfo = NULL; + +static pInfo pluginInfo = { + sizeof(pluginInfo), + FD_PLUGIN_INTERFACE_VERSION, + FD_PLUGIN_MAGIC, + PLUGIN_LICENSE, + PLUGIN_AUTHOR, + PLUGIN_DATE, + PLUGIN_VERSION, + PLUGIN_DESCRIPTION +}; + +static pFuncs pluginFuncs = { + sizeof(pluginFuncs), + FD_PLUGIN_INTERFACE_VERSION, + + /* Entry points into plugin */ + newPlugin, /* new plugin instance */ + freePlugin, /* free plugin instance */ + getPluginValue, + setPluginValue, + handlePluginEvent, + startBackupFile, + endBackupFile, + startRestoreFile, + endRestoreFile, + pluginIO, + createFile, + setFileAttributes, + NULL, /* No checkFiles */ + NULL /* No ACL/XATTR */ +}; + +/* + * Plugin called here when it is first loaded + */ +bRC DLL_IMP_EXP +loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs) +{ + bfuncs = lbfuncs; /* set Bacula funct pointers */ + binfo = lbinfo; + + *pinfo = &pluginInfo; /* return pointer to our info */ + *pfuncs = &pluginFuncs; /* return pointer to our functions */ + + return bRC_OK; +} + +/* + * Plugin called here when it is unloaded, normally when + * Bacula is going to exit. + */ +bRC DLL_IMP_EXP +unloadPlugin() +{ + return bRC_OK; +} + +#define get_self(ctx) ((barg *)ctx->pContext) + +class barg { +public: + POOLMEM *args; + POOLMEM *cmd; + char *argk[MAX_CMD_ARGS]; /* Argument keywords */ + char *argv[MAX_CMD_ARGS]; /* Argument values */ + int argc; + char *exclude; + bool snapshot_only; + + barg() { + args = cmd = NULL; + exclude = NULL; + argc = 0; + snapshot_only = false; + } + + ~barg() { + free_and_null_pool_memory(args); + free_and_null_pool_memory(cmd); + } + + /* + * Given a single keyword, find it in the argument list, but + * it must have a value + * Returns: -1 if not found or no value + * list index (base 0) on success + */ + int find_arg_with_value(const char *keyword) + { + for (int i=0; iexclude with simple string "ABCD" + */ + void parse(char *command) { + char *p; + char *q; + if ((p = strchr(command, ':')) == NULL) { + Dmsg(NULL, 10, "No options\n"); + return; + } + + args = get_pool_memory(PM_FNAME); + cmd = get_pool_memory(PM_FNAME); + + pm_strcpy(cmd, ++p); /* copy string after : */ + parse_args(cmd, &args, &argc, argk, argv, MAX_CMD_ARGS); + + for (int i=0; i < argc ; i++) { + if (strcmp(argk[i], "exclude") == 0) { + /* a,B,C d => ABCD */ + q = p = exclude = argv[i]; + for (; *p ; p++) { + if ((*p >= 'A' && *p <= 'Z') || (*p >= 'a' && *p <= 'z')) { + *q = toupper(*p); + q++; + } + } + *q = 0; + Dmsg(NULL, 50, "%s => %s\n", command, exclude); + + } else if (strcmp(argk[i], "snapshot") == 0) { + Dmsg(NULL, 50, "Doing only snapshot\n"); + snapshot_only = true; + + } else { + Dmsg(NULL, 10, "Unknown keyword %s\n", argk[i]); + } + } + } +}; + +/* + * Called here to make a new instance of the plugin -- i.e. when + * a new Job is started. There can be multiple instances of + * each plugin that are running at the same time. Your + * plugin instance must be thread safe and keep its own + * local data. + */ +static bRC newPlugin(bpContext *ctx) +{ + barg *self = new barg(); + ctx->pContext = (void *)self; /* set our context pointer */ + return bRC_OK; +} + +/* + * Release everything concerning a particular instance of a + * plugin. Normally called when the Job terminates. + */ +static bRC freePlugin(bpContext *ctx) +{ + barg *self = get_self(ctx); + if (self) { + delete self; + } + return bRC_OK; +} + +/* + * Called by core code to get a variable from the plugin. + * Not currently used. + */ +static bRC getPluginValue(bpContext *ctx, pVariable var, void *value) +{ +// printf("plugin: getPluginValue var=%d\n", var); + return bRC_OK; +} + +/* + * Called by core code to set a plugin variable. + * Not currently used. + */ +static bRC setPluginValue(bpContext *ctx, pVariable var, void *value) +{ +// printf("plugin: setPluginValue var=%d\n", var); + return bRC_OK; +} + +/* TODO: use findlib/drivetype instead */ +static bool drivetype(const char *fname, char *dt, int dtlen) +{ + CHAR rootpath[4]; + UINT type; + + /* Copy Drive Letter, colon, and backslash to rootpath */ + bstrncpy(rootpath, fname, 3); + rootpath[3] = '\0'; + + type = GetDriveType(rootpath); + + switch (type) { + case DRIVE_REMOVABLE: bstrncpy(dt, "removable", dtlen); return true; + case DRIVE_FIXED: bstrncpy(dt, "fixed", dtlen); return true; + case DRIVE_REMOTE: bstrncpy(dt, "remote", dtlen); return true; + case DRIVE_CDROM: bstrncpy(dt, "cdrom", dtlen); return true; + case DRIVE_RAMDISK: bstrncpy(dt, "ramdisk", dtlen); return true; + case DRIVE_UNKNOWN: + case DRIVE_NO_ROOT_DIR: + default: + return false; + } +} + +static void add_drives(bpContext *ctx, char *cmd) +{ + char buf[32]; + char dt[100]; + char drive; + barg *arg = get_self(ctx); + arg->parse(cmd); + + if (arg->snapshot_only) { + return; + } + + for (drive = 'A'; drive <= 'Z'; drive++) { + if (arg->exclude && strchr(arg->exclude, drive)) { + Dmsg(ctx, 10, "%c is in exclude list\n", drive); + continue; + } + snprintf(buf, sizeof(buf), "%c:/", drive); + if (drivetype(buf, dt, sizeof(dt))) { + if (strcmp(dt, "fixed") == 0) { + Dmsg(ctx, 10, "Adding %c to include list\n", drive); + bfuncs->AddInclude(ctx, buf); + snprintf(buf, sizeof(buf), "%c:/pagefile.sys", drive); + bfuncs->AddExclude(ctx, buf); + snprintf(buf, sizeof(buf), "%c:/System Volume Information", drive); + bfuncs->AddExclude(ctx, buf); + } else { + Dmsg(ctx, 10, "Discarding %c from include list\n", drive); + } + } + } +} + +static void add_snapshot(bpContext *ctx, char *ret) +{ + char buf[32]; + char dt[100]; + char drive; + char *p = ret; + barg *arg = get_self(ctx); + + /* Start from blank */ + *p = 0; + + if (!arg->snapshot_only) { + return; + } + + for (drive = 'A'; drive <= 'Z'; drive++) { + if (arg->exclude && strchr(arg->exclude, drive)) { + Dmsg(ctx, 10, "%c is in exclude list\n", drive); + continue; + } + + snprintf(buf, sizeof(buf), "%c:/", drive); + + if (drivetype(buf, dt, sizeof(dt))) { + if (strcmp(dt, "fixed") == 0) { + Dmsg(ctx, 10, "Adding %c to snapshot list\n", drive); + *p++ = drive; + } else { + Dmsg(ctx, 10, "Discarding %c from snapshot list\n", drive); + } + } + } + *p = 0; + Dmsg(ctx, 10, "ret = %s\n", ret); +} + +/* + * Called by Bacula when there are certain events that the + * plugin might want to know. The value depends on the + * event. + */ +static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value) +{ + barg arguments; + + switch (event->eventType) { + case bEventPluginCommand: + add_drives(ctx, (char *)value); /* command line */ + break; + + case bEventVssPrepareSnapshot: + add_snapshot(ctx, (char *)value); /* snapshot list */ + break; + default: + break; + } + + return bRC_OK; +} + +/* + * Called when starting to backup a file. Here the plugin must + * return the "stat" packet for the directory/file and provide + * certain information so that Bacula knows what the file is. + * The plugin can create "Virtual" files by giving them a + * name that is not normally found on the file system. + */ +static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp) +{ + return bRC_Stop; +} + +/* + * Done backing up a file. + */ +static bRC endBackupFile(bpContext *ctx) +{ + return bRC_Stop; +} + +/* + * Do actual I/O. Bacula calls this after startBackupFile + * or after startRestoreFile to do the actual file + * input or output. + */ +static bRC pluginIO(bpContext *ctx, struct io_pkt *io) +{ + io->status = 0; + io->io_errno = 0; + return bRC_Error; +} + +static bRC startRestoreFile(bpContext *ctx, const char *cmd) +{ + return bRC_Error; +} + +static bRC endRestoreFile(bpContext *ctx) +{ + return bRC_Error; +} + +/* + * Called here to give the plugin the information needed to + * re-create the file on a restore. It basically gets the + * stat packet that was created during the backup phase. + * This data is what is needed to create the file, but does + * not contain actual file data. + */ +static bRC createFile(bpContext *ctx, struct restore_pkt *rp) +{ + return bRC_Error; +} + +/* + * Called after the file has been restored. This can be used to + * set directory permissions, ... + */ +static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp) +{ + return bRC_Error; +} + + +#ifdef __cplusplus +} +#endif diff --git a/bacula/src/win32/filed/plugins/alldrives-fd.def b/bacula/src/win32/filed/plugins/alldrives-fd.def new file mode 100644 index 0000000000..05cb96be05 --- /dev/null +++ b/bacula/src/win32/filed/plugins/alldrives-fd.def @@ -0,0 +1,13 @@ +LIBRARY bacula.dll +EXPORTS + +;drivetype.o +_Z9drivetypePKcPci + +;console_command DATA +;b_plugin_list DATA +;plugin_bopen DATA +;plugin_bclose DATA +;plugin_bwrite DATA +;plugin_bread DATA +;plugin_blseek DATA diff --git a/bacula/src/win32/filed/plugins/api.c b/bacula/src/win32/filed/plugins/api.c new file mode 100644 index 0000000000..1e65e5a520 --- /dev/null +++ b/bacula/src/win32/filed/plugins/api.c @@ -0,0 +1,146 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#include "exchange-fd.h" + +HrESEBackupRestoreGetNodes_t HrESEBackupRestoreGetNodes; +HrESEBackupPrepare_t HrESEBackupPrepare; +HrESEBackupGetLogAndPatchFiles_t HrESEBackupGetLogAndPatchFiles; +HrESEBackupTruncateLogs_t HrESEBackupTruncateLogs; +HrESEBackupEnd_t HrESEBackupEnd; +HrESEBackupSetup_t HrESEBackupSetup; +HrESEBackupInstanceEnd_t HrESEBackupInstanceEnd; +HrESEBackupOpenFile_t HrESEBackupOpenFile; +HrESEBackupReadFile_t HrESEBackupReadFile; +HrESEBackupCloseFile_t HrESEBackupCloseFile; + +HrESERestoreOpen_t HrESERestoreOpen; +HrESERestoreReopen_t HrESERestoreReopen; +HrESERestoreComplete_t HrESERestoreComplete; +HrESERestoreClose_t HrESERestoreClose; +HrESERestoreGetEnvironment_t HrESERestoreGetEnvironment; +HrESERestoreSaveEnvironment_t HrESERestoreSaveEnvironment; +HrESERestoreAddDatabase_t HrESERestoreAddDatabase; +HrESERestoreOpenFile_t HrESERestoreOpenFile; + +bRC +loadExchangeApi() +{ + HMODULE h; + LONG status; + HKEY key_handle; + WCHAR *buf; + DWORD buf_len; + DWORD type; + + status = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\BackupRestore\\DLLPaths", &key_handle); + if (status != ERROR_SUCCESS) + { + _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status); + return bRC_Error; + } + + type = REG_EXPAND_SZ; + status = RegQueryValueExW(key_handle, L"esebcli2", NULL, &type, NULL, &buf_len); + if (status != ERROR_SUCCESS) + { + _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status); + return bRC_Error; + } + buf_len += 2; + buf = new WCHAR[buf_len]; + + type = REG_EXPAND_SZ; + status = RegQueryValueExW(key_handle, L"esebcli2", NULL, &type, (LPBYTE)buf, &buf_len); + if (status != ERROR_SUCCESS) + { + _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status); + delete buf; + return bRC_Error; + } + +printf("Got value %S\n", buf); + + // strictly speaking, a REG_EXPAND_SZ should be run through ExpandEnvironmentStrings + + h = LoadLibraryW(buf); + delete buf; + if (!h) { + _JobMessageNull(M_FATAL, "Cannot load Exchange DLL\n"); + return bRC_Error; + } + HrESEBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes_t)GetProcAddress(h, "HrESEBackupRestoreGetNodes"); + HrESEBackupPrepare = (HrESEBackupPrepare_t)GetProcAddress(h, "HrESEBackupPrepare"); + HrESEBackupEnd = (HrESEBackupEnd_t)GetProcAddress(h, "HrESEBackupEnd"); + HrESEBackupSetup = (HrESEBackupSetup_t)GetProcAddress(h, "HrESEBackupSetup"); + HrESEBackupGetLogAndPatchFiles = (HrESEBackupGetLogAndPatchFiles_t)GetProcAddress(h, "HrESEBackupGetLogAndPatchFiles"); + HrESEBackupTruncateLogs = (HrESEBackupTruncateLogs_t)GetProcAddress(h, "HrESEBackupTruncateLogs"); + HrESEBackupInstanceEnd = (HrESEBackupInstanceEnd_t)GetProcAddress(h, "HrESEBackupInstanceEnd"); + HrESEBackupOpenFile = (HrESEBackupOpenFile_t)GetProcAddress(h, "HrESEBackupOpenFile"); + HrESEBackupReadFile = (HrESEBackupReadFile_t)GetProcAddress(h, "HrESEBackupReadFile"); + HrESEBackupCloseFile = (HrESEBackupCloseFile_t)GetProcAddress(h, "HrESEBackupCloseFile"); + HrESERestoreOpen = (HrESERestoreOpen_t)GetProcAddress(h, "HrESERestoreOpen"); + HrESERestoreReopen = (HrESERestoreReopen_t)GetProcAddress(h, "HrESERestoreReopen"); + HrESERestoreComplete = (HrESERestoreComplete_t)GetProcAddress(h, "HrESERestoreComplete"); + HrESERestoreClose = (HrESERestoreClose_t)GetProcAddress(h, "HrESERestoreClose"); + HrESERestoreSaveEnvironment = (HrESERestoreSaveEnvironment_t)GetProcAddress(h, "HrESERestoreSaveEnvironment"); + HrESERestoreGetEnvironment = (HrESERestoreGetEnvironment_t)GetProcAddress(h, "HrESERestoreGetEnvironment"); + HrESERestoreAddDatabase = (HrESERestoreAddDatabase_t)GetProcAddress(h, "HrESERestoreAddDatabase"); + HrESERestoreOpenFile = (HrESERestoreOpenFile_t)GetProcAddress(h, "HrESERestoreOpenFile"); + return bRC_OK; +} + +const char * +ESEErrorMessage(HRESULT result) +{ + switch (result) { + case 0: + return "No error."; + case hrLogfileHasBadSignature: + return "Log file has bad signature. Check that no stale files are left in the Exchange data/log directories."; + case hrCBDatabaseInUse: + return "Database in use. Make sure database is dismounted."; + case hrRestoreAtFileLevel: + return "File must be restored using Windows file I/O calls."; + case hrMissingFullBackup: + return "Exchange reports that no previous full backup has been done."; + case hrBackupInProgress: + return "Exchange backup already in progress."; + case hrLogfileNotContiguous: + return "Existing log file is not contiguous. Check that no stale files are left in the Exchange data/log directories."; + case hrErrorFromESECall: + return "Error returned from ESE function call. Check the Windows Event Logs for more information."; + case hrCBDatabaseNotFound: + return "Database not found. Check that the Database you are trying to restore actually exists in the Storage Group you are restoring to."; + default: + return "Unknown error."; + } +} diff --git a/bacula/src/win32/filed/plugins/api.h b/bacula/src/win32/filed/plugins/api.h new file mode 100644 index 0000000000..08a01ba0be --- /dev/null +++ b/bacula/src/win32/filed/plugins/api.h @@ -0,0 +1,302 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2009 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +extern "C" { + +#define BACKUP_NODE_TYPE_MACHINE 0x001 +#define BACKUP_NODE_TYPE_ANNOTATION 0x010 +#define BACKUP_NODE_TYPE_DISPLAY 0x100 + +#define ESE_BACKUP_INSTANCE_END_ERROR 0x0 +#define ESE_BACKUP_INSTANCE_END_SUCCESS 0x1 + +#define BACKUP_TYPE_FULL 0x1 +#define BACKUP_TYPE_LOGS_ONLY 0x2 +#define BACKUP_TYPE_FULL_WITH_ALL_LOGS 0x3 + +#define RESTORE_CLOSE_ABORT 0x1 +#define RESTORE_CLOSE_NORMAL 0x0 + +#define ESE_RESTORE_COMPLETE_NOWAIT 0x00010000 +#define ESE_RESTORE_COMPLETE_ATTACH_DBS 0x00000001 +#define ESE_RESTORE_KEEP_LOG_FILES 0x00020000 + +//#include + +struct ESE_ICON_DESCRIPTION { + uint32_t ulSize; + char *pvData; +}; + +struct BACKUP_NODE_TREE { + WCHAR *wszName; + uint32_t fFlags; + ESE_ICON_DESCRIPTION iconDescription; + struct BACKUP_NODE_TREE *pNextNode; + struct BACKUP_NODE_TREE *pChildNode; +}; + +struct DATABASE_BACKUP_INFO { + WCHAR *wszDatabaseDisplayName; + uint32_t cwDatabaseStreams; + WCHAR *wszDatabaseStreams; + GUID rguidDatabase; + uint32_t *rgIconIndexDatabase; + uint32_t fDatabaseFlags; +}; + +struct INSTANCE_BACKUP_INFO { + uint64_t hInstanceId; + //RPC_STRING wszInstanceName; + WCHAR *wszInstanceName; + uint32_t ulIconIndexInstance; + uint32_t cDatabase; + DATABASE_BACKUP_INFO *rgDatabase; + uint32_t cIconDescription; + ESE_ICON_DESCRIPTION *rgIconDescription; +}; + +enum RECOVER_STATUS { + recoverInvalid = 0, + recoverNotStarted = 1, + recoverStarted = 2, + recoverEnded = 3, + recoverStatusMax +}; + +struct RESTORE_ENVIRONMENT { + WCHAR * m_wszRestoreLogPath; + WCHAR * m_wszSrcInstanceName; + uint32_t m_cDatabases; + WCHAR **m_wszDatabaseDisplayName; + GUID * m_rguidDatabase; + WCHAR * m_wszRestoreInstanceSystemPath; + WCHAR * m_wszRestoreInstanceLogPath; + WCHAR * m_wszTargetInstanceName; + WCHAR ** m_wszDatabaseStreamsS; + WCHAR ** m_wszDatabaseStreamsD; + uint32_t m_ulGenLow; + uint32_t m_ulGenHigh; + WCHAR * m_wszLogBaseName; + time_t m_timeLastRestore; + RECOVER_STATUS m_statusLastRecover; + HRESULT m_hrLastRecover; + time_t m_timeLastRecover; + WCHAR * m_wszAnnotation; +}; + +typedef HANDLE HCCX; + +typedef HRESULT (WINAPI *HrESEBackupRestoreGetNodes_t) +( + WCHAR* wszComputerName, + BACKUP_NODE_TREE* pBackupNodeTree +); + +typedef HRESULT (WINAPI *HrESEBackupPrepare_t) +( + WCHAR* wszBackupServer, + WCHAR* wszBackupAnnotation, + uint32_t *pcInstanceInfo, + INSTANCE_BACKUP_INFO **paInstanceInfo, + HCCX *phccxBackupContext +); + +typedef HRESULT (WINAPI *HrESEBackupEnd_t) +( + HCCX hccsBackupContext +); + +typedef HRESULT (WINAPI *HrESEBackupSetup_t) +( + HCCX hccsBackupContext, + uint64_t hInstanceID, + uint32_t btBackupType +); + +typedef HRESULT (WINAPI *HrESEBackupGetLogAndPatchFiles_t) +( + HCCX hccsBackupContext, + WCHAR** pwszFiles +); + +typedef HRESULT (WINAPI *HrESEBackupInstanceEnd_t) +( + HCCX hccsBackupContext, + uint32_t fFlags +); + +typedef HRESULT (WINAPI *HrESEBackupOpenFile_t) +( + HCCX hccsBackupContext, + WCHAR* wszFileName, + uint32_t cbReadHintSize, + uint32_t cSections, + void** rghFile, + uint64_t* rgliSectionSize +); + +typedef HRESULT (WINAPI *HrESEBackupReadFile_t) +( + HCCX hccsBackupContext, + void* hFile, + void* pvBuffer, + uint32_t cbBuffer, + uint32_t* pcbRead +); + +typedef HRESULT (WINAPI *HrESEBackupCloseFile_t) +( + HCCX hccsBackupContext, + void* hFile +); + +typedef HRESULT (WINAPI *HrESEBackupTruncateLogs_t) +( + HCCX hccsBackupContext +); + +typedef HRESULT (WINAPI *HrESERestoreOpen_t) +( + WCHAR* wszBackupServer, + WCHAR* wszBackupAnnotation, + WCHAR* wszSrcInstanceName, + WCHAR* wszRestoreLogPath, + HCCX* phccxRestoreContext +); + +typedef HRESULT (WINAPI *HrESERestoreReopen_t) +( + WCHAR* wszBackupServer, + WCHAR* wszBackupAnnotation, + WCHAR* wszRestoreLogPath, + HCCX* phccxRestoreContext +); + +typedef HRESULT (WINAPI *HrESERestoreClose_t) +( + HCCX phccxRestoreContext, + uint32_t fRestoreAbort +); + +typedef HRESULT (WINAPI *HrESERestoreComplete_t) +( + HCCX phccxRestoreContext, + WCHAR* wszCheckpointFilePath, + WCHAR* wszLogFilePath, + WCHAR* wszTargetInstanceName, + uint32_t fFlags +); + +typedef HRESULT (WINAPI *HrESERestoreSaveEnvironment_t) +( + HCCX phccxRestoreContext +); + +typedef HRESULT (WINAPI *HrESERestoreGetEnvironment_t) +( + HCCX phccxRestoreContext, + RESTORE_ENVIRONMENT **ppRestoreEnvironment +); + +typedef HRESULT (WINAPI *HrESERestoreAddDatabase_t) +( + HCCX phccxRestoreContext, + WCHAR* wszDatabaseDisplayName, + GUID guidDatabase, + WCHAR* wszDatabaseStreamsS, + WCHAR** wszDatabaseStreamsD +); + +typedef HRESULT (WINAPI *HrESERestoreOpenFile_t) +( + HCCX phccxRestoreContext, + WCHAR* wszFileName, + uint32_t cSections, + void* rghFile +); + +bRC +loadExchangeApi(); + +const char * +ESEErrorMessage(HRESULT result); + +#define hrLogfileHasBadSignature (HRESULT)0xC8000262L +#define hrLogfileNotContiguous (HRESULT)0xC8000263L +#define hrCBDatabaseInUse (HRESULT)0xC7FE1F41L +#define hrRestoreAtFileLevel (HRESULT)0xC7FF0FA5L +#define hrMissingFullBackup (HRESULT)0xC8000230L +#define hrBackupInProgress (HRESULT)0xC80001F9L +#define hrCBDatabaseNotFound (HRESULT)0xC7FE1F42L +#define hrErrorFromESECall (HRESULT)0xC7FF1004L + +extern HrESEBackupRestoreGetNodes_t HrESEBackupRestoreGetNodes; +extern HrESEBackupPrepare_t HrESEBackupPrepare; +extern HrESEBackupGetLogAndPatchFiles_t HrESEBackupGetLogAndPatchFiles; +extern HrESEBackupTruncateLogs_t HrESEBackupTruncateLogs; +extern HrESEBackupEnd_t HrESEBackupEnd; +extern HrESEBackupSetup_t HrESEBackupSetup; +extern HrESEBackupInstanceEnd_t HrESEBackupInstanceEnd; +extern HrESEBackupOpenFile_t HrESEBackupOpenFile; +extern HrESEBackupReadFile_t HrESEBackupReadFile; +extern HrESEBackupCloseFile_t HrESEBackupCloseFile; + +extern HrESERestoreOpen_t HrESERestoreOpen; +extern HrESERestoreReopen_t HrESERestoreReopen; +extern HrESERestoreComplete_t HrESERestoreComplete; +extern HrESERestoreClose_t HrESERestoreClose; +extern HrESERestoreGetEnvironment_t HrESERestoreGetEnvironment; +extern HrESERestoreSaveEnvironment_t HrESERestoreSaveEnvironment; +extern HrESERestoreAddDatabase_t HrESERestoreAddDatabase; +extern HrESERestoreOpenFile_t HrESERestoreOpenFile; + +#if !defined(MINGW64) && (_WIN32_WINNT < 0x0500) +typedef enum _COMPUTER_NAME_FORMAT { + ComputerNameNetBIOS, + ComputerNameDnsHostname, + ComputerNameDnsDomain, + ComputerNameDnsFullyQualified, + ComputerNamePhysicalNetBIOS, + ComputerNamePhysicalDnsHostname, + ComputerNamePhysicalDnsDomain, + ComputerNamePhysicalDnsFullyQualified, + ComputerNameMax +} COMPUTER_NAME_FORMAT; + +BOOL WINAPI GetComputerNameExW( + COMPUTER_NAME_FORMAT NameType, + LPWSTR lpBuffer, + LPDWORD lpnSize +); +#endif + +} diff --git a/bacula/src/win32/filed/plugins/bpipe-fd.c b/bacula/src/win32/filed/plugins/bpipe-fd.c new file mode 100644 index 0000000000..7b7e660217 --- /dev/null +++ b/bacula/src/win32/filed/plugins/bpipe-fd.c @@ -0,0 +1,557 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * A simple pipe plugin for the Bacula File Daemon + * + * Kern Sibbald, October 2007 + * Copied into Windows plugin environment March, 2010 (KES) + * + */ +#include "bacula.h" +#include "fd_plugins.h" + +#undef malloc +#undef free +#undef strdup + +#define fi __FILE__ +#define li __LINE__ + +#ifdef __cplusplus +extern "C" { +#endif + +static const int dbglvl = 150; + +#define PLUGIN_LICENSE "Bacula" +#define PLUGIN_AUTHOR "Kern Sibbald" +#define PLUGIN_DATE "January 2010" +#define PLUGIN_VERSION "1" +#define PLUGIN_DESCRIPTION "Bacula Pipe Windows File Daemon Plugin" + +/* Forward referenced functions */ +static bRC newPlugin(bpContext *ctx); +static bRC freePlugin(bpContext *ctx); +static bRC getPluginValue(bpContext *ctx, pVariable var, void *value); +static bRC setPluginValue(bpContext *ctx, pVariable var, void *value); +static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value); +static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp); +static bRC endBackupFile(bpContext *ctx); +static bRC pluginIO(bpContext *ctx, struct io_pkt *io); +static bRC startRestoreFile(bpContext *ctx, const char *cmd); +static bRC endRestoreFile(bpContext *ctx); +static bRC createFile(bpContext *ctx, struct restore_pkt *rp); +static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp); + +static char *apply_rp_codes(struct plugin_ctx * p_ctx); + +/* Pointers to Bacula functions */ +static bFuncs *bfuncs = NULL; +static bInfo *binfo = NULL; + +/* Plugin Information block */ +static pInfo pluginInfo = { + sizeof(pluginInfo), + FD_PLUGIN_INTERFACE_VERSION, + FD_PLUGIN_MAGIC, + PLUGIN_LICENSE, + PLUGIN_AUTHOR, + PLUGIN_DATE, + PLUGIN_VERSION, + PLUGIN_DESCRIPTION +}; + +/* Plugin entry points for Bacula */ +static pFuncs pluginFuncs = { + sizeof(pluginFuncs), + FD_PLUGIN_INTERFACE_VERSION, + + /* Entry points into plugin */ + newPlugin, /* new plugin instance */ + freePlugin, /* free plugin instance */ + getPluginValue, + setPluginValue, + handlePluginEvent, + startBackupFile, + endBackupFile, + startRestoreFile, + endRestoreFile, + pluginIO, + createFile, + setFileAttributes, + NULL, /* No checkFile */ + NULL /* No ACL/XATTR */ +}; + +/* + * Plugin private context + */ +struct plugin_ctx { + boffset_t offset; + FILE *fd; /* pipe file descriptor */ + bool backup; /* set for backup (not needed) */ + char *cmd; /* plugin command line */ + char *fname; /* filename to "backup/restore" */ + char *reader; /* reader program for backup */ + char *writer; /* writer program for backup */ + + char where[512]; + int replace; +}; + +/* + * loadPlugin() and unloadPlugin() are entry points that are + * exported, so Bacula can directly call these two entry points + * they are common to all Bacula plugins. + */ +/* + * External entry point called by Bacula to "load the plugin + */ +bRC loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs) +{ + bfuncs = lbfuncs; /* set Bacula funct pointers */ + binfo = lbinfo; + *pinfo = &pluginInfo; /* return pointer to our info */ + *pfuncs = &pluginFuncs; /* return pointer to our functions */ + + return bRC_OK; +} + +/* + * External entry point to unload the plugin + */ +bRC unloadPlugin() +{ +// printf("bpipe-fd: Unloaded\n"); + return bRC_OK; +} + +/* + * The following entry points are accessed through the function + * pointers we supplied to Bacula. Each plugin type (dir, fd, sd) + * has its own set of entry points that the plugin must define. + */ +/* + * Create a new instance of the plugin i.e. allocate our private storage + */ +static bRC newPlugin(bpContext *ctx) +{ + struct plugin_ctx *p_ctx = (struct plugin_ctx *)malloc(sizeof(struct plugin_ctx)); + if (!p_ctx) { + return bRC_Error; + } + memset(p_ctx, 0, sizeof(struct plugin_ctx)); + ctx->pContext = (void *)p_ctx; /* set our context pointer */ + return bRC_OK; +} + +/* + * Free a plugin instance, i.e. release our private storage + */ +static bRC freePlugin(bpContext *ctx) +{ + struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext; + if (!p_ctx) { + return bRC_Error; + } + if (p_ctx->cmd) { + free(p_ctx->cmd); /* free any allocated command string */ + } + free(p_ctx); /* free our private context */ + p_ctx = NULL; + return bRC_OK; +} + +/* + * Return some plugin value (none defined) + */ +static bRC getPluginValue(bpContext *ctx, pVariable var, void *value) +{ + return bRC_OK; +} + +/* + * Set a plugin value (none defined) + */ +static bRC setPluginValue(bpContext *ctx, pVariable var, void *value) +{ + return bRC_OK; +} + +/* + * Handle an event that was generated in Bacula + */ +static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value) +{ + struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext; + if (!p_ctx) { + return bRC_Error; + } + +// char *name; + + /* + * Most events don't interest us so we ignore them. + * the printfs are so that plugin writers can enable them to see + * what is really going on. + */ + switch (event->eventType) { + case bEventJobStart: + bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: JobStart=%s\n", (char *)value); + break; + case bEventJobEnd: +// printf("bpipe-fd: JobEnd\n"); + break; + case bEventStartBackupJob: +// printf("bpipe-fd: StartBackupJob\n"); + break; + case bEventEndBackupJob: +// printf("bpipe-fd: EndBackupJob\n"); + break; + case bEventLevel: +// printf("bpipe-fd: JobLevel=%c %d\n", (int)value, (int)value); + break; + case bEventSince: +// printf("bpipe-fd: since=%d\n", (int)value); + break; + + case bEventStartRestoreJob: +// printf("bpipe-fd: StartRestoreJob\n"); + break; + + case bEventEndRestoreJob: +// printf("bpipe-fd: EndRestoreJob\n"); + break; + + /* Plugin command e.g. plugin = ::read command:write command */ + case bEventRestoreCommand: +// printf("bpipe-fd: EventRestoreCommand cmd=%s\n", (char *)value); + /* Fall-through wanted */ + case bEventBackupCommand: + char *p; + bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: pluginEvent cmd=%s\n", (char *)value); + p_ctx->cmd = strdup((char *)value); + p = strchr(p_ctx->cmd, ':'); + if (!p) { + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "Plugin terminator not found: %s\n", (char *)value); + return bRC_Error; + } + *p++ = 0; /* terminate plugin */ + p_ctx->fname = p; + p = strchr(p, ':'); + if (!p) { + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "File terminator not found: %s\n", (char *)value); + return bRC_Error; + } + *p++ = 0; /* terminate file */ + p_ctx->reader = p; + p = strchr(p, ':'); + if (!p) { + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "Reader terminator not found: %s\n", (char *)value); + return bRC_Error; + } + *p++ = 0; /* terminate reader string */ + p_ctx->writer = p; +// printf("bpipe-fd: plugin=%s fname=%s reader=%s writer=%s\n", +// p_ctx->cmd, p_ctx->fname, p_ctx->reader, p_ctx->writer); + break; + + /* Ignore all unknown event types */ + default: + break; + } + return bRC_OK; +} + +/* + * Start the backup of a specific file + */ +static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp) +{ + struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext; + if (!p_ctx) { + return bRC_Error; + } + time_t now = time(NULL); + sp->fname = p_ctx->fname; + sp->type = FT_REG; + sp->statp.st_mode = 0700 | S_IFREG; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + sp->statp.st_blksize = 4096; + sp->statp.st_blocks = 1; + p_ctx->backup = true; +// printf("bpipe-fd: startBackupFile\n"); + return bRC_OK; +} + +/* + * Done with backup of this file + */ +static bRC endBackupFile(bpContext *ctx) +{ + /* + * We would return bRC_More if we wanted startBackupFile to be + * called again to backup another file + */ + return bRC_OK; +} + + +/* + * Bacula is calling us to do the actual I/O + */ +static bRC pluginIO(bpContext *ctx, struct io_pkt *io) +{ + struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext; + if (!p_ctx) { + return bRC_Error; + } + + io->status = 0; + io->io_errno = 0; + switch(io->func) { + case IO_OPEN: + bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_OPEN\n"); + if (io->flags & (O_CREAT | O_WRONLY)) { + char *writer_codes = apply_rp_codes(p_ctx); + + p_ctx->fd = popen(writer_codes, "w"); + bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_OPEN fd=%d writer=%s\n", + p_ctx->fd, writer_codes); + if (!p_ctx->fd) { + io->io_errno = errno; + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, + "Open pipe writer=%s failed: ERR=%s\n", writer_codes, strerror(errno)); + if (writer_codes) { + free(writer_codes); + } + return bRC_Error; + } + if (writer_codes) { + free(writer_codes); + } + } else { + p_ctx->fd = popen(p_ctx->reader, "r"); + bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_OPEN fd=%p reader=%s\n", + p_ctx->fd, p_ctx->reader); + if (!p_ctx->fd) { + io->io_errno = errno; + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, + "Open pipe reader=%s failed: ERR=%s\n", p_ctx->reader, strerror(errno)); + return bRC_Error; + } + } + bmicrosleep(1,0); /* let pipe connect */ + break; + + case IO_READ: + if (!p_ctx->fd) { + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "Logic error: NULL read FD\n"); + return bRC_Error; + } + io->status = fread(io->buf, 1, io->count, p_ctx->fd); +// bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_READ buf=%p len=%d\n", io->buf, io->status); + if (io->status == 0 && ferror(p_ctx->fd)) { + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, + "Pipe read error: ERR=%s\n", strerror(errno)); + bfuncs->DebugMessage(ctx, fi, li, dbglvl, + "Pipe read error: ERR=%s\n", strerror(errno)); + return bRC_Error; + } + break; + + case IO_WRITE: + if (!p_ctx->fd) { + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "Logic error: NULL write FD\n"); + return bRC_Error; + } +// printf("bpipe-fd: IO_WRITE fd=%p buf=%p len=%d\n", p_ctx->fd, io->buf, io->count); + io->status = fwrite(io->buf, 1, io->count, p_ctx->fd); +// printf("bpipe-fd: IO_WRITE buf=%p len=%d\n", io->buf, io->status); + if (io->status == 0 && ferror(p_ctx->fd)) { + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, + "Pipe write error\n"); + bfuncs->DebugMessage(ctx, fi, li, dbglvl, + "Pipe read error: ERR=%s\n", strerror(errno)); + return bRC_Error; + } + break; + + case IO_CLOSE: + if (!p_ctx->fd) { + bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "Logic error: NULL FD on bpipe close\n"); + return bRC_Error; + } + io->status = pclose(p_ctx->fd); + break; + + case IO_SEEK: + io->offset = p_ctx->offset; + break; + } + return bRC_OK; +} + +/* + * Bacula is notifying us that a plugin name string was found, and + * passing us the plugin command, so we can prepare for a restore. + */ +static bRC startRestoreFile(bpContext *ctx, const char *cmd) +{ +// printf("bpipe-fd: startRestoreFile cmd=%s\n", cmd); + return bRC_OK; +} + +/* + * Bacula is notifying us that the plugin data has terminated, so + * the restore for this particular file is done. + */ +static bRC endRestoreFile(bpContext *ctx) +{ +// printf("bpipe-fd: endRestoreFile\n"); + return bRC_OK; +} + +/* + * This is called during restore to create the file (if necessary) + * We must return in rp->create_status: + * + * CF_ERROR -- error + * CF_SKIP -- skip processing this file + * CF_EXTRACT -- extract the file (i.e.call i/o routines) + * CF_CREATED -- created, but no content to extract (typically directories) + * + */ +static bRC createFile(bpContext *ctx, struct restore_pkt *rp) +{ +// printf("bpipe-fd: createFile\n"); + if (strlen(rp->where) > 512) { + printf("Restore target dir too long. Restricting to first 512 bytes.\n"); + } + strncpy(((struct plugin_ctx *)ctx->pContext)->where, rp->where, 513); + ((struct plugin_ctx *)ctx->pContext)->replace = rp->replace; + rp->create_status = CF_EXTRACT; + return bRC_OK; +} + +/* + * We will get here if the File is a directory after everything + * is written in the directory. + */ +static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp) +{ +// printf("bpipe-fd: setFileAttributes\n"); + return bRC_OK; +} + +/************************************************************************* + * Apply codes in writer command: + * %w -> "where" + * %r -> "replace" + * + * Replace: + * 'always' => 'a', chr(97) + * 'ifnewer' => 'w', chr(119) + * 'ifolder' => 'o', chr(111) + * 'never' => 'n', chr(110) + * + * This function will allocate the required amount of memory with malloc. + * Need to be free()d manually. + * Inspired by edit_job_codes in lib/util.c + */ + +static char *apply_rp_codes(struct plugin_ctx * p_ctx) +{ + char *p, *q; + const char *str; + char add[10]; + int w_count = 0, r_count = 0; + char *omsg; + + char *imsg = p_ctx->writer; + + if (!imsg) { + return NULL; + } + + if ((p = imsg)) { + while ((q = strstr(p, "%w"))) { + w_count++; + p=q+1; + } + + p = imsg; + while ((q = strstr(p, "%r"))) { + r_count++; + p=q+1; + } + } + + /* Required mem: + * len(imsg) + * + number of "where" codes * (len(where)-2) + * - number of "replace" codes + */ + omsg = (char*)malloc(strlen(imsg) + (w_count * (strlen(p_ctx->where)-2)) - r_count + 1); + if (!omsg) { + fprintf(stderr, "Out of memory."); + return NULL; + } + + *omsg = 0; + //printf("apply_rp_codes: %s\n", imsg); + for (p=imsg; *p; p++) { + if (*p == '%') { + switch (*++p) { + case '%': + str = "%"; + break; + case 'w': + str = p_ctx->where; + break; + case 'r': + snprintf(add, 2, "%c", p_ctx->replace); + str = add; + break; + default: + add[0] = '%'; + add[1] = *p; + add[2] = 0; + str = add; + break; + } + } else { + add[0] = *p; + add[1] = 0; + str = add; + } + //printf("add_str %s\n", str); + strcat(omsg, str); + //printf("omsg=%s\n", omsg); + } + return omsg; +} + + +#ifdef __cplusplus +} +#endif diff --git a/bacula/src/win32/filed/plugins/bpipe-fd.def b/bacula/src/win32/filed/plugins/bpipe-fd.def new file mode 100644 index 0000000000..e79095cb3e --- /dev/null +++ b/bacula/src/win32/filed/plugins/bpipe-fd.def @@ -0,0 +1,15 @@ +LIBRARY bacula.dll +EXPORTS + +; compat.o +;_Z10open_bpipePciPKc +;_Z11close_bpipeP5BPIPE +;_Z11close_wpipeP5BPIPE + +;console_command DATA +;b_plugin_list DATA +;plugin_bopen DATA +;plugin_bclose DATA +;plugin_bwrite DATA +;plugin_bread DATA +;plugin_blseek DATA diff --git a/bacula/src/win32/filed/plugins/comadmin.h b/bacula/src/win32/filed/plugins/comadmin.h new file mode 100644 index 0000000000..9773b9bf2a --- /dev/null +++ b/bacula/src/win32/filed/plugins/comadmin.h @@ -0,0 +1,878 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error This stub requires an updated version of +#endif + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif + +#ifndef __comadmin_h__ +#define __comadmin_h__ + +#ifndef __ICOMAdminCatalog_FWD_DEFINED__ +#define __ICOMAdminCatalog_FWD_DEFINED__ +typedef struct ICOMAdminCatalog ICOMAdminCatalog; +#endif + +#ifndef __ICOMAdminCatalog2_FWD_DEFINED__ +#define __ICOMAdminCatalog2_FWD_DEFINED__ +typedef struct ICOMAdminCatalog2 ICOMAdminCatalog2; +#endif + +#ifndef __ICatalogObject_FWD_DEFINED__ +#define __ICatalogObject_FWD_DEFINED__ +typedef struct ICatalogObject ICatalogObject; +#endif + +#ifndef __ICatalogCollection_FWD_DEFINED__ +#define __ICatalogCollection_FWD_DEFINED__ +typedef struct ICatalogCollection ICatalogCollection; +#endif + +#ifndef __COMAdminCatalog_FWD_DEFINED__ +#define __COMAdminCatalog_FWD_DEFINED__ +#ifdef __cplusplus +typedef class COMAdminCatalog COMAdminCatalog; +#else +typedef struct COMAdminCatalog COMAdminCatalog; +#endif +#endif + +#ifndef __COMAdminCatalogObject_FWD_DEFINED__ +#define __COMAdminCatalogObject_FWD_DEFINED__ +#ifdef __cplusplus +typedef class COMAdminCatalogObject COMAdminCatalogObject; +#else +typedef struct COMAdminCatalogObject COMAdminCatalogObject; +#endif +#endif + +#ifndef __COMAdminCatalogCollection_FWD_DEFINED__ +#define __COMAdminCatalogCollection_FWD_DEFINED__ +#ifdef __cplusplus +typedef class COMAdminCatalogCollection COMAdminCatalogCollection; +#else +typedef struct COMAdminCatalogCollection COMAdminCatalogCollection; +#endif +#endif + +#include "unknwn.h" +#include "oaidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#ifndef __MIDL_user_allocate_free_DEFINED__ +#define __MIDL_user_allocate_free_DEFINED__ + void *__RPC_API MIDL_user_allocate(size_t); + void __RPC_API MIDL_user_free(void *); +#endif + +#include + + extern RPC_IF_HANDLE __MIDL_itf_comadmin_0000_v0_0_c_ifspec; + extern RPC_IF_HANDLE __MIDL_itf_comadmin_0000_v0_0_s_ifspec; + +#ifndef __ICOMAdminCatalog_INTERFACE_DEFINED__ +#define __ICOMAdminCatalog_INTERFACE_DEFINED__ + EXTERN_C const IID IID_ICOMAdminCatalog; +#if defined(__cplusplus) && !defined(CINTERFACE) + struct ICOMAdminCatalog : public IDispatch { + public: + virtual HRESULT WINAPI GetCollection(BSTR bstrCollName,IDispatch **ppCatalogCollection) = 0; + virtual HRESULT WINAPI Connect(BSTR bstrCatalogServerName,IDispatch **ppCatalogCollection) = 0; + virtual HRESULT WINAPI get_MajorVersion(long *plMajorVersion) = 0; + virtual HRESULT WINAPI get_MinorVersion(long *plMinorVersion) = 0; + virtual HRESULT WINAPI GetCollectionByQuery(BSTR bstrCollName,SAFEARRAY **ppsaVarQuery,IDispatch **ppCatalogCollection) = 0; + virtual HRESULT WINAPI ImportComponent(BSTR bstrApplIDOrName,BSTR bstrCLSIDOrProgID) = 0; + virtual HRESULT WINAPI InstallComponent(BSTR bstrApplIDOrName,BSTR bstrDLL,BSTR bstrTLB,BSTR bstrPSDLL) = 0; + virtual HRESULT WINAPI ShutdownApplication(BSTR bstrApplIDOrName) = 0; + virtual HRESULT WINAPI ExportApplication(BSTR bstrApplIDOrName,BSTR bstrApplicationFile,long lOptions) = 0; + virtual HRESULT WINAPI InstallApplication(BSTR bstrApplicationFile,BSTR bstrDestinationDirectory,long lOptions,BSTR bstrUserId,BSTR bstrPassword,BSTR bstrRSN) = 0; + virtual HRESULT WINAPI StopRouter(void) = 0; + virtual HRESULT WINAPI RefreshRouter(void) = 0; + virtual HRESULT WINAPI StartRouter(void) = 0; + virtual HRESULT WINAPI Reserved1(void) = 0; + virtual HRESULT WINAPI Reserved2(void) = 0; + virtual HRESULT WINAPI InstallMultipleComponents(BSTR bstrApplIDOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDs) = 0; + virtual HRESULT WINAPI GetMultipleComponentsInfo(BSTR bstrApplIdOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDs,SAFEARRAY **ppsaVarClassNames,SAFEARRAY **ppsaVarFileFlags,SAFEARRAY **ppsaVarComponentFlags) = 0; + virtual HRESULT WINAPI RefreshComponents(void) = 0; + virtual HRESULT WINAPI BackupREGDB(BSTR bstrBackupFilePath) = 0; + virtual HRESULT WINAPI RestoreREGDB(BSTR bstrBackupFilePath) = 0; + virtual HRESULT WINAPI QueryApplicationFile(BSTR bstrApplicationFile,BSTR *pbstrApplicationName,BSTR *pbstrApplicationDescription,VARIANT_BOOL *pbHasUsers,VARIANT_BOOL *pbIsProxy,SAFEARRAY **ppsaVarFileNames) = 0; + virtual HRESULT WINAPI StartApplication(BSTR bstrApplIdOrName) = 0; + virtual HRESULT WINAPI ServiceCheck(long lService,long *plStatus) = 0; + virtual HRESULT WINAPI InstallMultipleEventClasses(BSTR bstrApplIdOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDS) = 0; + virtual HRESULT WINAPI InstallEventClass(BSTR bstrApplIdOrName,BSTR bstrDLL,BSTR bstrTLB,BSTR bstrPSDLL) = 0; + virtual HRESULT WINAPI GetEventClassesForIID(BSTR bstrIID,SAFEARRAY **ppsaVarCLSIDs,SAFEARRAY **ppsaVarProgIDs,SAFEARRAY **ppsaVarDescriptions) = 0; + }; +#else + typedef struct ICOMAdminCatalogVtbl { + BEGIN_INTERFACE + HRESULT (WINAPI *QueryInterface)(ICOMAdminCatalog *This,REFIID riid,void **ppvObject); + ULONG (WINAPI *AddRef)(ICOMAdminCatalog *This); + ULONG (WINAPI *Release)(ICOMAdminCatalog *This); + HRESULT (WINAPI *GetTypeInfoCount)(ICOMAdminCatalog *This,UINT *pctinfo); + HRESULT (WINAPI *GetTypeInfo)(ICOMAdminCatalog *This,UINT iTInfo,LCID lcid,ITypeInfo **ppTInfo); + HRESULT (WINAPI *GetIDsOfNames)(ICOMAdminCatalog *This,REFIID riid,LPOLESTR *rgszNames,UINT cNames,LCID lcid,DISPID *rgDispId); + HRESULT (WINAPI *Invoke)(ICOMAdminCatalog *This,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr); + HRESULT (WINAPI *GetCollection)(ICOMAdminCatalog *This,BSTR bstrCollName,IDispatch **ppCatalogCollection); + HRESULT (WINAPI *Connect)(ICOMAdminCatalog *This,BSTR bstrCatalogServerName,IDispatch **ppCatalogCollection); + HRESULT (WINAPI *get_MajorVersion)(ICOMAdminCatalog *This,long *plMajorVersion); + HRESULT (WINAPI *get_MinorVersion)(ICOMAdminCatalog *This,long *plMinorVersion); + HRESULT (WINAPI *GetCollectionByQuery)(ICOMAdminCatalog *This,BSTR bstrCollName,SAFEARRAY **ppsaVarQuery,IDispatch **ppCatalogCollection); + HRESULT (WINAPI *ImportComponent)(ICOMAdminCatalog *This,BSTR bstrApplIDOrName,BSTR bstrCLSIDOrProgID); + HRESULT (WINAPI *InstallComponent)(ICOMAdminCatalog *This,BSTR bstrApplIDOrName,BSTR bstrDLL,BSTR bstrTLB,BSTR bstrPSDLL); + HRESULT (WINAPI *ShutdownApplication)(ICOMAdminCatalog *This,BSTR bstrApplIDOrName); + HRESULT (WINAPI *ExportApplication)(ICOMAdminCatalog *This,BSTR bstrApplIDOrName,BSTR bstrApplicationFile,long lOptions); + HRESULT (WINAPI *InstallApplication)(ICOMAdminCatalog *This,BSTR bstrApplicationFile,BSTR bstrDestinationDirectory,long lOptions,BSTR bstrUserId,BSTR bstrPassword,BSTR bstrRSN); + HRESULT (WINAPI *StopRouter)(ICOMAdminCatalog *This); + HRESULT (WINAPI *RefreshRouter)(ICOMAdminCatalog *This); + HRESULT (WINAPI *StartRouter)(ICOMAdminCatalog *This); + HRESULT (WINAPI *Reserved1)(ICOMAdminCatalog *This); + HRESULT (WINAPI *Reserved2)(ICOMAdminCatalog *This); + HRESULT (WINAPI *InstallMultipleComponents)(ICOMAdminCatalog *This,BSTR bstrApplIDOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDs); + HRESULT (WINAPI *GetMultipleComponentsInfo)(ICOMAdminCatalog *This,BSTR bstrApplIdOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDs,SAFEARRAY **ppsaVarClassNames,SAFEARRAY **ppsaVarFileFlags,SAFEARRAY **ppsaVarComponentFlags); + HRESULT (WINAPI *RefreshComponents)(ICOMAdminCatalog *This); + HRESULT (WINAPI *BackupREGDB)(ICOMAdminCatalog *This,BSTR bstrBackupFilePath); + HRESULT (WINAPI *RestoreREGDB)(ICOMAdminCatalog *This,BSTR bstrBackupFilePath); + HRESULT (WINAPI *QueryApplicationFile)(ICOMAdminCatalog *This,BSTR bstrApplicationFile,BSTR *pbstrApplicationName,BSTR *pbstrApplicationDescription,VARIANT_BOOL *pbHasUsers,VARIANT_BOOL *pbIsProxy,SAFEARRAY **ppsaVarFileNames); + HRESULT (WINAPI *StartApplication)(ICOMAdminCatalog *This,BSTR bstrApplIdOrName); + HRESULT (WINAPI *ServiceCheck)(ICOMAdminCatalog *This,long lService,long *plStatus); + HRESULT (WINAPI *InstallMultipleEventClasses)(ICOMAdminCatalog *This,BSTR bstrApplIdOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDS); + HRESULT (WINAPI *InstallEventClass)(ICOMAdminCatalog *This,BSTR bstrApplIdOrName,BSTR bstrDLL,BSTR bstrTLB,BSTR bstrPSDLL); + HRESULT (WINAPI *GetEventClassesForIID)(ICOMAdminCatalog *This,BSTR bstrIID,SAFEARRAY **ppsaVarCLSIDs,SAFEARRAY **ppsaVarProgIDs,SAFEARRAY **ppsaVarDescriptions); + END_INTERFACE + } ICOMAdminCatalogVtbl; + struct ICOMAdminCatalog { + CONST_VTBL struct ICOMAdminCatalogVtbl *lpVtbl; + }; +#ifdef COBJMACROS +#define ICOMAdminCatalog_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) +#define ICOMAdminCatalog_AddRef(This) (This)->lpVtbl->AddRef(This) +#define ICOMAdminCatalog_Release(This) (This)->lpVtbl->Release(This) +#define ICOMAdminCatalog_GetTypeInfoCount(This,pctinfo) (This)->lpVtbl->GetTypeInfoCount(This,pctinfo) +#define ICOMAdminCatalog_GetTypeInfo(This,iTInfo,lcid,ppTInfo) (This)->lpVtbl->GetTypeInfo(This,iTInfo,lcid,ppTInfo) +#define ICOMAdminCatalog_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) (This)->lpVtbl->GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) +#define ICOMAdminCatalog_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) (This)->lpVtbl->Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) +#define ICOMAdminCatalog_GetCollection(This,bstrCollName,ppCatalogCollection) (This)->lpVtbl->GetCollection(This,bstrCollName,ppCatalogCollection) +#define ICOMAdminCatalog_Connect(This,bstrCatalogServerName,ppCatalogCollection) (This)->lpVtbl->Connect(This,bstrCatalogServerName,ppCatalogCollection) +#define ICOMAdminCatalog_get_MajorVersion(This,plMajorVersion) (This)->lpVtbl->get_MajorVersion(This,plMajorVersion) +#define ICOMAdminCatalog_get_MinorVersion(This,plMinorVersion) (This)->lpVtbl->get_MinorVersion(This,plMinorVersion) +#define ICOMAdminCatalog_GetCollectionByQuery(This,bstrCollName,ppsaVarQuery,ppCatalogCollection) (This)->lpVtbl->GetCollectionByQuery(This,bstrCollName,ppsaVarQuery,ppCatalogCollection) +#define ICOMAdminCatalog_ImportComponent(This,bstrApplIDOrName,bstrCLSIDOrProgID) (This)->lpVtbl->ImportComponent(This,bstrApplIDOrName,bstrCLSIDOrProgID) +#define ICOMAdminCatalog_InstallComponent(This,bstrApplIDOrName,bstrDLL,bstrTLB,bstrPSDLL) (This)->lpVtbl->InstallComponent(This,bstrApplIDOrName,bstrDLL,bstrTLB,bstrPSDLL) +#define ICOMAdminCatalog_ShutdownApplication(This,bstrApplIDOrName) (This)->lpVtbl->ShutdownApplication(This,bstrApplIDOrName) +#define ICOMAdminCatalog_ExportApplication(This,bstrApplIDOrName,bstrApplicationFile,lOptions) (This)->lpVtbl->ExportApplication(This,bstrApplIDOrName,bstrApplicationFile,lOptions) +#define ICOMAdminCatalog_InstallApplication(This,bstrApplicationFile,bstrDestinationDirectory,lOptions,bstrUserId,bstrPassword,bstrRSN) (This)->lpVtbl->InstallApplication(This,bstrApplicationFile,bstrDestinationDirectory,lOptions,bstrUserId,bstrPassword,bstrRSN) +#define ICOMAdminCatalog_StopRouter(This) (This)->lpVtbl->StopRouter(This) +#define ICOMAdminCatalog_RefreshRouter(This) (This)->lpVtbl->RefreshRouter(This) +#define ICOMAdminCatalog_StartRouter(This) (This)->lpVtbl->StartRouter(This) +#define ICOMAdminCatalog_Reserved1(This) (This)->lpVtbl->Reserved1(This) +#define ICOMAdminCatalog_Reserved2(This) (This)->lpVtbl->Reserved2(This) +#define ICOMAdminCatalog_InstallMultipleComponents(This,bstrApplIDOrName,ppsaVarFileNames,ppsaVarCLSIDs) (This)->lpVtbl->InstallMultipleComponents(This,bstrApplIDOrName,ppsaVarFileNames,ppsaVarCLSIDs) +#define ICOMAdminCatalog_GetMultipleComponentsInfo(This,bstrApplIdOrName,ppsaVarFileNames,ppsaVarCLSIDs,ppsaVarClassNames,ppsaVarFileFlags,ppsaVarComponentFlags) (This)->lpVtbl->GetMultipleComponentsInfo(This,bstrApplIdOrName,ppsaVarFileNames,ppsaVarCLSIDs,ppsaVarClassNames,ppsaVarFileFlags,ppsaVarComponentFlags) +#define ICOMAdminCatalog_RefreshComponents(This) (This)->lpVtbl->RefreshComponents(This) +#define ICOMAdminCatalog_BackupREGDB(This,bstrBackupFilePath) (This)->lpVtbl->BackupREGDB(This,bstrBackupFilePath) +#define ICOMAdminCatalog_RestoreREGDB(This,bstrBackupFilePath) (This)->lpVtbl->RestoreREGDB(This,bstrBackupFilePath) +#define ICOMAdminCatalog_QueryApplicationFile(This,bstrApplicationFile,pbstrApplicationName,pbstrApplicationDescription,pbHasUsers,pbIsProxy,ppsaVarFileNames) (This)->lpVtbl->QueryApplicationFile(This,bstrApplicationFile,pbstrApplicationName,pbstrApplicationDescription,pbHasUsers,pbIsProxy,ppsaVarFileNames) +#define ICOMAdminCatalog_StartApplication(This,bstrApplIdOrName) (This)->lpVtbl->StartApplication(This,bstrApplIdOrName) +#define ICOMAdminCatalog_ServiceCheck(This,lService,plStatus) (This)->lpVtbl->ServiceCheck(This,lService,plStatus) +#define ICOMAdminCatalog_InstallMultipleEventClasses(This,bstrApplIdOrName,ppsaVarFileNames,ppsaVarCLSIDS) (This)->lpVtbl->InstallMultipleEventClasses(This,bstrApplIdOrName,ppsaVarFileNames,ppsaVarCLSIDS) +#define ICOMAdminCatalog_InstallEventClass(This,bstrApplIdOrName,bstrDLL,bstrTLB,bstrPSDLL) (This)->lpVtbl->InstallEventClass(This,bstrApplIdOrName,bstrDLL,bstrTLB,bstrPSDLL) +#define ICOMAdminCatalog_GetEventClassesForIID(This,bstrIID,ppsaVarCLSIDs,ppsaVarProgIDs,ppsaVarDescriptions) (This)->lpVtbl->GetEventClassesForIID(This,bstrIID,ppsaVarCLSIDs,ppsaVarProgIDs,ppsaVarDescriptions) +#endif +#endif + HRESULT WINAPI ICOMAdminCatalog_GetCollection_Proxy(ICOMAdminCatalog *This,BSTR bstrCollName,IDispatch **ppCatalogCollection); + void __RPC_STUB ICOMAdminCatalog_GetCollection_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_Connect_Proxy(ICOMAdminCatalog *This,BSTR bstrCatalogServerName,IDispatch **ppCatalogCollection); + void __RPC_STUB ICOMAdminCatalog_Connect_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_get_MajorVersion_Proxy(ICOMAdminCatalog *This,long *plMajorVersion); + void __RPC_STUB ICOMAdminCatalog_get_MajorVersion_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_get_MinorVersion_Proxy(ICOMAdminCatalog *This,long *plMinorVersion); + void __RPC_STUB ICOMAdminCatalog_get_MinorVersion_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_GetCollectionByQuery_Proxy(ICOMAdminCatalog *This,BSTR bstrCollName,SAFEARRAY **ppsaVarQuery,IDispatch **ppCatalogCollection); + void __RPC_STUB ICOMAdminCatalog_GetCollectionByQuery_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_ImportComponent_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIDOrName,BSTR bstrCLSIDOrProgID); + void __RPC_STUB ICOMAdminCatalog_ImportComponent_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_InstallComponent_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIDOrName,BSTR bstrDLL,BSTR bstrTLB,BSTR bstrPSDLL); + void __RPC_STUB ICOMAdminCatalog_InstallComponent_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_ShutdownApplication_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIDOrName); + void __RPC_STUB ICOMAdminCatalog_ShutdownApplication_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_ExportApplication_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIDOrName,BSTR bstrApplicationFile,long lOptions); + void __RPC_STUB ICOMAdminCatalog_ExportApplication_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_InstallApplication_Proxy(ICOMAdminCatalog *This,BSTR bstrApplicationFile,BSTR bstrDestinationDirectory,long lOptions,BSTR bstrUserId,BSTR bstrPassword,BSTR bstrRSN); + void __RPC_STUB ICOMAdminCatalog_InstallApplication_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_StopRouter_Proxy(ICOMAdminCatalog *This); + void __RPC_STUB ICOMAdminCatalog_StopRouter_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_RefreshRouter_Proxy(ICOMAdminCatalog *This); + void __RPC_STUB ICOMAdminCatalog_RefreshRouter_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_StartRouter_Proxy(ICOMAdminCatalog *This); + void __RPC_STUB ICOMAdminCatalog_StartRouter_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_Reserved1_Proxy(ICOMAdminCatalog *This); + void __RPC_STUB ICOMAdminCatalog_Reserved1_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_Reserved2_Proxy(ICOMAdminCatalog *This); + void __RPC_STUB ICOMAdminCatalog_Reserved2_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_InstallMultipleComponents_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIDOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDs); + void __RPC_STUB ICOMAdminCatalog_InstallMultipleComponents_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_GetMultipleComponentsInfo_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIdOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDs,SAFEARRAY **ppsaVarClassNames,SAFEARRAY **ppsaVarFileFlags,SAFEARRAY **ppsaVarComponentFlags); + void __RPC_STUB ICOMAdminCatalog_GetMultipleComponentsInfo_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_RefreshComponents_Proxy(ICOMAdminCatalog *This); + void __RPC_STUB ICOMAdminCatalog_RefreshComponents_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_BackupREGDB_Proxy(ICOMAdminCatalog *This,BSTR bstrBackupFilePath); + void __RPC_STUB ICOMAdminCatalog_BackupREGDB_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_RestoreREGDB_Proxy(ICOMAdminCatalog *This,BSTR bstrBackupFilePath); + void __RPC_STUB ICOMAdminCatalog_RestoreREGDB_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_QueryApplicationFile_Proxy(ICOMAdminCatalog *This,BSTR bstrApplicationFile,BSTR *pbstrApplicationName,BSTR *pbstrApplicationDescription,VARIANT_BOOL *pbHasUsers,VARIANT_BOOL *pbIsProxy,SAFEARRAY **ppsaVarFileNames); + void __RPC_STUB ICOMAdminCatalog_QueryApplicationFile_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_StartApplication_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIdOrName); + void __RPC_STUB ICOMAdminCatalog_StartApplication_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_ServiceCheck_Proxy(ICOMAdminCatalog *This,long lService,long *plStatus); + void __RPC_STUB ICOMAdminCatalog_ServiceCheck_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_InstallMultipleEventClasses_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIdOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDS); + void __RPC_STUB ICOMAdminCatalog_InstallMultipleEventClasses_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_InstallEventClass_Proxy(ICOMAdminCatalog *This,BSTR bstrApplIdOrName,BSTR bstrDLL,BSTR bstrTLB,BSTR bstrPSDLL); + void __RPC_STUB ICOMAdminCatalog_InstallEventClass_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog_GetEventClassesForIID_Proxy(ICOMAdminCatalog *This,BSTR bstrIID,SAFEARRAY **ppsaVarCLSIDs,SAFEARRAY **ppsaVarProgIDs,SAFEARRAY **ppsaVarDescriptions); + void __RPC_STUB ICOMAdminCatalog_GetEventClassesForIID_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); +#endif + + typedef enum COMAdminInUse { + COMAdminNotInUse = 0,COMAdminInUseByCatalog = 0x1,COMAdminInUseByRegistryUnknown = 0x2,COMAdminInUseByRegistryProxyStub = 0x3, + COMAdminInUseByRegistryTypeLib = 0x4,COMAdminInUseByRegistryClsid = 0x5 + } COMAdminInUse; + + extern RPC_IF_HANDLE __MIDL_itf_comadmin_0116_v0_0_c_ifspec; + extern RPC_IF_HANDLE __MIDL_itf_comadmin_0116_v0_0_s_ifspec; + +#ifndef __ICOMAdminCatalog2_INTERFACE_DEFINED__ +#define __ICOMAdminCatalog2_INTERFACE_DEFINED__ + EXTERN_C const IID IID_ICOMAdminCatalog2; +#if defined(__cplusplus) && !defined(CINTERFACE) + struct ICOMAdminCatalog2 : public ICOMAdminCatalog { + public: + virtual HRESULT WINAPI GetCollectionByQuery2(BSTR bstrCollectionName,VARIANT *pVarQueryStrings,IDispatch **ppCatalogCollection) = 0; + virtual HRESULT WINAPI GetApplicationInstanceIDFromProcessID(long lProcessID,BSTR *pbstrApplicationInstanceID) = 0; + virtual HRESULT WINAPI ShutdownApplicationInstances(VARIANT *pVarApplicationInstanceID) = 0; + virtual HRESULT WINAPI PauseApplicationInstances(VARIANT *pVarApplicationInstanceID) = 0; + virtual HRESULT WINAPI ResumeApplicationInstances(VARIANT *pVarApplicationInstanceID) = 0; + virtual HRESULT WINAPI RecycleApplicationInstances(VARIANT *pVarApplicationInstanceID,long lReasonCode) = 0; + virtual HRESULT WINAPI AreApplicationInstancesPaused(VARIANT *pVarApplicationInstanceID,VARIANT_BOOL *pVarBoolPaused) = 0; + virtual HRESULT WINAPI DumpApplicationInstance(BSTR bstrApplicationInstanceID,BSTR bstrDirectory,long lMaxImages,BSTR *pbstrDumpFile) = 0; + virtual HRESULT WINAPI get_IsApplicationInstanceDumpSupported(VARIANT_BOOL *pVarBoolDumpSupported) = 0; + virtual HRESULT WINAPI CreateServiceForApplication(BSTR bstrApplicationIDOrName,BSTR bstrServiceName,BSTR bstrStartType,BSTR bstrErrorControl,BSTR bstrDependencies,BSTR bstrRunAs,BSTR bstrPassword,VARIANT_BOOL bDesktopOk) = 0; + virtual HRESULT WINAPI DeleteServiceForApplication(BSTR bstrApplicationIDOrName) = 0; + virtual HRESULT WINAPI GetPartitionID(BSTR bstrApplicationIDOrName,BSTR *pbstrPartitionID) = 0; + virtual HRESULT WINAPI GetPartitionName(BSTR bstrApplicationIDOrName,BSTR *pbstrPartitionName) = 0; + virtual HRESULT WINAPI put_CurrentPartition(BSTR bstrPartitionIDOrName) = 0; + virtual HRESULT WINAPI get_CurrentPartitionID(BSTR *pbstrPartitionID) = 0; + virtual HRESULT WINAPI get_CurrentPartitionName(BSTR *pbstrPartitionName) = 0; + virtual HRESULT WINAPI get_GlobalPartitionID(BSTR *pbstrGlobalPartitionID) = 0; + virtual HRESULT WINAPI FlushPartitionCache(void) = 0; + virtual HRESULT WINAPI CopyApplications(BSTR bstrSourcePartitionIDOrName,VARIANT *pVarApplicationID,BSTR bstrDestinationPartitionIDOrName) = 0; + virtual HRESULT WINAPI CopyComponents(BSTR bstrSourceApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,BSTR bstrDestinationApplicationIDOrName) = 0; + virtual HRESULT WINAPI MoveComponents(BSTR bstrSourceApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,BSTR bstrDestinationApplicationIDOrName) = 0; + virtual HRESULT WINAPI AliasComponent(BSTR bstrSrcApplicationIDOrName,BSTR bstrCLSIDOrProgID,BSTR bstrDestApplicationIDOrName,BSTR bstrNewProgId,BSTR bstrNewClsid) = 0; + virtual HRESULT WINAPI IsSafeToDelete(BSTR bstrDllName,COMAdminInUse *pCOMAdminInUse) = 0; + virtual HRESULT WINAPI ImportUnconfiguredComponents(BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType) = 0; + virtual HRESULT WINAPI PromoteUnconfiguredComponents(BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType) = 0; + virtual HRESULT WINAPI ImportComponents(BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType) = 0; + virtual HRESULT WINAPI get_Is64BitCatalogServer(VARIANT_BOOL *pbIs64Bit) = 0; + virtual HRESULT WINAPI ExportPartition(BSTR bstrPartitionIDOrName,BSTR bstrPartitionFileName,long lOptions) = 0; + virtual HRESULT WINAPI InstallPartition(BSTR bstrFileName,BSTR bstrDestDirectory,long lOptions,BSTR bstrUserID,BSTR bstrPassword,BSTR bstrRSN) = 0; + virtual HRESULT WINAPI QueryApplicationFile2(BSTR bstrApplicationFile,IDispatch **ppFilesForImport) = 0; + virtual HRESULT WINAPI GetComponentVersionCount(BSTR bstrCLSIDOrProgID,long *plVersionCount) = 0; + }; +#else + typedef struct ICOMAdminCatalog2Vtbl { + BEGIN_INTERFACE + HRESULT (WINAPI *QueryInterface)(ICOMAdminCatalog2 *This,REFIID riid,void **ppvObject); + ULONG (WINAPI *AddRef)(ICOMAdminCatalog2 *This); + ULONG (WINAPI *Release)(ICOMAdminCatalog2 *This); + HRESULT (WINAPI *GetTypeInfoCount)(ICOMAdminCatalog2 *This,UINT *pctinfo); + HRESULT (WINAPI *GetTypeInfo)(ICOMAdminCatalog2 *This,UINT iTInfo,LCID lcid,ITypeInfo **ppTInfo); + HRESULT (WINAPI *GetIDsOfNames)(ICOMAdminCatalog2 *This,REFIID riid,LPOLESTR *rgszNames,UINT cNames,LCID lcid,DISPID *rgDispId); + HRESULT (WINAPI *Invoke)(ICOMAdminCatalog2 *This,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr); + HRESULT (WINAPI *GetCollection)(ICOMAdminCatalog2 *This,BSTR bstrCollName,IDispatch **ppCatalogCollection); + HRESULT (WINAPI *Connect)(ICOMAdminCatalog2 *This,BSTR bstrCatalogServerName,IDispatch **ppCatalogCollection); + HRESULT (WINAPI *get_MajorVersion)(ICOMAdminCatalog2 *This,long *plMajorVersion); + HRESULT (WINAPI *get_MinorVersion)(ICOMAdminCatalog2 *This,long *plMinorVersion); + HRESULT (WINAPI *GetCollectionByQuery)(ICOMAdminCatalog2 *This,BSTR bstrCollName,SAFEARRAY **ppsaVarQuery,IDispatch **ppCatalogCollection); + HRESULT (WINAPI *ImportComponent)(ICOMAdminCatalog2 *This,BSTR bstrApplIDOrName,BSTR bstrCLSIDOrProgID); + HRESULT (WINAPI *InstallComponent)(ICOMAdminCatalog2 *This,BSTR bstrApplIDOrName,BSTR bstrDLL,BSTR bstrTLB,BSTR bstrPSDLL); + HRESULT (WINAPI *ShutdownApplication)(ICOMAdminCatalog2 *This,BSTR bstrApplIDOrName); + HRESULT (WINAPI *ExportApplication)(ICOMAdminCatalog2 *This,BSTR bstrApplIDOrName,BSTR bstrApplicationFile,long lOptions); + HRESULT (WINAPI *InstallApplication)(ICOMAdminCatalog2 *This,BSTR bstrApplicationFile,BSTR bstrDestinationDirectory,long lOptions,BSTR bstrUserId,BSTR bstrPassword,BSTR bstrRSN); + HRESULT (WINAPI *StopRouter)(ICOMAdminCatalog2 *This); + HRESULT (WINAPI *RefreshRouter)(ICOMAdminCatalog2 *This); + HRESULT (WINAPI *StartRouter)(ICOMAdminCatalog2 *This); + HRESULT (WINAPI *Reserved1)(ICOMAdminCatalog2 *This); + HRESULT (WINAPI *Reserved2)(ICOMAdminCatalog2 *This); + HRESULT (WINAPI *InstallMultipleComponents)(ICOMAdminCatalog2 *This,BSTR bstrApplIDOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDs); + HRESULT (WINAPI *GetMultipleComponentsInfo)(ICOMAdminCatalog2 *This,BSTR bstrApplIdOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDs,SAFEARRAY **ppsaVarClassNames,SAFEARRAY **ppsaVarFileFlags,SAFEARRAY **ppsaVarComponentFlags); + HRESULT (WINAPI *RefreshComponents)(ICOMAdminCatalog2 *This); + HRESULT (WINAPI *BackupREGDB)(ICOMAdminCatalog2 *This,BSTR bstrBackupFilePath); + HRESULT (WINAPI *RestoreREGDB)(ICOMAdminCatalog2 *This,BSTR bstrBackupFilePath); + HRESULT (WINAPI *QueryApplicationFile)(ICOMAdminCatalog2 *This,BSTR bstrApplicationFile,BSTR *pbstrApplicationName,BSTR *pbstrApplicationDescription,VARIANT_BOOL *pbHasUsers,VARIANT_BOOL *pbIsProxy,SAFEARRAY **ppsaVarFileNames); + HRESULT (WINAPI *StartApplication)(ICOMAdminCatalog2 *This,BSTR bstrApplIdOrName); + HRESULT (WINAPI *ServiceCheck)(ICOMAdminCatalog2 *This,long lService,long *plStatus); + HRESULT (WINAPI *InstallMultipleEventClasses)(ICOMAdminCatalog2 *This,BSTR bstrApplIdOrName,SAFEARRAY **ppsaVarFileNames,SAFEARRAY **ppsaVarCLSIDS); + HRESULT (WINAPI *InstallEventClass)(ICOMAdminCatalog2 *This,BSTR bstrApplIdOrName,BSTR bstrDLL,BSTR bstrTLB,BSTR bstrPSDLL); + HRESULT (WINAPI *GetEventClassesForIID)(ICOMAdminCatalog2 *This,BSTR bstrIID,SAFEARRAY **ppsaVarCLSIDs,SAFEARRAY **ppsaVarProgIDs,SAFEARRAY **ppsaVarDescriptions); + HRESULT (WINAPI *GetCollectionByQuery2)(ICOMAdminCatalog2 *This,BSTR bstrCollectionName,VARIANT *pVarQueryStrings,IDispatch **ppCatalogCollection); + HRESULT (WINAPI *GetApplicationInstanceIDFromProcessID)(ICOMAdminCatalog2 *This,long lProcessID,BSTR *pbstrApplicationInstanceID); + HRESULT (WINAPI *ShutdownApplicationInstances)(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID); + HRESULT (WINAPI *PauseApplicationInstances)(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID); + HRESULT (WINAPI *ResumeApplicationInstances)(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID); + HRESULT (WINAPI *RecycleApplicationInstances)(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID,long lReasonCode); + HRESULT (WINAPI *AreApplicationInstancesPaused)(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID,VARIANT_BOOL *pVarBoolPaused); + HRESULT (WINAPI *DumpApplicationInstance)(ICOMAdminCatalog2 *This,BSTR bstrApplicationInstanceID,BSTR bstrDirectory,long lMaxImages,BSTR *pbstrDumpFile); + HRESULT (WINAPI *get_IsApplicationInstanceDumpSupported)(ICOMAdminCatalog2 *This,VARIANT_BOOL *pVarBoolDumpSupported); + HRESULT (WINAPI *CreateServiceForApplication)(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,BSTR bstrServiceName,BSTR bstrStartType,BSTR bstrErrorControl,BSTR bstrDependencies,BSTR bstrRunAs,BSTR bstrPassword,VARIANT_BOOL bDesktopOk); + HRESULT (WINAPI *DeleteServiceForApplication)(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName); + HRESULT (WINAPI *GetPartitionID)(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,BSTR *pbstrPartitionID); + HRESULT (WINAPI *GetPartitionName)(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,BSTR *pbstrPartitionName); + HRESULT (WINAPI *put_CurrentPartition)(ICOMAdminCatalog2 *This,BSTR bstrPartitionIDOrName); + HRESULT (WINAPI *get_CurrentPartitionID)(ICOMAdminCatalog2 *This,BSTR *pbstrPartitionID); + HRESULT (WINAPI *get_CurrentPartitionName)(ICOMAdminCatalog2 *This,BSTR *pbstrPartitionName); + HRESULT (WINAPI *get_GlobalPartitionID)(ICOMAdminCatalog2 *This,BSTR *pbstrGlobalPartitionID); + HRESULT (WINAPI *FlushPartitionCache)(ICOMAdminCatalog2 *This); + HRESULT (WINAPI *CopyApplications)(ICOMAdminCatalog2 *This,BSTR bstrSourcePartitionIDOrName,VARIANT *pVarApplicationID,BSTR bstrDestinationPartitionIDOrName); + HRESULT (WINAPI *CopyComponents)(ICOMAdminCatalog2 *This,BSTR bstrSourceApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,BSTR bstrDestinationApplicationIDOrName); + HRESULT (WINAPI *MoveComponents)(ICOMAdminCatalog2 *This,BSTR bstrSourceApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,BSTR bstrDestinationApplicationIDOrName); + HRESULT (WINAPI *AliasComponent)(ICOMAdminCatalog2 *This,BSTR bstrSrcApplicationIDOrName,BSTR bstrCLSIDOrProgID,BSTR bstrDestApplicationIDOrName,BSTR bstrNewProgId,BSTR bstrNewClsid); + HRESULT (WINAPI *IsSafeToDelete)(ICOMAdminCatalog2 *This,BSTR bstrDllName,COMAdminInUse *pCOMAdminInUse); + HRESULT (WINAPI *ImportUnconfiguredComponents)(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType); + HRESULT (WINAPI *PromoteUnconfiguredComponents)(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType); + HRESULT (WINAPI *ImportComponents)(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType); + HRESULT (WINAPI *get_Is64BitCatalogServer)(ICOMAdminCatalog2 *This,VARIANT_BOOL *pbIs64Bit); + HRESULT (WINAPI *ExportPartition)(ICOMAdminCatalog2 *This,BSTR bstrPartitionIDOrName,BSTR bstrPartitionFileName,long lOptions); + HRESULT (WINAPI *InstallPartition)(ICOMAdminCatalog2 *This,BSTR bstrFileName,BSTR bstrDestDirectory,long lOptions,BSTR bstrUserID,BSTR bstrPassword,BSTR bstrRSN); + HRESULT (WINAPI *QueryApplicationFile2)(ICOMAdminCatalog2 *This,BSTR bstrApplicationFile,IDispatch **ppFilesForImport); + HRESULT (WINAPI *GetComponentVersionCount)(ICOMAdminCatalog2 *This,BSTR bstrCLSIDOrProgID,long *plVersionCount); + END_INTERFACE + } ICOMAdminCatalog2Vtbl; + struct ICOMAdminCatalog2 { + CONST_VTBL struct ICOMAdminCatalog2Vtbl *lpVtbl; + }; +#ifdef COBJMACROS +#define ICOMAdminCatalog2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) +#define ICOMAdminCatalog2_AddRef(This) (This)->lpVtbl->AddRef(This) +#define ICOMAdminCatalog2_Release(This) (This)->lpVtbl->Release(This) +#define ICOMAdminCatalog2_GetTypeInfoCount(This,pctinfo) (This)->lpVtbl->GetTypeInfoCount(This,pctinfo) +#define ICOMAdminCatalog2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) (This)->lpVtbl->GetTypeInfo(This,iTInfo,lcid,ppTInfo) +#define ICOMAdminCatalog2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) (This)->lpVtbl->GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) +#define ICOMAdminCatalog2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) (This)->lpVtbl->Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) +#define ICOMAdminCatalog2_GetCollection(This,bstrCollName,ppCatalogCollection) (This)->lpVtbl->GetCollection(This,bstrCollName,ppCatalogCollection) +#define ICOMAdminCatalog2_Connect(This,bstrCatalogServerName,ppCatalogCollection) (This)->lpVtbl->Connect(This,bstrCatalogServerName,ppCatalogCollection) +#define ICOMAdminCatalog2_get_MajorVersion(This,plMajorVersion) (This)->lpVtbl->get_MajorVersion(This,plMajorVersion) +#define ICOMAdminCatalog2_get_MinorVersion(This,plMinorVersion) (This)->lpVtbl->get_MinorVersion(This,plMinorVersion) +#define ICOMAdminCatalog2_GetCollectionByQuery(This,bstrCollName,ppsaVarQuery,ppCatalogCollection) (This)->lpVtbl->GetCollectionByQuery(This,bstrCollName,ppsaVarQuery,ppCatalogCollection) +#define ICOMAdminCatalog2_ImportComponent(This,bstrApplIDOrName,bstrCLSIDOrProgID) (This)->lpVtbl->ImportComponent(This,bstrApplIDOrName,bstrCLSIDOrProgID) +#define ICOMAdminCatalog2_InstallComponent(This,bstrApplIDOrName,bstrDLL,bstrTLB,bstrPSDLL) (This)->lpVtbl->InstallComponent(This,bstrApplIDOrName,bstrDLL,bstrTLB,bstrPSDLL) +#define ICOMAdminCatalog2_ShutdownApplication(This,bstrApplIDOrName) (This)->lpVtbl->ShutdownApplication(This,bstrApplIDOrName) +#define ICOMAdminCatalog2_ExportApplication(This,bstrApplIDOrName,bstrApplicationFile,lOptions) (This)->lpVtbl->ExportApplication(This,bstrApplIDOrName,bstrApplicationFile,lOptions) +#define ICOMAdminCatalog2_InstallApplication(This,bstrApplicationFile,bstrDestinationDirectory,lOptions,bstrUserId,bstrPassword,bstrRSN) (This)->lpVtbl->InstallApplication(This,bstrApplicationFile,bstrDestinationDirectory,lOptions,bstrUserId,bstrPassword,bstrRSN) +#define ICOMAdminCatalog2_StopRouter(This) (This)->lpVtbl->StopRouter(This) +#define ICOMAdminCatalog2_RefreshRouter(This) (This)->lpVtbl->RefreshRouter(This) +#define ICOMAdminCatalog2_StartRouter(This) (This)->lpVtbl->StartRouter(This) +#define ICOMAdminCatalog2_Reserved1(This) (This)->lpVtbl->Reserved1(This) +#define ICOMAdminCatalog2_Reserved2(This) (This)->lpVtbl->Reserved2(This) +#define ICOMAdminCatalog2_InstallMultipleComponents(This,bstrApplIDOrName,ppsaVarFileNames,ppsaVarCLSIDs) (This)->lpVtbl->InstallMultipleComponents(This,bstrApplIDOrName,ppsaVarFileNames,ppsaVarCLSIDs) +#define ICOMAdminCatalog2_GetMultipleComponentsInfo(This,bstrApplIdOrName,ppsaVarFileNames,ppsaVarCLSIDs,ppsaVarClassNames,ppsaVarFileFlags,ppsaVarComponentFlags) (This)->lpVtbl->GetMultipleComponentsInfo(This,bstrApplIdOrName,ppsaVarFileNames,ppsaVarCLSIDs,ppsaVarClassNames,ppsaVarFileFlags,ppsaVarComponentFlags) +#define ICOMAdminCatalog2_RefreshComponents(This) (This)->lpVtbl->RefreshComponents(This) +#define ICOMAdminCatalog2_BackupREGDB(This,bstrBackupFilePath) (This)->lpVtbl->BackupREGDB(This,bstrBackupFilePath) +#define ICOMAdminCatalog2_RestoreREGDB(This,bstrBackupFilePath) (This)->lpVtbl->RestoreREGDB(This,bstrBackupFilePath) +#define ICOMAdminCatalog2_QueryApplicationFile(This,bstrApplicationFile,pbstrApplicationName,pbstrApplicationDescription,pbHasUsers,pbIsProxy,ppsaVarFileNames) (This)->lpVtbl->QueryApplicationFile(This,bstrApplicationFile,pbstrApplicationName,pbstrApplicationDescription,pbHasUsers,pbIsProxy,ppsaVarFileNames) +#define ICOMAdminCatalog2_StartApplication(This,bstrApplIdOrName) (This)->lpVtbl->StartApplication(This,bstrApplIdOrName) +#define ICOMAdminCatalog2_ServiceCheck(This,lService,plStatus) (This)->lpVtbl->ServiceCheck(This,lService,plStatus) +#define ICOMAdminCatalog2_InstallMultipleEventClasses(This,bstrApplIdOrName,ppsaVarFileNames,ppsaVarCLSIDS) (This)->lpVtbl->InstallMultipleEventClasses(This,bstrApplIdOrName,ppsaVarFileNames,ppsaVarCLSIDS) +#define ICOMAdminCatalog2_InstallEventClass(This,bstrApplIdOrName,bstrDLL,bstrTLB,bstrPSDLL) (This)->lpVtbl->InstallEventClass(This,bstrApplIdOrName,bstrDLL,bstrTLB,bstrPSDLL) +#define ICOMAdminCatalog2_GetEventClassesForIID(This,bstrIID,ppsaVarCLSIDs,ppsaVarProgIDs,ppsaVarDescriptions) (This)->lpVtbl->GetEventClassesForIID(This,bstrIID,ppsaVarCLSIDs,ppsaVarProgIDs,ppsaVarDescriptions) +#define ICOMAdminCatalog2_GetCollectionByQuery2(This,bstrCollectionName,pVarQueryStrings,ppCatalogCollection) (This)->lpVtbl->GetCollectionByQuery2(This,bstrCollectionName,pVarQueryStrings,ppCatalogCollection) +#define ICOMAdminCatalog2_GetApplicationInstanceIDFromProcessID(This,lProcessID,pbstrApplicationInstanceID) (This)->lpVtbl->GetApplicationInstanceIDFromProcessID(This,lProcessID,pbstrApplicationInstanceID) +#define ICOMAdminCatalog2_ShutdownApplicationInstances(This,pVarApplicationInstanceID) (This)->lpVtbl->ShutdownApplicationInstances(This,pVarApplicationInstanceID) +#define ICOMAdminCatalog2_PauseApplicationInstances(This,pVarApplicationInstanceID) (This)->lpVtbl->PauseApplicationInstances(This,pVarApplicationInstanceID) +#define ICOMAdminCatalog2_ResumeApplicationInstances(This,pVarApplicationInstanceID) (This)->lpVtbl->ResumeApplicationInstances(This,pVarApplicationInstanceID) +#define ICOMAdminCatalog2_RecycleApplicationInstances(This,pVarApplicationInstanceID,lReasonCode) (This)->lpVtbl->RecycleApplicationInstances(This,pVarApplicationInstanceID,lReasonCode) +#define ICOMAdminCatalog2_AreApplicationInstancesPaused(This,pVarApplicationInstanceID,pVarBoolPaused) (This)->lpVtbl->AreApplicationInstancesPaused(This,pVarApplicationInstanceID,pVarBoolPaused) +#define ICOMAdminCatalog2_DumpApplicationInstance(This,bstrApplicationInstanceID,bstrDirectory,lMaxImages,pbstrDumpFile) (This)->lpVtbl->DumpApplicationInstance(This,bstrApplicationInstanceID,bstrDirectory,lMaxImages,pbstrDumpFile) +#define ICOMAdminCatalog2_get_IsApplicationInstanceDumpSupported(This,pVarBoolDumpSupported) (This)->lpVtbl->get_IsApplicationInstanceDumpSupported(This,pVarBoolDumpSupported) +#define ICOMAdminCatalog2_CreateServiceForApplication(This,bstrApplicationIDOrName,bstrServiceName,bstrStartType,bstrErrorControl,bstrDependencies,bstrRunAs,bstrPassword,bDesktopOk) (This)->lpVtbl->CreateServiceForApplication(This,bstrApplicationIDOrName,bstrServiceName,bstrStartType,bstrErrorControl,bstrDependencies,bstrRunAs,bstrPassword,bDesktopOk) +#define ICOMAdminCatalog2_DeleteServiceForApplication(This,bstrApplicationIDOrName) (This)->lpVtbl->DeleteServiceForApplication(This,bstrApplicationIDOrName) +#define ICOMAdminCatalog2_GetPartitionID(This,bstrApplicationIDOrName,pbstrPartitionID) (This)->lpVtbl->GetPartitionID(This,bstrApplicationIDOrName,pbstrPartitionID) +#define ICOMAdminCatalog2_GetPartitionName(This,bstrApplicationIDOrName,pbstrPartitionName) (This)->lpVtbl->GetPartitionName(This,bstrApplicationIDOrName,pbstrPartitionName) +#define ICOMAdminCatalog2_put_CurrentPartition(This,bstrPartitionIDOrName) (This)->lpVtbl->put_CurrentPartition(This,bstrPartitionIDOrName) +#define ICOMAdminCatalog2_get_CurrentPartitionID(This,pbstrPartitionID) (This)->lpVtbl->get_CurrentPartitionID(This,pbstrPartitionID) +#define ICOMAdminCatalog2_get_CurrentPartitionName(This,pbstrPartitionName) (This)->lpVtbl->get_CurrentPartitionName(This,pbstrPartitionName) +#define ICOMAdminCatalog2_get_GlobalPartitionID(This,pbstrGlobalPartitionID) (This)->lpVtbl->get_GlobalPartitionID(This,pbstrGlobalPartitionID) +#define ICOMAdminCatalog2_FlushPartitionCache(This) (This)->lpVtbl->FlushPartitionCache(This) +#define ICOMAdminCatalog2_CopyApplications(This,bstrSourcePartitionIDOrName,pVarApplicationID,bstrDestinationPartitionIDOrName) (This)->lpVtbl->CopyApplications(This,bstrSourcePartitionIDOrName,pVarApplicationID,bstrDestinationPartitionIDOrName) +#define ICOMAdminCatalog2_CopyComponents(This,bstrSourceApplicationIDOrName,pVarCLSIDOrProgID,bstrDestinationApplicationIDOrName) (This)->lpVtbl->CopyComponents(This,bstrSourceApplicationIDOrName,pVarCLSIDOrProgID,bstrDestinationApplicationIDOrName) +#define ICOMAdminCatalog2_MoveComponents(This,bstrSourceApplicationIDOrName,pVarCLSIDOrProgID,bstrDestinationApplicationIDOrName) (This)->lpVtbl->MoveComponents(This,bstrSourceApplicationIDOrName,pVarCLSIDOrProgID,bstrDestinationApplicationIDOrName) +#define ICOMAdminCatalog2_AliasComponent(This,bstrSrcApplicationIDOrName,bstrCLSIDOrProgID,bstrDestApplicationIDOrName,bstrNewProgId,bstrNewClsid) (This)->lpVtbl->AliasComponent(This,bstrSrcApplicationIDOrName,bstrCLSIDOrProgID,bstrDestApplicationIDOrName,bstrNewProgId,bstrNewClsid) +#define ICOMAdminCatalog2_IsSafeToDelete(This,bstrDllName,pCOMAdminInUse) (This)->lpVtbl->IsSafeToDelete(This,bstrDllName,pCOMAdminInUse) +#define ICOMAdminCatalog2_ImportUnconfiguredComponents(This,bstrApplicationIDOrName,pVarCLSIDOrProgID,pVarComponentType) (This)->lpVtbl->ImportUnconfiguredComponents(This,bstrApplicationIDOrName,pVarCLSIDOrProgID,pVarComponentType) +#define ICOMAdminCatalog2_PromoteUnconfiguredComponents(This,bstrApplicationIDOrName,pVarCLSIDOrProgID,pVarComponentType) (This)->lpVtbl->PromoteUnconfiguredComponents(This,bstrApplicationIDOrName,pVarCLSIDOrProgID,pVarComponentType) +#define ICOMAdminCatalog2_ImportComponents(This,bstrApplicationIDOrName,pVarCLSIDOrProgID,pVarComponentType) (This)->lpVtbl->ImportComponents(This,bstrApplicationIDOrName,pVarCLSIDOrProgID,pVarComponentType) +#define ICOMAdminCatalog2_get_Is64BitCatalogServer(This,pbIs64Bit) (This)->lpVtbl->get_Is64BitCatalogServer(This,pbIs64Bit) +#define ICOMAdminCatalog2_ExportPartition(This,bstrPartitionIDOrName,bstrPartitionFileName,lOptions) (This)->lpVtbl->ExportPartition(This,bstrPartitionIDOrName,bstrPartitionFileName,lOptions) +#define ICOMAdminCatalog2_InstallPartition(This,bstrFileName,bstrDestDirectory,lOptions,bstrUserID,bstrPassword,bstrRSN) (This)->lpVtbl->InstallPartition(This,bstrFileName,bstrDestDirectory,lOptions,bstrUserID,bstrPassword,bstrRSN) +#define ICOMAdminCatalog2_QueryApplicationFile2(This,bstrApplicationFile,ppFilesForImport) (This)->lpVtbl->QueryApplicationFile2(This,bstrApplicationFile,ppFilesForImport) +#define ICOMAdminCatalog2_GetComponentVersionCount(This,bstrCLSIDOrProgID,plVersionCount) (This)->lpVtbl->GetComponentVersionCount(This,bstrCLSIDOrProgID,plVersionCount) +#endif +#endif + HRESULT WINAPI ICOMAdminCatalog2_GetCollectionByQuery2_Proxy(ICOMAdminCatalog2 *This,BSTR bstrCollectionName,VARIANT *pVarQueryStrings,IDispatch **ppCatalogCollection); + void __RPC_STUB ICOMAdminCatalog2_GetCollectionByQuery2_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_GetApplicationInstanceIDFromProcessID_Proxy(ICOMAdminCatalog2 *This,long lProcessID,BSTR *pbstrApplicationInstanceID); + void __RPC_STUB ICOMAdminCatalog2_GetApplicationInstanceIDFromProcessID_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_ShutdownApplicationInstances_Proxy(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID); + void __RPC_STUB ICOMAdminCatalog2_ShutdownApplicationInstances_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_PauseApplicationInstances_Proxy(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID); + void __RPC_STUB ICOMAdminCatalog2_PauseApplicationInstances_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_ResumeApplicationInstances_Proxy(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID); + void __RPC_STUB ICOMAdminCatalog2_ResumeApplicationInstances_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_RecycleApplicationInstances_Proxy(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID,long lReasonCode); + void __RPC_STUB ICOMAdminCatalog2_RecycleApplicationInstances_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_AreApplicationInstancesPaused_Proxy(ICOMAdminCatalog2 *This,VARIANT *pVarApplicationInstanceID,VARIANT_BOOL *pVarBoolPaused); + void __RPC_STUB ICOMAdminCatalog2_AreApplicationInstancesPaused_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_DumpApplicationInstance_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationInstanceID,BSTR bstrDirectory,long lMaxImages,BSTR *pbstrDumpFile); + void __RPC_STUB ICOMAdminCatalog2_DumpApplicationInstance_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_get_IsApplicationInstanceDumpSupported_Proxy(ICOMAdminCatalog2 *This,VARIANT_BOOL *pVarBoolDumpSupported); + void __RPC_STUB ICOMAdminCatalog2_get_IsApplicationInstanceDumpSupported_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_CreateServiceForApplication_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,BSTR bstrServiceName,BSTR bstrStartType,BSTR bstrErrorControl,BSTR bstrDependencies,BSTR bstrRunAs,BSTR bstrPassword,VARIANT_BOOL bDesktopOk); + void __RPC_STUB ICOMAdminCatalog2_CreateServiceForApplication_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_DeleteServiceForApplication_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName); + void __RPC_STUB ICOMAdminCatalog2_DeleteServiceForApplication_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_GetPartitionID_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,BSTR *pbstrPartitionID); + void __RPC_STUB ICOMAdminCatalog2_GetPartitionID_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_GetPartitionName_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,BSTR *pbstrPartitionName); + void __RPC_STUB ICOMAdminCatalog2_GetPartitionName_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_put_CurrentPartition_Proxy(ICOMAdminCatalog2 *This,BSTR bstrPartitionIDOrName); + void __RPC_STUB ICOMAdminCatalog2_put_CurrentPartition_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_get_CurrentPartitionID_Proxy(ICOMAdminCatalog2 *This,BSTR *pbstrPartitionID); + void __RPC_STUB ICOMAdminCatalog2_get_CurrentPartitionID_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_get_CurrentPartitionName_Proxy(ICOMAdminCatalog2 *This,BSTR *pbstrPartitionName); + void __RPC_STUB ICOMAdminCatalog2_get_CurrentPartitionName_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_get_GlobalPartitionID_Proxy(ICOMAdminCatalog2 *This,BSTR *pbstrGlobalPartitionID); + void __RPC_STUB ICOMAdminCatalog2_get_GlobalPartitionID_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_FlushPartitionCache_Proxy(ICOMAdminCatalog2 *This); + void __RPC_STUB ICOMAdminCatalog2_FlushPartitionCache_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_CopyApplications_Proxy(ICOMAdminCatalog2 *This,BSTR bstrSourcePartitionIDOrName,VARIANT *pVarApplicationID,BSTR bstrDestinationPartitionIDOrName); + void __RPC_STUB ICOMAdminCatalog2_CopyApplications_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_CopyComponents_Proxy(ICOMAdminCatalog2 *This,BSTR bstrSourceApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,BSTR bstrDestinationApplicationIDOrName); + void __RPC_STUB ICOMAdminCatalog2_CopyComponents_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_MoveComponents_Proxy(ICOMAdminCatalog2 *This,BSTR bstrSourceApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,BSTR bstrDestinationApplicationIDOrName); + void __RPC_STUB ICOMAdminCatalog2_MoveComponents_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_AliasComponent_Proxy(ICOMAdminCatalog2 *This,BSTR bstrSrcApplicationIDOrName,BSTR bstrCLSIDOrProgID,BSTR bstrDestApplicationIDOrName,BSTR bstrNewProgId,BSTR bstrNewClsid); + void __RPC_STUB ICOMAdminCatalog2_AliasComponent_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_IsSafeToDelete_Proxy(ICOMAdminCatalog2 *This,BSTR bstrDllName,COMAdminInUse *pCOMAdminInUse); + void __RPC_STUB ICOMAdminCatalog2_IsSafeToDelete_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_ImportUnconfiguredComponents_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType); + void __RPC_STUB ICOMAdminCatalog2_ImportUnconfiguredComponents_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_PromoteUnconfiguredComponents_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType); + void __RPC_STUB ICOMAdminCatalog2_PromoteUnconfiguredComponents_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_ImportComponents_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationIDOrName,VARIANT *pVarCLSIDOrProgID,VARIANT *pVarComponentType); + void __RPC_STUB ICOMAdminCatalog2_ImportComponents_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_get_Is64BitCatalogServer_Proxy(ICOMAdminCatalog2 *This,VARIANT_BOOL *pbIs64Bit); + void __RPC_STUB ICOMAdminCatalog2_get_Is64BitCatalogServer_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_ExportPartition_Proxy(ICOMAdminCatalog2 *This,BSTR bstrPartitionIDOrName,BSTR bstrPartitionFileName,long lOptions); + void __RPC_STUB ICOMAdminCatalog2_ExportPartition_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_InstallPartition_Proxy(ICOMAdminCatalog2 *This,BSTR bstrFileName,BSTR bstrDestDirectory,long lOptions,BSTR bstrUserID,BSTR bstrPassword,BSTR bstrRSN); + void __RPC_STUB ICOMAdminCatalog2_InstallPartition_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_QueryApplicationFile2_Proxy(ICOMAdminCatalog2 *This,BSTR bstrApplicationFile,IDispatch **ppFilesForImport); + void __RPC_STUB ICOMAdminCatalog2_QueryApplicationFile2_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICOMAdminCatalog2_GetComponentVersionCount_Proxy(ICOMAdminCatalog2 *This,BSTR bstrCLSIDOrProgID,long *plVersionCount); + void __RPC_STUB ICOMAdminCatalog2_GetComponentVersionCount_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); +#endif + +#ifndef __ICatalogObject_INTERFACE_DEFINED__ +#define __ICatalogObject_INTERFACE_DEFINED__ + EXTERN_C const IID IID_ICatalogObject; +#if defined(__cplusplus) && !defined(CINTERFACE) + struct ICatalogObject : public IDispatch { + public: + virtual HRESULT WINAPI get_Value(BSTR bstrPropName,VARIANT *pvarRetVal) = 0; + virtual HRESULT WINAPI put_Value(BSTR bstrPropName,VARIANT val) = 0; + virtual HRESULT WINAPI get_Key(VARIANT *pvarRetVal) = 0; + virtual HRESULT WINAPI get_Name(VARIANT *pvarRetVal) = 0; + virtual HRESULT WINAPI IsPropertyReadOnly(BSTR bstrPropName,VARIANT_BOOL *pbRetVal) = 0; + virtual HRESULT WINAPI get_Valid(VARIANT_BOOL *pbRetVal) = 0; + virtual HRESULT WINAPI IsPropertyWriteOnly(BSTR bstrPropName,VARIANT_BOOL *pbRetVal) = 0; + }; +#else + typedef struct ICatalogObjectVtbl { + BEGIN_INTERFACE + HRESULT (WINAPI *QueryInterface)(ICatalogObject *This,REFIID riid,void **ppvObject); + ULONG (WINAPI *AddRef)(ICatalogObject *This); + ULONG (WINAPI *Release)(ICatalogObject *This); + HRESULT (WINAPI *GetTypeInfoCount)(ICatalogObject *This,UINT *pctinfo); + HRESULT (WINAPI *GetTypeInfo)(ICatalogObject *This,UINT iTInfo,LCID lcid,ITypeInfo **ppTInfo); + HRESULT (WINAPI *GetIDsOfNames)(ICatalogObject *This,REFIID riid,LPOLESTR *rgszNames,UINT cNames,LCID lcid,DISPID *rgDispId); + HRESULT (WINAPI *Invoke)(ICatalogObject *This,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr); + HRESULT (WINAPI *get_Value)(ICatalogObject *This,BSTR bstrPropName,VARIANT *pvarRetVal); + HRESULT (WINAPI *put_Value)(ICatalogObject *This,BSTR bstrPropName,VARIANT val); + HRESULT (WINAPI *get_Key)(ICatalogObject *This,VARIANT *pvarRetVal); + HRESULT (WINAPI *get_Name)(ICatalogObject *This,VARIANT *pvarRetVal); + HRESULT (WINAPI *IsPropertyReadOnly)(ICatalogObject *This,BSTR bstrPropName,VARIANT_BOOL *pbRetVal); + HRESULT (WINAPI *get_Valid)(ICatalogObject *This,VARIANT_BOOL *pbRetVal); + HRESULT (WINAPI *IsPropertyWriteOnly)(ICatalogObject *This,BSTR bstrPropName,VARIANT_BOOL *pbRetVal); + END_INTERFACE + } ICatalogObjectVtbl; + struct ICatalogObject { + CONST_VTBL struct ICatalogObjectVtbl *lpVtbl; + }; +#ifdef COBJMACROS +#define ICatalogObject_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) +#define ICatalogObject_AddRef(This) (This)->lpVtbl->AddRef(This) +#define ICatalogObject_Release(This) (This)->lpVtbl->Release(This) +#define ICatalogObject_GetTypeInfoCount(This,pctinfo) (This)->lpVtbl->GetTypeInfoCount(This,pctinfo) +#define ICatalogObject_GetTypeInfo(This,iTInfo,lcid,ppTInfo) (This)->lpVtbl->GetTypeInfo(This,iTInfo,lcid,ppTInfo) +#define ICatalogObject_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) (This)->lpVtbl->GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) +#define ICatalogObject_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) (This)->lpVtbl->Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) +#define ICatalogObject_get_Value(This,bstrPropName,pvarRetVal) (This)->lpVtbl->get_Value(This,bstrPropName,pvarRetVal) +#define ICatalogObject_put_Value(This,bstrPropName,val) (This)->lpVtbl->put_Value(This,bstrPropName,val) +#define ICatalogObject_get_Key(This,pvarRetVal) (This)->lpVtbl->get_Key(This,pvarRetVal) +#define ICatalogObject_get_Name(This,pvarRetVal) (This)->lpVtbl->get_Name(This,pvarRetVal) +#define ICatalogObject_IsPropertyReadOnly(This,bstrPropName,pbRetVal) (This)->lpVtbl->IsPropertyReadOnly(This,bstrPropName,pbRetVal) +#define ICatalogObject_get_Valid(This,pbRetVal) (This)->lpVtbl->get_Valid(This,pbRetVal) +#define ICatalogObject_IsPropertyWriteOnly(This,bstrPropName,pbRetVal) (This)->lpVtbl->IsPropertyWriteOnly(This,bstrPropName,pbRetVal) +#endif +#endif + HRESULT WINAPI ICatalogObject_get_Value_Proxy(ICatalogObject *This,BSTR bstrPropName,VARIANT *pvarRetVal); + void __RPC_STUB ICatalogObject_get_Value_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogObject_put_Value_Proxy(ICatalogObject *This,BSTR bstrPropName,VARIANT val); + void __RPC_STUB ICatalogObject_put_Value_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogObject_get_Key_Proxy(ICatalogObject *This,VARIANT *pvarRetVal); + void __RPC_STUB ICatalogObject_get_Key_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogObject_get_Name_Proxy(ICatalogObject *This,VARIANT *pvarRetVal); + void __RPC_STUB ICatalogObject_get_Name_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogObject_IsPropertyReadOnly_Proxy(ICatalogObject *This,BSTR bstrPropName,VARIANT_BOOL *pbRetVal); + void __RPC_STUB ICatalogObject_IsPropertyReadOnly_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogObject_get_Valid_Proxy(ICatalogObject *This,VARIANT_BOOL *pbRetVal); + void __RPC_STUB ICatalogObject_get_Valid_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogObject_IsPropertyWriteOnly_Proxy(ICatalogObject *This,BSTR bstrPropName,VARIANT_BOOL *pbRetVal); + void __RPC_STUB ICatalogObject_IsPropertyWriteOnly_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); +#endif + +#ifndef __ICatalogCollection_INTERFACE_DEFINED__ +#define __ICatalogCollection_INTERFACE_DEFINED__ + EXTERN_C const IID IID_ICatalogCollection; +#if defined(__cplusplus) && !defined(CINTERFACE) + struct ICatalogCollection : public IDispatch { + public: + virtual HRESULT WINAPI get__NewEnum(IUnknown **ppEnumVariant) = 0; + virtual HRESULT WINAPI get_Item(long lIndex,IDispatch **ppCatalogObject) = 0; + virtual HRESULT WINAPI get_Count(long *plObjectCount) = 0; + virtual HRESULT WINAPI Remove(long lIndex) = 0; + virtual HRESULT WINAPI Add(IDispatch **ppCatalogObject) = 0; + virtual HRESULT WINAPI Populate(void) = 0; + virtual HRESULT WINAPI SaveChanges(long *pcChanges) = 0; + virtual HRESULT WINAPI GetCollection(BSTR bstrCollName,VARIANT varObjectKey,IDispatch **ppCatalogCollection) = 0; + virtual HRESULT WINAPI get_Name(VARIANT *pVarNamel) = 0; + virtual HRESULT WINAPI get_AddEnabled(VARIANT_BOOL *pVarBool) = 0; + virtual HRESULT WINAPI get_RemoveEnabled(VARIANT_BOOL *pVarBool) = 0; + virtual HRESULT WINAPI GetUtilInterface(IDispatch **ppIDispatch) = 0; + virtual HRESULT WINAPI get_DataStoreMajorVersion(long *plMajorVersion) = 0; + virtual HRESULT WINAPI get_DataStoreMinorVersion(long *plMinorVersionl) = 0; + virtual HRESULT WINAPI PopulateByKey(SAFEARRAY *psaKeys) = 0; + virtual HRESULT WINAPI PopulateByQuery(BSTR bstrQueryString,long lQueryType) = 0; + }; +#else + typedef struct ICatalogCollectionVtbl { + BEGIN_INTERFACE + HRESULT (WINAPI *QueryInterface)(ICatalogCollection *This,REFIID riid,void **ppvObject); + ULONG (WINAPI *AddRef)(ICatalogCollection *This); + ULONG (WINAPI *Release)(ICatalogCollection *This); + HRESULT (WINAPI *GetTypeInfoCount)(ICatalogCollection *This,UINT *pctinfo); + HRESULT (WINAPI *GetTypeInfo)(ICatalogCollection *This,UINT iTInfo,LCID lcid,ITypeInfo **ppTInfo); + HRESULT (WINAPI *GetIDsOfNames)(ICatalogCollection *This,REFIID riid,LPOLESTR *rgszNames,UINT cNames,LCID lcid,DISPID *rgDispId); + HRESULT (WINAPI *Invoke)(ICatalogCollection *This,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr); + HRESULT (WINAPI *get__NewEnum)(ICatalogCollection *This,IUnknown **ppEnumVariant); + HRESULT (WINAPI *get_Item)(ICatalogCollection *This,long lIndex,IDispatch **ppCatalogObject); + HRESULT (WINAPI *get_Count)(ICatalogCollection *This,long *plObjectCount); + HRESULT (WINAPI *Remove)(ICatalogCollection *This,long lIndex); + HRESULT (WINAPI *Add)(ICatalogCollection *This,IDispatch **ppCatalogObject); + HRESULT (WINAPI *Populate)(ICatalogCollection *This); + HRESULT (WINAPI *SaveChanges)(ICatalogCollection *This,long *pcChanges); + HRESULT (WINAPI *GetCollection)(ICatalogCollection *This,BSTR bstrCollName,VARIANT varObjectKey,IDispatch **ppCatalogCollection); + HRESULT (WINAPI *get_Name)(ICatalogCollection *This,VARIANT *pVarNamel); + HRESULT (WINAPI *get_AddEnabled)(ICatalogCollection *This,VARIANT_BOOL *pVarBool); + HRESULT (WINAPI *get_RemoveEnabled)(ICatalogCollection *This,VARIANT_BOOL *pVarBool); + HRESULT (WINAPI *GetUtilInterface)(ICatalogCollection *This,IDispatch **ppIDispatch); + HRESULT (WINAPI *get_DataStoreMajorVersion)(ICatalogCollection *This,long *plMajorVersion); + HRESULT (WINAPI *get_DataStoreMinorVersion)(ICatalogCollection *This,long *plMinorVersionl); + HRESULT (WINAPI *PopulateByKey)(ICatalogCollection *This,SAFEARRAY *psaKeys); + HRESULT (WINAPI *PopulateByQuery)(ICatalogCollection *This,BSTR bstrQueryString,long lQueryType); + END_INTERFACE + } ICatalogCollectionVtbl; + struct ICatalogCollection { + CONST_VTBL struct ICatalogCollectionVtbl *lpVtbl; + }; +#ifdef COBJMACROS +#define ICatalogCollection_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) +#define ICatalogCollection_AddRef(This) (This)->lpVtbl->AddRef(This) +#define ICatalogCollection_Release(This) (This)->lpVtbl->Release(This) +#define ICatalogCollection_GetTypeInfoCount(This,pctinfo) (This)->lpVtbl->GetTypeInfoCount(This,pctinfo) +#define ICatalogCollection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) (This)->lpVtbl->GetTypeInfo(This,iTInfo,lcid,ppTInfo) +#define ICatalogCollection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) (This)->lpVtbl->GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) +#define ICatalogCollection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) (This)->lpVtbl->Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) +#define ICatalogCollection_get__NewEnum(This,ppEnumVariant) (This)->lpVtbl->get__NewEnum(This,ppEnumVariant) +#define ICatalogCollection_get_Item(This,lIndex,ppCatalogObject) (This)->lpVtbl->get_Item(This,lIndex,ppCatalogObject) +#define ICatalogCollection_get_Count(This,plObjectCount) (This)->lpVtbl->get_Count(This,plObjectCount) +#define ICatalogCollection_Remove(This,lIndex) (This)->lpVtbl->Remove(This,lIndex) +#define ICatalogCollection_Add(This,ppCatalogObject) (This)->lpVtbl->Add(This,ppCatalogObject) +#define ICatalogCollection_Populate(This) (This)->lpVtbl->Populate(This) +#define ICatalogCollection_SaveChanges(This,pcChanges) (This)->lpVtbl->SaveChanges(This,pcChanges) +#define ICatalogCollection_GetCollection(This,bstrCollName,varObjectKey,ppCatalogCollection) (This)->lpVtbl->GetCollection(This,bstrCollName,varObjectKey,ppCatalogCollection) +#define ICatalogCollection_get_Name(This,pVarNamel) (This)->lpVtbl->get_Name(This,pVarNamel) +#define ICatalogCollection_get_AddEnabled(This,pVarBool) (This)->lpVtbl->get_AddEnabled(This,pVarBool) +#define ICatalogCollection_get_RemoveEnabled(This,pVarBool) (This)->lpVtbl->get_RemoveEnabled(This,pVarBool) +#define ICatalogCollection_GetUtilInterface(This,ppIDispatch) (This)->lpVtbl->GetUtilInterface(This,ppIDispatch) +#define ICatalogCollection_get_DataStoreMajorVersion(This,plMajorVersion) (This)->lpVtbl->get_DataStoreMajorVersion(This,plMajorVersion) +#define ICatalogCollection_get_DataStoreMinorVersion(This,plMinorVersionl) (This)->lpVtbl->get_DataStoreMinorVersion(This,plMinorVersionl) +#define ICatalogCollection_PopulateByKey(This,psaKeys) (This)->lpVtbl->PopulateByKey(This,psaKeys) +#define ICatalogCollection_PopulateByQuery(This,bstrQueryString,lQueryType) (This)->lpVtbl->PopulateByQuery(This,bstrQueryString,lQueryType) +#endif +#endif + HRESULT WINAPI ICatalogCollection_get__NewEnum_Proxy(ICatalogCollection *This,IUnknown **ppEnumVariant); + void __RPC_STUB ICatalogCollection_get__NewEnum_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_get_Item_Proxy(ICatalogCollection *This,long lIndex,IDispatch **ppCatalogObject); + void __RPC_STUB ICatalogCollection_get_Item_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_get_Count_Proxy(ICatalogCollection *This,long *plObjectCount); + void __RPC_STUB ICatalogCollection_get_Count_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_Remove_Proxy(ICatalogCollection *This,long lIndex); + void __RPC_STUB ICatalogCollection_Remove_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_Add_Proxy(ICatalogCollection *This,IDispatch **ppCatalogObject); + void __RPC_STUB ICatalogCollection_Add_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_Populate_Proxy(ICatalogCollection *This); + void __RPC_STUB ICatalogCollection_Populate_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_SaveChanges_Proxy(ICatalogCollection *This,long *pcChanges); + void __RPC_STUB ICatalogCollection_SaveChanges_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_GetCollection_Proxy(ICatalogCollection *This,BSTR bstrCollName,VARIANT varObjectKey,IDispatch **ppCatalogCollection); + void __RPC_STUB ICatalogCollection_GetCollection_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_get_Name_Proxy(ICatalogCollection *This,VARIANT *pVarNamel); + void __RPC_STUB ICatalogCollection_get_Name_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_get_AddEnabled_Proxy(ICatalogCollection *This,VARIANT_BOOL *pVarBool); + void __RPC_STUB ICatalogCollection_get_AddEnabled_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_get_RemoveEnabled_Proxy(ICatalogCollection *This,VARIANT_BOOL *pVarBool); + void __RPC_STUB ICatalogCollection_get_RemoveEnabled_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_GetUtilInterface_Proxy(ICatalogCollection *This,IDispatch **ppIDispatch); + void __RPC_STUB ICatalogCollection_GetUtilInterface_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_get_DataStoreMajorVersion_Proxy(ICatalogCollection *This,long *plMajorVersion); + void __RPC_STUB ICatalogCollection_get_DataStoreMajorVersion_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_get_DataStoreMinorVersion_Proxy(ICatalogCollection *This,long *plMinorVersionl); + void __RPC_STUB ICatalogCollection_get_DataStoreMinorVersion_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_PopulateByKey_Proxy(ICatalogCollection *This,SAFEARRAY *psaKeys); + void __RPC_STUB ICatalogCollection_PopulateByKey_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); + HRESULT WINAPI ICatalogCollection_PopulateByQuery_Proxy(ICatalogCollection *This,BSTR bstrQueryString,long lQueryType); + void __RPC_STUB ICatalogCollection_PopulateByQuery_Stub(IRpcStubBuffer *This,IRpcChannelBuffer *_pRpcChannelBuffer,PRPC_MESSAGE _pRpcMessage,DWORD *_pdwStubPhase); +#endif + +#ifndef __COMAdmin_LIBRARY_DEFINED__ +#define __COMAdmin_LIBRARY_DEFINED__ + typedef enum COMAdminComponentType { + COMAdmin32BitComponent = 0x1,COMAdmin64BitComponent = 0x2 + } COMAdminComponentType; + + typedef enum COMAdminApplicationInstallOptions { + COMAdminInstallNoUsers = 0,COMAdminInstallUsers = 1,COMAdminInstallForceOverwriteOfFiles = 2 + } COMAdminApplicationInstallOptions; + + typedef enum COMAdminApplicationExportOptions { + COMAdminExportNoUsers = 0,COMAdminExportUsers = 1,COMAdminExportApplicationProxy = 2,COMAdminExportForceOverwriteOfFiles = 4, + COMAdminExportIn10Format = 16 + } COMAdminApplicationExportOptions; + + typedef enum COMAdminThreadingModels { + COMAdminThreadingModelApartment = 0,COMAdminThreadingModelFree = 1,COMAdminThreadingModelMain = 2,COMAdminThreadingModelBoth = 3, + COMAdminThreadingModelNeutral = 4,COMAdminThreadingModelNotSpecified = 5 + } COMAdminThreadingModels; + + typedef enum COMAdminTransactionOptions { + COMAdminTransactionIgnored = 0,COMAdminTransactionNone = 1,COMAdminTransactionSupported = 2,COMAdminTransactionRequired = 3, + COMAdminTransactionRequiresNew = 4 + } COMAdminTransactionOptions; + + typedef enum COMAdminTxIsolationLevelOptions { + COMAdminTxIsolationLevelAny = 0,COMAdminTxIsolationLevelReadUnCommitted = COMAdminTxIsolationLevelAny + 1, + COMAdminTxIsolationLevelReadCommitted = COMAdminTxIsolationLevelReadUnCommitted + 1, + COMAdminTxIsolationLevelRepeatableRead = COMAdminTxIsolationLevelReadCommitted + 1, + COMAdminTxIsolationLevelSerializable = COMAdminTxIsolationLevelRepeatableRead + 1 + } COMAdminTxIsolationLevelOptions; + + typedef enum COMAdminSynchronizationOptions { + COMAdminSynchronizationIgnored = 0,COMAdminSynchronizationNone = 1,COMAdminSynchronizationSupported = 2,COMAdminSynchronizationRequired = 3, + COMAdminSynchronizationRequiresNew = 4 + } COMAdminSynchronizationOptions; + + typedef enum COMAdminActivationOptions { + COMAdminActivationInproc = 0,COMAdminActivationLocal = 1 + } COMAdminActivationOptions; + + typedef enum COMAdminAccessChecksLevelOptions { + COMAdminAccessChecksApplicationLevel = 0,COMAdminAccessChecksApplicationComponentLevel = 1 + } COMAdminAccessChecksLevelOptions; + + typedef enum COMAdminAuthenticationLevelOptions { + COMAdminAuthenticationDefault = 0,COMAdminAuthenticationNone = 1,COMAdminAuthenticationConnect = 2,COMAdminAuthenticationCall = 3, + COMAdminAuthenticationPacket = 4,COMAdminAuthenticationIntegrity = 5,COMAdminAuthenticationPrivacy = 6 + } COMAdminAuthenticationLevelOptions; + + typedef enum COMAdminImpersonationLevelOptions { + COMAdminImpersonationAnonymous = 1,COMAdminImpersonationIdentify = 2,COMAdminImpersonationImpersonate = 3,COMAdminImpersonationDelegate = 4 + } COMAdminImpersonationLevelOptions; + + typedef enum COMAdminAuthenticationCapabilitiesOptions { + COMAdminAuthenticationCapabilitiesNone = 0,COMAdminAuthenticationCapabilitiesSecureReference = 0x2, + COMAdminAuthenticationCapabilitiesStaticCloaking = 0x20,COMAdminAuthenticationCapabilitiesDynamicCloaking = 0x40 + } COMAdminAuthenticationCapabilitiesOptions; + + typedef enum COMAdminOS { + COMAdminOSNotInitialized = 0,COMAdminOSWindows3_1 = 1,COMAdminOSWindows9x = 2,COMAdminOSWindows2000 = 3, + COMAdminOSWindows2000AdvancedServer = 4,COMAdminOSWindows2000Unknown = 5,COMAdminOSUnknown = 6,COMAdminOSWindowsXPPersonal = 11, + COMAdminOSWindowsXPProfessional = 12,COMAdminOSWindowsNETStandardServer = 13,COMAdminOSWindowsNETEnterpriseServer = 14, + COMAdminOSWindowsNETDatacenterServer = 15,COMAdminOSWindowsNETWebServer = 16,COMAdminOSWindowsLonghornPersonal = 17, + COMAdminOSWindowsLonghornProfessional = 18,COMAdminOSWindowsLonghornStandardServer = 19,COMAdminOSWindowsLonghornEnterpriseServer = 20, + COMAdminOSWindowsLonghornDatacenterServer = 21,COMAdminOSWindowsLonghornWebServer = 22 + } COMAdminOS; + + typedef enum COMAdminServiceOptions { + COMAdminServiceLoadBalanceRouter = 1 + } COMAdminServiceOptions; + + typedef enum COMAdminServiceStatusOptions { + COMAdminServiceStopped = 0,COMAdminServiceStartPending = COMAdminServiceStopped + 1,COMAdminServiceStopPending = COMAdminServiceStartPending + 1, + COMAdminServiceRunning = COMAdminServiceStopPending + 1,COMAdminServiceContinuePending = COMAdminServiceRunning + 1, + COMAdminServicePausePending = COMAdminServiceContinuePending + 1,COMAdminServicePaused = COMAdminServicePausePending + 1, + COMAdminServiceUnknownState = COMAdminServicePaused + 1 + } COMAdminServiceStatusOptions; + + typedef enum COMAdminQCMessageAuthenticateOptions { + COMAdminQCMessageAuthenticateSecureApps = 0,COMAdminQCMessageAuthenticateOff = 1,COMAdminQCMessageAuthenticateOn = 2 + } COMAdminQCMessageAuthenticateOptions; + + typedef enum COMAdminFileFlags { + COMAdminFileFlagLoadable = 0x1,COMAdminFileFlagCOM = 0x2,COMAdminFileFlagContainsPS = 0x4,COMAdminFileFlagContainsComp = 0x8, + COMAdminFileFlagContainsTLB = 0x10,COMAdminFileFlagSelfReg = 0x20,COMAdminFileFlagSelfUnReg = 0x40,COMAdminFileFlagUnloadableDLL = 0x80, + COMAdminFileFlagDoesNotExist = 0x100,COMAdminFileFlagAlreadyInstalled = 0x200,COMAdminFileFlagBadTLB = 0x400, + COMAdminFileFlagGetClassObjFailed = 0x800,COMAdminFileFlagClassNotAvailable = 0x1000,COMAdminFileFlagRegistrar = 0x2000, + COMAdminFileFlagNoRegistrar = 0x4000,COMAdminFileFlagDLLRegsvrFailed = 0x8000,COMAdminFileFlagRegTLBFailed = 0x10000, + COMAdminFileFlagRegistrarFailed = 0x20000,COMAdminFileFlagError = 0x40000 + } COMAdminFileFlags; + + typedef enum COMAdminComponentFlags { + COMAdminCompFlagTypeInfoFound = 0x1,COMAdminCompFlagCOMPlusPropertiesFound = 0x2,COMAdminCompFlagProxyFound = 0x4, + COMAdminCompFlagInterfacesFound = 0x8,COMAdminCompFlagAlreadyInstalled = 0x10,COMAdminCompFlagNotInApplication = 0x20 + } COMAdminComponentFlags; + +#define COMAdminCollectionRoot ("Root") +#define COMAdminCollectionApplications ("Applications") +#define COMAdminCollectionComponents ("Components") +#define COMAdminCollectionComputerList ("ComputerList") +#define COMAdminCollectionApplicationCluster ("ApplicationCluster") +#define COMAdminCollectionLocalComputer ("LocalComputer") +#define COMAdminCollectionInprocServers ("InprocServers") +#define COMAdminCollectionRelatedCollectionInfo ("RelatedCollectionInfo") +#define COMAdminCollectionPropertyInfo ("PropertyInfo") +#define COMAdminCollectionRoles ("Roles") +#define COMAdminCollectionErrorInfo ("ErrorInfo") +#define COMAdminCollectionInterfacesForComponent ("InterfacesForComponent") +#define COMAdminCollectionRolesForComponent ("RolesForComponent") +#define COMAdminCollectionMethodsForInterface ("MethodsForInterface") +#define COMAdminCollectionRolesForInterface ("RolesForInterface") +#define COMAdminCollectionRolesForMethod ("RolesForMethod") +#define COMAdminCollectionUsersInRole ("UsersInRole") +#define COMAdminCollectionDCOMProtocols ("DCOMProtocols") +#define COMAdminCollectionPartitions ("Partitions") + + enum COMAdminErrorCodes { + COMAdminErrObjectErrors = (HRESULT)0x80110401L,COMAdminErrObjectInvalid = (HRESULT)0x80110402L,COMAdminErrKeyMissing = (HRESULT)0x80110403L, + COMAdminErrAlreadyInstalled = (HRESULT)0x80110404L,COMAdminErrAppFileWriteFail = (HRESULT)0x80110407L, + COMAdminErrAppFileReadFail = (HRESULT)0x80110408L,COMAdminErrAppFileVersion = (HRESULT)0x80110409L,COMAdminErrBadPath = (HRESULT)0x8011040aL, + COMAdminErrApplicationExists = (HRESULT)0x8011040bL,COMAdminErrRoleExists = (HRESULT)0x8011040cL,COMAdminErrCantCopyFile = (HRESULT)0x8011040dL, + COMAdminErrNoUser = (HRESULT)0x8011040fL,COMAdminErrInvalidUserids = (HRESULT)0x80110410L,COMAdminErrNoRegistryCLSID = (HRESULT)0x80110411L, + COMAdminErrBadRegistryProgID = (HRESULT)0x80110412L,COMAdminErrAuthenticationLevel = (HRESULT)0x80110413L, + COMAdminErrUserPasswdNotValid = (HRESULT)0x80110414L,COMAdminErrCLSIDOrIIDMismatch = (HRESULT)0x80110418L, + COMAdminErrRemoteInterface = (HRESULT)0x80110419L,COMAdminErrDllRegisterServer = (HRESULT)0x8011041aL, + COMAdminErrNoServerShare = (HRESULT)0x8011041bL,COMAdminErrDllLoadFailed = (HRESULT)0x8011041dL,COMAdminErrBadRegistryLibID = (HRESULT)0x8011041eL, + COMAdminErrAppDirNotFound = (HRESULT)0x8011041fL,COMAdminErrRegistrarFailed = (HRESULT)0x80110423L, + COMAdminErrCompFileDoesNotExist = (HRESULT)0x80110424L,COMAdminErrCompFileLoadDLLFail = (HRESULT)0x80110425L, + COMAdminErrCompFileGetClassObj = (HRESULT)0x80110426L,COMAdminErrCompFileClassNotAvail = (HRESULT)0x80110427L, + COMAdminErrCompFileBadTLB = (HRESULT)0x80110428L,COMAdminErrCompFileNotInstallable = (HRESULT)0x80110429L, + COMAdminErrNotChangeable = (HRESULT)0x8011042aL,COMAdminErrNotDeletable = (HRESULT)0x8011042bL,COMAdminErrSession = (HRESULT)0x8011042cL, + COMAdminErrCompMoveLocked = (HRESULT)0x8011042dL,COMAdminErrCompMoveBadDest = (HRESULT)0x8011042eL,COMAdminErrRegisterTLB = (HRESULT)0x80110430L, + COMAdminErrSystemApp = (HRESULT)0x80110433L,COMAdminErrCompFileNoRegistrar = (HRESULT)0x80110434L, + COMAdminErrCoReqCompInstalled = (HRESULT)0x80110435L,COMAdminErrServiceNotInstalled = (HRESULT)0x80110436L, + COMAdminErrPropertySaveFailed = (HRESULT)0x80110437L,COMAdminErrObjectExists = (HRESULT)0x80110438L, + COMAdminErrComponentExists = (HRESULT)0x80110439L,COMAdminErrRegFileCorrupt = (HRESULT)0x8011043bL, + COMAdminErrPropertyOverflow = (HRESULT)0x8011043cL,COMAdminErrNotInRegistry = (HRESULT)0x8011043eL, + COMAdminErrObjectNotPoolable = (HRESULT)0x8011043fL,COMAdminErrApplidMatchesClsid = (HRESULT)0x80110446L, + COMAdminErrRoleDoesNotExist = (HRESULT)0x80110447L,COMAdminErrStartAppNeedsComponents = (HRESULT)0x80110448L, + COMAdminErrRequiresDifferentPlatform = (HRESULT)0x80110449L,COMAdminErrQueuingServiceNotAvailable = (HRESULT)0x80110602L, + COMAdminErrObjectParentMissing = (HRESULT)0x80110808L,COMAdminErrObjectDoesNotExist = (HRESULT)0x80110809L, + COMAdminErrCanNotExportAppProxy = (HRESULT)0x8011044aL,COMAdminErrCanNotStartApp = (HRESULT)0x8011044bL, + COMAdminErrCanNotExportSystemApp = (HRESULT)0x8011044cL,COMAdminErrCanNotSubscribeToComponent = (HRESULT)0x8011044dL, + COMAdminErrAppNotRunning = (HRESULT)0x8011080aL,COMAdminErrEventClassCannotBeSubscriber = (HRESULT)0x8011044eL, + COMAdminErrLibAppProxyIncompatible = (HRESULT)0x8011044fL,COMAdminErrBasePartitionOnly = (HRESULT)0x80110450L, + COMAdminErrDuplicatePartitionName = (HRESULT)0x80110457L,COMAdminErrPartitionInUse = (HRESULT)0x80110459L, + COMAdminErrImportedComponentsNotAllowed = (HRESULT)0x8011045bL,COMAdminErrRegdbNotInitialized = (HRESULT)0x80110472L, + COMAdminErrRegdbNotOpen = (HRESULT)0x80110473L,COMAdminErrRegdbSystemErr = (HRESULT)0x80110474L, + COMAdminErrRegdbAlreadyRunning = (HRESULT)0x80110475L,COMAdminErrMigVersionNotSupported = (HRESULT)0x80110480L, + COMAdminErrMigSchemaNotFound = (HRESULT)0x80110481L,COMAdminErrCatBitnessMismatch = (HRESULT)0x80110482L, + COMAdminErrCatUnacceptableBitness = (HRESULT)0x80110483L,COMAdminErrCatWrongAppBitnessBitness = (HRESULT)0x80110484L, + COMAdminErrCatPauseResumeNotSupported = (HRESULT)0x80110485L,COMAdminErrCatServerFault = (HRESULT)0x80110486L, + COMAdminErrCantRecycleLibraryApps = (HRESULT)0x8011080fL,COMAdminErrCantRecycleServiceApps = (HRESULT)0x80110811L, + COMAdminErrProcessAlreadyRecycled = (HRESULT)0x80110812L,COMAdminErrPausedProcessMayNotBeRecycled = (HRESULT)0x80110813L, + COMAdminErrInvalidPartition = (HRESULT)0x8011080bL,COMAdminErrPartitionMsiOnly = (HRESULT)0x80110819L, + COMAdminErrStartAppDisabled = (HRESULT)0x80110451L,COMAdminErrCompMoveSource = (HRESULT)0x8011081cL, + COMAdminErrCompMoveDest = (HRESULT)0x8011081dL,COMAdminErrCompMovePrivate = (HRESULT)0x8011081eL, + COMAdminErrCannotCopyEventClass = (HRESULT)0x80110820L + }; + + EXTERN_C const IID LIBID_COMAdmin; + EXTERN_C const CLSID CLSID_COMAdminCatalog; +#ifdef __cplusplus + class COMAdminCatalog; +#endif + EXTERN_C const CLSID CLSID_COMAdminCatalogObject; +#ifdef __cplusplus + class COMAdminCatalogObject; +#endif + EXTERN_C const CLSID CLSID_COMAdminCatalogCollection; +#ifdef __cplusplus + class COMAdminCatalogCollection; +#endif +#endif + + unsigned long __RPC_API BSTR_UserSize(unsigned long *,unsigned long,BSTR *); + unsigned char *__RPC_API BSTR_UserMarshal(unsigned long *,unsigned char *,BSTR *); + unsigned char *__RPC_API BSTR_UserUnmarshal(unsigned long *,unsigned char *,BSTR *); + void __RPC_API BSTR_UserFree(unsigned long *,BSTR *); + unsigned long __RPC_API LPSAFEARRAY_UserSize(unsigned long *,unsigned long,LPSAFEARRAY *); + unsigned char *__RPC_API LPSAFEARRAY_UserMarshal(unsigned long *,unsigned char *,LPSAFEARRAY *); + unsigned char *__RPC_API LPSAFEARRAY_UserUnmarshal(unsigned long *,unsigned char *,LPSAFEARRAY *); + void __RPC_API LPSAFEARRAY_UserFree(unsigned long *,LPSAFEARRAY *); + unsigned long __RPC_API VARIANT_UserSize(unsigned long *,unsigned long,VARIANT *); + unsigned char *__RPC_API VARIANT_UserMarshal(unsigned long *,unsigned char *,VARIANT *); + unsigned char *__RPC_API VARIANT_UserUnmarshal(unsigned long *,unsigned char *,VARIANT *); + void __RPC_API VARIANT_UserFree(unsigned long *,VARIANT *); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/bacula/src/win32/filed/plugins/dbi_node.c b/bacula/src/win32/filed/plugins/dbi_node.c new file mode 100644 index 0000000000..c02477fb57 --- /dev/null +++ b/bacula/src/win32/filed/plugins/dbi_node.c @@ -0,0 +1,292 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#include "exchange-fd.h" + +dbi_node_t::dbi_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_DATABASE_INFO, parent_node) +{ + restore_display_name = NULL; + restore_input_streams = NULL; + buffer = NULL; +} + +dbi_node_t::~dbi_node_t() +{ + if (buffer != NULL) + delete buffer; + if (restore_input_streams != NULL) + delete restore_input_streams; + if (restore_display_name != NULL) + delete restore_display_name; +} + +bRC +dbi_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + time_t now = time(NULL); + + _DebugMessage(100, "startBackupNode_DBI state = %d\n", state); + + if (context->job_level == 'F') { + sp->fname = full_path; + sp->link = full_path; + sp->statp.st_mode = 0700 | S_IFREG; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = (uint64_t)-1; + sp->type = FT_REG; + return bRC_OK; + } + else + { + bfuncs->setBaculaValue(context->bpContext, bVarFileSeen, (void *)full_path); + return bRC_Seen; + } +} + +bRC +dbi_node_t::endBackupFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endBackupNode_DBI state = %d\n", state); + + context->current_node = parent; + + return bRC_OK; +} + +bRC +dbi_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + _DebugMessage(100, "createFile_DBI state = %d\n", state); + + rp->create_status = CF_EXTRACT; + + return bRC_OK; +} + +bRC +dbi_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endRestoreFile_DBI state = %d\n", state); + + context->current_node = parent; + + return bRC_OK; +} + +bRC +dbi_node_t::pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io) +{ + uint32_t len; + WCHAR *ptr; + WCHAR *stream; + //char tmp[512]; + + buffer_pos = 0; + buffer_size = 65536; + buffer = new char[buffer_size]; + + if (context->job_type == JOB_TYPE_BACKUP) + { + ptr = (WCHAR *)buffer; + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"DatabaseBackupInfo\n"); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"%d\n", EXCHANGE_PLUGIN_VERSION); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"%s\n", dbi->wszDatabaseDisplayName); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", + dbi->rguidDatabase.Data1, dbi->rguidDatabase.Data2, dbi->rguidDatabase.Data3, + dbi->rguidDatabase.Data4[0], dbi->rguidDatabase.Data4[1], + dbi->rguidDatabase.Data4[2], dbi->rguidDatabase.Data4[3], + dbi->rguidDatabase.Data4[4], dbi->rguidDatabase.Data4[5], + dbi->rguidDatabase.Data4[6], dbi->rguidDatabase.Data4[7]); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + + stream = dbi->wszDatabaseStreams; + while (*stream) + { + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"%s\n", stream); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + stream += wcslen(stream) + 1; + } + + buffer_size = buffer_pos; + buffer_pos = 0; + } + + io->status = 0; + io->io_errno = 0; + return bRC_OK; + +fail: + io->status = 0; + io->io_errno = 1; + return bRC_Error; +} + +bRC +dbi_node_t::pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io) +{ + io->status = 0; + io->io_errno = 0; + + io->status = MIN(io->count, (int)(buffer_size - buffer_pos)); + if (io->status == 0) + return bRC_OK; + memcpy(io->buf, buffer + buffer_pos, io->status); + buffer_pos += io->status; + + return bRC_OK; +} + +bRC +dbi_node_t::pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io) +{ + memcpy(&buffer[buffer_pos], io->buf, io->count); + buffer_pos += io->count; + io->status = io->count; + io->io_errno = 0; + return bRC_OK; +} + +bRC +dbi_node_t::pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io) +{ + WCHAR tmp[128]; + WCHAR *ptr; + WCHAR eol; + int wchars_read; + int version; + int stream_buf_count; + WCHAR *streams_start; + + if (context->job_type == JOB_TYPE_RESTORE) + { + // need to think about making this buffer overflow proof... + _DebugMessage(100, "analyzing DatabaseBackupInfo\n"); + ptr = (WCHAR *)buffer; + + if (swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) != 2) + goto restore_fail; + ptr += wchars_read; + _DebugMessage(150, "Header = %S\n", tmp); + // verify that header == "DatabaseBackupInfo" + + if (swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) != 2) + goto restore_fail; + if (swscanf(tmp, L"%d%c", &version, &eol) != 1) + { + version = 0; + _DebugMessage(150, "Version = 0 (inferred)\n"); + } + else + { + ptr += wchars_read; + _DebugMessage(150, "Version = %d\n", version); + if (swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) != 2) + goto restore_fail; + } + restore_display_name = new WCHAR[wchars_read]; + swscanf(ptr, L"%127[^\n]", restore_display_name); + _DebugMessage(150, "Database Display Name = %S\n", restore_display_name); + ptr += wchars_read; + + if (swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) != 2) + goto restore_fail; + + if (swscanf(ptr, L"%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x", + &restore_guid.Data1, &restore_guid.Data2, &restore_guid.Data3, + &restore_guid.Data4[0], &restore_guid.Data4[1], + &restore_guid.Data4[2], &restore_guid.Data4[3], + &restore_guid.Data4[4], &restore_guid.Data4[5], + &restore_guid.Data4[6], &restore_guid.Data4[7]) != 11) + { + goto restore_fail; + } + _DebugMessage(150, "GUID = %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", + restore_guid.Data1, restore_guid.Data2, restore_guid.Data3, + restore_guid.Data4[0], restore_guid.Data4[1], + restore_guid.Data4[2], restore_guid.Data4[3], + restore_guid.Data4[4], restore_guid.Data4[5], + restore_guid.Data4[6], restore_guid.Data4[7]); + + ptr += wchars_read; + + stream_buf_count = 1; + streams_start = ptr; + while (ptr < (WCHAR *)(buffer + buffer_pos) && swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) == 2) + { + _DebugMessage(150, "File = %S\n", tmp); + ptr += wchars_read; + stream_buf_count += wchars_read; + } + restore_input_streams = new WCHAR[stream_buf_count]; + ptr = streams_start; + stream_buf_count = 0; + while (ptr < (WCHAR *)(buffer + buffer_pos) && swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) == 2) + { + snwprintf(&restore_input_streams[stream_buf_count], 65535, L"%s", tmp); + ptr += wchars_read; + stream_buf_count += wchars_read; + } + restore_input_streams[stream_buf_count] = 0; + + _DebugMessage(100, "done analyzing DatabasePluginInfo\n"); + } + delete buffer; + buffer = NULL; + return bRC_OK; +restore_fail: + _JobMessage(M_FATAL, "Format of %s is incorrect", full_path); + delete buffer; + buffer = NULL; + return bRC_Error; +} diff --git a/bacula/src/win32/filed/plugins/exch_api.c b/bacula/src/win32/filed/plugins/exch_api.c new file mode 100644 index 0000000000..82c625bffc --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_api.c @@ -0,0 +1,139 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + * + * Used only in "old Exchange plugin" now deprecated. + */ + +#include "exchange-fd.h" + +HrESEBackupRestoreGetNodes_t HrESEBackupRestoreGetNodes; +HrESEBackupPrepare_t HrESEBackupPrepare; +HrESEBackupGetLogAndPatchFiles_t HrESEBackupGetLogAndPatchFiles; +HrESEBackupTruncateLogs_t HrESEBackupTruncateLogs; +HrESEBackupEnd_t HrESEBackupEnd; +HrESEBackupSetup_t HrESEBackupSetup; +HrESEBackupInstanceEnd_t HrESEBackupInstanceEnd; +HrESEBackupOpenFile_t HrESEBackupOpenFile; +HrESEBackupReadFile_t HrESEBackupReadFile; +HrESEBackupCloseFile_t HrESEBackupCloseFile; + +HrESERestoreOpen_t HrESERestoreOpen; +HrESERestoreReopen_t HrESERestoreReopen; +HrESERestoreComplete_t HrESERestoreComplete; +HrESERestoreClose_t HrESERestoreClose; +HrESERestoreGetEnvironment_t HrESERestoreGetEnvironment; +HrESERestoreSaveEnvironment_t HrESERestoreSaveEnvironment; +HrESERestoreAddDatabase_t HrESERestoreAddDatabase; +HrESERestoreOpenFile_t HrESERestoreOpenFile; + +bRC +loadExchangeApi() +{ + HMODULE h; + LONG status; + HKEY key_handle; + WCHAR *buf; + DWORD buf_len; + DWORD type; + + status = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\BackupRestore\\DLLPaths", &key_handle); + if (status != ERROR_SUCCESS) + { + _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status); + return bRC_Error; + } + + type = REG_EXPAND_SZ; + status = RegQueryValueExW(key_handle, L"esebcli2", NULL, &type, NULL, &buf_len); + if (status != ERROR_SUCCESS) + { + _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status); + return bRC_Error; + } + buf_len += 2; + buf = new WCHAR[buf_len]; + + type = REG_EXPAND_SZ; + status = RegQueryValueExW(key_handle, L"esebcli2", NULL, &type, (LPBYTE)buf, &buf_len); + if (status != ERROR_SUCCESS) + { + _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status); + delete buf; + return bRC_Error; + } + +printf("Got value %S\n", buf); + + // strictly speaking, a REG_EXPAND_SZ should be run through ExpandEnvironmentStrings + + h = LoadLibraryW(buf); + delete buf; + if (!h) { + _JobMessageNull(M_FATAL, "Cannot load Exchange DLL\n"); + return bRC_Error; + } + HrESEBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes_t)GetProcAddress(h, "HrESEBackupRestoreGetNodes"); + HrESEBackupPrepare = (HrESEBackupPrepare_t)GetProcAddress(h, "HrESEBackupPrepare"); + HrESEBackupEnd = (HrESEBackupEnd_t)GetProcAddress(h, "HrESEBackupEnd"); + HrESEBackupSetup = (HrESEBackupSetup_t)GetProcAddress(h, "HrESEBackupSetup"); + HrESEBackupGetLogAndPatchFiles = (HrESEBackupGetLogAndPatchFiles_t)GetProcAddress(h, "HrESEBackupGetLogAndPatchFiles"); + HrESEBackupTruncateLogs = (HrESEBackupTruncateLogs_t)GetProcAddress(h, "HrESEBackupTruncateLogs"); + HrESEBackupInstanceEnd = (HrESEBackupInstanceEnd_t)GetProcAddress(h, "HrESEBackupInstanceEnd"); + HrESEBackupOpenFile = (HrESEBackupOpenFile_t)GetProcAddress(h, "HrESEBackupOpenFile"); + HrESEBackupReadFile = (HrESEBackupReadFile_t)GetProcAddress(h, "HrESEBackupReadFile"); + HrESEBackupCloseFile = (HrESEBackupCloseFile_t)GetProcAddress(h, "HrESEBackupCloseFile"); + HrESERestoreOpen = (HrESERestoreOpen_t)GetProcAddress(h, "HrESERestoreOpen"); + HrESERestoreReopen = (HrESERestoreReopen_t)GetProcAddress(h, "HrESERestoreReopen"); + HrESERestoreComplete = (HrESERestoreComplete_t)GetProcAddress(h, "HrESERestoreComplete"); + HrESERestoreClose = (HrESERestoreClose_t)GetProcAddress(h, "HrESERestoreClose"); + HrESERestoreSaveEnvironment = (HrESERestoreSaveEnvironment_t)GetProcAddress(h, "HrESERestoreSaveEnvironment"); + HrESERestoreGetEnvironment = (HrESERestoreGetEnvironment_t)GetProcAddress(h, "HrESERestoreGetEnvironment"); + HrESERestoreAddDatabase = (HrESERestoreAddDatabase_t)GetProcAddress(h, "HrESERestoreAddDatabase"); + HrESERestoreOpenFile = (HrESERestoreOpenFile_t)GetProcAddress(h, "HrESERestoreOpenFile"); + return bRC_OK; +} + +const char * +ESEErrorMessage(HRESULT result) +{ + switch (result) { + case 0: + return "No error."; + case hrLogfileHasBadSignature: + return "Log file has bad signature. Check that no stale files are left in the Exchange data/log directories."; + case hrCBDatabaseInUse: + return "Database in use. Make sure database is dismounted."; + case hrRestoreAtFileLevel: + return "File must be restored using Windows file I/O calls."; + case hrMissingFullBackup: + return "Exchange reports that no previous full backup has been done."; + case hrBackupInProgress: + return "Exchange backup already in progress."; + case hrLogfileNotContiguous: + return "Existing log file is not contiguous. Check that no stale files are left in the Exchange data/log directories."; + case hrErrorFromESECall: + return "Error returned from ESE function call. Check the Windows Event Logs for more information."; + case hrCBDatabaseNotFound: + return "Database not found. Check that the Database you are trying to restore actually exists in the Storage Group you are restoring to."; + default: + return "Unknown error."; + } +} diff --git a/bacula/src/win32/filed/plugins/exch_api.h b/bacula/src/win32/filed/plugins/exch_api.h new file mode 100644 index 0000000000..4e6b2afd11 --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_api.h @@ -0,0 +1,293 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + */ + +extern "C" { + +#define BACKUP_NODE_TYPE_MACHINE 0x001 +#define BACKUP_NODE_TYPE_ANNOTATION 0x010 +#define BACKUP_NODE_TYPE_DISPLAY 0x100 + +#define ESE_BACKUP_INSTANCE_END_ERROR 0x0 +#define ESE_BACKUP_INSTANCE_END_SUCCESS 0x1 + +#define BACKUP_TYPE_FULL 0x1 +#define BACKUP_TYPE_LOGS_ONLY 0x2 +#define BACKUP_TYPE_FULL_WITH_ALL_LOGS 0x3 + +#define RESTORE_CLOSE_ABORT 0x1 +#define RESTORE_CLOSE_NORMAL 0x0 + +#define ESE_RESTORE_COMPLETE_NOWAIT 0x00010000 +#define ESE_RESTORE_COMPLETE_ATTACH_DBS 0x00000001 +#define ESE_RESTORE_KEEP_LOG_FILES 0x00020000 + +//#include + +struct ESE_ICON_DESCRIPTION { + uint32_t ulSize; + char *pvData; +}; + +struct BACKUP_NODE_TREE { + WCHAR *wszName; + uint32_t fFlags; + ESE_ICON_DESCRIPTION iconDescription; + struct BACKUP_NODE_TREE *pNextNode; + struct BACKUP_NODE_TREE *pChildNode; +}; + +struct DATABASE_BACKUP_INFO { + WCHAR *wszDatabaseDisplayName; + uint32_t cwDatabaseStreams; + WCHAR *wszDatabaseStreams; + GUID rguidDatabase; + uint32_t *rgIconIndexDatabase; + uint32_t fDatabaseFlags; +}; + +struct INSTANCE_BACKUP_INFO { + uint64_t hInstanceId; + //RPC_STRING wszInstanceName; + WCHAR *wszInstanceName; + uint32_t ulIconIndexInstance; + uint32_t cDatabase; + DATABASE_BACKUP_INFO *rgDatabase; + uint32_t cIconDescription; + ESE_ICON_DESCRIPTION *rgIconDescription; +}; + +enum RECOVER_STATUS { + recoverInvalid = 0, + recoverNotStarted = 1, + recoverStarted = 2, + recoverEnded = 3, + recoverStatusMax +}; + +struct RESTORE_ENVIRONMENT { + WCHAR * m_wszRestoreLogPath; + WCHAR * m_wszSrcInstanceName; + uint32_t m_cDatabases; + WCHAR **m_wszDatabaseDisplayName; + GUID * m_rguidDatabase; + WCHAR * m_wszRestoreInstanceSystemPath; + WCHAR * m_wszRestoreInstanceLogPath; + WCHAR * m_wszTargetInstanceName; + WCHAR ** m_wszDatabaseStreamsS; + WCHAR ** m_wszDatabaseStreamsD; + uint32_t m_ulGenLow; + uint32_t m_ulGenHigh; + WCHAR * m_wszLogBaseName; + time_t m_timeLastRestore; + RECOVER_STATUS m_statusLastRecover; + HRESULT m_hrLastRecover; + time_t m_timeLastRecover; + WCHAR * m_wszAnnotation; +}; + +typedef HANDLE HCCX; + +typedef HRESULT (WINAPI *HrESEBackupRestoreGetNodes_t) +( + WCHAR* wszComputerName, + BACKUP_NODE_TREE* pBackupNodeTree +); + +typedef HRESULT (WINAPI *HrESEBackupPrepare_t) +( + WCHAR* wszBackupServer, + WCHAR* wszBackupAnnotation, + uint32_t *pcInstanceInfo, + INSTANCE_BACKUP_INFO **paInstanceInfo, + HCCX *phccxBackupContext +); + +typedef HRESULT (WINAPI *HrESEBackupEnd_t) +( + HCCX hccsBackupContext +); + +typedef HRESULT (WINAPI *HrESEBackupSetup_t) +( + HCCX hccsBackupContext, + uint64_t hInstanceID, + uint32_t btBackupType +); + +typedef HRESULT (WINAPI *HrESEBackupGetLogAndPatchFiles_t) +( + HCCX hccsBackupContext, + WCHAR** pwszFiles +); + +typedef HRESULT (WINAPI *HrESEBackupInstanceEnd_t) +( + HCCX hccsBackupContext, + uint32_t fFlags +); + +typedef HRESULT (WINAPI *HrESEBackupOpenFile_t) +( + HCCX hccsBackupContext, + WCHAR* wszFileName, + uint32_t cbReadHintSize, + uint32_t cSections, + void** rghFile, + uint64_t* rgliSectionSize +); + +typedef HRESULT (WINAPI *HrESEBackupReadFile_t) +( + HCCX hccsBackupContext, + void* hFile, + void* pvBuffer, + uint32_t cbBuffer, + uint32_t* pcbRead +); + +typedef HRESULT (WINAPI *HrESEBackupCloseFile_t) +( + HCCX hccsBackupContext, + void* hFile +); + +typedef HRESULT (WINAPI *HrESEBackupTruncateLogs_t) +( + HCCX hccsBackupContext +); + +typedef HRESULT (WINAPI *HrESERestoreOpen_t) +( + WCHAR* wszBackupServer, + WCHAR* wszBackupAnnotation, + WCHAR* wszSrcInstanceName, + WCHAR* wszRestoreLogPath, + HCCX* phccxRestoreContext +); + +typedef HRESULT (WINAPI *HrESERestoreReopen_t) +( + WCHAR* wszBackupServer, + WCHAR* wszBackupAnnotation, + WCHAR* wszRestoreLogPath, + HCCX* phccxRestoreContext +); + +typedef HRESULT (WINAPI *HrESERestoreClose_t) +( + HCCX phccxRestoreContext, + uint32_t fRestoreAbort +); + +typedef HRESULT (WINAPI *HrESERestoreComplete_t) +( + HCCX phccxRestoreContext, + WCHAR* wszCheckpointFilePath, + WCHAR* wszLogFilePath, + WCHAR* wszTargetInstanceName, + uint32_t fFlags +); + +typedef HRESULT (WINAPI *HrESERestoreSaveEnvironment_t) +( + HCCX phccxRestoreContext +); + +typedef HRESULT (WINAPI *HrESERestoreGetEnvironment_t) +( + HCCX phccxRestoreContext, + RESTORE_ENVIRONMENT **ppRestoreEnvironment +); + +typedef HRESULT (WINAPI *HrESERestoreAddDatabase_t) +( + HCCX phccxRestoreContext, + WCHAR* wszDatabaseDisplayName, + GUID guidDatabase, + WCHAR* wszDatabaseStreamsS, + WCHAR** wszDatabaseStreamsD +); + +typedef HRESULT (WINAPI *HrESERestoreOpenFile_t) +( + HCCX phccxRestoreContext, + WCHAR* wszFileName, + uint32_t cSections, + void* rghFile +); + +bRC +loadExchangeApi(); + +const char * +ESEErrorMessage(HRESULT result); + +#define hrLogfileHasBadSignature (HRESULT)0xC8000262L +#define hrLogfileNotContiguous (HRESULT)0xC8000263L +#define hrCBDatabaseInUse (HRESULT)0xC7FE1F41L +#define hrRestoreAtFileLevel (HRESULT)0xC7FF0FA5L +#define hrMissingFullBackup (HRESULT)0xC8000230L +#define hrBackupInProgress (HRESULT)0xC80001F9L +#define hrCBDatabaseNotFound (HRESULT)0xC7FE1F42L +#define hrErrorFromESECall (HRESULT)0xC7FF1004L + +extern HrESEBackupRestoreGetNodes_t HrESEBackupRestoreGetNodes; +extern HrESEBackupPrepare_t HrESEBackupPrepare; +extern HrESEBackupGetLogAndPatchFiles_t HrESEBackupGetLogAndPatchFiles; +extern HrESEBackupTruncateLogs_t HrESEBackupTruncateLogs; +extern HrESEBackupEnd_t HrESEBackupEnd; +extern HrESEBackupSetup_t HrESEBackupSetup; +extern HrESEBackupInstanceEnd_t HrESEBackupInstanceEnd; +extern HrESEBackupOpenFile_t HrESEBackupOpenFile; +extern HrESEBackupReadFile_t HrESEBackupReadFile; +extern HrESEBackupCloseFile_t HrESEBackupCloseFile; + +extern HrESERestoreOpen_t HrESERestoreOpen; +extern HrESERestoreReopen_t HrESERestoreReopen; +extern HrESERestoreComplete_t HrESERestoreComplete; +extern HrESERestoreClose_t HrESERestoreClose; +extern HrESERestoreGetEnvironment_t HrESERestoreGetEnvironment; +extern HrESERestoreSaveEnvironment_t HrESERestoreSaveEnvironment; +extern HrESERestoreAddDatabase_t HrESERestoreAddDatabase; +extern HrESERestoreOpenFile_t HrESERestoreOpenFile; + +#if !defined(MINGW64) && (_WIN32_WINNT < 0x0500) +typedef enum _COMPUTER_NAME_FORMAT { + ComputerNameNetBIOS, + ComputerNameDnsHostname, + ComputerNameDnsDomain, + ComputerNameDnsFullyQualified, + ComputerNamePhysicalNetBIOS, + ComputerNamePhysicalDnsHostname, + ComputerNamePhysicalDnsDomain, + ComputerNamePhysicalDnsFullyQualified, + ComputerNameMax +} COMPUTER_NAME_FORMAT; + +BOOL WINAPI GetComputerNameExW( + COMPUTER_NAME_FORMAT NameType, + LPWSTR lpBuffer, + LPDWORD lpnSize +); +#endif + +} diff --git a/bacula/src/win32/filed/plugins/exch_dbi_node.c b/bacula/src/win32/filed/plugins/exch_dbi_node.c new file mode 100644 index 0000000000..8c96781c61 --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_dbi_node.c @@ -0,0 +1,280 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + * + * Used only in "old Exchange plugin" now deprecated. + */ + +#include "exchange-fd.h" + +dbi_node_t::dbi_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_DATABASE_INFO, parent_node) +{ + restore_display_name = NULL; + restore_input_streams = NULL; + buffer = NULL; +} + +dbi_node_t::~dbi_node_t() +{ + safe_delete(buffer); + safe_delete(restore_input_streams); + safe_delete(restore_display_name); +} + +bRC +dbi_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + time_t now = time(NULL); + + _DebugMessage(100, "startBackupNode_DBI state = %d\n", state); + + if (context->job_level == 'F') { + sp->fname = full_path; + sp->link = full_path; + sp->statp.st_mode = 0700 | S_IFREG; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = (uint64_t)-1; + sp->type = FT_REG; + return bRC_OK; + } + else + { + bfuncs->setBaculaValue(context->bpContext, bVarFileSeen, (void *)full_path); + return bRC_Seen; + } +} + +bRC +dbi_node_t::endBackupFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endBackupNode_DBI state = %d\n", state); + + context->current_node = parent; + + return bRC_OK; +} + +bRC +dbi_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + _DebugMessage(0, "createFile_DBI state = %d\n", state); + + rp->create_status = CF_EXTRACT; + + return bRC_OK; +} + +bRC +dbi_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(0, "endRestoreFile_DBI state = %d\n", state); + + context->current_node = parent; + + return bRC_OK; +} + +bRC +dbi_node_t::pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io) +{ + uint32_t len; + WCHAR *ptr; + WCHAR *stream; + //char tmp[512]; + + buffer_pos = 0; + buffer_size = 65536; + buffer = new char[buffer_size]; + + if (context->job_type == JOB_TYPE_BACKUP) + { + ptr = (WCHAR *)buffer; + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"DatabaseBackupInfo\n"); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"%d\n", EXCHANGE_PLUGIN_VERSION); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"%s\n", dbi->wszDatabaseDisplayName); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", + dbi->rguidDatabase.Data1, dbi->rguidDatabase.Data2, dbi->rguidDatabase.Data3, + dbi->rguidDatabase.Data4[0], dbi->rguidDatabase.Data4[1], + dbi->rguidDatabase.Data4[2], dbi->rguidDatabase.Data4[3], + dbi->rguidDatabase.Data4[4], dbi->rguidDatabase.Data4[5], + dbi->rguidDatabase.Data4[6], dbi->rguidDatabase.Data4[7]); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + + stream = dbi->wszDatabaseStreams; + while (*stream) + { + len = snwprintf(ptr, (buffer_size - buffer_pos) / 2, L"%s\n", stream); + if (len < 0) + goto fail; + buffer_pos += len * 2; + ptr += len; + stream += wcslen(stream) + 1; + } + + buffer_size = buffer_pos; + buffer_pos = 0; + } + + io->status = 0; + io->io_errno = 0; + return bRC_OK; + +fail: + io->status = 0; + io->io_errno = 1; + return bRC_Error; +} + +bRC +dbi_node_t::pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io) +{ + io->status = 0; + io->io_errno = 0; + + io->status = MIN(io->count, (int)(buffer_size - buffer_pos)); + if (io->status == 0) + return bRC_OK; + memcpy(io->buf, buffer + buffer_pos, io->status); + buffer_pos += io->status; + + return bRC_OK; +} + +bRC +dbi_node_t::pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io) +{ + memcpy(&buffer[buffer_pos], io->buf, io->count); + buffer_pos += io->count; + io->status = io->count; + io->io_errno = 0; + return bRC_OK; +} + +bRC +dbi_node_t::pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io) +{ + WCHAR tmp[128]; + WCHAR *ptr; + WCHAR eol; + int wchars_read; + int version; + int stream_buf_count; + WCHAR *streams_start; + + if (context->job_type == JOB_TYPE_RESTORE) + { + // need to think about making this buffer overflow proof... + _DebugMessage(100, "analyzing DatabaseBackupInfo\n"); + ptr = (WCHAR *)buffer; + + if (swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) != 2) + goto restore_fail; + ptr += wchars_read; + _DebugMessage(150, "Header = %S\n", tmp); + // verify that header == "DatabaseBackupInfo" + + if (swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) != 2) + goto restore_fail; + if (swscanf(tmp, L"%d%c", &version, &eol) != 1) + { + version = 0; + _DebugMessage(150, "Version = 0 (inferred)\n"); + } + else + { + ptr += wchars_read; + _DebugMessage(150, "Version = %d\n", version); + if (swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) != 2) + goto restore_fail; + } + restore_display_name = new WCHAR[wchars_read]; + swscanf(ptr, L"%127[^\n]", restore_display_name); + _DebugMessage(150, "Database Display Name = %S\n", restore_display_name); + ptr += wchars_read; + + if (swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) != 2) + goto restore_fail; + + if (swscanf(ptr, L"%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x", + &restore_guid.Data1, &restore_guid.Data2, &restore_guid.Data3, + &restore_guid.Data4[0], &restore_guid.Data4[1], + &restore_guid.Data4[2], &restore_guid.Data4[3], + &restore_guid.Data4[4], &restore_guid.Data4[5], + &restore_guid.Data4[6], &restore_guid.Data4[7]) != 11) + { + goto restore_fail; + } + _DebugMessage(150, "GUID = %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", + restore_guid.Data1, restore_guid.Data2, restore_guid.Data3, + restore_guid.Data4[0], restore_guid.Data4[1], + restore_guid.Data4[2], restore_guid.Data4[3], + restore_guid.Data4[4], restore_guid.Data4[5], + restore_guid.Data4[6], restore_guid.Data4[7]); + + ptr += wchars_read; + + stream_buf_count = 1; + streams_start = ptr; + while (ptr < (WCHAR *)(buffer + buffer_pos) && swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) == 2) + { + _DebugMessage(150, "File = %S\n", tmp); + ptr += wchars_read; + stream_buf_count += wchars_read; + } + restore_input_streams = new WCHAR[stream_buf_count]; + ptr = streams_start; + stream_buf_count = 0; + while (ptr < (WCHAR *)(buffer + buffer_pos) && swscanf(ptr, L"%127[^\n]%c%n", tmp, &eol, &wchars_read) == 2) + { + snwprintf(&restore_input_streams[stream_buf_count], 65535, L"%s", tmp); + ptr += wchars_read; + stream_buf_count += wchars_read; + } + restore_input_streams[stream_buf_count] = 0; + + _DebugMessage(100, "done analyzing DatabasePluginInfo\n"); + } + safe_delete(buffer); + return bRC_OK; +restore_fail: + _JobMessage(M_FATAL, "Format of %s is incorrect", full_path); + safe_delete(buffer); + return bRC_Error; +} diff --git a/bacula/src/win32/filed/plugins/exch_file_node.c b/bacula/src/win32/filed/plugins/exch_file_node.c new file mode 100644 index 0000000000..7c7b137dfb --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_file_node.c @@ -0,0 +1,229 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + * + * Used only in "old Exchange plugin" now deprecated. + */ + +#include "exchange-fd.h" + +file_node_t::file_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_FILE, parent_node) +{ + backup_file_handle = INVALID_HANDLE_VALUE; + restore_file_handle = INVALID_HANDLE_VALUE; + restore_at_file_level = FALSE; +} + +file_node_t::~file_node_t() +{ + if (backup_file_handle != INVALID_HANDLE_VALUE) + { + //_DebugMessage(100, "closing file handle in destructor\n"); + CloseHandle(backup_file_handle); + } + if (restore_file_handle != INVALID_HANDLE_VALUE) + { + //_DebugMessage(100, "closing file handle in destructor\n"); + if (restore_at_file_level) + { + CloseHandle(restore_file_handle); + } + else + { + // maybe one day + } + } +} + +bRC +file_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + time_t now = time(NULL); + _DebugMessage(100, "startBackupNode_FILE state = %d\n", state); + + if (context->job_level == 'F' || parent->type == NODE_TYPE_STORAGE_GROUP) { + sp->fname = full_path; + sp->link = full_path; + _DebugMessage(100, "fname = %s\n", sp->fname); + sp->statp.st_mode = 0700 | S_IFREG; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = (uint64_t)-1; + sp->type = FT_REG; + return bRC_OK; + } else { + bfuncs->setBaculaValue(context->bpContext, bVarFileSeen, (void *)full_path); + return bRC_Seen; + } +} + +bRC +file_node_t::endBackupFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endBackupNode_FILE state = %d\n", state); + + context->current_node = parent; + + return bRC_OK; +} + +bRC +file_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + //HrESERestoreOpenFile with name of log file + + _DebugMessage(0, "createFile_FILE state = %d\n", state); + rp->create_status = CF_EXTRACT; + return bRC_OK; +} + +bRC +file_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(0, "endRestoreFile_FILE state = %d\n", state); + context->current_node = parent; + return bRC_OK; +} + +bRC +file_node_t::pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io) +{ + HRESULT result; + HANDLE handle; + char *tmp = new char[wcslen(filename) + 1]; + wcstombs(tmp, filename, wcslen(filename) + 1); + + _DebugMessage(0, "pluginIoOpen_FILE - filename = %s\n", tmp); + io->status = 0; + io->io_errno = 0; + if (context->job_type == JOB_TYPE_BACKUP) + { + _DebugMessage(10, "Calling HrESEBackupOpenFile\n"); + result = HrESEBackupOpenFile(hccx, filename, 65535, 1, &backup_file_handle, §ion_size); + if (result) + { + _JobMessage(M_FATAL, "HrESEBackupOpenFile failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + backup_file_handle = INVALID_HANDLE_VALUE; + io->io_errno = 1; + return bRC_Error; + } + } + else + { + _DebugMessage(10, "Calling HrESERestoreOpenFile for '%s'\n", tmp); + result = HrESERestoreOpenFile(hccx, filename, 1, &restore_file_handle); + if (result == hrRestoreAtFileLevel) + { + restore_at_file_level = true; + _DebugMessage(100, "Calling CreateFileW for '%s'\n", tmp); + handle = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle == INVALID_HANDLE_VALUE) + { + _JobMessage(M_FATAL, "CreateFile failed"); + return bRC_Error; + } + restore_file_handle = (void *)handle; + return bRC_OK; + } + else if (result == 0) + { + _JobMessage(M_FATAL, "Exchange File IO API not yet supported for restore\n"); + restore_at_file_level = false; + return bRC_Error; + } + else + { + _JobMessage(M_FATAL, "HrESERestoreOpenFile failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + } + return bRC_OK; +} + +bRC +file_node_t::pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io) +{ + HRESULT result; + uint32_t readLength; + + io->status = 0; + io->io_errno = 0; + _DebugMessage(200, "Calling HrESEBackupReadFile\n"); + result = HrESEBackupReadFile(hccx, backup_file_handle, io->buf, io->count, &readLength); + if (result) + { + io->io_errno = 1; + return bRC_Error; + } + io->status = readLength; + size += readLength; + return bRC_OK; +} + +bRC +file_node_t::pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io) +{ + DWORD bytes_written; + + io->io_errno = 0; + if (!restore_at_file_level) + return bRC_Error; + + if (!WriteFile(restore_file_handle, io->buf, io->count, &bytes_written, NULL)) + { + _JobMessage(M_FATAL, "Write Error"); + return bRC_Error; + } + + if (bytes_written != (DWORD)io->count) + { + _JobMessage(M_FATAL, "Short write"); + return bRC_Error; + } + io->status = bytes_written; + + return bRC_OK; +} + +bRC +file_node_t::pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io) +{ + if (context->job_type == JOB_TYPE_BACKUP) + { + _DebugMessage(100, "Calling HrESEBackupCloseFile\n"); + HrESEBackupCloseFile(hccx, backup_file_handle); + backup_file_handle = INVALID_HANDLE_VALUE; + return bRC_OK; + } + else + { + if (restore_at_file_level) + { + CloseHandle(restore_file_handle); + restore_file_handle = INVALID_HANDLE_VALUE; + return bRC_OK; + } + else + { + return bRC_OK; + } + } +} diff --git a/bacula/src/win32/filed/plugins/exch_node.c b/bacula/src/win32/filed/plugins/exch_node.c new file mode 100644 index 0000000000..c8453392cd --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_node.c @@ -0,0 +1,120 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + * + * Used only in "old Exchange plugin" now deprecated. + */ + +#include "exchange-fd.h" + +node_t::node_t(char *name, int type) +{ + this->type = type; + state = 0; + parent = NULL; + this->name = bstrdup(name); + full_path = make_full_path(); + size = 0; + level = 0; +} + +node_t::node_t(char *name, int type, node_t *parent_node) +{ + this->type = type; + state = 0; + parent = parent_node; + this->name = bstrdup(name); + full_path = make_full_path(); + size = 0; + level = parent->level + 1; +} + +node_t::~node_t() +{ + safe_delete(name); + safe_delete(full_path); +} + +char * +node_t::make_full_path() +{ + node_t *curr_node; + int len; + char *retval; + + for (len = 0, curr_node = this; curr_node != NULL; curr_node = curr_node->parent) + { + len += strlen(curr_node->name) + 1; + } + if (type == NODE_TYPE_FILE || type == NODE_TYPE_DATABASE_INFO) + { + retval = new char[len + 1]; + retval[len] = 0; + } + else + { + retval = new char[len + 2]; + retval[len] = '/'; + retval[len + 1] = 0; + } + for (curr_node = this; curr_node != NULL; curr_node = curr_node->parent) + { + len -= strlen(curr_node->name); + memcpy(retval + len, curr_node->name, strlen(curr_node->name)); + retval[--len] = '/'; + } + return retval; +} + +bRC +node_t::pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io) +{ + _DebugMessage(100, "pluginIoOpen_Node\n"); + io->status = 0; + io->io_errno = 0; + return bRC_OK; +} + +bRC +node_t::pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io) +{ + _DebugMessage(100, "pluginIoRead_Node\n"); + io->status = 0; + io->io_errno = 0; + return bRC_OK; +} + +bRC +node_t::pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io) +{ + _DebugMessage(100, "pluginIoWrite_Node\n"); + io->status = 0; + io->io_errno = 1; + return bRC_Error; +} + +bRC +node_t::pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io) +{ + _DebugMessage(100, "pluginIoClose_Node\n"); + io->status = 0; + io->io_errno = 0; + return bRC_OK; +} diff --git a/bacula/src/win32/filed/plugins/exch_node.h b/bacula/src/win32/filed/plugins/exch_node.h new file mode 100644 index 0000000000..75b96d11d3 --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_node.h @@ -0,0 +1,159 @@ +/* + * Written by James Harper, July 2010 + */ + +#define NODE_TYPE_UNKNOWN 0 +#define NODE_TYPE_ROOT 1 +#define NODE_TYPE_SERVICE 2 +#define NODE_TYPE_STORAGE_GROUP 3 +#define NODE_TYPE_STORE 4 +#define NODE_TYPE_DATABASE_INFO 5 +#define NODE_TYPE_FILE 6 + +class node_t { +public: + int type; + int state; + node_t *parent; + char *name; + char *full_path; + size_t size; + int level; + + node_t(char *name, int type); + node_t(char *name, int type, node_t *parent_node); + virtual ~node_t(); + + char *make_full_path(); + + virtual bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) = 0; + virtual bRC endBackupFile(exchange_fd_context_t *context) = 0; + + virtual bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp) = 0; + virtual bRC endRestoreFile(exchange_fd_context_t *context) = 0; + + virtual bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io); + virtual bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io); + virtual bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io); + virtual bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io); +}; + +class file_node_t : public node_t { +public: + WCHAR *filename; + HCCX hccx; + VOID *backup_file_handle; + VOID *restore_file_handle; + uint64_t section_size; + bool restore_at_file_level; + + file_node_t(char *name, node_t *parent_node); + virtual ~file_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); + + bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io); +}; + +class dbi_node_t : public node_t { +public: + DATABASE_BACKUP_INFO *dbi; + char *buffer; + uint32_t buffer_size; + uint32_t buffer_pos; + WCHAR *restore_display_name; + GUID restore_guid; + WCHAR *restore_input_streams; + WCHAR *restore_output_streams; + + dbi_node_t(char *name, node_t *parent_node); + virtual ~dbi_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); + + bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io); +}; + +class store_node_t : public node_t { +public: + HCCX hccx; + DATABASE_BACKUP_INFO *dbi; + WCHAR *stream_ptr; + file_node_t *file_node; + dbi_node_t *dbi_node; + WCHAR *out_stream_ptr; + + store_node_t(char *name, node_t *parent_node); + virtual ~store_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); +}; + +class storage_group_node_t : public node_t { +public: + HCCX hccx; + INSTANCE_BACKUP_INFO *ibi; + store_node_t *store_node; + file_node_t *file_node; + uint32_t current_dbi; + WCHAR *logfiles; + WCHAR *logfile_ptr; + RESTORE_ENVIRONMENT *restore_environment; + WCHAR *service_name; + WCHAR *storage_group_name; + WCHAR *saved_log_path; + storage_group_node_t *next; + + storage_group_node_t(char *name, node_t *parent_node); + virtual ~storage_group_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); +}; + +class service_node_t : public node_t { +public: + uint32_t ibi_count; + INSTANCE_BACKUP_INFO *ibi; + HCCX hccx; + uint32_t current_ibi; + storage_group_node_t *first_storage_group_node; + + service_node_t(char *name, node_t *parent_node); + virtual ~service_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); +}; + +class root_node_t : public node_t { +public: + service_node_t *service_node; + + root_node_t(char *name); + virtual ~root_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); +}; diff --git a/bacula/src/win32/filed/plugins/exch_root_node.c b/bacula/src/win32/filed/plugins/exch_root_node.c new file mode 100644 index 0000000000..875433c7c0 --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_root_node.c @@ -0,0 +1,155 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + * + * Used only in "old Exchange plugin" now deprecated. + */ + +#include "exchange-fd.h" + +root_node_t::root_node_t(char *name) : node_t(name, NODE_TYPE_ROOT) +{ + service_node = NULL; +} + +root_node_t::~root_node_t() +{ +} + +bRC +root_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + bRC retval = bRC_OK; + time_t now; + + _DebugMessage(100, "startBackupNode_ROOT state = %d\n", state); + switch(state) + { + case 0: + if (strcmp(PLUGIN_PATH_PREFIX_BASE, name) != 0) + { + _JobMessage(M_FATAL, "Invalid backup path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n"); + state = 999; + return bRC_Error; + } + // check that service_node == NULL + service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this); + state = 1; + // fall through + case 1: + context->current_node = service_node; + break; + case 2: + now = time(NULL); + sp->fname = full_path; + sp->link = full_path; + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + sp->type = FT_DIREND; + break; + case 999: + return bRC_Error; + default: + _JobMessage(M_FATAL, "startBackupFile: invalid internal state %d", state); + state = 999; + } + return retval; +} + +bRC +root_node_t::endBackupFile(exchange_fd_context_t *context) +{ + bRC retval = bRC_OK; + + _DebugMessage(100, "endBackupNode_ROOT state = %d\n", state); + switch(state) + { + case 1: + state = 2; + retval = bRC_More; + // free service_node here? + break; + case 2: + retval = bRC_OK; + break; + case 999: + retval = bRC_Error; + default: + _JobMessage(M_FATAL, "endBackupFile: invalid internal state %d", state); + state = 999; + return bRC_Error; + } + return retval; +} + +bRC +root_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + _DebugMessage(0, "createFile_ROOT state = %d\n", state); + switch (state) { + case 0: + if (strcmp(name, PLUGIN_PATH_PREFIX_BASE) != 0) { + _JobMessage(M_FATAL, "Invalid restore path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n"); + state = 999; + return bRC_Error; + } + service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this); + context->current_node = service_node; + return bRC_OK; + case 1: + rp->create_status = CF_CREATED; + return bRC_OK; + + /* Skip this file */ + case 900: + rp->create_status = CF_SKIP; + return bRC_OK; + /* Error */ + case 999: + return bRC_Error; + default: + _JobMessage(M_FATAL, "createFile: invalid internal state %d", state); + state = 999; + } + return bRC_Error; +} + +bRC +root_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(0, "endRestoreFile_ROOT state = %d\n", state); + switch (state) { + case 0: + safe_delete(service_node); + state = 1; + return bRC_OK; + case 1: + return bRC_OK; + case 900: + return bRC_OK; + default: + _JobMessage(M_FATAL, "endRestore: invalid internal state %d", state); + state = 999; + } + return bRC_Error; +} diff --git a/bacula/src/win32/filed/plugins/exch_service_node.c b/bacula/src/win32/filed/plugins/exch_service_node.c new file mode 100644 index 0000000000..16a3fed625 --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_service_node.c @@ -0,0 +1,223 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + * + * Used only in "old Exchange plugin" now deprecated. + */ + +#include "exchange-fd.h" + +service_node_t::service_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_SERVICE, parent_node) +{ + current_ibi = 0; + hccx = NULL; + ibi = NULL; + ibi_count = 0; + first_storage_group_node = NULL; +} + +service_node_t::~service_node_t() +{ +} + +bRC +service_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + HRESULT result; + char aname[256]; + + _DebugMessage(100, "startBackupNode_SERVICE state = %d\n", state); + switch(state) + { + case 0: + if (strcmp(PLUGIN_PATH_PREFIX_SERVICE, name) != 0) + { + _JobMessage(M_FATAL, "Invalid restore path specified, must start with /" PLUGIN_PATH_PREFIX_BASE "/" PLUGIN_PATH_PREFIX_SERVICE "/\n"); + return bRC_Error; + } + // convert name to a wide string + + _DebugMessage(100, "Calling HrESEBackupPrepare\n"); + wcstombs(aname, context->computer_name, 256); + _JobMessage(M_INFO, "Preparing Exchange Backup for %s\n", aname); + result = HrESEBackupPrepare(context->computer_name, + (WCHAR *)PLUGIN_PATH_PREFIX_SERVICE_W, &ibi_count, &ibi, &hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupPrepare failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + state = 1; + // fall through + case 1: + if (context->path_bits[level + 1] == NULL) + { + _DebugMessage(100, "No specific storage group specified - backing them all up\n"); + char *tmp = new char[wcslen(ibi[current_ibi].wszInstanceName) + 1]; + wcstombs(tmp, ibi[current_ibi].wszInstanceName, wcslen(ibi[current_ibi].wszInstanceName) + 1); + first_storage_group_node = new storage_group_node_t(tmp, this); + delete tmp; + _DebugMessage(100, "storage group name = %s\n", first_storage_group_node->name); + first_storage_group_node->ibi = &ibi[current_ibi]; + first_storage_group_node->hccx = hccx; + context->current_node = first_storage_group_node; + } + else + { + char *tmp = NULL; + for (current_ibi = 0; current_ibi < ibi_count; current_ibi++) + { + tmp = new char[wcslen(ibi[current_ibi].wszInstanceName) + 1]; + wcstombs(tmp, ibi[current_ibi].wszInstanceName, wcslen(ibi[current_ibi].wszInstanceName) + 1); + if (stricmp(tmp, context->path_bits[level + 1]) == 0) + break; + } + first_storage_group_node = new storage_group_node_t(tmp, this); + delete tmp; + if (current_ibi == ibi_count) + { + _JobMessage(M_FATAL, "Invalid Storage Group '%s'\n", context->path_bits[level + 1]); + return bRC_Error; + } + _DebugMessage(100, "storage group name = %s\n", first_storage_group_node->name); + first_storage_group_node->ibi = &ibi[current_ibi]; + first_storage_group_node->hccx = hccx; + context->current_node = first_storage_group_node; + } + break; + case 2: + time_t now = time(NULL); + sp->fname = full_path; + sp->link = full_path; + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + sp->statp.st_nlink = 1; + //sp->statp.st_blocks = 0; + sp->type = FT_DIREND; + break; + } + _DebugMessage(100, "ending startBackupNode_SERVICE state = %d\n", state); + return bRC_OK; +} + +bRC +service_node_t::endBackupFile(exchange_fd_context_t *context) +{ + HRESULT result; + bRC retval = bRC_OK; + + _DebugMessage(100, "endBackupNode_SERVICE state = %d\n", state); + switch(state) + { + case 0: + // should never happen + break; + case 1: + // free node->storage_group_node + if (context->path_bits[level + 1] == NULL) + { + current_ibi++; + if (current_ibi == ibi_count) + state = 2; + } + else + state = 2; + retval = bRC_More; + break; + case 2: + _DebugMessage(100, "calling HrESEBackupEnd\n"); + result = HrESEBackupEnd(hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupEnd failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + + context->current_node = parent; + retval = bRC_OK; + break; + } + return retval; +} + +bRC +service_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + storage_group_node_t *curr_sg, *prev_sg; + + _DebugMessage(0, "createFile_SERVICE state = %d\n", state); + if (strcmp(name, "Microsoft Information Store") != 0) + { + _JobMessage(M_FATAL, "Invalid restore path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/" PLUGIN_PATH_PREFIX_SERVICE "/'\n", state); + return bRC_Error; + } + for(;;) + { + switch (state) + { + case 0: + if (context->path_bits[level + 1] == NULL) + { + state = 1; + break; + } + for (prev_sg = NULL, curr_sg = first_storage_group_node; curr_sg != NULL; prev_sg = curr_sg, curr_sg = curr_sg->next) + { + if (strcmp(curr_sg->name, context->path_bits[level + 1]) == 0) + { + break; + } + } + if (curr_sg == NULL) + { + curr_sg = new storage_group_node_t(bstrdup(context->path_bits[level + 1]), this); + if (prev_sg == NULL) + first_storage_group_node = curr_sg; + else + prev_sg->next = curr_sg; + } + context->current_node = curr_sg; + return bRC_OK; + case 1: + rp->create_status = CF_CREATED; + return bRC_OK; + } + } + return bRC_Error; +} + +bRC +service_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(0, "endRestoreFile_SERVICE state = %d\n", state); + switch(state) + { + case 0: + return bRC_Error; + case 1: + context->current_node = parent; + return bRC_OK; + } + + return bRC_Error; +} diff --git a/bacula/src/win32/filed/plugins/exch_storage_group_node.c b/bacula/src/win32/filed/plugins/exch_storage_group_node.c new file mode 100644 index 0000000000..195b84ced4 --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_storage_group_node.c @@ -0,0 +1,471 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + * + * Used only in "old Exchange plugin" now deprecated. + */ + +#include "exchange-fd.h" + +storage_group_node_t::storage_group_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_STORAGE_GROUP, parent_node) +{ + ibi = NULL; + store_node = NULL; + current_dbi = 0; + restore_environment = NULL; + saved_log_path = NULL; + next = NULL; +} + +storage_group_node_t::~storage_group_node_t() +{ +/* + safe_delete(dbi_node); + safe_delete(file_node); +*/ +} + +bRC +storage_group_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + HRESULT result; + int len; + WCHAR *tmp_logfiles, *tmp_logfile_ptr; + char *tmp; + + for(;;) + { + _DebugMessage(100, "startBackupNode_STORAGE_GROUP state = %d, name = %s\n", state, name); + switch(state) + { + case 0: + current_dbi = 0; + store_node = NULL; + logfile_ptr = NULL; + if (context->job_level == 'F') + { + _DebugMessage(100, "Calling HrESEBackupSetup (BACKUP_TYPE_FULL)\n"); + result = HrESEBackupSetup(hccx, ibi->hInstanceId, BACKUP_TYPE_FULL); + state = 1; + } + else + { + _DebugMessage(100, "Calling HrESEBackupSetup (BACKUP_TYPE_LOGS_ONLY)\n"); + result = HrESEBackupSetup(hccx, ibi->hInstanceId, BACKUP_TYPE_LOGS_ONLY); + if (context->accurate) + state = 1; + else + state = 2; + } + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupSetup failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + return bRC_Error; + } + break; + case 1: + if (context->path_bits[level + 1] == NULL) + { + _DebugMessage(100, "No specific database specified - backing them all up\n"); + DATABASE_BACKUP_INFO *dbi = &ibi->rgDatabase[current_dbi]; + char *tmp = new char[wcslen(dbi->wszDatabaseDisplayName) + 1]; + wcstombs(tmp, dbi->wszDatabaseDisplayName, wcslen(dbi->wszDatabaseDisplayName) + 1); + store_node = new store_node_t(tmp, this); + store_node->dbi = dbi; + store_node->hccx = hccx; + context->current_node = store_node; + } + else + { + DATABASE_BACKUP_INFO *dbi = NULL; + char *tmp = NULL; + for (current_dbi = 0; current_dbi < ibi->cDatabase; current_dbi++) + { + dbi = &ibi->rgDatabase[current_dbi]; + char *tmp = new char[wcslen(dbi->wszDatabaseDisplayName) + 1]; + wcstombs(tmp, dbi->wszDatabaseDisplayName, wcslen(dbi->wszDatabaseDisplayName) + 1); + if (stricmp(tmp, context->path_bits[level + 1]) == 0) + break; + safe_delete(tmp); + } + if (current_dbi == ibi->cDatabase) + { + _JobMessage(M_FATAL, "Invalid Database '%s'\n", context->path_bits[level + 1]); + return bRC_Error; + } + store_node = new store_node_t(tmp, this); + _DebugMessage(100, "Database name = %s\n", store_node->name); + safe_delete(tmp); + store_node->hccx = hccx; + store_node->dbi = dbi; + context->current_node = store_node; + } + return bRC_OK; + case 2: + _DebugMessage(100, "Calling HrESEBackupGetLogAndPatchFiles\n"); + result = HrESEBackupGetLogAndPatchFiles(hccx, &tmp_logfiles); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupGetLogAndPatchFiles failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + for (len = 0, tmp_logfile_ptr = tmp_logfiles; *tmp_logfile_ptr != 0; tmp_logfile_ptr += wcslen(tmp_logfile_ptr) + 1) + { + len += wcslen(tmp_logfile_ptr) + 1; + } + logfiles = new WCHAR[len + 1]; + logfile_ptr = logfiles; + for (tmp_logfile_ptr = tmp_logfiles; *tmp_logfile_ptr != 0; tmp_logfile_ptr += wcslen(tmp_logfile_ptr) + 1) + { + // check file modification date + HANDLE handle; + FILETIME modified_time; + //int64_t tmp_time; + __int64 tmp_time; + bool include_file; + include_file = false; + handle = INVALID_HANDLE_VALUE; + if (context->job_since == 0) + include_file = true; + if (!include_file) + { + handle = CreateFileW(tmp_logfile_ptr, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle == INVALID_HANDLE_VALUE) + { + //_JobMessage(M_WARNING, "Could not open '%S' to check last modified date (0x%08x), including anyway\n", tmp_logfile_ptr, GetLastError()); + include_file = true; + } + } + if (!include_file) + { + if (GetFileTime(handle, NULL, NULL, &modified_time) == 0) + { + //_JobMessage(M_WARNING, "Could not check last modified date for '%S' (0x%08x), including anyway\n", tmp_logfile_ptr, GetLastError()); + include_file = true; + } + } + if (!include_file) + { + tmp_time = (((int64_t)modified_time.dwHighDateTime) << 32) | modified_time.dwLowDateTime; + tmp_time -= 116444736000000000LL; + tmp_time /= 10000000; + if (tmp_time > context->job_since) + { + include_file = true; + } + } + if (include_file) + { + memcpy(logfile_ptr, tmp_logfile_ptr, (wcslen(tmp_logfile_ptr) + 1) * 2); + logfile_ptr += wcslen(logfile_ptr) + 1; + //_DebugMessage(100, "Including file %S\n", logfile_ptr); + } +#if 0 +/* this is handled via checkFile now */ + else + { + if (context->accurate) { + tmp = new char[strlen(full_path) + wcslen(tmp_logfile_ptr) + 1]; + strcpy(tmp, full_path); + wcstombs(tmp + strlen(full_path), tmp_logfile_ptr, wcslen(tmp_logfile_ptr) + 1); + bfuncs->setBaculaValue(context->bpContext, bVarFileSeen, (void *)tmp); + delete tmp; + } + } +#endif + + if (handle != INVALID_HANDLE_VALUE) + CloseHandle(handle); + + } + *logfile_ptr = 0; + logfile_ptr = logfiles; + state = 3; + break; + case 3: + tmp = new char[wcslen(logfile_ptr) + 1]; + wcstombs(tmp, logfile_ptr, wcslen(logfile_ptr) + 1); + file_node = new file_node_t(tmp, this); + delete tmp; + file_node->hccx = hccx; + file_node->filename = logfile_ptr; + context->current_node = file_node; + return bRC_OK; + case 4: + time_t now = time(NULL); + sp->fname = full_path; + sp->link = full_path; + _DebugMessage(100, "fname = %s\n", sp->fname); + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + //sp->statp.st_blocks = 0; + sp->type = FT_DIREND; + return bRC_OK; + } + } +} + +bRC +storage_group_node_t::endBackupFile(exchange_fd_context_t *context) +{ + HRESULT result; + bRC retval = bRC_Error; + + _DebugMessage(100, "endBackupNode_STORAGE_GROUP state = %d\n", state); + + switch(state) + { + case 0: + // should never happen + break; + case 1: + // free node->storage_group_node + if (context->path_bits[level + 1] == NULL) + { + current_dbi++; + if (current_dbi == ibi->cDatabase) + state = 2; + } + else + state = 2; + retval = bRC_More; + break; + case 2: + // should never happen + break; + case 3: + safe_delete(file_node); + logfile_ptr += wcslen(logfile_ptr) + 1; + if (*logfile_ptr == 0) + state = 4; + retval = bRC_More; + break; + case 4: + if (context->truncate_logs) { + _DebugMessage(100, "Calling HrESEBackupTruncateLogs\n"); + result = HrESEBackupTruncateLogs(hccx); + if (result != 0) { + _JobMessage(M_FATAL, "HrESEBackupTruncateLogs failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + } else { + _JobMessage(M_INFO, "Truncated database logs for Storage Group %s\n", name); + } + } else { + _JobMessage(M_INFO, "Did NOT truncate database logs for Storage Group %s\n", name); + } + _DebugMessage(100, "Calling HrESEBackupInstanceEnd\n"); + result = HrESEBackupInstanceEnd(hccx, ESE_BACKUP_INSTANCE_END_SUCCESS); + if (result != 0) { + _JobMessage(M_FATAL, "HrESEBackupInstanceEnd failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + retval = bRC_OK; + context->current_node = parent; + break; + } + return retval; +} + +bRC +storage_group_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + HRESULT result; + int len; + + _DebugMessage(0, "createFile_STORAGE_GROUP state = %d\n", state); + + if (strcmp(context->path_bits[level], name) != 0) { + _DebugMessage(0, "Different storage group - switching back to parent\n", state); + saved_log_path = new WCHAR[wcslen(restore_environment->m_wszRestoreLogPath) + 1]; + wcscpy(saved_log_path, restore_environment->m_wszRestoreLogPath); + _DebugMessage(100, "Calling HrESERestoreSaveEnvironment\n"); + result = HrESERestoreSaveEnvironment(hccx); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreSaveEnvironment failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + rp->create_status = CF_CREATED; + return bRC_OK; + } + _DebugMessage(100, "Calling HrESERestoreClose\n"); + result = HrESERestoreClose(hccx, RESTORE_CLOSE_NORMAL); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreClose failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + rp->create_status = CF_CREATED; + return bRC_OK; + } + context->current_node = parent; + return bRC_OK; + } + if (saved_log_path != NULL) { + _DebugMessage(0, "Calling HrESERestoreReopen\n"); + result = HrESERestoreReopen(context->computer_name, service_name, saved_log_path, &hccx); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreReopen failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + saved_log_path = NULL; + rp->create_status = CF_CREATED; + return bRC_OK; + } + _DebugMessage(0, "Calling HrESERestoreGetEnvironment\n"); + result = HrESERestoreGetEnvironment(hccx, &restore_environment); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreGetEnvironment failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + saved_log_path = NULL; + rp->create_status = CF_CREATED; + return bRC_OK; + } + saved_log_path = NULL; + } + + for (;;) { + switch (state) { + case 0: + if (context->path_bits[level + 2] == NULL) { + _JobMessage(M_ERROR, "Unexpected log file '%s%s' - expecting database\n", full_path, context->path_bits[level + 1]); + state = 999; + break; + } + service_name = new WCHAR[strlen(parent->name) + 1]; + storage_group_name = new WCHAR[strlen(name) + 1]; + mbstowcs(service_name, parent->name, strlen(parent->name) + 1); + mbstowcs(storage_group_name, name, strlen(name) + 1); + _DebugMessage(0, "Calling HrESERestoreOpen\n"); + result = HrESERestoreOpen(context->computer_name, service_name, storage_group_name, NULL, &hccx); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreOpen failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + _DebugMessage(0, "Calling HrESERestoreGetEnvironment\n"); + result = HrESERestoreGetEnvironment(hccx, &restore_environment); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreGetEnvironment failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + state = 1; + break; + case 1: + if (context->path_bits[level + 2] == NULL) { + state = 2; + break; + } + store_node = new store_node_t(bstrdup(context->path_bits[level + 1]), this); + store_node->hccx = hccx; + context->current_node = store_node; + return bRC_OK; + case 2: + if (context->path_bits[level + 2] != NULL) { + _JobMessage(M_ERROR, "Unexpected file '%s'\n", full_path); + state = 999; + break; + } + if (context->path_bits[level + 1] == NULL) { + state = 3; + break; + } + state = 2; + file_node = new file_node_t(bstrdup(context->path_bits[level + 1]), this); + file_node->hccx = hccx; + int i; + for (i = strlen(file_node->name) - 1; i >= 0; i--) { + if (file_node->name[i] == '\\') { + i++; + break; + } + } + len = wcslen(restore_environment->m_wszRestoreLogPath) + strlen(file_node->name + i) + 1 + 1; + file_node->filename = new WCHAR[len]; + wcscpy(file_node->filename, restore_environment->m_wszRestoreLogPath); + wcscat(file_node->filename, L"\\"); + mbstowcs(&file_node->filename[wcslen(file_node->filename)], file_node->name + i, strlen(file_node->name + i) + 1); + context->current_node = file_node; + return bRC_OK; + case 3: + if (rp->type != FT_DIREND) { + _JobMessage(M_ERROR, "Unexpected file '%s'\n", full_path); + state = 999; + break; + } + // must be the storage group node + _DebugMessage(100, "Calling HrESERestoreSaveEnvironment\n"); + result = HrESERestoreSaveEnvironment(hccx); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreSaveEnvironment failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + + _DebugMessage(100, "Calling HrESERestoreComplete\n"); + result = HrESERestoreComplete(hccx, restore_environment->m_wszRestoreLogPath, + restore_environment->m_wszRestoreLogPath, storage_group_name, ESE_RESTORE_COMPLETE_ATTACH_DBS); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreComplete failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + _DebugMessage(100, "Calling HrESERestoreClose\n"); + result = HrESERestoreClose(hccx, RESTORE_CLOSE_NORMAL); + state = 999; + break; + } else { + _JobMessage(M_INFO, "Storage Group '%s' restored successfully\n", name); + } + + _DebugMessage(100, "Calling HrESERestoreClose\n"); + result = HrESERestoreClose(hccx, RESTORE_CLOSE_NORMAL); + if (result != 0) { + _JobMessage(M_FATAL, "HrESERestoreClose failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + + rp->create_status = CF_CREATED; + return bRC_OK; + case 999: + rp->create_status = CF_CREATED; + return bRC_OK; + } + } +} + +bRC +storage_group_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(0, "endRestoreFile_STORAGE_GROUP state = %d\n", state); + switch (state) { + case 0: + return bRC_Error; + case 1: + return bRC_OK; + case 2: + return bRC_OK; + case 3: + context->current_node = parent; + return bRC_OK; + case 999: + context->current_node = parent; + return bRC_OK; + } + + return bRC_Error; +} diff --git a/bacula/src/win32/filed/plugins/exch_store_node.c b/bacula/src/win32/filed/plugins/exch_store_node.c new file mode 100644 index 0000000000..ab47993f2c --- /dev/null +++ b/bacula/src/win32/filed/plugins/exch_store_node.c @@ -0,0 +1,237 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + */ + +#include "exchange-fd.h" + +store_node_t::store_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_STORE, parent_node) +{ + dbi = NULL; + hccx = NULL; + dbi_node = NULL; + file_node = NULL; +} + +store_node_t::~store_node_t() +{ + safe_delete(dbi_node); + safe_delete(file_node); +} + +bRC +store_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + char *tmp; + + _DebugMessage(100, "startBackupNode_STORE state = %d\n", state); + + switch(state) + { + case 0: + stream_ptr = dbi->wszDatabaseStreams; + state = 1; + // fall through + case 1: + dbi_node = new dbi_node_t((char *)"DatabaseBackupInfo", this); + dbi_node->dbi = dbi; + context->current_node = dbi_node; + break; + case 2: + tmp = new char[wcslen(stream_ptr) + 1]; + wcstombs(tmp, stream_ptr, wcslen(stream_ptr) + 1); + file_node = new file_node_t(tmp, this); + file_node->hccx = hccx; + file_node->filename = stream_ptr; + context->current_node = file_node; + break; + case 3: + if (context->job_level == 'F') + { + time_t now = time(NULL); + sp->fname = full_path; + sp->link = full_path; + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + sp->type = FT_DIREND; + } + else + { + bfuncs->setBaculaValue(context->bpContext, bVarFileSeen, (void *)full_path); + return bRC_Seen; + } + break; + } + + return bRC_OK; +} + +bRC +store_node_t::endBackupFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endBackupNode_STORE state = %d\n", state); + bRC retval = bRC_OK; + + switch(state) + { + case 0: + // should never happen + break; + case 1: + state = 2; + retval = bRC_More; + break; + case 2: + safe_delete(file_node); + stream_ptr += wcslen(stream_ptr) + 1; + if (*stream_ptr == 0) + state = 3; + retval = bRC_More; + break; + case 3: + //delete dbi_node; + context->current_node = parent; + break; + } + return retval; +} + +bRC +store_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + _DebugMessage(0, "createFile_STORE state = %d\n", state); + + if (strcmp(context->path_bits[level - 1], parent->name) != 0) + { + _DebugMessage(0, "Different storage group - switching back to parent\n", state); + context->current_node = parent; + return bRC_OK; + } + for (;;) + { + switch (state) + { + case 0: + if (strcmp("DatabaseBackupInfo", context->path_bits[level + 1]) != 0) + { + _JobMessage(M_FATAL, "DatabaseBackupInfo file must exist and must be first in directory\n"); + state = 999; + break; + } + dbi_node = new dbi_node_t(bstrdup(context->path_bits[level + 1]), this); + context->current_node = dbi_node; + return bRC_OK; + case 1: + if (strcmp(context->path_bits[level - 1], parent->name) != 0) + { + _JobMessage(M_ERROR, "Unexpected Storage Group Change\n"); + state = 999; + break; + } + + if (*stream_ptr != 0) + { + // verify that stream_ptr == context->path_bits[level + 1]; + _DebugMessage(150, "stream_ptr = %S\n", stream_ptr); + _DebugMessage(150, "out_stream_ptr = %S\n", out_stream_ptr); + file_node = new file_node_t(bstrdup(context->path_bits[level + 1]), this); + file_node->hccx = hccx; + file_node->filename = out_stream_ptr; + context->current_node = file_node; + return bRC_OK; + } + else + { + _JobMessage(M_ERROR, "Extra file found '%s'\n", full_path); + state = 999; + break; + } + case 2: + if (rp->type != FT_DIREND) + { + _JobMessage(M_ERROR, "Unexpected file '%s'\n", full_path); + state = 999; + break; + } + rp->create_status = CF_CREATED; + return bRC_OK; + case 999: + if (strcmp(context->path_bits[level], name) != 0) + { + _DebugMessage(0, "End of Store when in error state - switching back to parent\n", state); + context->current_node = parent; + return bRC_OK; + } + rp->create_status = CF_CREATED; + return bRC_OK; + } + } +} + +bRC +store_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + HRESULT result; + + _DebugMessage(0, "endRestoreFile_STORE state = %d\n", state); + for (;;) + { + switch (state) + { + case 0: + state = 1; + _DebugMessage(0, "Calling HrESERestoreAddDatabase\n"); + result = HrESERestoreAddDatabase(hccx, dbi_node->restore_display_name, dbi_node->restore_guid, dbi_node->restore_input_streams, &dbi_node->restore_output_streams); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreAddDatabase failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + stream_ptr = dbi_node->restore_input_streams; + out_stream_ptr = dbi_node->restore_output_streams; + return bRC_OK; + case 1: + if (*stream_ptr != 0) + { + safe_delete(file_node); + file_node = NULL; + stream_ptr += wcslen(stream_ptr) + 1; + out_stream_ptr += wcslen(out_stream_ptr) + 1; + if (*stream_ptr == 0) + state = 2; + return bRC_OK; + } + else + { + state = 999; + break; + } + case 2: + context->current_node = parent; + return bRC_OK; + case 999: + return bRC_OK; + } + } +} diff --git a/bacula/src/win32/filed/plugins/exchange-fd.c b/bacula/src/win32/filed/plugins/exchange-fd.c new file mode 100644 index 0000000000..001dd43ccd --- /dev/null +++ b/bacula/src/win32/filed/plugins/exchange-fd.c @@ -0,0 +1,528 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + * + * Used only in "old Exchange plugin" now deprecated. + */ + +#include "exchange-fd.h" + +/* Pointers to Bacula functions */ +bFuncs *bfuncs = NULL; +bInfo *binfo = NULL; + +#define PLUGIN_LICENSE "Bacula" +#define PLUGIN_AUTHOR "James Harper" +#define PLUGIN_DATE "September 2008" +#define PLUGIN_VERSION "1" +#define PLUGIN_DESCRIPTION "Exchange Plugin" + +static pInfo pluginInfo = { + sizeof(pluginInfo), + FD_PLUGIN_INTERFACE_VERSION, + FD_PLUGIN_MAGIC, + PLUGIN_LICENSE, + PLUGIN_AUTHOR, + PLUGIN_DATE, + PLUGIN_VERSION, + PLUGIN_DESCRIPTION +}; + +/* Forward referenced functions */ +static bRC newPlugin(bpContext *ctx); +static bRC freePlugin(bpContext *ctx); +static bRC getPluginValue(bpContext *ctx, pVariable var, void *value); +static bRC setPluginValue(bpContext *ctx, pVariable var, void *value); +static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value); +static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp); +static bRC endBackupFile(bpContext *ctx); +static bRC pluginIO(bpContext *ctx, struct io_pkt *io); +static bRC startRestoreFile(bpContext *ctx, const char *cmd); +static bRC endRestoreFile(bpContext *ctx); +static bRC createFile(bpContext *ctx, struct restore_pkt *rp); +static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp); +static bRC checkFile(bpContext *ctx, char *fname); + +static pFuncs pluginFuncs = { + sizeof(pluginFuncs), + FD_PLUGIN_INTERFACE_VERSION, + + /* Entry points into plugin */ + newPlugin, /* new plugin instance */ + freePlugin, /* free plugin instance */ + getPluginValue, + setPluginValue, + handlePluginEvent, + startBackupFile, + endBackupFile, + startRestoreFile, + endRestoreFile, + pluginIO, + createFile, + setFileAttributes, + checkFile, + NULL /* No ACL/XATTR */ +}; + +extern "C" { + +static char ** +splitString(char *string, char split, int maxParts, int *count) +{ + char **RetVal; + char *first; + char *last; + + //KdPrint((__DRIVER_NAME " a\n")); + + *count = 0; + + RetVal = (char **)malloc((maxParts + 1) * sizeof(char *)); + last = string; + do + { + if (*count == maxParts) + break; + first = last; + for (last = first; *last != '\0' && *last != split; last++); + RetVal[*count] = (char *)malloc(last - first + 1); + strncpy(RetVal[*count], first, last - first); + RetVal[*count][last - first] = 0; + (*count)++; + if (*last == split) + last++; + } while (*last != 0); + RetVal[*count] = NULL; + return RetVal; +} + +bRC DLL_IMP_EXP +loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs) +{ + bRC retval; + bfuncs = lbfuncs; /* set Bacula funct pointers */ + binfo = lbinfo; + *pinfo = &pluginInfo; + *pfuncs = &pluginFuncs; + retval = loadExchangeApi(); + if (retval != bRC_OK) { + printf("Cannot load Exchange DLL\n"); + return retval; + } + return retval; +} + +bRC DLL_IMP_EXP +unloadPlugin() +{ + return bRC_OK; +} + +} +/* +void * +b_malloc(const char *file, int lone, size_t size) +{ + return NULL; +} + +void * +sm_malloc(const char *file, int lone, size_t size) +{ + return NULL; +} +*/ + +static bRC newPlugin(bpContext *ctx) +{ + exchange_fd_context_t *context; + bRC retval = bRC_OK; + DWORD size; + + int JobId = 0; + ctx->pContext = new exchange_fd_context_t; + context = (exchange_fd_context_t *)ctx->pContext; + context->bpContext = ctx; + context->job_since = 0; + context->notrunconfull_option = false; + context->plugin_active = false; + bfuncs->getBaculaValue(ctx, bVarJobId, (void *)&JobId); + _DebugMessage(0, "newPlugin JobId=%d\n", JobId); + bfuncs->registerBaculaEvents(ctx, 1, 2, 0); + size = MAX_COMPUTERNAME_LENGTH + 1; + context->computer_name = new WCHAR[size]; + /* + GetComputerNameW(context->computer_name, &size); + */ + GetComputerNameExW(ComputerNameNetBIOS, context->computer_name, &size); + context->current_node = NULL; + context->root_node = NULL; + return retval; +} + +static bRC freePlugin(bpContext *ctx) +{ + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + int JobId = 0; + bfuncs->getBaculaValue(ctx, bVarJobId, (void *)&JobId); + _DebugMessage(100, "freePlugin JobId=%d\n", JobId); + delete context; + return bRC_OK; +} + +static bRC getPluginValue(bpContext *ctx, pVariable var, void *value) +{ + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + _DebugMessage(100, "getPluginValue var=%d\n", var); + return bRC_OK; +} + +static bRC setPluginValue(bpContext *ctx, pVariable var, void *value) +{ + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + _DebugMessage(100, "setPluginValue var=%d\n", var); + return bRC_OK; +} + +static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value) +{ + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + char *name; + int i, intval; + int accurate; + char *command; + char *plugin_name; + + switch (event->eventType) { + case bEventJobStart: + _DebugMessage(0, "JobStart=%s\n", (char *)value); + context->plugin_active = false; + break; + case bEventJobEnd: + _DebugMessage(0, "JobEnd\n"); + break; + case bEventPluginCommand: + _DebugMessage(0, "bEventPluginCommand %s\n", value); + command = bstrdup((char *)value); + /* this isn't really unused */ + plugin_name = strtok((char *)command, ":"); + if (strcmp(plugin_name, "exchange") != 0) { + context->plugin_active = false; + } else { + context->plugin_active = true; + } + free(command); + break; + case bEventStartBackupJob: + if (!context->plugin_active) { + break; + } + _DebugMessage(0, "BackupStart\n"); + bfuncs->getBaculaValue(ctx, bVarAccurate, (void *)&accurate); + context->accurate = accurate; + context->job_type = JOB_TYPE_BACKUP; + // level should have been specified by now - check it + // if level is D or I, since should have been specified too + switch (context->job_level) { + case 'F': + if (context->notrunconfull_option) { + context->truncate_logs = false; + } else { + context->truncate_logs = true; + } + break; + case 'D': + context->truncate_logs = false; + break; + case 'I': + context->truncate_logs = false; + break; + default: + _DebugMessage(0, "Invalid job level %c\n", context->job_level); + return bRC_Error; + } + break; + case bEventEndBackupJob: + _DebugMessage(0, "BackupEnd\n"); + if (!context->plugin_active) { + break; + } + break; + case bEventLevel: + /* We don't know if the plugin is active here yet */ + intval = (intptr_t)value; + _DebugMessage(0, "JobLevel=%c %d\n", intval, intval); + context->job_level = intval; + break; + case bEventSince: + /* We don't know if the plugin is active here yet */ + intval = (intptr_t)value; + _DebugMessage(0, "since=%d\n", intval); + context->job_since = (time_t)value; + break; + case bEventStartRestoreJob: + _DebugMessage(0, "StartRestoreJob\n"); + context->job_type = JOB_TYPE_RESTORE; + context->plugin_active = true; + break; + case bEventEndRestoreJob: + if (!context->plugin_active) { + break; + } + _DebugMessage(0, "EndRestoreJob\n"); + context->plugin_active = false; + break; + + /* Plugin command e.g. plugin = ::command */ + case bEventRestoreCommand: + _DebugMessage(0, "restore\n"); // command=%s\n", (char *)value); + if (!context->plugin_active) { + break; + } + break; + + case bEventBackupCommand: + if (!context->plugin_active) { + break; + } + { + _DebugMessage(0, "backup command=%s\n", (char *)value); + char *command = new char[strlen((char *)value) + 1]; + strcpy(command, (char *)value); + char *plugin_name = strtok((char *)command, ":"); + char *path = strtok(NULL, ":"); + char *option; + while ((option = strtok(NULL, ":")) != NULL) { + _DebugMessage(100, "option %s\n", option); + if (stricmp(option, "notrunconfull") == 0) { + context->notrunconfull_option = true; + } else { + _JobMessage(M_WARNING, "Unknown plugin option '%s'\n", option); + } + } + _DebugMessage(0, "name = %s\n", plugin_name); + _DebugMessage(0, "path = %s\n", path); + if (*path != '/') { + _JobMessage(M_FATAL, "Path does not begin with a '/'\n"); + return bRC_Error; + } + + for (i = 0; i < 6; i++) { + context->path_bits[i] = NULL; + } + + char *path_bit = strtok(path, "/"); + for (i = 0; path_bit != NULL && i < 6; i++) { + context->path_bits[i] = new char[strlen(path_bit) + 1]; + strcpy(context->path_bits[i], path_bit); + path_bit = strtok(NULL, "/"); + } + + if (i < 2 || i > 4) { + _JobMessage(M_FATAL, "Invalid plugin backup path\n"); + return bRC_Error; + } + context->root_node = new root_node_t(context->path_bits[0]); + context->current_node = context->root_node; + + } + break; + + case bEventVssBeforeCloseRestore: + break; + case bEventComponentInfo: + break; + + default: + _DebugMessage(0, "Ignored event=%d\n", event->eventType); + break; + } + bfuncs->getBaculaValue(ctx, bVarFDName, (void *)&name); + return bRC_OK; +} + +static bRC +startBackupFile(bpContext *ctx, struct save_pkt *sp) +{ + bRC retval; + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + node_t *current_node; + + _DebugMessage(100, "startBackupFile, cmd = %s\n", sp->cmd); + if (sp->pkt_size != sizeof(struct save_pkt) || sp->pkt_end != sizeof(struct save_pkt)) { + _JobMessage(M_FATAL, "save_pkt size mismatch - sizeof(struct save_pkt) = %d, pkt_size = %d, pkt_end = %d\n", sizeof(struct save_pkt), sp->pkt_size, sp->pkt_end); + return bRC_Error; + } + + //context->root_node = new root_node_t(PLUGIN_PATH_PREFIX_BASE); + //context->current_node = context->root_node; + do { + current_node = context->current_node; + retval = current_node->startBackupFile(context, sp); + if (retval == bRC_Seen) + endBackupFile(ctx); + } while (current_node != context->current_node); + _DebugMessage(100, "startBackupFile done - type = %d, fname = %s, retval = %d\n", sp->type, sp->fname, retval); + return retval; +} + +static bRC endBackupFile(bpContext *ctx) +{ + bRC retval; + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + node_t *current_node; + + _DebugMessage(100, "endBackupFile\n"); + + do { + current_node = context->current_node; + retval = current_node->endBackupFile(context); + } while (current_node != context->current_node); + _DebugMessage(100, "endBackupFile done - retval = %d\n", retval); + return retval; +} + +/* + * Do actual I/O + */ +static bRC pluginIO(bpContext *ctx, struct io_pkt *io) +{ + bRC retval = bRC_OK; + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + + if (io->pkt_size != sizeof(struct io_pkt) || io->pkt_end != sizeof(struct io_pkt)) + { + _JobMessage(M_FATAL, "io_pkt size mismatch - sizeof(struct io_pkt) = %d, pkt_size = %d, pkt_end = %d\n", sizeof(struct io_pkt), io->pkt_size, io->pkt_end); + } + + switch(io->func) { + case IO_OPEN: + _DebugMessage(100, "IO_OPEN\n"); + retval = context->current_node->pluginIoOpen(context, io); + break; + case IO_READ: + //_DebugMessage(100, "IO_READ buf=%p len=%d\n", io->buf, io->count); + retval = context->current_node->pluginIoRead(context, io); + break; + case IO_WRITE: + //_DebugMessage(100, "IO_WRITE buf=%p len=%d\n", io->buf, io->count); + retval = context->current_node->pluginIoWrite(context, io); + break; + case IO_CLOSE: + _DebugMessage(100, "IO_CLOSE\n"); + retval = context->current_node->pluginIoClose(context, io); + break; + } + return retval; +} + +static bRC startRestoreFile(bpContext *ctx, const char *cmd) +{ + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + _DebugMessage(100, "startRestoreFile\n"); + + return bRC_OK; +} + +static bRC endRestoreFile(bpContext *ctx) +{ + bRC retval; + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + node_t *current_node; + + _DebugMessage(100, "endRestoreFile\n"); + + do { + current_node = context->current_node; + retval = current_node->endRestoreFile(context); + } while (current_node != context->current_node); + _DebugMessage(100, "endRestoreFile done - retval = %d\n", retval); + return retval; +} + +static bRC createFile(bpContext *ctx, struct restore_pkt *rp) +{ + bRC retval; + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + node_t *current_node; + char **path_bits; + int count; + int i; + + + _DebugMessage(100, "createFile - type = %d, ofname = %s\n", rp->type, rp->ofname); + if (rp->pkt_size != sizeof(struct restore_pkt) || rp->pkt_end != sizeof(struct restore_pkt)) + { + _JobMessage(M_FATAL, "restore_pkt size mismatch - sizeof(struct restore_pkt) = %d, pkt_size = %d, pkt_end = %d\n", sizeof(struct restore_pkt), rp->pkt_size, rp->pkt_end); + return bRC_Error; + } + + for (i = 0; i < 6; i++) + { + context->path_bits[i] = NULL; + } + + path_bits = splitString((char *)rp->ofname, '/', 7, &count); + + _DebugMessage(100, "count = %d\n", count); + + for (i = 1; i < count; i++) + { + _DebugMessage(150, "%d = '%s'\n", i, path_bits[i]); + context->path_bits[i - 1] = path_bits[i]; + } + + if (context->current_node == NULL) + { + context->root_node = new root_node_t(context->path_bits[0]); + context->current_node = context->root_node; + } + + do { + current_node = context->current_node; + retval = current_node->createFile(context, rp); + } while (current_node != context->current_node); + _DebugMessage(100, "createFile done - retval = %d\n", retval); + return retval; +} + +static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp) +{ + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + _DebugMessage(100, "setFileAttributes\n"); + return bRC_OK; +} + +/* + * At the end of the job, the accurate code loops over all files + * that are in the accurate list but not marked as seen during the + * backup. Unless the checkFile routine returns bRC_Seen, + * these files look to be deleted and hence will not be + * returned during a restore. + */ +static bRC checkFile(bpContext *ctx, char *fname) +{ + exchange_fd_context_t *context = (exchange_fd_context_t *)ctx->pContext; + if (context->plugin_active) { + _DebugMessage(100, "marked as seen %s\n", fname); + return bRC_Seen; + } + return bRC_OK; +} diff --git a/bacula/src/win32/filed/plugins/exchange-fd.def b/bacula/src/win32/filed/plugins/exchange-fd.def new file mode 100644 index 0000000000..e79095cb3e --- /dev/null +++ b/bacula/src/win32/filed/plugins/exchange-fd.def @@ -0,0 +1,15 @@ +LIBRARY bacula.dll +EXPORTS + +; compat.o +;_Z10open_bpipePciPKc +;_Z11close_bpipeP5BPIPE +;_Z11close_wpipeP5BPIPE + +;console_command DATA +;b_plugin_list DATA +;plugin_bopen DATA +;plugin_bclose DATA +;plugin_bwrite DATA +;plugin_bread DATA +;plugin_blseek DATA diff --git a/bacula/src/win32/filed/plugins/exchange-fd.h b/bacula/src/win32/filed/plugins/exchange-fd.h new file mode 100644 index 0000000000..793c2a49f4 --- /dev/null +++ b/bacula/src/win32/filed/plugins/exchange-fd.h @@ -0,0 +1,157 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Written by James Harper, July 2010 + */ + +#ifndef _EXCHANGE_FD_H +#define _EXCHANGE_FD_H + +#define BUILD_PLUGIN + +#if defined(BUILDING_DLL) +# define DLL_IMP_EXP __declspec(dllexport) +#elif defined(USING_DLL) +# define DLL_IMP_EXP __declspec(dllimport) +#else +# define DLL_IMP_EXP +#endif + +#if defined(HAVE_WIN32) +#if defined(HAVE_MINGW) +#include "winhdrs.h" +#else +#include "winconfig.h" +#endif +#else +#include "config.h" +#endif +#define __CONFIG_H + +enum { + /* Keep M_ABORT=1 for dlist.h */ + M_ABORT = 1, /* MUST abort immediately */ + M_DEBUG, /* debug message */ + M_FATAL, /* Fatal error, stopping job */ + M_ERROR, /* Error, but recoverable */ + M_WARNING, /* Warning message */ + M_INFO, /* Informational message */ + M_SAVED, /* Info on saved file */ + M_NOTSAVED, /* Info on notsaved file */ + M_SKIPPED, /* File skipped during backup by option setting */ + M_MOUNT, /* Mount requests */ + M_ERROR_TERM, /* Error termination request (no dump) */ + M_TERM, /* Terminating daemon normally */ + M_RESTORED, /* ls -l of restored files */ + M_SECURITY, /* security violation */ + M_ALERT, /* tape alert messages */ + M_VOLMGMT /* Volume management messages */ +}; + +#define FT_REG 3 +#define FT_DIREND 5 + +#define _REENTRANT 1 +#define _THREAD_SAFE 1 +#define _POSIX_PTHREAD_SEMANTICS 1 + +#include + +#include +#include +#include +#include +#ifdef HAVE_SYS_BITYPES_H +#include +#endif + +//#include "bacula.h" +#include "compat.h" +#include "bc_types.h" + +typedef int64_t boffset_t; +//#define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str)) +#define bstrdup(str) strdup(str) + +#include "fd_plugins.h" +#include "exch_api.h" + +#if defined(HAVE_WIN32) +#include "winapi.h" +#include "winhost.h" +#else +#include "host.h" +#endif + +#define EXCHANGE_PLUGIN_VERSION 1 + +#define JOB_TYPE_BACKUP 1 +#define JOB_TYPE_RESTORE 2 + +#define JOB_LEVEL_FULL ((int)'F') +#define JOB_LEVEL_INCREMENTAL ((int)'I') +#define JOB_LEVEL_DIFFERENTIAL ((int)'D') + +struct exchange_fd_context_t; + +#include "exch_node.h" + +struct exchange_fd_context_t { + struct bpContext *bpContext; + WCHAR *computer_name; + char *path_bits[6]; + root_node_t *root_node; + node_t *current_node; + int job_type; + int job_level; + time_t job_since; + bool notrunconfull_option; + bool truncate_logs; + bool accurate; + bool plugin_active; +}; + +static inline char *tocharstring(WCHAR *src) +{ + char *tmp = new char[wcslen(src) + 1]; + wcstombs(tmp, src, wcslen(src) + 1); + return tmp; +} + +static inline WCHAR *towcharstring(char *src) +{ + WCHAR *tmp = new WCHAR[strlen(src) + 1]; + mbstowcs(tmp, src, strlen(src) + 1); + return tmp; +} + +#define safe_delete(buf) if (buf) { delete buf; buf=NULL; } + +extern bFuncs *bfuncs; +extern bInfo *binfo; + +#define _DebugMessage(level, message, ...) bfuncs->DebugMessage(context->bpContext, __FILE__, __LINE__, level, message, ##__VA_ARGS__) +#define _JobMessage(type, message, ...) bfuncs->JobMessage(context->bpContext, __FILE__, __LINE__, type, 0, message, ##__VA_ARGS__) +#define _JobMessageNull(type, message, ...) bfuncs->JobMessage(NULL, __FILE__, __LINE__, type, 0, message, ##__VA_ARGS__) + +#define PLUGIN_PATH_PREFIX_BASE "@EXCHANGE" +#define PLUGIN_PATH_PREFIX_SERVICE "Microsoft Information Store" +#define PLUGIN_PATH_PREFIX_SERVICE_W L"Microsoft Information Store" + +#endif /* _EXCHANGE_FD_H */ diff --git a/bacula/src/win32/filed/plugins/file_node.c b/bacula/src/win32/filed/plugins/file_node.c new file mode 100644 index 0000000000..18ff399a75 --- /dev/null +++ b/bacula/src/win32/filed/plugins/file_node.c @@ -0,0 +1,236 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#include "exchange-fd.h" + +file_node_t::file_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_FILE, parent_node) +{ + backup_file_handle = INVALID_HANDLE_VALUE; + restore_file_handle = INVALID_HANDLE_VALUE; + restore_at_file_level = FALSE; +} + +file_node_t::~file_node_t() +{ + if (backup_file_handle != INVALID_HANDLE_VALUE) + { + //_DebugMessage(100, "closing file handle in destructor\n"); + CloseHandle(backup_file_handle); + } + if (restore_file_handle != INVALID_HANDLE_VALUE) + { + //_DebugMessage(100, "closing file handle in destructor\n"); + if (restore_at_file_level) + { + CloseHandle(restore_file_handle); + } + else + { + // maybe one day + } + } +} + +bRC +file_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + time_t now = time(NULL); + _DebugMessage(100, "startBackupNode_FILE state = %d\n", state); + + if (context->job_level == 'F' || parent->type == NODE_TYPE_STORAGE_GROUP) { + sp->fname = full_path; + sp->link = full_path; + _DebugMessage(100, "fname = %s\n", sp->fname); + sp->statp.st_mode = 0700 | S_IFREG; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = (uint64_t)-1; + sp->type = FT_REG; + return bRC_OK; + } else { + bfuncs->setBaculaValue(context->bpContext, bVarFileSeen, (void *)full_path); + return bRC_Seen; + } +} + +bRC +file_node_t::endBackupFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endBackupNode_FILE state = %d\n", state); + + context->current_node = parent; + + return bRC_OK; +} + +bRC +file_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + //HrESERestoreOpenFile with name of log file + + _DebugMessage(100, "createFile_FILE state = %d\n", state); + rp->create_status = CF_EXTRACT; + return bRC_OK; +} + +bRC +file_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endRestoreFile_FILE state = %d\n", state); + context->current_node = parent; + return bRC_OK; +} + +bRC +file_node_t::pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io) +{ + HRESULT result; + HANDLE handle; + char *tmp = new char[wcslen(filename) + 1]; + wcstombs(tmp, filename, wcslen(filename) + 1); + + _DebugMessage(100, "pluginIoOpen_FILE - filename = %s\n", tmp); + io->status = 0; + io->io_errno = 0; + if (context->job_type == JOB_TYPE_BACKUP) + { + _DebugMessage(10, "Calling HrESEBackupOpenFile\n"); + result = HrESEBackupOpenFile(hccx, filename, 65535, 1, &backup_file_handle, §ion_size); + if (result) + { + _JobMessage(M_FATAL, "HrESEBackupOpenFile failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + backup_file_handle = INVALID_HANDLE_VALUE; + io->io_errno = 1; + return bRC_Error; + } + } + else + { + _DebugMessage(10, "Calling HrESERestoreOpenFile for '%s'\n", tmp); + result = HrESERestoreOpenFile(hccx, filename, 1, &restore_file_handle); + if (result == hrRestoreAtFileLevel) + { + restore_at_file_level = true; + _DebugMessage(100, "Calling CreateFileW for '%s'\n", tmp); + handle = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle == INVALID_HANDLE_VALUE) + { + _JobMessage(M_FATAL, "CreateFile failed"); + return bRC_Error; + } + restore_file_handle = (void *)handle; + return bRC_OK; + } + else if (result == 0) + { + _JobMessage(M_FATAL, "Exchange File IO API not yet supported for restore\n"); + restore_at_file_level = false; + return bRC_Error; + } + else + { + _JobMessage(M_FATAL, "HrESERestoreOpenFile failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + } + return bRC_OK; +} + +bRC +file_node_t::pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io) +{ + HRESULT result; + uint32_t readLength; + + io->status = 0; + io->io_errno = 0; + _DebugMessage(200, "Calling HrESEBackupReadFile\n"); + result = HrESEBackupReadFile(hccx, backup_file_handle, io->buf, io->count, &readLength); + if (result) + { + io->io_errno = 1; + return bRC_Error; + } + io->status = readLength; + size += readLength; + return bRC_OK; +} + +bRC +file_node_t::pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io) +{ + DWORD bytes_written; + + io->io_errno = 0; + if (!restore_at_file_level) + return bRC_Error; + + if (!WriteFile(restore_file_handle, io->buf, io->count, &bytes_written, NULL)) + { + _JobMessage(M_FATAL, "Write Error"); + return bRC_Error; + } + + if (bytes_written != (DWORD)io->count) + { + _JobMessage(M_FATAL, "Short write"); + return bRC_Error; + } + io->status = bytes_written; + + return bRC_OK; +} + +bRC +file_node_t::pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io) +{ + if (context->job_type == JOB_TYPE_BACKUP) + { + _DebugMessage(100, "Calling HrESEBackupCloseFile\n"); + HrESEBackupCloseFile(hccx, backup_file_handle); + backup_file_handle = INVALID_HANDLE_VALUE; + return bRC_OK; + } + else + { + if (restore_at_file_level) + { + CloseHandle(restore_file_handle); + restore_file_handle = INVALID_HANDLE_VALUE; + return bRC_OK; + } + else + { + return bRC_OK; + } + } +} diff --git a/bacula/src/win32/filed/plugins/node.c b/bacula/src/win32/filed/plugins/node.c new file mode 100644 index 0000000000..f26e3174d9 --- /dev/null +++ b/bacula/src/win32/filed/plugins/node.c @@ -0,0 +1,127 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#include "exchange-fd.h" + +node_t::node_t(char *name, int type) +{ + this->type = type; + state = 0; + parent = NULL; + this->name = bstrdup(name); + full_path = make_full_path(); + size = 0; + level = 0; +} + +node_t::node_t(char *name, int type, node_t *parent_node) +{ + this->type = type; + state = 0; + parent = parent_node; + this->name = bstrdup(name); + full_path = make_full_path(); + size = 0; + level = parent->level + 1; +} + +node_t::~node_t() +{ + delete name; + delete full_path; +} + +char * +node_t::make_full_path() +{ + node_t *curr_node; + int len; + char *retval; + + for (len = 0, curr_node = this; curr_node != NULL; curr_node = curr_node->parent) + { + len += strlen(curr_node->name) + 1; + } + if (type == NODE_TYPE_FILE || type == NODE_TYPE_DATABASE_INFO) + { + retval = new char[len + 1]; + retval[len] = 0; + } + else + { + retval = new char[len + 2]; + retval[len] = '/'; + retval[len + 1] = 0; + } + for (curr_node = this; curr_node != NULL; curr_node = curr_node->parent) + { + len -= strlen(curr_node->name); + memcpy(retval + len, curr_node->name, strlen(curr_node->name)); + retval[--len] = '/'; + } + return retval; +} + +bRC +node_t::pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io) +{ + _DebugMessage(100, "pluginIoOpen_Node\n"); + io->status = 0; + io->io_errno = 0; + return bRC_OK; +} + +bRC +node_t::pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io) +{ + _DebugMessage(100, "pluginIoRead_Node\n"); + io->status = 0; + io->io_errno = 0; + return bRC_OK; +} + +bRC +node_t::pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io) +{ + _DebugMessage(100, "pluginIoWrite_Node\n"); + io->status = 0; + io->io_errno = 1; + return bRC_Error; +} + +bRC +node_t::pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io) +{ + _DebugMessage(100, "pluginIoClose_Node\n"); + io->status = 0; + io->io_errno = 0; + return bRC_OK; +} diff --git a/bacula/src/win32/filed/plugins/node.h b/bacula/src/win32/filed/plugins/node.h new file mode 100644 index 0000000000..dcaa43f420 --- /dev/null +++ b/bacula/src/win32/filed/plugins/node.h @@ -0,0 +1,186 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2008 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#define NODE_TYPE_UNKNOWN 0 +#define NODE_TYPE_ROOT 1 +#define NODE_TYPE_SERVICE 2 +#define NODE_TYPE_STORAGE_GROUP 3 +#define NODE_TYPE_STORE 4 +#define NODE_TYPE_DATABASE_INFO 5 +#define NODE_TYPE_FILE 6 + +class node_t { +public: + int type; + int state; + node_t *parent; + char *name; + char *full_path; + size_t size; + int level; + + node_t(char *name, int type); + node_t(char *name, int type, node_t *parent_node); + virtual ~node_t(); + + char *make_full_path(); + + virtual bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) = 0; + virtual bRC endBackupFile(exchange_fd_context_t *context) = 0; + + virtual bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp) = 0; + virtual bRC endRestoreFile(exchange_fd_context_t *context) = 0; + + virtual bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io); + virtual bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io); + virtual bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io); + virtual bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io); +}; + +class file_node_t : public node_t { +public: + WCHAR *filename; + HCCX hccx; + VOID *backup_file_handle; + VOID *restore_file_handle; + uint64_t section_size; + bool restore_at_file_level; + + file_node_t(char *name, node_t *parent_node); + virtual ~file_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); + + bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io); +}; + +class dbi_node_t : public node_t { +public: + DATABASE_BACKUP_INFO *dbi; + char *buffer; + uint32_t buffer_size; + uint32_t buffer_pos; + WCHAR *restore_display_name; + GUID restore_guid; + WCHAR *restore_input_streams; + WCHAR *restore_output_streams; + + dbi_node_t(char *name, node_t *parent_node); + virtual ~dbi_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); + + bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io); + bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io); +}; + +class store_node_t : public node_t { +public: + HCCX hccx; + DATABASE_BACKUP_INFO *dbi; + WCHAR *stream_ptr; + file_node_t *file_node; + dbi_node_t *dbi_node; + WCHAR *out_stream_ptr; + + store_node_t(char *name, node_t *parent_node); + virtual ~store_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); +}; + +class storage_group_node_t : public node_t { +public: + HCCX hccx; + INSTANCE_BACKUP_INFO *ibi; + store_node_t *store_node; + file_node_t *file_node; + uint32_t current_dbi; + WCHAR *logfiles; + WCHAR *logfile_ptr; + RESTORE_ENVIRONMENT *restore_environment; + WCHAR *service_name; + WCHAR *storage_group_name; + WCHAR *saved_log_path; + storage_group_node_t *next; + + storage_group_node_t(char *name, node_t *parent_node); + virtual ~storage_group_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); +}; + +class service_node_t : public node_t { +public: + uint32_t ibi_count; + INSTANCE_BACKUP_INFO *ibi; + HCCX hccx; + uint32_t current_ibi; + storage_group_node_t *first_storage_group_node; + + service_node_t(char *name, node_t *parent_node); + virtual ~service_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); +}; + +class root_node_t : public node_t { +public: + service_node_t *service_node; + + root_node_t(char *name); + virtual ~root_node_t(); + bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp); + bRC endBackupFile(exchange_fd_context_t *context); + + bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp); + bRC endRestoreFile(exchange_fd_context_t *context); +}; diff --git a/bacula/src/win32/filed/plugins/root_node.c b/bacula/src/win32/filed/plugins/root_node.c new file mode 100644 index 0000000000..dfddb7469f --- /dev/null +++ b/bacula/src/win32/filed/plugins/root_node.c @@ -0,0 +1,162 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#include "exchange-fd.h" + +root_node_t::root_node_t(char *name) : node_t(name, NODE_TYPE_ROOT) +{ + service_node = NULL; +} + +root_node_t::~root_node_t() +{ +} + +bRC +root_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + bRC retval = bRC_OK; + time_t now; + + _DebugMessage(100, "startBackupNode_ROOT state = %d\n", state); + switch(state) + { + case 0: + if (strcmp(PLUGIN_PATH_PREFIX_BASE, name) != 0) + { + _JobMessage(M_FATAL, "Invalid backup path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n"); + state = 999; + return bRC_Error; + } + // check that service_node == NULL + service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this); + state = 1; + // fall through + case 1: + context->current_node = service_node; + break; + case 2: + now = time(NULL); + sp->fname = full_path; + sp->link = full_path; + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + sp->type = FT_DIREND; + break; + case 999: + return bRC_Error; + default: + _JobMessage(M_FATAL, "startBackupFile: invalid internal state %d", state); + state = 999; + } + return retval; +} + +bRC +root_node_t::endBackupFile(exchange_fd_context_t *context) +{ + bRC retval = bRC_OK; + + _DebugMessage(100, "endBackupNode_ROOT state = %d\n", state); + switch(state) + { + case 1: + state = 2; + retval = bRC_More; + // free service_node here? + break; + case 2: + retval = bRC_OK; + break; + case 999: + retval = bRC_Error; + default: + _JobMessage(M_FATAL, "endBackupFile: invalid internal state %d", state); + state = 999; + return bRC_Error; + } + return retval; +} + +bRC +root_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + _DebugMessage(100, "createFile_ROOT state = %d\n", state); + switch (state) { + case 0: + if (strcmp(name, PLUGIN_PATH_PREFIX_BASE) != 0) { + _JobMessage(M_FATAL, "Invalid restore path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n"); + state = 999; + return bRC_Error; + } + service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this); + context->current_node = service_node; + return bRC_OK; + case 1: + rp->create_status = CF_CREATED; + return bRC_OK; + + /* Skip this file */ + case 900: + rp->create_status = CF_SKIP; + return bRC_OK; + /* Error */ + case 999: + return bRC_Error; + default: + _JobMessage(M_FATAL, "createFile: invalid internal state %d", state); + state = 999; + } + return bRC_Error; +} + +bRC +root_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endRestoreFile_ROOT state = %d\n", state); + switch (state) { + case 0: + delete service_node; + state = 1; + return bRC_OK; + case 1: + return bRC_OK; + case 900: + return bRC_OK; + default: + _JobMessage(M_FATAL, "endRestore: invalid internal state %d", state); + state = 999; + } + return bRC_Error; +} diff --git a/bacula/src/win32/filed/plugins/service_node.c b/bacula/src/win32/filed/plugins/service_node.c new file mode 100644 index 0000000000..095320036b --- /dev/null +++ b/bacula/src/win32/filed/plugins/service_node.c @@ -0,0 +1,229 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#include "exchange-fd.h" + +service_node_t::service_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_SERVICE, parent_node) +{ + current_ibi = 0; + hccx = NULL; + ibi = NULL; + ibi_count = 0; + first_storage_group_node = NULL; +} + +service_node_t::~service_node_t() +{ +} + +bRC +service_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + HRESULT result; + char aname[256]; + + _DebugMessage(100, "startBackupNode_SERVICE state = %d\n", state); + switch(state) + { + case 0: + if (strcmp(PLUGIN_PATH_PREFIX_SERVICE, name) != 0) + { + _JobMessage(M_FATAL, "Invalid restore path specified, must start with /" PLUGIN_PATH_PREFIX_BASE "/" PLUGIN_PATH_PREFIX_SERVICE "/\n"); + return bRC_Error; + } + // convert name to a wide string + + _DebugMessage(100, "Calling HrESEBackupPrepare\n"); + wcstombs(aname, context->computer_name, 256); + _JobMessage(M_INFO, "Preparing Exchange Backup for %s\n", aname); + result = HrESEBackupPrepare(context->computer_name, PLUGIN_PATH_PREFIX_SERVICE_W, &ibi_count, &ibi, &hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupPrepare failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + state = 1; + // fall through + case 1: + if (context->path_bits[level + 1] == NULL) + { + _DebugMessage(100, "No specific storage group specified - backing them all up\n"); + char *tmp = new char[wcslen(ibi[current_ibi].wszInstanceName) + 1]; + wcstombs(tmp, ibi[current_ibi].wszInstanceName, wcslen(ibi[current_ibi].wszInstanceName) + 1); + first_storage_group_node = new storage_group_node_t(tmp, this); + delete tmp; + _DebugMessage(100, "storage group name = %s\n", first_storage_group_node->name); + first_storage_group_node->ibi = &ibi[current_ibi]; + first_storage_group_node->hccx = hccx; + context->current_node = first_storage_group_node; + } + else + { + char *tmp = NULL; + for (current_ibi = 0; current_ibi < ibi_count; current_ibi++) + { + tmp = new char[wcslen(ibi[current_ibi].wszInstanceName) + 1]; + wcstombs(tmp, ibi[current_ibi].wszInstanceName, wcslen(ibi[current_ibi].wszInstanceName) + 1); + if (stricmp(tmp, context->path_bits[level + 1]) == 0) + break; + } + first_storage_group_node = new storage_group_node_t(tmp, this); + delete tmp; + if (current_ibi == ibi_count) + { + _JobMessage(M_FATAL, "Invalid Storage Group '%s'\n", context->path_bits[level + 1]); + return bRC_Error; + } + _DebugMessage(100, "storage group name = %s\n", first_storage_group_node->name); + first_storage_group_node->ibi = &ibi[current_ibi]; + first_storage_group_node->hccx = hccx; + context->current_node = first_storage_group_node; + } + break; + case 2: + time_t now = time(NULL); + sp->fname = full_path; + sp->link = full_path; + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + sp->statp.st_nlink = 1; + //sp->statp.st_blocks = 0; + sp->type = FT_DIREND; + break; + } + _DebugMessage(100, "ending startBackupNode_SERVICE state = %d\n", state); + return bRC_OK; +} + +bRC +service_node_t::endBackupFile(exchange_fd_context_t *context) +{ + HRESULT result; + bRC retval = bRC_OK; + + _DebugMessage(100, "endBackupNode_SERVICE state = %d\n", state); + switch(state) + { + case 0: + // should never happen + break; + case 1: + // free node->storage_group_node + if (context->path_bits[level + 1] == NULL) + { + current_ibi++; + if (current_ibi == ibi_count) + state = 2; + } + else + state = 2; + retval = bRC_More; + break; + case 2: + _DebugMessage(100, "calling HrESEBackupEnd\n"); + result = HrESEBackupEnd(hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupEnd failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + + context->current_node = parent; + retval = bRC_OK; + break; + } + return retval; +} + +bRC +service_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + storage_group_node_t *curr_sg, *prev_sg; + + _DebugMessage(100, "createFile_SERVICE state = %d\n", state); + if (strcmp(name, "Microsoft Information Store") != 0) + { + _JobMessage(M_FATAL, "Invalid restore path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/" PLUGIN_PATH_PREFIX_SERVICE "/'\n", state); + return bRC_Error; + } + for(;;) + { + switch (state) + { + case 0: + if (context->path_bits[level + 1] == NULL) + { + state = 1; + break; + } + for (prev_sg = NULL, curr_sg = first_storage_group_node; curr_sg != NULL; prev_sg = curr_sg, curr_sg = curr_sg->next) + { + if (strcmp(curr_sg->name, context->path_bits[level + 1]) == 0) + { + break; + } + } + if (curr_sg == NULL) + { + curr_sg = new storage_group_node_t(bstrdup(context->path_bits[level + 1]), this); + if (prev_sg == NULL) + first_storage_group_node = curr_sg; + else + prev_sg->next = curr_sg; + } + context->current_node = curr_sg; + return bRC_OK; + case 1: + rp->create_status = CF_CREATED; + return bRC_OK; + } + } + return bRC_Error; +} + +bRC +service_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endRestoreFile_SERVICE state = %d\n", state); + switch(state) + { + case 0: + return bRC_Error; + case 1: + context->current_node = parent; + return bRC_OK; + } + + return bRC_Error; +} diff --git a/bacula/src/win32/filed/plugins/storage_group_node.c b/bacula/src/win32/filed/plugins/storage_group_node.c new file mode 100644 index 0000000000..4e6bf2ed1e --- /dev/null +++ b/bacula/src/win32/filed/plugins/storage_group_node.c @@ -0,0 +1,511 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#include "exchange-fd.h" + +storage_group_node_t::storage_group_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_STORAGE_GROUP, parent_node) +{ + ibi = NULL; + store_node = NULL; + current_dbi = 0; + restore_environment = NULL; + saved_log_path = NULL; + next = NULL; +} + +storage_group_node_t::~storage_group_node_t() +{ +/* + if (dbi_node != NULL) + delete dbi_node; + + if (file_node != NULL) + delete file_node; +*/ +} + +bRC +storage_group_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + HRESULT result; + int len; + WCHAR *tmp_logfiles, *tmp_logfile_ptr; + char *tmp; + + for(;;) + { + _DebugMessage(100, "startBackupNode_STORAGE_GROUP state = %d, name = %s\n", state, name); + switch(state) + { + case 0: + current_dbi = 0; + store_node = NULL; + logfile_ptr = NULL; + if (context->job_level == 'F') + { + _DebugMessage(100, "Calling HrESEBackupSetup (BACKUP_TYPE_FULL)\n"); + result = HrESEBackupSetup(hccx, ibi->hInstanceId, BACKUP_TYPE_FULL); + state = 1; + } + else + { + _DebugMessage(100, "Calling HrESEBackupSetup (BACKUP_TYPE_LOGS_ONLY)\n"); + result = HrESEBackupSetup(hccx, ibi->hInstanceId, BACKUP_TYPE_LOGS_ONLY); + if (context->accurate) + state = 1; + else + state = 2; + } + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupSetup failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + return bRC_Error; + } + break; + case 1: + if (context->path_bits[level + 1] == NULL) + { + _DebugMessage(100, "No specific database specified - backing them all up\n"); + DATABASE_BACKUP_INFO *dbi = &ibi->rgDatabase[current_dbi]; + char *tmp = new char[wcslen(dbi->wszDatabaseDisplayName) + 1]; + wcstombs(tmp, dbi->wszDatabaseDisplayName, wcslen(dbi->wszDatabaseDisplayName) + 1); + store_node = new store_node_t(tmp, this); + store_node->dbi = dbi; + store_node->hccx = hccx; + context->current_node = store_node; + } + else + { + DATABASE_BACKUP_INFO *dbi = NULL; + char *tmp = NULL; + for (current_dbi = 0; current_dbi < ibi->cDatabase; current_dbi++) + { + dbi = &ibi->rgDatabase[current_dbi]; + char *tmp = new char[wcslen(dbi->wszDatabaseDisplayName) + 1]; + wcstombs(tmp, dbi->wszDatabaseDisplayName, wcslen(dbi->wszDatabaseDisplayName) + 1); + if (stricmp(tmp, context->path_bits[level + 1]) == 0) + break; + delete tmp; + } + if (current_dbi == ibi->cDatabase) + { + _JobMessage(M_FATAL, "Invalid Database '%s'\n", context->path_bits[level + 1]); + return bRC_Error; + } + store_node = new store_node_t(tmp, this); + _DebugMessage(100, "Database name = %s\n", store_node->name); + delete tmp; + store_node->hccx = hccx; + store_node->dbi = dbi; + context->current_node = store_node; + } + return bRC_OK; + case 2: + _DebugMessage(100, "Calling HrESEBackupGetLogAndPatchFiles\n"); + result = HrESEBackupGetLogAndPatchFiles(hccx, &tmp_logfiles); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupGetLogAndPatchFiles failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + for (len = 0, tmp_logfile_ptr = tmp_logfiles; *tmp_logfile_ptr != 0; tmp_logfile_ptr += wcslen(tmp_logfile_ptr) + 1) + { + len += wcslen(tmp_logfile_ptr) + 1; + } + logfiles = new WCHAR[len + 1]; + logfile_ptr = logfiles; + for (tmp_logfile_ptr = tmp_logfiles; *tmp_logfile_ptr != 0; tmp_logfile_ptr += wcslen(tmp_logfile_ptr) + 1) + { + // check file modification date + HANDLE handle; + FILETIME modified_time; + //int64_t tmp_time; + __int64 tmp_time; + bool include_file; + include_file = false; + handle = INVALID_HANDLE_VALUE; + if (context->job_since == 0) + include_file = true; + if (!include_file) + { + handle = CreateFileW(tmp_logfile_ptr, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle == INVALID_HANDLE_VALUE) + { + //_JobMessage(M_WARNING, "Could not open '%S' to check last modified date (0x%08x), including anyway\n", tmp_logfile_ptr, GetLastError()); + include_file = true; + } + } + if (!include_file) + { + if (GetFileTime(handle, NULL, NULL, &modified_time) == 0) + { + //_JobMessage(M_WARNING, "Could not check last modified date for '%S' (0x%08x), including anyway\n", tmp_logfile_ptr, GetLastError()); + include_file = true; + } + } + if (!include_file) + { + tmp_time = (((int64_t)modified_time.dwHighDateTime) << 32) | modified_time.dwLowDateTime; + tmp_time -= 116444736000000000LL; + tmp_time /= 10000000; + if (tmp_time > context->job_since) + { + include_file = true; + } + } + if (include_file) + { + memcpy(logfile_ptr, tmp_logfile_ptr, (wcslen(tmp_logfile_ptr) + 1) * 2); + logfile_ptr += wcslen(logfile_ptr) + 1; + //_DebugMessage(100, "Including file %S\n", logfile_ptr); + } +#if 0 +/* this is handled via checkFile now */ + else + { + if (context->accurate) { + tmp = new char[strlen(full_path) + wcslen(tmp_logfile_ptr) + 1]; + strcpy(tmp, full_path); + wcstombs(tmp + strlen(full_path), tmp_logfile_ptr, wcslen(tmp_logfile_ptr) + 1); + bfuncs->setBaculaValue(context->bpContext, bVarFileSeen, (void *)tmp); + delete tmp; + } + } +#endif + + if (handle != INVALID_HANDLE_VALUE) + CloseHandle(handle); + + } + *logfile_ptr = 0; + logfile_ptr = logfiles; + state = 3; + break; + case 3: + tmp = new char[wcslen(logfile_ptr) + 1]; + wcstombs(tmp, logfile_ptr, wcslen(logfile_ptr) + 1); + file_node = new file_node_t(tmp, this); + delete tmp; + file_node->hccx = hccx; + file_node->filename = logfile_ptr; + context->current_node = file_node; + return bRC_OK; + case 4: + time_t now = time(NULL); + sp->fname = full_path; + sp->link = full_path; + _DebugMessage(100, "fname = %s\n", sp->fname); + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + //sp->statp.st_blocks = 0; + sp->type = FT_DIREND; + return bRC_OK; + } + } +} + +bRC +storage_group_node_t::endBackupFile(exchange_fd_context_t *context) +{ + HRESULT result; + bRC retval = bRC_Error; + + _DebugMessage(100, "endBackupNode_STORAGE_GROUP state = %d\n", state); + + switch(state) + { + case 0: + // should never happen + break; + case 1: + // free node->storage_group_node + if (context->path_bits[level + 1] == NULL) + { + current_dbi++; + if (current_dbi == ibi->cDatabase) + state = 2; + } + else + state = 2; + retval = bRC_More; + break; + case 2: + // should never happen + break; + case 3: + delete file_node; + logfile_ptr += wcslen(logfile_ptr) + 1; + if (*logfile_ptr == 0) + state = 4; + retval = bRC_More; + break; + case 4: + if (context->truncate_logs) + { + _DebugMessage(100, "Calling HrESEBackupTruncateLogs\n"); + result = HrESEBackupTruncateLogs(hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupTruncateLogs failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + } + else + { + _JobMessage(M_INFO, "Truncated database logs for Storage Group %s\n", name); + } + } + else + { + _JobMessage(M_INFO, "Did NOT truncate database logs for Storage Group %s\n", name); + } + _DebugMessage(100, "Calling HrESEBackupInstanceEnd\n"); + result = HrESEBackupInstanceEnd(hccx, ESE_BACKUP_INSTANCE_END_SUCCESS); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESEBackupInstanceEnd failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + return bRC_Error; + } + retval = bRC_OK; + context->current_node = parent; + break; + } + return retval; +} + +bRC +storage_group_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + HRESULT result; + int len; + + _DebugMessage(100, "createFile_STORAGE_GROUP state = %d\n", state); + + if (strcmp(context->path_bits[level], name) != 0) + { + _DebugMessage(100, "Different storage group - switching back to parent\n", state); + saved_log_path = new WCHAR[wcslen(restore_environment->m_wszRestoreLogPath) + 1]; + wcscpy(saved_log_path, restore_environment->m_wszRestoreLogPath); + _DebugMessage(100, "Calling HrESERestoreSaveEnvironment\n"); + result = HrESERestoreSaveEnvironment(hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreSaveEnvironment failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + rp->create_status = CF_CREATED; + return bRC_OK; + } + _DebugMessage(100, "Calling HrESERestoreClose\n"); + result = HrESERestoreClose(hccx, RESTORE_CLOSE_NORMAL); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreClose failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + rp->create_status = CF_CREATED; + return bRC_OK; + } + context->current_node = parent; + return bRC_OK; + } + if (saved_log_path != NULL) + { + _DebugMessage(100, "Calling HrESERestoreReopen\n"); + result = HrESERestoreReopen(context->computer_name, service_name, saved_log_path, &hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreReopen failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + saved_log_path = NULL; + rp->create_status = CF_CREATED; + return bRC_OK; + } + _DebugMessage(100, "Calling HrESERestoreGetEnvironment\n"); + result = HrESERestoreGetEnvironment(hccx, &restore_environment); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreGetEnvironment failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + saved_log_path = NULL; + rp->create_status = CF_CREATED; + return bRC_OK; + } + saved_log_path = NULL; + } + + for (;;) + { + switch (state) + { + case 0: + if (context->path_bits[level + 2] == NULL) + { + _JobMessage(M_ERROR, "Unexpected log file '%s%s' - expecting database\n", full_path, context->path_bits[level + 1]); + state = 999; + break; + } + service_name = new WCHAR[strlen(parent->name) + 1]; + storage_group_name = new WCHAR[strlen(name) + 1]; + mbstowcs(service_name, parent->name, strlen(parent->name) + 1); + mbstowcs(storage_group_name, name, strlen(name) + 1); + _DebugMessage(100, "Calling HrESERestoreOpen\n"); + result = HrESERestoreOpen(context->computer_name, service_name, storage_group_name, NULL, &hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreOpen failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + _DebugMessage(100, "Calling HrESERestoreGetEnvironment\n"); + result = HrESERestoreGetEnvironment(hccx, &restore_environment); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreGetEnvironment failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + state = 1; + break; + case 1: + if (context->path_bits[level + 2] == NULL) + { + state = 2; + break; + } + store_node = new store_node_t(bstrdup(context->path_bits[level + 1]), this); + store_node->hccx = hccx; + context->current_node = store_node; + return bRC_OK; + case 2: + if (context->path_bits[level + 2] != NULL) + { + _JobMessage(M_ERROR, "Unexpected file '%s'\n", full_path); + state = 999; + break; + } + if (context->path_bits[level + 1] == NULL) + { + state = 3; + break; + } + state = 2; + file_node = new file_node_t(bstrdup(context->path_bits[level + 1]), this); + file_node->hccx = hccx; + int i; + for (i = strlen(file_node->name) - 1; i >= 0; i--) + { + if (file_node->name[i] == '\\') + { + i++; + break; + } + } + len = wcslen(restore_environment->m_wszRestoreLogPath) + strlen(file_node->name + i) + 1 + 1; + file_node->filename = new WCHAR[len]; + wcscpy(file_node->filename, restore_environment->m_wszRestoreLogPath); + wcscat(file_node->filename, L"\\"); + mbstowcs(&file_node->filename[wcslen(file_node->filename)], file_node->name + i, strlen(file_node->name + i) + 1); + context->current_node = file_node; + return bRC_OK; + case 3: + if (rp->type != FT_DIREND) + { + _JobMessage(M_ERROR, "Unexpected file '%s'\n", full_path); + state = 999; + break; + } + // must be the storage group node + _DebugMessage(100, "Calling HrESERestoreSaveEnvironment\n"); + result = HrESERestoreSaveEnvironment(hccx); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreSaveEnvironment failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + + _DebugMessage(100, "Calling HrESERestoreComplete\n"); + result = HrESERestoreComplete(hccx, restore_environment->m_wszRestoreLogPath, + restore_environment->m_wszRestoreLogPath, storage_group_name, ESE_RESTORE_COMPLETE_ATTACH_DBS); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreComplete failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + _DebugMessage(100, "Calling HrESERestoreClose\n"); + result = HrESERestoreClose(hccx, RESTORE_CLOSE_NORMAL); + state = 999; + break; + } + else + { + _JobMessage(M_INFO, "Storage Group '%s' restored successfully\n", name); + } + + _DebugMessage(100, "Calling HrESERestoreClose\n"); + result = HrESERestoreClose(hccx, RESTORE_CLOSE_NORMAL); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreClose failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + + rp->create_status = CF_CREATED; + return bRC_OK; + case 999: + rp->create_status = CF_CREATED; + return bRC_OK; + } + } +} + +bRC +storage_group_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endRestoreFile_STORAGE_GROUP state = %d\n", state); + switch (state) + { + case 0: + return bRC_Error; + case 1: + return bRC_OK; + case 2: + return bRC_OK; + case 3: + context->current_node = parent; + return bRC_OK; + case 999: + context->current_node = parent; + return bRC_OK; + } + + return bRC_Error; +} diff --git a/bacula/src/win32/filed/plugins/store_node.c b/bacula/src/win32/filed/plugins/store_node.c new file mode 100644 index 0000000000..eea94317d9 --- /dev/null +++ b/bacula/src/win32/filed/plugins/store_node.c @@ -0,0 +1,249 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Written by James Harper, October 2008 + */ + +#include "exchange-fd.h" + +store_node_t::store_node_t(char *name, node_t *parent_node) : node_t(name, NODE_TYPE_STORE, parent_node) +{ + dbi = NULL; + hccx = NULL; + dbi_node = NULL; + file_node = NULL; +} + +store_node_t::~store_node_t() +{ + if (dbi_node != NULL) + delete dbi_node; + + if (file_node != NULL) + delete file_node; +} + +bRC +store_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) +{ + char *tmp; + + _DebugMessage(100, "startBackupNode_STORE state = %d\n", state); + + switch(state) + { + case 0: + stream_ptr = dbi->wszDatabaseStreams; + state = 1; + // fall through + case 1: + dbi_node = new dbi_node_t("DatabaseBackupInfo", this); + dbi_node->dbi = dbi; + context->current_node = dbi_node; + break; + case 2: + tmp = new char[wcslen(stream_ptr) + 1]; + wcstombs(tmp, stream_ptr, wcslen(stream_ptr) + 1); + file_node = new file_node_t(tmp, this); + file_node->hccx = hccx; + file_node->filename = stream_ptr; + context->current_node = file_node; + break; + case 3: + if (context->job_level == 'F') + { + time_t now = time(NULL); + sp->fname = full_path; + sp->link = full_path; + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = 0; + sp->type = FT_DIREND; + } + else + { + bfuncs->setBaculaValue(context->bpContext, bVarFileSeen, (void *)full_path); + return bRC_Seen; + } + break; + } + + return bRC_OK; +} + +bRC +store_node_t::endBackupFile(exchange_fd_context_t *context) +{ + _DebugMessage(100, "endBackupNode_STORE state = %d\n", state); + bRC retval = bRC_OK; + + switch(state) + { + case 0: + // should never happen + break; + case 1: + state = 2; + retval = bRC_More; + break; + case 2: + delete file_node; + stream_ptr += wcslen(stream_ptr) + 1; + if (*stream_ptr == 0) + state = 3; + retval = bRC_More; + break; + case 3: + //delete dbi_node; + context->current_node = parent; + break; + } + return retval; +} + +bRC +store_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) +{ + _DebugMessage(100, "createFile_STORE state = %d\n", state); + + if (strcmp(context->path_bits[level - 1], parent->name) != 0) + { + _DebugMessage(100, "Different storage group - switching back to parent\n", state); + context->current_node = parent; + return bRC_OK; + } + for (;;) + { + switch (state) + { + case 0: + if (strcmp("DatabaseBackupInfo", context->path_bits[level + 1]) != 0) + { + _JobMessage(M_FATAL, "DatabaseBackupInfo file must exist and must be first in directory\n"); + state = 999; + break; + } + dbi_node = new dbi_node_t(bstrdup(context->path_bits[level + 1]), this); + context->current_node = dbi_node; + return bRC_OK; + case 1: + if (strcmp(context->path_bits[level - 1], parent->name) != 0) + { + _JobMessage(M_ERROR, "Unexpected Storage Group Change\n"); + state = 999; + break; + } + + if (*stream_ptr != 0) + { + // verify that stream_ptr == context->path_bits[level + 1]; + _DebugMessage(150, "stream_ptr = %S\n", stream_ptr); + _DebugMessage(150, "out_stream_ptr = %S\n", out_stream_ptr); + file_node = new file_node_t(bstrdup(context->path_bits[level + 1]), this); + file_node->hccx = hccx; + file_node->filename = out_stream_ptr; + context->current_node = file_node; + return bRC_OK; + } + else + { + _JobMessage(M_ERROR, "Extra file found '%s'\n", full_path); + state = 999; + break; + } + case 2: + if (rp->type != FT_DIREND) + { + _JobMessage(M_ERROR, "Unexpected file '%s'\n", full_path); + state = 999; + break; + } + rp->create_status = CF_CREATED; + return bRC_OK; + case 999: + if (strcmp(context->path_bits[level], name) != 0) + { + _DebugMessage(100, "End of Store when in error state - switching back to parent\n", state); + context->current_node = parent; + return bRC_OK; + } + rp->create_status = CF_CREATED; + return bRC_OK; + } + } +} + +bRC +store_node_t::endRestoreFile(exchange_fd_context_t *context) +{ + HRESULT result; + + _DebugMessage(100, "endRestoreFile_STORE state = %d\n", state); + for (;;) + { + switch (state) + { + case 0: + state = 1; + _DebugMessage(100, "Calling HrESERestoreAddDatabase\n"); + result = HrESERestoreAddDatabase(hccx, dbi_node->restore_display_name, dbi_node->restore_guid, dbi_node->restore_input_streams, &dbi_node->restore_output_streams); + if (result != 0) + { + _JobMessage(M_FATAL, "HrESERestoreAddDatabase failed with error 0x%08x - %s\n", result, ESEErrorMessage(result)); + state = 999; + break; + } + stream_ptr = dbi_node->restore_input_streams; + out_stream_ptr = dbi_node->restore_output_streams; + return bRC_OK; + case 1: + if (*stream_ptr != 0) + { + delete file_node; + file_node = NULL; + stream_ptr += wcslen(stream_ptr) + 1; + out_stream_ptr += wcslen(out_stream_ptr) + 1; + if (*stream_ptr == 0) + state = 2; + return bRC_OK; + } + else + { + state = 999; + break; + } + case 2: + context->current_node = parent; + return bRC_OK; + case 999: + return bRC_OK; + } + } +} diff --git a/bacula/src/win32/filed/service.cpp b/bacula/src/win32/filed/service.cpp new file mode 100644 index 0000000000..c8f4a6f630 --- /dev/null +++ b/bacula/src/win32/filed/service.cpp @@ -0,0 +1,25 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#include "who.h" +#include "../libwin32/service.cpp" diff --git a/bacula/src/win32/filed/trayMonitor.cpp b/bacula/src/win32/filed/trayMonitor.cpp new file mode 100644 index 0000000000..2549434073 --- /dev/null +++ b/bacula/src/win32/filed/trayMonitor.cpp @@ -0,0 +1,25 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#include "who.h" +#include "../libwin32/trayMonitor.cpp" diff --git a/bacula/src/win32/filed/vss.cpp b/bacula/src/win32/filed/vss.cpp new file mode 100644 index 0000000000..e328e205c5 --- /dev/null +++ b/bacula/src/win32/filed/vss.cpp @@ -0,0 +1,589 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +// vss.cpp -- Interface to Volume Shadow Copies (VSS) +// +// Copyright transferred from MATRIX-Computer GmbH to +// Kern Sibbald by express permission. +// +// Author : Thorsten Engel +// Created On : Fri May 06 21:44:00 2005 + + +#ifdef WIN32_VSS +#include "bacula.h" +#include "compat.h" +#include "ms_atl.h" +#include +#undef setlocale +#include +using namespace std; + +#include "vss.h" + +#define dbglvl_snap DT_VOLUME|50 + +wstring GetUniqueVolumeNameForPath(wstring path, wstring &rootPath); + +static int volume_search(void *i1, void *i2) +{ + wstring *volname = (wstring *) i1; + MTabEntry *vol = (MTabEntry *) i2; + + return volname->compare(vol->volumeName); +} + +static int volume_cmp(void *e1, void *e2) +{ + MTabEntry *v1 = (MTabEntry *) e1; + MTabEntry *v2 = (MTabEntry *) e2; + return wcscmp(v1->volumeName, v2->volumeName); +} + +UINT MTabEntry::getDriveType() +{ + WCHAR *root = first(); + + // Make sure to discard CD-ROM and network drives + if (!root) { + return 0; + } + + driveType = GetDriveTypeW(root); + return driveType; +} + +/* Return true if the current volume can be snapshoted (ie not CDROM or fat32) */ +bool MTabEntry::isSuitableForSnapshot() +{ + DWORD componentlength, fsflags; + WCHAR fstype[50]; + WCHAR *root = first(); + UINT oldmode; + BOOL result; + + // Make sure to discard CD-ROM and network drives + if (!root) { + Dmsg1(dbglvl_snap, "No mount point for %ls\n", volumeName); + goto bail_out; + } + + if (getDriveType() != DRIVE_FIXED) { + Dmsg2(dbglvl_snap, "Invalid disk type %d for %ls\n", driveType, root); + goto bail_out; + } + + /* From fstype.c, except that we have WCHAR instead of char */ + /* We don't want any popups if there isn't any media in the drive */ + oldmode = SetErrorMode(SEM_FAILCRITICALERRORS); + result = GetVolumeInformationW(root, NULL, 0, NULL, + &componentlength, &fsflags, fstype, ARRAYSIZE(fstype)); + SetErrorMode(oldmode); + + if (result) { + /* Windows returns NTFS, FAT, etc. Make it lowercase to be consistent with other OSes */ + Dmsg1(dbglvl_snap, "fstype=%ls\n", fstype); + if (!_wcsicmp(fstype, L"ntfs")) { + can_Snapshot = true; + } + if (!_wcsicmp(fstype, L"refs")) { + can_Snapshot = true; + } + } +bail_out: + Dmsg2(dbglvl_snap, "%ls is %s suitable for VSS snapshot\n", root, can_Snapshot?"":"not"); + return can_Snapshot; +} + +/* Find a volume for a specific path */ +MTabEntry *MTab::search(char *p) +{ + wstring volume; + wstring path; + wstring rootPath; + + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + UTF8_2_wchar(&pwszBuf, p); + path.assign((wchar_t *)pwszBuf); + volume = GetUniqueVolumeNameForPath(path, rootPath); + + MTabEntry *elt = (MTabEntry *)entries->search(&volume, volume_search); + free_pool_memory(pwszBuf); + + if (!elt) { + Dmsg1(000, "Unable to find %ls in volume list\n", volume.c_str()); + } + + return elt; +} + +bool MTab::addInSnapshotSet(char *p) +{ + MTabEntry *elt = search(p); + if (elt) { + if (!elt->in_SnapshotSet && elt->isSuitableForSnapshot()) { + nb_in_SnapshotSet++; + elt->setInSnapshotSet(); + } + } + return nb_in_SnapshotSet == entries->size(); +} + +/* Initialize the "entries" list will all existing volumes */ +bool MTab::get() +{ + DWORD count = 0; + WCHAR DeviceName[MAX_PATH] = L""; + HANDLE FindHandle = INVALID_HANDLE_VALUE; + size_t Index = 0; + bool Success = FALSE; + WCHAR VolumeName[MAX_PATH] = L""; + + Dmsg0(dbglvl_snap, "Filling MTAB\n"); + + + // Enumerate all volumes in the system. + FindHandle = FindFirstVolumeW(VolumeName, ARRAYSIZE(VolumeName)); + + if (FindHandle == INVALID_HANDLE_VALUE) { + lasterror = GetLastError(); + return false; + } + + for (;;) { + // Skip the \\?\ prefix and remove the trailing backslash. + Index = wcslen(VolumeName) - 1; + + if (VolumeName[0] != L'\\' || + VolumeName[1] != L'\\' || + VolumeName[2] != L'?' || + VolumeName[3] != L'\\' || + VolumeName[Index] != L'\\') + { + lasterror = ERROR_BAD_PATHNAME; + lasterror_str = "FindFirstVolumeW/FindNextVolumeW returned a bad path"; + Dmsg1(000, "FindFirstVolumeW/FindNextVolumeW returned a bad path %ls\n", VolumeName); + break; + } + + // + // QueryDosDeviceW does not allow a trailing backslash, + // so temporarily remove it. + VolumeName[Index] = L'\0'; + + count = QueryDosDeviceW(&VolumeName[4], DeviceName, + ARRAYSIZE(DeviceName)); + + VolumeName[Index] = L'\\'; + + if (count == 0) { + lasterror = GetLastError(); + Dmsg1(000, "QueryDosDeviceW failed with error code %d\n", lasterror); + break; + } + + MTabEntry *entry = New(MTabEntry(DeviceName, VolumeName)); + entries->insert(entry, volume_cmp); + + // + // Move on to the next volume. + Success = FindNextVolumeW(FindHandle, VolumeName, ARRAYSIZE(VolumeName)); + + if (!Success) { + lasterror = GetLastError(); + if (lasterror != ERROR_NO_MORE_FILES) { + Dmsg1(000, "FindNextVolumeW failed with error code %d\n", lasterror); + break; + } + + // Finished iterating + // through all the volumes. + lasterror = ERROR_SUCCESS; + break; + } + } + + FindVolumeClose(FindHandle); + FindHandle = INVALID_HANDLE_VALUE; + + return true; +} + +BOOL VSSPathConverter(); +BOOL VSSPathConvert(const char *szFilePath, char *szShadowPath, int nBuflen); +BOOL VSSPathConvertW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen); + +// {b5946137-7b9f-4925-af80-51abd60b20d5} + +static const GUID VSS_SWPRV_ProviderID = + { 0xb5946137, 0x7b9f, 0x4925, { 0xaf, 0x80, 0x51, 0xab, 0xd6, 0x0b, 0x20, 0xd5 } }; + +static pthread_once_t key_vss_once = PTHREAD_ONCE_INIT; +static pthread_key_t vssclient_key; + +static void create_vss_key() +{ + int status = pthread_key_create(&vssclient_key, NULL); + if (status != 0) { + berrno be; + Pmsg1(000, _("pthread key create failed: ERR=%s\n"), + be.bstrerror(status)); + ASSERT2(0, "pthread_key_create failed"); + } + SetVSSPathConvert(VSSPathConverter, VSSPathConvert, VSSPathConvertW); +} + +/* TODO: Use the JCR variable to get the VSSClient pointer + * the JCR FileDaemon part is not known in the VSS library + */ +static void store_vssclient_in_tsd(VSSClient *cl) +{ + int status = pthread_once(&key_vss_once, create_vss_key); + if (status != 0) { + berrno be; + Pmsg1(000, _("pthread key create failed: ERR=%s\n"), + be.bstrerror(status)); + ASSERT2(0, "pthread_once failed"); + } + + status = pthread_setspecific(vssclient_key, (void *)cl); + if (status != 0) { + berrno be; + Jmsg1(NULL, M_ABORT, 0, _("pthread_setspecific failed: ERR=%s\n"), + be.bstrerror(status)); + } +} + +static VSSClient *get_vssclient_from_tsd() +{ + return (VSSClient *)pthread_getspecific(vssclient_key); +} + +void +VSSCleanup(VSSClient *pVSSClient) +{ + store_vssclient_in_tsd(NULL); + if (pVSSClient) { + delete (pVSSClient); + } +} + +/* + * May be called multiple times + */ +VSSClient *VSSInit() +{ + VSSClient *pVSSClient = NULL; + /* decide which vss class to initialize */ + if (g_MajorVersion == 5) { + switch (g_MinorVersion) { + case 1: + pVSSClient = new VSSClientXP(); + break; + case 2: + pVSSClient = new VSSClient2003(); + break; + } + /* Vista or Longhorn or later */ + } else if (g_MajorVersion >= 6) { + pVSSClient = new VSSClientVista(); + } + store_vssclient_in_tsd(pVSSClient); + return pVSSClient; +} + +BOOL VSSPathConverter() +{ + if (get_vssclient_from_tsd() == NULL) { + return false; + } + return true; +} + +BOOL +VSSPathConvert(const char *szFilePath, char *szShadowPath, int nBuflen) +{ + VSSClient *pVSSClient = get_vssclient_from_tsd(); + if (pVSSClient) { + return pVSSClient->GetShadowPath(szFilePath, szShadowPath, nBuflen); + } else { + return false; + } +} + +BOOL +VSSPathConvertW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen) +{ + VSSClient *pVSSClient = get_vssclient_from_tsd(); + if (pVSSClient) { + return pVSSClient->GetShadowPathW(szFilePath, szShadowPath, nBuflen); + } else { + return false; + } +} + +// Constructor +VSSClient::VSSClient() +{ + memset(this, 0, sizeof(VSSClient)); + m_pAlistWriterState = New(alist(10, not_owned_by_alist)); + m_pAlistWriterInfoText = New(alist(10, owned_by_alist)); + m_uidCurrentSnapshotSet = GUID_NULL; +} + +// Destructor +VSSClient::~VSSClient() +{ + // Release the IVssBackupComponents interface + // WARNING: this must be done BEFORE calling CoUninitialize() + if (m_pVssObject) { +// m_pVssObject->Release(); + m_pVssObject = NULL; + } + + DestroyWriterInfo(); + delete m_pAlistWriterState; + delete m_pAlistWriterInfoText; + + // Call CoUninitialize if the CoInitialize was performed successfully + if (m_bCoInitializeCalled) { + CoUninitialize(); + } + + delete m_VolumeList; +} + +bool VSSClient::InitializeForBackup(JCR *jcr) +{ + //return Initialize (VSS_CTX_BACKUP); + m_jcr = jcr; + return Initialize(0); +} + + +bool VSSClient::InitializeForRestore(JCR *jcr) +{ + m_metadata = NULL; + m_jcr = jcr; + return Initialize(0, true/*=>Restore*/); +} + +// Append a backslash to the current string +wstring AppendBackslash(wstring str) +{ + if (str.length() == 0) { + return wstring(L"\\"); + } + if (str[str.length() - 1] == L'\\') { + return str; + } + return str.append(L"\\"); +} + +// Get the unique volume name for the given path +wstring GetUniqueVolumeNameForPath(wstring path, wstring &rootPath) +{ + if (path.length() <= 0) { + //Dmsg0(50, "Failed path.len <= 0\n"); + return L""; + } + + // Add the backslash termination, if needed + path = AppendBackslash(path); + //Dmsg1(50, "Path=%ls\n", path.c_str()); + + // Get the root path of the volume + wchar_t volumeRootPath[MAX_PATH]; + wchar_t volumeName[MAX_PATH]; + wchar_t volumeUniqueName[MAX_PATH]; + + volumeRootPath[0] = 0; + volumeName[0] = 0; + volumeUniqueName[0] = 0; + + if (!p_GetVolumePathNameW || !p_GetVolumePathNameW((LPCWSTR)path.c_str(), volumeRootPath, MAX_PATH)) { + Dmsg1(50, "Failed GetVolumePathNameW path=%ls\n", path.c_str()); + return L""; + } + rootPath.assign(volumeRootPath); + Dmsg1(dbglvl_snap, "VolumeRootPath=%ls\n", volumeRootPath); + + // Get the volume name alias (might be different from the unique volume name in rare cases) + if (!p_GetVolumeNameForVolumeMountPointW || !p_GetVolumeNameForVolumeMountPointW(volumeRootPath, volumeName, MAX_PATH)) { + Dmsg1(50, "Failed GetVolumeNameForVolumeMountPointW path=%ls\n", volumeRootPath); + return L""; + } + Dmsg1(dbglvl_snap, "VolumeName=%ls\n", volumeName); + + // Get the unique volume name + if (!p_GetVolumeNameForVolumeMountPointW(volumeName, volumeUniqueName, MAX_PATH)) { + Dmsg1(50, "Failed GetVolumeNameForVolumeMountPointW path=%ls\n", volumeName); + return L""; + } + Dmsg1(dbglvl_snap, "VolumeUniqueName=%ls\n", volumeUniqueName); + return volumeUniqueName; +} + +bool VSSClient::GetShadowPath(const char *szFilePath, char *szShadowPath, int nBuflen) +{ + Dmsg1(dbglvl_snap, "GetShadowPath(%s)\n", szFilePath); + + if (m_bDuringRestore) { + return false; + } + + if (!m_bBackupIsInitialized) { + Jmsg0(m_jcr, M_FATAL, 0, "Backup is not Initialized\n"); + return false; + } + + wstring path, rootPath, volume; + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); + + UTF8_2_wchar(&pwszBuf, szFilePath); + path.assign((wchar_t *)pwszBuf); + + /* TODO: Have some cache here? */ + volume = GetUniqueVolumeNameForPath(path, rootPath); + + MTabEntry *vol = (MTabEntry *)m_VolumeList->entries->search(&volume,volume_search); + free_pool_memory(pwszBuf); + + if (vol && vol->shadowCopyName) { + if (WideCharToMultiByte(CP_UTF8,0,vol->shadowCopyName,-1,szShadowPath,nBuflen-1,NULL,NULL)) { + nBuflen -= (int)strlen(szShadowPath); + + bstrncat(szShadowPath, "\\", nBuflen); + nBuflen -= 1; + //Dmsg4(200,"szFilePath=%s rootPath=%ls len(rootPath)=%d nBuflen=%d\n", + // szFilePath, rootPath.c_str(), rootPath.length(), nBuflen); + + /* here we skip C:, we skip volume root */ + /* TODO: I'm not 100% sure that rootPath.lenght() WCHAR means X CHAR + * The main goal here is to convert + * c:/tmp/mounted/test -> \\?\Device\HardDiskSnapshot10\test + * + * So, we skip c:/tmp/mounted/ from the base file. + */ + if (strlen(szFilePath) > rootPath.length()) { + bstrncat(szShadowPath, szFilePath+rootPath.length(), nBuflen); + } + Dmsg2(dbglvl_snap, "GetShadowPath(%s) -> %s\n", szFilePath, szShadowPath); + return true; + } + } + + bstrncpy(szShadowPath, szFilePath, nBuflen); + Dmsg2(dbglvl_snap, "GetShadowPath(%s) -> %s\n", szFilePath, szShadowPath); + errno = EINVAL; + return false; +} + +/* + * c:/tmp -> \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy15\tmp + */ +bool VSSClient::GetShadowPathW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen) +{ + Dmsg1(dbglvl_snap, "GetShadowPathW(%ls)\n", szFilePath); + + if (m_bDuringRestore) { + return false; + } + + if (!m_bBackupIsInitialized) { + Jmsg0(m_jcr, M_FATAL, 0, "Backup is not Initialized\n"); + return false; + } + wstring path, rootPath, volume; + path.assign((wchar_t *)szFilePath); + /* TODO: Have some cache here? */ + volume = GetUniqueVolumeNameForPath(path, rootPath); + MTabEntry *vol = (MTabEntry *)m_VolumeList->entries->search(&volume,volume_search); + + if (vol && vol->shadowCopyName) { + Dmsg5(dbglvl_snap, "szFilePath=%ls rootPath=%ls len(rootPath)=%d nBuflen=%d shadowCopyName=%ls\n", + szFilePath, rootPath.c_str(), rootPath.length(), nBuflen, vol->shadowCopyName); + + wcsncpy(szShadowPath, vol->shadowCopyName, nBuflen); + nBuflen -= (int)wcslen(vol->shadowCopyName); + + wcsncat(szShadowPath, L"\\", nBuflen); + nBuflen -= 1; + + //Dmsg4(200, "szFilePath=%ls rootPath=%ls len(rootPath)=%d nBuflen=%d\n", + // szFilePath, rootPath.c_str(), rootPath.length(), nBuflen); + + if (wcslen(szFilePath) > rootPath.length()) { + /* here we skip C:, we skip volume root */ + wcsncat(szShadowPath, szFilePath+rootPath.length(), nBuflen); + } + Dmsg2(dbglvl_snap, "GetShadowPathW(%ls) -> %ls\n", szFilePath, szShadowPath); + return true; + } + + wcsncpy(szShadowPath, szFilePath, nBuflen); + Dmsg2(dbglvl_snap, "GetShadowPathW(%ls) -> %ls\n", szFilePath, szShadowPath); + errno = EINVAL; + return false; +} + +const size_t VSSClient::GetWriterCount() +{ + return m_pAlistWriterInfoText->size(); +} + +const char* VSSClient::GetWriterInfo(int nIndex) +{ + return (char*)m_pAlistWriterInfoText->get(nIndex); +} + + +const int VSSClient::GetWriterState(int nIndex) +{ + void *item = m_pAlistWriterState->get(nIndex); + +/* Eliminate compiler warnings */ +#ifdef HAVE_VSS64 + return (int64_t)(char *)item; +#else + return (int)(char *)item; +#endif +} + +void VSSClient::AppendWriterInfo(int nState, const char* pszInfo) +{ + m_pAlistWriterInfoText->push(bstrdup(pszInfo)); + m_pAlistWriterState->push((void*)(intptr_t)nState); +} + +/* + * Note, this is called at the end of every job, so release all + * the items in the alists, but do not delete the alist. + */ +void VSSClient::DestroyWriterInfo() +{ + while (!m_pAlistWriterInfoText->empty()) { + free(m_pAlistWriterInfoText->pop()); + } + + while (!m_pAlistWriterState->empty()) { + m_pAlistWriterState->pop(); + } +} + +#endif diff --git a/bacula/src/win32/filed/vss.h b/bacula/src/win32/filed/vss.h new file mode 100644 index 0000000000..e29a583f77 --- /dev/null +++ b/bacula/src/win32/filed/vss.h @@ -0,0 +1,344 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* -*- Mode: C -*- + * vss.h -- + */ +// +// Copyright transferred from MATRIX-Computer GmbH to +// Kern Sibbald by express permission. +/* + * + * Author : Thorsten Engel + * Created On : Fri May 06 21:44:00 2006 + */ + +#ifndef __VSS_H_ +#define __VSS_H_ + +#ifndef b_errno_win32 +#define b_errno_win32 (1<<29) +#endif + +#ifdef WIN32_VSS + +#define VSS_INIT_RESTORE_AFTER_INIT 1 +#define VSS_INIT_RESTORE_AFTER_GATHER 2 + +// some forward declarations +struct IVssAsync; + +#define bwcsdup(str) wcscpy((WCHAR *)bmalloc((wcslen(str)+1)*sizeof(WCHAR)),(str)) + +/* The MTabEntry class is representing a mounted volume, + * it associates a volume name with mount paths and a device name + */ +class MTabEntry: public SMARTALLOC { +public: + WCHAR *volumeName; // Name of the current volume + WCHAR *mountPaths; // List of mount paths + WCHAR *deviceName; + WCHAR *shadowCopyName; + bool in_SnapshotSet; + bool can_Snapshot; + UINT driveType; + rblink link; + + MTabEntry() { + mountPaths = NULL; + volumeName = NULL; + deviceName = NULL; + in_SnapshotSet = false; + shadowCopyName = NULL; + can_Snapshot = false; + driveType = 0; + }; + + MTabEntry(WCHAR *DeviceName, WCHAR *VolumeName) { + int last = wcslen(VolumeName); + if (VolumeName[last - 1] == L'\\') { + volumeName = bwcsdup(VolumeName); + } else { /* \\ + \0 */ + volumeName = (WCHAR *)bmalloc(last+2*sizeof(WCHAR)); + wcscpy(volumeName, VolumeName); + volumeName[last] = L'\\'; + volumeName[last+1] = L'\0'; + } + mountPaths = NULL; + in_SnapshotSet = false; + deviceName = bwcsdup(DeviceName); + shadowCopyName = NULL; + driveType = 0; + can_Snapshot = false; + get_paths(); + }; + + ~MTabEntry() { + destroy(); + }; + + void destroy() { + if (mountPaths) { + free(mountPaths); + mountPaths = NULL; + } + if (volumeName) { + free(volumeName); + volumeName = NULL; + } + if (deviceName) { + free(deviceName); + deviceName = NULL; + } + if (shadowCopyName) { + free(shadowCopyName); + shadowCopyName = NULL; + } + }; + + /* Return the drive type (cdrom, fixed, network, ...) */ + UINT getDriveType(); + + /* Return true if the current volume can be snapshoted (ie not CDROM or fat32) */ + bool isSuitableForSnapshot(); + + void setInSnapshotSet() { + Dmsg1(050, "Marking %ls for the SnapshotSet\n", mountPaths); + in_SnapshotSet = true; + } + + void debug_paths() { + WCHAR *p; + /* Display the paths in the list. */ + if (mountPaths != NULL) { + Dmsg2(DT_VOLUME|10, "Device: [%ls], Volume: [%ls]\n", deviceName, volumeName); + for ( p = mountPaths; p[0] != L'\0'; p += wcslen(p) + 1) { + Dmsg1(DT_VOLUME|10, " %ls\n", p); + } + } + }; + + /* Compute the path list assiciated with the current volume */ + bool get_paths() { + DWORD count = MAX_PATH + 1; + bool ret = false; + + for (;;) { + // Allocate a buffer to hold the paths. + mountPaths = (WCHAR*) malloc(count * sizeof(WCHAR)); + + // Obtain all of the paths + // for this volume. + ret = GetVolumePathNamesForVolumeNameW(volumeName, mountPaths, + count, &count); + if (ret) { + break; + } + + if (GetLastError() != ERROR_MORE_DATA) { + break; + } + + // Try again with the + // new suggested size. + free(mountPaths); + mountPaths = NULL; + } + debug_paths(); + return ret; + }; + + /* Return the first mount point */ + WCHAR *first() { + return mountPaths; + }; + + /* Return the next mount point */ + WCHAR *next(WCHAR *prev) { + if (prev == NULL || prev[0] == L'\0') { + return NULL; + } + + prev += wcslen(prev) + 1; + + return (prev[0] == L'\0') ? NULL : prev; + }; +}; + +/* Class to handle all volumes of the system, it contains + * a list of all current volumes (MTabEntry) + */ +class MTab: public SMARTALLOC { +public: + DWORD lasterror; + const char *lasterror_str; + rblist *entries; /* MTabEntry */ + int nb_in_SnapshotSet; + + MTab() { + MTabEntry *elt = NULL; + lasterror = ERROR_SUCCESS; + lasterror_str = ""; + nb_in_SnapshotSet = 0; + entries = New(rblist(elt, &elt->link)); + }; + + ~MTab() { + if (entries) { + MTabEntry *elt; + foreach_rblist(elt, entries) { + elt->destroy(); + } + delete entries; + } + }; + /* Get a Volume by name */ + MTabEntry *search(char *file); + + /* Try to add a volume to the current snapshotset */ + bool addInSnapshotSet(char *file); + + /* Fill the "entries" list will all detected volumes of the system*/ + bool get(); +}; + +class VSSClient +{ +public: + VSSClient(); + virtual ~VSSClient(); + + // Backup Process + bool InitializeForBackup(JCR *jcr); + bool InitializeForRestore(JCR *jcr); + virtual bool CreateSnapshots(alist *mount_points) = 0; + virtual bool CloseBackup() = 0; + virtual bool CloseRestore() = 0; + virtual WCHAR *GetMetadata() = 0; + virtual const char* GetDriverName() = 0; + bool GetShadowPath (const char* szFilePath, char* szShadowPath, int nBuflen); + bool GetShadowPathW (const wchar_t* szFilePath, wchar_t* szShadowPath, int nBuflen); /* nBuflen in characters */ + + const size_t GetWriterCount(); + const char* GetWriterInfo(int nIndex); + const int GetWriterState(int nIndex); + void DestroyWriterInfo(); + void AppendWriterInfo(int nState, const char* pszInfo); + const bool IsInitialized() { return m_bBackupIsInitialized; }; + IUnknown *GetVssObject() { return m_pVssObject; }; + +private: + virtual bool Initialize(DWORD dwContext, bool bDuringRestore = FALSE) = 0; + virtual bool WaitAndCheckForAsyncOperation(IVssAsync* pAsync) = 0; + virtual void QuerySnapshotSet(GUID snapshotSetID) = 0; + +protected: + JCR *m_jcr; + + DWORD m_dwContext; + + IUnknown* m_pVssObject; + GUID m_uidCurrentSnapshotSet; + + MTab *m_VolumeList; + + alist *m_pAlistWriterState; + alist *m_pAlistWriterInfoText; + + bool m_bCoInitializeCalled; + bool m_bCoInitializeSecurityCalled; + bool m_bDuringRestore; /* true if we are doing a restore */ + bool m_bBackupIsInitialized; + bool m_bWriterStatusCurrent; + + WCHAR *m_metadata; + + void CreateVSSVolumeList(); + void DeleteVSSVolumeList(); +}; + +class VSSClientXP:public VSSClient +{ +public: + VSSClientXP(); + virtual ~VSSClientXP(); + virtual bool CreateSnapshots(alist *mount_points); + virtual bool CloseBackup(); + virtual bool CloseRestore(); + virtual WCHAR *GetMetadata(); +#ifdef _WIN64 + virtual const char* GetDriverName() { return "Win64 VSS"; }; +#else + virtual const char* GetDriverName() { return "Win32 VSS"; }; +#endif +private: + virtual bool Initialize(DWORD dwContext, bool bDuringRestore); + virtual bool WaitAndCheckForAsyncOperation(IVssAsync* pAsync); + virtual void QuerySnapshotSet(GUID snapshotSetID); + bool CheckWriterStatus(); +}; + +class VSSClient2003:public VSSClient +{ +public: + VSSClient2003(); + virtual ~VSSClient2003(); + virtual bool CreateSnapshots(alist *mount_points); + virtual bool CloseBackup(); + virtual bool CloseRestore(); + virtual WCHAR *GetMetadata(); +#ifdef _WIN64 + virtual const char* GetDriverName() { return "Win64 VSS"; }; +#else + virtual const char* GetDriverName() { return "Win32 VSS"; }; +#endif +private: + virtual bool Initialize(DWORD dwContext, bool bDuringRestore); + virtual bool WaitAndCheckForAsyncOperation(IVssAsync* pAsync); + virtual void QuerySnapshotSet(GUID snapshotSetID); + bool CheckWriterStatus(); +}; + +class VSSClientVista:public VSSClient +{ +public: + VSSClientVista(); + virtual ~VSSClientVista(); + virtual bool CreateSnapshots(alist *mount_points); + virtual bool CloseBackup(); + virtual bool CloseRestore(); + virtual WCHAR *GetMetadata(); +#ifdef _WIN64 + virtual const char* GetDriverName() { return "Win64 VSS"; }; +#else + virtual const char* GetDriverName() { return "Win32 VSS"; }; +#endif +private: + virtual bool Initialize(DWORD dwContext, bool bDuringRestore); + virtual bool WaitAndCheckForAsyncOperation(IVssAsync* pAsync); + virtual void QuerySnapshotSet(GUID snapshotSetID); + bool CheckWriterStatus(); +}; + + +BOOL VSSPathConvert(const char *szFilePath, char *szShadowPath, int nBuflen); +BOOL VSSPathConvertW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen); + +#endif /* WIN32_VSS */ + +#endif /* __VSS_H_ */ diff --git a/bacula/src/win32/filed/vss_Vista.cpp b/bacula/src/win32/filed/vss_Vista.cpp new file mode 100644 index 0000000000..c9e8184274 --- /dev/null +++ b/bacula/src/win32/filed/vss_Vista.cpp @@ -0,0 +1,4 @@ +#ifdef WIN32_VSS +#define B_VSS_VISTA +#include "vss_generic.cpp" +#endif diff --git a/bacula/src/win32/filed/vss_W2K3.cpp b/bacula/src/win32/filed/vss_W2K3.cpp new file mode 100644 index 0000000000..1c397dada7 --- /dev/null +++ b/bacula/src/win32/filed/vss_W2K3.cpp @@ -0,0 +1,13 @@ +/* + * We need one class per OS as Microsofts API + * differs only by calling convention and some + * function we don't use. + * + * vss_generic will handle all versions and + * switch between different headers to include. +*/ + +#ifdef WIN32_VSS +#define B_VSS_W2K3 +#include "vss_generic.cpp" +#endif diff --git a/bacula/src/win32/filed/vss_XP.cpp b/bacula/src/win32/filed/vss_XP.cpp new file mode 100644 index 0000000000..20871296d9 --- /dev/null +++ b/bacula/src/win32/filed/vss_XP.cpp @@ -0,0 +1,4 @@ +#ifdef WIN32_VSS +#define B_VSS_XP +#include "vss_generic.cpp" +#endif diff --git a/bacula/src/win32/filed/vss_generic.cpp b/bacula/src/win32/filed/vss_generic.cpp new file mode 100644 index 0000000000..74efc8c98d --- /dev/null +++ b/bacula/src/win32/filed/vss_generic.cpp @@ -0,0 +1,847 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +// -*- Mode: C++ -*- +// vss.cpp -- Interface to Volume Shadow Copies (VSS) +// +// Copyright transferred from MATRIX-Computer GmbH to +// Kern Sibbald by express permission. +// +// Author : Thorsten Engel +// Created On : Fri May 06 21:44:00 2005 + + +#ifdef WIN32_VSS + +#include "bacula.h" +#include "filed/filed.h" + +#undef setlocale + +// STL includes +#include +#include +#include +#include +#include +using namespace std; + +#include "ms_atl.h" +#include + +/* + * Kludges to get Vista code to compile. + * by Kern Sibbald - June 2007 + */ +#define __in IN +#define __out OUT +#define __RPC_unique_pointer +#define __RPC_string +#ifndef __RPC__out_ecount_part +#define __RPC__out_ecount_part(x, y) +#endif +#define __RPC__deref_inout_opt +#define __RPC__out + +#if !defined(ENABLE_NLS) +#define setlocale(p, d) +#endif + +#ifdef HAVE_STRSAFE_H +// Used for safe string manipulation +#include +#endif + +#ifdef HAVE_MINGW +class IXMLDOMDocument; +#endif + +/* Reduce compiler warnings from Windows vss code */ +#undef uuid +#define uuid(x) + +#ifdef B_VSS_XP + #define VSSClientGeneric VSSClientXP + #include "inc/WinXP/vss.h" + #include "inc/WinXP/vswriter.h" + #include "inc/WinXP/vsbackup.h" + +#endif + +#ifdef B_VSS_W2K3 + #define VSSClientGeneric VSSClient2003 + #include "inc/Win2003/vss.h" + #include "inc/Win2003/vswriter.h" + #include "inc/Win2003/vsbackup.h" +#endif + +#ifdef B_VSS_VISTA + #define VSSClientGeneric VSSClientVista + #include "inc/Win2003/vss.h" + #include "inc/Win2003/vswriter.h" + #include "inc/Win2003/vsbackup.h" +#endif + +#include "vss.h" + +static void JmsgVssApiStatus(JCR *jcr, int msg_status, HRESULT hr, const char *apiName) +{ + const char *errmsg; + if (hr == S_OK || hr == VSS_S_ASYNC_FINISHED) { + return; + } + switch (hr) { + case E_INVALIDARG: + errmsg = "One of the parameter values is not valid."; + break; + case E_OUTOFMEMORY: + errmsg = "The caller is out of memory or other system resources."; + break; + case E_ACCESSDENIED: + errmsg = "The caller does not have sufficient backup privileges or is not an administrator."; + break; + case VSS_E_INVALID_XML_DOCUMENT: + errmsg = "The XML document is not valid."; + break; + case VSS_E_OBJECT_NOT_FOUND: + errmsg = "The specified file does not exist."; + break; + case VSS_E_BAD_STATE: + errmsg = "Object is not initialized; called during restore or not called in correct sequence."; + break; + case VSS_E_WRITER_INFRASTRUCTURE: + errmsg = "The writer infrastructure is not operating properly. Check that the Event Service and VSS have been started, and check for errors associated with those services in the error log."; + break; + case VSS_S_ASYNC_CANCELLED: + errmsg = "The asynchronous operation was canceled by a previous call to IVssAsync::Cancel."; + break; + case VSS_S_ASYNC_PENDING: + errmsg = "The asynchronous operation is still running."; + break; + case RPC_E_CHANGED_MODE: + errmsg = "Previous call to CoInitializeEx specified the multithread apartment (MTA). This call indicates single-threaded apartment has occurred."; + break; + case S_FALSE: + errmsg = "No writer found for the current component."; + break; + default: + errmsg = "Unexpected error. The error code is logged in the error log file."; + break; + } + Jmsg(jcr, msg_status, 0, "VSS API failure calling \"%s\". ERR=%s\n", apiName, errmsg); +} + +#ifndef VSS_WS_FAILED_AT_BACKUPSHUTDOWN +#define VSS_WS_FAILED_AT_BACKUPSHUTDOWN (VSS_WRITER_STATE)15 +#endif + + +static void JmsgVssWriterStatus(JCR *jcr, int msg_status, VSS_WRITER_STATE eWriterStatus, char *writer_name) +{ + const char *errmsg; + + /* The following are normal states */ + if (eWriterStatus == VSS_WS_STABLE || + eWriterStatus == VSS_WS_WAITING_FOR_BACKUP_COMPLETE) { + return; + } + + /* Potential errors */ + switch (eWriterStatus) { + default: + case VSS_WS_UNKNOWN: + errmsg = "The writer's state is not known. This is a writer error."; + break; + case VSS_WS_WAITING_FOR_FREEZE: + errmsg = "The writer is waiting for the freeze state."; + break; + case VSS_WS_WAITING_FOR_THAW: + errmsg = "The writer is waiting for the thaw state."; + break; + case VSS_WS_WAITING_FOR_POST_SNAPSHOT: + errmsg = "The writer is waiting for the PostSnapshot state."; + break; + case VSS_WS_WAITING_FOR_BACKUP_COMPLETE: + errmsg = "The writer is waiting for the requester to finish its backup operation."; + break; + case VSS_WS_FAILED_AT_IDENTIFY: + errmsg = "The writer vetoed the shadow copy creation process at the writer identification state."; + break; + case VSS_WS_FAILED_AT_PREPARE_BACKUP: + errmsg = "The writer vetoed the shadow copy creation process during the backup preparation state."; + break; + case VSS_WS_FAILED_AT_PREPARE_SNAPSHOT: + errmsg = "The writer vetoed the shadow copy creation process during the PrepareForSnapshot state."; + break; + case VSS_WS_FAILED_AT_FREEZE: + errmsg = "The writer vetoed the shadow copy creation process during the freeze state."; + break; + case VSS_WS_FAILED_AT_THAW: + errmsg = "The writer vetoed the shadow copy creation process during the thaw state."; + break; + case VSS_WS_FAILED_AT_POST_SNAPSHOT: + errmsg = "The writer vetoed the shadow copy creation process during the PostSnapshot state."; + break; + case VSS_WS_FAILED_AT_BACKUP_COMPLETE: + errmsg = "The shadow copy has been created and the writer failed during the BackupComplete state."; + break; + case VSS_WS_FAILED_AT_PRE_RESTORE: + errmsg = "The writer failed during the PreRestore state."; + break; + case VSS_WS_FAILED_AT_POST_RESTORE: + errmsg = "The writer failed during the PostRestore state."; + break; + case VSS_WS_FAILED_AT_BACKUPSHUTDOWN: + errmsg = "The writer failed during the shutdown of the backup application."; + + } + Jmsg(jcr, msg_status, 0, "VSS Writer \"%s\" has invalid state. ERR=%s\n", writer_name, errmsg); +} + +/* + * + * some helper functions + * + * + */ + + +// Defined in vss.cpp +// Append a backslash to the current string +wstring AppendBackslash(wstring str); +// Get the unique volume name for the given path +wstring GetUniqueVolumeNameForPath(wstring path, wstring &rootPath); + +// Helper macro for quick treatment of case statements for error codes +#define GEN_MERGE(A, B) A##B +#define GEN_MAKE_W(A) GEN_MERGE(L, A) + +#define CHECK_CASE_FOR_CONSTANT(value) \ + case value: return (GEN_MAKE_W(#value)); + + +// Convert a writer status into a string +inline const wchar_t* GetStringFromWriterStatus(VSS_WRITER_STATE eWriterStatus) +{ + switch (eWriterStatus) { + CHECK_CASE_FOR_CONSTANT(VSS_WS_STABLE); + CHECK_CASE_FOR_CONSTANT(VSS_WS_WAITING_FOR_FREEZE); + CHECK_CASE_FOR_CONSTANT(VSS_WS_WAITING_FOR_THAW); + CHECK_CASE_FOR_CONSTANT(VSS_WS_WAITING_FOR_POST_SNAPSHOT); + CHECK_CASE_FOR_CONSTANT(VSS_WS_WAITING_FOR_BACKUP_COMPLETE); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_IDENTIFY); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_PREPARE_BACKUP); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_PREPARE_SNAPSHOT); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_FREEZE); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_THAW); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_POST_SNAPSHOT); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_BACKUP_COMPLETE); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_PRE_RESTORE); + CHECK_CASE_FOR_CONSTANT(VSS_WS_FAILED_AT_POST_RESTORE); + default: + return L"Error or Undefined"; + } +} + +// Constructor + +VSSClientGeneric::VSSClientGeneric() +{ +} + +// Destructor +VSSClientGeneric::~VSSClientGeneric() +{ +} + +// Initialize the COM infrastructure and the internal pointers +bool VSSClientGeneric::Initialize(DWORD dwContext, bool bDuringRestore) +{ + CComPtr pAsync1; + VSS_BACKUP_TYPE backup_type; + IVssBackupComponents* pVssObj = (IVssBackupComponents*)m_pVssObject; + + if (!(p_CreateVssBackupComponents && p_VssFreeSnapshotProperties)) { + Dmsg2(0, "VSSClientGeneric::Initialize: p_CreateVssBackupComponents=0x%08X, p_VssFreeSnapshotProperties=0x%08X\n", p_CreateVssBackupComponents, p_VssFreeSnapshotProperties); + Jmsg(m_jcr, M_FATAL, 0, "Entry point CreateVssBackupComponents or VssFreeSnapshotProperties missing.\n"); + return false; + } + + if (m_VolumeList) { + delete m_VolumeList; + } + + m_VolumeList = New(MTab()); // TODO: See if we do this part only in backup + if (!m_VolumeList->get()) { + Jmsg(m_jcr, M_ERROR, 0, "Unable to list devices and volumes.\n"); + return false; + } + + HRESULT hr; + // Initialize COM + if (!m_bCoInitializeCalled) { + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); + if (FAILED(hr)) { + Dmsg1(0, "VSSClientGeneric::Initialize: CoInitializeEx returned 0x%08X\n", hr); + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "CoInitializeEx"); + errno = b_errno_win32; + return false; + } + m_bCoInitializeCalled = true; + } + + // Release the any old IVssBackupComponents interface + if (pVssObj) { + pVssObj->Release(); + m_pVssObject = NULL; + } + + // Create new internal backup components object + hr = p_CreateVssBackupComponents((IVssBackupComponents**)&m_pVssObject); + if (FAILED(hr)) { + berrno be; + Dmsg2(0, "VSSClientGeneric::Initialize: CreateVssBackupComponents returned 0x%08X. ERR=%s\n", + hr, be.bstrerror(b_errno_win32)); + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "CreateVssBackupComponents"); + errno = b_errno_win32; + return false; + } + + /* Define shorthand VssObject with time */ + pVssObj = (IVssBackupComponents*)m_pVssObject; + + + if (!bDuringRestore) { +#if defined(B_VSS_W2K3) || defined(B_VSS_VISTA) + if (dwContext != VSS_CTX_BACKUP) { + hr = pVssObj->SetContext(dwContext); + if (FAILED(hr)) { + Dmsg1(0, "VSSClientGeneric::Initialize: IVssBackupComponents->SetContext returned 0x%08X\n", hr); + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "SetContext"); + errno = b_errno_win32; + return false; + } + } +#endif + + // 1. InitializeForBackup + hr = pVssObj->InitializeForBackup(); + if (FAILED(hr)) { + Dmsg1(0, "VSSClientGeneric::Initialize: IVssBackupComponents->InitializeForBackup returned 0x%08X\n", hr); + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "InitializeForBackup"); + errno = b_errno_win32; + return false; + } + + // 2. SetBackupState + switch (m_jcr->getJobLevel()) { + case L_FULL: + backup_type = VSS_BT_FULL; + break; + case L_DIFFERENTIAL: + backup_type = VSS_BT_DIFFERENTIAL; + break; + case L_INCREMENTAL: + backup_type = VSS_BT_INCREMENTAL; + break; + default: + Dmsg1(0, "VSSClientGeneric::Initialize: unknown backup level %d\n", m_jcr->getJobLevel()); + backup_type = VSS_BT_FULL; + break; + } + hr = pVssObj->SetBackupState(true, true, backup_type, false); /* FIXME: need to support partial files - make last parameter true when done */ + if (FAILED(hr)) { + Dmsg1(0, "VSSClientGeneric::Initialize: IVssBackupComponents->SetBackupState returned 0x%08X\n", hr); + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "SetBackupState"); + errno = b_errno_win32; + return false; + } + + // 3. GatherWriterMetaData + hr = pVssObj->GatherWriterMetadata(&pAsync1.p); + if (FAILED(hr)) { + Dmsg1(0, "VSSClientGeneric::Initialize: IVssBackupComponents->GatherWriterMetadata returned 0x%08X\n", hr); + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "GatherWriterMetadata"); + errno = b_errno_win32; + return false; + } + // Waits for the async operation to finish and checks the result + if (!WaitAndCheckForAsyncOperation(pAsync1.p)) { + /* Error message already printed */ + errno = b_errno_win32; + return false; + } + } + + // We are during restore now? + m_bDuringRestore = bDuringRestore; + + // Keep the context + m_dwContext = dwContext; + + return true; +} + +bool VSSClientGeneric::WaitAndCheckForAsyncOperation(IVssAsync* pAsync) +{ + // Wait until the async operation finishes + // unfortunately we can't use a timeout here yet. + // the interface would allow it on W2k3, + // but it is not implemented yet.... + + HRESULT hr; + + // Check the result of the asynchronous operation + HRESULT hrReturned = S_OK; + + int timeout = 1800; // 30 minutes ... + + int queryErrors = 0; + do { + if (hrReturned != S_OK) { + Sleep(1000); + } + hrReturned = S_OK; + hr = pAsync->QueryStatus(&hrReturned, NULL); + if (FAILED(hr)) { + queryErrors++; + } + } while ((timeout-- > 0) && (hrReturned == VSS_S_ASYNC_PENDING)); + + if (hrReturned == VSS_S_ASYNC_FINISHED) { + return true; + } + + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "Query Async Status after 30 minute wait"); + return false; +} + +static int volume_cmp(void *e1, void *e2) +{ + WCHAR *v1 = (WCHAR *) e1; + MTabEntry *v2 = (MTabEntry *) e2; + return wcscmp(v1, v2->volumeName); +} + +static pthread_mutex_t create_mutex = PTHREAD_MUTEX_INITIALIZER; + +bool VSSClientGeneric::CreateSnapshots(alist *mount_points) +{ + IVssBackupComponents *pVssObj; + bool ret = false; + HRESULT hr; + + /* AddToSnapshotSet */ + CComPtr pAsync1; + CComPtr pAsync2; + VSS_ID pid; + + /* While testing the concurrent snapshot creation, I found out that the entire snapshot + * creation process should be protected by a mutex. (InitializeForBackups and CreateSnapshots). + */ + + /* Create only one snapshot set at a time */ + P(create_mutex); + + /* szDriveLetters contains all drive letters in uppercase */ + /* if a drive can not being added, it's converted to lowercase in szDriveLetters */ + /* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vss/base/ivssbackupcomponents_startsnapshotset.asp */ + if (!m_pVssObject || m_bBackupIsInitialized) { + Jmsg(m_jcr, M_FATAL, 0, "No pointer to VssObject or Backup is not Initialized\n"); + errno = ENOSYS; + goto bail_out; + } + + m_uidCurrentSnapshotSet = GUID_NULL; + + pVssObj = (IVssBackupComponents*)m_pVssObject; + + /* startSnapshotSet */ + hr = pVssObj->StartSnapshotSet(&m_uidCurrentSnapshotSet); + if (FAILED(hr)) { + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "StartSnapshotSet"); + errno = ENOSYS; + goto bail_out; + } + + /* + * Now try all paths in case they are mount points + */ + for (int i=0; i < mount_points->size(); i++) { + wchar_t *p = (wchar_t *)mount_points->get(i); + // store uniquevolumname + if (SUCCEEDED(pVssObj->AddToSnapshotSet(p, GUID_NULL, &pid))) { + MTabEntry *elt = (MTabEntry*)m_VolumeList->entries->search(p, volume_cmp); + ASSERT2(elt, "Should find the volume in the list"); + Jmsg(m_jcr, M_INFO, 0, " Snapshot mount point: %ls\n", elt->first()); + Dmsg1(50, "AddToSnapshot OK for Vol: %ls\n", p); + } else { + //Dmsg1(50, "AddToSnapshot() failed for Vol: %ls\n", (LPWSTR)volume.c_str()); + //Dmsg1(50, "AddToSnapshot() failed for path: %s\n", p); + } + } + + /* PrepareForBackup */ + hr = pVssObj->PrepareForBackup(&pAsync1.p); + if (FAILED(hr)) { + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "PrepareForBackup"); + errno = b_errno_win32; + goto bail_out; + } + + // Waits for the async operation to finish and checks the result + if (!WaitAndCheckForAsyncOperation(pAsync1.p)) { + /* Error message already printed */ + errno = b_errno_win32; + goto bail_out; + } + + /* get latest info about writer status */ + if (!CheckWriterStatus()) { + /* Error message already printed */ + errno = b_errno_win32; /* Error already printed */ + goto bail_out; + } + + /* DoSnapShotSet */ + hr = pVssObj->DoSnapshotSet(&pAsync2.p); + if (FAILED(hr)) { + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "DoSnapshotSet"); + errno = b_errno_win32; + goto bail_out; + } + + // Waits for the async operation to finish and checks the result + if (!WaitAndCheckForAsyncOperation(pAsync2.p)) { + /* Error message already printed */ + errno = b_errno_win32; + goto bail_out; + } + + /* get latest info about writer status */ + if (!CheckWriterStatus()) { + /* Error message already printed */ + errno = b_errno_win32; /* Error already printed */ + goto bail_out; + } + + /* query snapshot info */ + QuerySnapshotSet(m_uidCurrentSnapshotSet); + + m_bBackupIsInitialized = true; + + ret = true; +bail_out: + V(create_mutex); + return ret; +} + +bool VSSClientGeneric::CloseBackup() +{ + bool bRet = false; + HRESULT hr; + BSTR xml; + IVssBackupComponents* pVssObj = (IVssBackupComponents*)m_pVssObject; + + if (!m_pVssObject) { + Jmsg(m_jcr, M_FATAL, 0, "VssOject is NULL.\n"); + errno = ENOSYS; + return bRet; + } + /* Create or Delete Snapshot one at a time */ + P(create_mutex); + + CComPtr pAsync; + m_bBackupIsInitialized = false; + + hr = pVssObj->BackupComplete(&pAsync.p); + if (SUCCEEDED(hr)) { + // Waits for the async operation to finish and checks the result + if (!WaitAndCheckForAsyncOperation(pAsync.p)) { + /* Error message already printed */ + errno = b_errno_win32; + } else { + bRet = true; + } + } else { + JmsgVssApiStatus(m_jcr, M_ERROR, hr, "BackupComplete"); + errno = b_errno_win32; + pVssObj->AbortBackup(); + } + + /* get latest info about writer status */ + CheckWriterStatus(); + + hr = pVssObj->SaveAsXML(&xml); + if (SUCCEEDED(hr)) { + m_metadata = xml; + } else { + m_metadata = NULL; + } + + /* FIXME?: The docs http://msdn.microsoft.com/en-us/library/aa384582%28v=VS.85%29.aspx say this isn't required... */ + if (m_uidCurrentSnapshotSet != GUID_NULL) { + VSS_ID idNonDeletedSnapshotID = GUID_NULL; + LONG lSnapshots; + + pVssObj->DeleteSnapshots( + m_uidCurrentSnapshotSet, + VSS_OBJECT_SNAPSHOT_SET, + false, + &lSnapshots, + &idNonDeletedSnapshotID); + + m_uidCurrentSnapshotSet = GUID_NULL; + } + + if (m_bWriterStatusCurrent) { + m_bWriterStatusCurrent = false; + pVssObj->FreeWriterStatus(); + } + + pVssObj->Release(); + m_pVssObject = NULL; + + // Call CoUninitialize if the CoInitialize was performed sucesfully + if (m_bCoInitializeCalled) { + CoUninitialize(); + m_bCoInitializeCalled = false; + } + + V(create_mutex); + return bRet; +} + +WCHAR *VSSClientGeneric::GetMetadata() +{ + return m_metadata; +} + +bool VSSClientGeneric::CloseRestore() +{ + //HRESULT hr; + IVssBackupComponents* pVssObj = (IVssBackupComponents*)m_pVssObject; + CComPtr pAsync; + + if (!pVssObj) { + Jmsg(m_jcr, M_FATAL, 0, "No pointer to VssObject or Backup is not Initialized\n"); + errno = ENOSYS; + return false; + } +#if 0 +/* done by plugin now */ + if (SUCCEEDED(hr = pVssObj->PostRestore(&pAsync.p))) { + // Waits for the async operation to finish and checks the result + if (!WaitAndCheckForAsyncOperation(pAsync1.p)) { + /* Error message already printed */ + errno = b_errno_win32; + return false; + } + /* get latest info about writer status */ + if (!CheckWriterStatus()) { + /* Error message already printed */ + errno = b_errno_win32; + return false; + } + } else { + errno = b_errno_win32; + return false; + } +#endif + return true; +} + +// Query all the shadow copies in the given set +void VSSClientGeneric::QuerySnapshotSet(GUID snapshotSetID) +{ + if (!(p_CreateVssBackupComponents && p_VssFreeSnapshotProperties)) { + Jmsg(m_jcr, M_FATAL, 0, "CreateVssBackupComponents or VssFreeSnapshotProperties API is NULL.\n"); + errno = ENOSYS; + return; + } + + if (snapshotSetID == GUID_NULL || m_pVssObject == NULL) { + Jmsg(m_jcr, M_FATAL, 0, "snapshotSetID == NULL or VssObject is NULL.\n"); + errno = ENOSYS; + return; + } + + IVssBackupComponents* pVssObj = (IVssBackupComponents*) m_pVssObject; + + // Get list all shadow copies. + CComPtr pIEnumSnapshots; + HRESULT hr = pVssObj->Query( GUID_NULL, + VSS_OBJECT_NONE, + VSS_OBJECT_SNAPSHOT, + (IVssEnumObject**)(&pIEnumSnapshots) ); + + // If there are no shadow copies, just return + if (FAILED(hr)) { + Jmsg(m_jcr, M_FATAL, 0, "No Volume Shadow copies made.\n"); + errno = b_errno_win32; + return; + } + + // Enumerate all shadow copies. + VSS_OBJECT_PROP Prop; + VSS_SNAPSHOT_PROP& Snap = Prop.Obj.Snap; + + while (true) { + // Get the next element + ULONG ulFetched; + hr = (pIEnumSnapshots.p)->Next(1, &Prop, &ulFetched); + + // We reached the end of list + if (ulFetched == 0) { + break; + } + + Dmsg2(DT_VOLUME|50, "Adding %ls => %ls to m_VolumeList\n", + Snap.m_pwszOriginalVolumeName, Snap.m_pwszSnapshotDeviceObject); + + // Print the shadow copy (if not filtered out) + if (Snap.m_SnapshotSetId == snapshotSetID) { + MTabEntry *elt = (MTabEntry*)m_VolumeList->entries->search(Snap.m_pwszOriginalVolumeName, volume_cmp); + if (!elt) { + Dmsg1(DT_VOLUME|50, "Unable to find [%ls] in the device list\n", Snap.m_pwszOriginalVolumeName); + foreach_rblist(elt, m_VolumeList->entries) { + elt->debug_paths(); + } + Jmsg(m_jcr, M_WARNING, 0, _("Unable to find volume %ls in the device list\n"), Snap.m_pwszOriginalVolumeName); + } else { + elt->shadowCopyName = bwcsdup(Snap.m_pwszSnapshotDeviceObject); + elt->setInSnapshotSet(); + } + } + p_VssFreeSnapshotProperties(&Snap); + } + errno = 0; +} + +// Check the status for all selected writers +bool VSSClientGeneric::CheckWriterStatus() +{ + /* + http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vss/base/ivssbackupcomponents_startsnapshotset.asp + */ + IVssBackupComponents* pVssObj = (IVssBackupComponents*)m_pVssObject; + if (!pVssObj) { + Jmsg(m_jcr, M_FATAL, 0, "Cannot get IVssBackupComponents pointer.\n"); + errno = ENOSYS; + return false; + } + DestroyWriterInfo(); + + if (m_bWriterStatusCurrent) { + m_bWriterStatusCurrent = false; + pVssObj->FreeWriterStatus(); + } + // Gather writer status to detect potential errors + CComPtr pAsync; + + HRESULT hr = pVssObj->GatherWriterStatus(&pAsync.p); + if (FAILED(hr)) { + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "GatherWriterStatus"); + errno = b_errno_win32; + return false; + } + + // Waits for the async operation to finish and checks the result + if (!WaitAndCheckForAsyncOperation(pAsync.p)) { + /* Error message already printed */ + errno = b_errno_win32; + return false; + } + + m_bWriterStatusCurrent = true; + + unsigned cWriters = 0; + + hr = pVssObj->GetWriterStatusCount(&cWriters); + if (FAILED(hr)) { + JmsgVssApiStatus(m_jcr, M_FATAL, hr, "GetWriterStatusCount"); + errno = b_errno_win32; + return false; + } + + int nState; + POOLMEM *szBuf = get_pool_memory(PM_FNAME); + // Enumerate each writer + for (unsigned iWriter = 0; iWriter < cWriters; iWriter++) { + VSS_ID idInstance = GUID_NULL; + VSS_ID idWriter= GUID_NULL; + VSS_WRITER_STATE eWriterStatus = VSS_WS_UNKNOWN; + CComBSTR bstrWriterName; + HRESULT hrWriterFailure = S_OK; + + // Get writer status + hr = pVssObj->GetWriterStatus(iWriter, + &idInstance, + &idWriter, + &bstrWriterName, + &eWriterStatus, + &hrWriterFailure); + if (FAILED(hr)) { + /* Api failed */ + JmsgVssApiStatus(m_jcr, M_WARNING, hr, "GetWriterStatus"); + nState = 0; /* Unknown writer state -- API failed */ + } else { + switch(eWriterStatus) { + case VSS_WS_FAILED_AT_IDENTIFY: + case VSS_WS_FAILED_AT_PREPARE_BACKUP: + case VSS_WS_FAILED_AT_PREPARE_SNAPSHOT: + case VSS_WS_FAILED_AT_FREEZE: + case VSS_WS_FAILED_AT_THAW: + case VSS_WS_FAILED_AT_POST_SNAPSHOT: + case VSS_WS_FAILED_AT_BACKUP_COMPLETE: + case VSS_WS_FAILED_AT_PRE_RESTORE: + case VSS_WS_FAILED_AT_POST_RESTORE: + #if defined(B_VSS_W2K3) || defined(B_VSS_VISTA) + case VSS_WS_FAILED_AT_BACKUPSHUTDOWN: + #endif + /* Writer status problem */ + wchar_2_UTF8(&szBuf, bstrWriterName.p); + JmsgVssWriterStatus(m_jcr, M_WARNING, eWriterStatus, szBuf); + nState = -1; /* bad writer state */ + break; + + default: + /* ok */ + nState = 1; /* Writer state OK */ + } + } + /* store text info */ + char str[1000]; + bstrncpy(str, "\"", sizeof(str)); + wchar_2_UTF8(&szBuf, bstrWriterName.p); + bstrncat(str, szBuf, sizeof(str)); + bstrncat(str, "\", State: 0x", sizeof(str)); + itoa(eWriterStatus, szBuf, sizeof_pool_memory(szBuf)); + bstrncat(str, szBuf, sizeof(str)); + bstrncat(str, " (", sizeof(str)); + wchar_2_UTF8(&szBuf, GetStringFromWriterStatus(eWriterStatus)); + bstrncat(str, szBuf, sizeof(str)); + bstrncat(str, ")", sizeof(str)); + AppendWriterInfo(nState, (const char *)str); + } + free_pool_memory(szBuf); + errno = 0; + return true; +} + +#endif /* WIN32_VSS */ diff --git a/bacula/src/win32/filed/who.h b/bacula/src/win32/filed/who.h new file mode 100644 index 0000000000..cedf6bfc32 --- /dev/null +++ b/bacula/src/win32/filed/who.h @@ -0,0 +1,33 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + * This file is pulled in by certain generic routines in libwin32 + * to define the names of the daemon that is being built. + */ + +#define APP_NAME "Bacula-fd" +#define LC_APP_NAME "bacula-fd" +#define APP_DESC "Bacula File Backup Service" + +#define terminate_app(x) terminate_filed(x) +extern void terminate_filed(int sig); +class VSSClient; +extern VSSClient *VSSInit(); diff --git a/bacula/src/win32/full_win32_installer/ConfigPage1.nsh b/bacula/src/win32/full_win32_installer/ConfigPage1.nsh new file mode 100644 index 0000000000..71965a2a38 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/ConfigPage1.nsh @@ -0,0 +1,294 @@ +Function EnterConfigPage1 + ${If} $AutomaticInstall = 1 + Abort + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsFileAndStorage} + + ${If} $R0 = 0 + Abort + ${EndIf} + + FileOpen $R5 "$PLUGINSDIR\ConfigPage1.ini" w + + StrCpy $R6 1 ; Field Number + StrCpy $R7 0 ; Top + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 52 + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Client"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigClientName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigClientPort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigClientMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigClientPassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigClientInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigClientStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 52 + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Storage"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigStorageName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigStoragePort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigStorageMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigStoragePassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigStorageInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigStorageStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + ${Endif} + + IntOp $R6 $R6 - 1 + + FileWrite $R5 "[Settings]$\r$\nNumFields=$R6$\r$\n" + + FileClose $R5 + + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage1)" "$(SUBTITLE_ConfigPage1)" + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ConfigPage1.ini" + Pop $HDLG ;HWND of dialog + + ; Initialize Controls + + StrCpy $R6 1 ; Field Number + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + + ; Client Name + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + + IntOp $R6 $R6 + 2 + + ; Client Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + + IntOp $R6 $R6 + 2 + + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 5 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + + ; Storage Name + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + + IntOp $R6 $R6 + 2 + + ; Storage Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + + IntOp $R6 $R6 + 2 + + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 5 + ${Endif} + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process results + + StrCpy $R6 3 + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientName "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPort "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientMaxJobs "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPassword "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientInstallService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientStartService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 3 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageName "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStoragePort "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageMaxJobs "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStoragePassword "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageInstallService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageStartService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 3 + ${Endif} +FunctionEnd + +Function LeaveConfigPage1 + StrCpy $R6 5 + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 9 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 9 + ${Endif} +FunctionEnd diff --git a/bacula/src/win32/full_win32_installer/ConfigPage2.nsh b/bacula/src/win32/full_win32_installer/ConfigPage2.nsh new file mode 100644 index 0000000000..532af9b069 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/ConfigPage2.nsh @@ -0,0 +1,454 @@ +Function EnterConfigPage2 + IntOp $R0 $NewComponents & ${ComponentsRequiringUserConfig} + + ${If} $R0 = 0 + Abort + ${EndIf} + + FileOpen $R5 "$PLUGINSDIR\ConfigPage2.ini" w + + StrCpy $R6 1 ; Field Number + StrCpy $R7 0 ; Top + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + ${If} $AutomaticInstall = 1 + IntOp $R8 $R7 + 54 + ${Else} + IntOp $R8 $R7 + 92 + ${EndIf} + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Director"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 54 + ${Else} + IntOp $R8 $R7 + 26 + ${EndIf} + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Enter data for Director allowed to access this Client"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + ${EndIf} + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + ${If} "$ConfigDirectorName" == "" + StrCpy $ConfigDirectorName "$HostName-dir" + ${EndIf} + ${If} "$ConfigDirectorPassword" == "" + StrCpy $ConfigDirectorPassword "$LocalDirectorPassword" + ${EndIf} + ${Else} + ${If} "$ConfigDirectorName" == "$HostName-dir" + StrCpy $ConfigDirectorName "" + ${EndIf} + ${If} "$ConfigDirectorPassword" == "$LocalDirectorPassword" + StrCpy $ConfigDirectorPassword "" + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigDirectorPort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigDirectorMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + IntOp $R7 $R7 + 14 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorPassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Mail Server"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=48$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorMailServer$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Mail Address"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=48$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorMailAddress$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Database"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + ${If} $ConfigDirectorDB = 0 + ${If} $MySQLPath != "" + StrCpy $ConfigDirectorDB 1 + ${ElseIf} $PostgreSQLPath != "" + StrCpy $ConfigDirectorDB 2 + ${Else} + StrCpy $ConfigDirectorDB 3 + ${EndIf} + ${EndIf} + + ${If} $ConfigDirectorDB = 1 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="MySQL"$\r$\nFlags="GROUP"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=90$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + + ${If} $ConfigDirectorDB = 2 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="PostgreSQL"$\r$\nFlags="NOTABSTOP"$\r$\nLeft=94$\r$\nTop=$R7$\r$\nRight=146$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + + ${If} $ConfigDirectorDB = 3 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="Sqlite"$\r$\nFlags="NOTABSTOP"$\r$\nLeft=150$\r$\nTop=$R7$\r$\nRight=182$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + ${If} $AutomaticInstall = 0 + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigDirectorInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigDirectorStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Address"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=48$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorAddress$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + IntOp $R8 $R7 + 8 + ${EndIf} + ${EndIf} + + IntOp $R7 $R7 + 4 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 42 + + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Monitor"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigMonitorName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=150$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigMonitorPassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 20 + ${EndIf} + ${EndIf} + + IntOp $R6 $R6 - 1 + FileWrite $R5 "[Settings]$\r$\nNumFields=$R6$\r$\n" + + FileClose $R5 + + IntOp $R0 $NewComponents & ${ComponentsFileAndStorage} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 1 + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage1)" "$(SUBTITLE_ConfigPage1)" + ${Else} + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage2)" "$(SUBTITLE_ConfigPage2)" + ${EndIf} + + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ConfigPage2.ini" + Pop $HDLG ;HWND of dialog + + ; Initialize Controls + StrCpy $R6 2 ; Field Number + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + ; Name + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + ; Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 9 + + ${If} $AutomaticInstall = 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process results + + StrCpy $R6 2 + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorName "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorPort "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMaxJobs "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorPassword "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMailServer "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMailAddress "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 1 + ${Endif} + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 2 + ${Endif} + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 3 + ${Endif} + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorInstallService "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorStartService "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorAddress "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMonitorName "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMonitorPassword "ConfigPage2.ini" "Field $R6" "State" + ${EndIf} + ${EndIf} +FunctionEnd + +Function LeaveConfigPage2 + ${If} $AutomaticInstall = 0 + StrCpy $R6 4 + + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} +FunctionEnd diff --git a/bacula/src/win32/full_win32_installer/DumpLog.nsh b/bacula/src/win32/full_win32_installer/DumpLog.nsh new file mode 100644 index 0000000000..c450044a80 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/DumpLog.nsh @@ -0,0 +1,46 @@ +!define LVM_GETITEMCOUNT 0x1004 +!define LVM_GETITEMTEXT 0x102D + +Function DumpLog + Exch $5 + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $6 + + FindWindow $0 "#32770" "" $HWNDPARENT + GetDlgItem $0 $0 1016 + StrCmp $0 0 error + FileOpen $5 $5 "w" + StrCmp $5 0 error + SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6 + System::Alloc ${NSIS_MAX_STRLEN} + Pop $3 + StrCpy $2 0 + System::Call "*(i, i, i, i, i, i, i, i, i) i \ + (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1" + loop: StrCmp $2 $6 done + System::Call "User32::SendMessageA(i, i, i, i) i \ + ($0, ${LVM_GETITEMTEXT}, $2, r1)" + System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)" + FileWrite $5 "$4$\r$\n" + IntOp $2 $2 + 1 + Goto loop + done: + FileClose $5 + System::Free $1 + System::Free $3 + Goto exit + error: + MessageBox MB_OK error + exit: + Pop $6 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + Exch $5 +FunctionEnd diff --git a/bacula/src/win32/full_win32_installer/InstallType.ini b/bacula/src/win32/full_win32_installer/InstallType.ini new file mode 100644 index 0000000000..73fb8d9390 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/InstallType.ini @@ -0,0 +1,56 @@ +; +; Note: certain text in this file is overwritten by the code in +; InstallType.nsh +; + +[Settings] +NumFields=6 + +[Field 1] +Type=Label +Text=This is a new installation. Please choose the installation type. +Left=0 +Right=300 +Top=0 +Bottom=28 + +[Field 2] +Type=GroupBox +Text=Installation Type +Left=0 +Right=300 +Top=32 +Bottom=136 + +[Field 3] +Type=RadioButton +Text=Automatic +State=1 +Left=6 +Right=52 +Top=44 +Bottom=54 + +[Field 4] +Type=RadioButton +Text=Custom (not recommended) +Left=6 +Right=252 +Top=90 +Bottom=100 + +[Field 5] +Type=Label +Text=The software will be installed in the default directory "Program Files\\Bacula". The configuration files will be generated using defaults applicable to most installations. +Left=17 +Right=295 +Top=58 +Bottom=86 + +[Field 6] +Type=Label +Text=You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work. +Left=17 +Right=295 +Top=104 +Bottom=132 diff --git a/bacula/src/win32/full_win32_installer/InstallType.nsh b/bacula/src/win32/full_win32_installer/InstallType.nsh new file mode 100644 index 0000000000..373f68cce1 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/InstallType.nsh @@ -0,0 +1,102 @@ +Function EnterInstallType + Push $R0 + Push $R1 + Push $R2 + + ; Check if this is an upgrade by looking for an uninstaller configured + ; in the registry. + ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" + + ${If} "$R0" != "" + ; Check registry for new installer + ReadRegStr $R1 HKLM "Software\Bacula" "InstallLocation" + ${If} "$R1" != "" + ; New Installer + StrCpy $OldInstallDir $R1 + StrCpy $InstallType ${UpgradeInstall} + + SetShellVarContext all + + StrCpy $R1 "$APPDATA\Bacula" + StrCpy $R2 "$INSTDIR\Doc" + + ReadRegDWORD $PreviousComponents HKLM "Software\Bacula" "Components" + + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "A previous installation has been found in $OldInstallDir. Please choose the installation type for any additional components you select." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The configuration files for additional components will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + + ReadRegDWORD $ConfigDirectorDB HKLM Software\Bacula Database + + ${If} $ConfigDirectorDB = 0 + IntOp $R0 $PreviousComponents & ${ComponentDirector} + ${If} $R0 <> 0 + StrCpy $ConfigDirectorDB 1 + ${EndIf} + ${EndIf} + ${Else} + ; Processing Upgrade - Get Install Directory + ${StrRep} $R0 $R0 '"' '' + ${GetParent} $R0 $OldInstallDir + + ; Old Installer + StrCpy $InstallType ${MigrateInstall} + StrCpy $R1 "$OldInstallDir\bin" + StrCpy $R2 "$OldInstallDir\Doc" + + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "An old installation has been found in $OldInstallDir. The Configuration will be migrated. Please choose the installation type for any additional components you select." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"$PROGRAMFILES\Bacula$\". The configuration files for additional components will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + ${EndIf} + ${Else} + ; New Install + StrCpy $InstallType ${NewInstall} + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"$PROGRAMFILES\Bacula$\". The configuration files will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + ${EndIf} + + ${If} $InstallType <> ${NewInstall} + ${AndIf} $PreviousComponents = 0 + ${If} ${FileExists} "$R1\bacula-fd.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentFile} + ${EndIf} + ${If} ${FileExists} "$R1\bconsole.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole} + ${EndIf} + ${If} ${FileExists} "$R1\bat.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentBatConsole} + ${EndIf} + ${If} ${FileExists} "$R1\wx-console.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentGUIConsole} + ${EndIf} + ${If} ${FileExists} "$R2\bacula.pdf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs} + ${EndIf} + ${If} ${FileExists} "$R2\bacula\bacula.html" + IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs} + ${EndIf} + ${If} ${FileExists} "$R2\bacula.html" + IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs} + ${EndIf} + ${EndIf} + + !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)" + !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini" + Pop $HDLG ;HWND of dialog + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process Results + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State" + + ${If} $R0 = 1 + StrCpy $AutomaticInstall 1 + ${Else} + StrCpy $AutomaticInstall 0 + ${EndIf} + + Pop $R2 + Pop $R1 + Pop $R0 +FunctionEnd diff --git a/bacula/src/win32/full_win32_installer/Start.bat b/bacula/src/win32/full_win32_installer/Start.bat new file mode 100644 index 0000000000..0b61f7ec1d --- /dev/null +++ b/bacula/src/win32/full_win32_installer/Start.bat @@ -0,0 +1,5 @@ +rem +rem Bacula start file for Win95/98/Me +rem +cd c:\bacula\bin +c:\bacula\bin\bacula-fd.exe /service -c c:\bacula\bin\bacula-fd.conf diff --git a/bacula/src/win32/full_win32_installer/Stop.bat b/bacula/src/win32/full_win32_installer/Stop.bat new file mode 100644 index 0000000000..3b1d0e5b91 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/Stop.bat @@ -0,0 +1,5 @@ +rem +rem Bacula stop file for Win95/98/Me +rem +cd c:\bacula\bin +c:\bacula\bin\bacula-fd.exe /kill diff --git a/bacula/src/win32/full_win32_installer/WriteTemplates.ini b/bacula/src/win32/full_win32_installer/WriteTemplates.ini new file mode 100644 index 0000000000..e4fb1de804 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/WriteTemplates.ini @@ -0,0 +1,48 @@ +[Settings] +NumFields=5 +CancelEnabled=0 +BackEnabled=0 + +[Field 1] +Type="Label" +Text="Templates of the Client and Storage resources can be generated that are customized with the information about this system. These templates can then be copied to the Director computer and included in the Director's configuration file." +Left=7 +Right=293 +Top=6 +Bottom=32 + +[Field 2] +Type="CheckBox" +Text="Save Client template in:" +Left=6 +Right=240 +Top=38 +Bottom=48 + +[Field 3] +Type="FileRequest" +State="Client.conf" +Flags= +Filter=Configuration Files|*.conf|All Files|*.* +Left=16 +Right=288 +Top=50 +Bottom=62 + +[Field 4] +Type="CheckBox" +Text="Save Storage template in:" +Left=6 +Right=248 +Top=70 +Bottom=80 + +[Field 5] +Type="FileRequest" +State="Storage.conf" +Flags=REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST +Filter=Configuration Files|*.conf|All Files|*.* +Left=16 +Right=288 +Top=82 +Bottom=94 diff --git a/bacula/src/win32/full_win32_installer/bacula-dir.conf.in b/bacula/src/win32/full_win32_installer/bacula-dir.conf.in new file mode 100644 index 0000000000..6b3fe43a48 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/bacula-dir.conf.in @@ -0,0 +1,380 @@ +# +# Default Bacula Director Configuration file +# +# The only thing that MUST be changed is to add one or more +# file or directory names in the Include directive of the +# FileSet resource. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ @DISTVER@ +# +# You might also want to change the default email address +# from root to your address. See the "mail" and "operator" +# directives in the Messages resource. +# + +Director { # define myself + Name = @director_name@ + DIRport = @director_port@ # where we listen for UA connections + QueryFile = "@bin_dir@\\query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@working_dir@" + Maximum Concurrent Jobs = @director_maxjobs@ + Password = "@director_password@" # Console password + Messages = Daemon +} + +JobDefs { + Name = "DefaultJob" + Type = Backup + Level = Incremental + Client = @client_name@ + FileSet = "Test Set" + Schedule = "WeeklyCycle" + Storage = File + Messages = Standard + Pool = Default + Priority = 10 +} + + +# +# Define the main nightly save backup job +# By default, this job will back up to disk in C:/tmp +Job { + Name = "Client1" + JobDefs = "DefaultJob" + Write Bootstrap = "@working_dir@\\Client1.bsr" +} + +#Job { +# Name = "Client2" +# Client = @client_name@2 +# JobDefs = "DefaultJob" +# Write Bootstrap = "@working_dir@\\Client2.bsr" +#} + +# Backup the catalog database (after the nightly save) +Job { + Name = "BackupCatalog" + JobDefs = "DefaultJob" + Level = Full + FileSet="Catalog" + Schedule = "WeeklyCycleAfterBackup" + # This creates an ASCII copy of the catalog + RunBeforeJob = "\"@bin_dir@\\make_catalog_backup\" bacula bacula" + # This deletes the copy of the catalog + RunAfterJob = "\"@bin_dir@\\delete_catalog_backup\"" + Write Bootstrap = "@working_dir@\\BackupCatalog.bsr" + Priority = 11 # run after main backup +} + +# +# Standard Restore template, to be changed by Console program +# Only one such job is needed for all Jobs/Clients/Storage ... +# +Job { + Name = "RestoreFiles" + Type = Restore + Client=@client_name@ + FileSet="Test Set" + Storage = File + Pool = Default + Messages = Standard + Where = "C:\\tmp\\bacula-restores" +} + +# +# Note: Windows path separators do NOT work correctly in FileSets. +# +# List of files to be backed up +FileSet { + Name = "Test Set" + Include { + Options { + signature = MD5 + ignore case = yes + } +# +# Put your list of files here, preceded by 'File =', one per line +# or include an external list with: +# +# File = (+Y|FC8 zmOZw|Gal!0nw_-c-FyN6M;J?6wOu2tU|-(=h88B z5AY}T*@vv8B%KuzG!o#k% zKlj}qbANtOKV}LkZ4*Tw-zc%MP9o$@0sA|Kxj@Lng0#SQE>^6i{O-h$H1hdtLNYLD z?HYe<_kW)JOcZ~zRA_2mM92-6{fJ@j6Y@CB+xz{6N`75*u~0NFg1t9hba%Xnj*siJ z+5|eR{7UcX>)Z%M^oDzD`3e4f%1SH~|Lqi1$JdSk0w@i9Tb*e2$?DC-+HQ2Bdy^%Q zMl^m3ZXs((U40QZblBqMS-2%EQ^gHJ*Rn$1^9JF^S)uUTo;+bI&sRrY2L+x}-C3rJ z100@ih4^)y`9D9qRkCxtj3}LA*;@?z1tITvxQ2hYNJCbv{SI&&$-gyx@@9Yb4Mp~K zMb`D+%o}}K&uQ2DvKAGY=zMb^_x51ko#B&cw}$d=4(6ia27h8qER8Z~4J#?mpnR?K9^t)W~Dcz3h_4L6jM zft(vy2nKn^Lhut_ys5~(4H`f{ULPyGKUR2;8v&Hu0woxngJSX7gDlg)L3fKThqjyj zIdo~mbX}CBr*NQ51nfMu6ttY%gSqGoG5`+c?;6nfd%W`XgHlb69HKnTvad7DXGGzD`Aa|)ZW1&0kT4(ar&g3iYNw_|zt#nAiE7yC|mwK~qV7)zbgoUoO z>pggq364-q0L~hccqUSQ_2*pg$w1G=o^-s35w7=TF9G(R^lM$Ibn1?zm06xi3GL94 zyi9`vJk7zdOW~T$U2j#V`t%eObVM$_U;kq~OClWe+B)NMH#V1jJly5ua~NI9s1E-w=y- z_8D!yA!fcl=3ITkg~r5-Euu@UQmhoOUuu3X=t#S8<@0f2fY68u`cl>u2Q?)z*ak8^hdYnKKOgF2jJ2{Xdz{eEBq0MyLRAz@lcW!lufD zPob3_KV5p_blFCYK0khnwiDBpAv0CsXKEuk&c>dpi=L~Fn5~YOtBJy*z$Pr=&T#%6 zEP;1h)RN@GSS@s=V43r@f8?w@;!JH6P&(HTccwn(Om*Z;Wf+~h95g(e40I?xK3R5R zsvKm5&DX|&p%+^rMdEW!!ui_h8F@I?a=I)SeL(QK533gg2hrwHbMjA0IO5wp!NiY0_7lPx(Y9b&d7m7FZ116LpCNkPu=xyRc@5_J4Cfvh zD>yb$5;$2Lgyl>Y1&kN^VUUR;|EY=)$SSmQsXvQa70yuL=H_4?>=-};$AQlTeZ~J& zX&^-Xu&a#4DZ2guc54Glab{OQqglP{}|rFjI&kYvsDqe0Wo6*ejslk z#~Y+>xR!xzufZJe(UV8Viu}NFh#&Osd{aD>3!()Uj}{(V9sy)L8;!wiA39X7&q%KC zX#PU8l^U-r4CgsF<) z;gi0KH22<=LtRM+JEcyY(t}+xr>7g9)1Q)@(0Wo1^`#%~&+w$|righe(%kyeTn92e zu_7$td{ZLq25(&u+U&tXI_9SC1&Xm;U&dbZ8OGt8}4;l77mT6YyYv76=MZylm*92#E{S!g$hPabWOP$HZM&p4Ju-(5*}3WIuXBAO|x&q1vN)M+ftcK)OH-D8UGLy;B4z)(^549Ik_H zx5Tz3aeupLe}~AvO|-u+*&bx{rMrz6_yGq<@6En!io;j|aJbr;GG8A{amb=L^d>v@ zBpvKaa|0vhYNFxm5x%bS@y+uUeWhN6e1J5LfJHLr0mD9G*fECvTSD3^QsW=b6)be7 zK%KFQcFDnBiD_k+VNHZ#b%bF}q``Aqb%X)>RE8PMWSTZ7ShXbBvN#ExJJ!0eUUj-?ovhhiZZVf|X< z5&9hcxEfZ58_r~zw~1`qB#u;}QeAsfTsRr9pG-Hepd+B^KN|{u3QC4N(x6Xl)(~q^ z7i}>pGcO4?8c(-w6CZ$9o+=HRZ-_?(%k4_?5aA;nnyw5T&hu@T9vn@xlZTshi%mOa z2cVmNr&Z0dDLH=}k2rO!w z*zsJhsS+{fmhTbaY|$B~*AZis;j7OPKo`Z0&(Dt9GBnJ~->hEogc3lAr@oFG#HlXA zxFO1PM7Amkz!pS;)YVt`8-59R5wD{IZXD;b4I5(2A&~XaW~b61&wv8;Y#;*-BRoCG z>X>+)Z{7k`_YsNCkQk+J;4ehfxjjz5Q(^}fJXsuwxD;B0y%mC3_+qGDo7myPNmEW> zFpG!G+j>0P8T>`GkEnH(kB`q*4pev&@~S{Ez_70}?AJ7(!(3q5$Am1N6vw_Xm4lrQ zB82{AhoT^!co5)9h`Y)bUnONPB_&UyqGO8Wdfl3OD*YeEgill0V8 zF)~;H2H9(92JhMx$GnvMS z8~`!`p85J{ga-(35M%eIxb{h{QjhRj4;=h50{4%k9{?ZEH41O^rrjG`-gmrxp{z11 z5J3*h%rXq}08q)7;VactyHO~al@RvEbRJkwqq}7L!sEPA1%}>at8lw63MoSgIZjB> zcdz&}fcBwfm+l-xy`7Bgd*XBlMEkTDe)&Mgy)M$QOJdWPdI&Kj0(+Q!=q7dn2#wC< zLI^P(?3ME#v+A}Ooz|#*sXn|qD1QSGi zn%UL#OAUKds6HaTMQRk=G~TYhb+)Wk4nBUvFkdjt3?DBSPPt&Vh~( zWPA3??2CdhAPlvuwx(-Wyg_BCX-SY#aiC#I(E5gl#X$zmQTxnxgKJ)pSpA)jeF?ht z;rnW-V}fXbelJaR2Z$mZJ;J|XY}4}nu*stFxx}XA1n9@RmZ8Dj=VzuWj;Qp-?={;6 z!wxaFc>CvndgW4ovER<(00VAzqY{u2i0g7&p~|S_xN+GDlMbnqJV2`|#1O{W+Y&|< z7#a=?yz+-He^%`|xK~*TVrETL!e6;K*q3Bce!?8Dqm_qR&=H<$cwQT2-H~*tE=(73LQAYk*$IFN zgFtc6(XyY)Fm97NBH$T0=?hK7E{SfJq}Ex!STg*$nK*IuRDX9%#0#*%*j6LGgALlM zU48d*QAT_UA%9@mUoh-H2n1CuGsv<}wyHwc9wtQ|dpwp^1_bulw##ph`j8%7b)HQKJg4`SIQ5{@T@{hVl^o{zSc! z$g)#p(Hw747irX*VAm3FSs!ISlL0=$Cb$wMD7)97bYF+at~2SNBEx+k0~_Q+%|iR@ z#jvQr0lM!8YD;~TT7-6B@pM%vHfy&OImq4d`uN_}qLeUXR{xe^-)GtP81@gW;HH2n zVFZ(eER-b%y>>bmi9zh&VOLl9=%TFRqs6$X3tZLJoHf)AYN$Cq-PF|_wHVOpq^#_t z#>TpuyLQFyt`0S*4b$rv0vWg!SY6m&*Qs>9rZ}rsp

|ZBx9>V3L`)6|ao@{_V+= z>mwC;uB0wZzb%G0s@9WJkL3Z3Ja}(SsJ=Wz53M>>|Eb15G^h$Tz@#-{w4u+i7}fxT zn|1X(Qe=6`PwZ@pv&1F>nGHaP%mBm*tvA&L5k5A0*dxFv20H*u_iZ}y#=D$*<98{j zmxp_`D=A;>5LwlR@8bu-D+t@LFQzTk9XS)U{&Za3dXfFW4L5jCvP-+fp>q0u~c&hJgqwNT1kkJpf%N@dcbo?yvNl9VQ|sND zK$ZGv^Y+C30G7|cVSB}=0Y^_BL(B{d-y*bai8HGT!PHLMcL=Rbj`zmDpb+XRQFxvF zk9Q&fZi+Q&7uiD$hH`yq0T)0E8l0>pEK-#W0-1q`8;Xf@0F=u5IMI=;-uZCa6D9u;=`)3&M}RaWud zqT;({i|>}LxE@6itFq-Np*9ozMOf>yYgf#UJ=rNfhAol%5F}vtQ6FJEDuqhIOM>qZ zMYpMx-L(-WHIc>xVq+H*UI_I;{Dsb(B2PhWs8M5tK|>^7L4IDX=FF&dzzmBll9$ z##ER{cnzX-e7PwH5#KpFx^ZZXMw-Ynn@Yz|u&a>XqiNoTU9o#tm9Ylq zdR+_IhbQoioJ#7$GIRIvkC+su?1-^VNsmwm9vN{3P(>_2p9PYA+J~&9{=W1)xE)tvyBNjZs<)yyb2?L z!QGr4<4z@zp1AD;i93fxIzytJgNZtWB6^P-`b4~IShQ;{ZO3t&UE6gt6g`UvY-4-k zcecbMooEl&&?2-MPcySO0LxrBBkU1*(CBL3F3$fNL`C+2{xmxRj??%@WQUv46cY_K zh$!4HG~KOFr~|=(j`zgv>58M*o`k(?uide_^w;>k+;w+-n0{4=!3a&HSScy{C5p#e zBDG=Jur;2kq~RYu)EmshxgHMOfj>?^rz%b$ghn`B7Y!3(r@13GIiaW}RD+AtAPjCH z5sJDP^G=B^lxwz{Cj3!tf@25_vbN!15r5u9Nd_$@$;CwUK&L8fB>!l;)M+Zy%xo7> zMc@jR^pJWOT+G(tgjp{ua|SphTNA`ZgIV5?Hz?zco^+fFtt*E4Y$;UFPjt?DBJ z9)|MqmMlEsXBP{v_hn%JIEZ*P33&iW4&8(A+bgs+4%Ak6(PA98vyPgA16s_1?Odbx z^iMpu*Jjb#{&--`7r*`{CoZWeayL@VIQHsGbwvWdU1U3y1XBr7gsFryI=Y#`BS7P9 zK>Wf)bD6I?vUB_~M~B35AjvYw9=lhlFgjz&2en!2?W~m+W2Gsu;F_f-W2q@vzG?_8 zwzHP_bsJ;5jX6*iy0<=DZ&(68+No=XPE5a39msY{9FRqUkW-H{bP~sZw5SQkM*X=+ z62i3Ne6vex-x>?My5H0yy{~ap?!UEPxSR8j9@De0*Mu2$i0wvB9-Xg?!65WZ5ax~> z1lP3*=~9k~StlV#$1VFu0rN|i{g{xN#=`J7=Sxv*1U?Ss9O(xiPe32xp`1-j z#QMgW9GI9FTtLIk+J+}^jcaNo&=B&EL>#tAIEp%zVQ#$#DhU+> zYw$WEAKMr2{T%&MYzejlJ*h7Aq!`(xG}jJ^!)OY>UN^*7oL1sRuoZ6sgs0o;bDEjd z-(laMxMx_r8+_clH3(CjbXV$>IwCZMH-s6a$MLA9;0o&Q44u5znR=!=3dfE;GW*6T z2(YdDp`v@Y7fU^q`V#0MSoNR&`AJ=zb$g->&dSd=#G~{D8}qwdWg5oWxJ?w_8O=wu zdAVJRB0ihj8JD3;9!|1XX*}~9L6XO(BRc~dL zBQ#j$8x2`$;Hs?R#l_N|#)e66z4<=qDLEo&6WN1_$T%T5#92J@5*_dkGC%}&gYWJv zb7FLG5uK+ye-kkEkqj28zWT*vVZ{+vv=aI%02a#vFF*47Ty&b$L$!CfCUFsRQxeZ`B60-iK0#bs(~CA)R6Z$&>9pn zEq0}ysf)o0X2L78x7P80c5I)->sQh z4Mq4HhzfWOnOW#c$1A5w0u>pDJH>V#iNJx67Ccxsc=7ThP&i(nQx%|%Y%?k%=4zwi z8L2X^(7ATx&+q1KV``ODuxG^P5f&9$9n>LL5OT9JujuV_`6w%bF&`^D)}QLqD}kGU z%p5`b)X+57$u(DNhg4lFPJKICyvFu84Q*WG)wSbUtr%7H2(6tWr^Ds5mp(n;o?Lxm zCpN;!A0iWuv;JuWY+y~2%c)Fr^W9KMxV*!*7Re7EzWdcT|54ydJp!r-uuPohpcn(y zFHlUJ#GTDG*3m?I!IvlnYwZ+k>qyw`ag0_RuAt%Dt9HEFwir$A1be57hcCbX>DT{S zA`w;xYL3ywCR8cn^|!u;UBx~Q59*rA zM;hvDgVaZ57z9aX|LeCuZVA_f(VHv{#2Gzger*i77U$J_s_$I=AquE2wM%h)jJgr1 z^t z%^}=;d&QqqJT_+7LbzLI{q-s>7b3BngTG6-F}lbf%Ha+tOyA^&v9{Zt7(MJnar+(luAt!&WYl zUI7hdg)dz`T^qKyF3O}S#=IiLDDsd~d8l1avLklxQLZ5_g?h9A*-LC9 zKqSPeKV`qf(=yh}70K16So5Y>v-(Km1ExN;QC1ydTWklA*`}xY{n@JpGfzXk`h?B` zl^jADQW{lB;E>_oE^?gBGTgEiICv8hm6dm~Lu%6;YobUy3>>iWM1dtArml-{_+dX> zD0FpB$G15Q3%3YmM8Gq|Ft>=(f7f{-^Y;%+pvViIsYvJ{3xQ&l!BpGPRP#ZZX}`=^ zAvGM38VyK|pKkq9qkf6epwy^4(Xctj1cffh0ORN%@ixvGQCmeTPpZS=R$w$*6YXcR z45eOHA}^=r=siu5`rS!1Hv%C92eBPMpbpkUF(JC(FIcaT*^H)`4}b;hx;4-IXDW0 zzMv|pEBVl1n!Q45hOil16$IPuiNL|6CBd>MpHx0V=j*lO;G*jfD{6 za2yrOKnZ~a_Gnlawq1~@b_u4i=WAWoQ?iCU9D#vgq-AI^71y|uCnuy+;Pj^}gHeNu zAZIzwT(MWc8QTX$m8j^0_zmWI!w=Gfm=qTbf*X28%}lB*CvVt(3gJ&_!gI}@ZXMKX z|D>@HqT-=kibErgjDxXr!QgH1CdoFyp;ctpo#KL&IB-CLC6<4yKL@P8H@QI>IY$2F zVquUwBF_&5%tr$HWd}|n=NP7)W#@^~|1sQqpdtBSb(SzSPIj{^bh_&3h3bGFuHX$z zprsdF>DRg|p7Raf2XQH)Q=FGUo6a>S@O3zV2mu=u4Y4|`3LGVRA~dDdFKLJ22PcaI zupL7Q3L*!T(xHAEH4Hc<=l15o69s+)IX>9gA&BKCT1No?CnXP*q#aUZxFN5IVNrdD zJSr_gL^WfLcOASy{vWDbbdnnda%QF+))E7s;}A`qBiuZQ#bRL#Q`T)D5XP8SQ0oVkDxg8W$-oR zYX@0-|JM1cmLh~Mj~V7y3=6HC2NN0QO;%8)q5cz;=pb+<s(2LEf*u6kU?oCCY@87jVtWf0fWoTb zTwerKs8EIGB7cRHKA1>LI_ZZV=%0aD9W?_}m0PJ>CGt%*c`yv2l2aen%qXC*eRSl5+SDOia@Xetm+$@BrUPS3E@LyBV%i}|5T#hQUVfvtz@YHzgTvHsqHsYFqn+r`s zq-0V0jtGR3x=|##4)E1Kc|PJT)EgtT9JO^=(Kya63kSFg|Q++{GLoN`!iQLZPdva`N0zLQt%Rl|E=p$}-6jDej zUt_=VwGH1dpaNgQMKwu~C}<*dkbaee9TxZT0$svD4ib-G4S)hBw6)+<4k@66!J!-T zF>3D6AAtwmJ`d*NLlxk5xh)CZFg{1dvngp4Bk7I7LB?f#bc1hdxTxuBCqAo5!KXSX z0R2jd)A*+g<)L> zFa$ADU!5&q7>Oceie*1w1Rn|n|DmCNOlw%(_jSqK|o5Rmrd^?e;C%aejyq|xxP%n-iR1D%<0(>L*%7(N_R&`ijn4d9f zuWM^ps8>aP$2*JT(ix)_L(%**`u`A*6*? z&9NT~1o+n;E(-(~G&Jw1Y<{HyZ7X?f&`Q(ob&|e7KPL>5a;du9tqWSoqy~*b!l6eUINt3gq?V}sf{-VKTp}c0Lt~N< zJx|wdp@9c&?1OQRBiM=rdjozVq!HyMn(PUEy;6f+zIM(@Me$zmT&&#G${)gr|CBy( zaIei*e|e|;v)eTv-H?BFyZ+1j6<^#c94_%pjXb8Ojicmkgv{WpbC_AwDiiWCAzu=5 zN@Yup8uMhU+BaLa{7O}IK~3#9@T5o^a7m#uC1TTC68HFA)qe_+n}hrX2vB2qs`T;s z>i4e7zkJa6_1%j4Y?q@h!Qr0A4%+8%s)vJMB=?#Ki6dl)kT9IQ;9ti&aL{9*H1KkZ z|E;OY-@V-M%524E6!aJ1|6lP6=io|zda?S$>s9YBR(*V<__r_T|L&puH!oHH@loN6 z^Q9MiGVafm{{2tNfBQ22jV$@&^Odj7S3R1+Mr?h; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/full_win32_installer/storage.conf.in b/bacula/src/win32/full_win32_installer/storage.conf.in new file mode 100644 index 0000000000..5928815c5c --- /dev/null +++ b/bacula/src/win32/full_win32_installer/storage.conf.in @@ -0,0 +1,10 @@ +# Definition of file storage device +Storage { + Name = File +# Do not use "localhost" here + Address = @storage_address@ # N.B. Use a fully qualified name here + SDPort = @storage_port@ + Password = "@storage_password@" + Device = FileStorage + Media Type = File +} diff --git a/bacula/src/win32/full_win32_installer/winbacula.nsi b/bacula/src/win32/full_win32_installer/winbacula.nsi new file mode 100644 index 0000000000..700dff6316 --- /dev/null +++ b/bacula/src/win32/full_win32_installer/winbacula.nsi @@ -0,0 +1,1466 @@ +; winbacula.nsi +; +; Began as a version written by Michel Meyers (michel@tcnnet.dyndns.org) +; +; Adapted by Kern Sibbald for native Win32 Bacula +; added a number of elements from Christopher Hull's installer +; +; D. Scott Barninger Nov 13 2004 +; added configuration editing for bconsole.conf and bwx-console.conf +; better explanation in dialog boxes for editing config files +; added Start Menu items +; fix uninstall of config files to do all not just bacula-fd.conf +; +; D. Scott Barninger Dec 05 2004 +; added specification of default permissions for bacula-fd.conf +; - thanks to Jamie Ffolliott for pointing me at cacls +; added removal of working-dir files if user selects to remove config +; uninstall is now 100% clean +; +; D. Scott Barninger Apr 17 2005 +; 1.36.3 release docs update +; add pdf manual and menu shortcut +; +; Robert Nelson May 15 2006 +; Added server installs and implemented Microsoft install locations +; Use LogicLib.nsh +; Added Bacula-SD and Bacula-DIR +; Replaced ParameterGiven with standard GetOptions +; +; Command line options: +; +; /service - +; /start +; +; netsh firewall add portopening protocol=tcp port=9102 name="Bacula-FD" + + +!define PRODUCT "Bacula" + +; +; Include the Modern UI +; + +!include "MUI.nsh" +!include "LogicLib.nsh" +!include "FileFunc.nsh" +!include "Sections.nsh" +!include "StrFunc.nsh" +!include "WinMessages.nsh" +; +; Basics +; +Name "Bacula" +OutFile "${OUT_DIR}\winbacula-${VERSION}.exe" +SetCompressor lzma +InstallDir "$PROGRAMFILES\Bacula" +InstallDirRegKey HKLM "Software\Bacula" "InstallLocation" + +InstType "Client" +InstType "Server" +InstType "Full" + +!insertmacro GetParent + +${StrCase} +${StrRep} +${StrTok} +${StrTrimNewLines} + +; +; Pull in pages +; + +!define MUI_COMPONENTSPAGE_SMALLDESC + +!define MUI_HEADERIMAGE +!define MUI_BGCOLOR 739AB9 +!define MUI_HEADERIMAGE_BITMAP "bacula-logo.bmp" + +!InsertMacro MUI_PAGE_WELCOME +!InsertMacro MUI_PAGE_LICENSE "..\..\..\LICENSE" +Page custom EnterInstallType +!define MUI_PAGE_CUSTOMFUNCTION_SHOW PageComponentsShow +!InsertMacro MUI_PAGE_COMPONENTS +!define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre +!InsertMacro MUI_PAGE_DIRECTORY +Page custom EnterConfigPage1 LeaveConfigPage1 +Page custom EnterConfigPage2 LeaveConfigPage2 +!Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage +!InsertMacro MUI_PAGE_INSTFILES +Page custom EnterWriteTemplates +!Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt +!InsertMacro MUI_PAGE_FINISH + +!InsertMacro MUI_UNPAGE_WELCOME +!InsertMacro MUI_UNPAGE_CONFIRM +!InsertMacro MUI_UNPAGE_INSTFILES +!InsertMacro MUI_UNPAGE_FINISH + +!define MUI_ABORTWARNING + +!InsertMacro MUI_LANGUAGE "English" + +!InsertMacro GetParameters +!InsertMacro GetOptions + +DirText "Setup will install Bacula ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder." + +!InsertMacro MUI_RESERVEFILE_INSTALLOPTIONS +; +; Global Variables +; +Var OptService +Var OptStart +Var OptSilent + +Var CommonFilesDone + +Var OsIsNT + +Var HostName + +Var ConfigClientName +Var ConfigClientPort +Var ConfigClientMaxJobs +Var ConfigClientPassword +Var ConfigClientInstallService +Var ConfigClientStartService + +Var ConfigStorageName +Var ConfigStoragePort +Var ConfigStorageMaxJobs +Var ConfigStoragePassword +Var ConfigStorageInstallService +Var ConfigStorageStartService + +Var ConfigDirectorName +Var ConfigDirectorPort +Var ConfigDirectorMaxJobs +Var ConfigDirectorPassword +Var ConfigDirectorAddress +Var ConfigDirectorMailServer +Var ConfigDirectorMailAddress +Var ConfigDirectorDB +Var ConfigDirectorInstallService +Var ConfigDirectorStartService + +Var ConfigMonitorName +Var ConfigMonitorPassword + +Var LocalDirectorPassword +Var LocalHostAddress + +Var MySQLPath +Var MySQLVersion +Var PostgreSQLPath +Var PostgreSQLVersion + +Var AutomaticInstall +Var InstallType +!define NewInstall 0 +!define UpgradeInstall 1 +!define MigrateInstall 2 + +Var OldInstallDir +Var PreviousComponents +Var NewComponents + +; Bit 0 = File Service +; 1 = Storage Service +; 2 = Director Service +; 3 = Command Console +; 4 = Bat Console +; 5 = wxWidgets Console +; 7 = Documentation (PDF) +; 7 = Documentation (HTML) + +!define ComponentFile 1 +!define ComponentStorage 2 +!define ComponentDirector 4 +!define ComponentTextConsole 8 +!define ComponentBatConsole 16 +!define ComponentGUIConsole 32 +!define ComponentPDFDocs 64 +!define ComponentHTMLDocs 128 + +!define ComponentsRequiringUserConfig 63 +!define ComponentsFileAndStorage 3 +!define ComponentsFileAndStorageAndDirector 7 +!define ComponentsDirectorAndTextGuiConsoles 60 +!define ComponentsTextAndGuiConsoles 56 + +Var HDLG +Var HCTL + +Function .onInit + Push $R0 + Push $R1 + + ; Process Command Line Options + StrCpy $OptService 1 + StrCpy $OptStart 1 + StrCpy $OptSilent 0 + StrCpy $CommonFilesDone 0 + StrCpy $OsIsNT 0 + StrCpy $AutomaticInstall 0 + StrCpy $InstallType ${NewInstall} + StrCpy $OldInstallDir "" + StrCpy $PreviousComponents 0 + StrCpy $NewComponents 0 + StrCpy $MySQLPath "" + StrCpy $MySQLVersion "" + StrCpy $PostgreSQLPath "" + StrCpy $PostgreSQLVersion "" + + ${GetParameters} $R0 + + ClearErrors + ${GetOptions} $R0 "/noservice" $R1 + IfErrors +2 + StrCpy $OptService 0 + + ClearErrors + ${GetOptions} $R0 "/nostart" $R1 + IfErrors +2 + StrCpy $OptStart 0 + + IfSilent 0 +2 + StrCpy $OptSilent 1 + + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + ${If} $R0 != "" + StrCpy $OsIsNT 1 + ${EndIf} + + Call GetComputerName + Pop $HostName + + Call GetHostName + Pop $LocalHostAddress + + Call GetUserName + Pop $ConfigDirectorMailAddress + + Call FindDatabaseApps + + ; Configuration Defaults + + StrCpy $ConfigClientName "$HostName-fd" + StrCpy $ConfigClientPort 9102 + StrCpy $ConfigClientMaxJobs 5 + ;StrCpy $ConfigClientPassword + StrCpy $ConfigClientInstallService "$OptService" + StrCpy $ConfigClientStartService "$OptStart" + + StrCpy $ConfigStorageName "$HostName-sd" + StrCpy $ConfigStoragePort 9103 + StrCpy $ConfigStorageMaxJobs 10 + ;StrCpy $ConfigStoragePassword + StrCpy $ConfigStorageInstallService "$OptService" + StrCpy $ConfigStorageStartService "$OptStart" + + ;StrCpy $ConfigDirectorName "$HostName-dir" + StrCpy $ConfigDirectorPort 9101 + StrCpy $ConfigDirectorMaxJobs 1 + ;StrCpy $ConfigDirectorPassword + StrCpy $ConfigDirectorDB 0 + StrCpy $ConfigDirectorInstallService "$OptService" + StrCpy $ConfigDirectorStartService "$OptStart" + + StrCpy $ConfigMonitorName "$HostName-mon" + ;StrCpy $ConfigMonitorPassword + + InitPluginsDir + File "/oname=$PLUGINSDIR\openssl.exe" "${SRC_DIR}\openssl.exe" + File "/oname=$PLUGINSDIR\libeay32.dll" "${SRC_DIR}\libeay32.dll" + File "/oname=$PLUGINSDIR\ssleay32.dll" "${SRC_DIR}\ssleay32.dll" + File "/oname=$PLUGINSDIR\sed.exe" "${SRC_DIR}\sed.exe" + + !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini" + !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini" + + SetPluginUnload alwaysoff + + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigClientPassword $R0 + FileClose $R1 + ${EndIf} + + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigStoragePassword $R0 + FileClose $R1 + ${EndIf} + + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $LocalDirectorPassword $R0 + FileClose $R1 + ${EndIf} + + SetPluginUnload manual + + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigMonitorPassword $R0 + FileClose $R1 + ${EndIf} + + Pop $R1 + Pop $R0 +FunctionEnd + +Function .onSelChange + Call UpdateComponentUI +FunctionEnd + +Function InstallCommonFiles + ${If} $CommonFilesDone = 0 + SetOutPath "$INSTDIR" + File "Readme.txt" + + SetOutPath "$INSTDIR\bin" +!if "${BUILD_TOOLS}" == "VC8" + File "${SRC_DIR}\msvcm80.dll" + File "${SRC_DIR}\msvcp80.dll" + File "${SRC_DIR}\msvcr80.dll" + File "${SRC_DIR}\Microsoft.VC80.CRT.manifest" + File "${SRC_DIR}\pthreadVCE.dll" +!endif +!if "${BUILD_TOOLS}" == "VC8_DEBUG" + File "${SRC_DIR}\msvcm80.dll" + File "${SRC_DIR}\msvcp80.dll" + File "${SRC_DIR}\msvcr80.dll" + File "${SRC_DIR}\Microsoft.VC80.CRT.manifest" + File "${SRC_DIR}\msvcm80d.dll" + File "${SRC_DIR}\msvcp80d.dll" + File "${SRC_DIR}\msvcr80d.dll" + File "${SRC_DIR}\Microsoft.VC80.DebugCRT.manifest" + File "${SRC_DIR}\pthreadVCE.dll" +!endif +!if "${BUILD_TOOLS}" == "MinGW" + File "${SRC_DIR}\mingwm10.dll" + File "${SRC_DIR}\pthreadGCE.dll" +!endif + File "${SRC_DIR}\libeay32.dll" + File "${SRC_DIR}\ssleay32.dll" + File "${SRC_DIR}\zlib1.dll" +!if "${BUILD_TOOLS}" == "VC8" + File "${SRC_DIR}\zlib1.dll.manifest" +!endif +!If "${BUILD_TOOLS}" == "VC8_DEBUG" + File "${SRC_DIR}\zlib1.dll.manifest" +!endif + File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf" + File "${SRC_DIR}\openssl.exe" + File "${SRC_DIR}\bsleep.exe" + File "${SRC_DIR}\bsmtp.exe" + File "${SRC_DIR}\bacula.dll" + File "${SRC_DIR}\expr64.exe" + File "${SRC_DIR}\snooze.exe" + + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"' + + StrCpy $CommonFilesDone 1 + ${EndIf} +FunctionEnd + +Section "-Initialize" + ${If} $MySQLPath != "" + DetailPrint "Found MySQL (version $MySQLVersion)" + ${EndIf} + ${If} $PostgreSQLPath != "" + DetailPrint "Found PostgreSQL (version $PostgreSQLVersion)" + ${EndIf} + + WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR" + + Call GetSelectedComponents + Pop $R2 + WriteRegDWORD HKLM Software\Bacula Components $R2 + + WriteRegDWORD HKLM Software\Bacula Database $ConfigDirectorDB + + ; remove start menu items + SetShellVarContext all + + Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*" + Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*" + Delete /REBOOTOK "$SMPROGRAMS\Bacula\*" + RMDir "$SMPROGRAMS\Bacula\Configuration" + RMDir "$SMPROGRAMS\Bacula\Documentation" + RMDir "$SMPROGRAMS\Bacula" + CreateDirectory "$SMPROGRAMS\Bacula" + CreateDirectory "$SMPROGRAMS\Bacula\Configuration" + CreateDirectory "$SMPROGRAMS\Bacula\Documentation" + + CreateDirectory "$INSTDIR" + CreateDirectory "$INSTDIR\bin" + CreateDirectory "$APPDATA\Bacula" + CreateDirectory "$APPDATA\Bacula\Work" + CreateDirectory "$APPDATA\Bacula\Spool" + + SetOutPath "$INSTDIR" + File "..\..\..\LICENSE" + Delete /REBOOTOK "$INSTDIR\bin\License.txt" + + FileOpen $R1 $PLUGINSDIR\config.sed w + 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" +!Else + StrCpy $R2 "MVS" +!EndIf + + Call GetHostName + Exch $R3 + Pop $R3 + + FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n" + + ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\\\" + FileWrite $R1 's;@working_dir@;$R2;g$\r$\n' + ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\" + FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n' + + ${StrRep} $R2 "$INSTDIR\bin" "\" "\\\\" + 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\bin\fdplugins" "\" "\\\\" + FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n' + + ${StrRep} $R2 "$INSTDIR" "\" "/" + FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n" + + Call IsDirectorSelected + Pop $R2 + ${If} $R2 = 1 + FileWrite $R1 "s;@director_address@;$LocalHostAddress;g$\r$\n" + ${Else} + ${If} "$ConfigDirectorAddress" != "" + FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n" + ${EndIf} + ${EndIf} + + 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;g$\r$\n" + ${EndIf} + ${If} "$ConfigClientPort" != "" + FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n" + ${EndIf} + ${If} "$ConfigClientMaxJobs" != "" + FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n" + ${EndIf} + ${If} "$ConfigClientPassword" != "" + FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n" + ${EndIf} + ${If} "$ConfigStorageName" != "" + FileWrite $R1 "s;@storage_name@;$ConfigStorageName;g$\r$\n" + ${EndIf} + ${If} "$ConfigStoragePort" != "" + FileWrite $R1 "s;@storage_port@;$ConfigStoragePort;g$\r$\n" + ${EndIf} + ${If} "$ConfigStorageMaxJobs" != "" + FileWrite $R1 "s;@storage_maxjobs@;$ConfigStorageMaxJobs;g$\r$\n" + ${EndIf} + ${If} "$ConfigStoragePassword" != "" + FileWrite $R1 "s;@storage_password@;$ConfigStoragePassword;g$\r$\n" + ${EndIf} + ${If} "$ConfigDirectorName" != "" + FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n" + ${EndIf} + ${If} "$ConfigDirectorPort" != "" + FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n" + ${EndIf} + ${If} "$ConfigDirectorMaxJobs" != "" + FileWrite $R1 "s;@director_maxjobs@;$ConfigDirectorMaxJobs;g$\r$\n" + ${EndIf} + ${If} "$ConfigDirectorPassword" != "" + FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n" + ${EndIf} + ${If} "$ConfigDirectorMailServer" != "" + FileWrite $R1 "s;@smtp_host@;$ConfigDirectorMailServer;g$\r$\n" + ${EndIf} + ${If} "$ConfigDirectorMailAddress" != "" + FileWrite $R1 "s;@job_email@;$ConfigDirectorMailAddress;g$\r$\n" + ${EndIf} + ${If} "$ConfigMonitorName" != "" + FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n" + ${EndIf} + ${If} "$ConfigMonitorPassword" != "" + 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;g$\r$\n" + ${EndIf} + ${ElseIf} $ConfigDirectorDB = 2 + ${If} $PostgreSQLPath != "" + ${StrRep} $R2 "$PostgreSQLPath\bin" "\" "\\" + FileWrite $R1 "s;@SQL_BINDIR@;$R2;g$\r$\n" + ${EndIf} + ${EndIf} + + FileClose $R1 + + ${If} $InstallType = ${MigrateInstall} + FileOpen $R1 $PLUGINSDIR\migrate.sed w + ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\\\" + FileWrite $R1 's;\(Working *Directory *= *\)[^ ][^ ]*.*$$;\1"$R2";$\r$\n' + FileWrite $R1 's;\(Pid *Directory *= *\)[^ ][^ ]*.*$$;\1"$R2";$\r$\n' + FileClose $R1 + ${EndIf} + + ${If} ${FileExists} "$OldInstallDir\bin\bacula-fd.exe" + 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" /kill' ; Shutdown any bacula that could be running + Sleep 3000 + 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" /kill' ; Shutdown any bacula that could be running + Sleep 3000 + nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /remove' ; Remove existing service + ${EndIf} + +SectionEnd + +SectionGroup "Client" SecGroupClient + +Section "File Service" SecFileDaemon + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\bin\fdplugins" + File "${SRC_DIR}\exchange-fd.dll" + + SetOutPath "$INSTDIR\bin" + + File "${SRC_DIR}\bacula-fd.exe" + + ${If} $InstallType = ${MigrateInstall} + ${AndIf} ${FileExists} "$OldInstallDir\bin\bacula-fd.conf" + CopyFiles "$OldInstallDir\bin\bacula-fd.conf" "$APPDATA\Bacula" + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\migrate.sed" -i.bak "$APPDATA\Bacula\bacula-fd.conf"' + ${Else} + File "/oname=$PLUGINSDIR\bacula-fd.conf" "bacula-fd.conf.in" + + StrCpy $0 "$APPDATA\Bacula" + StrCpy $1 bacula-fd.conf + Call ConfigEditAndCopy + ${EndIf} + + StrCpy $0 bacula-fd + StrCpy $1 "File Service" + StrCpy $2 $ConfigClientInstallService + StrCpy $3 $ConfigClientStartService + + Call InstallDaemon + + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-fd.conf"' +SectionEnd + +SectionGroupEnd + +SectionGroup "Server" SecGroupServer + +Section "Storage Service" SecStorageDaemon + SectionIn 2 3 + + SetOutPath "$INSTDIR\bin" + + File "${SRC_DIR}\loaderinfo.exe" + File "${SRC_DIR}\mt.exe" + File "${SRC_DIR}\mtx.exe" + File "${SRC_DIR}\scsitape.exe" + File "${SRC_DIR}\tapeinfo.exe" + File "${SRC_DIR}\bacula-sd.exe" + File "${SRC_DIR}\bcopy.exe" + File "${SRC_DIR}\bextract.exe" + File "${SRC_DIR}\bls.exe" + File "${SRC_DIR}\bscan.exe" + File "${SRC_DIR}\btape.exe" + File "${SRC_DIR}\scsilist.exe" + File "${SRC_DIR}\mkisofs.exe" + File "${SRC_DIR}\growisofs.exe" + File "${SRC_DIR}\dvd-ram-control.exe" + File "${SRC_DIR}\dvd+rw-booktype.exe" + File "${SRC_DIR}\dvd+rw-format.exe" + File "${SRC_DIR}\dvd+rw-mediainfo.exe" + + File "/oname=$PLUGINSDIR\mtx-changer.cmd" "${SRC_DIR}\mtx-changer.cmd" + + StrCpy $0 "$INSTDIR\bin" + StrCpy $1 mtx-changer.cmd + Call ConfigEditAndCopy + + File "/oname=$PLUGINSDIR\disk-changer.cmd" "${SRC_DIR}\disk-changer.cmd" + + StrCpy $0 "$INSTDIR\bin" + StrCpy $1 disk-changer.cmd + Call ConfigEditAndCopy + + File "/oname=$PLUGINSDIR\dvd-handler.cmd" "${SRC_DIR}\dvd-handler.cmd" + + StrCpy $0 "$INSTDIR\bin" + StrCpy $1 dvd-handler.cmd + Call ConfigEditAndCopy + + File "/oname=$PLUGINSDIR\bacula-sd.conf" "bacula-sd.conf.in" + + StrCpy $0 "$APPDATA\Bacula" + StrCpy $1 bacula-sd.conf + Call ConfigEditAndCopy + + StrCpy $0 bacula-sd + StrCpy $1 "Storage Service" + StrCpy $2 $ConfigStorageInstallService + StrCpy $3 $ConfigStorageStartService + Call InstallDaemon + + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\List Devices.lnk" "$INSTDIR\bin\scsilist.exe" "/pause" + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Storage Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-sd.conf"' +SectionEnd + +Section "Director Service" SecDirectorDaemon + SectionIn 2 3 + + SetOutPath "$INSTDIR\bin" + + ${If} $ConfigDirectorDB = 1 + File /oname=bacula_cats.dll "${SRC_DIR}\cats_mysql.dll" + File "${SRC_DIR}\libmysql.dll" + File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_mysql_database.cmd + File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_mysql_database.cmd + File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_mysql_tables.cmd + File ${SRC_DIR}\make_mysql_tables.sql + File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_mysql_tables.cmd + File ${SRC_DIR}\drop_mysql_tables.sql + File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_mysql_privileges.cmd + File ${SRC_DIR}\grant_mysql_privileges.sql + File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_mysql_catalog_backup.cmd + ${ElseIf} $ConfigDirectorDB = 2 + File /oname=bacula_cats.dll "${SRC_DIR}\cats_postgresql.dll" + File "${SRC_DIR}\libpq.dll" +!if "${BUILD_TOOLS}" == "VC8" + File "${SRC_DIR}\comerr32.dll" + File "${SRC_DIR}\libintl-2.dll" + File "${SRC_DIR}\libiconv-2.dll" + File "${SRC_DIR}\krb5_32.dll" +!endif +!If "${BUILD_TOOLS}" == "VC8_DEBUG" + File "${SRC_DIR}\comerr32.dll" + File "${SRC_DIR}\libintl-2.dll" + File "${SRC_DIR}\libiconv-2.dll" + File "${SRC_DIR}\krb5_32.dll" +!endif + File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_postgresql_database.cmd + File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_postgresql_database.cmd + File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_postgresql_tables.cmd + File ${SRC_DIR}\create_postgresql_database.sql + File ${SRC_DIR}\make_postgresql_tables.sql + File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_postgresql_tables.cmd + File ${SRC_DIR}\drop_postgresql_tables.sql + File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_postgresql_privileges.cmd + File ${SRC_DIR}\grant_postgresql_privileges.sql + File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_postgresql_catalog_backup.cmd + ${ElseIf} $ConfigDirectorDB = 3 + File "${SRC_DIR}\sqlite3.exe" +!if "${BUILD_TOOLS}" == "VC8" + File "${SRC_DIR}\sqlite3.exe.manifest" +!endif +!If "${BUILD_TOOLS}" == "VC8_DEBUG" + File "${SRC_DIR}\sqlite3.exe.manifest" +!endif + File /oname=bacula_cats.dll "${SRC_DIR}\cats_sqlite3.dll" + File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_sqlite3_database.cmd + File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_sqlite3_database.cmd + File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_sqlite3_tables.cmd + File ${SRC_DIR}\make_sqlite3_tables.sql + File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_sqlite3_tables.cmd + File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_sqlite3_privileges.cmd + File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_sqlite3_catalog_backup.cmd + ${EndIf} + + File "${SRC_DIR}\bacula-dir.exe" + File "${SRC_DIR}\dbcheck.exe" + + File "/oname=$PLUGINSDIR\delete_catalog_backup.cmd" "${SRC_DIR}\delete_catalog_backup.cmd" + + StrCpy $0 "$INSTDIR\bin" + + StrCpy $1 create_database.cmd + Call ConfigEditAndCopy + + StrCpy $1 drop_database.cmd + Call ConfigEditAndCopy + + StrCpy $1 make_tables.cmd + Call ConfigEditAndCopy + + StrCpy $1 drop_tables.cmd + Call ConfigEditAndCopy + + StrCpy $1 grant_privileges.cmd + Call ConfigEditAndCopy + + StrCpy $1 make_catalog_backup.cmd + Call ConfigEditAndCopy + + StrCpy $1 delete_catalog_backup.cmd + Call ConfigEditAndCopy + + File "${SRC_DIR}\query.sql" + + File "/oname=$PLUGINSDIR\bacula-dir.conf" "bacula-dir.conf.in" + + StrCpy $0 "$APPDATA\Bacula" + StrCpy $1 bacula-dir.conf + Call ConfigEditAndCopy + + StrCpy $0 bacula-dir + StrCpy $1 "Director Service" + StrCpy $2 $ConfigDirectorInstallService + StrCpy $3 $ConfigDirectorStartService + Call InstallDaemon + + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Director Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-dir.conf"' +SectionEnd + +SectionGroupEnd + +SectionGroup "Consoles" SecGroupConsoles + +Section "Command Console" SecConsole + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\bin" + + File "${SRC_DIR}\bconsole.exe" + Call InstallCommonFiles + + ${If} $InstallType = ${MigrateInstall} + ${AndIf} ${FileExists} "$OldInstallDir\bin\bconsole.conf" + CopyFiles "$OldInstallDir\bin\bconsole.conf" "$APPDATA\Bacula" + ${Else} + File "/oname=$PLUGINSDIR\bconsole.conf" "bconsole.conf.in" + StrCpy $0 "$APPDATA\Bacula" + StrCpy $1 bconsole.conf + Call ConfigEditAndCopy + ${EndIf} + + CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bin\bconsole.exe" '-c "$APPDATA\Bacula\bconsole.conf"' "$INSTDIR\bin\bconsole.exe" 0 + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bconsole.conf"' + +SectionEnd + +Section "Bat Console" SecBatConsole + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\bin" + + Call InstallCommonFiles + File "${SRC_DIR}\QtCore4.dll" + File "${SRC_DIR}\QtGui4.dll" + + File "${SRC_DIR}\bat.exe" + + ${If} $InstallType = ${MigrateInstall} + ${AndIf} ${FileExists} "$OldInstallDir\bin\bat.conf" + CopyFiles "$OldInstallDir\bin\bat.conf" "$APPDATA\Bacula" + ${Else} + File "/oname=$PLUGINSDIR\bat.conf" "bat.conf.in" + StrCpy $0 "$APPDATA\Bacula" + StrCpy $1 bat.conf + Call ConfigEditAndCopy + ${EndIf} + + ; Create Start Menu entry + CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bin\bat.exe" '-c "$APPDATA\Bacula\bat.conf"' "$INSTDIR\bin\bat.exe" 0 + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bat.conf"' +SectionEnd + + +Section "Graphical Console" SecWxConsole + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\bin" + + Call InstallCommonFiles +!if "${BUILD_TOOLS}" == "VC8" + File "${SRC_DIR}\wxbase28_vc_bacula.dll" + File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll" +!endif +!If "${BUILD_TOOLS}" == "VC8_DEBUG" + File "${SRC_DIR}\wxbase28_vc_bacula.dll" + File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll" +!endif +!if "${BUILD_TOOLS}" == "MinGW" + File "${SRC_DIR}\wxbase28_gcc_bacula.dll" + File "${SRC_DIR}\wxmsw28_core_gcc_bacula.dll" +!endif + + File "${SRC_DIR}\bwx-console.exe" + + ${If} $InstallType = ${MigrateInstall} + ${AndIf} ${FileExists} "$OldInstallDir\bin\bwx-console.conf" + CopyFiles "$OldInstallDir\bin\bwx-console.conf" "$APPDATA\Bacula" + ${Else} + File "/oname=$PLUGINSDIR\bwx-console.conf" "bwx-console.conf.in" + StrCpy $0 "$APPDATA\Bacula" + StrCpy $1 bwx-console.conf + Call ConfigEditAndCopy + ${EndIf} + + ; Create Start Menu entry + CreateShortCut "$SMPROGRAMS\Bacula\bwx-console.lnk" "$INSTDIR\bin\bwx-console.exe" '-c "$APPDATA\Bacula\bwx-console.conf"' "$INSTDIR\bin\bwx-console.exe" 0 + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Graphical Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bwx-console.conf"' +SectionEnd + +SectionGroupEnd + +SectionGroup "Documentation" SecGroupDocumentation + +Section "Documentation (Acrobat Format)" SecDocPdf + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\doc" + CreateDirectory "$INSTDIR\doc" + + File "${SRC_DIR}\docs\manuals\en\console\console.pdf" + File "${SRC_DIR}\docs\manuals\en\misc\misc.pdf" + File "${SRC_DIR}\docs\manuals\en\main\main.pdf" + File "${SRC_DIR}\docs\manuals\en\utility\utility.pdf" + File "${SRC_DIR}\docs\manuals\en\problems\problems.pdf" + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Console.lnk" '"$INSTDIR\doc\console.pdf"' + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Main.lnk" '"$INSTDIR\doc\main.pdf"' + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Misc.lnk" '"$INSTDIR\doc\misc.pdf"' + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Utility.lnk" '"$INSTDIR\doc\utility.pdf"' + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Problems.lnk" '"$INSTDIR\doc\problems.pdf"' +SectionEnd + +Section "Documentation (HTML Format)" SecDocHtml + SectionIn 3 + + SetOutPath "$INSTDIR\doc" + CreateDirectory "$INSTDIR\doc" + +; File "${SRC_DIR}\manual\bacula\*.html" +; File "${SRC_DIR}\manual\bacula\*.png" +; File "${SRC_DIR}\manual\bacula\*.css" +; CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual (HTML).lnk" '"$INSTDIR\doc\index.html"' +SectionEnd + +SectionGroupEnd + +Section "-Finish" + Push $R0 + + ${If} $OsIsNT = 1 + nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR" /T /G SYSTEM:F Administrators:F' + nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$APPDATA\Bacula" /T /G SYSTEM:F Administrators:F' + ${EndIf} + + ; Write the uninstall keys for Windows & create Start Menu entry + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}" + ${StrTok} $R0 "${VERSION}" "." 0 0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0 + ${StrTok} $R0 "${VERSION}" "." 1 0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1 + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://sourceforge.net/project/showfiles.php?group_id=50727" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.bacula.org" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.bacula.org/?page=support" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"' + WriteUninstaller "$INSTDIR\Uninstall.exe" + CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 + Pop $R0 +SectionEnd + +; Extra Page descriptions + +LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula File Daemon on this system." +LangString DESC_SecStorageDaemon ${LANG_ENGLISH} "Install Bacula Storage Daemon on this system." +LangString DESC_SecDirectorDaemon ${LANG_ENGLISH} "Install Bacula Director Daemon on this system." +LangString DESC_SecConsole ${LANG_ENGLISH} "Install command console program on this system." +LangString DESC_SecBatConsole ${LANG_ENGLISH} "Install Bat graphical console program on this system." +LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install wxWidgets graphical console program on this system." +LangString DESC_SecDocPdf ${LANG_ENGLISH} "Install documentation in Acrobat format on this system." +LangString DESC_SecDocHtml ${LANG_ENGLISH} "Install documentation in HTML format on this system." + +LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration" +LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration." + +LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)" +LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration." + +LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type" +LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type." + +LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates" +LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create resource templates for inclusion in the Director's configuration file." + +!InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN + !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecStorageDaemon} $(DESC_SecStorageDaemon) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecDirectorDaemon} $(DESC_SecDirectorDaemon) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecBatConsole} $(DESC_SecBatConsole) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecDocPdf} $(DESC_SecDocPdf) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecDocHtml} $(DESC_SecDocHtml) +!InsertMacro MUI_FUNCTION_DESCRIPTION_END + +; Uninstall section + +UninstallText "This will uninstall Bacula. Hit next to continue." + +Section "Uninstall" + ; Shutdown any baculum that could be running + 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" /remove' + nsExec::ExecToLog '"$INSTDIR\bin\exchange-fd.dll" /remove' + ${EndIf} + + ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-sd" + ${If} $R0 = 1 + ; Remove bacula service + 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" /remove' + ${EndIf} + + ; remove registry keys + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" + DeleteRegKey HKLM "Software\Bacula" + + ; remove start menu items + SetShellVarContext all + Delete /REBOOTOK "$SMPROGRAMS\Bacula\*" + RMDir "$SMPROGRAMS\Bacula" + + ; remove files and uninstaller (preserving config for now) + Delete /REBOOTOK "$INSTDIR\bin\*" + Delete /REBOOTOK "$INSTDIR\doc\*" + Delete /REBOOTOK "$INSTDIR\*" + + ; Check for existing installation + MessageBox MB_YESNO|MB_ICONQUESTION \ + "Would you like to delete the current configuration files and the working state file?" IDNO NoDel + Delete /REBOOTOK "$APPDATA\Bacula\*" + Delete /REBOOTOK "$APPDATA\Bacula\Work\*" + Delete /REBOOTOK "$APPDATA\Bacula\Spool\*" + Delete /REBOOTOK "$PLUGINSDIR\bacula-*.conf" + Delete /REBOOTOK "$PLUGINSDIR\*console.conf" + Delete /REBOOTOK "$PLUGINSDIR\*conf.in" + Delete /REBOOTOK "$PLUGINSDIR\openssl.exe" + Delete /REBOOTOK "$PLUGINSDIR\libeay32.dll" + Delete /REBOOTOK "$PLUGINSDIR\ssleay32.dll" + Delete /REBOOTOK "$PLUGINSDIR\sed.exe" + Delete /REBOOTOK "$PLUGINSDIR\pw.txt" + Delete /REBOOTOK "$PLUGINSDIR\*.sed" + Delete /REBOOTOK "$PLUGINSDIR\*.cmd" + Delete /REBOOTOK "$PLUGINSDIR\*.sql" + RMDir "$APPDATA\Bacula\Work" + RMDir "$APPDATA\Bacula\Spool" + RMDir "$APPDATA\Bacula" +NoDel: + + ; remove directories used + RMDir "$INSTDIR\bin" + RMDir "$INSTDIR\doc" + RMDir "$INSTDIR" +SectionEnd + +; +; $0 - Service Name (ie Bacula-FD) +; $1 - Service Description (ie Bacula File Daemon) +; $2 - Install as Service +; $3 - Start Service now +; +Function InstallDaemon + Call InstallCommonFiles + + WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2 + + ${If} $2 = 1 + 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? + + ${If} $3 = 1 + ${If} $OsIsNT = 1 + nsExec::ExecToLog 'net start $0' + ${Else} + Exec '"$INSTDIR\bin\$0.exe" -c "$APPDATA\Bacula\$0.conf"' + ${EndIf} + ${EndIf} + ${Else} + CreateShortCut "$SMPROGRAMS\Bacula\Start $1.lnk" "$INSTDIR\bin\$0.exe" '-c "$APPDATA\Bacula\$0.conf"' "$INSTDIR\bin\$0.exe" 0 + ${EndIf} +FunctionEnd + +Function GetComputerName + Push $R0 + Push $R1 + Push $R2 + + System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2" + + ${StrCase} $R0 $R0 "L" + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +!define ComputerNameDnsFullyQualified 3 + +Function GetHostName + Push $R0 + Push $R1 + Push $R2 + + ${If} $OsIsNT = 1 + System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetComputerNameExA failed - LastError = $R2" + Call GetComputerName + Pop $R0 + ${Else} + Pop $R2 + ${EndIf} + ${Else} + Call GetComputerName + Pop $R0 + ${EndIf} + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +!define NameUserPrincipal 8 + +Function GetUserName + Push $R0 + Push $R1 + Push $R2 + + ${If} $OsIsNT = 1 + System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetUserNameExA failed - LastError = $R2" + Pop $R0 + StrCpy $R0 "" + ${Else} + Pop $R2 + ${EndIf} + ${Else} + StrCpy $R0 "" + ${EndIf} + + ${If} $R0 == "" + System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetUserNameA failed - LastError = $R2" + StrCpy $R0 "" + ${Else} + Pop $R2 + ${EndIf} + ${EndIf} + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +Function ConfigEditAndCopy + Push $R1 + + ${If} ${FileExists} "$0\$1" + StrCpy $R1 ".new" + ${Else} + StrCpy $R1 "" + ${EndIf} + + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\$1"' + CopyFiles "$PLUGINSDIR\$1" "$0\$1$R1" + + Pop $R1 +FunctionEnd + +Function FindDatabaseApps + Push $R1 + + ReadRegStr $0 HKLM "Software\MySQL AB\MySQL Server 5.0" "Location" + + ${If} $0 != "" + Call RemoveTrailingSlash + StrCpy $MySQLPath $0 + ReadRegStr $0 HKLM "Software\MySQL AB\MySQL Server 5.0" "Version" + StrCpy $MySQLVersion $0 + ${EndIf} + + EnumRegKey $R1 HKLM "Software\PostgreSQL\Installations" 0 + ${If} $R1 != "" + ReadRegStr $0 HKLM "Software\PostgreSQL\Installations\$R1" "Base Directory" + Call RemoveTrailingSlash + StrCpy $PostgreSQLPath $0 + ReadRegStr $0 HKLM "Software\PostgreSQL\Installations\$R1" "Version" + StrCpy $PostgreSQLVersion $0 + ${EndIf} + + Pop $R1 +FunctionEnd + +Function RemoveTrailingSlash + Push $R1 + StrCpy $R1 $0 "" -1 + ${If} $R1 == "\" + StrCpy $0 $0 -1 + ${EndIf} + Pop $R1 +FunctionEnd + +Function IsDirectorSelected + Push $R0 + SectionGetFlags ${SecDirectorDaemon} $R0 + IntOp $R0 $R0 & ${SF_SELECTED} + Exch $R0 +FunctionEnd + +Function GetSelectedComponents + Push $R0 + StrCpy $R0 0 + ${If} ${SectionIsSelected} ${SecFileDaemon} + IntOp $R0 $R0 | ${ComponentFile} + ${EndIf} + ${If} ${SectionIsSelected} ${SecStorageDaemon} + IntOp $R0 $R0 | ${ComponentStorage} + ${EndIf} + ${If} ${SectionIsSelected} ${SecDirectorDaemon} + IntOp $R0 $R0 | ${ComponentDirector} + ${EndIf} + ${If} ${SectionIsSelected} ${SecConsole} + IntOp $R0 $R0 | ${ComponentTextConsole} + ${EndIf} + ${If} ${SectionIsSelected} ${SecBatConsole} + IntOp $R0 $R0 | ${ComponentBatConsole} + ${EndIf} + ${If} ${SectionIsSelected} ${SecWxConsole} + IntOp $R0 $R0 | ${ComponentGUIConsole} + ${EndIf} + ${If} ${SectionIsSelected} ${SecDocPdf} + IntOp $R0 $R0 | ${ComponentPDFDocs} + ${EndIf} + ${If} ${SectionIsSelected} ${SecDocHtml} + IntOp $R0 $R0 | ${ComponentHTMLDocs} + ${EndIf} + Exch $R0 +FunctionEnd + +Function PageComponentsShow + ${If} $OsIsNT <> 1 + Call DisableServerSections + ${EndIf} + + Call SelectPreviousComponents + Call UpdateComponentUI +FunctionEnd + +Function PageDirectoryPre + ${If} $AutomaticInstall = 1 + ${OrIf} $InstallType = ${UpgradeInstall} + Abort + ${EndIf} +FunctionEnd + +Function LeaveInstallPage + Push "$INSTDIR\install.log" + Call DumpLog +FunctionEnd + +Function EnterWriteTemplates + Push $R0 + Push $R1 + + Call GetSelectedComponents + Pop $R0 + + IntOp $R0 $R0 & ${ComponentDirector} + IntOp $R1 $NewComponents & ${ComponentsFileAndStorage} + + ${If} $R0 <> 0 + ${OrIf} $R1 = 0 + Pop $R1 + Pop $R0 + Abort + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 = 0 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED + DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED + ${Else} + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 1 + DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "C:\$ConfigClientName.conf" + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 = 0 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 0 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags DISABLED + DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED + ${Else} + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 1 + DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State "C:\$ConfigStorageName.conf" + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST + ${EndIf} + + !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)" + !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini" + + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State + ${If} $R0 <> 0 + File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in" + + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"' + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State + ${If} $R0 != "" + CopyFiles "$PLUGINSDIR\client.conf.in" "$R0" + ${EndIf} + ${EndIf} + + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 4" State + ${If} $R0 <> 0 + File "/oname=$PLUGINSDIR\storage.conf.in" "storage.conf.in" + + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\storage.conf.in"' + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 5" State + ${If} $R0 != "" + CopyFiles "$PLUGINSDIR\storage.conf.in" "$R0" + ${EndIf} + ${EndIf} + + Pop $R1 + Pop $R0 +FunctionEnd + +Function SelectPreviousComponents + ${If} $InstallType <> ${NewInstall} + IntOp $R1 $PreviousComponents & ${ComponentFile} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecFileDaemon} + !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecFileDaemon} + !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentStorage} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecStorageDaemon} + !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecStorageDaemon} + !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentDirector} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecDirectorDaemon} + !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecDirectorDaemon} + !InsertMacro ClearSectionFlag ${SecDirectorDaemon} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentTextConsole} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecConsole} + !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecConsole} + !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentBatConsole} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecBatConsole} + !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecBatConsole} + !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentGUIConsole} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecWxConsole} + !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecWxConsole} + !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentPDFDocs} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecDocPdf} + !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecDocPdf} + !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentHTMLDocs} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecDocHtml} + !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecDocHtml} + !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_RO} + ${EndIf} + ${EndIf} +FunctionEnd + +Function DisableServerSections + !InsertMacro UnselectSection ${SecGroupServer} + !InsertMacro SetSectionFlag ${SecGroupServer} ${SF_RO} + !InsertMacro UnselectSection ${SecStorageDaemon} + !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO} + !InsertMacro UnselectSection ${SecDirectorDaemon} + !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO} +FunctionEnd + +Function UpdateComponentUI + Push $R0 + Push $R1 + + Call GetSelectedComponents + Pop $R0 + + IntOp $R1 $R0 ^ $PreviousComponents + IntOp $NewComponents $R0 & $R1 + + ${If} $InstallType <> ${NewInstall} + IntOp $R1 $NewComponents & ${ComponentFile} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentStorage} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentDirector} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecDirectorDaemon} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentTextConsole} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentBatConsole} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentGUIConsole} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentPDFDocs} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentHTMLDocs} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_BOLD} + ${EndIf} + ${EndIf} + + GetDlgItem $R0 $HWNDPARENT 1 + + IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig} + ${If} $R1 = 0 + SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install" + ${Else} + SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >" + ${EndIf} + + Pop $R1 + Pop $R0 +FunctionEnd + +!include "InstallType.nsh" +!include "ConfigPage1.nsh" +!include "ConfigPage2.nsh" +!include "DumpLog.nsh" diff --git a/bacula/src/win32/lib/Makefile b/bacula/src/win32/lib/Makefile new file mode 100644 index 0000000000..eb43e420bf --- /dev/null +++ b/bacula/src/win32/lib/Makefile @@ -0,0 +1,181 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written by Robert Nelson, June 2006 +# + +include ../Makefile.inc + +INCLUDES = \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_OPENSSL) + +DEFINES = \ + $(HAVES) + +vpath %.c $(BUILDDIR)/compat $(MAINDIR)/src/findlib $(MAINDIR)/src/lib +vpath %.cpp $(BUILDDIR)/compat $(MAINDIR)/src/findlib $(MAINDIR)/src/lib + +###################################################################### + +# Files files in src/lib + +COMPAT_OBJS = \ + $(OBJDIR)/compat.o \ + $(OBJDIR)/print.o \ + $(OBJDIR)/winapi.o + +# $(OBJDIR)/getopt.o \ + +FIND_OBJS = \ + $(OBJDIR)/attribs.o \ + $(OBJDIR)/bfile.o \ + $(OBJDIR)/win32filter.o \ + $(OBJDIR)/create_file.o \ + $(OBJDIR)/drivetype.o \ + $(OBJDIR)/enable_priv.o \ + $(OBJDIR)/find.o \ + $(OBJDIR)/find_one.o \ + $(OBJDIR)/fstype.o \ + $(OBJDIR)/mkpath.o \ + $(OBJDIR)/match.o + +LIB_OBJS = \ + $(OBJDIR)/address_conf.o \ + $(OBJDIR)/alist.o \ + $(OBJDIR)/attr.o \ + $(OBJDIR)/base64.o \ + $(OBJDIR)/berrno.o \ + $(OBJDIR)/bget_msg.o \ + $(OBJDIR)/bnet.o \ + $(OBJDIR)/bnet_server.o \ + $(OBJDIR)/bpipe.o \ + $(OBJDIR)/breg.o \ + $(OBJDIR)/bregex.o \ + $(OBJDIR)/bsock.o \ + $(OBJDIR)/bsnprintf.o \ + $(OBJDIR)/bsys.o \ + $(OBJDIR)/btime.o \ + $(OBJDIR)/btimers.o \ + $(OBJDIR)/cram-md5.o \ + $(OBJDIR)/crc32.o \ + $(OBJDIR)/crypto.o \ + $(OBJDIR)/daemon.o \ + $(OBJDIR)/dlist.o \ + $(OBJDIR)/edit.o \ + $(OBJDIR)/fnmatch.o \ + $(OBJDIR)/guid_to_name.o \ + $(OBJDIR)/hmac.o \ + $(OBJDIR)/htable.o \ + $(OBJDIR)/jcr.o \ + $(OBJDIR)/lex.o \ + $(OBJDIR)/lz4.o \ + $(OBJDIR)/md5.o \ + $(OBJDIR)/mem_pool.o \ + $(OBJDIR)/message.o \ + $(OBJDIR)/openssl.o \ + $(OBJDIR)/plugins.o \ + $(OBJDIR)/priv.o \ + $(OBJDIR)/queue.o \ + $(OBJDIR)/rblist.o \ + $(OBJDIR)/runscript.o \ + $(OBJDIR)/rwlock.o \ + $(OBJDIR)/scan.o \ + $(OBJDIR)/serial.o \ + $(OBJDIR)/sha1.o \ + $(OBJDIR)/signal.o \ + $(OBJDIR)/smartall.o \ + $(OBJDIR)/tls.o \ + $(OBJDIR)/tree.o \ + $(OBJDIR)/util.o \ + $(OBJDIR)/var.o \ + $(OBJDIR)/watchdog.o \ + $(OBJDIR)/workq.o \ + $(OBJDIR)/binflate.o \ + $(OBJDIR)/ini.o \ + $(OBJDIR)/output.o \ + $(OBJDIR)/sellist.o \ + $(OBJDIR)/lockmgr.o \ + $(OBJDIR)/worker.o \ + $(OBJDIR)/flist.o + +DLL_OBJS = \ + $(COMPAT_OBJS) $(FIND_OBJS) $(LIB_OBJS) + +STATIC_OBJS = \ + $(OBJDIR)/parse_conf.o \ + $(OBJDIR)/res.o + +ALL_OBJS = \ + $(DLL_OBJS) $(STATIC_OBJS) + +LIBS_DLL = \ + $(LIBS_SSL) \ + $(LIBS_CRYPTO) \ + $(LIBS_PTHREADS) \ + $(LIBS_ZLIB) \ + $(LIBS_NETWORK) \ + -lole32 \ + -loleaut32 \ + -lws2_32 \ + -luuid + +###################################################################### + +# Targets + +.PHONY: all clean distclean + +all: $(BINDIR)/bacula.dll $(LIBDIR)/libbacula.a + +distclean: clean + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(ALL_OBJS)) + $(call clean_exe,$(BINDIR)/bacula.dll) + $(ECHO_CMD)rm -f $(OBJDIR)/bacula.a $(LIBDIR)/libbacula.a + $(ECHO_CMD)rm -rf $(OBJDIRS) + +# +# Rules for generating from ../lib +# + +$(LIBDIR)/libbacula.a: DLL_DEFINE=USING_DLL + +$(LIBDIR)/libbacula.a: $(BINDIR)/bacula.dll $(STATIC_OBJS) + @echo "Updating archive $@" + $(call checkdir,$@) + $(ECHO_CMD)cp $(OBJDIR)/bacula.a $@ + $(ECHO_CMD)$(AR) rsv $@ $(filter %.o,$^) + +$(BINDIR)/bacula.dll: DLL_DEFINE=BUILDING_DLL + +$(BINDIR)/bacula.dll: $(DLL_OBJS) bacula$(WIN_VERSION).def + @echo "Linking $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(LDFLAGS) -mdll -mwindows -Wl,--out-implib,$(OBJDIR)/bacula.a $^ $(LIBS_DLL) -o $@ + +bacula$(WIN_VERSION).def: $(DLL_OBJS) + ./make_def$(WIN_VERSION) $(DLL_OBJS) >bacula$(WIN_VERSION).def.new && \ + mv bacula$(WIN_VERSION).def.new bacula$(WIN_VERSION).def + + +include ../Makefile.rules + +$(OBJDIR)/%.o: %.c + @echo "Compiling $<" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) -D$(DLL_DEFINE) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.cpp + @echo "Compiling $<" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) -D$(DLL_DEFINE) $(CFLAGS) -c $< -o $@ diff --git a/bacula/src/win32/lib/bacula32.def b/bacula/src/win32/lib/bacula32.def new file mode 100644 index 0000000000..d8e3145fb5 --- /dev/null +++ b/bacula/src/win32/lib/bacula32.def @@ -0,0 +1,1017 @@ +LIBRARY bacula.dll +EXPORTS + +; address_conf.o +_Z14free_addressesP5dlist +_Z15store_addressesP13s_lex_contextP8RES_ITEMii +_Z17get_first_addressP5dlistPci +_Z17sockaddr_get_portPK8sockaddr +_Z17sockaddr_to_asciiPK8sockaddriPci +_Z19build_addresses_strP5dlistPci +_Z20store_addresses_portP13s_lex_contextP8RES_ITEMii +_Z22init_default_addressesPP5dlisti +_Z23store_addresses_addressP13s_lex_contextP8RES_ITEMii +_Z24get_first_port_net_orderP5dlist +_Z25get_first_port_host_orderP5dlist +_Z26remove_duplicate_addressesP5dlist +_Z27sockaddr_get_port_net_orderPK8sockaddr +_ZN6IPADDR11get_addressEPci +_ZN6IPADDR12get_sockaddrEv +_ZN6IPADDR12set_addr_anyEv +_ZN6IPADDR12set_port_netEt +_ZN6IPADDR16get_sockaddr_lenEv +_ZN6IPADDR17build_address_strEPci +_ZN6IPADDR8set_typeENS_6i_typeE +_ZN6IPADDR9copy_addrEPS_ +_ZN6IPADDR9set_addr4EP7in_addr +_ZN6IPADDR9set_addr6EP8in6_addr +_ZN6IPADDRC1Ei +_ZN6IPADDRC1ERKS_ +_ZN6IPADDRC2Ei +_ZN6IPADDRC2ERKS_ +_ZNK6IPADDR10get_familyEv +_ZNK6IPADDR18get_port_net_orderEv +_ZNK6IPADDR8get_typeEv + +; alist.o +_ZN5alist4lastEv +_ZN5alist4nextEv +_ZN5alist4prevEv +_ZN5alist5firstEv +_ZN5alist7prependEPv +_ZN5ilist3putEiPv +_ZN8baselist11remove_itemEi +_ZN8baselist3getEi +_ZN8baselist6appendEPv +_ZN8baselist7destroyEv +_ZN8baselist9grow_listEv + +; attr.o +_Z15print_ls_outputP3JCRP4ATTRi +_Z24build_attr_output_fnamesP3JCRP4ATTR +_Z24unpack_attributes_recordP3JCRiPciP4ATTR +_Z8new_attrP3JCR +_Z9free_attrP4ATTR + +; attribs.o +_Z11decode_statPcP4statiPi +_Z11encode_statPcP4statiii +_Z11set_own_modP4ATTRPcjjt +_Z13decode_LinkFIPcP4stati +_Z14set_attributesP3JCRP4ATTRP5BFILE +_Z16encode_attribsExP3JCRPcP6FF_PKT +_Z16set_mod_own_timeP3JCRP5BFILEP4ATTR +_Z18select_data_streamP6FF_PKT +_Z9win_errorP3JCRiPKcPc +_Z9win_errorP3JCRPKcm +_Z9win_errorP3JCRPKcPc + +; base64.o +_Z11base64_initv +_Z11from_base64PxPc +_Z13base64_to_binPciS_i +_Z13bin_to_base64PciS_ii +_Z9to_base64xPc + +; berrno.o +_ZN6berrno20format_win32_messageEv +_ZN6berrno9bstrerrorEv + +; bfile.o +_Z10set_fattrsP5BFILEP4stat +_Z11bget_handleP5BFILE +_Z11int32_LE2BEPii +_Z11int64_LE2BEPxx +_Z14have_win32_apiv +_Z14set_cmd_pluginP5BFILEP3JCR +_Z15is_win32_streami +_Z15stream_to_asciii +_Z16set_win32_backupP5BFILE +_Z18is_portable_backupP5BFILE +_Z19set_portable_backupP5BFILE +_Z26processWin32BackupAPIBlockP5BFILEPvi +_Z27is_restore_stream_supportedi +_Z5binitP5BFILE +_Z5bopenP5BFILEPKcyt +_Z5breadP5BFILEPvj +_Z6bcloseP5BFILE +_Z6blseekP5BFILExi +_Z6bwriteP5BFILEPvj +_Z8is_bopenP5BFILE +_Z9pause_msgPKcS0_iS0_ + +; bget_msg.o +_Z8bget_msgP5BSOCK +_ZN6GetMsg14wait_read_sockEi +_ZN6GetMsg15start_read_sockEv +_ZN6GetMsg19do_read_sock_threadEv +_ZN6GetMsg7is_doneEv +_ZN6GetMsg7is_stopEv +_ZN6GetMsg8bget_msgEPP8bmessage +_ZN6GetMsg8is_errorEv +_ZN6GetMsgC1EP3JCRP5BSOCKPKci +_ZN6GetMsgC2EP3JCRP5BSOCKPKci +_ZN6GetMsgD0Ev +_ZN6GetMsgD1Ev +_ZN6GetMsgD2Ev +_ZN8bmessage4swapEP5BSOCK +_ZN8bmessageC1Ei +_ZN8bmessageC2Ei +_ZN8bmessageD0Ev +_ZN8bmessageD1Ev +_ZN8bmessageD2Ev + +; binflate.o +_Z8ZdeflatePciS_Ri +_Z8ZinflatePciS_Ri + +; bnet.o +_Z10init_bsockP3JCRiPKcS2_iP8sockaddr +_Z11read_nbytesP5BSOCKPci +_Z11resolv_hostiPKcP5dlist +_Z12write_nbytesP5BSOCKPci +_Z15bnet_tls_clientP11TLS_ContextP5BSOCKP5alist +_Z15bnet_tls_serverP11TLS_ContextP5BSOCKP5alist +_Z16set_socket_errnoi +_Z17bnet_host2ipaddrsPKciPS0_ +_Z17bnet_sig_to_asciii +_Z9dup_bsockP5BSOCK + +; bnet_server.o +_Z18bnet_thread_serverP5dlistiP9workq_tagPFPvS3_E +_Z23bnet_stop_thread_server14ptw32_handle_t + +; bpipe.o +_Z11run_programPciRS_ +_Z23run_program_full_outputPciRS_PS_ + +; breg.o +_Z11new_bregexpPKc +_Z12free_bregexpP7BREGEXP +_Z12get_bregexpsPKc +_Z13free_bregexpsP5alist +_Z14apply_bregexpsPKcP5alistPPc +_Z19bregexp_build_wherePciS_S_S_ +_Z21bregexp_escape_stringPcPKcc +_Z28bregexp_get_build_where_sizePcS_S_ +_ZN7BREGEXP10edit_substEPKcP12b_regmatch_t +_ZN7BREGEXP12return_fnameEPKci +_ZN7BREGEXP14extract_regexpEPKc +_ZN7BREGEXP16compute_dest_lenEPKcP12b_regmatch_t +_ZN7BREGEXP5debugEv +_ZN7BREGEXP7replaceEPKc + +; bregex.o +b_re_compile_fastmap +b_re_compile_initialize +b_re_compile_pattern +b_regcomp +b_regerror +b_regexec +b_regfree +b_re_match +b_re_search +b_re_set_syntax +_Z24re_registers_to_regmatchP12re_registersP12b_regmatch_tj + +; bsnprintf.o +_Z10bvsnprintfPciPKcS_ +_Z9bsnprintfPciPKcz + +; bsock.o +_Z14dump_bsock_msgijPKcjijPci +_Z9new_bsockv +_ZN13BSOCKCallbackC1Ev +_ZN13BSOCKCallbackC2Ev +_ZN13BSOCKCallbackD0Ev +_ZN13BSOCKCallbackD1Ev +_ZN13BSOCKCallbackD2Ev +_ZN5BSOCK11set_lockingEv +_ZN5BSOCK12set_blockingEv +_ZN5BSOCK12set_killableEb +_ZN5BSOCK13clear_lockingEv +_ZN5BSOCK13comm_compressEv +_ZN5BSOCK14wait_data_intrEii +_ZN5BSOCK15control_bwlimitEi +_ZN5BSOCK15set_buffer_sizeEji +_ZN5BSOCK15set_nonblockingEv +_ZN5BSOCK16restore_blockingEi +_ZN5BSOCK18set_source_addressEP5dlist +_ZN5BSOCK21authenticate_directorEPKcS1_P11TLS_ContextPci +_ZN5BSOCK4initEv +_ZN5BSOCK4openEP3JCRPKcPcS4_ixPi +_ZN5BSOCK4recvEv +_ZN5BSOCK4sendEi +_ZN5BSOCK5closeEv +_ZN5BSOCK5fsendEPKcz +_ZN5BSOCK6cancelEv +_ZN5BSOCK6signalEi +_ZN5BSOCK7connectEP3JCRixxPKcPcS4_ii +_ZN5BSOCK7despoolEPFviEi +_ZN5BSOCK7destroyEv +_ZN5BSOCK8_destroyEv +_ZN5BSOCK8fin_initEP3JCRiPKcS3_iP8sockaddr +_ZN5BSOCK8free_tlsEv +_ZN5BSOCK8get_peerEPci +_ZN5BSOCK9bstrerrorEv +_ZN5BSOCK9wait_dataEii + +; bsys.o +_Z10b_strerroriPcj +_Z11bmicrosleepii +_Z11bstrcasecmpPKcS0_ +_Z11quote_wherePcPKc +_Z11stack_tracev +_Z12fd_wait_datai12fd_wait_modeii +_Z12quote_stringPcPKc +_Z12safer_unlinkPKcS0_ +_Z15create_pid_filePcPKci +_Z15delete_pid_filePcPKci +_Z15escape_filenamePKc +_Z15read_state_filePcPKci +_Z16create_lock_filePcPKcS1_PS_Pi +_Z16write_state_filePcPKci +_Z17fs_get_free_spacePKcPxS1_ +_Z20make_unique_filenamePPciS_ +_Z5bfreePv +_Z6bfgetsPciP6_iobuf +_Z6bfgetsRPcP6_iobuf +_Z6bfopenPKcS0_ +_Z7bacceptiP8sockaddrPi +_Z7bcallocjj +_Z7bstrcmpPKcS0_ +_Z7cstrlenPKc +_Z8b_mallocPKcij +_Z8breallocPvj +_Z8bstrncatPcPKci +_Z8bstrncatPcR8POOL_MEMi +_Z8bstrncpyPcPKci +_Z8bstrncpyPcR8POOL_MEMi +_Z8copyfilePKcS0_ +_Z9setup_envPPc + +; btime.o +_Z10bstrftimesPcix +_Z11date_decodedPjPhS0_ +_Z11date_encodejhh +_Z11time_decodedPhS_S_Pf +_Z11time_encodehhhf +_Z12bstrftime_dnPcix +_Z12bstrftime_ncPcix +_Z12bstrftime_nyPcix +_Z12str_to_utimePc +_Z13btime_to_unixx +_Z14btime_to_utimex +_Z16date_time_decodeP9date_timePjPhS2_S2_S2_S2_Pf +_Z16date_time_encodeP9date_timejhhhhhf +_Z16get_current_timeP9date_time +_Z17date_time_compareP9date_timeS0_ +_Z17get_current_btimev +_Z6tm_womii +_Z6tm_woyl +_Z7tm_ldomii +_Z9bstrftimePcix +_Z9bstrutimePcix +_Z9tm_decodeP9date_timeP2tm +_Z9tm_encodeP9date_timeP2tm + +; btimers.o +_Z16stop_bsock_timerP8btimer_t +_Z16stop_child_timerP8btimer_t +_Z17start_bsock_timerP5BSOCKj +_Z17start_child_timerP3JCRij +_Z17stop_thread_timerP8btimer_t +_Z18start_thread_timerP3JCR14ptw32_handle_tj + +; compat.o +mkstemp +nanosleep +snprintf +umask +_Z10binet_ptoniPKcPv +_Z10open_bpipePciPKcPS_ +_Z11close_bpipeP5BPIPE +_Z11close_wpipeP5BPIPE +_Z11LogErrorMsgPKc +_Z11malloc_trimi +_Z11strncasecmpPKcS0_i +_Z11win32_cgetsPci +_Z11win32_chdirPKc +_Z11win32_chmodPKct +_Z11win32_fputsPKcP6_iobuf +_Z11win32_mkdirPKc +_Z12gettimeofdayP7timevalP8timezone +_Z12init_signalsPFviE +_Z12UTF8_2_wcharPPcPKc +_Z12wchar_2_UTF8PcPKwi +_Z12wchar_2_UTF8PPcPKw +_Z12win32_getcwdPci +_Z12win32_unlinkPKc +_Z15get_memory_infoPci +_Z15init_stack_dumpv +_Z15win32_ftruncateix +_Z16wchar_win32_pathPKcPw +_Z17SetVSSPathConvertPFivEPFiPKcPciEPFiPKwPwiE +_Z18CreateChildProcessPKcPvS1_S1_ +_Z18cvt_ftime_to_utimeRK9_FILETIME +_Z18cvt_utime_to_ftimeRKlR9_FILETIME +_Z18GetApplicationNamePKcPPcPS0_ +_Z18unix_name_to_win32PPcPKc +_Z20allow_os_suspensionsv +_Z21Win32ConvCleanupCachev +_Z22prevent_os_suspensionsv +_Z28make_win32_path_UTF8_2_wcharPPcPKcPi +_Z4forkv +_Z4killii +_Z4pipePi +_Z4statPKcP4stat +_Z5chownPKcjj +_Z5dlsymPvPKc +_Z5fcntlii +_Z5fcntliil +_Z5fstatiP4stat +_Z5hstatPvP4stat +_Z5lstatPKcP4stat +_Z5sleepi +_Z6dlopenPKci +_Z6execvpPKcPPc +_Z6lchownPKcjj +_Z6randomv +_Z6syslogiPKcz +_Z7dlclosePv +_Z7dlerrorv +_Z7geteuidv +_Z7opendirPKc +_Z7openlogPKcii +_Z7srandomj +_Z7symlinkPKcS0_ +_Z7waitpidiPii +_Z8closedirPv +_Z8closelogv +_Z8getArgv0PKc +_Z8getgrgidj +_Z8getpwuidj +_Z8pathconfPKci +_Z8readlinkPKcPci +_Z8WSA_Initv +_Z9ErrorExitPKc +_Z9inet_atonPKcP7in_addr +_Z9readdir_rPvP6direntPS1_ +_ZN6winverC1Ev +_ZN6winverC2Ev + +; cram-md5.o +_Z16cram_md5_respondP5BSOCKPKcPiS3_ +_Z18cram_md5_challengeP5BSOCKPKcii + +; crc32.o +_Z6bcrc32Phi + +; create_file.o +_Z11create_fileP3JCRP4ATTRP5BFILEi + +; crypto.o +_Z13CryptoData_itv +_Z13SignerInfo_itv +_Z14CryptoData_newv +_Z14d2i_CryptoDataPP10CryptoDataPPKhl +_Z14d2i_SignerInfoPP10SignerInfoPPKhl +_Z14i2d_CryptoDataP10CryptoDataPPh +_Z14i2d_SignerInfoP10SignerInfoPPh +_Z14SignerInfo_newv +_Z15CryptoData_freeP10CryptoData +_Z15crypto_sign_newP3JCR +_Z15crypto_strerror14crypto_error_t +_Z15SignerInfo_freeP10SignerInfo +_Z16crypto_sign_freeP9Signature +_Z16RecipientInfo_itv +_Z16SignatureData_itv +_Z17crypto_cipher_newP14Crypto_SessionbPj +_Z17crypto_digest_newP3JCR15crypto_digest_t +_Z17d2i_RecipientInfoPP13RecipientInfoPPKhl +_Z17d2i_SignatureDataPP13SignatureDataPPKhl +_Z17i2d_RecipientInfoP13RecipientInfoPPh +_Z17i2d_SignatureDataP13SignatureDataPPh +_Z17RecipientInfo_newv +_Z17SignatureData_newv +_Z18crypto_cipher_freeP14Cipher_Context +_Z18crypto_digest_freeP6Digest +_Z18crypto_digest_nameP6Digest +_Z18crypto_keypair_dupP12X509_Keypair +_Z18crypto_keypair_newv +_Z18crypto_session_new15crypto_cipher_tP5alist +_Z18crypto_sign_decodeP3JCRPKhj +_Z18crypto_sign_encodeP9SignaturePhPj +_Z18crypto_sign_verifyP9SignatureP12X509_KeypairP6Digest +_Z18RecipientInfo_freeP13RecipientInfo +_Z18SignatureData_freeP13SignatureData +_Z19crypto_keypair_freeP12X509_Keypair +_Z19crypto_session_freeP14Crypto_Session +_Z20crypto_cipher_updateP14Cipher_ContextPKhjS2_Pj +_Z20crypto_digest_updateP6DigestPKhj +_Z21crypto_session_decodePKhjP5alistPP14Crypto_Session +_Z21crypto_session_encodeP14Crypto_SessionPhPj +_Z22crypto_cipher_finalizeP14Cipher_ContextPhPj +_Z22crypto_digest_finalizeP6DigestPhPj +_Z22crypto_keypair_has_keyPKc +_Z22crypto_sign_add_signerP9SignatureP6DigestP12X509_Keypair +_Z22crypto_sign_get_digestP9SignatureP12X509_KeypairR15crypto_digest_tPP6Digest +_Z23crypto_keypair_load_keyP12X509_KeypairPKcPFiPciPKvES5_ +_Z24crypto_keypair_load_certP12X509_KeypairPKc +_Z25crypto_digest_stream_typei +_Z27crypto_default_pem_callbackPciPKv + +; daemon.o +_Z12daemon_startv + +; dlist.o +_Z15new_dlistStringPKc +_Z15new_dlistStringPKci +_ZN5dlist12insert_afterEPvS0_ +_ZN5dlist13binary_insertEPvPFiS0_S0_E +_ZN5dlist13binary_searchEPvPFiS0_S0_E +_ZN5dlist13insert_beforeEPvS0_ +_ZN5dlist22binary_insert_multipleEPvPFiS0_S0_E +_ZN5dlist4nextEPv +_ZN5dlist4prevEPv +_ZN5dlist6appendEPv +_ZN5dlist6removeEPv +_ZN5dlist7destroyEv +_ZN5dlist7prependEPv + +; drivetype.o +_Z9drivetypePKcPci + +; edit.o +_Z10add_commasPcS_ +_Z10edit_int64xPc +_Z10edit_utimexPci +_Z11edit_uint64yPc +_Z11is_a_numberPKc +_Z12str_to_int64Pc +_Z13is_an_integerPKc +_Z13is_name_validPKcPPc +_Z13str_to_uint64Pc +_Z14size_to_uint64PciPy +_Z15speed_to_uint64PciPy +_Z16is_a_number_listPKc +_Z17duration_to_utimePcPx +_Z22edit_int64_with_commasxPc +_Z23edit_uint64_with_commasyPc +_Z23edit_uint64_with_suffixyPc + +; enable_priv.o +_Z24enable_backup_privilegesP3JCRi + +; find.o +_Z10find_filesP3JCRP6FF_PKTPFiS0_S2_bES4_ +_Z11accept_fileP6FF_PKT +_Z13is_in_filesetP6FF_PKT +_Z15init_find_filesv +_Z15term_find_filesP6FF_PKT +_Z16set_find_optionsP6FF_PKTil +_Z25set_find_changed_functionP6FF_PKTPFbP3JCRS0_E +_Z26set_find_snapshot_functionP6FF_PKTPFbP3JCRS0_P5dlistP11dlistStringE + +; find_one.o +_Z13check_changesP3JCRP6FF_PKT +_Z13find_one_fileP3JCRP6FF_PKTPFiS0_S2_bEPcjb +_Z13term_find_oneP6FF_PKT +_Z16has_file_changedP3JCRP6FF_PKT +_Z22ff_pkt_set_link_digestP6FF_PKTiPKcj + +; flist.o +_ZN5flist5queueEPv +_ZN5flist7dequeueEv +_ZN5flist7destroyEv + +; fnmatch.o +fnmatch + +; fstype.o +_Z13add_mtab_itemPvP4statPKcS3_S3_S3_ +_Z6fstypeP6FF_PKTPci +_Z9read_mtabPFvPvP4statPKcS3_S3_S3_ES_ + +; guid_to_name.o +_Z13new_guid_listv +_Z14free_guid_listP9guid_list +_ZN9guid_list11gid_to_nameEjPci +_ZN9guid_list11uid_to_nameEjPci + +; hmac.o +_Z8hmac_md5PhiS_iS_ + +; htable.o +_ZN6htable10grow_tableEv +_ZN6htable10hash_indexEPc +_ZN6htable10hash_indexEy +_ZN6htable11hash_mallocEi +_ZN6htable13hash_big_freeEv +_ZN6htable14malloc_big_bufEi +_ZN6htable4initEPvS0_i +_ZN6htable4nextEv +_ZN6htable4sizeEv +_ZN6htable5firstEv +_ZN6htable5statsEv +_ZN6htable6insertEPcPv +_ZN6htable6insertEyPv +_ZN6htable6lookupEPc +_ZN6htable6lookupEy +_ZN6htable7destroyEv +_ZN6htableC1EPvS0_i +_ZN6htableC2EPvS0_i + +; ini.o +_Z13ini_store_strP13s_lex_contextP10ConfigFileP9ini_items +_Z14ini_store_boolP13s_lex_contextP10ConfigFileP9ini_items +_Z14ini_store_dateP13s_lex_contextP10ConfigFileP9ini_items +_Z14ini_store_nameP13s_lex_contextP10ConfigFileP9ini_items +_Z15ini_store_int32P13s_lex_contextP10ConfigFileP9ini_items +_Z15ini_store_int64P13s_lex_contextP10ConfigFileP9ini_items +_Z16ini_store_pint32P13s_lex_contextP10ConfigFileP9ini_items +_Z16ini_store_pint64P13s_lex_contextP10ConfigFileP9ini_items +_Z18ini_get_store_codePFbP13s_lex_contextP10ConfigFileP9ini_itemsE +_Z19ini_store_alist_strP13s_lex_contextP10ConfigFileP9ini_items +_Z21ini_get_store_handlerPKc +_ZN10ConfigFile10free_itemsEv +_ZN10ConfigFile11clear_itemsEv +_ZN10ConfigFile11dump_stringEPKci +_ZN10ConfigFile11unserializeEPKc +_ZN10ConfigFile12dump_resultsEPPc +_ZN10ConfigFile5parseEPKc +_ZN10ConfigFile5parseEv +_ZN10ConfigFile8get_itemEPKc +_ZN10ConfigFile9parse_bufEPKc +_ZN10ConfigFile9serializeEPKc +_ZN10ConfigFile9serializeEPPc +_ZN10ConfigFileD0Ev +_ZN10ConfigFileD1Ev + +; jcr.o +timeout_handler +_Z10b_free_jcrPKciP3JCR +_Z11unlock_jobsv +_Z12jcr_walk_endP3JCR +_Z12job_end_pushP3JCRPFvS0_PvES1_ +_Z13dbg_print_jcrP6_iobuf +_Z13get_jcr_by_idj +_Z13jcr_walk_nextP3JCR +_Z14create_jcr_keyv +_Z14jcr_walk_startv +_Z14set_jcr_in_tsdP3JCR +_Z16dbg_jcr_add_hookPFvP3JCRP6_iobufE +_Z16get_jcr_from_tsdv +_Z18get_jcr_by_sessionjj +_Z18get_jobid_from_tid14ptw32_handle_t +_Z18get_jobid_from_tsdv +_Z18init_jcr_subsystemv +_Z19init_last_jobs_listv +_Z19lock_last_jobs_listv +_Z19read_last_jobs_listiy +_Z19remove_jcr_from_tsdP3JCR +_Z19term_last_jobs_listv +_Z20get_jcr_by_full_namePc +_Z20write_last_jobs_listiy +_Z21unlock_last_jobs_listv +_Z23get_jcr_by_partial_namePc +_Z24get_next_jobid_from_listPPcPj +_Z7new_jcriPFvP3JCRE +_Z9job_countv +_Z9lock_jobsv +_ZN3JCR12setJobStatusEi +_ZN3JCR12set_killableEb +_ZN3JCR13sendJobStatusEi +_ZN3JCR13sendJobStatusEv +_ZN3JCR13setJobStartedEv +_ZN3JCR14can_be_stoppedEv +_ZN3JCR14get_ActionNameEb +_ZN3JCR17get_OperationNameEv +_ZN3JCR21my_thread_send_signalEi +_ZN3JCR8JobReadsEv + +; lex.o +_Z11scan_to_eolP13s_lex_context +_Z12lex_get_charP13s_lex_context +_Z12lex_open_bufP13s_lex_contextPKcPFvS2_iS0_S2_zE +_Z13lex_check_eolP13s_lex_context +_Z13lex_get_tokenP13s_lex_contexti +_Z13lex_open_fileP13s_lex_contextPKcPFvS2_iS0_S2_zE +_Z14lex_close_fileP13s_lex_context +_Z14lex_tok_to_stri +_Z14lex_unget_charP13s_lex_context +_Z20scan_to_next_not_eolP13s_lex_context +_Z25lex_store_clear_passwordsP13s_lex_context +_Z29lex_set_default_error_handlerP13s_lex_context +_Z32lex_set_error_handler_error_typeP13s_lex_contexti + +; lockmgr.o +_Z14dbg_print_lockP6_iobuf +_Z18bthread_change_uidjj +_Z21bthread_get_thread_idv +_Z6lmgr_pPP16pthread_mutex_t_ +_Z6lmgr_vPP16pthread_mutex_t_ + +; lz4.o +LZ4_compress +LZ4_compressBound +LZ4_compress_continue +LZ4_compress_default +LZ4_compress_destSize +LZ4_compress_fast +LZ4_compress_fast_continue +LZ4_compress_fast_extState +LZ4_compress_limitedOutput +LZ4_compress_limitedOutput_continue +LZ4_compress_limitedOutput_withState +LZ4_compress_withState +LZ4_create +LZ4_createStream +LZ4_createStreamDecode +LZ4_decompress_fast +LZ4_decompress_fast_continue +LZ4_decompress_fast_usingDict +LZ4_decompress_fast_withPrefix64k +LZ4_decompress_safe +LZ4_decompress_safe_continue +LZ4_decompress_safe_partial +LZ4_decompress_safe_usingDict +LZ4_decompress_safe_withPrefix64k +LZ4_freeStream +LZ4_freeStreamDecode +LZ4_loadDict +LZ4_resetStream +LZ4_resetStreamState +LZ4_saveDict +LZ4_setStreamDecode +LZ4_sizeofState +LZ4_sizeofStreamState +LZ4_slideInputBuffer +LZ4_uncompress +LZ4_uncompress_unknownOutputSize +LZ4_versionNumber +LZ4_versionString +_Z23LZ4_compress_fast_forcePKcPciii +_Z25LZ4_compress_forceExtDictP12LZ4_stream_uPKcPci +_Z32LZ4_decompress_safe_forceExtDictPKcPciiS0_i + +; match.o +_Z11match_filesP3JCRP6FF_PKTPFiS0_S2_bE +_Z16file_is_excludedP6FF_PKTPKc +_Z16file_is_includedP6FF_PKTPKc +_Z22get_next_included_fileP6FF_PKTP15s_included_file +_Z25add_fname_to_exclude_listP6FF_PKTPKc +_Z25add_fname_to_include_listP6FF_PKTiPKc +_Z26term_include_exclude_filesP6FF_PKT + +; md5.o +_Z11byteReversePhj +_Z12MD5TransformPjS_ +_Z7MD5InitP10MD5Context +_Z8MD5FinalPhP10MD5Context +_Z9MD5UpdateP10MD5ContextPhj + +; mem_pool.o +_Z13sm_get_memoryPKcii +_Z17close_memory_poolv +_Z18sm_get_pool_memoryPKcii +_Z19sm_free_pool_memoryPKciPc +_Z21sm_sizeof_pool_memoryPKciPc +_Z22garbage_collect_memoryv +_Z22sm_realloc_pool_memoryPKciPci +_Z23print_memory_pool_statsv +_Z25sm_check_pool_memory_sizePKciPci +_Z27garbage_collect_memory_poolv +_Z9pm_memcpyPPcPKci +_Z9pm_memcpyR8POOL_MEMPKci +_Z9pm_memcpyRPcPKci +_Z9pm_memcpyRPcR8POOL_MEMi +_Z9pm_strcatPPcPKc +_Z9pm_strcatR8POOL_MEMPKc +_Z9pm_strcatR8POOL_MEMS0_ +_Z9pm_strcatRPcPKc +_Z9pm_strcatRPcR8POOL_MEM +_Z9pm_strcpyPPcPKc +_Z9pm_strcpyR8POOL_MEMPKc +_Z9pm_strcpyRPcPKc +_Z9pm_strcpyRPcR8POOL_MEM +_ZN8POOL_MEM10realloc_pmEi +_ZN8POOL_MEM6strcatEPKc +_ZN8POOL_MEM6strcpyEPKc +_ZN8POOL_MEM8max_sizeEv + +; message.o +_Z10get_blowupv +_Z10get_hangupv +_Z10my_name_isiPPcPKc +_Z10set_blowupi +_Z10set_hangupi +_Z12add_msg_destP4MSGSiiPcS1_ +_Z12get_basenamePKc +_Z12rem_msg_destP4MSGSiiPc +_Z13debug_get_tagjPPKc +_Z13free_msgs_resP4MSGS +_Z14debug_find_tagPKcbPx +_Z14set_assert_msgPKciS0_ +_Z15set_debug_flagsPc +_Z16debug_parse_tagsPKcPx +_Z16dequeue_messagesP3JCR +_Z16dispatch_messageP3JCRixPc +_Z16init_console_msgPKc +_Z18set_db_engine_namePKc +_Z19is_message_type_setP3JCRi +_Z20handle_hangup_blowupP3JCRjy +_Z21generate_daemon_eventP3JCRPKc +_Z25free_daemon_message_queuev +_Z25register_message_callbackPFviPcE +_Z26setup_daemon_message_queuev +_Z4JmsgP3JCRixPKcz +_Z4MmsgPPcPKcz +_Z4MmsgR8POOL_MEMPKcz +_Z4MmsgRPcPKcz +_Z4QmsgP3JCRixPKcz +_Z5d_msgPKcixS0_z +_Z5e_msgPKciiiS0_z +_Z5j_msgPKciP3JCRixS0_z +_Z5m_msgPKciPPcS0_z +_Z5m_msgPKciRPcS0_z +_Z5p_msgPKciiS0_z +_Z5q_msgPKciP3JCRixS0_z +_Z5t_msgPKcixS0_z +_Z6vd_msgPKcixS0_Pc +_Z8init_msgP3JCRP4MSGSPFPcS0_PKcS3_iE +_Z8term_msgv +_Z9close_msgP3JCR +_Z9get_tracev +_Z9set_tracei +_ZN4MSGS15wait_not_in_useEv +_ZN4MSGS4lockEv +_ZN4MSGS6unlockEv + +; mkpath.o +_Z13path_list_addP3JCRjPc +_Z14free_path_listP3JCR +_Z16path_list_lookupP3JCRPc +_Z8makepathP4ATTRPKcttjji + +; openssl.o +_Z11init_cryptov +_Z14cleanup_cryptov +_Z19openssl_post_errorsiPKc +_Z19openssl_post_errorsP3JCRiPKc + +; output.o +snprintf +_ZN12OutputWriter10get_outputE10OutputTypez +_ZN12OutputWriter10get_outputEPcPS0_10OutputType +_ZN12OutputWriter10get_outputEPPc10OutputTypez +_ZN12OutputWriter10start_listEPKcb +_ZN12OutputWriter11get_optionsEPc +_ZN12OutputWriter11start_groupEPKcb +_ZN12OutputWriter13parse_optionsEPKc +_ZN12OutputWriter7get_bufEb +_ZN12OutputWriter8end_listEb +_ZN12OutputWriter9end_groupEb +_ZN12OutputWriterD0Ev +_ZN12OutputWriterD1Ev + +; plugins.o +_Z10new_pluginv +_Z12load_pluginsPvS_PKcS1_PFbP6PluginE +_Z14unload_pluginsv +_Z16dbg_print_pluginP6_iobuf +_Z19dbg_plugin_add_hookPFvP6PluginP6_iobufE + +; print.o +_Z10__snprintfPcjPKcz +_Z10__vsprintfPcPKcS_ +_Z11__vsnprintfPcjPKcS_ +_Z4doprPcjPKcS_PFvS_PjjiE +_Z9__sprintfPcPKcz + +; priv.o +_Z4dropPcS_b + +; queue.o +_Z5qnextP7b_queueS0_ +_Z7qdchainP7b_queue +_Z7qinsertP7b_queueS0_ +_Z7qremoveP7b_queue + +; rblist.o +_ZN6rblist11left_rotateEPv +_ZN6rblist12right_rotateEPv +_ZN6rblist3anyEPv +_ZN6rblist4nextEPv +_ZN6rblist5firstEv +_ZN6rblist6insertEPvPFiS0_S0_E +_ZN6rblist6removeEPv +_ZN6rblist6searchEPvPFiS0_S0_E +_ZN6rblist7destroyEv + +; runscript.o +_Z11run_scriptsP3JCRP5alistPKc +_Z13new_runscriptv +_Z14copy_runscriptP9RUNSCRIPT +_Z14free_runscriptP9RUNSCRIPT +_Z15free_runscriptsP5alist +_ZN9RUNSCRIPT10set_targetEPKc +_ZN9RUNSCRIPT11set_commandEPKci +_ZN9RUNSCRIPT13reset_defaultEb +_ZN9RUNSCRIPT21set_job_code_callbackEPFPcP3JCRPKcS0_iE +_ZN9RUNSCRIPT3runEP3JCRPKc +_ZN9RUNSCRIPT5debugEv +_ZN9RUNSCRIPT8is_localEv + +; rwlock.o +_Z11rwl_destroyP12s_rwlock_tag +_Z12is_rwl_validP12s_rwlock_tag +_Z12rwl_readlockP12s_rwlock_tag +_Z14rwl_readunlockP12s_rwlock_tag +_Z15rwl_readtrylockP12s_rwlock_tag +_Z15rwl_writelock_pP12s_rwlock_tagPKci +_Z15rwl_writeunlockP12s_rwlock_tag +_Z16rwl_writetrylockP12s_rwlock_tag +_Z8rwl_initP12s_rwlock_tagi + +; scan.o +_Z10parse_argsPcPS_PiS0_S0_i +_Z11skip_spacesPPc +_Z14skip_nonspacesPPc +_Z15parse_args_onlyPcPS_PiS0_S0_i +_Z19strip_leading_spacePc +_Z19strip_trailing_junkPc +_Z22strip_trailing_newlinePc +_Z22strip_trailing_slashesPc +_Z23split_path_and_filenamePKcPPcPiS2_S3_ +_Z7bsscanfPKcS0_z +_Z7fstrschPKcS0_ +_Z8next_argPPc +_Z9next_namePPc + +; sellist.o +_ZN7sellist10set_stringEPKcb +_ZN7sellist17get_expanded_listEv +_ZN7sellist4nextEv + +; serial.o +_Z12serial_btimePPhx +_Z12serial_int16PPhs +_Z12serial_int32PPhi +_Z12serial_int64PPhx +_Z13serial_stringPPhPKc +_Z13serial_uint16PPht +_Z13serial_uint32PPhj +_Z13serial_uint64PPhy +_Z14serial_float64PPhd +_Z14unserial_btimePPh +_Z14unserial_int16PPh +_Z14unserial_int32PPh +_Z14unserial_int64PPh +_Z15unserial_stringPPhPci +_Z15unserial_uint16PPh +_Z15unserial_uint32PPh +_Z15unserial_uint64PPh +_Z16unserial_float64PPh + +; sha1.o +_Z10SHA1UpdateP11SHA1ContextPKhj +_Z8SHA1InitP11SHA1Context +_Z9SHA1FinalP11SHA1ContextPh + +; signal.o + +; smartall.o +_Z10sm_reallocPKciPvj +_Z12actuallyfreePv +_Z12sm_check_rtnPKcib +_Z12sm_new_ownerPKciPc +_Z14actuallycallocjj +_Z14actuallymallocj +_Z15actuallyreallocPvj +_Z7bmemsetPvij +_Z7sm_dumpbb +_Z7sm_freePKciPv +_Z8sm_checkPKcib +_Z9sm_callocPKcijj +_Z9sm_mallocPKcij +_Z9sm_staticb + +; tls.o +_Z14get_tls_enableP11TLS_Context +_Z15get_tls_requireP11TLS_Context +_Z15new_tls_contextPKcS0_S0_S0_PFiPciPKvES3_S0_b +_Z15tls_bsock_probeP5BSOCK +_Z15tls_bsock_readnP5BSOCKPci +_Z16free_tls_contextP11TLS_Context +_Z16tls_bsock_acceptP5BSOCK +_Z16tls_bsock_writenP5BSOCKPci +_Z17tls_bsock_connectP5BSOCK +_Z18new_tls_connectionP11TLS_Contexti +_Z18tls_bsock_shutdownP5BSOCK +_Z19free_tls_connectionP14TLS_Connection +_Z25tls_postconnect_verify_cnP3JCRP14TLS_ConnectionP5alist +_Z27tls_postconnect_verify_hostP3JCRP14TLS_ConnectionPKc + +; tree.o +_Z11tree_relcwdPcP11s_tree_rootP11s_tree_node +_Z12tree_getpathP11s_tree_nodePci +_Z14make_tree_pathPcP11s_tree_root +_Z16insert_tree_nodePcS_iP11s_tree_rootP11s_tree_node +_Z16tree_remove_nodeP11s_tree_rootP11s_tree_node +_Z19tree_add_delta_partP11s_tree_rootP11s_tree_nodeji +_Z8new_treei +_Z8tree_cwdPcP11s_tree_rootP11s_tree_node +_Z9free_treeP11s_tree_root + +; util.o +_Z11bash_spacesPc +_Z11bash_spacesR8POOL_MEM +_Z11encode_modetPc +_Z11encode_timexPc +_Z11is_buf_zeroPKci +_Z13unbash_spacesPc +_Z13unbash_spacesR8POOL_MEM +_Z14edit_job_codesP3JCRPcS1_PKcPFS1_S0_S3_S1_iE +_Z15is_power_of_twoy +_Z15job_type_to_stri +_Z16job_level_to_stri +_Z16make_session_keyPcS_i +_Z17job_status_to_strii +_Z18decode_session_keyPcS_S_i +_Z18do_shell_expansionPci +_Z18encode_session_keyPcS_S_i +_Z18jobstatus_to_asciiiPci +_Z19last_path_separatorPKc +_Z20volume_status_to_strPKc +_Z21set_working_directoryPc +_Z22jobstatus_to_ascii_guiiPci +_Z25action_on_purge_to_stringiR8POOL_MEM +_Z5lcasePc +_Z7hexdumpPKciPcib +_Z7is_nullPKv +_Z8bmemzeroPvj +_Z9asciidumpPKciPci +_Z9smartdumpPKciPciPb + +; var.o +_Z10var_configP6var_st12var_config_tz +_Z10var_createPP6var_st +_Z10var_expandP6var_stPKciPPcPii +_Z10var_formatP6var_stPPciPKcz +_Z11var_destroyP6var_st +_Z11var_formatvP6var_stPPciPKcS1_ +_Z12var_strerrorP6var_st8var_rc_t +_Z12var_unescapeP6var_stPKciPcii + +; watchdog.o +watchdog_thread +_Z11is_watchdogv +_Z12new_watchdogv +_Z13stop_watchdogv +_Z14start_watchdogv +_Z17register_watchdogP12s_watchdog_t +_Z19unregister_watchdogP12s_watchdog_t + +; win32filter.o +_ZN11Win32Filter9have_dataEPPcPxS2_ + +; winapi.o +_Z17InitWinAPIWrapperv + +; worker.o +_ZN6worker11finish_workEv +_ZN6worker12release_lockEv +_ZN6worker13discard_queueEv +_ZN6worker13set_run_stateEv +_ZN6worker14set_quit_stateEv +_ZN6worker14set_wait_stateEv +_ZN6worker15pop_free_bufferEv +_ZN6worker16push_free_bufferEPv +_ZN6worker16wait_queue_emptyEv +_ZN6worker4initEi +_ZN6worker4stopEv +_ZN6worker4waitEv +_ZN6worker5queueEPv +_ZN6worker5startEPFPvS0_ES0_ +_ZN6worker7dequeueEv +_ZN6worker7destroyEv + +; workq.o +workq_server +_Z10workq_initP9workq_tagiPFPvS1_E +_Z12workq_removeP9workq_tagP13workq_ele_tag +_Z13workq_destroyP9workq_tag +_Z15workq_wait_idleP9workq_tag +_Z9workq_addP9workq_tagPvPP13workq_ele_tagi + +console_command DATA +b_plugin_list DATA +plugin_bopen DATA +plugin_bclose DATA +plugin_bwrite DATA +plugin_bread DATA +plugin_blseek DATA +exepath DATA +version DATA +dist_name DATA diff --git a/bacula/src/win32/lib/bacula64.def b/bacula/src/win32/lib/bacula64.def new file mode 100644 index 0000000000..c95ccbeb7a --- /dev/null +++ b/bacula/src/win32/lib/bacula64.def @@ -0,0 +1,965 @@ +LIBRARY bacula.dll +EXPORTS + +; address_conf.o +_Z14free_addressesP5dlist +_Z15store_addressesP13s_lex_contextP8RES_ITEMii +_Z17get_first_addressP5dlistPci +_Z17sockaddr_get_portPK8sockaddr +_Z17sockaddr_to_asciiPK8sockaddriPci +_Z19build_addresses_strP5dlistPci +_Z20store_addresses_portP13s_lex_contextP8RES_ITEMii +_Z22init_default_addressesPP5dlisti +_Z23store_addresses_addressP13s_lex_contextP8RES_ITEMii +_Z24get_first_port_net_orderP5dlist +_Z25get_first_port_host_orderP5dlist +_Z26remove_duplicate_addressesP5dlist +_Z27sockaddr_get_port_net_orderPK8sockaddr +_ZN6IPADDR11get_addressEPci +_ZN6IPADDR12get_sockaddrEv +_ZN6IPADDR12set_addr_anyEv +_ZN6IPADDR12set_port_netEt +_ZN6IPADDR16get_sockaddr_lenEv +_ZN6IPADDR17build_address_strEPci +_ZN6IPADDR8set_typeENS_6i_typeE +_ZN6IPADDR9copy_addrEPS_ +_ZN6IPADDR9set_addr4EP7in_addr +_ZN6IPADDR9set_addr6EP8in6_addr +_ZN6IPADDRC1Ei +_ZN6IPADDRC1ERKS_ +_ZN6IPADDRC2Ei +_ZN6IPADDRC2ERKS_ +_ZNK6IPADDR10get_familyEv +_ZNK6IPADDR18get_port_net_orderEv +_ZNK6IPADDR8get_typeEv + +; alist.o +_ZN5alist4lastEv +_ZN5alist4nextEv +_ZN5alist4prevEv +_ZN5alist5firstEv +_ZN5alist7prependEPv +_ZN5ilist3putEiPv +_ZN8baselist11remove_itemEi +_ZN8baselist3getEi +_ZN8baselist6appendEPv +_ZN8baselist7destroyEv +_ZN8baselist9grow_listEv + +; attribs.o +_Z11decode_statPcP4statiPi +_Z11encode_statPcP4statiii +_Z11set_own_modP4ATTRPcjjt +_Z13decode_LinkFIPcP4stati +_Z14set_attributesP3JCRP4ATTRP5BFILE +_Z16encode_attribsExP3JCRPcP6FF_PKT +_Z16set_mod_own_timeP3JCRP5BFILEP4ATTR +_Z18select_data_streamP6FF_PKT +_Z9win_errorP3JCRiPKcPc +_Z9win_errorP3JCRPKcm +_Z9win_errorP3JCRPKcPc + +; attr.o +_Z15print_ls_outputP3JCRP4ATTRi +_Z24build_attr_output_fnamesP3JCRP4ATTR +_Z24unpack_attributes_recordP3JCRiPciP4ATTR +_Z8new_attrP3JCR +_Z9free_attrP4ATTR + +; base64.o +_Z11base64_initv +_Z11from_base64PxPc +_Z13base64_to_binPciS_i +_Z13bin_to_base64PciS_ii +_Z9to_base64xPc + +; berrno.o +_ZN6berrno20format_win32_messageEv +_ZN6berrno9bstrerrorEv + +; bfile.o +_Z10set_fattrsP5BFILEP4stat +_Z11bget_handleP5BFILE +_Z11int32_LE2BEPii +_Z11int64_LE2BEPxx +_Z14have_win32_apiv +_Z14set_cmd_pluginP5BFILEP3JCR +_Z15is_win32_streami +_Z15stream_to_asciii +_Z16set_win32_backupP5BFILE +_Z18is_portable_backupP5BFILE +_Z19set_portable_backupP5BFILE +_Z26processWin32BackupAPIBlockP5BFILEPvx +_Z27is_restore_stream_supportedi +_Z5binitP5BFILE +_Z5bopenP5BFILEPKcyt +_Z5breadP5BFILEPvy +_Z6bcloseP5BFILE +_Z6blseekP5BFILExi +_Z6bwriteP5BFILEPvy +_Z8is_bopenP5BFILE +_Z9pause_msgPKcS0_iS0_ + +; bget_msg.o +_Z8bget_msgP5BSOCK +_ZN6GetMsg14wait_read_sockEi +_ZN6GetMsg15start_read_sockEv +_ZN6GetMsg19do_read_sock_threadEv +_ZN6GetMsg7is_doneEv +_ZN6GetMsg7is_stopEv +_ZN6GetMsg8bget_msgEPP8bmessage +_ZN6GetMsg8is_errorEv +_ZN6GetMsgC1EP3JCRP5BSOCKPKci +_ZN6GetMsgC2EP3JCRP5BSOCKPKci +_ZN6GetMsgD0Ev +_ZN6GetMsgD1Ev +_ZN6GetMsgD2Ev +_ZN8bmessage4swapEP5BSOCK +_ZN8bmessageC1Ei +_ZN8bmessageC2Ei +_ZN8bmessageD0Ev +_ZN8bmessageD1Ev +_ZN8bmessageD2Ev + +; binflate.o +_Z8ZdeflatePciS_Ri +_Z8ZinflatePciS_Ri + +; bnet.o +_Z10init_bsockP3JCRiPKcS2_iP8sockaddr +_Z11read_nbytesP5BSOCKPci +_Z11resolv_hostiPKcP5dlist +_Z12write_nbytesP5BSOCKPci +_Z15bnet_tls_clientP11TLS_ContextP5BSOCKP5alist +_Z15bnet_tls_serverP11TLS_ContextP5BSOCKP5alist +_Z16set_socket_errnoi +_Z17bnet_host2ipaddrsPKciPS0_ +_Z17bnet_sig_to_asciii +_Z9dup_bsockP5BSOCK + +; bnet_server.o +_Z18bnet_thread_serverP5dlistiP9workq_tagPFPvS3_E +_Z23bnet_stop_thread_server14ptw32_handle_t + +; bpipe.o +_Z11run_programPciRS_ +_Z23run_program_full_outputPciRS_PS_ + +; bregex.o +b_regcomp +b_regerror +b_regexec +b_regfree +_Z24re_registers_to_regmatchP12re_registersP12b_regmatch_ty + +; breg.o +_Z11new_bregexpPKc +_Z12free_bregexpP7BREGEXP +_Z12get_bregexpsPKc +_Z13free_bregexpsP5alist +_Z14apply_bregexpsPKcP5alistPPc +_Z19bregexp_build_wherePciS_S_S_ +_Z21bregexp_escape_stringPcPKcc +_Z28bregexp_get_build_where_sizePcS_S_ +_ZN7BREGEXP10edit_substEPKcP12b_regmatch_t +_ZN7BREGEXP12return_fnameEPKci +_ZN7BREGEXP14extract_regexpEPKc +_ZN7BREGEXP16compute_dest_lenEPKcP12b_regmatch_t +_ZN7BREGEXP5debugEv +_ZN7BREGEXP7replaceEPKc + +; bsnprintf.o +_Z10bvsnprintfPciPKcS_ +_Z9bsnprintfPciPKcz + +; bsock.o +_Z14dump_bsock_msgijPKcjijPci +_Z9new_bsockv +_ZN13BSOCKCallbackC1Ev +_ZN13BSOCKCallbackC2Ev +_ZN13BSOCKCallbackD0Ev +_ZN13BSOCKCallbackD1Ev +_ZN13BSOCKCallbackD2Ev +_ZN5BSOCK11set_lockingEv +_ZN5BSOCK12set_blockingEv +_ZN5BSOCK12set_killableEb +_ZN5BSOCK13clear_lockingEv +_ZN5BSOCK13comm_compressEv +_ZN5BSOCK14wait_data_intrEii +_ZN5BSOCK15control_bwlimitEi +_ZN5BSOCK15set_buffer_sizeEji +_ZN5BSOCK15set_nonblockingEv +_ZN5BSOCK16restore_blockingEi +_ZN5BSOCK18set_source_addressEP5dlist +_ZN5BSOCK21authenticate_directorEPKcS1_P11TLS_ContextPci +_ZN5BSOCK4initEv +_ZN5BSOCK4openEP3JCRPKcPcS4_ixPi +_ZN5BSOCK4recvEv +_ZN5BSOCK4sendEi +_ZN5BSOCK5closeEv +_ZN5BSOCK5fsendEPKcz +_ZN5BSOCK6cancelEv +_ZN5BSOCK6signalEi +_ZN5BSOCK7connectEP3JCRixxPKcPcS4_ii +_ZN5BSOCK7despoolEPFvxEx +_ZN5BSOCK7destroyEv +_ZN5BSOCK8_destroyEv +_ZN5BSOCK8fin_initEP3JCRiPKcS3_iP8sockaddr +_ZN5BSOCK8free_tlsEv +_ZN5BSOCK8get_peerEPci +_ZN5BSOCK9bstrerrorEv +_ZN5BSOCK9wait_dataEii + +; bsys.o +_Z10b_strerroriPcy +_Z11bmicrosleepii +_Z11bstrcasecmpPKcS0_ +_Z11quote_wherePcPKc +_Z11stack_tracev +_Z12fd_wait_datai12fd_wait_modeii +_Z12quote_stringPcPKc +_Z12safer_unlinkPKcS0_ +_Z15create_pid_filePcPKci +_Z15delete_pid_filePcPKci +_Z15escape_filenamePKc +_Z15read_state_filePcPKci +_Z16create_lock_filePcPKcS1_PS_Pi +_Z16write_state_filePcPKci +_Z17fs_get_free_spacePKcPxS1_ +_Z20make_unique_filenamePPciS_ +_Z5bfreePv +_Z6bfgetsPciP6_iobuf +_Z6bfgetsRPcP6_iobuf +_Z6bfopenPKcS0_ +_Z7bacceptiP8sockaddrPi +_Z7bcallocyy +_Z7bstrcmpPKcS0_ +_Z7cstrlenPKc +_Z8b_mallocPKciy +_Z8breallocPvy +_Z8bstrncatPcPKci +_Z8bstrncatPcR8POOL_MEMi +_Z8bstrncpyPcPKci +_Z8bstrncpyPcR8POOL_MEMi +_Z8copyfilePKcS0_ +_Z9setup_envPPc + +; btime.o +_Z10bstrftimesPcix +_Z11date_decodedPjPhS0_ +_Z11date_encodejhh +_Z11time_decodedPhS_S_Pf +_Z11time_encodehhhf +_Z12bstrftime_dnPcix +_Z12bstrftime_ncPcix +_Z12bstrftime_nyPcix +_Z12str_to_utimePc +_Z13btime_to_unixx +_Z14btime_to_utimex +_Z16date_time_decodeP9date_timePjPhS2_S2_S2_S2_Pf +_Z16date_time_encodeP9date_timejhhhhhf +_Z16get_current_timeP9date_time +_Z17date_time_compareP9date_timeS0_ +_Z17get_current_btimev +_Z6tm_womii +_Z6tm_woyx +_Z7tm_ldomii +_Z9bstrftimePcix +_Z9bstrutimePcix +_Z9tm_decodeP9date_timeP2tm +_Z9tm_encodeP9date_timeP2tm + +; btimers.o +_Z16stop_bsock_timerP8btimer_t +_Z16stop_child_timerP8btimer_t +_Z17start_bsock_timerP5BSOCKj +_Z17start_child_timerP3JCRxj +_Z17stop_thread_timerP8btimer_t +_Z18start_thread_timerP3JCR14ptw32_handle_tj + +; compat.o +_Z10binet_ptoniPKcPv +_Z10open_bpipePciPKcPS_ +_Z11close_bpipeP5BPIPE +_Z11close_wpipeP5BPIPE +_Z11LogErrorMsgPKc +_Z11malloc_trimi +_Z11strncasecmpPKcS0_i +_Z11win32_cgetsPci +_Z11win32_chdirPKc +_Z11win32_chmodPKct +_Z11win32_fputsPKcP6_iobuf +_Z11win32_mkdirPKc +_Z12gettimeofdayP7timevalP8timezone +_Z12init_signalsPFviE +_Z12UTF8_2_wcharPPcPKc +_Z12wchar_2_UTF8PcPKwi +_Z12wchar_2_UTF8PPcPKw +_Z12win32_getcwdPci +_Z12win32_unlinkPKc +_Z15get_memory_infoPci +_Z15init_stack_dumpv +_Z15win32_ftruncateix +_Z16wchar_win32_pathPKcPw +_Z17SetVSSPathConvertPFivEPFiPKcPciEPFiPKwPwiE +_Z18CreateChildProcessPKcPvS1_S1_ +_Z18cvt_ftime_to_utimeRK9_FILETIME +_Z18cvt_utime_to_ftimeRKxR9_FILETIME +_Z18GetApplicationNamePKcPPcPS0_ +_Z18unix_name_to_win32PPcPKc +_Z20allow_os_suspensionsv +_Z21Win32ConvCleanupCachev +_Z22prevent_os_suspensionsv +_Z28make_win32_path_UTF8_2_wcharPPcPKcPi +_Z4forkv +_Z4killxi +_Z4pipePi +_Z4statPKcP4stat +_Z5chownPKcjj +_Z5dlsymPvPKc +_Z5fcntlii +_Z5fcntliil +_Z5fstatxP4stat +_Z5hstatPvP4stat +_Z5lstatPKcP4stat +_Z5sleepi +_Z6dlopenPKci +_Z6execvpPKcPPc +_Z6lchownPKcjj +_Z6randomv +_Z6syslogiPKcz +_Z7dlclosePv +_Z7dlerrorv +_Z7geteuidv +_Z7opendirPKc +_Z7openlogPKcii +_Z7srandomj +_Z7symlinkPKcS0_ +_Z7waitpidiPii +_Z8closedirPv +_Z8closelogv +_Z8getArgv0PKc +_Z8getgrgidj +_Z8getpwuidj +_Z8pathconfPKci +_Z8readlinkPKcPci +_Z8WSA_Initv +_Z9ErrorExitPKc +_Z9inet_atonPKcP7in_addr +_Z9readdir_rPvP6direntPS1_ +_ZN6winverC1Ev +_ZN6winverC2Ev + +; cram-md5.o +_Z16cram_md5_respondP5BSOCKPKcPiS3_ +_Z18cram_md5_challengeP5BSOCKPKcii + +; crc32.o +_Z6bcrc32Phi + +; create_file.o +_Z11create_fileP3JCRP4ATTRP5BFILEi + +; crypto.o +_Z13CryptoData_itv +_Z13SignerInfo_itv +_Z14CryptoData_newv +_Z14d2i_CryptoDataPP10CryptoDataPPKhl +_Z14d2i_SignerInfoPP10SignerInfoPPKhl +_Z14i2d_CryptoDataP10CryptoDataPPh +_Z14i2d_SignerInfoP10SignerInfoPPh +_Z14SignerInfo_newv +_Z15CryptoData_freeP10CryptoData +_Z15crypto_sign_newP3JCR +_Z15crypto_strerror14crypto_error_t +_Z15SignerInfo_freeP10SignerInfo +_Z16crypto_sign_freeP9Signature +_Z16RecipientInfo_itv +_Z16SignatureData_itv +_Z17crypto_cipher_newP14Crypto_SessionbPj +_Z17crypto_digest_newP3JCR15crypto_digest_t +_Z17d2i_RecipientInfoPP13RecipientInfoPPKhl +_Z17d2i_SignatureDataPP13SignatureDataPPKhl +_Z17i2d_RecipientInfoP13RecipientInfoPPh +_Z17i2d_SignatureDataP13SignatureDataPPh +_Z17RecipientInfo_newv +_Z17SignatureData_newv +_Z18crypto_cipher_freeP14Cipher_Context +_Z18crypto_digest_freeP6Digest +_Z18crypto_digest_nameP6Digest +_Z18crypto_keypair_dupP12X509_Keypair +_Z18crypto_keypair_newv +_Z18crypto_session_new15crypto_cipher_tP5alist +_Z18crypto_sign_decodeP3JCRPKhj +_Z18crypto_sign_encodeP9SignaturePhPj +_Z18crypto_sign_verifyP9SignatureP12X509_KeypairP6Digest +_Z18RecipientInfo_freeP13RecipientInfo +_Z18SignatureData_freeP13SignatureData +_Z19crypto_keypair_freeP12X509_Keypair +_Z19crypto_session_freeP14Crypto_Session +_Z20crypto_cipher_updateP14Cipher_ContextPKhjS2_Pj +_Z20crypto_digest_updateP6DigestPKhj +_Z21crypto_session_decodePKhjP5alistPP14Crypto_Session +_Z21crypto_session_encodeP14Crypto_SessionPhPj +_Z22crypto_cipher_finalizeP14Cipher_ContextPhPj +_Z22crypto_digest_finalizeP6DigestPhPj +_Z22crypto_keypair_has_keyPKc +_Z22crypto_sign_add_signerP9SignatureP6DigestP12X509_Keypair +_Z22crypto_sign_get_digestP9SignatureP12X509_KeypairR15crypto_digest_tPP6Digest +_Z23crypto_keypair_load_keyP12X509_KeypairPKcPFiPciPKvES5_ +_Z24crypto_keypair_load_certP12X509_KeypairPKc +_Z25crypto_digest_stream_typei +_Z27crypto_default_pem_callbackPciPKv + +; daemon.o +_Z12daemon_startv + +; dlist.o +_Z15new_dlistStringPKc +_Z15new_dlistStringPKci +_ZN5dlist12insert_afterEPvS0_ +_ZN5dlist13binary_insertEPvPFiS0_S0_E +_ZN5dlist13binary_searchEPvPFiS0_S0_E +_ZN5dlist13insert_beforeEPvS0_ +_ZN5dlist22binary_insert_multipleEPvPFiS0_S0_E +_ZN5dlist4nextEPv +_ZN5dlist4prevEPv +_ZN5dlist6appendEPv +_ZN5dlist6removeEPv +_ZN5dlist7destroyEv +_ZN5dlist7prependEPv + +; drivetype.o +_Z9drivetypePKcPci + +; edit.o +_Z10add_commasPcS_ +_Z10edit_int64xPc +_Z10edit_utimexPci +_Z11edit_uint64yPc +_Z11is_a_numberPKc +_Z12str_to_int64Pc +_Z13is_an_integerPKc +_Z13is_name_validPKcPPc +_Z13str_to_uint64Pc +_Z14size_to_uint64PciPy +_Z15speed_to_uint64PciPy +_Z16is_a_number_listPKc +_Z17duration_to_utimePcPx +_Z22edit_int64_with_commasxPc +_Z23edit_uint64_with_commasyPc +_Z23edit_uint64_with_suffixyPc + +; enable_priv.o +_Z24enable_backup_privilegesP3JCRi + +; find.o +_Z10find_filesP3JCRP6FF_PKTPFiS0_S2_bES4_ +_Z11accept_fileP6FF_PKT +_Z13is_in_filesetP6FF_PKT +_Z15init_find_filesv +_Z15term_find_filesP6FF_PKT +_Z16set_find_optionsP6FF_PKTix +_Z25set_find_changed_functionP6FF_PKTPFbP3JCRS0_E +_Z26set_find_snapshot_functionP6FF_PKTPFbP3JCRS0_P5dlistP11dlistStringE + +; find_one.o +_Z13check_changesP3JCRP6FF_PKT +_Z13find_one_fileP3JCRP6FF_PKTPFiS0_S2_bEPcjb +_Z13term_find_oneP6FF_PKT +_Z16has_file_changedP3JCRP6FF_PKT +_Z22ff_pkt_set_link_digestP6FF_PKTiPKcj + +; flist.o +_ZN5flist5queueEPv +_ZN5flist7dequeueEv +_ZN5flist7destroyEv + +; fnmatch.o +fnmatch + +; fstype.o +_Z13add_mtab_itemPvP4statPKcS3_S3_S3_ +_Z6fstypeP6FF_PKTPci +_Z9read_mtabPFvPvP4statPKcS3_S3_S3_ES_ + +; guid_to_name.o +_Z13new_guid_listv +_Z14free_guid_listP9guid_list +_ZN9guid_list11gid_to_nameEjPci +_ZN9guid_list11uid_to_nameEjPci + +; hmac.o +_Z8hmac_md5PhiS_iS_ + +; htable.o +_ZN6htable10grow_tableEv +_ZN6htable10hash_indexEPc +_ZN6htable10hash_indexEy +_ZN6htable11hash_mallocEi +_ZN6htable13hash_big_freeEv +_ZN6htable14malloc_big_bufEi +_ZN6htable4initEPvS0_i +_ZN6htable4nextEv +_ZN6htable4sizeEv +_ZN6htable5firstEv +_ZN6htable5statsEv +_ZN6htable6insertEPcPv +_ZN6htable6insertEyPv +_ZN6htable6lookupEPc +_ZN6htable6lookupEy +_ZN6htable7destroyEv +_ZN6htableC1EPvS0_i +_ZN6htableC2EPvS0_i + +; ini.o +_Z13ini_store_strP13s_lex_contextP10ConfigFileP9ini_items +_Z14ini_store_boolP13s_lex_contextP10ConfigFileP9ini_items +_Z14ini_store_dateP13s_lex_contextP10ConfigFileP9ini_items +_Z14ini_store_nameP13s_lex_contextP10ConfigFileP9ini_items +_Z15ini_store_int32P13s_lex_contextP10ConfigFileP9ini_items +_Z15ini_store_int64P13s_lex_contextP10ConfigFileP9ini_items +_Z16ini_store_pint32P13s_lex_contextP10ConfigFileP9ini_items +_Z16ini_store_pint64P13s_lex_contextP10ConfigFileP9ini_items +_Z18ini_get_store_codePFbP13s_lex_contextP10ConfigFileP9ini_itemsE +_Z19ini_store_alist_strP13s_lex_contextP10ConfigFileP9ini_items +_Z21ini_get_store_handlerPKc +_ZN10ConfigFile10free_itemsEv +_ZN10ConfigFile11clear_itemsEv +_ZN10ConfigFile11dump_stringEPKci +_ZN10ConfigFile11unserializeEPKc +_ZN10ConfigFile12dump_resultsEPPc +_ZN10ConfigFile5parseEPKc +_ZN10ConfigFile5parseEv +_ZN10ConfigFile8get_itemEPKc +_ZN10ConfigFile9parse_bufEPKc +_ZN10ConfigFile9serializeEPKc +_ZN10ConfigFile9serializeEPPc +_ZN10ConfigFileD0Ev +_ZN10ConfigFileD1Ev + +; jcr.o +_Z10b_free_jcrPKciP3JCR +_Z11unlock_jobsv +_Z12jcr_walk_endP3JCR +_Z12job_end_pushP3JCRPFvS0_PvES1_ +_Z13dbg_print_jcrP6_iobuf +_Z13get_jcr_by_idj +_Z13jcr_walk_nextP3JCR +_Z14create_jcr_keyv +_Z14jcr_walk_startv +_Z14set_jcr_in_tsdP3JCR +_Z16dbg_jcr_add_hookPFvP3JCRP6_iobufE +_Z16get_jcr_from_tsdv +_Z18get_jcr_by_sessionjj +_Z18get_jobid_from_tid14ptw32_handle_t +_Z18get_jobid_from_tsdv +_Z18init_jcr_subsystemv +_Z19init_last_jobs_listv +_Z19lock_last_jobs_listv +_Z19read_last_jobs_listiy +_Z19remove_jcr_from_tsdP3JCR +_Z19term_last_jobs_listv +_Z20get_jcr_by_full_namePc +_Z20write_last_jobs_listiy +_Z21unlock_last_jobs_listv +_Z23get_jcr_by_partial_namePc +_Z24get_next_jobid_from_listPPcPj +_Z7new_jcriPFvP3JCRE +_Z9job_countv +_Z9lock_jobsv +_ZN3JCR12setJobStatusEi +_ZN3JCR12set_killableEb +_ZN3JCR13sendJobStatusEi +_ZN3JCR13sendJobStatusEv +_ZN3JCR13setJobStartedEv +_ZN3JCR14can_be_stoppedEv +_ZN3JCR14get_ActionNameEb +_ZN3JCR17get_OperationNameEv +_ZN3JCR21my_thread_send_signalEi +_ZN3JCR8JobReadsEv + +; lex.o +_Z11scan_to_eolP13s_lex_context +_Z12lex_get_charP13s_lex_context +_Z12lex_open_bufP13s_lex_contextPKcPFvS2_iS0_S2_zE +_Z13lex_check_eolP13s_lex_context +_Z13lex_get_tokenP13s_lex_contexti +_Z13lex_open_fileP13s_lex_contextPKcPFvS2_iS0_S2_zE +_Z14lex_close_fileP13s_lex_context +_Z14lex_tok_to_stri +_Z14lex_unget_charP13s_lex_context +_Z20scan_to_next_not_eolP13s_lex_context +_Z25lex_store_clear_passwordsP13s_lex_context +_Z29lex_set_default_error_handlerP13s_lex_context +_Z32lex_set_error_handler_error_typeP13s_lex_contexti + +; lockmgr.o +_Z14dbg_print_lockP6_iobuf +_Z18bthread_change_uidjj +_Z21bthread_get_thread_idv +_Z6lmgr_pPP16pthread_mutex_t_ +_Z6lmgr_vPP16pthread_mutex_t_ + +; lz4.o +_Z23LZ4_compress_fast_forcePKcPciii +_Z25LZ4_compress_forceExtDictP12LZ4_stream_uPKcPci +_Z32LZ4_decompress_safe_forceExtDictPKcPciiS0_i + +; match.o +_Z11match_filesP3JCRP6FF_PKTPFiS0_S2_bE +_Z16file_is_excludedP6FF_PKTPKc +_Z16file_is_includedP6FF_PKTPKc +_Z22get_next_included_fileP6FF_PKTP15s_included_file +_Z25add_fname_to_exclude_listP6FF_PKTPKc +_Z25add_fname_to_include_listP6FF_PKTiPKc +_Z26term_include_exclude_filesP6FF_PKT + +; md5.o +_Z11byteReversePhj +_Z12MD5TransformPjS_ +_Z7MD5InitP10MD5Context +_Z8MD5FinalPhP10MD5Context +_Z9MD5UpdateP10MD5ContextPhj + +; mem_pool.o +_Z13sm_get_memoryPKcii +_Z17close_memory_poolv +_Z18sm_get_pool_memoryPKcii +_Z19sm_free_pool_memoryPKciPc +_Z21sm_sizeof_pool_memoryPKciPc +_Z22garbage_collect_memoryv +_Z22sm_realloc_pool_memoryPKciPci +_Z23print_memory_pool_statsv +_Z25sm_check_pool_memory_sizePKciPci +_Z27garbage_collect_memory_poolv +_Z9pm_memcpyPPcPKci +_Z9pm_memcpyR8POOL_MEMPKci +_Z9pm_memcpyRPcPKci +_Z9pm_memcpyRPcR8POOL_MEMi +_Z9pm_strcatPPcPKc +_Z9pm_strcatR8POOL_MEMPKc +_Z9pm_strcatR8POOL_MEMS0_ +_Z9pm_strcatRPcPKc +_Z9pm_strcatRPcR8POOL_MEM +_Z9pm_strcpyPPcPKc +_Z9pm_strcpyR8POOL_MEMPKc +_Z9pm_strcpyRPcPKc +_Z9pm_strcpyRPcR8POOL_MEM +_ZN8POOL_MEM10realloc_pmEi +_ZN8POOL_MEM6strcatEPKc +_ZN8POOL_MEM6strcpyEPKc +_ZN8POOL_MEM8max_sizeEv + +; message.o +_Z10get_blowupv +_Z10get_hangupv +_Z10my_name_isiPPcPKc +_Z10set_blowupi +_Z10set_hangupi +_Z12add_msg_destP4MSGSiiPcS1_ +_Z12get_basenamePKc +_Z12rem_msg_destP4MSGSiiPc +_Z13debug_get_tagjPPKc +_Z13free_msgs_resP4MSGS +_Z14debug_find_tagPKcbPx +_Z14set_assert_msgPKciS0_ +_Z15set_debug_flagsPc +_Z16debug_parse_tagsPKcPx +_Z16dequeue_messagesP3JCR +_Z16dispatch_messageP3JCRixPc +_Z16init_console_msgPKc +_Z18set_db_engine_namePKc +_Z19is_message_type_setP3JCRi +_Z20handle_hangup_blowupP3JCRjy +_Z21generate_daemon_eventP3JCRPKc +_Z25free_daemon_message_queuev +_Z25register_message_callbackPFviPcE +_Z26setup_daemon_message_queuev +_Z4JmsgP3JCRixPKcz +_Z4MmsgPPcPKcz +_Z4MmsgR8POOL_MEMPKcz +_Z4MmsgRPcPKcz +_Z4QmsgP3JCRixPKcz +_Z5d_msgPKcixS0_z +_Z5e_msgPKciiiS0_z +_Z5j_msgPKciP3JCRixS0_z +_Z5m_msgPKciPPcS0_z +_Z5m_msgPKciRPcS0_z +_Z5p_msgPKciiS0_z +_Z5q_msgPKciP3JCRixS0_z +_Z5t_msgPKcixS0_z +_Z6vd_msgPKcixS0_Pc +_Z8init_msgP3JCRP4MSGSPFPcS0_PKcS3_iE +_Z8term_msgv +_Z9close_msgP3JCR +_Z9get_tracev +_Z9set_tracei +_ZN4MSGS15wait_not_in_useEv +_ZN4MSGS4lockEv +_ZN4MSGS6unlockEv + +; mkpath.o +_Z13path_list_addP3JCRjPc +_Z14free_path_listP3JCR +_Z16path_list_lookupP3JCRPc +_Z8makepathP4ATTRPKcttjji + +; openssl.o +_Z11init_cryptov +_Z14cleanup_cryptov +_Z19openssl_post_errorsiPKc +_Z19openssl_post_errorsP3JCRiPKc + +; output.o +_ZN12OutputWriter10get_outputE10OutputTypez +_ZN12OutputWriter10get_outputEPcPS0_10OutputType +_ZN12OutputWriter10get_outputEPPc10OutputTypez +_ZN12OutputWriter10start_listEPKcb +_ZN12OutputWriter11get_optionsEPc +_ZN12OutputWriter11start_groupEPKcb +_ZN12OutputWriter13parse_optionsEPKc +_ZN12OutputWriter7get_bufEb +_ZN12OutputWriter8end_listEb +_ZN12OutputWriter9end_groupEb +_ZN12OutputWriterD0Ev +_ZN12OutputWriterD1Ev + +; plugins.o +_Z10new_pluginv +_Z12load_pluginsPvS_PKcS1_PFbP6PluginE +_Z14unload_pluginsv +_Z16dbg_print_pluginP6_iobuf +_Z19dbg_plugin_add_hookPFvP6PluginP6_iobufE + +; print.o +_Z10__snprintfPcyPKcz +_Z10__vsprintfPcPKcS_ +_Z11__vsnprintfPcyPKcS_ +_Z4doprPcyPKcS_PFvS_PyyiE +_Z9__sprintfPcPKcz + +; priv.o +_Z4dropPcS_b + +; queue.o +_Z5qnextP7b_queueS0_ +_Z7qdchainP7b_queue +_Z7qinsertP7b_queueS0_ +_Z7qremoveP7b_queue + +; rblist.o +_ZN6rblist11left_rotateEPv +_ZN6rblist12right_rotateEPv +_ZN6rblist3anyEPv +_ZN6rblist4nextEPv +_ZN6rblist5firstEv +_ZN6rblist6insertEPvPFiS0_S0_E +_ZN6rblist6removeEPv +_ZN6rblist6searchEPvPFiS0_S0_E +_ZN6rblist7destroyEv + +; runscript.o +_Z11run_scriptsP3JCRP5alistPKc +_Z13new_runscriptv +_Z14copy_runscriptP9RUNSCRIPT +_Z14free_runscriptP9RUNSCRIPT +_Z15free_runscriptsP5alist +_ZN9RUNSCRIPT10set_targetEPKc +_ZN9RUNSCRIPT11set_commandEPKci +_ZN9RUNSCRIPT13reset_defaultEb +_ZN9RUNSCRIPT21set_job_code_callbackEPFPcP3JCRPKcS0_iE +_ZN9RUNSCRIPT3runEP3JCRPKc +_ZN9RUNSCRIPT5debugEv +_ZN9RUNSCRIPT8is_localEv + +; rwlock.o +_Z11rwl_destroyP12s_rwlock_tag +_Z12is_rwl_validP12s_rwlock_tag +_Z12rwl_readlockP12s_rwlock_tag +_Z14rwl_readunlockP12s_rwlock_tag +_Z15rwl_readtrylockP12s_rwlock_tag +_Z15rwl_writelock_pP12s_rwlock_tagPKci +_Z15rwl_writeunlockP12s_rwlock_tag +_Z16rwl_writetrylockP12s_rwlock_tag +_Z8rwl_initP12s_rwlock_tagi + +; scan.o +_Z10parse_argsPcPS_PiS0_S0_i +_Z11skip_spacesPPc +_Z14skip_nonspacesPPc +_Z15parse_args_onlyPcPS_PiS0_S0_i +_Z19strip_leading_spacePc +_Z19strip_trailing_junkPc +_Z22strip_trailing_newlinePc +_Z22strip_trailing_slashesPc +_Z23split_path_and_filenamePKcPPcPiS2_S3_ +_Z7bsscanfPKcS0_z +_Z7fstrschPKcS0_ +_Z8next_argPPc +_Z9next_namePPc + +; sellist.o +_ZN7sellist10set_stringEPKcb +_ZN7sellist17get_expanded_listEv +_ZN7sellist4nextEv + +; serial.o +_Z12serial_btimePPhx +_Z12serial_int16PPhs +_Z12serial_int32PPhi +_Z12serial_int64PPhx +_Z13serial_stringPPhPKc +_Z13serial_uint16PPht +_Z13serial_uint32PPhj +_Z13serial_uint64PPhy +_Z14serial_float64PPhd +_Z14unserial_btimePPh +_Z14unserial_int16PPh +_Z14unserial_int32PPh +_Z14unserial_int64PPh +_Z15unserial_stringPPhPci +_Z15unserial_uint16PPh +_Z15unserial_uint32PPh +_Z15unserial_uint64PPh +_Z16unserial_float64PPh + +; sha1.o +_Z10SHA1UpdateP11SHA1ContextPKhj +_Z8SHA1InitP11SHA1Context +_Z9SHA1FinalP11SHA1ContextPh + +; signal.o + +; smartall.o +_Z10sm_reallocPKciPvj +_Z12actuallyfreePv +_Z12sm_check_rtnPKcib +_Z12sm_new_ownerPKciPc +_Z14actuallycallocjj +_Z14actuallymallocj +_Z15actuallyreallocPvj +_Z7bmemsetPviy +_Z7sm_dumpbb +_Z7sm_freePKciPv +_Z8sm_checkPKcib +_Z9sm_callocPKcijj +_Z9sm_mallocPKcij +_Z9sm_staticb + +; tls.o +_Z14get_tls_enableP11TLS_Context +_Z15get_tls_requireP11TLS_Context +_Z15new_tls_contextPKcS0_S0_S0_PFiPciPKvES3_S0_b +_Z15tls_bsock_probeP5BSOCK +_Z15tls_bsock_readnP5BSOCKPci +_Z16free_tls_contextP11TLS_Context +_Z16tls_bsock_acceptP5BSOCK +_Z16tls_bsock_writenP5BSOCKPci +_Z17tls_bsock_connectP5BSOCK +_Z18new_tls_connectionP11TLS_Contexti +_Z18tls_bsock_shutdownP5BSOCK +_Z19free_tls_connectionP14TLS_Connection +_Z25tls_postconnect_verify_cnP3JCRP14TLS_ConnectionP5alist +_Z27tls_postconnect_verify_hostP3JCRP14TLS_ConnectionPKc + +; tree.o +_Z11tree_relcwdPcP11s_tree_rootP11s_tree_node +_Z12tree_getpathP11s_tree_nodePci +_Z14make_tree_pathPcP11s_tree_root +_Z16insert_tree_nodePcS_iP11s_tree_rootP11s_tree_node +_Z16tree_remove_nodeP11s_tree_rootP11s_tree_node +_Z19tree_add_delta_partP11s_tree_rootP11s_tree_nodeji +_Z8new_treei +_Z8tree_cwdPcP11s_tree_rootP11s_tree_node +_Z9free_treeP11s_tree_root + +; util.o +_Z11bash_spacesPc +_Z11bash_spacesR8POOL_MEM +_Z11encode_modetPc +_Z11encode_timexPc +_Z11is_buf_zeroPKci +_Z13unbash_spacesPc +_Z13unbash_spacesR8POOL_MEM +_Z14edit_job_codesP3JCRPcS1_PKcPFS1_S0_S3_S1_iE +_Z15is_power_of_twoy +_Z15job_type_to_stri +_Z16job_level_to_stri +_Z16make_session_keyPcS_i +_Z17job_status_to_strii +_Z18decode_session_keyPcS_S_i +_Z18do_shell_expansionPci +_Z18encode_session_keyPcS_S_i +_Z18jobstatus_to_asciiiPci +_Z19last_path_separatorPKc +_Z20volume_status_to_strPKc +_Z21set_working_directoryPc +_Z22jobstatus_to_ascii_guiiPci +_Z25action_on_purge_to_stringiR8POOL_MEM +_Z5lcasePc +_Z7hexdumpPKciPcib +_Z7is_nullPKv +_Z8bmemzeroPvy +_Z9asciidumpPKciPci +_Z9smartdumpPKciPciPb + +; var.o +_Z10var_configP6var_st12var_config_tz +_Z10var_createPP6var_st +_Z10var_expandP6var_stPKciPPcPii +_Z10var_formatP6var_stPPciPKcz +_Z11var_destroyP6var_st +_Z11var_formatvP6var_stPPciPKcS1_ +_Z12var_strerrorP6var_st8var_rc_t +_Z12var_unescapeP6var_stPKciPcii + +; watchdog.o +_Z11is_watchdogv +_Z12new_watchdogv +_Z13stop_watchdogv +_Z14start_watchdogv +_Z17register_watchdogP12s_watchdog_t +_Z19unregister_watchdogP12s_watchdog_t + +; win32filter.o +_ZN11Win32Filter9have_dataEPPcPxS2_ + +; winapi.o +_Z17InitWinAPIWrapperv + +; worker.o +_ZN6worker11finish_workEv +_ZN6worker12release_lockEv +_ZN6worker13discard_queueEv +_ZN6worker13set_run_stateEv +_ZN6worker14set_quit_stateEv +_ZN6worker14set_wait_stateEv +_ZN6worker15pop_free_bufferEv +_ZN6worker16push_free_bufferEPv +_ZN6worker16wait_queue_emptyEv +_ZN6worker4initEi +_ZN6worker4stopEv +_ZN6worker4waitEv +_ZN6worker5queueEPv +_ZN6worker5startEPFPvS0_ES0_ +_ZN6worker7dequeueEv +_ZN6worker7destroyEv + +; workq.o +_Z10workq_initP9workq_tagiPFPvS1_E +_Z12workq_removeP9workq_tagP13workq_ele_tag +_Z13workq_destroyP9workq_tag +_Z15workq_wait_idleP9workq_tag +_Z9workq_addP9workq_tagPvPP13workq_ele_tagi + +console_command DATA +b_plugin_list DATA +plugin_bopen DATA +plugin_bclose DATA +plugin_bwrite DATA +plugin_bread DATA +plugin_blseek DATA +exepath DATA +version DATA +dist_name DATA diff --git a/bacula/src/win32/lib/make_def32 b/bacula/src/win32/lib/make_def32 new file mode 100755 index 0000000000..04ec04ab3b --- /dev/null +++ b/bacula/src/win32/lib/make_def32 @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Make the stupid bacula.def file so that we don't have to do it +# manually +# +# Kern Sibbald, June 2007 +# + +TOPDIR=`(cd ../../..;pwd)` +TOPDIR=${DEPKGS:-${TOPDIR}} +NM=i686-w64-mingw32-nm + +echo "LIBRARY bacula.dll" +echo "EXPORTS" +echo " " + +cd obj32 +# remove "static" objects before running +rm -f parse_conf.* res.* + +for i in *.o ; do \ + echo "; $i"; \ + ${NM} $i | grep "^[0-9a-f]* T _" | cut -c13- ; \ + echo " "; \ +done + +DATA="console_command b_plugin_list plugin_bopen plugin_bclose plugin_bwrite plugin_bread plugin_blseek exepath version dist_name" + +for i in ${DATA}; do \ + echo "$i DATA"; \ +done diff --git a/bacula/src/win32/lib/make_def64 b/bacula/src/win32/lib/make_def64 new file mode 100755 index 0000000000..9a8682cde8 --- /dev/null +++ b/bacula/src/win32/lib/make_def64 @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Make the stupid bacula.def file so that we don't have to do it +# manually +# +# Kern Sibbald, June 2007 +# + +TOPDIR=`(cd ../../..;pwd)` +TOPDIR=${DEPKGS:-${TOPDIR}} +NM=x86_64-w64-mingw32-nm + +echo "LIBRARY bacula.dll" +echo "EXPORTS" +echo " " + +cd obj64 +# remove "static" objects before running +rm -f parse_conf.* res.* + +for i in `ls *.o | grep -v -e parse_conf.o -e res.o`; do \ + echo "; $i"; \ + ${NM} $i | grep -e "^[0-9a-f]* T _" -e "^[0-9a-f]* T b_reg" -e "^[0-9a-f]* T fnmatch" | cut -c20- ; \ + echo " "; \ +done + +DATA="console_command b_plugin_list plugin_bopen plugin_bclose plugin_bwrite plugin_bread plugin_blseek exepath version dist_name" + +for i in ${DATA}; do \ + echo "$i DATA"; \ +done diff --git a/bacula/src/win32/libbac/Makefile b/bacula/src/win32/libbac/Makefile new file mode 100644 index 0000000000..d19adc35f4 --- /dev/null +++ b/bacula/src/win32/libbac/Makefile @@ -0,0 +1,111 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written for Bacula by Howard Thomson, April 2006 +# for building using cross-complilation. +# + +include ../Makefile.inc + +INCLUDES = \ + $(INCLUDE_GCC) \ + $(INCLUDE_MINGW) \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_VSS) \ + $(INCLUDE_ICONS) \ + $(INCLUDE_OPENSSL) + +DEFINES = \ + -DWIN32 \ + $(HAVES) + +###################################################################### + +# Files files in src/lib + +LIB_OBJS = \ + $(OBJDIR)/address_conf.o \ + $(OBJDIR)/alist.o \ + $(OBJDIR)/attr.o \ + $(OBJDIR)/base64.o \ + $(OBJDIR)/berrno.o \ + $(OBJDIR)/bget_msg.o \ + $(OBJDIR)/bnet.o \ + $(OBJDIR)/bnet_server.o \ + $(OBJDIR)/bpipe.o \ + $(OBJDIR)/bregex.o \ + $(OBJDIR)/bshm.o \ + $(OBJDIR)/bsnprintf.o \ + $(OBJDIR)/bsock.o \ + $(OBJDIR)/bsys.o \ + $(OBJDIR)/btime.o \ + $(OBJDIR)/btimers.o \ + $(OBJDIR)/cram-md5.o \ + $(OBJDIR)/crc32.o \ + $(OBJDIR)/crypto.o \ + $(OBJDIR)/daemon.o \ + $(OBJDIR)/dlist.o \ + $(OBJDIR)/edit.o \ + $(OBJDIR)/enh_fnmatch.o \ + $(OBJDIR)/fnmatch.o \ + $(OBJDIR)/hmac.o \ + $(OBJDIR)/htable.o \ + $(OBJDIR)/idcache.o \ + $(OBJDIR)/jcr.o \ + $(OBJDIR)/lex.o \ + $(OBJDIR)/md5.o \ + $(OBJDIR)/mem_pool.o \ + $(OBJDIR)/message.o \ + $(OBJDIR)/openssl.o \ + $(OBJDIR)/parse_conf.o \ + $(OBJDIR)/pythonlib.o \ + $(OBJDIR)/queue.o \ + $(OBJDIR)/rblist.o \ + $(OBJDIR)/res.o \ + $(OBJDIR)/runscript.o \ + $(OBJDIR)/rwlock.o \ + $(OBJDIR)/scan.o \ + $(OBJDIR)/serial.o \ + $(OBJDIR)/sha1.o \ + $(OBJDIR)/signal.o \ + $(OBJDIR)/smartall.o \ + $(OBJDIR)/tls.o \ + $(OBJDIR)/tree.o \ + $(OBJDIR)/util.o \ + $(OBJDIR)/var.o \ + $(OBJDIR)/watchdog.o \ + $(OBJDIR)/winapi.o \ + $(OBJDIR)/workq.o \ + $(OBJDIR)/lockmgr.o + +# $(LIBDIR)/events.o + +###################################################################### + +# Targets + +.PHONY: all clean + +all: $(LIBDIR)/libbac.a + +clean: + @echo "Cleaning `pwd`" + $(ECHO_CMD)rm -f $(OBJDIR)/*.[od] $(LIBDIR)/libbac.a + +# +# Rules +# + +$(LIBDIR)/libbac.a: $(LIB_OBJS) + @echo "Updating archive $@" + $(call checkdir,$@) + $(ECHO_CMD)$(AR) rs $@ $^ + +include ../Makefile.rules + +ifneq ($(MAKECMDGOALS),clean) +include $(patsubst %.o,%.d,$(filter-out %.res,$(LIB_OBJS))) +endif diff --git a/bacula/src/win32/libbac/libbac.vcproj b/bacula/src/win32/libbac/libbac.vcproj new file mode 100644 index 0000000000..d8e1c6c8c1 --- /dev/null +++ b/bacula/src/win32/libbac/libbac.vcproj @@ -0,0 +1,1733 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/libbac/msvc/bacula.def b/bacula/src/win32/libbac/msvc/bacula.def new file mode 100644 index 0000000000..86830d1dfd --- /dev/null +++ b/bacula/src/win32/libbac/msvc/bacula.def @@ -0,0 +1,510 @@ +LIBRARY bacula.dll +EXPORTS + +; address_conf.obj +?get_port_net_order@IPADDR@@QBEGXZ +?get_address@IPADDR@@QAEPBDPADH@Z +?get_first_address@@YAPBDPAVdlist@@PADH@Z +?get_first_port_host_order@@YAHPAVdlist@@@Z +?init_default_addresses@@YAXPAPAVdlist@@H@Z +?store_addresses@@YAXPAUs_lex_context@@PAURES_ITEM@@HH@Z +?store_addresses_address@@YAXPAUs_lex_context@@PAURES_ITEM@@HH@Z +?store_addresses_port@@YAXPAUs_lex_context@@PAURES_ITEM@@HH@Z +?free_addresses@@YAXPAVdlist@@@Z +?sockaddr_get_port_net_order@@YAHPBUsockaddr@@@Z +?sockaddr_to_ascii@@YAPADPBUsockaddr@@PADH@Z + +; alist.obj +?first@alist@@QAEPAXXZ +?next@alist@@QAEPAXXZ +?prepend@alist@@QAEXPAX@Z +?append@alist@@QAEXPAX@Z +?remove@alist@@QAEPAXH@Z +?get@alist@@QAEPAXH@Z +?destroy@alist@@QAEXXZ + +; attr.obj +?new_attr@@YAPAUATTR@@XZ +?free_attr@@YAXPAUATTR@@@Z +?unpack_attributes_record@@YAHPAVJCR@@JPADPAUATTR@@@Z +?build_attr_output_fnames@@YAXPAVJCR@@PAUATTR@@@Z +?print_ls_output@@YAXPAVJCR@@PAUATTR@@@Z + +; attribs.obj +?select_data_stream@@YAHPAUFF_PKT@@@Z +?encode_stat@@YAXPADPAUFF_PKT@@H@Z +?decode_stat@@YAHPADPAUstat@@PAJ@Z +?decode_LinkFI@@YAJPADPAUstat@@@Z +?set_attributes@@YA_NPAVJCR@@PAUATTR@@PAUBFILE@@@Z +?encode_attribsEx@@YAHPAVJCR@@PADPAUFF_PKT@@@Z + +; base64.obj +?bin_to_base64@@YAHPADH0HH@Z + +; berrno.obj +?strerror@berrno@@QAEPBDXZ +?format_win32_message@berrno@@AAEXXZ + +; bfile.obj +?is_win32_stream@@YA_NH@Z +?stream_to_ascii@@YAPBDH@Z +?processWin32BackupAPIBlock@@YA_NPAUBFILE@@PAXH@Z +?binit@@YAXPAUBFILE@@@Z +?set_portable_backup@@YA_NPAUBFILE@@@Z +?set_prog@@YA_NPAUBFILE@@PADPAVJCR@@@Z +?is_portable_backup@@YA_NPAUBFILE@@@Z +?have_win32_api@@YA_NXZ +?is_restore_stream_supported@@YA_NH@Z +?bopen@@YAHPAUBFILE@@PBDHI@Z +?bclose@@YAHPAUBFILE@@@Z +?bread@@YAHPAUBFILE@@PAXI@Z +?bwrite@@YAHPAUBFILE@@PAXI@Z +?is_bopen@@YA_NPAUBFILE@@@Z +?blseek@@YA_JPAUBFILE@@_JH@Z + +; bget_msg.obj +?bget_msg@@YAHPAVBSOCK@@@Z + +; bnet.obj +?bnet_recv@@YAJPAVBSOCK@@@Z +?is_bnet_stop@@YA_NPAVBSOCK@@@Z +?is_bnet_error@@YAHPAVBSOCK@@@Z +?bnet_suppress_error_messages@@YAXPAVBSOCK@@_N@Z +?bnet_despool_to_bsock@@YAHPAVBSOCK@@P6AXH@ZH@Z +?bnet_send@@YA_NPAVBSOCK@@@Z +?bnet_tls_server@@YA_NPAUTLS_Context@@PAVBSOCK@@PAValist@@@Z +?bnet_tls_client@@YA_NPAUTLS_Context@@PAVBSOCK@@@Z +?bnet_wait_data@@YAHPAVBSOCK@@H@Z +?bnet_wait_data_intr@@YAHPAVBSOCK@@H@Z +?bnet_connect@@YAPAVBSOCK@@PAVJCR@@HHPBDPAD2HH@Z +?bnet_strerror@@YAPBDPAVBSOCK@@@Z +?bnet_fsend@@YA_NPAVBSOCK@@PBDZZ +?bnet_get_peer@@YAHPAVBSOCK@@PADH@Z +?bnet_set_buffer_size@@YA_NPAVBSOCK@@IH@Z +?bnet_sig@@YA_NPAVBSOCK@@H@Z +?bnet_sig_to_ascii@@YAPBDPAVBSOCK@@@Z +?bnet_close@@YAXPAVBSOCK@@@Z +?term_bsock@@YAXPAVBSOCK@@@Z + +; bnet_server.obj +?bnet_stop_thread_server@@YAXPAUpthread_t_@@@Z +?bnet_thread_server@@YAXPAVdlist@@HPAUworkq_tag@@P6APAXPAX@Z@Z + +; bpipe.obj +?run_program@@YAHPADH0@Z +?run_program_full_output@@YAHPADH0@Z + +; bregex.obj +b_regcomp +b_regexec +b_regerror +b_regfree + +; bsnprintf.obj +?bsnprintf@@YAHPADJPBDZZ +?bvsnprintf@@YAHPADJPBD0@Z + +; bsock.obj +?close@BSOCK@@QAEXXZ +?dup_bsock@@YAPAVBSOCK@@PAV1@@Z +?fsend@BSOCK@@QAA_NPBDZZ +?init_bsock@@YAPAVBSOCK@@PAVJCR@@HPBD1HPAUsockaddr@@@Z +?recv@BSOCK@@QAEJXZ +?send@BSOCK@@QAE_NXZ +?signal@BSOCK@@QAE_NH@Z + +; bsys.obj +?bmicrosleep@@YAHJJ@Z +?bstrncpy@@YAPADPADPBDH@Z +?bstrncpy@@YAPADPADAAVPOOL_MEM@@H@Z +?bstrncat@@YAPADPADPBDH@Z +?bstrcmp@@YA_NPBD0@Z +?cstrlen@@YAHPBD@Z +?bfree@@YAXPAX@Z +?b_malloc@@YAPAXPBDHI@Z +?brealloc@@YAPAXPAXI@Z +?_p@@YAXPAPAUpthread_mutex_t_@@@Z +?_v@@YAXPAPAUpthread_mutex_t_@@@Z +?create_pid_file@@YAXPADPBDH@Z +?delete_pid_file@@YAHPADPBDH@Z +?read_state_file@@YAXPADPBDH@Z +?write_state_file@@YAXPADPBDH@Z +?drop@@YAXPAD0@Z +?bfgets@@YAPADPADHPAU_iobuf@@@Z +?escape_filename@@YAPADPBD@Z + +; btime.obj +?bstrftime@@YAPADPADH_J@Z +?bstrftimes@@YAPADPADH_J@Z +?bstrftime_nc@@YAPADPADH_J@Z +?bstrutime@@YAPADPADH_J@Z +?str_to_utime@@YA_JPAD@Z +?get_current_btime@@YA_JXZ +?btime_to_unix@@YAJ_J@Z +?btime_to_utime@@YA_J_J@Z +?tm_woy@@YAHJ@Z +?get_current_time@@YAXPAUdate_time@@@Z +?tm_decode@@YAXPAUdate_time@@PAUtm@@@Z + +; btimers.obj +?start_thread_timer@@YAPAUs_btimer_t@@PAUpthread_t_@@I@Z +?start_bsock_timer@@YAPAUs_btimer_t@@PAVBSOCK@@I@Z +?stop_bsock_timer@@YAXPAUs_btimer_t@@@Z +?stop_thread_timer@@YAXPAUs_btimer_t@@@Z + +; compat.obj +?SetVSSPathConvert@@YAXP6AHPBDPADH@ZP6AHPB_WPA_WH@Z@Z +?wchar_2_UTF8@@YAHPADPB_WH@Z +?random@@YAJXZ +?srandom@@YAXI@Z +?fstat@@YAHHPAUstat@@@Z +?stat@@YAHPBDPAU0@@Z +?fcntl@@YAHHHJ@Z +?lstat@@YAHPBDPAUstat@@@Z +?sleep@@YAXH@Z +?strcasecmp@@YAHPBD0@Z +?gettimeofday@@YAHPAUtimeval@@PAUtimezone@@@Z +?opendir@@YAPAXPBD@Z +?closedir@@YAHPAX@Z +?readdir_r@@YAHPAXPAUdirent@@PAPAU1@@Z +?init_signals@@YAXP6AXH@Z@Z +?init_stack_dump@@YAXXZ +?pathconf@@YAJPBDH@Z +?WSA_Init@@YAHXZ +?win32_fputs@@YAHPBDPAU_iobuf@@@Z +?win32_cgets@@YAPADPADH@Z +?win32_unlink@@YAHPBD@Z +?open_bpipe@@YAPAVBPIPE@@PADHPBD@Z +?kill@@YAHHH@Z +?close_bpipe@@YAHPAVBPIPE@@@Z +?utime@@YAHPBDPAUutimbuf@@@Z + +; cram-md5.obj +?cram_md5_challenge@@YA_NPAVBSOCK@@PADHH@Z +?cram_md5_respond@@YA_NPAVBSOCK@@PADPAH2@Z + +; crc32.obj +?bcrc32@@YAIPAEH@Z + +;create_file.obj +?create_file@@YAHPAVJCR@@PAUATTR@@PAUBFILE@@H@Z + +; crypto.obj +?crypto_digest_new@@YAPAUDigest@@W4crypto_digest_t@@@Z +?crypto_digest_update@@YA_NPAUDigest@@PBEI@Z +?crypto_digest_finalize@@YA_NPAUDigest@@PAEPAI@Z +?crypto_digest_free@@YAXPAUDigest@@@Z +?init_crypto@@YAHXZ +?cleanup_crypto@@YAHXZ +?crypto_sign_new@@YAPAUSignature@@XZ +?crypto_sign_get_digest@@YA?AW4crypto_error_t@@PAUSignature@@PAUX509_Keypair@@PAPAUDigest@@@Z +?crypto_sign_verify@@YA?AW4crypto_error_t@@PAUSignature@@PAUX509_Keypair@@PAUDigest@@@Z +?crypto_sign_add_signer@@YAHPAUSignature@@PAUDigest@@PAUX509_Keypair@@@Z +?crypto_sign_encode@@YAHPAUSignature@@PAEPAI@Z +?crypto_sign_decode@@YAPAUSignature@@PBEI@Z +?crypto_sign_free@@YAXPAUSignature@@@Z +?crypto_keypair_new@@YAPAUX509_Keypair@@XZ +?crypto_keypair_dup@@YAPAUX509_Keypair@@PAU1@@Z +?crypto_keypair_load_cert@@YAHPAUX509_Keypair@@PBD@Z +?crypto_keypair_has_key@@YA_NPBD@Z +?crypto_keypair_load_key@@YAHPAUX509_Keypair@@PBDP6AHPADHPBX@Z3@Z +?crypto_keypair_free@@YAXPAUX509_Keypair@@@Z +?crypto_session_new@@YAPAUCrypto_Session@@W4crypto_cipher_t@@PAValist@@@Z +?crypto_session_free@@YAXPAUCrypto_Session@@@Z +?crypto_session_encode@@YA_NPAUCrypto_Session@@PAEPAI@Z +?crypto_session_decode@@YA?AW4crypto_error_t@@PBEIPAValist@@PAPAUCrypto_Session@@@Z +?crypto_cipher_new@@YAPAUCipher_Context@@PAUCrypto_Session@@_NPAI@Z +?crypto_cipher_update@@YA_NPAUCipher_Context@@PBEI1PAI@Z +?crypto_cipher_finalize@@YA_NPAUCipher_Context@@PAEPAI@Z +?crypto_cipher_free@@YAXPAUCipher_Context@@@Z +?crypto_default_pem_callback@@YAHPADHPBX@Z +?crypto_digest_name@@YAPBDPAUDigest@@@Z +?crypto_digest_stream_type@@YA?AW4crypto_digest_t@@H@Z +?crypto_strerror@@YAPBDW4crypto_error_t@@@Z + +; daemon.obj +?daemon_start@@YAXXZ + +; dlist.obj +?append@dlist@@QAEXPAX@Z +?prepend@dlist@@QAEXPAX@Z +?insert_before@dlist@@QAEXPAX0@Z +?binary_insert@dlist@@QAEPAXPAXP6AH00@Z@Z +?first@dlist@@QBEPAXXZ +?last@dlist@@QBEPAXXZ +?binary_insert_multiple@dlist@@QAEXPAXP6AH00@Z@Z +?binary_search@dlist@@QAEPAXPAXP6AH00@Z@Z +?remove@dlist@@QAEXPAX@Z +?next@dlist@@QAEPAXPAX@Z +?destroy@dlist@@QAEXXZ +?new_dlistString@@YAPAVdlistString@@PBD@Z + +; drivetype.obj +?drivetype@@YA_NPBDPADH@Z + +; edit.obj +?str_to_uint64@@YA_KPAD@Z +?str_to_int64@@YA_JPAD@Z +?edit_uint64_with_commas@@YAPAD_KPAD@Z +?edit_uint64_with_suffix@@YAPAD_KPAD@Z +?edit_uint64@@YAPAD_KPAD@Z +?edit_int64@@YAPAD_JPAD@Z +?duration_to_utime@@YA_NPADPA_J@Z +?edit_utime@@YAPAD_JPADH@Z +?size_to_uint64@@YA_NPADHPA_K@Z +?is_a_number@@YA_NPBD@Z +?is_an_integer@@YA_NPBD@Z +?is_name_valid@@YA_NPADPAPAD@Z +?add_commas@@YAPADPAD0@Z + +; enable_priv.obj +?enable_backup_privileges@@YAHPAVJCR@@H@Z + +; enh_fnmatch.obj + +; find.obj +?init_find_files@@YAPAUFF_PKT@@XZ +?set_find_options@@YAXPAUFF_PKT@@HJ@Z +?get_win32_driveletters@@YAHPAUFF_PKT@@PAD@Z +?find_files@@YAHPAVJCR@@PAUFF_PKT@@P6AH1PAX_N@Z2@Z +?term_find_files@@YAHPAUFF_PKT@@@Z + +; find_one.obj +?find_one_file@@YAHPAVJCR@@PAUFF_PKT@@P6AH1PAX_N@Z2PADI3@Z + +; fnmatch.obj +fnmatch + +; fstype.obj +?fstype@@YA_NPBDPADH@Z + +; hmac.obj +?hmac_md5@@YAXPAEH0H0@Z + +; htable.obj + +; idcache.obj +?getuser@@YAPADIPADH@Z +?getgroup@@YAPADIPADH@Z + +; jcr.obj +?lock_jobs@@YAXXZ +?unlock_jobs@@YAXXZ +?term_last_jobs_list@@YAXXZ +?lock_last_jobs_list@@YAXXZ +?unlock_last_jobs_list@@YAXXZ +?job_end_push@@YAXPAVJCR@@P6AX0PAX@Z1@Z +?new_jcr@@YAPAVJCR@@HP6AXPAV1@@Z@Z +?inc_use_count@JCR@@QAEXXZ +?lock@JCR@@QAEXXZ +?unlock@JCR@@QAEXXZ +?init_mutex@JCR@@QAEXXZ +?b_free_jcr@@YAXPBDHPAVJCR@@@Z +?dec_use_count@JCR@@QAEXXZ +?use_count@JCR@@QAEHXZ +?destroy_mutex@JCR@@QAEXXZ +?get_jcr_by_id@@YAPAVJCR@@I@Z +?get_jcr_by_session@@YAPAVJCR@@II@Z +?get_jcr_by_partial_name@@YAPAVJCR@@PAD@Z +?get_jcr_by_full_name@@YAPAVJCR@@PAD@Z +?set_jcr_job_status@@YAXPAVJCR@@H@Z +?jcr_walk_start@@YAPAVJCR@@XZ +?jcr_walk_next@@YAPAVJCR@@PAV1@@Z +?jcr_walk_end@@YAXPAVJCR@@@Z +?init_jcr_subsystem@@YA_NXZ + +; lex.obj +?scan_to_eol@@YAXPAUs_lex_context@@@Z +?lex_set_default_error_handler@@YAXPAUs_lex_context@@@Z +?lex_set_error_handler_error_type@@YAHPAUs_lex_context@@H@Z +?lex_close_file@@YAPAUs_lex_context@@PAU1@@Z +?lex_open_file@@YAPAUs_lex_context@@PAU1@PBDP6AX1H01ZZ@Z +?lex_tok_to_str@@YAPBDH@Z +?lex_get_token@@YAHPAUs_lex_context@@H@Z + +; makepath.obj + +; match.obj +?match_files@@YAHPAVJCR@@PAUFF_PKT@@P6AH1PAX_N@Z2@Z +?term_include_exclude_files@@YAXPAUFF_PKT@@@Z +?add_fname_to_include_list@@YAXPAUFF_PKT@@HPBD@Z +?add_fname_to_exclude_list@@YAXPAUFF_PKT@@PBD@Z +?file_is_included@@YAHPAUFF_PKT@@PBD@Z +?file_is_excluded@@YAHPAUFF_PKT@@PBD@Z + +; md5.obj +?MD5Init@@YAXPAUMD5Context@@@Z +?MD5Update@@YAXPAUMD5Context@@PAEI@Z +?MD5Final@@YAXQAEPAUMD5Context@@@Z + +; mem_pool.obj +?sm_get_pool_memory@@YAPADPBDHH@Z +?sm_get_memory@@YAPADPBDHJ@Z +?sm_sizeof_pool_memory@@YAJPBDHPAD@Z +?sm_realloc_pool_memory@@YAPADPBDHPADJ@Z +?sm_check_pool_memory_size@@YAPADPBDHPADJ@Z +?sm_free_pool_memory@@YAXPBDHPAD@Z +?close_memory_pool@@YAXXZ +?print_memory_pool_stats@@YAXXZ +?pm_strcat@@YAHPAPADPBD@Z +?pm_strcat@@YAHAAPADPBD@Z +?c_str@POOL_MEM@@QBEPADXZ +?pm_strcat@@YAHAAVPOOL_MEM@@PBD@Z +?check_size@POOL_MEM@@QAEPADJ@Z +?pm_strcpy@@YAHPAPADPBD@Z +?pm_strcpy@@YAHAAPADPBD@Z +?pm_strcpy@@YAHAAPADAAVPOOL_MEM@@@Z +?pm_strcpy@@YAHAAVPOOL_MEM@@PBD@Z +?max_size@POOL_MEM@@QAEJXZ + +; message.obj +?my_name_is@@YAXHQAPADPBD@Z +?init_msg@@YAXPAVJCR@@PAVMSGS@@@Z +?init_console_msg@@YAXPBD@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@@YAXPAVMSGS@@@Z +?term_msg@@YAXXZ +?dispatch_message@@YAXPAVJCR@@HJPAD@Z +?c_str@POOL_MEM@@QBEPADXZ +?d_msg@@YAXPBDHH0ZZ +?get_basename@@YAPBDPBD@Z +?set_trace@@YAXH@Z +?get_trace@@YA_NXZ +?p_msg@@YAXPBDHH0ZZ +?e_msg@@YAXPBDHHH0ZZ +?Jmsg@@YAXPAVJCR@@HJPBDZZ +?j_msg@@YAXPBDHPAVJCR@@HJ0ZZ +?m_msg@@YAHPBDHPAPAD0ZZ +?m_msg@@YAHPBDHAAPAD0ZZ +?Mmsg@@YAHPAPADPBDZZ +?Mmsg@@YAHAAPADPBDZZ +?Mmsg@@YAHAAVPOOL_MEM@@PBDZZ +?Qmsg@@YAXPAVJCR@@HJPBDZZ +?dequeue_messages@@YAXPAVJCR@@@Z +?q_msg@@YAXPBDHPAVJCR@@HJ0ZZ + +; print.obj + +; pythonlib.obj +?generate_daemon_event@@YAHPAVJCR@@PBD@Z +?init_python_interpreter@@YAXPBD00@Z +?term_python_interpreter@@YAXXZ + +; queue.obj +?qinsert@@YAXPAUb_queue@@0@Z +?qnext@@YAPAUb_queue@@PAU1@0@Z +?qdchain@@YAPAUb_queue@@PAU1@@Z + +; runscript.obj +?new_runscript@@YAPAVRUNSCRIPT@@XZ +?reset_default@RUNSCRIPT@@QAEX_N@Z +?copy_runscript@@YAPAVRUNSCRIPT@@PAV1@@Z +?free_runscript@@YAXPAVRUNSCRIPT@@@Z +?run_scripts@@YAHPAVJCR@@PAValist@@PBD@Z +?set_command@RUNSCRIPT@@QAEXPBD@Z +?set_target@RUNSCRIPT@@QAEXPBD@Z +?run@RUNSCRIPT@@QAEHPAVJCR@@PBD@Z +?free_runscripts@@YAXPAValist@@@Z +?debug@RUNSCRIPT@@QAEXXZ + +; rwlock.obj +?rwl_init@@YAHPAUs_rwlock_tag@@@Z +?rwl_destroy@@YAHPAUs_rwlock_tag@@@Z +?rwl_writelock@@YAHPAUs_rwlock_tag@@@Z +?rwl_writeunlock@@YAHPAUs_rwlock_tag@@@Z + +; save-cwd.obj + +; scan.obj +?strip_leading_space@@YAXPAD@Z +?strip_trailing_junk@@YAXPAD@Z +?strip_trailing_newline@@YAXPAD@Z +?skip_spaces@@YA_NPAPAD@Z +?skip_nonspaces@@YA_NPAPAD@Z +?fstrsch@@YAHPBD0@Z +?next_arg@@YAPADPAPAD@Z +?parse_args@@YAHPADPAPADPAH11H@Z +?parse_args_only@@YAHPADPAPADPAH11H@Z +?bsscanf@@YAHPBD0ZZ + +; serial.obj +?serial_int32@@YAXQAPAEJ@Z +?serial_uint32@@YAXQAPAEI@Z +?serial_uint64@@YAXQAPAE_K@Z +?serial_btime@@YAXQAPAE_J@Z +?serial_float64@@YAXQAPAEN@Z +?serial_string@@YAXQAPAEQBD@Z +?unserial_int32@@YAJQAPAE@Z +?unserial_uint32@@YAIQAPAE@Z +?unserial_uint64@@YA_KQAPAE@Z +?unserial_btime@@YA_JQAPAE@Z +?unserial_float64@@YANQAPAE@Z +?unserial_string@@YAXQAPAEQAD@Z + +; sha1.obj + +; signal.obj + +; smartall.obj +?sm_free@@YAXPBDHPAX@Z +?sm_malloc@@YAPAXPBDHI@Z +?sm_calloc@@YAPAXPBDHII@Z +?sm_realloc@@YAPAXPBDHPAXI@Z +?sm_dump@@YAX_N@Z +?sm_check@@YAXPBDH_N@Z +?sm_static@@YAXH@Z + +; tls.obj +?new_tls_context@@YAPAUTLS_Context@@PBD000P6AHPADHPBX@Z20_N@Z +?free_tls_context@@YAXPAUTLS_Context@@@Z + +; tree.obj +?new_tree@@YAPAUs_tree_root@@H@Z +?free_tree@@YAXPAUs_tree_root@@@Z +?insert_tree_node@@YAPAUs_tree_node@@PAD0HPAUs_tree_root@@PAU1@@Z +?strrchr@@YAPADPADH@Z +?tree_getpath@@YAHPAUs_tree_node@@PADH@Z +?tree_cwd@@YAPAUs_tree_node@@PADPAUs_tree_root@@PAU1@@Z +; rblist +?insert@rblist@@QAEPAXPAXP6AH00@Z@Z +?next@rblist@@QAEPAXPAX@Z + +; util.obj +?is_buf_zero@@YA_NPADH@Z +?lcase@@YAXPAD@Z +?bash_spaces@@YAXPAD@Z +?bash_spaces@@YAXAAVPOOL_MEM@@@Z +?unbash_spaces@@YAXPAD@Z +?unbash_spaces@@YAXAAVPOOL_MEM@@@Z +?encode_time@@YAPADJPAD@Z +?jobstatus_to_ascii@@YAXHPADH@Z +?job_status_to_str@@YAPBDH@Z +?job_type_to_str@@YAPBDH@Z +?job_level_to_str@@YAPBDH@Z +?encode_mode@@YAPADIPAD@Z +?do_shell_expansion@@YAHPADH@Z +?make_session_key@@YAXPAD0H@Z +?edit_job_codes@@YAPADPAVJCR@@PAD1PBD@Z +?set_working_directory@@YAXPAD@Z + +; var.obj +?var_create@@YA?AW4var_rc_t@@PAPAUvar_st@@@Z +?var_destroy@@YA?AW4var_rc_t@@PAUvar_st@@@Z +?var_config@@YA?AW4var_rc_t@@PAUvar_st@@W4var_config_t@@ZZ +?var_unescape@@YA?AW4var_rc_t@@PAUvar_st@@PBDHPADHH@Z +?var_expand@@YA?AW4var_rc_t@@PAUvar_st@@PBDHPAPADPAHH@Z +?var_strerror@@YAPBDPAUvar_st@@W4var_rc_t@@@Z + +; watchdog.obj +?start_watchdog@@YAHXZ +?stop_watchdog@@YAHXZ +?new_watchdog@@YAPAUs_watchdog_t@@XZ +?register_watchdog@@YA_NPAUs_watchdog_t@@@Z + +; winapi.obj +?InitWinAPIWrapper@@YAXXZ + +; workq.obj diff --git a/bacula/src/win32/libwin32/aboutDialog.cpp b/bacula/src/win32/libwin32/aboutDialog.cpp new file mode 100644 index 0000000000..0eab81d453 --- /dev/null +++ b/bacula/src/win32/libwin32/aboutDialog.cpp @@ -0,0 +1,71 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * + * Kern Sibbald, August 2007 + * + * +*/ + +#include "bacula.h" +#include "win32.h" + +static BOOL CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + /* Get the dialog class pointer from USERDATA */ + aboutDialog *about; + + switch (uMsg) { + case WM_INITDIALOG: + /* save the dialog class pointer */ + SetWindowLong(hwnd, GWL_USERDATA, lParam); + about = (aboutDialog *)lParam; + + /* Show the dialog */ + SetForegroundWindow(hwnd); + about->m_visible = true; + return true; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDCANCEL: + case IDOK: + EndDialog(hwnd, true); + about = (aboutDialog *)GetWindowLong(hwnd, GWL_USERDATA); + about->m_visible = false; + return true; + } + break; + + case WM_DESTROY: + EndDialog(hwnd, false); + about = (aboutDialog *)GetWindowLong(hwnd, GWL_USERDATA); + about->m_visible = false; + return true; + } + return false; +} + +void aboutDialog::show(bool show) +{ + if (show && !m_visible) { + DialogBoxParam(appInstance, MAKEINTRESOURCE(IDD_ABOUT), NULL, + (DLGPROC)DialogProc, (LPARAM)this); + } +} diff --git a/bacula/src/win32/libwin32/aboutDialog.h b/bacula/src/win32/libwin32/aboutDialog.h new file mode 100644 index 0000000000..b1fdd4c8e2 --- /dev/null +++ b/bacula/src/win32/libwin32/aboutDialog.h @@ -0,0 +1,39 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#ifndef __ABOUT_DIALOG_H_ +#define __ABOUT_DIALOG_H_ 1 + +/* Define the aboutDialog class */ +class aboutDialog +{ +public: + aboutDialog() { m_visible =false; }; + ~aboutDialog() { }; + + void show(bool show); + + bool m_visible; +}; + +#endif /* __ABOUT_H_ */ diff --git a/bacula/src/win32/libwin32/bacula.bmp b/bacula/src/win32/libwin32/bacula.bmp new file mode 100644 index 0000000000000000000000000000000000000000..a31eb1636902fbe82492cf1bcc9424b196296912 GIT binary patch literal 3126 zcmd6o!41MN3`NbI0XTAGf)2o)oiZAm!6(1^ib&KtPFvM#EjNvyznvnUujy*pCin;L z`+Q&Qh6pyl=L7xcSSw3+#U7a{C2WK5H7N1(-#tbpC*)g7x*!rg=@9{pUFI+a^jkg) zPL;HJ1tstbb|in{sG$Uc*|>%D1McMi+Ad6^&{{oz!WT*)SNfU0>RC?n7rfa;fX}|f zhdhxL@FRgIUysfJStVatHJ>Hea+epg44V9M!(hBCe^+?jI1Xq-`{Q>VrDrpxstQsN zul|%g8&n-7YQ9zi0jn?b^)?WA_yO5U@$dt(mEz%Z&xlvK=J^K5mW!e14=6nFeIt7e-mMG^>!P}Oo`Rqas4hADb?#lfFnd|d% literal 0 HcmV?d00001 diff --git a/bacula/src/win32/libwin32/bacula.ico b/bacula/src/win32/libwin32/bacula.ico new file mode 100644 index 0000000000000000000000000000000000000000..f6d50bf516caaa111e8598006ac9cac9ed166358 GIT binary patch literal 766 zcmbtSJx;?g7=0#0jMx!kPBRonq~rhy^#Cln0$1qjjca*l;0hgCP&-tj5>)1WcI<{! zl`8S#=g%+SuPg(KUtMbmJ}!V;+IzAlA4!Ev?x$g`g>w#|_1-g(w9#vx2PWQS9d{|GMa9(zmM9Oifg9J{yF$_zg`k0-syWK-!{PKm;c%Cp!Q4?eoMXst}RfUL&g>>lC`cR F_ZNY8Y|;P# literal 0 HcmV?d00001 diff --git a/bacula/src/win32/libwin32/bacula.rc b/bacula/src/win32/libwin32/bacula.rc new file mode 100644 index 0000000000..38577315ee --- /dev/null +++ b/bacula/src/win32/libwin32/bacula.rc @@ -0,0 +1,171 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Generic version of Bacula resource + * + */ + +#include +#include +#include "res.h" +#include "../../version.h" + +/******************************************************************** + * + * Icons + * + * Icon with lowest ID value placed first to ensure application icon + * remains consistent on all systems. + */ +IDI_BACULA ICON "../libwin32/bacula.ico" +IDI_IDLE ICON "../libwin32/idle.ico" +IDI_RUNNING ICON "../libwin32/running.ico" +IDI_JOB_ERROR ICON "../libwin32/error.ico" +IDI_JOB_WARNING ICON "../libwin32/warn.ico" + +/******************************************************************** + * + * Menu + * + */ +IDR_TRAYMENU MENU +BEGIN + POPUP "tray" + BEGIN + MENUITEM "&Status", ID_STATUS + MENUITEM SEPARATOR + MENUITEM "&About Bacula", ID_ABOUT +// MENUITEM SEPARATOR +// MENUITEM "&Close Bacula", ID_CLOSE + END +END + + +/******************************************************************** + * + * Version + * + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,1,0,0 + PRODUCTVERSION 1,1,0,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0 +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E0" // Lang=US English, CharSet=Windows Multiligual + BEGIN + VALUE "Comments", "by Kern Sibbald\0" + VALUE "CompanyName", "Bacula\0" +#ifdef _WIN64 + VALUE "FileDescription", "Bacula File daemon for Win64\0" + VALUE "ProductName", "Bacula(R) - Win64 Version\0" +#else + VALUE "FileDescription", "Bacula File daemon for Win32\0" + VALUE "ProductName", "Bacula(R) - Win32 Version\0" +#endif + VALUE "FileVersion", VERSION "\0" + VALUE "InternalName", "Bacula\0" + VALUE "LegalCopyright", "Copyright Kern Sibbald, 2000-2018\0" + VALUE "LegalTrademarks", "Bacula(R)\0" + VALUE "OriginalFilename", "bacula-fd.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductVersion", VERSION + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 // US English, Multilingual + END +END + + +/*********************************************************************** + * + * Bitmap + * + */ +IDB_BACULABMP BITMAP DISCARDABLE "../libwin32/bacula.bmp" + +/*********************************************************************** + * + * String Table + */ +STRINGTABLE +BEGIN + IDI_BACULA "Bacula" +END + +/*********************************************************************** + * + * About Dialog + */ +IDD_ABOUT DIALOG 0, 0, 250, 145 +#if !defined(MINGW64) && !defined(HAVE_MINGW_W64) +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +#endif +CAPTION "About Bacula" +FONT 8, "MS Sans Serif" +BEGIN +#if !defined(MINGW64) && !defined(HAVE_MINGW_W64) + DEFPUSHBUTTON "OK",IDOK,190,120,50,15 +#endif +// CONTROL "\3", IDC_BACULABMP,"Static",SS_ICON | SS_CENTERIMAGE | +// SS_SUNKEN,7,5,73,65 +#if !defined(HAVE_MINGW) && !defined(MINGW64) && !defined(HAVE_MINGW_W64) + CONTROL IDB_BACULABMP,IDB_BACULABMP,"Static",SS_BITMAP|SS_SUNKEN,7,5,32,32 +#endif + + LTEXT " by Kern Sibbald",-1,134,38,78,10 + LTEXT "For more information, see:",-1,115,60,100,10 + LTEXT " www.bacula.org",-1,115,70,100,10 + LTEXT "Copyright (C) 2000-2018, Kern Sibbald",-1,7,120,175,10 + LTEXT "Licensed by Kern Sibbald",-1,7,130,175,10 + RTEXT "Build Date:",-1,108,24,42,8 + RTEXT "Bacula Version:",-1,100,9,50,8 + LTEXT VERSION,-1,159,10,65,8 + LTEXT BDATE,-1,159,24,65,10 + +END + +/************************************************************************ + * + * Status Dialog + */ +IDD_STATUS DIALOGEX 0, 0, 411, 244 +#if !defined(MINGW64) && !defined(HAVE_MINGW_W64) +STYLE DS_SETFONT | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +#endif +CAPTION "Bacula Status" +FONT 8, "Courier New" +BEGIN +#if !defined(MINGW64) && !defined(HAVE_MINGW_W64) + DEFPUSHBUTTON "&OK",IDOK,355,5,51,15 + EDITTEXT IDC_TEXTDISPLAY, 2, 2, 350, 240, WS_VSCROLL | WS_HSCROLL | WS_BORDER | ES_READONLY | ES_MULTILINE +#endif +END diff --git a/bacula/src/win32/libwin32/error.ico b/bacula/src/win32/libwin32/error.ico new file mode 100644 index 0000000000000000000000000000000000000000..a8f85f120dbcc8483e9530af48554432945c2a91 GIT binary patch literal 766 zcmc&yu?~VT5Pd}wMy-RZwJeSret?0`a%lXrPEI8Lf}!Bzr^i}8{7j(2xG zt_gskN2wJU_YBxj+!GbCCJN-F^DxH1S_@DF+_XHymJp<9}LB@7nDn`rxlQm{6{?* z^`}?Y;|VMuK+ypUOTS!8`@DJDqP-kVdsdO`Ip6nPo$Hu%7DU0k(JY!*4BwcFFV=Zv AHvj+t literal 0 HcmV?d00001 diff --git a/bacula/src/win32/libwin32/idle.ico b/bacula/src/win32/libwin32/idle.ico new file mode 100644 index 0000000000000000000000000000000000000000..ce5315f2507bed96c9f4a12d542d7189ef1a2471 GIT binary patch literal 766 zcmc&yF%H5o47`*|9U%;?gmhs9^#dLHEQW}eWn!wt7Z@2kG9U#zX-TMBi3M@doqKlT zI#K{ZOQ{tY_YBxj+!GbCCJN-F^DxH1S_@Eg&dqQ9Nkt~$J0w<0PUr~96GW?nFRMyx zFTo#xwf5qDiKZ4_!u~RE8sX(jKRO>;$NqXJr4BMVAJ5#w*9Sv!>;>hL>uCjKBmYrP zTK(yh-iyZ*SU!NF0~VH^Tubx3dD^1A98G&xk?c9&@4GtJG3hLbf_bA})UO!+F%@4h CbY?XG literal 0 HcmV?d00001 diff --git a/bacula/src/win32/libwin32/main.cpp b/bacula/src/win32/libwin32/main.cpp new file mode 100644 index 0000000000..c1d4d33f24 --- /dev/null +++ b/bacula/src/win32/libwin32/main.cpp @@ -0,0 +1,666 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * + * Kern Sibbald, August 2007 + * + * Note, some of the original Bacula Windows startup and service handling code + * was derived from VNC code that was used in apcupsd then ported to + * Bacula. However, since then the code has been significantly enhanced + * and largely rewritten. + * + * Evidently due to the nature of Windows startup code and service + * handling code, certain similarities remain. Thanks to the original + * VNC authors. + * + * This is a generic main routine, which is used by all three + * of the daemons. Each one compiles it with slightly different + * #defines. + * + */ + +#define LOCKMGR_COMPLIANT +#include "bacula.h" +#include "win32.h" +#include +#include + +#include + + +/* Globals */ +HINSTANCE appInstance; +DWORD mainthreadId; +bool opt_debug = false; +bool have_service_api; +DWORD service_thread_id = 0; +char win_os[300]; + +bool GetWindowsVersionString(LPTSTR osbuf, int maxsiz); + + +#define MAX_COMMAND_ARGS 100 +static char *command_args[MAX_COMMAND_ARGS] = {(char *)LC_APP_NAME, NULL}; +static int num_command_args = 1; +static pid_t main_pid; +static pthread_t main_tid; + +const char usage[] = APP_NAME "[/debug] [/service] [/run] [/kill] [/install] [/remove] [/help]\n"; + +/* + * + * Main Windows entry point. + * + * We parse the command line and either calls the main App + * or starts up the service. + */ +int WINAPI WinMain(HINSTANCE Instance, HINSTANCE /*PrevInstance*/, PSTR CmdLine, + int /*show*/) +{ + char *cmdLine = CmdLine; + char *wordPtr, *tempPtr; + int i, quote; + OSVERSIONINFO osversioninfo; + osversioninfo.dwOSVersionInfoSize = sizeof(osversioninfo); + + /* Save the application instance and main thread id */ + appInstance = Instance; + mainthreadId = GetCurrentThreadId(); + + if (GetVersionEx(&osversioninfo) && + osversioninfo.dwPlatformId == VER_PLATFORM_WIN32_NT) { + have_service_api = true; + } + + GetWindowsVersionString(win_os, sizeof(win_os)); + + main_pid = getpid(); + main_tid = pthread_self(); + + INITCOMMONCONTROLSEX initCC = { + sizeof(INITCOMMONCONTROLSEX), + ICC_STANDARD_CLASSES + }; + + InitCommonControlsEx(&initCC); + + /* + * Funny things happen with the command line if the + * execution comes from c:/Program Files/bacula/bacula.exe + * We get a command line like: Files/bacula/bacula.exe" options + * I.e. someone stops scanning command line on a space, not + * realizing that the filename is quoted!!!!!!!!!! + * So if first character is not a double quote and + * the last character before first space is a double + * quote, we throw away the junk. + */ + + wordPtr = cmdLine; + while (*wordPtr && *wordPtr != ' ') + wordPtr++; + if (wordPtr > cmdLine) /* backup to char before space */ + wordPtr--; + /* if first character is not a quote and last is, junk it */ + if (*cmdLine != '"' && *wordPtr == '"') { + cmdLine = wordPtr + 1; + } + + /* + * Build Unix style argc *argv[] for the main "Unix" code + * stripping out any Windows options + */ + + /* Don't NULL command_args[0] !!! */ + for (i=1;i +#include + +#ifndef PRODUCT_UNLICENSED +#define PRODUCT_UNLICENSED 0xABCDABCD +#define PRODUCT_BUSINESS 0x00000006 +#define PRODUCT_BUSINESS_N 0x00000010 +#define PRODUCT_CLUSTER_SERVER 0x00000012 +#define PRODUCT_DATACENTER_SERVER 0x00000008 +#define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C +#define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027 +#define PRODUCT_DATACENTER_SERVER_V 0x00000025 +#define PRODUCT_ENTERPRISE 0x00000004 +#define PRODUCT_ENTERPRISE_E 0x00000046 +#define PRODUCT_ENTERPRISE_N 0x0000001B +#define PRODUCT_ENTERPRISE_SERVER 0x0000000A +#define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E +#define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029 +#define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F +#define PRODUCT_ENTERPRISE_SERVER_V 0x00000026 +#define PRODUCT_HOME_BASIC 0x00000002 +#define PRODUCT_HOME_BASIC_E 0x00000043 +#define PRODUCT_HOME_BASIC_N 0x00000005 +#define PRODUCT_HOME_PREMIUM 0x00000003 +#define PRODUCT_HOME_PREMIUM_E 0x00000044 +#define PRODUCT_HOME_PREMIUM_N 0x0000001A +#define PRODUCT_HYPERV 0x0000002A +#define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E +#define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020 +#define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F +#define PRODUCT_PROFESSIONAL 0x00000030 +#define PRODUCT_PROFESSIONAL_E 0x00000045 +#define PRODUCT_PROFESSIONAL_N 0x00000031 +#define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018 +#define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023 +#define PRODUCT_SERVER_FOUNDATION 0x00000021 +#define PRODUCT_SMALLBUSINESS_SERVER 0x00000009 +#define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038 +#define PRODUCT_STANDARD_SERVER 0x00000007 +#define PRODUCT_STANDARD_SERVER_CORE 0x0000000D +#define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028 +#define PRODUCT_STANDARD_SERVER_V 0x00000024 +#define PRODUCT_STARTER 0x0000000B +#define PRODUCT_STARTER_E 0x00000042 +#define PRODUCT_STARTER_N 0x0000002F +#define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017 +#define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014 +#define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015 +#define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016 +#define PRODUCT_UNDEFINED 0x00000000 +#define PRODUCT_ULTIMATE 0x00000001 +#define PRODUCT_ULTIMATE_E 0x00000047 +#define PRODUCT_ULTIMATE_N 0x0000001C +#define PRODUCT_WEB_SERVER 0x00000011 +#define PRODUCT_WEB_SERVER_CORE 0x0000001D + +#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x19 +#define SM_SERVERR2 89 +#define VER_SERVER_NT 0x80000000 + +#endif + +#ifndef PRODUCT_PROFESSIONAL +#define PRODUCT_PROFESSIONAL 0x00000030 +#endif +#ifndef VER_SUITE_STORAGE_SERVER +#define VER_SUITE_STORAGE_SERVER 0x00002000 +#endif +#ifndef VER_SUITE_COMPUTE_SERVER +#define VER_SUITE_COMPUTE_SERVER 0x00004000 +#endif + +/* Unknown value */ +#ifndef VER_SUITE_WH_SERVER +#define VER_SUITE_WH_SERVER -1 +#endif + +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); +typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); + +/* + * Get Windows version display string + */ +bool GetWindowsVersionString(LPTSTR osbuf, int maxsiz) +{ + OSVERSIONINFOEX osvi; + SYSTEM_INFO si; + PGNSI pGNSI; + PGPI pGPI; + BOOL bOsVersionInfoEx; + DWORD dwType; + + memset(&si, 0, sizeof(SYSTEM_INFO)); + memset(&osvi, 0, sizeof(OSVERSIONINFOEX)); + + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) + return 1; + + // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. + + pGNSI = (PGNSI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), + "GetNativeSystemInfo"); + if (pGNSI) { + pGNSI(&si); + } else { + GetSystemInfo(&si); + } + + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion > 4) { + bstrncpy(osbuf, TEXT("Microsoft "), maxsiz); + + // Test for the specific product. + + if (osvi.dwMajorVersion == 6) { + if (osvi.dwMinorVersion == 0) { + if (osvi.wProductType == VER_NT_WORKSTATION) + bstrncat(osbuf, TEXT("Windows Vista "), maxsiz); + else + bstrncat(osbuf, TEXT("Windows Server 2008 " ), maxsiz); + } + + if (osvi.dwMinorVersion == 1) { + if (osvi.wProductType == VER_NT_WORKSTATION ) + bstrncat(osbuf, TEXT("Windows 7 "), maxsiz); + else + bstrncat(osbuf, TEXT("Windows Server 2008 R2 " ), maxsiz); + } + + pGPI = (PGPI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), + "GetProductInfo"); + + if (pGPI) { + pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); + } else { + dwType = PRODUCT_HOME_BASIC; + } + + switch (dwType) { + case PRODUCT_ULTIMATE: + bstrncat(osbuf, TEXT("Ultimate Edition" ), maxsiz); + break; + case PRODUCT_PROFESSIONAL: + bstrncat(osbuf, TEXT("Professional" ), maxsiz); + break; + case PRODUCT_HOME_PREMIUM: + bstrncat(osbuf, TEXT("Home Premium Edition" ), maxsiz); + break; + case PRODUCT_HOME_BASIC: + bstrncat(osbuf, TEXT("Home Basic Edition" ), maxsiz); + break; + case PRODUCT_ENTERPRISE: + bstrncat(osbuf, TEXT("Enterprise Edition" ), maxsiz); + break; + case PRODUCT_BUSINESS: + bstrncat(osbuf, TEXT("Business Edition" ), maxsiz); + break; + case PRODUCT_STARTER: + bstrncat(osbuf, TEXT("Starter Edition" ), maxsiz); + break; + case PRODUCT_CLUSTER_SERVER: + bstrncat(osbuf, TEXT("Cluster Server Edition" ), maxsiz); + break; + case PRODUCT_DATACENTER_SERVER: + bstrncat(osbuf, TEXT("Datacenter Edition" ), maxsiz); + break; + case PRODUCT_DATACENTER_SERVER_CORE: + bstrncat(osbuf, TEXT("Datacenter Edition (core installation)" ), maxsiz); + break; + case PRODUCT_ENTERPRISE_SERVER: + bstrncat(osbuf, TEXT("Enterprise Edition" ), maxsiz); + break; + case PRODUCT_ENTERPRISE_SERVER_CORE: + bstrncat(osbuf, TEXT("Enterprise Edition (core installation)" ), maxsiz); + break; + case PRODUCT_ENTERPRISE_SERVER_IA64: + bstrncat(osbuf, TEXT("Enterprise Edition for Itanium-based Systems" ), maxsiz); + break; + case PRODUCT_SMALLBUSINESS_SERVER: + bstrncat(osbuf, TEXT("Small Business Server" ), maxsiz); + break; + case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: + bstrncat(osbuf, TEXT("Small Business Server Premium Edition" ), maxsiz); + break; + case PRODUCT_STANDARD_SERVER: + bstrncat(osbuf, TEXT("Standard Edition" ), maxsiz); + break; + case PRODUCT_STANDARD_SERVER_CORE: + bstrncat(osbuf, TEXT("Standard Edition (core installation)" ), maxsiz); + break; + case PRODUCT_WEB_SERVER: + bstrncat(osbuf, TEXT("Web Server Edition" ), maxsiz); + break; + } + } + + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { + if( GetSystemMetrics(SM_SERVERR2) ) + bstrncat(osbuf, TEXT( "Windows Server 2003 R2 "), maxsiz); + else if (osvi.wSuiteMask & VER_SUITE_STORAGE_SERVER) + bstrncat(osbuf, TEXT( "Windows Storage Server 2003"), maxsiz); + else if (osvi.wSuiteMask & VER_SUITE_WH_SERVER ) + bstrncat(osbuf, TEXT( "Windows Home Server"), maxsiz); + else if (osvi.wProductType == VER_NT_WORKSTATION && + si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) + bstrncat(osbuf, TEXT( "Windows XP Professional x64 Edition"), maxsiz); + else + bstrncat(osbuf, TEXT("Windows Server 2003 "), maxsiz); + + // Test for the server type. + if (osvi.wProductType != VER_NT_WORKSTATION) { + if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64) { + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + bstrncat(osbuf, TEXT( "Datacenter Edition for Itanium-based Systems" ), maxsiz); + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + bstrncat(osbuf, TEXT( "Enterprise Edition for Itanium-based Systems" ), maxsiz); + } + + else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) { + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + bstrncat(osbuf, TEXT( "Datacenter x64 Edition" ), maxsiz); + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + bstrncat(osbuf, TEXT( "Enterprise x64 Edition" ), maxsiz); + else bstrncat(osbuf, TEXT( "Standard x64 Edition" ), maxsiz); + } else { + if ( osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER ) + bstrncat(osbuf, TEXT( "Compute Cluster Edition" ), maxsiz); + else if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + bstrncat(osbuf, TEXT( "Datacenter Edition" ), maxsiz); + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + bstrncat(osbuf, TEXT( "Enterprise Edition" ), maxsiz); + else if ( osvi.wSuiteMask & VER_SUITE_BLADE ) + bstrncat(osbuf, TEXT( "Web Edition" ), maxsiz); + else bstrncat(osbuf, TEXT( "Standard Edition" ), maxsiz); + } + } + } + + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) { + bstrncat(osbuf, TEXT("Windows XP "), maxsiz); + if( osvi.wSuiteMask & VER_SUITE_PERSONAL ) + bstrncat(osbuf, TEXT( "Home Edition" ), maxsiz); + else + bstrncat(osbuf, TEXT( "Professional" ), maxsiz); + } + + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) { + bstrncat(osbuf, TEXT("Windows 2000 "), maxsiz); + if ( osvi.wProductType == VER_NT_WORKSTATION ) { + bstrncat(osbuf, TEXT( "Professional" ), maxsiz); + } else { + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + bstrncat(osbuf, TEXT( "Datacenter Server" ), maxsiz); + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + bstrncat(osbuf, TEXT( "Advanced Server" ), maxsiz); + else bstrncat(osbuf, TEXT( "Server" ), maxsiz); + } + } + + // Include service pack (if any) and build number. + + if (_tcslen(osvi.szCSDVersion) > 0) { + bstrncat(osbuf, TEXT(" ") , maxsiz); + bstrncat(osbuf, osvi.szCSDVersion, maxsiz); + } + + char buf[80]; + + snprintf(buf, 80, " (build %d)", (int)osvi.dwBuildNumber); + bstrncat(osbuf, buf, maxsiz); + + if (osvi.dwMajorVersion >= 6) { + if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) + bstrncat(osbuf, TEXT( ", 64-bit" ), maxsiz); + else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL ) + bstrncat(osbuf, TEXT(", 32-bit"), maxsiz); + } + + return true; + } else { + bstrncpy(osbuf, "Unknown Windows version.", maxsiz); + return true; + } +} diff --git a/bacula/src/win32/libwin32/protos.h b/bacula/src/win32/libwin32/protos.h new file mode 100644 index 0000000000..38bdeb13d5 --- /dev/null +++ b/bacula/src/win32/libwin32/protos.h @@ -0,0 +1,50 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#define log_error_message(msg) LogLastErrorMsg((msg), __FILE__, __LINE__) + +extern int BaculaAppMain(); +extern void LogLastErrorMsg(const char *msg, const char *fname, int lineno); + +extern int BaculaMain(int argc, char *argv[]); +extern BOOL ReportStatus(DWORD state, DWORD exitcode, DWORD waithint); +extern void d_msg(const char *, int, int, const char *, ...); +extern char *bac_status(char *buf, int buf_len); + + +/* service.cpp */ +bool postToBacula(UINT message, WPARAM wParam, LPARAM lParam); +bool isAService(); +int installService(const char *svc); +int removeService(); +int stopRunningBacula(); +int baculaServiceMain(); + + +/* Globals */ +extern DWORD service_thread_id; +extern DWORD service_error; +extern bool opt_debug; +extern bool have_service_api; +extern HINSTANCE appInstance; +extern int bacstat; diff --git a/bacula/src/win32/libwin32/res.h b/bacula/src/win32/libwin32/res.h new file mode 100644 index 0000000000..6d9b9a66d4 --- /dev/null +++ b/bacula/src/win32/libwin32/res.h @@ -0,0 +1,41 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +/* Icon definitions */ +#define IDI_BACULA 100 +#define IDI_IDLE 101 +#define IDI_RUNNING 102 +#define IDI_JOB_ERROR 103 +#define IDI_JOB_WARNING 104 +#define IDR_TRAYMENU 105 +#define IDB_BACULABMP 106 + +#define IDC_TEXTDISPLAY 1000 + +#define ID_ABOUT 40000 +#define ID_STATUS 40001 +#define ID_CLOSE 40002 + +/* Dialog definitions */ +#define IDD_ABOUT 201 +#define IDD_STATUS 202 diff --git a/bacula/src/win32/libwin32/running.ico b/bacula/src/win32/libwin32/running.ico new file mode 100644 index 0000000000000000000000000000000000000000..32dc42cd3c159fea18072b3b5baba6999d87c692 GIT binary patch literal 766 zcmc&yu?~VT5Pd}wMy-RZwJeSret?0`a%lXrPEI8Lf}!Bzr^i}8{7j(2xG zt_gskN2wJU_YBxj+!GbCCJN-F^DxH1S_@EwoA3KgMJC`oBvwjJ=m^OxM5}`@t4eDx z!5@IN_TqhsrWRg8f0;Lp@baY}oe!hqe7%!W2btWDckbcqgP}O~f^y0Av;wk`|EMRU z{`Bg4Jb~o{C^}$a>6dG1pEpliw3nl4&nl8V=li~^a~+e;f+(0bnnm-9;Tu!&1=o0F AHvj+t literal 0 HcmV?d00001 diff --git a/bacula/src/win32/libwin32/saving.ico b/bacula/src/win32/libwin32/saving.ico new file mode 100644 index 0000000000000000000000000000000000000000..f6d50bf516caaa111e8598006ac9cac9ed166358 GIT binary patch literal 766 zcmbtSJx;?g7=0#0jMx!kPBRonq~rhy^#Cln0$1qjjca*l;0hgCP&-tj5>)1WcI<{! zl`8S#=g%+SuPg(KUtMbmJ}!V;+IzAlA4!Ev?x$g`g>w#|_1-g(w9#vx2PWQS9d{|GMa9(zmM9Oifg9J{yF$_zg`k0-syWK-!{PKm;c%Cp!Q4?eoMXst}RfUL&g>>lC`cR F_ZNY8Y|;P# literal 0 HcmV?d00001 diff --git a/bacula/src/win32/libwin32/service.cpp b/bacula/src/win32/libwin32/service.cpp new file mode 100644 index 0000000000..3d8a7eaecc --- /dev/null +++ b/bacula/src/win32/libwin32/service.cpp @@ -0,0 +1,586 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * + * Kern Sibbald, August 2007 + * + * This is a generic service routine, which is used by all three + * of the daemons. Each one compiles it with slightly different + * #defines. + * + */ + +#include "bacula.h" +#include "win32.h" + +/* Forward reference */ +static void set_service_description(SC_HANDLE hSCManager, + SC_HANDLE hService, LPSTR lpDesc); + +/* Other Window component dependencies */ +#define BAC_DEPENDENCIES __TEXT("tcpip\0afd\0") + +/* Service globals */ +SERVICE_STATUS_HANDLE service_handle; +SERVICE_STATUS service_status; +DWORD service_error = 0; +static bool is_service = false; + +/* Forward references */ +void WINAPI serviceControlCallback(DWORD ctrlcode); +BOOL ReportStatus(DWORD state, DWORD exitcode, DWORD waithint); +DWORD WINAPI baculaWorkerThread(LPVOID lpwThreadParam); + + +/* + * Post a message to a running instance of the app + */ +bool postToBacula(UINT message, WPARAM wParam, LPARAM lParam) +{ + /* Locate the Bacula menu window */ + HWND hservwnd = FindWindow(APP_NAME, NULL); + if (hservwnd == NULL) { + return false; + } + + /* Post the message to Bacula */ + PostMessage(hservwnd, message, wParam, lParam); + return true; +} + + +/* + * Running as a service? + */ +bool isAService() +{ + return is_service; +} + +/* + * terminate any running Bacula + */ +int stopRunningBacula() +{ + postToBacula(WM_CLOSE, 0, 0); + sleep(5); + return 0; +} + +/* + * New style service start callback handler for the OS. + * the OS returns control here immediately after starting + * the service. + */ +void WINAPI serviceStartCallback(DWORD argc, char **argv) +{ + DWORD dwThreadID; + + /* Register our service */ + service_handle = RegisterServiceCtrlHandler(APP_NAME, serviceControlCallback); + if (!service_handle) { + log_error_message(_("RegisterServiceCtlHandler failed")); + MessageBox(NULL, _("Failure contacting the Service Handler"), + APP_DESC, MB_OK); + return; + } + + service_status.dwServiceType = SERVICE_WIN32; + service_status.dwServiceSpecificExitCode = 0; + + /* Report status */ + if (!ReportStatus(SERVICE_START_PENDING, NO_ERROR, 45000)) { + ReportStatus(SERVICE_STOPPED, service_error, 0); + log_error_message(_("Service start report failed")); + return; + } + + /* Now create the Bacula worker thread */ + (void)CreateThread(NULL, 0, baculaWorkerThread, NULL, 0, &dwThreadID); + return; +} + +/* + * Stop our service + */ +static void serviceStop() +{ + /* Post a quit message our service thread */ + if (service_thread_id != 0) { + PostThreadMessage(service_thread_id, WM_QUIT, 0, 0); + } +} + +/* + * Service Control callback handler. The OS can call us here + * at any time, most often to stop the service. + */ +void WINAPI serviceControlCallback(DWORD ctrlcode) +{ + switch(ctrlcode) { + case SERVICE_CONTROL_STOP: + service_status.dwCurrentState = SERVICE_STOP_PENDING; + serviceStop(); /* our stop service routine */ + break; + } + + /* Report our status */ + ReportStatus(service_status.dwCurrentState, NO_ERROR, 0); +} + + +/* + * Run Bacula as a service + */ +int baculaServiceMain() +{ + is_service = true; /* indicate we are running as a service */ + + if (have_service_api) { /* New style service API */ + /* Tell OS where to dispatch service calls to us */ + SERVICE_TABLE_ENTRY dispatchTable[] = { + {(char *)APP_NAME, (LPSERVICE_MAIN_FUNCTION)serviceStartCallback}, + {NULL, NULL}}; + + /* Start the service control dispatcher */ + if (!StartServiceCtrlDispatcher(dispatchTable)) { + log_error_message(_("StartServiceCtrlDispatcher failed.")); + } + /* Note, this thread continues in the ServiceCallback routine */ + + } else { /* old style Win95/98/Me */ + HINSTANCE kerneldll = LoadLibrary("KERNEL32.DLL"); + if (kerneldll == NULL) { + MessageBox(NULL, _("KERNEL32.DLL not found: Bacula service not started"), + APP_DESC, MB_OK); + return 1; + } + + /* Get entry point for RegisterServiceProcess function */ + DWORD (WINAPI *RegisterService)(DWORD, DWORD); + RegisterService = (DWORD (WINAPI *)(DWORD, DWORD)) + GetProcAddress(kerneldll, "RegisterServiceProcess"); + if (RegisterService == NULL) { + MessageBox(NULL, _("Registry service not found: Bacula service not started"), + APP_DESC, MB_OK); + log_error_message(_("Registry service entry point not found")); + FreeLibrary(kerneldll); /* free up kernel dll */ + return 1; + } + + RegisterService(0, 1); /* register us as a service */ + BaculaAppMain(); /* call the main Bacula code */ + RegisterService(0, 0); /* terminate the service */ + FreeLibrary(kerneldll); /* free up kernel dll */ + } + return 0; +} + + +/* + * New style service bacula worker thread + */ +DWORD WINAPI baculaWorkerThread(LPVOID lpwThreadParam) +{ + service_thread_id = GetCurrentThreadId(); + + if (!ReportStatus(SERVICE_RUNNING, NO_ERROR, 0)) { + MessageBox(NULL, _("Report Service failure"), APP_DESC, MB_OK); + log_error_message("ReportStatus RUNNING failed"); + return 0; + } + + /* Call Bacula main code */ + BaculaAppMain(); + + /* Mark that we're no longer running */ + service_thread_id = 0; + + /* Tell the service manager that we've stopped */ + ReportStatus(SERVICE_STOPPED, service_error, 0); + return 0; +} + + + +/* + * Install the Bacula service on the OS -- very complicated + */ +int installService(const char *cmdOpts) +{ + const int maxlen = 2048; + char path[maxlen]; + char svcmd[maxlen]; + + bsnprintf(svcmd, sizeof(svcmd), "service: install: %s", cmdOpts, APP_DESC, MB_OK); + + /* Get our filename */ + if (GetModuleFileName(NULL, path, maxlen-11) == 0) { + MessageBox(NULL, _("Unable to install the service"), APP_DESC, MB_ICONEXCLAMATION | MB_OK); + return 0; + } + + /* Create a valid command for starting the service */ + if ((int)strlen(path) + (int)strlen(cmdOpts) + 30 < maxlen) { + bsnprintf(svcmd, sizeof(svcmd), "\"%s\" /service %s", path, cmdOpts); + } else { + log_error_message(_("Service command length too long")); + MessageBox(NULL, _("Service command length too long. Service not registered."), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + return 0; + } + + if (have_service_api) { + SC_HANDLE baculaService, serviceManager; + + /* Open the service control manager */ + serviceManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (!serviceManager) { + log_error_message("Open Service Manager failed"); + MessageBox(NULL, + _("The Service Control Manager could not be contacted - the service was not installed"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + return 0; + } + + /* Now actually create the Bacula service entry */ + baculaService = CreateService( + serviceManager, + APP_NAME, /* Our service name */ + APP_DESC, /* Display name */ + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, /* | SERVICE_INTERACTIVE_PROCESS, */ + SERVICE_AUTO_START, + SERVICE_ERROR_NORMAL, + svcmd, /* Command string to start the service */ + NULL, + NULL, + BAC_DEPENDENCIES, /* Services to start before us */ + NULL, /* Use default SYSTEM account */ + NULL); + if (!baculaService) { + CloseServiceHandle(serviceManager); + log_error_message("CreateService failed for " APP_DESC); + MessageBox(NULL, _("The Bacula service: " APP_NAME " could not be installed"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + return 0; + } + + /* Set a text description in the service manager's control panel */ + set_service_description(serviceManager, baculaService, +(char *)_("Provides file backup and restore services. Bacula -- the network backup solution.")); + + CloseServiceHandle(serviceManager); + CloseServiceHandle(baculaService); + + } else { + /* Old style service -- create appropriate registry key path */ + HKEY runservices; + if (RegCreateKey(HKEY_LOCAL_MACHINE, + "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices", + &runservices) != ERROR_SUCCESS) { + log_error_message(_("Cannot write System Registry for " APP_DESC)); + MessageBox(NULL, _("The System Registry could not be updated - the Bacula service was not installed"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + return 0; + } + + /* Add the Bacula values */ + if (RegSetValueEx(runservices, APP_NAME, 0, REG_SZ, + (unsigned char *)svcmd, strlen(svcmd)+1) != ERROR_SUCCESS) { + RegCloseKey(runservices); + log_error_message(_("Cannot add Bacula key to System Registry")); + MessageBox(NULL, _("The Bacula service: " APP_NAME " could not be installed"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + return 0; + } + RegCloseKey(runservices); + } + + /* At this point the service is installed */ + if (opt_debug) { + MessageBox(NULL, + _("The " APP_DESC "was successfully installed.\n" + "The service may be started by double clicking on the\n" + "Bacula \"Start\" icon and will be automatically\n" + "be run the next time this machine is rebooted. "), + APP_DESC, MB_ICONINFORMATION | MB_OK); + } + return 0; +} + + +/* + * Remove a service from the OS (normally done when we are installing + * a new version). + */ +int removeService() +{ + SC_HANDLE serviceManager, baculaService; + int stat = 0; + + if (have_service_api) { /* Newer Windows platforms (NT, Win2K, ...) */ + serviceManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (serviceManager) { + /* Now get the Bacula service entry */ + baculaService = OpenService(serviceManager, APP_NAME, SERVICE_ALL_ACCESS); + if (baculaService) { + SERVICE_STATUS status; + /* If the service is running, stop it */ + if (ControlService(baculaService, SERVICE_CONTROL_STOP, &status)) { + while(QueryServiceStatus(baculaService, &status)) { + if (status.dwCurrentState != SERVICE_STOP_PENDING) { + break; + } + sleep(1); + } + if (status.dwCurrentState != SERVICE_STOPPED) { + if (opt_debug) { + MessageBox(NULL, _("The Bacula service: " APP_NAME " could not be stopped"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + } + } + } + if (DeleteService(baculaService)) { + if (opt_debug) { + MessageBox(NULL, _("The Bacula service: " APP_NAME " has been removed"), + APP_DESC, MB_ICONINFORMATION | MB_OK); + } + } else { + MessageBox(NULL, _("The Bacula service: " APP_NAME " could not be removed"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + stat = 1; /* error */ + } + CloseServiceHandle(baculaService); + } else { + if (opt_debug) { + MessageBox(NULL, _("An existing Bacula service: " APP_NAME " could not be found for " + "removal. This is not normally an error."), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + } + } + CloseServiceHandle(serviceManager); + return stat; + } else { + MessageBox(NULL, _("The service Manager could not be contacted - the Bacula service was not removed"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + return 1; /* error */ + } + + } else { /* Old Win95/98/Me OS */ + /* Open the registry path key */ + HKEY runservices; + if (RegOpenKey(HKEY_LOCAL_MACHINE, + "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices", + &runservices) != ERROR_SUCCESS) { + if (opt_debug) { + MessageBox(NULL, + _("Could not find registry entry.\nService probably not registerd - the Bacula service was not removed"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + } + } else { + /* Now delete the Bacula entry */ + if (RegDeleteValue(runservices, APP_NAME) != ERROR_SUCCESS) { + RegCloseKey(runservices); + MessageBox(NULL, _("Could not delete Registry key for " APP_NAME ".\n" + "The Bacula service could not be removed"), APP_DESC, MB_ICONEXCLAMATION | MB_OK); + } + RegCloseKey(runservices); + return 1; + } + /* Stop any running Bacula */ + if (!stopRunningBacula()) { + if (opt_debug) { + MessageBox(NULL, + _("Bacula could not be contacted, probably not running"), + APP_DESC, MB_ICONEXCLAMATION | MB_OK); + } + return 0; /* not really an error */ + } + /* At this point, the service has been removed */ + if (opt_debug) { + MessageBox(NULL, _("The Bacula service has been removed"), APP_DESC, MB_ICONINFORMATION | MB_OK); + } + } + return 0; +} + + +/* + * This subroutine is called to report our current status to the + * new style service manager + */ +BOOL ReportStatus(DWORD state, DWORD exitcode, DWORD waithint) +{ + static DWORD checkpoint = 1; + BOOL result = TRUE; + + /* No callbacks until we are started */ + if (state == SERVICE_START_PENDING) { + service_status.dwControlsAccepted = 0; + } else { + service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP; + } + + /* Save global service_status state */ + service_status.dwCurrentState = state; + service_status.dwWin32ExitCode = exitcode; + service_status.dwWaitHint = waithint; + + /* + * Update the checkpoint variable so the service manager knows + * we are alive. + */ + if (state == SERVICE_RUNNING || state == SERVICE_STOPPED) { + service_status.dwCheckPoint = 0; + } else { + service_status.dwCheckPoint = checkpoint++; + } + + /* Send our new status */ + result = SetServiceStatus(service_handle, &service_status); + if (!result) { + log_error_message(_("SetServiceStatus failed")); + } + return result; +} + +/* Log an error message for the last Windows error */ +void LogLastErrorMsg(const char *message, const char *fname, int lineno) +{ + char msgbuf[500]; + HANDLE eventHandler; + const char *strings[3]; + LPTSTR msg; + + service_error = GetLastError(); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER| + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + service_error, + 0, + (LPTSTR)&msg, + 0, + NULL); + + /* Use the OS event logging to log the error */ + eventHandler = RegisterEventSource(NULL, APP_NAME); + + bsnprintf(msgbuf, sizeof(msgbuf), _("\n\n%s error: %ld at %s:%d"), + APP_NAME, service_error, fname, lineno); + + strings[0] = msgbuf; + strings[1] = message; + strings[2] = msg; + + if (eventHandler) { + ReportEvent(eventHandler, EVENTLOG_ERROR_TYPE, + 0, /* category */ + 0, /* ID */ + NULL, /* SID */ + 3, /* Number of strings */ + 0, /* raw data size */ + (const char **)strings, /* error strings */ + NULL); /* raw data */ + DeregisterEventSource(eventHandler); + } + LocalFree(msg); +} + +typedef BOOL (WINAPI * WinAPI)(SC_HANDLE, DWORD, LPVOID); + +/* + * This is amazingly complicated just to get a bit of English explanation + * in the service manager's dialog box. + */ +static void set_service_description(SC_HANDLE hSCManager, SC_HANDLE hService, + LPSTR lpDesc) +{ + SC_LOCK sclLock; + LPQUERY_SERVICE_LOCK_STATUS lpqslsBuf; + SERVICE_DESCRIPTION sdBuf; + DWORD dwBytesNeeded; + WinAPI ChangeServiceDescription; + + HINSTANCE hLib = LoadLibrary("ADVAPI32.DLL"); + if (!hLib) { + return; + } + ChangeServiceDescription = (WinAPI)GetProcAddress(hLib, + "ChangeServiceConfig2A"); + FreeLibrary(hLib); + if (!ChangeServiceDescription) { + return; + } + + // Need to acquire database lock before reconfiguring. + sclLock = LockServiceDatabase(hSCManager); + + // If the database cannot be locked, report the details. + if (sclLock == NULL) { + // Exit if the database is not locked by another process. + if (GetLastError() != ERROR_SERVICE_DATABASE_LOCKED) { + log_error_message("LockServiceDatabase"); + return; + } + + // Allocate a buffer to get details about the lock. + lpqslsBuf = (LPQUERY_SERVICE_LOCK_STATUS)LocalAlloc( + LPTR, sizeof(QUERY_SERVICE_LOCK_STATUS)+256); + if (lpqslsBuf == NULL) { + log_error_message("LocalAlloc"); + return; + } + + // Get and print the lock status information. + if (!QueryServiceLockStatus( + hSCManager, + lpqslsBuf, + sizeof(QUERY_SERVICE_LOCK_STATUS)+256, + &dwBytesNeeded)) { + log_error_message("QueryServiceLockStatus"); + } + + if (lpqslsBuf->fIsLocked) { + printf(_("Locked by: %s, duration: %ld seconds\n"), + lpqslsBuf->lpLockOwner, + lpqslsBuf->dwLockDuration); + } else { + printf(_("No longer locked\n")); + } + + LocalFree(lpqslsBuf); + log_error_message(_("Could not lock database")); + return; + } + + // The database is locked, so it is safe to make changes. + + sdBuf.lpDescription = lpDesc; + + if (!ChangeServiceDescription( + hService, // handle to service + SERVICE_CONFIG_DESCRIPTION, // change: description + &sdBuf) ) { // value: new description + log_error_message("ChangeServiceConfig2"); + } + + // Release the database lock. + UnlockServiceDatabase(sclLock); +} diff --git a/bacula/src/win32/libwin32/statusDialog.cpp b/bacula/src/win32/libwin32/statusDialog.cpp new file mode 100644 index 0000000000..674783c94c --- /dev/null +++ b/bacula/src/win32/libwin32/statusDialog.cpp @@ -0,0 +1,165 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Bacula File daemon Status Dialog box + * + * Kern Sibbald, August 2007 + * + */ + +#include "bacula.h" +#include "win32.h" +#include "statusDialog.h" +#include "lib/status.h" + +static BOOL CALLBACK dialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + /* Get class pointer from user data */ + statusDialog *statDlg = (statusDialog *)GetWindowLong(hDlg, GWL_USERDATA); + + switch (uMsg) { + case WM_INITDIALOG: + /* Set class pointer in user data */ + SetWindowLong(hDlg, GWL_USERDATA, lParam); + statDlg = (statusDialog *)lParam; + statDlg->m_textWin = GetDlgItem(hDlg, IDC_TEXTDISPLAY); + + /* show the dialog */ + SetForegroundWindow(hDlg); + + /* Update every 5 seconds */ + SetTimer(hDlg, 1, 5000, NULL); + statDlg->m_visible = true; + statDlg->display(); + return true; + + case WM_TIMER: + statDlg->display(); + return true; + + case WM_SIZE: + statDlg->resize(hDlg, LOWORD(lParam), HIWORD(lParam)); + return true; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDCANCEL: + case IDOK: + statDlg->m_visible = false; + KillTimer(hDlg, 1); + EndDialog(hDlg, true); + return true; + } + break; + + case WM_DESTROY: + statDlg->m_textWin = NULL; + statDlg->m_visible = false; + KillTimer(hDlg, 1); + EndDialog(hDlg, false); + return true; + } + return false; +} + + +static void displayString(const char *msg, int len, void *context) +{ + /* Get class pointer from user data */ + statusDialog *statDlg = (statusDialog *)context; + const char *start = msg; + const char *p; + char *str; + + for (p=start; *p; p++) { + if (*p == '\n') { + int len = p - start; + if (len > 0) { + str = (char *)alloca(len + 1); + bstrncpy(str, start, len + 1); + + SendMessage(statDlg->m_textWin, EM_SETSEL, (WPARAM)-1, (LPARAM)-1); + SendMessage(statDlg->m_textWin, EM_REPLACESEL, 0, (LPARAM)str); + } + + if (*p == '\n') { + SendMessage(statDlg->m_textWin, EM_SETSEL, (WPARAM)-1, (LPARAM)-1); + SendMessage(statDlg->m_textWin, EM_REPLACESEL, 0, (LPARAM)"\r\n"); + } + + if (*p == '\0'){ + break; + } + start = p + 1; + } + } +} + +void statusDialog::display() +{ + if (m_textWin != NULL) { + STATUS_PKT sp; + long hPos = GetScrollPos(m_textWin, SB_HORZ); + long vPos = GetScrollPos(m_textWin, SB_VERT); + long selStart; + long selEnd; + + SendMessage(m_textWin, EM_GETSEL, (WPARAM)&selStart, (LPARAM)&selEnd); + + SetWindowText(m_textWin, ""); + sp.bs = NULL; + sp.context = this; + sp.callback = displayString; + output_status(&sp); + + SendMessage(m_textWin, EM_SETSEL, selStart, selEnd); + SendMessage(m_textWin, WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, hPos), 0); + SendMessage(m_textWin, WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, vPos), 0); + } +} + +/* Dialog box handling functions */ +void statusDialog::show(bool show) +{ + if (show && !m_visible) { + DialogBoxParam(appInstance, MAKEINTRESOURCE(IDD_STATUS), NULL, + (DLGPROC)dialogProc, (LPARAM)this); + } +} + +/* + * Make sure OK button is positioned in the right place + */ +void statusDialog::resize(HWND dWin, int dWidth, int dHeight) +{ + int bWidth, bHeight; + RECT bRect; + HWND bWin; + + if (m_textWin != NULL) { + bWin = GetDlgItem(dWin, IDOK); /* get size of OK button */ + + GetWindowRect(bWin, &bRect); + bWidth = bRect.right - bRect.left; + bHeight = bRect.bottom - bRect.top; + + MoveWindow(m_textWin, 8, 8, dWidth-bWidth-24, dHeight-16, true); + MoveWindow(bWin, dWidth - bWidth-8, 8, bWidth, bHeight, true); + } +} diff --git a/bacula/src/win32/libwin32/statusDialog.h b/bacula/src/win32/libwin32/statusDialog.h new file mode 100644 index 0000000000..f2770834b3 --- /dev/null +++ b/bacula/src/win32/libwin32/statusDialog.h @@ -0,0 +1,45 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Bacula Status Dialog header file + * + * Kern Sibbald, August 2007 + * + */ + +#ifndef __STATUS_DIALOG_H_ +#define __STATUS_DIALOG_H_ + +class statusDialog +{ +public: + statusDialog() { m_visible = false; m_textWin = NULL; }; + ~statusDialog() { }; + + void display(); + + void show(bool show); + + void resize(HWND win, int width, int height); + + bool m_visible; + HWND m_textWin; +}; + +#endif diff --git a/bacula/src/win32/libwin32/trayMonitor.cpp b/bacula/src/win32/libwin32/trayMonitor.cpp new file mode 100644 index 0000000000..ca0bd04593 --- /dev/null +++ b/bacula/src/win32/libwin32/trayMonitor.cpp @@ -0,0 +1,263 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * + * Kern Sibbald, August 2007 + * + * This is a generic tray monitor routine, which is used by all three + * of the daemons. Each one compiles it with slightly different + * #defines. + * + */ + +#include "bacula.h" +#include "jcr.h" +#include "win32.h" + +trayMonitor::trayMonitor() +{ + +// m_tbcreated_msg = RegisterWindowMessage("TaskbarCreated"); + + /* Create a window to handle tray icon messages */ + WNDCLASSEX trayclass; + + trayclass.cbSize = sizeof(trayclass); + trayclass.style = 0; + trayclass.lpfnWndProc = trayMonitor::trayWinProc; + trayclass.cbClsExtra = 0; + trayclass.cbWndExtra = 0; + trayclass.hInstance = appInstance; + trayclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); + trayclass.hCursor = LoadCursor(NULL, IDC_ARROW); + trayclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + trayclass.lpszMenuName = NULL; + trayclass.lpszClassName = APP_NAME; + trayclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + + RegisterClassEx(&trayclass); + + m_hwnd = CreateWindow(APP_NAME, APP_NAME, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, + NULL, NULL, appInstance, NULL); + if (!m_hwnd) { + PostQuitMessage(0); + return; + } + + /* Save our class pointer */ + SetWindowLong(m_hwnd, GWL_USERDATA, (LPARAM)this); + + + // Load the icons for the tray + m_idle_icon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_IDLE)); + m_running_icon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_RUNNING)); + m_error_icon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_JOB_ERROR)); + m_warn_icon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_JOB_WARNING)); + + /* Load the menu */ + m_hmenu = LoadMenu(appInstance, MAKEINTRESOURCE(IDR_TRAYMENU)); + m_visible = false; + m_installed = false; + + /* Install the icon in the tray */ + install(); + + /* Timer to trigger icon updating */ + SetTimer(m_hwnd, 1, 5000, NULL); +} + +trayMonitor::~trayMonitor() +{ + /* Remove the icon from the tray */ + sendMessage(NIM_DELETE, 0); + + if (m_hmenu) { + DestroyMenu(m_hmenu); + m_hmenu = NULL; + } +} + +void trayMonitor::install() +{ + m_installed = true; + sendMessage(NIM_ADD, bacstat); +} + +void trayMonitor::update(int bacstat) +{ + if (!m_installed) { + install(); + } + (void)bac_status(NULL, 0); + sendMessage(NIM_MODIFY, bacstat); +} + +void trayMonitor::sendMessage(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 + switch (bacstat) { + case 0: + m_nid.hIcon = m_idle_icon; + break; + case JS_Running: + m_nid.hIcon = m_running_icon; + 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; + + + /* Use the resource string as tip */ + if (LoadString(appInstance, IDI_BACULA, m_nid.szTip, sizeof(m_nid.szTip))) { + m_nid.uFlags |= NIF_TIP; + } + + /* Add the Bacula status to the tip string */ + if (m_nid.uFlags & NIF_TIP) { + bac_status(m_nid.szTip, sizeof(m_nid.szTip)); + } + + if (Shell_NotifyIcon(msg, &m_nid)) { + EnableMenuItem(m_hmenu, ID_CLOSE, MF_ENABLED); + } +} + +/* + * This is the windows call back for our tray window + */ +LRESULT CALLBACK trayMonitor::trayWinProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) +{ + HMENU menu; + trayMonitor *mon = (trayMonitor *)GetWindowLong(hwnd, GWL_USERDATA); + + switch (iMsg) { + + /* Every five seconds, a timer message causes the icon to update */ + case WM_TIMER: + if (isAService()) { + mon->install(); + } + mon->update(bacstat); + break; + + case WM_CREATE: + return 0; + + case WM_COMMAND: + /* User has clicked an item on the tray monitor menu */ + switch (LOWORD(wParam)) { + case ID_STATUS: + /* show the dialog box */ + mon->m_status.show(true); + mon->update(bacstat); + break; + + case ID_ABOUT: + /* Show the About box */ + mon->m_about.show(true); + break; + + /* This is turned off now */ +#ifdef xxx + case ID_CLOSE: + /* User selected Close from the tray menu */ + PostMessage(hwnd, WM_CLOSE, 0, 0); + break; +#endif + + } + return 0; + + /* Our special command to check for mouse events */ + case WM_TRAYNOTIFY: + /* Right button click pops up the menu */ + if (lParam == WM_RBUTTONUP) { + POINT mouse; + /* Get the menu and pop it up */ + menu = GetSubMenu(mon->m_hmenu, 0); + if (!menu) { + return 0; + } + + /* The first menu item (Status) is the default */ + SetMenuDefaultItem(menu, 0, TRUE); + GetCursorPos(&mouse); + SetForegroundWindow(mon->m_nid.hWnd); /* display the menu */ + + /* Open the menu at the mouse position */ + TrackPopupMenu(menu, 0, mouse.x, mouse.y, 0, mon->m_nid.hWnd, NULL); + + /* Left double click brings up status dialog directly */ + } else if (lParam == WM_LBUTTONDBLCLK) { + mon->m_status.show(true); + mon->update(bacstat); + } + return 0; + + case WM_CLOSE: + if (isAService()) { + mon->sendMessage(NIM_DELETE, 0); + } + terminate_app(0); + break; + + case WM_DESTROY: + /* zap everything */ + PostQuitMessage(0); + return 0; + + case WM_QUERYENDSESSION: + if (!isAService() || lParam == 0) { + PostQuitMessage(0); + return TRUE; + } + return TRUE; + + default: + /* Need to redraw tray icon */ +// if (iMsg == mon->m_tbcreated_msg) { +// mon->install(); +// } + break; + } + + return DefWindowProc(hwnd, iMsg, wParam, lParam); +} diff --git a/bacula/src/win32/libwin32/trayMonitor.h b/bacula/src/win32/libwin32/trayMonitor.h new file mode 100644 index 0000000000..283aaf2867 --- /dev/null +++ b/bacula/src/win32/libwin32/trayMonitor.h @@ -0,0 +1,59 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#ifndef __TRAY_MONITOR_H_ +#define __TRAY_MONITOR_H_ 1 + +#define WM_TRAYNOTIFY WM_USER+1 + +/* Define the trayMonitor class */ +class trayMonitor +{ +public: + trayMonitor(); + ~trayMonitor(); + + void show(bool show); + void install(); + void update(int bacstat); + void sendMessage(DWORD msg, int bacstat); + + static LRESULT CALLBACK trayWinProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam); + + bool m_visible; + bool m_installed; + UINT m_tbcreated_msg; + + aboutDialog m_about; + statusDialog m_status; + + HWND m_hwnd; + HMENU m_hmenu; + NOTIFYICONDATA m_nid; + HICON m_idle_icon; + HICON m_running_icon; + HICON m_error_icon; + HICON m_warn_icon; +}; + +#endif /* __TRAY_MONITOR_H_ */ diff --git a/bacula/src/win32/libwin32/warn.ico b/bacula/src/win32/libwin32/warn.ico new file mode 100644 index 0000000000000000000000000000000000000000..26e1d398bb446fb55d02635a2afa4dc8489e0587 GIT binary patch literal 766 zcmc&yu?~VT5Pd}wMy-RZwJeSret?0`a%lXrPEI8Lf}!Bzr^i}8{7j(2xG zt_gskN2wJU_YBxj+!GbCCJN-F^DxH1S_@EwbMuWqsmKI;hr~+B2^}GMgJ^Z|WmReI zCHMod)?U0X(bU3A=r8l85njIZqw`^OoUeCM>L8Q*@yo9M@*nkN z)Sq5mk0-Ev07VBZEd6pV?epeoi}rFf?O8>#=X~FHb*^L5Sr7&DMzd&MF??exz5s&v BWi|i+ literal 0 HcmV?d00001 diff --git a/bacula/src/win32/libwin32/win32.h b/bacula/src/win32/libwin32/win32.h new file mode 100644 index 0000000000..6511bd0ce8 --- /dev/null +++ b/bacula/src/win32/libwin32/win32.h @@ -0,0 +1,31 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#include "protos.h" +#include "res.h" + +#ifdef HAVE_TRAY_MONITOR +#include "aboutDialog.h" +#include "statusDialog.h" +#include "trayMonitor.h" +#endif diff --git a/bacula/src/win32/makeall b/bacula/src/win32/makeall new file mode 100755 index 0000000000..0a31ac5df9 --- /dev/null +++ b/bacula/src/win32/makeall @@ -0,0 +1,7 @@ +#!/bin/sh +make clean +# Build win32 Bacula +make bat=no +# +# Build win64 Bacula +make win64=yes diff --git a/bacula/src/win32/patches/binutils_texinfo_version.patch b/bacula/src/win32/patches/binutils_texinfo_version.patch new file mode 100644 index 0000000000..01100e9abe --- /dev/null +++ b/bacula/src/win32/patches/binutils_texinfo_version.patch @@ -0,0 +1,31 @@ +diff -Nur binutils-2.16.91-20060119-1.orig/configure binutils-2.16.91-20060119-1.patched/configure +--- binutils-2.16.91-20060119-1.orig/configure 2006-01-19 04:57:59.000000000 +0000 ++++ binutils-2.16.91-20060119-1.patched/configure 2008-10-04 02:43:58.768687939 +0000 +@@ -3549,7 +3549,7 @@ + # For an installed makeinfo, we require it to be from texinfo 4.2 or + # higher, else we use the "missing" dummy. + if ${MAKEINFO} --version \ +- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null 2>&1; then ++ | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|4\.1[0-9]|[5-9])' >/dev/null 2>&1; then + : + else + MAKEINFO="$MISSING makeinfo" +diff -Nur binutils-2.16.91-20060119-1.orig/gas/Makefile.in binutils-2.16.91-20060119-1.patched/gas/Makefile.in +--- binutils-2.16.91-20060119-1.orig/gas/Makefile.in 2006-01-19 04:59:26.000000000 +0000 ++++ binutils-2.16.91-20060119-1.patched/gas/Makefile.in 2008-10-04 03:13:51.380719189 +0000 +@@ -3266,6 +3266,7 @@ + .PHONY: dep dep-in dep-am + #MKDEP DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW. + app.o: app.c $(INCDIR)/symcat.h ++ $(COMPILE) -c $< $(NO_WERROR) + as.o: as.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ + output-file.h sb.h macro.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(BFDVER_H) +@@ -3302,6 +3303,7 @@ + read.o: read.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h sb.h macro.h ecoff.h \ + dw2gencfi.h $(INCDIR)/elf/dwarf2.h ++ $(COMPILE) -c $< $(NO_WERROR) + sb.o: sb.c sb.h $(INCDIR)/symcat.h + stabs.o: stabs.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ + subsegs.h ecoff.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def diff --git a/bacula/src/win32/patches/dvd+rw-tools.patch b/bacula/src/win32/patches/dvd+rw-tools.patch new file mode 100644 index 0000000000..3f73d35006 --- /dev/null +++ b/bacula/src/win32/patches/dvd+rw-tools.patch @@ -0,0 +1,264 @@ +--- ../orig/dvd+rw-tools-7.0/growisofs.c 2006-09-24 10:28:53.000000000 -0700 ++++ ./growisofs.c 2006-12-07 01:56:17.000000000 -0800 +@@ -370,12 +370,17 @@ + * upon Layer Break command, therefore longer timeout is required; + * - Linux: deploy BLKFLSBUF to avoid media reloads when possible; + * - add unit buffer utilization indicator [by request from K3b]; ++ * 7.0.1: (by Nicolas Boichat, Bacula project) ++ * - Allow session to cross 4GB boundary regardless of medium type ++ * (don't need to have a DL media) ++ * - Add a -F option (used instead of -M or -Z), which displays next_session ++ * offset and capacity (free space = next_session - capacity). + */ + #define PRINT_VERSION(cmd) do { \ + char *s=strrchr((cmd),'/'); \ + s ? s++ : (s=(cmd)); \ + printf ("* %.*sgrowisofs by ,"\ +- " version 7.0,\n",(int)(s-(cmd)),(cmd)); \ ++ " version 7.0.1,\n",(int)(s-(cmd)),(cmd)); \ + } while (0) + + #define _LARGEFILE_SOURCE +@@ -2576,7 +2581,8 @@ + else arg = mkisofs_argv[0]; + + cmdsz--; +- assert ((len0=strlen (arg)) < cmdsz); ++ len0 = strlen (arg); ++ assert (len0 < cmdsz); + + strcpy (cmd,arg), cmd[len0++] = ' ', cmdsz -= len0; + +@@ -2773,6 +2779,18 @@ + else in_device = argv[++i]; + dev_found = 'Z'; + } ++ else if (argv[i][1] == 'F') ++ { if (len > 2) in_device = argv[i]+2; ++ else in_device = argv[++i]; ++ dev_found = 'F'; ++ dry_run = 1; /* NEVER write anything with -F */ ++ } ++ else if (!strncmp(opt,"-free-space",11)) ++ { if (len > 11) in_device = opt+11; ++ else in_device = argv[++i]; ++ dev_found = 'F'; ++ dry_run = 1; /* NEVER write anything with -F */ ++ } + else if (!strcmp(opt,"-poor-man")) + { if (poor_man<0) poor_man = 1; + continue; +@@ -2898,7 +2916,7 @@ + else if (argv[i][1] == '?' || !strcmp(opt,"-help")) + { PRINT_VERSION (argv[0]); + printf ("- usage: %s [-dvd-compat] [-overburn] [-speed=1] \\\n" +- " -[ZM] /dev/dvd \n",argv[0]); ++ " -[ZMF] /dev/dvd \n",argv[0]); + printf (" for see 'mkisofs %s'\n",opt); + exit (FATAL_START(EINVAL)); + } +@@ -2993,7 +3011,13 @@ + fprintf (stderr," you most likely want to use -Z option.\n"), + exit (FATAL_START(errno)); + +- if (dev_found == 'M') ++ if ((dev_found == 'M') || ++ ((dev_found == 'F') && !(mmc_profile&0x10000)) && ++ (saved_descriptors[0].type[0] || ++ saved_descriptors[0].type[1] || ++ saved_descriptors[0].type[2])) ++ /* -F : The medium is not blank, there is a fs on it (the_buffer[0,1 or 2] != 0), ++ so compute next_session. */ + { if (memcmp (saved_descriptors[0].type,"\1CD001",6)) + fprintf (stderr,":-( %s doesn't look like isofs...\n", + in_device), exit(FATAL_START(EMEDIUMTYPE)); +@@ -3016,8 +3040,7 @@ + exit(FATAL_START(EINVAL)); + } + else if (next_session > (0x200000-0x5000)) /* 4GB/2K-40MB/2K */ +- if ((mmc_profile&0xFFFF)<0x20 || +- ((mmc_profile&0xFFFF)<0x40 && !no_4gb_check)) ++ if ((mmc_profile&0xFFFF)<0x40 && !no_4gb_check) + fprintf (stderr,":-( next session would cross 4GB " + "boundary, aborting...\n"), + exit (FATAL_START(ENOSPC)); +@@ -3060,7 +3083,7 @@ + exit (FATAL_START(EINVAL)); + + if (imgfd<0) +- { if (mkisofs_argc==1) ++ { if ((mkisofs_argc==1) && (dev_found != 'F')) + fprintf (stderr,"%s: no mkisofs options specified, " + "aborting...\n",argv[0]), + exit (FATAL_START(EINVAL)); +@@ -3244,6 +3267,15 @@ + } + } + ++ if (dev_found == 'F') { ++ off64_t capacity = 0; ++ printf("next_session=%d\n", next_session * CD_BLOCK); ++ if (ioctl_handle!=INVALID_HANDLE) ++ capacity = get_capacity (ioctl_handle); ++ printf("capacity=%lld\n", capacity); ++ exit(0); ++ } ++ + if (imgfd>=0) + { quiet--; + if (builtin_dd (imgfd,out_fd,next_session*CD_BLOCK) < 0) +--- ../orig/dvd+rw-tools-7.0/Makefile 2006-08-27 13:07:37.000000000 -0700 ++++ ./Makefile 2006-12-07 01:56:17.000000000 -0800 +@@ -9,7 +9,7 @@ + + CHAIN=growisofs dvd+rw-format dvd+rw-booktype dvd+rw-mediainfo dvd-ram-control + clean: +- -(rm *.o $(CHAIN) rpl8 btcflash; exit 0) < /dev/null > /dev/null 2>&1 ++ -(rm *.o $(CHAIN) $(CHAIN:=.exe) rpl8 btcflash; exit 0) < /dev/null > /dev/null 2>&1 + + VER=7.0 + DIST=dvd+rw-tools-$(VER) +--- ../orig/dvd+rw-tools-7.0/Makefile.m4 2006-09-24 10:55:19.000000000 -0700 ++++ ./Makefile.m4 2006-12-07 01:59:30.000000000 -0800 +@@ -1,12 +1,5 @@ + # OBS! M4 processed! + changequote([, ]) +-[ +-CHAIN=growisofs dvd+rw-format dvd+rw-booktype dvd+rw-mediainfo dvd-ram-control +- +-dvd+rw-tools: $(CHAIN) +- +-WARN=#-Wall # developers are welcomed to build with `make WARN=-Wall' +-] + + # fix-up OS macro + ifelse(substr(OS,0,7),[CYGWIN_],[define([OS],[MINGW32])]) +@@ -38,11 +31,36 @@ + # + # MINGW section + # ++SUFFIXES+=.exe + CC =gcc + CFLAGS +=$(WARN) -mno-cygwin -O2 + CXX =g++ + CXXFLAGS+=$(WARN) -mno-cygwin -O2 -fno-exceptions + LINK.o =$(LINK.cc) ++EXE =.exe ++]) ++ ++ifelse(OS,XMINGW32,[ ++# ++# MINGW cross-compile section ++# ++SUFFIXES+=.exe ++CC =mingw32-gcc ++CFLAGS +=$(WARN) -mno-cygwin -O2 ++CXX =mingw32-g++ ++CXXFLAGS+=$(WARN) -mno-cygwin -O2 -fno-exceptions ++LINK.o =$(LINK.cc) ++EXE =.exe ++%.exe:%.o ++ $(CXX) $(CXXFLAGS) -o $@ $> $^ $(LDFLAGS) $(LDLIBS) ++ ++install: dvd+rw-tools ++ [[ -d $(prefix)/bin ]] || mkdir -p $(prefix)/bin ++ install -m 0755 $(CHAIN) $(prefix)/bin ++ [[ -d $(manprefix)/man1 ]] || mkdir -p $(manprefix)/man1 ++ install -m 0644 growisofs.1 $(manprefix)/man1 ++ -[[ -f rpl8 ]] && install -m 0755 rpl8 $(prefix)/bin; : ++ -[[ -f btcflash ]] && install -m 0755 btcflash $(prefix)/bin; : + ]) + + ifelse(OS,BSD,[ +@@ -207,27 +225,33 @@ + + # common section + [ +-growisofs: growisofs_mmc.o growisofs.o ++CHAIN=growisofs$(EXE) dvd+rw-format$(EXE) dvd+rw-booktype$(EXE) dvd+rw-mediainfo$(EXE) dvd-ram-control$(EXE) ++ ++dvd+rw-tools: $(CHAIN) ++ ++WARN=#-Wall # developers are welcomed to build with `make WARN=-Wall' ++ ++growisofs$(EXE): growisofs_mmc.o growisofs.o + growisofs.o: growisofs.c mp.h + growisofs_mmc.o: growisofs_mmc.cpp transport.hxx + +-dvd+rw-format: dvd+rw-format.o ++dvd+rw-format$(EXE): dvd+rw-format.o + dvd+rw-format.o: dvd+rw-format.cpp transport.hxx + +-dvd+rw-mediainfo: dvd+rw-mediainfo.o ++dvd+rw-mediainfo$(EXE): dvd+rw-mediainfo.o + dvd+rw-mediainfo.o: dvd+rw-mediainfo.cpp transport.hxx + +-dvd+rw-booktype: dvd+rw-booktype.o ++dvd+rw-booktype$(EXE): dvd+rw-booktype.o + dvd+rw-booktype.o: dvd+rw-booktype.cpp transport.hxx + +-dvd-ram-control: dvd-ram-control.o ++dvd-ram-control$(EXE): dvd-ram-control.o + dvd-ram-control.o: dvd-ram-control.cpp transport.hxx + +-rpl8: rpl8.o ++rpl8$(EXE): rpl8.o + rpl8.o: rpl8.cpp transport.hxx + +rpl8: rpl8 + #so that I can invoke `make +rpl8' to build rpl8... +-btcflash: btcflash.o ++btcflash$(EXE): btcflash.o + btcflash.o: btcflash.cpp transport.hxx + +btcflash: btcflash + #so that I can invoke `make +btcflash' to build btcflash... +--- ../orig/dvd+rw-tools-7.0/Makefile.msc 1969-12-31 16:00:00.000000000 -0800 ++++ ./Makefile.msc 2006-12-07 01:56:17.000000000 -0800 +@@ -0,0 +1,48 @@ ++CHAIN=growisofs.exe dvd+rw-format.exe dvd+rw-booktype.exe dvd+rw-mediainfo.exe dvd-ram-control.exe ++ ++DEFINES=/D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "_MBCS" ++CFLAGS=$(DEFINES) /O2 /FD /EHsc /MD /W3 /nologo /c /Wp64 /Zi ++CPPFLAGS=$(DEFINES) /O2 /FD /EHsc /MD /W3 /nologo /c /Wp64 /Zi ++LDFLAGS=/NOLOGO /SUBSYSTEM:CONSOLE /MANIFEST ++ ++all: ++ ++clean: ++ -del *.obj *.manifest *.pdb *.idb $(CHAIN) > nul 2>&1 ++ ++install: $(CHAIN) ++ !xcopy $** $(prefix)\bin\ /y ++ ++dvd+rw-tools: $(CHAIN) ++ ++growisofs.exe: growisofs_mmc.obj growisofs.obj ++ link $(LDFLAGS) /MANIFESTFILE:$@.manifest /out:$@ $** ++ mt /nologo /outputresource:"$@;#1" -manifest $@.manifest ++ ++growisofs.obj: growisofs.c mp.h ++ ++growisofs_mmc.obj: growisofs_mmc.cpp transport.hxx ++ ++dvd+rw-format.exe: dvd+rw-format.obj ++ link $(LDFLAGS) /MANIFESTFILE:$@.manifest /out:$@ $** ++ mt /nologo /outputresource:"$@;#1" -manifest $@.manifest ++ ++dvd+rw-format.obj: dvd+rw-format.cpp transport.hxx ++ ++dvd+rw-mediainfo.exe: dvd+rw-mediainfo.obj ++ link $(LDFLAGS) /MANIFESTFILE:$@.manifest /out:$@ $** ++ mt /nologo /outputresource:"$@;#1" -manifest $@.manifest ++ ++dvd+rw-mediainfo.obj: dvd+rw-mediainfo.cpp transport.hxx ++ ++dvd+rw-booktype.exe: dvd+rw-booktype.obj ++ link $(LDFLAGS) /MANIFESTFILE:$@.manifest /out:$@ $** ++ mt /nologo /outputresource:"$@;#1" -manifest $@.manifest ++ ++dvd+rw-booktype.obj: dvd+rw-booktype.cpp transport.hxx ++ ++dvd-ram-control.exe: dvd-ram-control.obj ++ link $(LDFLAGS) /MANIFESTFILE:$@.manifest /out:$@ $** ++ mt /nologo /outputresource:"$@;#1" -manifest $@.manifest ++ ++dvd-ram-control.obj: dvd-ram-control.cpp transport.hxx diff --git a/bacula/src/win32/patches/mingw-utils.patch b/bacula/src/win32/patches/mingw-utils.patch new file mode 100644 index 0000000000..e2d225f582 --- /dev/null +++ b/bacula/src/win32/patches/mingw-utils.patch @@ -0,0 +1,6670 @@ +diff -ru ../release/mingw-utils-0.3/configure ./configure +--- ../release/mingw-utils-0.3/configure 2003-11-25 08:31:12.000000000 -0800 ++++ ./configure 2006-08-11 05:25:25.000000000 -0700 +@@ -1,6 +1,6 @@ + #! /bin/sh + # Guess values for system-dependent variables and create Makefiles. +-# Generated by GNU Autoconf 2.58 for mingw-utils 0.3. ++# Generated by GNU Autoconf 2.59 for mingw-utils 0.3. + # + # Copyright (C) 2003 Free Software Foundation, Inc. + # This configure script is free software; the Free Software Foundation +@@ -309,7 +309,7 @@ + # include + #endif" + +-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE RANLIB ac_ct_RANLIB LEX LEXLIB LEX_OUTPUT_ROOT YACC WINDRES ac_pt_WINDRES CPP EGREP LIBOBJS LTLIBOBJS' ++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT BUILD_DRMINGW_TRUE BUILD_DRMINGW_FALSE BUILD_REDIR_TRUE BUILD_REDIR_FALSE BUILD_RES2COFF_TRUE BUILD_RES2COFF_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE RANLIB ac_ct_RANLIB LEX LEXLIB LEX_OUTPUT_ROOT YACC WINDRES ac_pt_WINDRES CPP EGREP LIBOBJS LTLIBOBJS' + ac_subst_files='' + + # Initialize some variables set by options. +@@ -859,10 +859,15 @@ + Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] +- --enable-maintainer-mode enable make rules and dependencies not useful +- (and sometimes confusing) to the casual installer +- --disable-dependency-tracking Speeds up one-time builds +- --enable-dependency-tracking Do not reject slow dependency extractors ++ --enable-maintainer-mode enable make rules and dependencies not useful ++ (and sometimes confusing) to the casual installer ++ --disable-drmingw Don't build drmingw (default is build) ++ --disable-redir Don't build redir (default is build) ++ --disable-res2coff Don't build res2coff (default is build) ++ --disable-nonportable shortcut for --disable-drmingw, --disable-redir and ++ --disable-res2coff ++ --disable-dependency-tracking speeds up one-time build ++ --enable-dependency-tracking do not reject slow dependency extractors + + Some influential environment variables: + CC C compiler command +@@ -967,7 +972,7 @@ + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi +- cd "$ac_popdir" ++ cd $ac_popdir + done + fi + +@@ -975,7 +980,7 @@ + if $ac_init_version; then + cat <<\_ACEOF + mingw-utils configure 0.3 +-generated by GNU Autoconf 2.58 ++generated by GNU Autoconf 2.59 + + Copyright (C) 2003 Free Software Foundation, Inc. + This configure script is free software; the Free Software Foundation +@@ -989,7 +994,7 @@ + running configure, to aid debugging if configure makes a mistake. + + It was created by mingw-utils $as_me 0.3, which was +-generated by GNU Autoconf 2.58. Invocation command line was ++generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +@@ -1325,7 +1330,7 @@ + + + +-am__api_version="1.7" ++am__api_version="1.9" + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then +@@ -1488,7 +1493,6 @@ + program_transform_name=`echo $program_transform_name | sed -f conftest.sed` + rm conftest.sed + +- + # expand $ac_aux_dir to an absolute path + am_aux_dir=`cd $ac_aux_dir && pwd` + +@@ -1502,6 +1506,39 @@ + echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} + fi + ++if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then ++ # We used to keeping the `.' as first argument, in order to ++ # allow $(mkdir_p) to be used without argument. As in ++ # $(mkdir_p) $(somedir) ++ # where $(somedir) is conditionally defined. However this is wrong ++ # for two reasons: ++ # 1. if the package is installed by a user who cannot write `.' ++ # make install will fail, ++ # 2. the above comment should most certainly read ++ # $(mkdir_p) $(DESTDIR)$(somedir) ++ # so it does not work when $(somedir) is undefined and ++ # $(DESTDIR) is not. ++ # To support the latter case, we have to write ++ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), ++ # so the `.' trick is pointless. ++ mkdir_p='mkdir -p --' ++else ++ # On NextStep and OpenStep, the `mkdir' command does not ++ # recognize any option. It will interpret all options as ++ # directories to create, and then abort because `.' already ++ # exists. ++ for d in ./-p ./--version; ++ do ++ test -d $d && rmdir $d ++ done ++ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. ++ if test -f "$ac_aux_dir/mkinstalldirs"; then ++ mkdir_p='$(mkinstalldirs)' ++ else ++ mkdir_p='$(install_sh) -d' ++ fi ++fi ++ + for ac_prog in gawk mawk nawk awk + do + # Extract the first word of "$ac_prog", so it can be a program name with args. +@@ -1580,7 +1617,7 @@ + fi + rmdir .tst 2>/dev/null + +- # test to see if srcdir already configured ++# test to see if srcdir already configured + if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +@@ -1619,9 +1656,6 @@ + + MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +- +-AMTAR=${AMTAR-"${am_missing_run}tar"} +- + install_sh=${install_sh-"$am_aux_dir/install-sh"} + + # Installed binaries are usually stripped using `strip' when the user +@@ -1714,6 +1748,13 @@ + + # We need awk for the "check" target. The system "awk" is bad on + # some platforms. ++# Always define AMTAR for backward compatibility. ++ ++AMTAR=${AMTAR-"${am_missing_run}tar"} ++ ++am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ++ ++ + + + +@@ -1745,6 +1786,99 @@ + + + ++# Check whether --enable-drmingw or --disable-drmingw was given. ++if test "${enable_drmingw+set}" = set; then ++ enableval="$enable_drmingw" ++ case "${enableval}" in ++ yes) build_drmingw=true ;; ++ no) build_drmingw=false ;; ++ *) { { echo "$as_me:$LINENO: error: --enable-drmingw argument must be yes or no, not \"${enableval}\"" >&5 ++echo "$as_me: error: --enable-drmingw argument must be yes or no, not \"${enableval}\"" >&2;} ++ { (exit 1); exit 1; }; } ;; ++ esac ++else ++ build_drmingw=true ++fi; ++ ++# Check whether --enable-redir or --disable-redir was given. ++if test "${enable_redir+set}" = set; then ++ enableval="$enable_redir" ++ case "${enableval}" in ++ yes) build_redir=true ;; ++ no) build_redir=false ;; ++ *) { { echo "$as_me:$LINENO: error: --enable-redir argument must be yes or no, not \"${enableval}\"" >&5 ++echo "$as_me: error: --enable-redir argument must be yes or no, not \"${enableval}\"" >&2;} ++ { (exit 1); exit 1; }; } ;; ++ esac ++else ++ build_redir=true ++fi; ++ ++# Check whether --enable-res2coff or --disable-res2coff was given. ++if test "${enable_res2coff+set}" = set; then ++ enableval="$enable_res2coff" ++ case "${enableval}" in ++ yes) build_res2coff=true ;; ++ no) build_res2coff=false ;; ++ *) { { echo "$as_me:$LINENO: error: --enable-res2coff argument must be yes or no, not \"${enableval}\"" >&5 ++echo "$as_me: error: --enable-res2coff argument must be yes or no, not \"${enableval}\"" >&2;} ++ { (exit 1); exit 1; }; } ;; ++ esac ++else ++ build_res2coff=true ++fi; ++ ++# Check whether --enable-nonportable or --disable-nonportable was given. ++if test "${enable_nonportable+set}" = set; then ++ enableval="$enable_nonportable" ++ case "${enableval}" in ++ yes) build_drmingw=true ++ build_redir=true ++ build_res2coff=true ++ ;; ++ no) build_res2coff=false ++ build_redir=false ++ build_res2coff=false ++ ;; ++ *) { { echo "$as_me:$LINENO: error: --enable-nonportable argument must be yes or no, not \"${enableval}\"" >&5 ++echo "$as_me: error: --enable-nonportable argument must be yes or no, not \"${enableval}\"" >&2;} ++ { (exit 1); exit 1; }; } ;; ++ esac ++else ++ build_res2coff=true ++fi; ++ ++ ++ ++if test "${build_drmingw}" = "true"; then ++ BUILD_DRMINGW_TRUE= ++ BUILD_DRMINGW_FALSE='#' ++else ++ BUILD_DRMINGW_TRUE='#' ++ BUILD_DRMINGW_FALSE= ++fi ++ ++ ++ ++if test "${build_redir}" = "true"; then ++ BUILD_REDIR_TRUE= ++ BUILD_REDIR_FALSE='#' ++else ++ BUILD_REDIR_TRUE='#' ++ BUILD_REDIR_FALSE= ++fi ++ ++ ++ ++if test "${build_res2coff}" = "true"; then ++ BUILD_RES2COFF_TRUE= ++ BUILD_RES2COFF_FALSE='#' ++else ++ BUILD_RES2COFF_TRUE='#' ++ BUILD_RES2COFF_FALSE= ++fi ++ ++ + # Checks for programs. + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' +@@ -2314,7 +2448,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2372,7 +2507,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2488,7 +2624,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2542,7 +2679,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2587,7 +2725,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2631,7 +2770,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2776,7 +2916,9 @@ + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c +- : > sub/conftst$i.h ++ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with ++ # Solaris 8's {/usr,}/bin/sh. ++ touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + +@@ -2804,9 +2946,14 @@ + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings +- # (even with -Werror). So we grep stderr for any message +- # that says an option was ignored. +- if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else ++ # or remarks (even with -Werror). So we grep stderr for any message ++ # that says an option was ignored or not supported. ++ # When given -MP, icc 7.0 and 7.1 complain thusly: ++ # icc: Command line warning: ignoring option '-M'; no argument required ++ # The diagnosis changed in icc 8.0: ++ # icc: Command line remark: option '-MP' not supported ++ if (grep 'ignoring option' conftest.err || ++ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi +@@ -2982,7 +3129,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_cxx_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3040,7 +3188,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_cxx_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3111,7 +3260,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_cxx_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3155,7 +3305,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_cxx_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3229,7 +3380,9 @@ + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c +- : > sub/conftst$i.h ++ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with ++ # Solaris 8's {/usr,}/bin/sh. ++ touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + +@@ -3257,9 +3410,14 @@ + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings +- # (even with -Werror). So we grep stderr for any message +- # that says an option was ignored. +- if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else ++ # or remarks (even with -Werror). So we grep stderr for any message ++ # that says an option was ignored or not supported. ++ # When given -MP, icc 7.0 and 7.1 complain thusly: ++ # icc: Command line warning: ignoring option '-M'; no argument required ++ # The diagnosis changed in icc 8.0: ++ # icc: Command line remark: option '-MP' not supported ++ if (grep 'ignoring option' conftest.err || ++ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi +@@ -3601,7 +3759,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3667,7 +3826,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3756,7 +3916,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3903,9 +4064,6 @@ + done + done + +- test -z "$ac_cv_path_ac_pt_WINDRES" && ac_cv_path_ac_pt_WINDRES="{ echo "$as_me:$LINENO: WARNING: Could not find a windres tool in your PATH. Will not be able to compile drmingw." >&5 +-echo "$as_me: WARNING: Could not find a windres tool in your PATH. Will not be able to compile drmingw." >&2;} +-" + ;; + esac + fi +@@ -3925,6 +4083,22 @@ + fi + + ++if test -z "${WINDRES}"; then ++ { echo "$as_me:$LINENO: WARNING: windres tool isn't in your PATH, drmingw can't be built!!" >&5 ++echo "$as_me: WARNING: windres tool isn't in your PATH, drmingw can't be built!!" >&2;} ++ ++ ++if false; then ++ BUILD_DRMINGW_TRUE= ++ BUILD_DRMINGW_FALSE='#' ++else ++ BUILD_DRMINGW_TRUE='#' ++ BUILD_DRMINGW_FALSE= ++fi ++ ++fi ++ ++ + + # Checks for header files. + ac_ext=c +@@ -4210,7 +4384,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4342,9 +4517,7 @@ + + fi + +-where_toGet_utime_h='not found!' +-# this part is scrambled by autoconf. phooey. so we just cannot tell the user what we are doing. +-# AC_MSG_CHECKING([for whether utime.h is found as "utime.h" or "sys/utime.h"]) ++ + # On IRIX 5.3, sys/types and inttypes.h are conflicting. + + +@@ -4383,7 +4556,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4416,6 +4590,160 @@ + done + + ++ ++for ac_header in windows.h ++do ++as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` ++if eval "test \"\${$as_ac_Header+set}\" = set"; then ++ echo "$as_me:$LINENO: checking for $ac_header" >&5 ++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 ++if eval "test \"\${$as_ac_Header+set}\" = set"; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++fi ++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 ++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 ++else ++ # Is the header compilable? ++echo "$as_me:$LINENO: checking $ac_header usability" >&5 ++echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++#include <$ac_header> ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_header_compiler=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_header_compiler=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ++echo "${ECHO_T}$ac_header_compiler" >&6 ++ ++# Is the header present? ++echo "$as_me:$LINENO: checking $ac_header presence" >&5 ++echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <$ac_header> ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag ++ else ++ ac_cpp_err= ++ fi ++else ++ ac_cpp_err=yes ++fi ++if test -z "$ac_cpp_err"; then ++ ac_header_preproc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_preproc=no ++fi ++rm -f conftest.err conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 ++echo "${ECHO_T}$ac_header_preproc" >&6 ++ ++# So? What about this header? ++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in ++ yes:no: ) ++ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 ++echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 ++echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ++ ac_header_preproc=yes ++ ;; ++ no:yes:* ) ++ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 ++echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 ++echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 ++echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 ++echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ++ ( ++ cat <<\_ASBOX ++## -------------------------------------- ## ++## Report this to the mingw-utils lists. ## ++## -------------------------------------- ## ++_ASBOX ++ ) | ++ sed "s/^/$as_me: WARNING: /" >&2 ++ ;; ++esac ++echo "$as_me:$LINENO: checking for $ac_header" >&5 ++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 ++if eval "test \"\${$as_ac_Header+set}\" = set"; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ eval "$as_ac_Header=\$ac_header_preproc" ++fi ++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 ++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 ++ ++fi ++if test `eval echo '${'$as_ac_Header'}'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++ ++done ++ ++ ++where_toGet_utime_h='not found!' ++# this part is scrambled by autoconf. phooey. so we just cannot tell the user what we are doing. ++# AC_MSG_CHECKING([for whether utime.h is found as "utime.h" or "sys/utime.h"]) + if test "${ac_cv_header_utime_h+set}" = set; then + echo "$as_me:$LINENO: checking for utime.h" >&5 + echo $ECHO_N "checking for utime.h... $ECHO_C" >&6 +@@ -4446,7 +4774,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4590,7 +4919,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4787,7 +5117,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4888,7 +5219,8 @@ + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4921,24 +5253,1681 @@ + done + + +- ac_config_files="$ac_config_files Makefile dos2unix/Makefile drmingw/Makefile pexports/Makefile redir/Makefile reimp/Makefile res2coff/Makefile scripts/Makefile scripts/a2dll scripts/dsw2mak unix2dos/Makefile" ++echo "$as_me:$LINENO: checking for _int64" >&5 ++echo $ECHO_N "checking for _int64... $ECHO_C" >&6 ++if test "${ac_cv_type__int64+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++if ((_int64 *) 0) ++ return 0; ++if (sizeof (_int64)) ++ return 0; ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_type__int64=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 + +-cat >confcache <<\_ACEOF +-# This file is a shell script that caches the results of configure +-# tests run on this system so they can be shared between configure +-# scripts and configure runs, see configure's option --config-cache. +-# It is not useful on other systems. If it contains results you don't +-# want to keep, you may remove or edit it. +-# +-# config.status only pays attention to the cache file if you give it +-# the --recheck option to rerun configure. +-# +-# `ac_cv_env_foo' variables (set or unset) will be overridden when +-# loading this file, other *unset* `ac_cv_foo' will be assigned the +-# following values. ++ac_cv_type__int64=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: $ac_cv_type__int64" >&5 ++echo "${ECHO_T}$ac_cv_type__int64" >&6 + ++echo "$as_me:$LINENO: checking size of _int64" >&5 ++echo $ECHO_N "checking size of _int64... $ECHO_C" >&6 ++if test "${ac_cv_sizeof__int64+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test "$ac_cv_type__int64" = yes; then ++ # The cast to unsigned long works around a bug in the HP C Compiler ++ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects ++ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. ++ # This bug is HP SR number 8606223364. ++ if test "$cross_compiling" = yes; then ++ # Depending upon the size, compute the lo and hi bounds. ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ + _ACEOF +- ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (_int64))) >= 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_lo=0 ac_mid=0 ++ while :; do ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (_int64))) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=$ac_mid; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo=`expr $ac_mid + 1` ++ if test $ac_lo -le $ac_mid; then ++ ac_lo= ac_hi= ++ break ++ fi ++ ac_mid=`expr 2 '*' $ac_mid + 1` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (_int64))) < 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=-1 ac_mid=-1 ++ while :; do ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (_int64))) >= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_lo=$ac_mid; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_hi=`expr '(' $ac_mid ')' - 1` ++ if test $ac_mid -le $ac_hi; then ++ ac_lo= ac_hi= ++ break ++ fi ++ ac_mid=`expr 2 '*' $ac_mid` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo= ac_hi= ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++# Binary search between lo and hi bounds. ++while test "x$ac_lo" != "x$ac_hi"; do ++ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (_int64))) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=$ac_mid ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo=`expr '(' $ac_mid ')' + 1` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++done ++case $ac_lo in ++?*) ac_cv_sizeof__int64=$ac_lo;; ++'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (_int64), 77 ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute sizeof (_int64), 77 ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ;; ++esac ++else ++ if test "$cross_compiling" = yes; then ++ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot run test program while cross compiling ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++long longval () { return (long) (sizeof (_int64)); } ++unsigned long ulongval () { return (long) (sizeof (_int64)); } ++#include ++#include ++int ++main () ++{ ++ ++ FILE *f = fopen ("conftest.val", "w"); ++ if (! f) ++ exit (1); ++ if (((long) (sizeof (_int64))) < 0) ++ { ++ long i = longval (); ++ if (i != ((long) (sizeof (_int64)))) ++ exit (1); ++ fprintf (f, "%ld\n", i); ++ } ++ else ++ { ++ unsigned long i = ulongval (); ++ if (i != ((long) (sizeof (_int64)))) ++ exit (1); ++ fprintf (f, "%lu\n", i); ++ } ++ exit (ferror (f) || fclose (f) != 0); ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_sizeof__int64=`cat conftest.val` ++else ++ echo "$as_me: program exited with status $ac_status" >&5 ++echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++( exit $ac_status ) ++{ { echo "$as_me:$LINENO: error: cannot compute sizeof (_int64), 77 ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute sizeof (_int64), 77 ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext ++fi ++fi ++rm -f conftest.val ++else ++ ac_cv_sizeof__int64=0 ++fi ++fi ++echo "$as_me:$LINENO: result: $ac_cv_sizeof__int64" >&5 ++echo "${ECHO_T}$ac_cv_sizeof__int64" >&6 ++cat >>confdefs.h <<_ACEOF ++#define SIZEOF__INT64 $ac_cv_sizeof__int64 ++_ACEOF ++ ++ ++echo "$as_me:$LINENO: checking for long long" >&5 ++echo $ECHO_N "checking for long long... $ECHO_C" >&6 ++if test "${ac_cv_type_long_long+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++if ((long long *) 0) ++ return 0; ++if (sizeof (long long)) ++ return 0; ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_type_long_long=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_type_long_long=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 ++echo "${ECHO_T}$ac_cv_type_long_long" >&6 ++ ++echo "$as_me:$LINENO: checking size of long long" >&5 ++echo $ECHO_N "checking size of long long... $ECHO_C" >&6 ++if test "${ac_cv_sizeof_long_long+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test "$ac_cv_type_long_long" = yes; then ++ # The cast to unsigned long works around a bug in the HP C Compiler ++ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects ++ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. ++ # This bug is HP SR number 8606223364. ++ if test "$cross_compiling" = yes; then ++ # Depending upon the size, compute the lo and hi bounds. ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_lo=0 ac_mid=0 ++ while :; do ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=$ac_mid; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo=`expr $ac_mid + 1` ++ if test $ac_lo -le $ac_mid; then ++ ac_lo= ac_hi= ++ break ++ fi ++ ac_mid=`expr 2 '*' $ac_mid + 1` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=-1 ac_mid=-1 ++ while :; do ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_lo=$ac_mid; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_hi=`expr '(' $ac_mid ')' - 1` ++ if test $ac_mid -le $ac_hi; then ++ ac_lo= ac_hi= ++ break ++ fi ++ ac_mid=`expr 2 '*' $ac_mid` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo= ac_hi= ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++# Binary search between lo and hi bounds. ++while test "x$ac_lo" != "x$ac_hi"; do ++ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=$ac_mid ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo=`expr '(' $ac_mid ')' + 1` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++done ++case $ac_lo in ++?*) ac_cv_sizeof_long_long=$ac_lo;; ++'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute sizeof (long long), 77 ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ;; ++esac ++else ++ if test "$cross_compiling" = yes; then ++ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot run test program while cross compiling ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++long longval () { return (long) (sizeof (long long)); } ++unsigned long ulongval () { return (long) (sizeof (long long)); } ++#include ++#include ++int ++main () ++{ ++ ++ FILE *f = fopen ("conftest.val", "w"); ++ if (! f) ++ exit (1); ++ if (((long) (sizeof (long long))) < 0) ++ { ++ long i = longval (); ++ if (i != ((long) (sizeof (long long)))) ++ exit (1); ++ fprintf (f, "%ld\n", i); ++ } ++ else ++ { ++ unsigned long i = ulongval (); ++ if (i != ((long) (sizeof (long long)))) ++ exit (1); ++ fprintf (f, "%lu\n", i); ++ } ++ exit (ferror (f) || fclose (f) != 0); ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_sizeof_long_long=`cat conftest.val` ++else ++ echo "$as_me: program exited with status $ac_status" >&5 ++echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++( exit $ac_status ) ++{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute sizeof (long long), 77 ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext ++fi ++fi ++rm -f conftest.val ++else ++ ac_cv_sizeof_long_long=0 ++fi ++fi ++echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 ++echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 ++cat >>confdefs.h <<_ACEOF ++#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long ++_ACEOF ++ ++ ++echo "$as_me:$LINENO: checking for long" >&5 ++echo $ECHO_N "checking for long... $ECHO_C" >&6 ++if test "${ac_cv_type_long+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++if ((long *) 0) ++ return 0; ++if (sizeof (long)) ++ return 0; ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_type_long=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_type_long=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 ++echo "${ECHO_T}$ac_cv_type_long" >&6 ++ ++echo "$as_me:$LINENO: checking size of long" >&5 ++echo $ECHO_N "checking size of long... $ECHO_C" >&6 ++if test "${ac_cv_sizeof_long+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test "$ac_cv_type_long" = yes; then ++ # The cast to unsigned long works around a bug in the HP C Compiler ++ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects ++ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. ++ # This bug is HP SR number 8606223364. ++ if test "$cross_compiling" = yes; then ++ # Depending upon the size, compute the lo and hi bounds. ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_lo=0 ac_mid=0 ++ while :; do ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=$ac_mid; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo=`expr $ac_mid + 1` ++ if test $ac_lo -le $ac_mid; then ++ ac_lo= ac_hi= ++ break ++ fi ++ ac_mid=`expr 2 '*' $ac_mid + 1` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=-1 ac_mid=-1 ++ while :; do ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_lo=$ac_mid; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_hi=`expr '(' $ac_mid ')' - 1` ++ if test $ac_mid -le $ac_hi; then ++ ac_lo= ac_hi= ++ break ++ fi ++ ac_mid=`expr 2 '*' $ac_mid` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo= ac_hi= ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++# Binary search between lo and hi bounds. ++while test "x$ac_lo" != "x$ac_hi"; do ++ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=$ac_mid ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo=`expr '(' $ac_mid ')' + 1` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++done ++case $ac_lo in ++?*) ac_cv_sizeof_long=$ac_lo;; ++'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute sizeof (long), 77 ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ;; ++esac ++else ++ if test "$cross_compiling" = yes; then ++ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot run test program while cross compiling ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++long longval () { return (long) (sizeof (long)); } ++unsigned long ulongval () { return (long) (sizeof (long)); } ++#include ++#include ++int ++main () ++{ ++ ++ FILE *f = fopen ("conftest.val", "w"); ++ if (! f) ++ exit (1); ++ if (((long) (sizeof (long))) < 0) ++ { ++ long i = longval (); ++ if (i != ((long) (sizeof (long)))) ++ exit (1); ++ fprintf (f, "%ld\n", i); ++ } ++ else ++ { ++ unsigned long i = ulongval (); ++ if (i != ((long) (sizeof (long)))) ++ exit (1); ++ fprintf (f, "%lu\n", i); ++ } ++ exit (ferror (f) || fclose (f) != 0); ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_sizeof_long=`cat conftest.val` ++else ++ echo "$as_me: program exited with status $ac_status" >&5 ++echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++( exit $ac_status ) ++{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute sizeof (long), 77 ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext ++fi ++fi ++rm -f conftest.val ++else ++ ac_cv_sizeof_long=0 ++fi ++fi ++echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 ++echo "${ECHO_T}$ac_cv_sizeof_long" >&6 ++cat >>confdefs.h <<_ACEOF ++#define SIZEOF_LONG $ac_cv_sizeof_long ++_ACEOF ++ ++ ++echo "$as_me:$LINENO: checking for void *" >&5 ++echo $ECHO_N "checking for void *... $ECHO_C" >&6 ++if test "${ac_cv_type_void_p+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++if ((void * *) 0) ++ return 0; ++if (sizeof (void *)) ++ return 0; ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_type_void_p=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_type_void_p=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 ++echo "${ECHO_T}$ac_cv_type_void_p" >&6 ++ ++echo "$as_me:$LINENO: checking size of void *" >&5 ++echo $ECHO_N "checking size of void *... $ECHO_C" >&6 ++if test "${ac_cv_sizeof_void_p+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test "$ac_cv_type_void_p" = yes; then ++ # The cast to unsigned long works around a bug in the HP C Compiler ++ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects ++ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. ++ # This bug is HP SR number 8606223364. ++ if test "$cross_compiling" = yes; then ++ # Depending upon the size, compute the lo and hi bounds. ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_lo=0 ac_mid=0 ++ while :; do ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=$ac_mid; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo=`expr $ac_mid + 1` ++ if test $ac_lo -le $ac_mid; then ++ ac_lo= ac_hi= ++ break ++ fi ++ ac_mid=`expr 2 '*' $ac_mid + 1` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=-1 ac_mid=-1 ++ while :; do ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_lo=$ac_mid; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_hi=`expr '(' $ac_mid ')' - 1` ++ if test $ac_mid -le $ac_hi; then ++ ac_lo= ac_hi= ++ break ++ fi ++ ac_mid=`expr 2 '*' $ac_mid` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo= ac_hi= ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++# Binary search between lo and hi bounds. ++while test "x$ac_lo" != "x$ac_hi"; do ++ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++int ++main () ++{ ++static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_hi=$ac_mid ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_lo=`expr '(' $ac_mid ')' + 1` ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++done ++case $ac_lo in ++?*) ac_cv_sizeof_void_p=$ac_lo;; ++'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute sizeof (void *), 77 ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ;; ++esac ++else ++ if test "$cross_compiling" = yes; then ++ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot run test program while cross compiling ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++long longval () { return (long) (sizeof (void *)); } ++unsigned long ulongval () { return (long) (sizeof (void *)); } ++#include ++#include ++int ++main () ++{ ++ ++ FILE *f = fopen ("conftest.val", "w"); ++ if (! f) ++ exit (1); ++ if (((long) (sizeof (void *))) < 0) ++ { ++ long i = longval (); ++ if (i != ((long) (sizeof (void *)))) ++ exit (1); ++ fprintf (f, "%ld\n", i); ++ } ++ else ++ { ++ unsigned long i = ulongval (); ++ if (i != ((long) (sizeof (void *)))) ++ exit (1); ++ fprintf (f, "%lu\n", i); ++ } ++ exit (ferror (f) || fclose (f) != 0); ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_sizeof_void_p=`cat conftest.val` ++else ++ echo "$as_me: program exited with status $ac_status" >&5 ++echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++( exit $ac_status ) ++{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute sizeof (void *), 77 ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext ++fi ++fi ++rm -f conftest.val ++else ++ ac_cv_sizeof_void_p=0 ++fi ++fi ++echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 ++echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6 ++cat >>confdefs.h <<_ACEOF ++#define SIZEOF_VOID_P $ac_cv_sizeof_void_p ++_ACEOF ++ ++ ++ ++ ac_config_files="$ac_config_files Makefile dos2unix/Makefile drmingw/Makefile pexports/Makefile redir/Makefile reimp/Makefile res2coff/Makefile scripts/Makefile scripts/a2dll scripts/dsw2mak unix2dos/Makefile" ++ ++cat >confcache <<\_ACEOF ++# This file is a shell script that caches the results of configure ++# tests run on this system so they can be shared between configure ++# scripts and configure runs, see configure's option --config-cache. ++# It is not useful on other systems. If it contains results you don't ++# want to keep, you may remove or edit it. ++# ++# config.status only pays attention to the cache file if you give it ++# the --recheck option to rerun configure. ++# ++# `ac_cv_env_foo' variables (set or unset) will be overridden when ++# loading this file, other *unset* `ac_cv_foo' will be assigned the ++# following values. ++ ++_ACEOF ++ + # The following way of writing the cache mishandles newlines in values, + # but we know of no workaround that is simple, portable, and efficient. + # So, don't put newlines in cache variables' values. +@@ -5021,6 +7010,27 @@ + Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } + fi ++if test -z "${BUILD_DRMINGW_TRUE}" && test -z "${BUILD_DRMINGW_FALSE}"; then ++ { { echo "$as_me:$LINENO: error: conditional \"BUILD_DRMINGW\" was never defined. ++Usually this means the macro was only invoked conditionally." >&5 ++echo "$as_me: error: conditional \"BUILD_DRMINGW\" was never defined. ++Usually this means the macro was only invoked conditionally." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++if test -z "${BUILD_REDIR_TRUE}" && test -z "${BUILD_REDIR_FALSE}"; then ++ { { echo "$as_me:$LINENO: error: conditional \"BUILD_REDIR\" was never defined. ++Usually this means the macro was only invoked conditionally." >&5 ++echo "$as_me: error: conditional \"BUILD_REDIR\" was never defined. ++Usually this means the macro was only invoked conditionally." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++if test -z "${BUILD_RES2COFF_TRUE}" && test -z "${BUILD_RES2COFF_FALSE}"; then ++ { { echo "$as_me:$LINENO: error: conditional \"BUILD_RES2COFF\" was never defined. ++Usually this means the macro was only invoked conditionally." >&5 ++echo "$as_me: error: conditional \"BUILD_RES2COFF\" was never defined. ++Usually this means the macro was only invoked conditionally." >&2;} ++ { (exit 1); exit 1; }; } ++fi + if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. + Usually this means the macro was only invoked conditionally." >&5 +@@ -5042,6 +7052,13 @@ + Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } + fi ++if test -z "${BUILD_DRMINGW_TRUE}" && test -z "${BUILD_DRMINGW_FALSE}"; then ++ { { echo "$as_me:$LINENO: error: conditional \"BUILD_DRMINGW\" was never defined. ++Usually this means the macro was only invoked conditionally." >&5 ++echo "$as_me: error: conditional \"BUILD_DRMINGW\" was never defined. ++Usually this means the macro was only invoked conditionally." >&2;} ++ { (exit 1); exit 1; }; } ++fi + + : ${CONFIG_STATUS=./config.status} + ac_clean_files_save=$ac_clean_files +@@ -5314,7 +7331,7 @@ + cat >&5 <<_CSEOF + + This file was extended by mingw-utils $as_me 0.3, which was +-generated by GNU Autoconf 2.58. Invocation command line was ++generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS +@@ -5377,7 +7394,7 @@ + cat >>$CONFIG_STATUS <<_ACEOF + ac_cs_version="\\ + mingw-utils config.status 0.3 +-configured by $0, generated by GNU Autoconf 2.58, ++configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + + Copyright (C) 2003 Free Software Foundation, Inc. +@@ -5595,17 +7612,26 @@ + s,@AUTOMAKE@,$AUTOMAKE,;t t + s,@AUTOHEADER@,$AUTOHEADER,;t t + s,@MAKEINFO@,$MAKEINFO,;t t +-s,@AMTAR@,$AMTAR,;t t + s,@install_sh@,$install_sh,;t t + s,@STRIP@,$STRIP,;t t + s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t + s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t ++s,@mkdir_p@,$mkdir_p,;t t + s,@AWK@,$AWK,;t t + s,@SET_MAKE@,$SET_MAKE,;t t + s,@am__leading_dot@,$am__leading_dot,;t t ++s,@AMTAR@,$AMTAR,;t t ++s,@am__tar@,$am__tar,;t t ++s,@am__untar@,$am__untar,;t t + s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t + s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t + s,@MAINT@,$MAINT,;t t ++s,@BUILD_DRMINGW_TRUE@,$BUILD_DRMINGW_TRUE,;t t ++s,@BUILD_DRMINGW_FALSE@,$BUILD_DRMINGW_FALSE,;t t ++s,@BUILD_REDIR_TRUE@,$BUILD_REDIR_TRUE,;t t ++s,@BUILD_REDIR_FALSE@,$BUILD_REDIR_FALSE,;t t ++s,@BUILD_RES2COFF_TRUE@,$BUILD_RES2COFF_TRUE,;t t ++s,@BUILD_RES2COFF_FALSE@,$BUILD_RES2COFF_FALSE,;t t + s,@CC@,$CC,;t t + s,@CFLAGS@,$CFLAGS,;t t + s,@LDFLAGS@,$LDFLAGS,;t t +@@ -6262,27 +8288,21 @@ + else + continue + fi +- grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue +- # Extract the definition of DEP_FILES from the Makefile without +- # running `make'. +- DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` ++ # Extract the definition of DEPDIR, am__include, and am__quote ++ # from the Makefile without running `make'. ++ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue ++ am__include=`sed -n 's/^am__include = //p' < "$mf"` ++ test -z "am__include" && continue ++ am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it +- U=`sed -n -e '/^U = / s///p' < "$mf"` +- test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" +- # We invoke sed twice because it is the simplest approach to +- # changing $(DEPDIR) to its actual value in the expansion. +- for file in `sed -n -e ' +- /^DEP_FILES = .*\\\\$/ { +- s/^DEP_FILES = // +- :loop +- s/\\\\$// +- p +- n +- /\\\\$/ b loop +- p +- } +- /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ ++ U=`sed -n 's/^U = //p' < "$mf"` ++ # Find all dependency output files, they are included files with ++ # $(DEPDIR) in their names. We invoke sed twice because it is the ++ # simplest approach to changing $(DEPDIR) to its actual value in the ++ # expansion. ++ for file in `sed -n " ++ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue +diff -ru ../release/mingw-utils-0.3/configure.ac ./configure.ac +--- ../release/mingw-utils-0.3/configure.ac 2003-11-25 08:24:13.000000000 -0800 ++++ ./configure.ac 2006-08-11 05:25:25.000000000 -0700 +@@ -7,6 +7,52 @@ + AM_CONFIG_HEADER(config.h) + AM_MAINTAINER_MODE + ++AC_ARG_ENABLE(drmingw, ++ AS_HELP_STRING([--disable-drmingw],[Don't build drmingw (default is build)]), ++ [case "${enableval}" in ++ yes) build_drmingw=true ;; ++ no) build_drmingw=false ;; ++ *) AC_MSG_ERROR([--enable-drmingw argument must be yes or no, not "${enableval}"]) ;; ++ esac], ++ [build_drmingw=true]) ++ ++AC_ARG_ENABLE(redir, ++ AS_HELP_STRING([--disable-redir],[Don't build redir (default is build)]), ++ [case "${enableval}" in ++ yes) build_redir=true ;; ++ no) build_redir=false ;; ++ *) AC_MSG_ERROR([--enable-redir argument must be yes or no, not "${enableval}"]) ;; ++ esac], ++ [build_redir=true]) ++ ++AC_ARG_ENABLE(res2coff, ++ AS_HELP_STRING([--disable-res2coff],[Don't build res2coff (default is build)]), ++ [case "${enableval}" in ++ yes) build_res2coff=true ;; ++ no) build_res2coff=false ;; ++ *) AC_MSG_ERROR([--enable-res2coff argument must be yes or no, not "${enableval}"]) ;; ++ esac], ++ [build_res2coff=true]) ++ ++AC_ARG_ENABLE(nonportable, ++ AS_HELP_STRING([--disable-nonportable],[shortcut for --disable-drmingw, --disable-redir and --disable-res2coff]), ++ [case "${enableval}" in ++ yes) build_drmingw=true ++ build_redir=true ++ build_res2coff=true ++ ;; ++ no) build_res2coff=false ++ build_redir=false ++ build_res2coff=false ++ ;; ++ *) AC_MSG_ERROR([--enable-nonportable argument must be yes or no, not "${enableval}"]) ;; ++ esac], ++ [build_res2coff=true]) ++ ++AM_CONDITIONAL(BUILD_DRMINGW, [test "${build_drmingw}" = "true"]) ++AM_CONDITIONAL(BUILD_REDIR, [test "${build_redir}" = "true"]) ++AM_CONDITIONAL(BUILD_RES2COFF, [test "${build_res2coff}" = "true"]) ++ + # Checks for programs. + AC_PROG_CC + AC_PROG_CXX +@@ -19,13 +65,20 @@ + AC_PROG_YACC + + AC_ARG_VAR(WINDRES, [Windows Resource compiler tool path]) +-AC_PATH_TOOL(WINDRES,windres, +- [AC_MSG_WARN(Could not find a windres tool in your PATH. Will not be able to compile drmingw.)] +-) ++AC_PATH_TOOL(WINDRES,windres) ++ ++if test -z "${WINDRES}"; then ++ AC_MSG_WARN([windres tool isn't in your PATH, drmingw can't be built!!]) ++ AM_CONDITIONAL(BUILD_DRMINGW, false) ++fi ++ + AC_SUBST(WINDRES) + + # Checks for header files. + AC_HEADER_STDC ++ ++AC_CHECK_HEADERS([windows.h]) ++ + where_toGet_utime_h='not found!' + # this part is scrambled by autoconf. phooey. so we just cannot tell the user what we are doing. + # AC_MSG_CHECKING([for whether utime.h is found as "utime.h" or "sys/utime.h"]) +@@ -44,6 +97,11 @@ + AC_CHECK_FUNCS(mkstemp mktemp, break) + AC_CHECK_FUNCS(utime) + ++AC_CHECK_SIZEOF(_int64) ++AC_CHECK_SIZEOF(long long) ++AC_CHECK_SIZEOF(long) ++AC_CHECK_SIZEOF(void *) ++ + AC_CONFIG_FILES([ + Makefile + dos2unix/Makefile +diff -ru ../release/mingw-utils-0.3/dos2unix/Makefile.am ./dos2unix/Makefile.am +--- ../release/mingw-utils-0.3/dos2unix/Makefile.am 2002-12-04 04:07:55.000000000 -0800 ++++ ./dos2unix/Makefile.am 2006-09-25 20:06:24.000000000 -0700 +@@ -6,7 +6,8 @@ + + docdir = $(prefix)/doc/dos2unix + +-doc_DATA = COPYING dos2unix.html ++#doc_DATA = COPYING dos2unix.html ++doc_DATA = COPYING + + dos2unix.html: dos2unix.1 + man2html $< > $@ +diff -ru ../release/mingw-utils-0.3/dos2unix/Makefile.in ./dos2unix/Makefile.in +--- ../release/mingw-utils-0.3/dos2unix/Makefile.in 2003-11-25 08:31:11.000000000 -0800 ++++ ./dos2unix/Makefile.in 2006-09-25 20:08:13.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -14,6 +14,7 @@ + + @SET_MAKE@ + ++ + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +@@ -21,7 +22,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +35,42 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++bin_PROGRAMS = dos2unix$(EXEEXT) ++subdir = dos2unix ++DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = $(top_builddir)/config.h ++CONFIG_CLEAN_FILES = ++am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" ++binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++PROGRAMS = $(bin_PROGRAMS) ++am_dos2unix_OBJECTS = dos2unix.$(OBJEXT) ++dos2unix_OBJECTS = $(am_dos2unix_OBJECTS) ++dos2unix_LDADD = $(LDADD) ++DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) ++depcomp = $(SHELL) $(top_srcdir)/depcomp ++am__depfiles_maybe = depfiles ++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ ++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(CC) ++LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++SOURCES = $(dos2unix_SOURCES) ++DIST_SOURCES = $(dos2unix_SOURCES) ++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; ++am__vpath_adj = case $$p in \ ++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ++ *) f=$$p;; \ ++ esac; ++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; ++docDATA_INSTALL = $(INSTALL_DATA) ++DATA = $(doc_DATA) ++ETAGS = etags ++CTAGS = ctags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +79,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +143,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +157,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -120,63 +165,55 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +-bin_PROGRAMS = dos2unix +- + dos2unix_SOURCES = dos2unix.c dos2unix.h +- + noinst_man_MANS = dos2unix.1 +- + docdir = $(prefix)/doc/dos2unix + +-doc_DATA = COPYING dos2unix.html +-subdir = dos2unix +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = $(top_builddir)/config.h +-CONFIG_CLEAN_FILES = +-bin_PROGRAMS = dos2unix$(EXEEXT) +-PROGRAMS = $(bin_PROGRAMS) +- +-am_dos2unix_OBJECTS = dos2unix.$(OBJEXT) +-dos2unix_OBJECTS = $(am_dos2unix_OBJECTS) +-dos2unix_LDADD = $(LDADD) +-dos2unix_DEPENDENCIES = +-dos2unix_LDFLAGS = +- +-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +-depcomp = $(SHELL) $(top_srcdir)/depcomp +-am__depfiles_maybe = depfiles +-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dos2unix.Po +-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-CCLD = $(CC) +-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +-DIST_SOURCES = $(dos2unix_SOURCES) +-DATA = $(doc_DATA) +- +-DIST_COMMON = $(srcdir)/Makefile.in COPYING Makefile.am +-SOURCES = $(dos2unix_SOURCES) +- ++#doc_DATA = COPYING dos2unix.html ++doc_DATA = COPYING + all: all-am + + .SUFFIXES: + .SUFFIXES: .c .o .obj +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dos2unix/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu dos2unix/Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ++ esac; ++ ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++ ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ +- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ ++ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ ++ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +@@ -184,8 +221,8 @@ + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ +- rm -f $(DESTDIR)$(bindir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + + clean-binPROGRAMS: +@@ -195,7 +232,7 @@ + $(LINK) $(dos2unix_LDFLAGS) $(dos2unix_OBJECTS) $(dos2unix_LDADD) $(LIBS) + + mostlyclean-compile: +- -rm -f *.$(OBJEXT) core *.core ++ -rm -f *.$(OBJEXT) + + distclean-compile: + -rm -f *.tab.c +@@ -203,54 +240,37 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dos2unix.Po@am__quote@ + + .c.o: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c $< + + .c.obj: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + uninstall-info-am: +-docDATA_INSTALL = $(INSTALL_DATA) + install-docDATA: $(doc_DATA) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(docdir) ++ test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f"; \ +- $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " $(docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ ++ $(docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + + uninstall-docDATA: + @$(NORMAL_UNINSTALL) + @list='$(doc_DATA)'; for p in $$list; do \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " rm -f $(DESTDIR)$(docdir)/$$f"; \ +- rm -f $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done + +-ETAGS = etags +-ETAGSFLAGS = +- +-CTAGS = ctags +-CTAGSFLAGS = +- +-tags: TAGS +- + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ +@@ -259,6 +279,7 @@ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique ++tags: TAGS + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -270,10 +291,11 @@ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ +- test -z "$(ETAGS_ARGS)$$tags$$unique" \ +- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique +- ++ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ test -n "$$unique" || unique=$$empty_fix; \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique; \ ++ fi + ctags: CTAGS + CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -296,10 +318,6 @@ + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = .. +-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ +@@ -313,7 +331,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -331,9 +349,10 @@ + check-am: all-am + check: check-am + all-am: Makefile $(PROGRAMS) $(DATA) +- + installdirs: +- $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(docdir) ++ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"; do \ ++ test -z "$$dir" || $(mkdir_p) "$$dir"; \ ++ done + install: install-am + install-exec: install-exec-am + install-data: install-data-am +@@ -353,7 +372,7 @@ + clean-generic: + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -372,6 +391,8 @@ + + dvi-am: + ++html: html-am ++ + info: info-am + + info-am: +@@ -403,19 +424,20 @@ + + ps-am: + +-uninstall-am: uninstall-binPROGRAMS uninstall-docDATA uninstall-info-am ++uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \ ++ uninstall-info-am + + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ +- distclean-generic distclean-tags distdir dvi dvi-am info \ +- info-am install install-am install-binPROGRAMS install-data \ +- install-data-am install-docDATA install-exec install-exec-am \ +- install-info install-info-am install-man install-strip \ +- installcheck installcheck-am installdirs maintainer-clean \ +- maintainer-clean-generic mostlyclean mostlyclean-compile \ +- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ +- uninstall-am uninstall-binPROGRAMS uninstall-docDATA \ +- uninstall-info-am ++ distclean-generic distclean-tags distdir dvi dvi-am html \ ++ html-am info info-am install install-am install-binPROGRAMS \ ++ install-data install-data-am install-docDATA install-exec \ ++ install-exec-am install-info install-info-am install-man \ ++ install-strip installcheck installcheck-am installdirs \ ++ maintainer-clean maintainer-clean-generic mostlyclean \ ++ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ ++ tags uninstall uninstall-am uninstall-binPROGRAMS \ ++ uninstall-docDATA uninstall-info-am + + + dos2unix.html: dos2unix.1 +diff -ru ../release/mingw-utils-0.3/drmingw/Makefile.in ./drmingw/Makefile.in +--- ../release/mingw-utils-0.3/drmingw/Makefile.in 2003-11-25 09:56:14.000000000 -0800 ++++ ./drmingw/Makefile.in 2006-09-25 20:08:13.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -14,6 +14,8 @@ + + @SET_MAKE@ + ++ ++ + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +@@ -21,7 +23,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +36,73 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++bin_PROGRAMS = drmingw$(EXEEXT) ++samples_PROGRAMS = test$(EXEEXT) testcpp$(EXEEXT) ++subdir = drmingw ++DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \ ++ $(srcdir)/Makefile.in COPYING COPYING.LIB ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = $(top_builddir)/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(noinst_LIBRARIES) ++AR = ar ++ARFLAGS = cru ++libexchndl2_a_AR = $(AR) $(ARFLAGS) ++libexchndl2_a_LIBADD = ++am_libexchndl2_a_OBJECTS = exchndl2.$(OBJEXT) ++libexchndl2_a_OBJECTS = $(am_libexchndl2_a_OBJECTS) ++am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(samplesdir)" \ ++ "$(DESTDIR)$(docdir)" "$(DESTDIR)$(samplesdir)" ++binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++samplesPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++PROGRAMS = $(bin_PROGRAMS) $(samples_PROGRAMS) ++am_drmingw_OBJECTS = debugger.$(OBJEXT) debugx.$(OBJEXT) \ ++ dialog.$(OBJEXT) log.$(OBJEXT) main.$(OBJEXT) misc.$(OBJEXT) \ ++ module.$(OBJEXT) prdbg.$(OBJEXT) symbols.$(OBJEXT) \ ++ ieee.$(OBJEXT) rdcoff.$(OBJEXT) rddbg.$(OBJEXT) \ ++ stabs.$(OBJEXT) debug.$(OBJEXT) ++drmingw_OBJECTS = $(am_drmingw_OBJECTS) ++drmingw_DEPENDENCIES = resource.o ++am_test_OBJECTS = test-test.$(OBJEXT) ++test_OBJECTS = $(am_test_OBJECTS) ++test_DEPENDENCIES = exchndl2.o ++am_testcpp_OBJECTS = testcpp-testcpp.$(OBJEXT) ++testcpp_OBJECTS = $(am_testcpp_OBJECTS) ++testcpp_DEPENDENCIES = exchndl2.o ++DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) ++depcomp = $(SHELL) $(top_srcdir)/depcomp ++am__depfiles_maybe = depfiles ++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ ++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(CC) ++LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ ++ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) ++CXXLD = $(CXX) ++CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ ++ -o $@ ++SOURCES = $(libexchndl2_a_SOURCES) $(drmingw_SOURCES) \ ++ $(dist_EXTRA_drmingw_SOURCES) $(test_SOURCES) \ ++ $(testcpp_SOURCES) ++DIST_SOURCES = $(libexchndl2_a_SOURCES) $(drmingw_SOURCES) \ ++ $(dist_EXTRA_drmingw_SOURCES) $(test_SOURCES) \ ++ $(testcpp_SOURCES) ++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; ++am__vpath_adj = case $$p in \ ++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ++ *) f=$$p;; \ ++ esac; ++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; ++dist_docDATA_INSTALL = $(INSTALL_DATA) ++samplesDATA_INSTALL = $(INSTALL_DATA) ++DATA = $(dist_doc_DATA) $(samples_DATA) ++ETAGS = etags ++CTAGS = ctags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +111,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +175,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +189,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -120,9 +197,6 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +- +-bin_PROGRAMS = drmingw +- + drmingw_SOURCES = \ + debugger.c \ + debugger.h \ +@@ -158,116 +232,62 @@ + include/libcoff.h \ + include/libiberty.h + +- + dist_EXTRA_drmingw_SOURCES = \ + resource.rc \ + icon.ico + +- + INCLUDES = -I$(srcdir)/include +- + drmingw_LDFLAGS = -mwindows + drmingw_LDADD = resource.o -lbfd -liberty +- + RC = @WINDRES@ + RCFLAGS = --use-temp-file --verbose -O COFF +- + EXTRA_DIST = exchndl.c +- + CLEANFILES = exchndl.dll +- + docdir = $(prefix)/doc/drmingw +- + dist_doc_DATA = COPYING COPYING.LIB doc/drmingw.html doc/drmingw.reg doc/exception-nt.gif doc/install.gif doc/sample.gif +- + noinst_LIBRARIES = libexchndl2.a +- + libexchndl2_a_SOURCES = samples/exchndl2.cxx +- + samplesdir = $(docdir)/samples +- +-samples_PROGRAMS = test testcpp + samples_DATA = samples/exchndl2.cxx samples/test.c samples/testcpp.cxx +- + test_SOURCES = samples/test.c + test_LDADD = exchndl2.o -lstdc++ + test_CFLAGS = -ggdb $(AM_CFLAGS) +- + testcpp_SOURCES = samples/testcpp.cxx + testcpp_LDADD = exchndl2.o -lstdc++ + testcpp_CXXFLAGS = -ggdb $(AM_CXXFLAGS) +-subdir = drmingw +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = $(top_builddir)/config.h +-CONFIG_CLEAN_FILES = +-LIBRARIES = $(noinst_LIBRARIES) +- +-libexchndl2_a_AR = $(AR) cru +-libexchndl2_a_LIBADD = +-am_libexchndl2_a_OBJECTS = exchndl2.$(OBJEXT) +-libexchndl2_a_OBJECTS = $(am_libexchndl2_a_OBJECTS) +-bin_PROGRAMS = drmingw$(EXEEXT) +-samples_PROGRAMS = test$(EXEEXT) testcpp$(EXEEXT) +-PROGRAMS = $(bin_PROGRAMS) $(samples_PROGRAMS) +- +-am_drmingw_OBJECTS = debugger.$(OBJEXT) debugx.$(OBJEXT) \ +- dialog.$(OBJEXT) log.$(OBJEXT) main.$(OBJEXT) misc.$(OBJEXT) \ +- module.$(OBJEXT) prdbg.$(OBJEXT) symbols.$(OBJEXT) \ +- ieee.$(OBJEXT) rdcoff.$(OBJEXT) rddbg.$(OBJEXT) stabs.$(OBJEXT) \ +- debug.$(OBJEXT) +-drmingw_OBJECTS = $(am_drmingw_OBJECTS) +-drmingw_DEPENDENCIES = resource.o +-am_test_OBJECTS = test-test.$(OBJEXT) +-test_OBJECTS = $(am_test_OBJECTS) +-test_DEPENDENCIES = exchndl2.o +-test_LDFLAGS = +-am_testcpp_OBJECTS = testcpp-testcpp.$(OBJEXT) +-testcpp_OBJECTS = $(am_testcpp_OBJECTS) +-testcpp_DEPENDENCIES = exchndl2.o +-testcpp_LDFLAGS = +- +-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +-depcomp = $(SHELL) $(top_srcdir)/depcomp +-am__depfiles_maybe = depfiles +-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/debug.Po ./$(DEPDIR)/debugger.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/debugx.Po ./$(DEPDIR)/dialog.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/exchndl2.Po ./$(DEPDIR)/ieee.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/log.Po ./$(DEPDIR)/main.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/misc.Po ./$(DEPDIR)/module.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/prdbg.Po ./$(DEPDIR)/rdcoff.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/rddbg.Po ./$(DEPDIR)/stabs.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/symbols.Po ./$(DEPDIR)/test-test.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/testcpp-testcpp.Po +-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-CCLD = $(CC) +-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +-CXXLD = $(CXX) +-CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ +- -o $@ +-DIST_SOURCES = $(libexchndl2_a_SOURCES) $(drmingw_SOURCES) \ +- $(dist_EXTRA_drmingw_SOURCES) $(test_SOURCES) \ +- $(testcpp_SOURCES) +-DATA = $(dist_doc_DATA) $(samples_DATA) +- +-DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.in COPYING \ +- COPYING.LIB Makefile.am +-SOURCES = $(libexchndl2_a_SOURCES) $(drmingw_SOURCES) $(dist_EXTRA_drmingw_SOURCES) $(test_SOURCES) $(testcpp_SOURCES) +- + all: all-am + + .SUFFIXES: + .SUFFIXES: .c .cxx .o .obj +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu drmingw/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu drmingw/Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +- +-AR = ar ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ++ esac; ++ ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++ ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + + clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +@@ -275,17 +295,16 @@ + -rm -f libexchndl2.a + $(libexchndl2_a_AR) libexchndl2.a $(libexchndl2_a_OBJECTS) $(libexchndl2_a_LIBADD) + $(RANLIB) libexchndl2.a +-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) + install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ +- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ ++ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ ++ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +@@ -293,23 +312,22 @@ + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ +- rm -f $(DESTDIR)$(bindir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + + clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +-samplesPROGRAMS_INSTALL = $(INSTALL_PROGRAM) + install-samplesPROGRAMS: $(samples_PROGRAMS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(samplesdir) ++ test -z "$(samplesdir)" || $(mkdir_p) "$(DESTDIR)$(samplesdir)" + @list='$(samples_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " $(INSTALL_PROGRAM_ENV) $(samplesPROGRAMS_INSTALL) $$p $(DESTDIR)$(samplesdir)/$$f"; \ +- $(INSTALL_PROGRAM_ENV) $(samplesPROGRAMS_INSTALL) $$p $(DESTDIR)$(samplesdir)/$$f || exit 1; \ ++ echo " $(INSTALL_PROGRAM_ENV) $(samplesPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(samplesdir)/$$f'"; \ ++ $(INSTALL_PROGRAM_ENV) $(samplesPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(samplesdir)/$$f" || exit 1; \ + else :; fi; \ + done + +@@ -317,8 +335,8 @@ + @$(NORMAL_UNINSTALL) + @list='$(samples_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " rm -f $(DESTDIR)$(samplesdir)/$$f"; \ +- rm -f $(DESTDIR)$(samplesdir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(samplesdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(samplesdir)/$$f"; \ + done + + clean-samplesPROGRAMS: +@@ -334,7 +352,7 @@ + $(CXXLINK) $(testcpp_LDFLAGS) $(testcpp_OBJECTS) $(testcpp_LDADD) $(LIBS) + + mostlyclean-compile: +- -rm -f *.$(OBJEXT) core *.core ++ -rm -f *.$(OBJEXT) + + distclean-compile: + -rm -f *.tab.c +@@ -358,160 +376,110 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcpp-testcpp.Po@am__quote@ + + .c.o: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c $< + + .c.obj: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + + test-test.o: samples/test.c +-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_CFLAGS) $(CFLAGS) -MT test-test.o -MD -MP -MF "$(DEPDIR)/test-test.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o test-test.o `test -f 'samples/test.c' || echo '$(srcdir)/'`samples/test.c; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test-test.Tpo" "$(DEPDIR)/test-test.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/test-test.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_CFLAGS) $(CFLAGS) -MT test-test.o -MD -MP -MF "$(DEPDIR)/test-test.Tpo" -c -o test-test.o `test -f 'samples/test.c' || echo '$(srcdir)/'`samples/test.c; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test-test.Tpo" "$(DEPDIR)/test-test.Po"; else rm -f "$(DEPDIR)/test-test.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='samples/test.c' object='test-test.o' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/test-test.Po' tmpdepfile='$(DEPDIR)/test-test.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_CFLAGS) $(CFLAGS) -c -o test-test.o `test -f 'samples/test.c' || echo '$(srcdir)/'`samples/test.c + + test-test.obj: samples/test.c +-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_CFLAGS) $(CFLAGS) -MT test-test.obj -MD -MP -MF "$(DEPDIR)/test-test.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o test-test.obj `if test -f 'samples/test.c'; then $(CYGPATH_W) 'samples/test.c'; else $(CYGPATH_W) '$(srcdir)/samples/test.c'; fi`; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test-test.Tpo" "$(DEPDIR)/test-test.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/test-test.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_CFLAGS) $(CFLAGS) -MT test-test.obj -MD -MP -MF "$(DEPDIR)/test-test.Tpo" -c -o test-test.obj `if test -f 'samples/test.c'; then $(CYGPATH_W) 'samples/test.c'; else $(CYGPATH_W) '$(srcdir)/samples/test.c'; fi`; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test-test.Tpo" "$(DEPDIR)/test-test.Po"; else rm -f "$(DEPDIR)/test-test.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='samples/test.c' object='test-test.obj' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/test-test.Po' tmpdepfile='$(DEPDIR)/test-test.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_CFLAGS) $(CFLAGS) -c -o test-test.obj `if test -f 'samples/test.c'; then $(CYGPATH_W) 'samples/test.c'; else $(CYGPATH_W) '$(srcdir)/samples/test.c'; fi` + + .cxx.o: +-@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCXX_TRUE@ fi ++@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ ++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< ++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + + .cxx.obj: +-@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCXX_TRUE@ fi ++@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ ++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` ++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + + exchndl2.o: samples/exchndl2.cxx +-@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT exchndl2.o -MD -MP -MF "$(DEPDIR)/exchndl2.Tpo" \ +-@am__fastdepCXX_TRUE@ -c -o exchndl2.o `test -f 'samples/exchndl2.cxx' || echo '$(srcdir)/'`samples/exchndl2.cxx; \ +-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/exchndl2.Tpo" "$(DEPDIR)/exchndl2.Po"; \ +-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/exchndl2.Tpo"; exit 1; \ +-@am__fastdepCXX_TRUE@ fi ++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT exchndl2.o -MD -MP -MF "$(DEPDIR)/exchndl2.Tpo" -c -o exchndl2.o `test -f 'samples/exchndl2.cxx' || echo '$(srcdir)/'`samples/exchndl2.cxx; \ ++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/exchndl2.Tpo" "$(DEPDIR)/exchndl2.Po"; else rm -f "$(DEPDIR)/exchndl2.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='samples/exchndl2.cxx' object='exchndl2.o' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/exchndl2.Po' tmpdepfile='$(DEPDIR)/exchndl2.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o exchndl2.o `test -f 'samples/exchndl2.cxx' || echo '$(srcdir)/'`samples/exchndl2.cxx + + exchndl2.obj: samples/exchndl2.cxx +-@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT exchndl2.obj -MD -MP -MF "$(DEPDIR)/exchndl2.Tpo" \ +-@am__fastdepCXX_TRUE@ -c -o exchndl2.obj `if test -f 'samples/exchndl2.cxx'; then $(CYGPATH_W) 'samples/exchndl2.cxx'; else $(CYGPATH_W) '$(srcdir)/samples/exchndl2.cxx'; fi`; \ +-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/exchndl2.Tpo" "$(DEPDIR)/exchndl2.Po"; \ +-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/exchndl2.Tpo"; exit 1; \ +-@am__fastdepCXX_TRUE@ fi ++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT exchndl2.obj -MD -MP -MF "$(DEPDIR)/exchndl2.Tpo" -c -o exchndl2.obj `if test -f 'samples/exchndl2.cxx'; then $(CYGPATH_W) 'samples/exchndl2.cxx'; else $(CYGPATH_W) '$(srcdir)/samples/exchndl2.cxx'; fi`; \ ++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/exchndl2.Tpo" "$(DEPDIR)/exchndl2.Po"; else rm -f "$(DEPDIR)/exchndl2.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='samples/exchndl2.cxx' object='exchndl2.obj' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/exchndl2.Po' tmpdepfile='$(DEPDIR)/exchndl2.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o exchndl2.obj `if test -f 'samples/exchndl2.cxx'; then $(CYGPATH_W) 'samples/exchndl2.cxx'; else $(CYGPATH_W) '$(srcdir)/samples/exchndl2.cxx'; fi` + + testcpp-testcpp.o: samples/testcpp.cxx +-@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testcpp_CXXFLAGS) $(CXXFLAGS) -MT testcpp-testcpp.o -MD -MP -MF "$(DEPDIR)/testcpp-testcpp.Tpo" \ +-@am__fastdepCXX_TRUE@ -c -o testcpp-testcpp.o `test -f 'samples/testcpp.cxx' || echo '$(srcdir)/'`samples/testcpp.cxx; \ +-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/testcpp-testcpp.Tpo" "$(DEPDIR)/testcpp-testcpp.Po"; \ +-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/testcpp-testcpp.Tpo"; exit 1; \ +-@am__fastdepCXX_TRUE@ fi ++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testcpp_CXXFLAGS) $(CXXFLAGS) -MT testcpp-testcpp.o -MD -MP -MF "$(DEPDIR)/testcpp-testcpp.Tpo" -c -o testcpp-testcpp.o `test -f 'samples/testcpp.cxx' || echo '$(srcdir)/'`samples/testcpp.cxx; \ ++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/testcpp-testcpp.Tpo" "$(DEPDIR)/testcpp-testcpp.Po"; else rm -f "$(DEPDIR)/testcpp-testcpp.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='samples/testcpp.cxx' object='testcpp-testcpp.o' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/testcpp-testcpp.Po' tmpdepfile='$(DEPDIR)/testcpp-testcpp.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testcpp_CXXFLAGS) $(CXXFLAGS) -c -o testcpp-testcpp.o `test -f 'samples/testcpp.cxx' || echo '$(srcdir)/'`samples/testcpp.cxx + + testcpp-testcpp.obj: samples/testcpp.cxx +-@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testcpp_CXXFLAGS) $(CXXFLAGS) -MT testcpp-testcpp.obj -MD -MP -MF "$(DEPDIR)/testcpp-testcpp.Tpo" \ +-@am__fastdepCXX_TRUE@ -c -o testcpp-testcpp.obj `if test -f 'samples/testcpp.cxx'; then $(CYGPATH_W) 'samples/testcpp.cxx'; else $(CYGPATH_W) '$(srcdir)/samples/testcpp.cxx'; fi`; \ +-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/testcpp-testcpp.Tpo" "$(DEPDIR)/testcpp-testcpp.Po"; \ +-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/testcpp-testcpp.Tpo"; exit 1; \ +-@am__fastdepCXX_TRUE@ fi ++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testcpp_CXXFLAGS) $(CXXFLAGS) -MT testcpp-testcpp.obj -MD -MP -MF "$(DEPDIR)/testcpp-testcpp.Tpo" -c -o testcpp-testcpp.obj `if test -f 'samples/testcpp.cxx'; then $(CYGPATH_W) 'samples/testcpp.cxx'; else $(CYGPATH_W) '$(srcdir)/samples/testcpp.cxx'; fi`; \ ++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/testcpp-testcpp.Tpo" "$(DEPDIR)/testcpp-testcpp.Po"; else rm -f "$(DEPDIR)/testcpp-testcpp.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='samples/testcpp.cxx' object='testcpp-testcpp.obj' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/testcpp-testcpp.Po' tmpdepfile='$(DEPDIR)/testcpp-testcpp.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testcpp_CXXFLAGS) $(CXXFLAGS) -c -o testcpp-testcpp.obj `if test -f 'samples/testcpp.cxx'; then $(CYGPATH_W) 'samples/testcpp.cxx'; else $(CYGPATH_W) '$(srcdir)/samples/testcpp.cxx'; fi` + uninstall-info-am: +-dist_docDATA_INSTALL = $(INSTALL_DATA) + install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(docdir) ++ test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(dist_doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " $(dist_docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f"; \ +- $(dist_docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ ++ $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + + uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; for p in $$list; do \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " rm -f $(DESTDIR)$(docdir)/$$f"; \ +- rm -f $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done +-samplesDATA_INSTALL = $(INSTALL_DATA) + install-samplesDATA: $(samples_DATA) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(samplesdir) ++ test -z "$(samplesdir)" || $(mkdir_p) "$(DESTDIR)$(samplesdir)" + @list='$(samples_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " $(samplesDATA_INSTALL) $$d$$p $(DESTDIR)$(samplesdir)/$$f"; \ +- $(samplesDATA_INSTALL) $$d$$p $(DESTDIR)$(samplesdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " $(samplesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(samplesdir)/$$f'"; \ ++ $(samplesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(samplesdir)/$$f"; \ + done + + uninstall-samplesDATA: + @$(NORMAL_UNINSTALL) + @list='$(samples_DATA)'; for p in $$list; do \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " rm -f $(DESTDIR)$(samplesdir)/$$f"; \ +- rm -f $(DESTDIR)$(samplesdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " rm -f '$(DESTDIR)$(samplesdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(samplesdir)/$$f"; \ + done + +-ETAGS = etags +-ETAGSFLAGS = +- +-CTAGS = ctags +-CTAGSFLAGS = +- +-tags: TAGS +- + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ +@@ -520,6 +488,7 @@ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique ++tags: TAGS + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -531,10 +500,11 @@ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ +- test -z "$(ETAGS_ARGS)$$tags$$unique" \ +- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique +- ++ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ test -n "$$unique" || unique=$$empty_fix; \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique; \ ++ fi + ctags: CTAGS + CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -557,13 +527,9 @@ + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = .. +-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) +- $(mkinstalldirs) $(distdir)/doc ++ $(mkdir_p) $(distdir)/doc + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ +@@ -575,7 +541,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -593,9 +559,10 @@ + check-am: all-am + check: check-am + all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA) +- + installdirs: +- $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(samplesdir) $(DESTDIR)$(docdir) $(DESTDIR)$(samplesdir) ++ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(samplesdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(samplesdir)"; do \ ++ test -z "$$dir" || $(mkdir_p) "$$dir"; \ ++ done + install: install-am + install-exec: install-exec-am + install-data: install-data-am +@@ -616,7 +583,7 @@ + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -636,6 +603,8 @@ + + dvi-am: + ++html: html-am ++ + info: info-am + + info-am: +@@ -673,14 +642,15 @@ + uninstall-samplesPROGRAMS + + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ +- clean-generic clean-noinstLIBRARIES clean-samplesPROGRAMS ctags \ +- distclean distclean-compile distclean-generic distclean-tags \ +- distdir dvi dvi-am info info-am install install-am \ +- install-binPROGRAMS install-data install-data-am \ +- install-dist_docDATA install-exec install-exec-am \ +- install-exec-local install-info install-info-am install-man \ +- install-samplesDATA install-samplesPROGRAMS install-strip \ +- installcheck installcheck-am installdirs maintainer-clean \ ++ clean-generic clean-noinstLIBRARIES clean-samplesPROGRAMS \ ++ ctags distclean distclean-compile distclean-generic \ ++ distclean-tags distdir dvi dvi-am html html-am info info-am \ ++ install install-am install-binPROGRAMS install-data \ ++ install-data-am install-dist_docDATA install-exec \ ++ install-exec-am install-exec-local install-info \ ++ install-info-am install-man install-samplesDATA \ ++ install-samplesPROGRAMS install-strip installcheck \ ++ installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-dist_docDATA \ +diff -ru ../release/mingw-utils-0.3/Makefile.am ./Makefile.am +--- ../release/mingw-utils-0.3/Makefile.am 2002-12-04 04:06:21.000000000 -0800 ++++ ./Makefile.am 2006-08-11 05:25:25.000000000 -0700 +@@ -1,4 +1,18 @@ +-SUBDIRS = dos2unix drmingw pexports redir reimp res2coff scripts unix2dos ++if BUILD_DRMINGW ++ DRMINGW = drmingw ++endif ++ ++if BUILD_REDIR ++ REDIR = redir ++endif ++ ++if BUILD_RES2COFF ++ RES2COFF = res2coff ++endif ++ ++SUBDIRS = dos2unix $(DRMINGW) pexports ${REDIR} reimp ${RES2COFF} scripts unix2dos ++ ++EXTRA_DIST = dos2unix/dos2unix.1 unix2dos/unix2dos.1 + + instdir = /tmp/$(PACKAGE)-$(VERSION) + +diff -ru ../release/mingw-utils-0.3/Makefile.in ./Makefile.in +--- ../release/mingw-utils-0.3/Makefile.in 2003-11-25 08:31:11.000000000 -0800 ++++ ./Makefile.in 2006-09-25 20:08:14.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -13,7 +13,6 @@ + # PARTICULAR PURPOSE. + + @SET_MAKE@ +- + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +@@ -21,7 +20,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = . +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +33,43 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++subdir = . ++DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ ++ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ ++ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ ++ compile depcomp install-sh missing mkinstalldirs ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ ++ configure.lineno configure.status.lineno ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = config.h ++CONFIG_CLEAN_FILES = ++SOURCES = ++DIST_SOURCES = ++RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ ++ html-recursive info-recursive install-data-recursive \ ++ install-exec-recursive install-info-recursive \ ++ install-recursive installcheck-recursive installdirs-recursive \ ++ pdf-recursive ps-recursive uninstall-info-recursive \ ++ uninstall-recursive ++ETAGS = etags ++CTAGS = ctags ++DIST_SUBDIRS = dos2unix drmingw pexports redir reimp res2coff scripts \ ++ unix2dos ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ++distdir = $(PACKAGE)-$(VERSION) ++top_distdir = $(distdir) ++am__remove_distdir = \ ++ { test ! -d $(distdir) \ ++ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ ++ && rm -fr $(distdir); }; } ++DIST_ARCHIVES = $(distdir).tar.gz ++GZIP_ENV = --best ++distuninstallcheck_listfiles = find . -type f -print ++distcleancheck_listfiles = find . -type f -print + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +78,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +142,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +156,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -120,45 +164,48 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +-SUBDIRS = dos2unix drmingw pexports redir reimp res2coff scripts unix2dos +- ++@BUILD_DRMINGW_TRUE@DRMINGW = drmingw ++@BUILD_REDIR_TRUE@REDIR = redir ++@BUILD_RES2COFF_TRUE@RES2COFF = res2coff ++SUBDIRS = dos2unix $(DRMINGW) pexports ${REDIR} reimp ${RES2COFF} scripts unix2dos ++EXTRA_DIST = dos2unix/dos2unix.1 unix2dos/unix2dos.1 + instdir = /tmp/$(PACKAGE)-$(VERSION) +-subdir = . +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = config.h +-CONFIG_CLEAN_FILES = +-DIST_SOURCES = +- +-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ +- ps-recursive install-info-recursive uninstall-info-recursive \ +- all-recursive install-data-recursive install-exec-recursive \ +- installdirs-recursive install-recursive uninstall-recursive \ +- check-recursive installcheck-recursive +-DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure AUTHORS \ +- COPYING ChangeLog INSTALL Makefile.am NEWS aclocal.m4 compile \ +- config.h.in configure configure.ac depcomp install-sh missing \ +- mkinstalldirs +-DIST_SUBDIRS = $(SUBDIRS) + all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + + .SUFFIXES: +- +-am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ +- configure.lineno +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++am--refresh: ++ @: ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ ++ cd $(srcdir) && $(AUTOMAKE) --gnu \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ echo ' $(SHELL) ./config.status'; \ ++ $(SHELL) ./config.status;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ ++ esac; + +-$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +-$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) +- cd $(srcdir) && $(AUTOCONF) + +-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.ac ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(srcdir) && $(AUTOCONF) ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + + config.h: stamp-h1 +@@ -170,10 +217,10 @@ + stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +- +-$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) +- touch $(srcdir)/config.h.in ++ rm -f stamp-h1 ++ touch $@ + + distclean-hdr: + -rm -f config.h stamp-h1 +@@ -186,7 +233,13 @@ + # (which will cause the Makefiles to be regenerated when you run `make'); + # (2) otherwise, pass the desired values on the `make' command line. + $(RECURSIVE_TARGETS): +- @set fnord $$MAKEFLAGS; amf=$$2; \ ++ @failcom='exit 1'; \ ++ for f in x $$MAKEFLAGS; do \ ++ case $$f in \ ++ *=* | --[!k]*);; \ ++ *k*) failcom='fail=yes';; \ ++ esac; \ ++ done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ +@@ -198,7 +251,7 @@ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ +- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ ++ || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ +@@ -206,7 +259,13 @@ + + mostlyclean-recursive clean-recursive distclean-recursive \ + maintainer-clean-recursive: +- @set fnord $$MAKEFLAGS; amf=$$2; \ ++ @failcom='exit 1'; \ ++ for f in x $$MAKEFLAGS; do \ ++ case $$f in \ ++ *=* | --[!k]*);; \ ++ *k*) failcom='fail=yes';; \ ++ esac; \ ++ done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ +@@ -227,7 +286,7 @@ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ +- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ ++ || eval $$failcom; \ + done && test -z "$$fail" + tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ +@@ -238,14 +297,6 @@ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +-ETAGS = etags +-ETAGSFLAGS = +- +-CTAGS = ctags +-CTAGSFLAGS = +- +-tags: TAGS +- + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ +@@ -254,19 +305,22 @@ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique ++tags: TAGS + + TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ +- if (etags --etags-include --version) >/dev/null 2>&1; then \ ++ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ ++ empty_fix=.; \ + else \ + include_option=--include; \ ++ empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ +- test -f $$subdir/TAGS && \ ++ test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ +@@ -276,10 +330,11 @@ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ +- test -z "$(ETAGS_ARGS)$$tags$$unique" \ +- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique +- ++ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ test -n "$$unique" || unique=$$empty_fix; \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique; \ ++ fi + ctags: CTAGS + CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -302,24 +357,11 @@ + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = . +-distdir = $(PACKAGE)-$(VERSION) +- +-am__remove_distdir = \ +- { test ! -d $(distdir) \ +- || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ +- && rm -fr $(distdir); }; } +- +-GZIP_ENV = --best +-distuninstallcheck_listfiles = find . -type f -print +-distcleancheck_listfiles = find . -type f -print + + distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) +- $(mkinstalldirs) $(distdir)/scripts ++ $(mkdir_p) $(distdir)/dos2unix $(distdir)/scripts $(distdir)/unix2dos + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ +@@ -331,7 +373,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -346,15 +388,17 @@ + || exit 1; \ + fi; \ + done +- list='$(SUBDIRS)'; for subdir in $$list; do \ ++ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ +- test -d $(distdir)/$$subdir \ +- || mkdir $(distdir)/$$subdir \ ++ test -d "$(distdir)/$$subdir" \ ++ || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ ++ distdir=`$(am__cd) $(distdir) && pwd`; \ ++ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ +- top_distdir="$(top_distdir)" \ +- distdir=../$(distdir)/$$subdir \ ++ top_distdir="$$top_distdir" \ ++ distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ +@@ -365,19 +409,46 @@ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) + dist-gzip: distdir +- $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ++ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ++ $(am__remove_distdir) ++ ++dist-bzip2: distdir ++ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 ++ $(am__remove_distdir) ++ ++dist-tarZ: distdir ++ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z ++ $(am__remove_distdir) ++ ++dist-shar: distdir ++ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz ++ $(am__remove_distdir) ++ ++dist-zip: distdir ++ -rm -f $(distdir).zip ++ zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + + dist dist-all: distdir +- $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ++ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + + # This target untars the dist file and tries a VPATH configuration. Then + # it guarantees that the distribution is self-contained by making another + # tarfile. + distcheck: dist +- $(am__remove_distdir) +- GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ++ case '$(DIST_ARCHIVES)' in \ ++ *.tar.gz*) \ ++ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ ++ *.tar.bz2*) \ ++ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ ++ *.tar.Z*) \ ++ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ ++ *.shar.gz*) \ ++ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ ++ *.zip*) \ ++ unzip $(distdir).zip ;;\ ++ esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst +@@ -397,19 +468,20 @@ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ +- (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ ++ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ +- && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ +- && rm -f $(distdir).tar.gz \ ++ && $(MAKE) $(AM_MAKEFLAGS) dist \ ++ && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) +- @echo "$(distdir).tar.gz is ready for distribution" | \ +- sed 'h;s/./=/g;p;x;p;x' ++ @(echo "$(distdir) archives ready for distribution: "; \ ++ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ ++ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' + distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ +@@ -433,7 +505,6 @@ + all-am: Makefile config.h + installdirs: installdirs-recursive + installdirs-am: +- + install: install-recursive + install-exec: install-exec-recursive + install-data: install-data-recursive +@@ -453,7 +524,7 @@ + clean-generic: + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -471,6 +542,8 @@ + + dvi-am: + ++html: html-recursive ++ + info: info-recursive + + info-am: +@@ -507,22 +580,20 @@ + + uninstall-info: uninstall-info-recursive + +-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ +- clean-generic clean-recursive ctags ctags-recursive dist \ +- dist-all dist-gzip distcheck distclean distclean-generic \ +- distclean-hdr distclean-recursive distclean-tags distcleancheck \ +- distdir distuninstallcheck dvi dvi-am dvi-recursive info \ +- info-am info-recursive install install-am install-data \ +- install-data-am install-data-recursive install-exec \ +- install-exec-am install-exec-recursive install-info \ +- install-info-am install-info-recursive install-man \ +- install-recursive install-strip installcheck installcheck-am \ +- installdirs installdirs-am installdirs-recursive \ +- maintainer-clean maintainer-clean-generic \ +- maintainer-clean-recursive mostlyclean mostlyclean-generic \ +- mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \ +- ps-recursive tags tags-recursive uninstall uninstall-am \ +- uninstall-info-am uninstall-info-recursive uninstall-recursive ++.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ ++ check-am clean clean-generic clean-recursive ctags \ ++ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ ++ dist-tarZ dist-zip distcheck distclean distclean-generic \ ++ distclean-hdr distclean-recursive distclean-tags \ ++ distcleancheck distdir distuninstallcheck dvi dvi-am html \ ++ html-am info info-am install install-am install-data \ ++ install-data-am install-exec install-exec-am install-info \ ++ install-info-am install-man install-strip installcheck \ ++ installcheck-am installdirs installdirs-am maintainer-clean \ ++ maintainer-clean-generic maintainer-clean-recursive \ ++ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ ++ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ ++ uninstall-info-am + + + sdist: dist +diff -ru ../release/mingw-utils-0.3/pexports/Makefile.in ./pexports/Makefile.in +--- ../release/mingw-utils-0.3/pexports/Makefile.in 2003-11-25 08:31:11.000000000 -0800 ++++ ./pexports/Makefile.in 2006-09-25 20:08:14.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -14,6 +14,7 @@ + + @SET_MAKE@ + ++ + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +@@ -21,7 +22,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +35,46 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++bin_PROGRAMS = pexports$(EXEEXT) ++subdir = pexports ++DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ ++ AUTHORS COPYING ChangeLog hlex.c hparse.c ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = $(top_builddir)/config.h ++CONFIG_CLEAN_FILES = ++am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" ++binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++PROGRAMS = $(bin_PROGRAMS) ++am_pexports_OBJECTS = hlex.$(OBJEXT) hparse.$(OBJEXT) \ ++ pexports.$(OBJEXT) str_tree.$(OBJEXT) ++pexports_OBJECTS = $(am_pexports_OBJECTS) ++pexports_LDADD = $(LDADD) ++DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) ++depcomp = $(SHELL) $(top_srcdir)/depcomp ++am__depfiles_maybe = depfiles ++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ ++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(CC) ++LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) ++YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) ++SOURCES = $(pexports_SOURCES) ++DIST_SOURCES = $(pexports_SOURCES) ++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; ++am__vpath_adj = case $$p in \ ++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ++ *) f=$$p;; \ ++ esac; ++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; ++docDATA_INSTALL = $(INSTALL_DATA) ++DATA = $(doc_DATA) ++ETAGS = etags ++CTAGS = ctags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +83,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +147,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +161,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -120,66 +169,52 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +-bin_PROGRAMS = pexports +- + pexports_SOURCES = hlex.l hparse.h hparse.y pe.h pexports.c pexports.h str_tree.c str_tree.h +- + docdir = $(prefix)/doc/pexports +- + doc_DATA = AUTHORS COPYING README +-subdir = pexports +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = $(top_builddir)/config.h +-CONFIG_CLEAN_FILES = +-bin_PROGRAMS = pexports$(EXEEXT) +-PROGRAMS = $(bin_PROGRAMS) +- +-am_pexports_OBJECTS = hlex.$(OBJEXT) hparse.$(OBJEXT) pexports.$(OBJEXT) \ +- str_tree.$(OBJEXT) +-pexports_OBJECTS = $(am_pexports_OBJECTS) +-pexports_LDADD = $(LDADD) +-pexports_DEPENDENCIES = +-pexports_LDFLAGS = +- +-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +-depcomp = $(SHELL) $(top_srcdir)/depcomp +-am__depfiles_maybe = depfiles +-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/hlex.Po ./$(DEPDIR)/hparse.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/pexports.Po ./$(DEPDIR)/str_tree.Po +-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-CCLD = $(CC) +-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +-LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) +-YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +-DIST_SOURCES = $(pexports_SOURCES) +-DATA = $(doc_DATA) +- +-DIST_COMMON = README $(srcdir)/Makefile.in AUTHORS COPYING ChangeLog \ +- Makefile.am hlex.c hparse.c +-SOURCES = $(pexports_SOURCES) +- + all: all-am + + .SUFFIXES: + .SUFFIXES: .c .l .o .obj .y +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pexports/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu pexports/Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ++ esac; ++ ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++ ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ +- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ ++ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ ++ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +@@ -187,8 +222,8 @@ + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ +- rm -f $(DESTDIR)$(bindir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + + clean-binPROGRAMS: +@@ -198,7 +233,7 @@ + $(LINK) $(pexports_LDFLAGS) $(pexports_OBJECTS) $(pexports_LDADD) $(LIBS) + + mostlyclean-compile: +- -rm -f *.$(OBJEXT) core *.core ++ -rm -f *.$(OBJEXT) + + distclean-compile: + -rm -f *.tab.c +@@ -209,39 +244,32 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_tree.Po@am__quote@ + + .c.o: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c $< + + .c.obj: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + + .l.c: +- $(LEXCOMPILE) `test -f $< || echo '$(srcdir)/'`$< ++ $(LEXCOMPILE) $< + sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ + rm -f $(LEX_OUTPUT_ROOT).c + + .y.c: +- $(YACCCOMPILE) `test -f '$<' || echo '$(srcdir)/'`$< ++ $(YACCCOMPILE) $< + if test -f y.tab.h; then \ + to=`echo "$*_H" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ +- sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >$*.ht; \ ++ sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ ++ y.tab.h >$*.ht; \ + rm -f y.tab.h; \ + if cmp -s $*.ht $*.h; then \ + rm -f $*.ht ;\ +@@ -255,33 +283,24 @@ + sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ + rm -f y.tab.c + uninstall-info-am: +-docDATA_INSTALL = $(INSTALL_DATA) + install-docDATA: $(doc_DATA) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(docdir) ++ test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f"; \ +- $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " $(docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ ++ $(docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + + uninstall-docDATA: + @$(NORMAL_UNINSTALL) + @list='$(doc_DATA)'; for p in $$list; do \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " rm -f $(DESTDIR)$(docdir)/$$f"; \ +- rm -f $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done + +-ETAGS = etags +-ETAGSFLAGS = +- +-CTAGS = ctags +-CTAGSFLAGS = +- +-tags: TAGS +- + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ +@@ -290,6 +309,7 @@ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique ++tags: TAGS + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -301,10 +321,11 @@ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ +- test -z "$(ETAGS_ARGS)$$tags$$unique" \ +- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique +- ++ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ test -n "$$unique" || unique=$$empty_fix; \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique; \ ++ fi + ctags: CTAGS + CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -327,10 +348,6 @@ + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = .. +-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ +@@ -344,7 +361,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -362,9 +379,10 @@ + check-am: all-am + check: check-am + all-am: Makefile $(PROGRAMS) $(DATA) +- + installdirs: +- $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(docdir) ++ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"; do \ ++ test -z "$$dir" || $(mkdir_p) "$$dir"; \ ++ done + install: install-am + install-exec: install-exec-am + install-data: install-data-am +@@ -384,7 +402,7 @@ + clean-generic: + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -405,6 +423,8 @@ + + dvi-am: + ++html: html-am ++ + info: info-am + + info-am: +@@ -436,19 +456,20 @@ + + ps-am: + +-uninstall-am: uninstall-binPROGRAMS uninstall-docDATA uninstall-info-am ++uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \ ++ uninstall-info-am + + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ +- distclean-generic distclean-tags distdir dvi dvi-am info \ +- info-am install install-am install-binPROGRAMS install-data \ +- install-data-am install-docDATA install-exec install-exec-am \ +- install-info install-info-am install-man install-strip \ +- installcheck installcheck-am installdirs maintainer-clean \ +- maintainer-clean-generic mostlyclean mostlyclean-compile \ +- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ +- uninstall-am uninstall-binPROGRAMS uninstall-docDATA \ +- uninstall-info-am ++ distclean-generic distclean-tags distdir dvi dvi-am html \ ++ html-am info info-am install install-am install-binPROGRAMS \ ++ install-data install-data-am install-docDATA install-exec \ ++ install-exec-am install-info install-info-am install-man \ ++ install-strip installcheck installcheck-am installdirs \ ++ maintainer-clean maintainer-clean-generic mostlyclean \ ++ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ ++ tags uninstall uninstall-am uninstall-binPROGRAMS \ ++ uninstall-docDATA uninstall-info-am + + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. +diff -ru ../release/mingw-utils-0.3/pexports/pexports.c ./pexports/pexports.c +--- ../release/mingw-utils-0.3/pexports/pexports.c 2003-11-25 07:23:09.000000000 -0800 ++++ ./pexports/pexports.c 2006-08-11 05:25:25.000000000 -0700 +@@ -19,7 +19,7 @@ + #endif + + /* get pointer to section header n */ +-#define IMAGE_SECTION_HDR(n) ((PIMAGE_SECTION_HEADER) ((DWORD) nt_hdr + \ ++#define IMAGE_SECTION_HDR(n) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR) nt_hdr + \ + 4 + sizeof(IMAGE_FILE_HEADER) + \ + nt_hdr->FileHeader.SizeOfOptionalHeader + \ + n * sizeof(IMAGE_SECTION_HEADER))) +@@ -146,7 +146,7 @@ + return 1; + } + +- nt_hdr = (PIMAGE_NT_HEADERS) ((DWORD) dos_hdr + dos_hdr->e_lfanew); ++ nt_hdr = (PIMAGE_NT_HEADERS) ((ULONG_PTR) dos_hdr + dos_hdr->e_lfanew); + + exp_rva = nt_hdr->OptionalHeader.DataDirectory[0].VirtualAddress; + +@@ -181,7 +181,7 @@ + PIMAGE_EXPORT_DIRECTORY exports; + char *export_name; + PWORD ordinal_table; +- char **name_table; ++ DWORD *name_table; + DWORD *function_table; + int i; + static int first = 1; +@@ -203,7 +203,7 @@ + /* set up various pointers */ + export_name = RVA_TO_PTR(exports->Name,char*); + ordinal_table = RVA_TO_PTR(exports->AddressOfNameOrdinals,PWORD); +- name_table = RVA_TO_PTR(exports->AddressOfNames,char**); ++ name_table = RVA_TO_PTR(exports->AddressOfNames,DWORD*); + function_table = RVA_TO_PTR(exports->AddressOfFunctions,void*); + + if (verbose) +@@ -297,14 +297,14 @@ + } + + /* convert rva to pointer into loaded file */ +-DWORD ++ULONG_PTR + rva_to_ptr(DWORD rva) + { + PIMAGE_SECTION_HEADER section = find_section(rva); + if (section->PointerToRawData == 0) + return 0; + else +- return ((DWORD) dos_hdr + (DWORD) rva - (section->VirtualAddress - section->PointerToRawData)); ++ return ((ULONG_PTR) dos_hdr + (DWORD) rva - (section->VirtualAddress - section->PointerToRawData)); + } + + /* Load a portable executable into memory */ +diff -ru ../release/mingw-utils-0.3/pexports/pexports.h ./pexports/pexports.h +--- ../release/mingw-utils-0.3/pexports/pexports.h 2002-05-26 03:13:58.000000000 -0700 ++++ ./pexports/pexports.h 2006-08-11 05:25:25.000000000 -0700 +@@ -21,12 +21,26 @@ + #define VER_MINOR 43 + + /* These are needed */ +-typedef unsigned short WORD; +-typedef unsigned int DWORD; +-typedef unsigned char BYTE; +-typedef long LONG; +-typedef WORD *PWORD; +-typedef DWORD *PDWORD; ++typedef unsigned short WORD, *PWORD; ++typedef unsigned char BYTE, *PBYTE; ++ ++#if SIZEOF_LONG == 4 ++typedef unsigned long DWORD, *PDWORD; ++typedef long LONG, *PLONG; ++#else ++typedef unsigned int DWORD, *PDWORD; ++typedef int LONG, *PLONG; ++#endif ++ ++#if SIZEOF_LONG == SIZEOF_VOID_P ++typedef unsigned long ULONG_PTR; ++#elif SIZEOF_LONG_LONG == SIZEOF_VOID_P ++typedef unsigned long long ULONG_PTR; ++#elif SIZEOF__INT64 == SIZEOF_VOID_P ++typedef unsigned _int64 ULONG_PTR; ++#else ++typedef unsigned int ULONG_PTR; ++#endif + + /* PE structures */ + typedef struct _IMAGE_DATA_DIRECTORY { +@@ -111,9 +125,9 @@ + DWORD Base; + DWORD NumberOfFunctions; + DWORD NumberOfNames; +- PDWORD *AddressOfFunctions; +- PDWORD *AddressOfNames; +- PWORD *AddressOfNameOrdinals; ++ DWORD AddressOfFunctions; ++ DWORD AddressOfNames; ++ DWORD AddressOfNameOrdinals; + } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; + + typedef struct _IMAGE_DOS_HEADER { +@@ -144,7 +158,7 @@ + PIMAGE_DOS_HEADER + load_pe_image(const char *filename); + +-DWORD ++ULONG_PTR + rva_to_ptr(DWORD rva); + + void +diff -ru ../release/mingw-utils-0.3/redir/Makefile.in ./redir/Makefile.in +--- ../release/mingw-utils-0.3/redir/Makefile.in 2003-11-25 08:31:12.000000000 -0800 ++++ ./redir/Makefile.in 2006-09-25 20:08:14.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -14,6 +14,7 @@ + + @SET_MAKE@ + ++ + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +@@ -21,7 +22,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +35,42 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++bin_PROGRAMS = redir$(EXEEXT) ++subdir = redir ++DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = $(top_builddir)/config.h ++CONFIG_CLEAN_FILES = ++am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" ++binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++PROGRAMS = $(bin_PROGRAMS) ++am_redir_OBJECTS = redir.$(OBJEXT) ++redir_OBJECTS = $(am_redir_OBJECTS) ++redir_LDADD = $(LDADD) ++DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) ++depcomp = $(SHELL) $(top_srcdir)/depcomp ++am__depfiles_maybe = depfiles ++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ ++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(CC) ++LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++SOURCES = $(redir_SOURCES) ++DIST_SOURCES = $(redir_SOURCES) ++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; ++am__vpath_adj = case $$p in \ ++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ++ *) f=$$p;; \ ++ esac; ++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; ++docDATA_INSTALL = $(INSTALL_DATA) ++DATA = $(doc_DATA) ++ETAGS = etags ++CTAGS = ctags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +79,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +143,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +157,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -120,61 +165,52 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +-bin_PROGRAMS = redir +- + redir_SOURCES = redir.c +- + docdir = $(prefix)/doc/redir +- + doc_DATA = README +-subdir = redir +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = $(top_builddir)/config.h +-CONFIG_CLEAN_FILES = +-bin_PROGRAMS = redir$(EXEEXT) +-PROGRAMS = $(bin_PROGRAMS) +- +-am_redir_OBJECTS = redir.$(OBJEXT) +-redir_OBJECTS = $(am_redir_OBJECTS) +-redir_LDADD = $(LDADD) +-redir_DEPENDENCIES = +-redir_LDFLAGS = +- +-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +-depcomp = $(SHELL) $(top_srcdir)/depcomp +-am__depfiles_maybe = depfiles +-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/redir.Po +-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-CCLD = $(CC) +-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +-DIST_SOURCES = $(redir_SOURCES) +-DATA = $(doc_DATA) +- +-DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am +-SOURCES = $(redir_SOURCES) +- + all: all-am + + .SUFFIXES: + .SUFFIXES: .c .o .obj +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu redir/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu redir/Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ++ esac; ++ ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++ ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ +- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ ++ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ ++ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +@@ -182,8 +218,8 @@ + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ +- rm -f $(DESTDIR)$(bindir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + + clean-binPROGRAMS: +@@ -193,7 +229,7 @@ + $(LINK) $(redir_LDFLAGS) $(redir_OBJECTS) $(redir_LDADD) $(LIBS) + + mostlyclean-compile: +- -rm -f *.$(OBJEXT) core *.core ++ -rm -f *.$(OBJEXT) + + distclean-compile: + -rm -f *.tab.c +@@ -201,54 +237,37 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/redir.Po@am__quote@ + + .c.o: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c $< + + .c.obj: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + uninstall-info-am: +-docDATA_INSTALL = $(INSTALL_DATA) + install-docDATA: $(doc_DATA) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(docdir) ++ test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f"; \ +- $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " $(docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ ++ $(docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + + uninstall-docDATA: + @$(NORMAL_UNINSTALL) + @list='$(doc_DATA)'; for p in $$list; do \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " rm -f $(DESTDIR)$(docdir)/$$f"; \ +- rm -f $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done + +-ETAGS = etags +-ETAGSFLAGS = +- +-CTAGS = ctags +-CTAGSFLAGS = +- +-tags: TAGS +- + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ +@@ -257,6 +276,7 @@ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique ++tags: TAGS + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -268,10 +288,11 @@ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ +- test -z "$(ETAGS_ARGS)$$tags$$unique" \ +- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique +- ++ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ test -n "$$unique" || unique=$$empty_fix; \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique; \ ++ fi + ctags: CTAGS + CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -294,10 +315,6 @@ + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = .. +-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ +@@ -311,7 +328,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -329,9 +346,10 @@ + check-am: all-am + check: check-am + all-am: Makefile $(PROGRAMS) $(DATA) +- + installdirs: +- $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(docdir) ++ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"; do \ ++ test -z "$$dir" || $(mkdir_p) "$$dir"; \ ++ done + install: install-am + install-exec: install-exec-am + install-data: install-data-am +@@ -351,7 +369,7 @@ + clean-generic: + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -370,6 +388,8 @@ + + dvi-am: + ++html: html-am ++ + info: info-am + + info-am: +@@ -401,19 +421,20 @@ + + ps-am: + +-uninstall-am: uninstall-binPROGRAMS uninstall-docDATA uninstall-info-am ++uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \ ++ uninstall-info-am + + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ +- distclean-generic distclean-tags distdir dvi dvi-am info \ +- info-am install install-am install-binPROGRAMS install-data \ +- install-data-am install-docDATA install-exec install-exec-am \ +- install-info install-info-am install-man install-strip \ +- installcheck installcheck-am installdirs maintainer-clean \ +- maintainer-clean-generic mostlyclean mostlyclean-compile \ +- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ +- uninstall-am uninstall-binPROGRAMS uninstall-docDATA \ +- uninstall-info-am ++ distclean-generic distclean-tags distdir dvi dvi-am html \ ++ html-am info info-am install install-am install-binPROGRAMS \ ++ install-data install-data-am install-docDATA install-exec \ ++ install-exec-am install-info install-info-am install-man \ ++ install-strip installcheck installcheck-am installdirs \ ++ maintainer-clean maintainer-clean-generic mostlyclean \ ++ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ ++ tags uninstall uninstall-am uninstall-binPROGRAMS \ ++ uninstall-docDATA uninstall-info-am + + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. +diff -ru ../release/mingw-utils-0.3/reimp/ar.c ./reimp/ar.c +--- ../release/mingw-utils-0.3/reimp/ar.c 2002-04-10 06:39:07.000000000 -0700 ++++ ./reimp/ar.c 2006-08-11 05:25:25.000000000 -0700 +@@ -21,6 +21,7 @@ + if (fread (long_names, size, 1, f) != 1) + error (0, "unexpected end-of-file\n"); + } ++ return 1; + } + else + return 0; +diff -ru ../release/mingw-utils-0.3/reimp/Makefile.in ./reimp/Makefile.in +--- ../release/mingw-utils-0.3/reimp/Makefile.in 2003-11-25 08:31:12.000000000 -0800 ++++ ./reimp/Makefile.in 2006-09-25 20:08:14.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -14,6 +14,7 @@ + + @SET_MAKE@ + ++ + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +@@ -21,7 +22,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +35,42 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++bin_PROGRAMS = reimp$(EXEEXT) ++subdir = reimp ++DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = $(top_builddir)/config.h ++CONFIG_CLEAN_FILES = ++am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" ++binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++PROGRAMS = $(bin_PROGRAMS) ++am_reimp_OBJECTS = ar.$(OBJEXT) reimp.$(OBJEXT) util.$(OBJEXT) ++reimp_OBJECTS = $(am_reimp_OBJECTS) ++reimp_LDADD = $(LDADD) ++DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) ++depcomp = $(SHELL) $(top_srcdir)/depcomp ++am__depfiles_maybe = depfiles ++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ ++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(CC) ++LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++SOURCES = $(reimp_SOURCES) ++DIST_SOURCES = $(reimp_SOURCES) ++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; ++am__vpath_adj = case $$p in \ ++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ++ *) f=$$p;; \ ++ esac; ++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; ++docDATA_INSTALL = $(INSTALL_DATA) ++DATA = $(doc_DATA) ++ETAGS = etags ++CTAGS = ctags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +79,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +143,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +157,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -120,62 +165,52 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +-bin_PROGRAMS = reimp +- + reimp_SOURCES = ar.c reimp.c reimp.h util.c +- + docdir = $(prefix)/doc/reimp +- + doc_DATA = README +-subdir = reimp +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = $(top_builddir)/config.h +-CONFIG_CLEAN_FILES = +-bin_PROGRAMS = reimp$(EXEEXT) +-PROGRAMS = $(bin_PROGRAMS) +- +-am_reimp_OBJECTS = ar.$(OBJEXT) reimp.$(OBJEXT) util.$(OBJEXT) +-reimp_OBJECTS = $(am_reimp_OBJECTS) +-reimp_LDADD = $(LDADD) +-reimp_DEPENDENCIES = +-reimp_LDFLAGS = +- +-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +-depcomp = $(SHELL) $(top_srcdir)/depcomp +-am__depfiles_maybe = depfiles +-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ar.Po ./$(DEPDIR)/reimp.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/util.Po +-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-CCLD = $(CC) +-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +-DIST_SOURCES = $(reimp_SOURCES) +-DATA = $(doc_DATA) +- +-DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am +-SOURCES = $(reimp_SOURCES) +- + all: all-am + + .SUFFIXES: + .SUFFIXES: .c .o .obj +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu reimp/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu reimp/Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ++ esac; ++ ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++ ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ +- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ ++ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ ++ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +@@ -183,8 +218,8 @@ + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ +- rm -f $(DESTDIR)$(bindir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + + clean-binPROGRAMS: +@@ -194,7 +229,7 @@ + $(LINK) $(reimp_LDFLAGS) $(reimp_OBJECTS) $(reimp_LDADD) $(LIBS) + + mostlyclean-compile: +- -rm -f *.$(OBJEXT) core *.core ++ -rm -f *.$(OBJEXT) + + distclean-compile: + -rm -f *.tab.c +@@ -204,54 +239,37 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ + + .c.o: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c $< + + .c.obj: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + uninstall-info-am: +-docDATA_INSTALL = $(INSTALL_DATA) + install-docDATA: $(doc_DATA) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(docdir) ++ test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f"; \ +- $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " $(docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ ++ $(docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + + uninstall-docDATA: + @$(NORMAL_UNINSTALL) + @list='$(doc_DATA)'; for p in $$list; do \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " rm -f $(DESTDIR)$(docdir)/$$f"; \ +- rm -f $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done + +-ETAGS = etags +-ETAGSFLAGS = +- +-CTAGS = ctags +-CTAGSFLAGS = +- +-tags: TAGS +- + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ +@@ -260,6 +278,7 @@ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique ++tags: TAGS + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -271,10 +290,11 @@ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ +- test -z "$(ETAGS_ARGS)$$tags$$unique" \ +- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique +- ++ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ test -n "$$unique" || unique=$$empty_fix; \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique; \ ++ fi + ctags: CTAGS + CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -297,10 +317,6 @@ + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = .. +-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ +@@ -314,7 +330,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -332,9 +348,10 @@ + check-am: all-am + check: check-am + all-am: Makefile $(PROGRAMS) $(DATA) +- + installdirs: +- $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(docdir) ++ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"; do \ ++ test -z "$$dir" || $(mkdir_p) "$$dir"; \ ++ done + install: install-am + install-exec: install-exec-am + install-data: install-data-am +@@ -354,7 +371,7 @@ + clean-generic: + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -373,6 +390,8 @@ + + dvi-am: + ++html: html-am ++ + info: info-am + + info-am: +@@ -404,19 +423,20 @@ + + ps-am: + +-uninstall-am: uninstall-binPROGRAMS uninstall-docDATA uninstall-info-am ++uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \ ++ uninstall-info-am + + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ +- distclean-generic distclean-tags distdir dvi dvi-am info \ +- info-am install install-am install-binPROGRAMS install-data \ +- install-data-am install-docDATA install-exec install-exec-am \ +- install-info install-info-am install-man install-strip \ +- installcheck installcheck-am installdirs maintainer-clean \ +- maintainer-clean-generic mostlyclean mostlyclean-compile \ +- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ +- uninstall-am uninstall-binPROGRAMS uninstall-docDATA \ +- uninstall-info-am ++ distclean-generic distclean-tags distdir dvi dvi-am html \ ++ html-am info info-am install install-am install-binPROGRAMS \ ++ install-data install-data-am install-docDATA install-exec \ ++ install-exec-am install-info install-info-am install-man \ ++ install-strip installcheck installcheck-am installdirs \ ++ maintainer-clean maintainer-clean-generic mostlyclean \ ++ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ ++ tags uninstall uninstall-am uninstall-binPROGRAMS \ ++ uninstall-docDATA uninstall-info-am + + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. +diff -ru ../release/mingw-utils-0.3/reimp/reimp.h ./reimp/reimp.h +--- ../release/mingw-utils-0.3/reimp/reimp.h 2002-04-10 06:39:07.000000000 -0700 ++++ ./reimp/reimp.h 2006-08-11 05:25:25.000000000 -0700 +@@ -3,7 +3,7 @@ + + /* we need integers of specific sizes */ + #ifndef uint32 +-#define uint32 unsigned long ++#define uint32 unsigned int + #endif + + #ifndef uint16 +diff -ru ../release/mingw-utils-0.3/res2coff/Makefile.in ./res2coff/Makefile.in +--- ../release/mingw-utils-0.3/res2coff/Makefile.in 2003-11-25 08:31:12.000000000 -0800 ++++ ./res2coff/Makefile.in 2006-09-25 20:08:14.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -14,6 +14,7 @@ + + @SET_MAKE@ + ++ + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +@@ -21,7 +22,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +35,43 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++bin_PROGRAMS = res2coff$(EXEEXT) ++subdir = res2coff ++DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = $(top_builddir)/config.h ++CONFIG_CLEAN_FILES = ++am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" ++binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++PROGRAMS = $(bin_PROGRAMS) ++am_res2coff_OBJECTS = objimage.$(OBJEXT) res2coff.$(OBJEXT) \ ++ resimage.$(OBJEXT) ++res2coff_OBJECTS = $(am_res2coff_OBJECTS) ++res2coff_LDADD = $(LDADD) ++DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) ++depcomp = $(SHELL) $(top_srcdir)/depcomp ++am__depfiles_maybe = depfiles ++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ ++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(CC) ++LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++SOURCES = $(res2coff_SOURCES) ++DIST_SOURCES = $(res2coff_SOURCES) ++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; ++am__vpath_adj = case $$p in \ ++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ++ *) f=$$p;; \ ++ esac; ++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; ++docDATA_INSTALL = $(INSTALL_DATA) ++DATA = $(doc_DATA) ++ETAGS = etags ++CTAGS = ctags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +80,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +144,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +158,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -120,63 +166,52 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +-bin_PROGRAMS = res2coff +- + res2coff_SOURCES = objimage.c protos.h res2coff.c res2coff.h resimage.c +- + docdir = $(prefix)/doc/res2coff +- + doc_DATA = README +-subdir = res2coff +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = $(top_builddir)/config.h +-CONFIG_CLEAN_FILES = +-bin_PROGRAMS = res2coff$(EXEEXT) +-PROGRAMS = $(bin_PROGRAMS) +- +-am_res2coff_OBJECTS = objimage.$(OBJEXT) res2coff.$(OBJEXT) \ +- resimage.$(OBJEXT) +-res2coff_OBJECTS = $(am_res2coff_OBJECTS) +-res2coff_LDADD = $(LDADD) +-res2coff_DEPENDENCIES = +-res2coff_LDFLAGS = +- +-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +-depcomp = $(SHELL) $(top_srcdir)/depcomp +-am__depfiles_maybe = depfiles +-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/objimage.Po ./$(DEPDIR)/res2coff.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/resimage.Po +-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-CCLD = $(CC) +-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +-DIST_SOURCES = $(res2coff_SOURCES) +-DATA = $(doc_DATA) +- +-DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am +-SOURCES = $(res2coff_SOURCES) +- + all: all-am + + .SUFFIXES: + .SUFFIXES: .c .o .obj +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu res2coff/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu res2coff/Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ++ esac; ++ ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++ ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ +- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ ++ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ ++ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +@@ -184,8 +219,8 @@ + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ +- rm -f $(DESTDIR)$(bindir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + + clean-binPROGRAMS: +@@ -195,7 +230,7 @@ + $(LINK) $(res2coff_LDFLAGS) $(res2coff_OBJECTS) $(res2coff_LDADD) $(LIBS) + + mostlyclean-compile: +- -rm -f *.$(OBJEXT) core *.core ++ -rm -f *.$(OBJEXT) + + distclean-compile: + -rm -f *.tab.c +@@ -205,54 +240,37 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resimage.Po@am__quote@ + + .c.o: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c $< + + .c.obj: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + uninstall-info-am: +-docDATA_INSTALL = $(INSTALL_DATA) + install-docDATA: $(doc_DATA) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(docdir) ++ test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f"; \ +- $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " $(docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ ++ $(docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + + uninstall-docDATA: + @$(NORMAL_UNINSTALL) + @list='$(doc_DATA)'; for p in $$list; do \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " rm -f $(DESTDIR)$(docdir)/$$f"; \ +- rm -f $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done + +-ETAGS = etags +-ETAGSFLAGS = +- +-CTAGS = ctags +-CTAGSFLAGS = +- +-tags: TAGS +- + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ +@@ -261,6 +279,7 @@ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique ++tags: TAGS + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -272,10 +291,11 @@ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ +- test -z "$(ETAGS_ARGS)$$tags$$unique" \ +- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique +- ++ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ test -n "$$unique" || unique=$$empty_fix; \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique; \ ++ fi + ctags: CTAGS + CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -298,10 +318,6 @@ + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = .. +-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ +@@ -315,7 +331,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -333,9 +349,10 @@ + check-am: all-am + check: check-am + all-am: Makefile $(PROGRAMS) $(DATA) +- + installdirs: +- $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(docdir) ++ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"; do \ ++ test -z "$$dir" || $(mkdir_p) "$$dir"; \ ++ done + install: install-am + install-exec: install-exec-am + install-data: install-data-am +@@ -355,7 +372,7 @@ + clean-generic: + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -374,6 +391,8 @@ + + dvi-am: + ++html: html-am ++ + info: info-am + + info-am: +@@ -405,19 +424,20 @@ + + ps-am: + +-uninstall-am: uninstall-binPROGRAMS uninstall-docDATA uninstall-info-am ++uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \ ++ uninstall-info-am + + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ +- distclean-generic distclean-tags distdir dvi dvi-am info \ +- info-am install install-am install-binPROGRAMS install-data \ +- install-data-am install-docDATA install-exec install-exec-am \ +- install-info install-info-am install-man install-strip \ +- installcheck installcheck-am installdirs maintainer-clean \ +- maintainer-clean-generic mostlyclean mostlyclean-compile \ +- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ +- uninstall-am uninstall-binPROGRAMS uninstall-docDATA \ +- uninstall-info-am ++ distclean-generic distclean-tags distdir dvi dvi-am html \ ++ html-am info info-am install install-am install-binPROGRAMS \ ++ install-data install-data-am install-docDATA install-exec \ ++ install-exec-am install-info install-info-am install-man \ ++ install-strip installcheck installcheck-am installdirs \ ++ maintainer-clean maintainer-clean-generic mostlyclean \ ++ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ ++ tags uninstall uninstall-am uninstall-binPROGRAMS \ ++ uninstall-docDATA uninstall-info-am + + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. +diff -ru ../release/mingw-utils-0.3/scripts/a2dll.in ./scripts/a2dll.in +--- ../release/mingw-utils-0.3/scripts/a2dll.in 2002-05-26 03:13:58.000000000 -0700 ++++ ./scripts/a2dll.in 2006-08-11 05:25:25.000000000 -0700 +@@ -12,6 +12,13 @@ + exit 0 + } + ++# Figure out where the script is located and then use that path as the location ++# for the tools ++ ++cwd=`pwd` ++cd `dirname $0` ++SCRIPTDIR=`pwd` ++cd $cwd + + cmdline=$@ + +@@ -43,14 +50,14 @@ + rm -f .dll/* + /usr/bin/mkdir -p .dll + cd .dll +- ar x ../$in ++ ${SCRIPTDIR}/ar x ../$in + else + cd .dll + fi + + echo Creating shared library \'$out\' + +-dllwrap --export-all -o ../$out `ls` $libs >../ld.err 2>&1 ++${SCRIPTDIR}/dllwrap --export-all -o ../$out `ls` $libs >../ld.err 2>&1 + + cd .. + if [ `wc ld.err|awk ' {print $1}' ` -gt 2 ] +@@ -72,17 +79,17 @@ + # 2. I just saw that dlltool lies about assembly-sourced files, it + # lists their symbols as data + +- pexports $out >$base.def ++ ${SCRIPTDIR}/pexports $out >$base.def + + # create import library + + mv $in $in.static +- dlltool --dllname $out --def $base.def --output-lib $in ++ ${SCRIPTDIR}/dlltool --dllname $out --def $base.def --output-lib $in + + # finally, we check whether dll exports data symbols + # if yes, we suggest user on steps to perform + +- pexports $out | awk '/DATA/ { print $1}' >$out.data ++ ${SCRIPTDIR}/pexports $out | awk '/DATA/ { print $1}' >$out.data + if test -s $out.data + then + echo +diff -ru ../release/mingw-utils-0.3/scripts/Makefile.in ./scripts/Makefile.in +--- ../release/mingw-utils-0.3/scripts/Makefile.in 2003-11-25 08:31:12.000000000 -0800 ++++ ./scripts/Makefile.in 2006-09-25 20:08:14.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -21,7 +21,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +34,22 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++subdir = scripts ++DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ ++ $(srcdir)/a2dll.in $(srcdir)/dsw2mak.in ChangeLog ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = $(top_builddir)/config.h ++CONFIG_CLEAN_FILES = a2dll dsw2mak ++am__installdirs = "$(DESTDIR)$(bindir)" ++binSCRIPT_INSTALL = $(INSTALL_SCRIPT) ++SCRIPTS = $(bin_SCRIPTS) ++SOURCES = ++DIST_SOURCES = ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +58,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +122,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +136,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -121,40 +145,52 @@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ + bin_SCRIPTS = a2dll dsw2mak +- + EXTRA_DIST = a2dll.html static2dll_howto.txt +-subdir = scripts +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = $(top_builddir)/config.h +-CONFIG_CLEAN_FILES = a2dll dsw2mak +-SCRIPTS = $(bin_SCRIPTS) +- +-DIST_SOURCES = +-DIST_COMMON = $(srcdir)/Makefile.in ChangeLog Makefile.am a2dll.in \ +- dsw2mak.in + all: all-am + + .SUFFIXES: +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu scripts/Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +-a2dll: $(top_builddir)/config.status a2dll.in ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ++ esac; ++ ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++ ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++a2dll: $(top_builddir)/config.status $(srcdir)/a2dll.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +-dsw2mak: $(top_builddir)/config.status dsw2mak.in ++dsw2mak: $(top_builddir)/config.status $(srcdir)/dsw2mak.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +-binSCRIPT_INSTALL = $(INSTALL_SCRIPT) + install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ +- echo " $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f"; \ +- $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f; \ ++ echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ ++ $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +@@ -162,8 +198,8 @@ + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ +- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ +- rm -f $(DESTDIR)$(bindir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + uninstall-info-am: + tags: TAGS +@@ -172,10 +208,6 @@ + ctags: CTAGS + CTAGS: + +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = .. +-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ +@@ -189,7 +221,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -207,9 +239,10 @@ + check-am: all-am + check: check-am + all-am: Makefile $(SCRIPTS) +- + installdirs: +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ for dir in "$(DESTDIR)$(bindir)"; do \ ++ test -z "$$dir" || $(mkdir_p) "$$dir"; \ ++ done + install: install-am + install-exec: install-exec-am + install-data: install-data-am +@@ -229,7 +262,7 @@ + clean-generic: + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -246,6 +279,8 @@ + + dvi-am: + ++html: html-am ++ + info: info-am + + info-am: +@@ -279,14 +314,14 @@ + uninstall-am: uninstall-binSCRIPTS uninstall-info-am + + .PHONY: all all-am check check-am clean clean-generic distclean \ +- distclean-generic distdir dvi dvi-am info info-am install \ +- install-am install-binSCRIPTS install-data install-data-am \ +- install-exec install-exec-am install-exec-local install-info \ +- install-info-am install-man install-strip installcheck \ +- installcheck-am installdirs maintainer-clean \ +- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ +- pdf-am ps ps-am uninstall uninstall-am uninstall-binSCRIPTS \ +- uninstall-info-am ++ distclean-generic distdir dvi dvi-am html html-am info info-am \ ++ install install-am install-binSCRIPTS install-data \ ++ install-data-am install-exec install-exec-am \ ++ install-exec-local install-info install-info-am install-man \ ++ install-strip installcheck installcheck-am installdirs \ ++ maintainer-clean maintainer-clean-generic mostlyclean \ ++ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ ++ uninstall-binSCRIPTS uninstall-info-am + + + install-exec-local: +diff -ru ../release/mingw-utils-0.3/unix2dos/Makefile.am ./unix2dos/Makefile.am +--- ../release/mingw-utils-0.3/unix2dos/Makefile.am 2002-12-04 04:08:07.000000000 -0800 ++++ ./unix2dos/Makefile.am 2006-09-25 20:07:20.000000000 -0700 +@@ -6,7 +6,8 @@ + + docdir = $(prefix)/doc/unix2dos + +-doc_DATA = COPYING unix2dos.html ++#doc_DATA = COPYING unix2dos.html ++doc_DATA = COPYING + + unix2dos.html: unix2dos.1 + man2html $< > $@ +diff -ru ../release/mingw-utils-0.3/unix2dos/Makefile.in ./unix2dos/Makefile.in +--- ../release/mingw-utils-0.3/unix2dos/Makefile.in 2003-11-25 08:31:12.000000000 -0800 ++++ ./unix2dos/Makefile.in 2006-09-25 20:08:14.000000000 -0700 +@@ -1,8 +1,8 @@ +-# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# Makefile.in generated by automake 1.9.6 from Makefile.am. + # @configure_input@ + +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +-# Free Software Foundation, Inc. ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -14,6 +14,7 @@ + + @SET_MAKE@ + ++ + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +@@ -21,7 +22,6 @@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. +- + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + INSTALL = @INSTALL@ + install_sh_DATA = $(install_sh) -c -m 644 +@@ -35,6 +35,42 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++bin_PROGRAMS = unix2dos$(EXEEXT) ++subdir = unix2dos ++DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++am__aclocal_m4_deps = $(top_srcdir)/configure.ac ++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ++ $(ACLOCAL_M4) ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = $(top_builddir)/config.h ++CONFIG_CLEAN_FILES = ++am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" ++binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++PROGRAMS = $(bin_PROGRAMS) ++am_unix2dos_OBJECTS = unix2dos.$(OBJEXT) ++unix2dos_OBJECTS = $(am_unix2dos_OBJECTS) ++unix2dos_LDADD = $(LDADD) ++DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) ++depcomp = $(SHELL) $(top_srcdir)/depcomp ++am__depfiles_maybe = depfiles ++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ ++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(CC) ++LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++SOURCES = $(unix2dos_SOURCES) ++DIST_SOURCES = $(unix2dos_SOURCES) ++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; ++am__vpath_adj = case $$p in \ ++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ++ *) f=$$p;; \ ++ esac; ++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; ++docDATA_INSTALL = $(INSTALL_DATA) ++DATA = $(doc_DATA) ++ETAGS = etags ++CTAGS = ctags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + ACLOCAL = @ACLOCAL@ + AMDEP_FALSE = @AMDEP_FALSE@ + AMDEP_TRUE = @AMDEP_TRUE@ +@@ -43,6 +79,12 @@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ ++BUILD_DRMINGW_FALSE = @BUILD_DRMINGW_FALSE@ ++BUILD_DRMINGW_TRUE = @BUILD_DRMINGW_TRUE@ ++BUILD_REDIR_FALSE = @BUILD_REDIR_FALSE@ ++BUILD_REDIR_TRUE = @BUILD_REDIR_TRUE@ ++BUILD_RES2COFF_FALSE = @BUILD_RES2COFF_FALSE@ ++BUILD_RES2COFF_TRUE = @BUILD_RES2COFF_TRUE@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +@@ -101,6 +143,8 @@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ ++am__tar = @am__tar@ ++am__untar = @am__untar@ + bindir = @bindir@ + build_alias = @build_alias@ + datadir = @datadir@ +@@ -113,6 +157,7 @@ + libexecdir = @libexecdir@ + localstatedir = @localstatedir@ + mandir = @mandir@ ++mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +@@ -120,63 +165,55 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +-bin_PROGRAMS = unix2dos +- + unix2dos_SOURCES = unix2dos.c unix2dos.h +- + noinst_man_MANS = unix2dos.1 +- + docdir = $(prefix)/doc/unix2dos + +-doc_DATA = COPYING unix2dos.html +-subdir = unix2dos +-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +-CONFIG_HEADER = $(top_builddir)/config.h +-CONFIG_CLEAN_FILES = +-bin_PROGRAMS = unix2dos$(EXEEXT) +-PROGRAMS = $(bin_PROGRAMS) +- +-am_unix2dos_OBJECTS = unix2dos.$(OBJEXT) +-unix2dos_OBJECTS = $(am_unix2dos_OBJECTS) +-unix2dos_LDADD = $(LDADD) +-unix2dos_DEPENDENCIES = +-unix2dos_LDFLAGS = +- +-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +-depcomp = $(SHELL) $(top_srcdir)/depcomp +-am__depfiles_maybe = depfiles +-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/unix2dos.Po +-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-CCLD = $(CC) +-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +-DIST_SOURCES = $(unix2dos_SOURCES) +-DATA = $(doc_DATA) +- +-DIST_COMMON = $(srcdir)/Makefile.in COPYING Makefile.am +-SOURCES = $(unix2dos_SOURCES) +- ++#doc_DATA = COPYING unix2dos.html ++doc_DATA = COPYING + all: all-am + + .SUFFIXES: + .SUFFIXES: .c .o .obj +-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ++ @for dep in $?; do \ ++ case '$(am__configure_deps)' in \ ++ *$$dep*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ ++ && exit 0; \ ++ exit 1;; \ ++ esac; \ ++ done; \ ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu unix2dos/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu unix2dos/Makefile +-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status +- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) ++.PRECIOUS: Makefile ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++ @case '$?' in \ ++ *config.status*) \ ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ ++ *) \ ++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ ++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ++ esac; ++ ++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++ ++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) ++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(bindir) ++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ +- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ ++ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ ++ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +@@ -184,8 +221,8 @@ + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ +- rm -f $(DESTDIR)$(bindir)/$$f; \ ++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + + clean-binPROGRAMS: +@@ -195,7 +232,7 @@ + $(LINK) $(unix2dos_LDFLAGS) $(unix2dos_OBJECTS) $(unix2dos_LDADD) $(LIBS) + + mostlyclean-compile: +- -rm -f *.$(OBJEXT) core *.core ++ -rm -f *.$(OBJEXT) + + distclean-compile: + -rm -f *.tab.c +@@ -203,54 +240,37 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix2dos.Po@am__quote@ + + .c.o: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c $< + + .c.obj: +-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +-@am__fastdepCC_TRUE@ fi ++@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ ++@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + uninstall-info-am: +-docDATA_INSTALL = $(INSTALL_DATA) + install-docDATA: $(doc_DATA) + @$(NORMAL_INSTALL) +- $(mkinstalldirs) $(DESTDIR)$(docdir) ++ test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f"; \ +- $(docDATA_INSTALL) $$d$$p $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " $(docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ ++ $(docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + + uninstall-docDATA: + @$(NORMAL_UNINSTALL) + @list='$(doc_DATA)'; for p in $$list; do \ +- f="`echo $$p | sed -e 's|^.*/||'`"; \ +- echo " rm -f $(DESTDIR)$(docdir)/$$f"; \ +- rm -f $(DESTDIR)$(docdir)/$$f; \ ++ f=$(am__strip_dir) \ ++ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ ++ rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done + +-ETAGS = etags +-ETAGSFLAGS = +- +-CTAGS = ctags +-CTAGSFLAGS = +- +-tags: TAGS +- + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ +@@ -259,6 +279,7 @@ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique ++tags: TAGS + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -270,10 +291,11 @@ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ +- test -z "$(ETAGS_ARGS)$$tags$$unique" \ +- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique +- ++ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ test -n "$$unique" || unique=$$empty_fix; \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique; \ ++ fi + ctags: CTAGS + CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +@@ -296,10 +318,6 @@ + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +- +-top_distdir = .. +-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ +@@ -313,7 +331,7 @@ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ +- $(mkinstalldirs) "$(distdir)$$dir"; \ ++ $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ +@@ -331,9 +349,10 @@ + check-am: all-am + check: check-am + all-am: Makefile $(PROGRAMS) $(DATA) +- + installdirs: +- $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(docdir) ++ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"; do \ ++ test -z "$$dir" || $(mkdir_p) "$$dir"; \ ++ done + install: install-am + install-exec: install-exec-am + install-data: install-data-am +@@ -353,7 +372,7 @@ + clean-generic: + + distclean-generic: +- -rm -f $(CONFIG_CLEAN_FILES) ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -372,6 +391,8 @@ + + dvi-am: + ++html: html-am ++ + info: info-am + + info-am: +@@ -403,19 +424,20 @@ + + ps-am: + +-uninstall-am: uninstall-binPROGRAMS uninstall-docDATA uninstall-info-am ++uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \ ++ uninstall-info-am + + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ +- distclean-generic distclean-tags distdir dvi dvi-am info \ +- info-am install install-am install-binPROGRAMS install-data \ +- install-data-am install-docDATA install-exec install-exec-am \ +- install-info install-info-am install-man install-strip \ +- installcheck installcheck-am installdirs maintainer-clean \ +- maintainer-clean-generic mostlyclean mostlyclean-compile \ +- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ +- uninstall-am uninstall-binPROGRAMS uninstall-docDATA \ +- uninstall-info-am ++ distclean-generic distclean-tags distdir dvi dvi-am html \ ++ html-am info info-am install install-am install-binPROGRAMS \ ++ install-data install-data-am install-docDATA install-exec \ ++ install-exec-am install-info install-info-am install-man \ ++ install-strip installcheck installcheck-am installdirs \ ++ maintainer-clean maintainer-clean-generic mostlyclean \ ++ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ ++ tags uninstall uninstall-am uninstall-binPROGRAMS \ ++ uninstall-docDATA uninstall-info-am + + + unix2dos.html: unix2dos.1 diff --git a/bacula/src/win32/patches/mt.patch b/bacula/src/win32/patches/mt.patch new file mode 100644 index 0000000000..7b0914b4e7 --- /dev/null +++ b/bacula/src/win32/patches/mt.patch @@ -0,0 +1,1689 @@ +diff -ru ..\release\mt-st-0.9b/Makefile ./Makefile +--- ..\release\mt-st-0.9b/Makefile 2005-08-16 12:16:28.000000000 -0700 ++++ ./Makefile 2006-08-09 03:26:58.292856500 -0700 +@@ -1,29 +1,27 @@ ++CC= mingw32-gcc + CFLAGS= -Wall -O2 +-SBINDIR= /sbin +-BINDIR= /bin +-MANDIR= /usr/share/man ++PREFIX= ++SBINDIR= $(PREFIX)/sbin ++BINDIR= $(PREFIX)/bin ++MANDIR= $(PREFIX)/man + +-all: mt stinit ++all: mt.exe + +-mt: mt.c +- $(CC) $(CFLAGS) -o mt mt.c ++mt.exe: mt.c ++ $(CC) $(CFLAGS) -o mt.exe mt.c mtops.c + +-stinit: stinit.c ++stinit.exe: stinit.c + $(CC) $(CFLAGS) -o stinit stinit.c + +-install: mt stinit +- install -s mt $(BINDIR) ++install: mt.exe ++ install mt.exe $(BINDIR) + install -c -m 444 mt.1 $(MANDIR)/man1 + (if [ -f $(MANDIR)/man1/mt.1.gz ] ; then \ + rm -f $(MANDIR)/man1/mt.1.gz; gzip $(MANDIR)/man1/mt.1; fi) +- install -s stinit $(SBINDIR) +- install -c -m 444 stinit.8 $(MANDIR)/man8 +- (if [ -f $(MANDIR)/man8/stinit.8.gz ] ; then \ +- rm -f $(MANDIR)/man8/stinit.8.gz; gzip $(MANDIR)/man8/stinit.8; fi) + + dist: clean + (mydir=`basename \`pwd\``;\ + cd .. && tar cvvf - $$mydir | gzip -9 > $${mydir}.tar.gz) + + clean: +- rm -f *~ \#*\# *.o mt stinit ++ rm -f *~ \#*\# *.o mt.exe stinit.exe +diff -ru ..\release\mt-st-0.9b/mt.1 ./mt.1 +--- ..\release\mt-st-0.9b/mt.1 2005-08-21 11:53:50.000000000 -0700 ++++ ./mt.1 2006-08-09 03:26:58.302871100 -0700 +@@ -48,20 +48,22 @@ + files. + The tape is positioned on the first block of the next file. + .IP fsfm +-Forward space ++Forward space past + .I count +-files. +-The tape is positioned on the last block of the previous file. ++file marks, then backward space one file record. ++This leaves the tape positioned on the last block of the file that is count-1 ++files past the current file. + .IP bsf + Backward space + .I count + files. + The tape is positioned on the last block of the previous file. + .IP bsfm +-Backward space ++Backward space past + .I count +-files. +-The tape is positioned on the first block of the next file. ++file marks, then forward space one file record. ++This leaves the tape positioned on the first block of the file that is count-1 ++files before the current file. + .IP asf + The tape is positioned at the beginning of the + .I count +diff -ru ..\release\mt-st-0.9b/mt.c ./mt.c +--- ..\release\mt-st-0.9b/mt.c 2005-08-21 11:48:06.000000000 -0700 ++++ ./mt.c 2006-08-09 04:00:01.093525100 -0700 +@@ -11,25 +11,35 @@ + Last Modified: Sun Aug 21 21:48:06 2005 by kai.makisara + */ + ++#include ++#include ++#include ++ ++#define O_NONBLOCK 0 ++ + #include ++#if !defined(_MSC_VER) + #include ++#endif + #include + #include + #include + #include + #include + #include +-#include + ++#include "mtops.h" + #include "mtio.h" + ++#define ioctl tape_ioctl ++ + #ifndef DEFTAPE +-#define DEFTAPE "/dev/tape" /* default tape device */ ++#define DEFTAPE "Tape0" /* default tape device */ + #endif /* DEFTAPE */ + +-#define VERSION "0.9b" ++#define VERSION "0.9b-bacula" + +-typedef int (* cmdfunc)(/* int, struct cmdef_tr *, int, char ** */); ++typedef int (* cmdfunc)(int, struct cmdef_tr *, int, char **); + + typedef struct cmdef_tr { + char *cmd_name; +@@ -143,12 +153,14 @@ + FD_RDONLY, ONE_ARG, 0}, + { "defcompression", MTSETDRVBUFFER, do_drvbuffer, MT_ST_DEF_COMPRESSION, + FD_RDONLY, ONE_ARG, 0}, ++#if 0 + { "stsetcln", MTSETDRVBUFFER, do_drvbuffer, MT_ST_SET_CLN, + FD_RDONLY, ONE_ARG, 0}, + { "sttimeout", MTSETDRVBUFFER, do_drvbuffer, MT_ST_SET_TIMEOUT, + FD_RDONLY, ONE_ARG, 0}, + { "stlongtimeout", MTSETDRVBUFFER, do_drvbuffer, MT_ST_SET_LONG_TIMEOUT, + FD_RDONLY, ONE_ARG, 0}, ++#endif + { "densities", 0, print_densities, 0, NO_FD, NO_ARGS, + 0 }, + { "setpartition", MTSETPART, do_standard, 0, FD_RDONLY, ONE_ARG, +@@ -211,13 +223,19 @@ + {0x30, "AIT-1 or MLR3"}, + {0x31, "AIT-2"}, + {0x32, "AIT-3"}, +- {0x33, "SLR6"}, ++ {0x33, "AIT-4 or SLR6"}, + {0x34, "SLR100"}, ++ {0x38, "AIT-E Turbo"}, ++ {0x39, "AIT-1 Turbo"}, ++ {0x3A, "AIT-2 Turbo"}, ++ {0x3B, "AIT-3Ex"}, + {0x40, "DLT1 40 GB, or Ultrium"}, + {0x41, "DLT 40GB, or Ultrium2"}, + {0x42, "LTO-2"}, + {0x45, "QIC-3095-MC (TR-4)"}, + {0x47, "TR-5"}, ++ {0x48, "Quantum SDLT220"}, ++ {0x49, "Quantum SDLT320"}, + {0x80, "DLT 15GB uncomp. or Ecrix"}, + {0x81, "DLT 15GB compressed"}, + {0x82, "DLT 20GB uncompressed"}, +@@ -254,20 +272,25 @@ + {"no-blklimits", MT_ST_NO_BLKLIMS, "drive doesn't support read block limits"}, + {"can-partitions",MT_ST_CAN_PARTITIONS,"drive can handle partitioned tapes"}, + {"scsi2logical", MT_ST_SCSI2LOGICAL, "logical block addresses used with SCSI-2"}, ++#if 0 + {"no-wait", MT_ST_NOWAIT, "immediate mode for rewind, etc."}, ++#endif + #ifdef MT_ST_SYSV + {"sysv", MT_ST_SYSV, "enable the SystemV semantics"}, + #endif ++#if 0 + {"cleaning", MT_ST_SET_CLN, "set the cleaning bit location and mask"}, ++#endif + {NULL, 0}}; + + static char *tape_name; /* The tape name for messages */ + + +- int ++int + main(int argc, char **argv) + { +- int mtfd, cmd_code, i, argn, len, oflags; ++ int mtfd, cmd_code, i, argn, oflags; ++ unsigned int len; + char *cmdstr; + cmdef_tr *comp, *comp2; + +@@ -344,7 +367,7 @@ + oflags = comp->cmd_fdtype == FD_RDONLY ? O_RDONLY : O_RDWR; + if ((comp->error_tests & ET_ONLINE) == 0) + oflags |= O_NONBLOCK; +- if ((mtfd = open(tape_name, oflags)) < 0) { ++ if ((mtfd = tape_open(tape_name, oflags, 0)) < 0) { + perror(tape_name); + exit(1); + } +@@ -368,7 +391,7 @@ + } + + if (mtfd >= 0) +- close(mtfd); ++ tape_close(mtfd); + return i; + } + +@@ -409,9 +432,9 @@ + do_standard(int mtfd, cmdef_tr *cmd, int argc, char **argv) + { + struct mtop mt_com; +- char *endp; ++ char *endp = NULL; + +- mt_com.mt_op = cmd->cmd_code; ++ mt_com.mt_op = (short)cmd->cmd_code; + mt_com.mt_count = (argc > 0 ? strtol(*argv, &endp, 0) : 1); + if (argc > 0 && endp != *argv) { + if (*endp == 'k') +@@ -464,7 +487,8 @@ + static int + do_options(int mtfd, cmdef_tr *cmd, int argc, char **argv) + { +- int i, an, len; ++ int i, an; ++ unsigned int len; + struct mtop mt_com; + + mt_com.mt_op = MTSETDRVBUFFER; +@@ -596,8 +620,10 @@ + type = "SCSI 1"; + else if (status.mt_type == MT_ISSCSI2) + type = "SCSI 2"; ++#if 0 + else if (status.mt_type == MT_ISONSTREAM_SC) + type = "OnStream SC-, DI-, DP-, or USB"; ++#endif + else + type = NULL; + if (type == NULL) { +@@ -607,7 +633,7 @@ + printf("IDE-Tape (type code 0) ?\n"); + else + printf("Unknown tape drive type (type code %ld)\n", status.mt_type); +- printf("File number=%d, block number=%d.\n", ++ printf("File number=%ld, block number=%ld.\n", + status.mt_fileno, status.mt_blkno); + printf("mt_resid: %ld, mt_erreg: 0x%lx\n", + status.mt_resid, status.mt_erreg); +@@ -617,14 +643,17 @@ + else { + printf("%s tape drive:\n", type); + if (status.mt_type == MT_ISSCSI2) +- printf("File number=%d, block number=%d, partition=%ld.\n", ++ printf("File number=%ld, block number=%ld, partition=%ld.\n", + status.mt_fileno, status.mt_blkno, (status.mt_resid & 0xff)); + else +- printf("File number=%d, block number=%d.\n", ++ printf("File number=%ld, block number=%ld.\n", + status.mt_fileno, status.mt_blkno); +- if (status.mt_type == MT_ISSCSI1 || +- status.mt_type == MT_ISSCSI2 || +- status.mt_type == MT_ISONSTREAM_SC) { ++ if (status.mt_type == MT_ISSCSI1 ++ || status.mt_type == MT_ISSCSI2 ++#if 0 ++ || status.mt_type == MT_ISONSTREAM_SC ++#endif ++ ) { + dens = (status.mt_dsreg & MT_ST_DENSITY_MASK) >> MT_ST_DENSITY_SHIFT; + density = "no translation"; + for (i=0; i < NBR_DENSITIES; i++) +@@ -666,8 +695,10 @@ + printf(" DR_OPEN"); + if (GMT_IM_REP_EN(status.mt_gstat)) + printf(" IM_REP_EN"); ++#if 0 + if (GMT_CLN(status.mt_gstat)) + printf(" CLN"); ++#endif + printf("\n"); + return 0; + } +diff -ru ..\release\mt-st-0.9b/mtio.h ./mtio.h +--- ..\release\mt-st-0.9b/mtio.h 2005-08-16 12:16:28.000000000 -0700 ++++ ./mtio.h 2006-08-09 03:26:58.352944100 -0700 +@@ -8,9 +8,7 @@ + #ifndef _LINUX_MTIO_H + #define _LINUX_MTIO_H + +-#include +-#include +-#include ++#include + + /* + * Structures and definitions for mag tape io control commands +@@ -150,6 +148,7 @@ + }; + + ++#ifdef USE_QIC02 + /* structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended + * as an interim solution for QIC-02 until DDI is fully implemented. + */ +@@ -281,6 +280,7 @@ + * command + */ + }; ++#endif + + /* mag tape io control commands */ + #define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ +diff -ru ..\release\mt-st-0.9b/stinit.def.examples ./stinit.def.examples +--- ..\release\mt-st-0.9b/stinit.def.examples 2005-08-16 12:16:28.000000000 -0700 ++++ ./stinit.def.examples 2006-08-09 03:26:58.362958700 -0700 +@@ -56,3 +56,169 @@ + mode3 blocksize=0 density=1 # 800 bpi + } + ++# DLT2000 / 2000XT ++manufacturer="QUANTUM" model = "DLT2000" { ++scsi2logical=1 ++can-bsr ++auto-lock=0 ++two-fms=0 ++drive-buffering=1 ++buffer-writes ++read-ahead=1 ++async-writes=1 ++can-partitions=0 ++fast-mteom=1 ++# ++# If your stinit supports the timeouts: ++timeout=3600 # 1 hour ++long-timeout=14400 # 4 hours ++# ++mode1 blocksize=0 density=0x81 # 10GB + compression on DLTtape III, 15+ with DLTtape IIIXT in 2000XT ++mode2 blocksize=0 density=0x80 # 10GB, no compression on DLTtape III, 15 with DLTtape IIIXT in 2000XT ++mode3 blocksize=0 density=0x18 # 6GB, compression not available, on DLTtape III ++mode4 blocksize=0 density=0x17 #2.6GB, compression not available, on DLTtape III ++} ++ ++# DLT4000 ++manufacturer="QUANTUM" model = "DLT4000" { ++scsi2logical=1 ++can-bsr ++auto-lock=0 ++two-fms=0 ++drive-buffering=1 ++buffer-writes ++read-ahead=1 ++async-writes=1 ++can-partitions=0 ++fast-mteom=1 ++# ++# If your stinit supports the timeouts: ++timeout=3600 # 1 hour ++long-timeout=14400 # 4 hours ++# ++# Drive is backwards compatible, use older modes (e.g. from above) as required ++mode1 blocksize=0 density=0x83 # 20GB + compression ++mode2 blocksize=0 density=0x82 # 20GB, no compression ++mode3 blocksize=0 density=0x81 # 10GB + compression (DLT2000 mode) with DLTtape III, 15+ with DLTtape IIIXT in 2000XT ++mode4 blocksize=0 density=0x80 # 10GB, no compression (DLT2000 mode) with DLTtape III, 15 with DLTtape IIIXT in 2000XT ++} ++ ++# DLT7000 ++manufacturer="QUANTUM" model = "DLT7000" { ++scsi2logical=1 ++can-bsr ++auto-lock=0 ++two-fms=0 ++drive-buffering=1 ++buffer-writes ++read-ahead=1 ++async-writes=1 ++can-partitions=0 ++fast-mteom=1 ++# ++# If your stinit supports the timeouts: ++timeout=3600 # 1 hour ++long-timeout=14400 # 4 hours ++# ++# Drive is backwards compatible, use older modes (e.g. from above) as required. ++mode1 blocksize=0 density=0x85 # 35GB + compression ++mode2 blocksize=0 density=0x84 # 35GB, no compression ++mode3 blocksize=0 density=0x83 # 20GB + compression (DLT4000 mode) ++mode4 blocksize=0 density=0x82 # 20GB, no compression (DLT4000 mode) ++} ++ ++# DLT8000 ++manufacturer="QUANTUM" model = "DLT8000" { ++scsi2logical=1 ++can-bsr=1 ++auto-lock=0 ++two-fms=0 ++drive-buffering=1 ++buffer-writes ++read-ahead=1 ++async-writes=1 ++can-partitions=0 ++fast-mteom=1 ++# ++# If your stinit supports the timeouts: ++timeout=3600 # 1 hour ++long-timeout=14400 # 4 hours ++# ++# Drive is backwards compatible to DLT7000, use older modes (e.g. from above) as required. Modes <10GB (<0x19) not supported! ++mode1 blocksize=0 density=0x89 # 40GB + compression ++mode2 blocksize=0 density=0x88 # 40GB, no compression ++mode3 blocksize=0 density=0x85 # 35GB + compression (DLT7000 mode) ++mode4 blocksize=0 density=0x84 # 35GB, no compression (DLT7000 mode) ++} ++ ++ ++# SDLT220 ++manufacturer="QUANTUM" model = "SuperDLT1" { ++scsi2logical=1 ++can-bsr=1 ++auto-lock=0 ++two-fms=0 ++drive-buffering=1 ++buffer-writes ++read-ahead=1 ++async-writes=1 ++can-partitions=0 ++fast-mteom=1 ++# ++# If your stinit supports the timeouts: ++timeout=3600 # 1 hour ++long-timeout=14400 # 4 hours ++# ++# Drive is backwards read compatible to DLT4000/7000/8000. Mode settings are only required for writing, so no need to define any other modes here. ++mode1 blocksize=0 density=0x48 compression=1 # 110 GB + compression ++mode2 blocksize=0 density=0x48 compression=0 # 110 GB, no ompression ++} ++ ++# SDLT320 ++manufacturer="QUANTUM" model = "SDLT320" { ++scsi2logical=1 ++can-bsr=1 ++auto-lock=0 ++two-fms=0 ++drive-buffering=1 ++buffer-writes ++read-ahead=1 ++async-writes=1 ++can-partitions=0 ++fast-mteom=1 ++# ++# If your stinit supports the timeouts: ++timeout=3600 # 1 hour ++long-timeout=14400 # 4 hours ++# ++# Drive is backwards write compatible to SDLT220 and read compatible to DLT4000/7000/8000. Mode settings are only required for writing, so we need only the SDL220/320 modes here ++mode1 blocksize=0 density=0x49 compression=1 # 160 GB + compression ++mode2 blocksize=0 density=0x49 compression=0 # 160 GB, no ompression ++mode3 blocksize=0 density=0x48 compression=1 # 110 GB + compression ++mode4 blocksize=0 density=0x48 compression=0 # 110 GB, no ompression ++} ++ ++# SDLT600 ++manufacturer="QUANTUM" model = "SDLT600" { ++scsi2logical=1 ++can-bsr=1 ++auto-lock=0 ++two-fms=0 ++drive-buffering=1 ++buffer-writes ++read-ahead=1 ++async-writes=1 ++can-partitions=0 ++fast-mteom=1 ++# ++# If your stinit supports the timeouts: ++timeout=3600 # 1 hour ++long-timeout=14400 # 4 hours ++# ++# Drive is backwards read compatible to SDLT220/320 and VS160. Mode settings are only required for writing, so we need only the native SDLT600 mode here. ++mode1 blocksize=0 density=0x4a compression=1 # 300 GB + compression ++mode2 blocksize=0 density=0x4a compression=0 # 300 GB, no ompression ++mode3 blocksize=0 density=0x4a compression=1 # 300 GB + compression ++mode4 blocksize=0 density=0x4a compression=0 # 300 GB, no ompression ++} ++ + +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ mtops.c 2006-08-09 04:03:09.307917500 -0700 +@@ -0,0 +1,1163 @@ ++/* ++ * mtops.cpp - Emulate the Linux st (scsi tape) driver on Microsoft Windows. ++ * ++ * Author: Robert Nelson, May, 2006 ++ * ++ * Version $Id: mt.patch 3802 2006-12-14 11:41:02Z kerns $ ++ * ++ * Copyright (C) 2006 Free Software Foundation Europe e.V. ++ * ++ * This file was contributed to the Bacula project by Robert Nelson. ++ * ++ * Robert Nelson has been granted a perpetual, worldwide, ++ * non-exclusive, no-charge, royalty-free, irrevocable copyright ++ * license to reproduce, prepare derivative works of, publicly ++ * display, publicly perform, sublicense, and distribute the original ++ * work contributed by Robert Nelson to the Bacula project in source ++ * or object form. ++ * ++ * If you wish to license contributions from Robert Nelson ++ * under an alternate open source license please contact ++ * Robert Nelson . ++ */ ++/* ++ Copyright (C) 2006 Free Software Foundation Europe e.V. ++ ++ This program is free software; you can redistribute it and/or ++ modify it under the terms of the GNU General Public License ++ version 2 as amended with additional clauses defined in the ++ file LICENSE in the main source directory. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ the file LICENSE for additional details. ++ ++ */ ++ ++#include ++#include ++ ++#include ++#include ++ ++#include "mtops.h" ++#include "mtio.h" ++#if defined(_MSC_VER) ++#include ++#include ++#else ++#include ++#include ++#endif ++ ++#ifndef __cplusplus ++typedef char bool; ++#define true 1 ++#define false 0 ++#endif ++ ++// ++// SCSI bus status codes. ++// ++ ++#define SCSISTAT_GOOD 0x00 ++#define SCSISTAT_CHECK_CONDITION 0x02 ++#define SCSISTAT_CONDITION_MET 0x04 ++#define SCSISTAT_BUSY 0x08 ++#define SCSISTAT_INTERMEDIATE 0x10 ++#define SCSISTAT_INTERMEDIATE_COND_MET 0x14 ++#define SCSISTAT_RESERVATION_CONFLICT 0x18 ++#define SCSISTAT_COMMAND_TERMINATED 0x22 ++#define SCSISTAT_QUEUE_FULL 0x28 ++ ++/* Forward referenced functions */ ++ ++extern char my_name[]; ++extern int debug_level; ++ ++inline SHORT Read16BitSigned(const unsigned char *pValue) ++{ ++ return (SHORT)(((USHORT)pValue[0] << 8) | (USHORT)pValue[1]); ++} ++ ++inline USHORT Read16BitUnsigned(const unsigned char *pValue) ++{ ++ return (((USHORT)pValue[0] << 8) | (USHORT)pValue[1]); ++} ++ ++inline LONG Read24BitSigned(const unsigned char *pValue) ++{ ++ return ((LONG)(((ULONG)pValue[0] << 16) | ((ULONG)pValue[1] << 8) | ++ (ULONG)pValue[2])) << 8 >> 8; ++} ++ ++inline ULONG Read24BitUnsigned(const unsigned char *pValue) ++{ ++ return ((ULONG)pValue[0] << 16) | ((ULONG)pValue[1] << 8) | (ULONG)pValue[2]; ++} ++ ++inline LONG Read32BitSigned(const unsigned char *pValue) ++{ ++ return (LONG)(((ULONG)pValue[0] << 24) | ((ULONG)pValue[1] << 16) | ++ ((ULONG)pValue[2] << 8) | (ULONG)pValue[3]); ++} ++ ++inline ULONG Read32BitUnsigned(const unsigned char *pValue) ++{ ++ return (((ULONG)pValue[0] << 24) | ((ULONG)pValue[1] << 16) | ++ ((ULONG)pValue[2] << 8) | (ULONG)pValue[3]); ++} ++ ++inline LONGLONG Read64BitSigned(const unsigned char *pValue) ++{ ++ return (LONGLONG)(((ULONGLONG)pValue[0] << 56) | ((ULONGLONG)pValue[1] << 48) | ++ ((ULONGLONG)pValue[2] << 40) | ((ULONGLONG)pValue[3] << 32) | ++ ((ULONGLONG)pValue[4] << 24) | ((ULONGLONG)pValue[5] << 16) | ++ ((ULONGLONG)pValue[6] << 8) | (ULONGLONG)pValue[7]); ++} ++ ++inline ULONGLONG Read64BitUnsigned(const unsigned char *pValue) ++{ ++ return (LONGLONG)(((ULONGLONG)pValue[0] << 56) | ((ULONGLONG)pValue[1] << 48) | ++ ((ULONGLONG)pValue[2] << 40) | ((ULONGLONG)pValue[3] << 32) | ++ ((ULONGLONG)pValue[4] << 24) | ((ULONGLONG)pValue[5] << 16) | ++ ((ULONGLONG)pValue[6] << 8) | (ULONGLONG)pValue[7]); ++} ++ ++typedef struct _TAPE_POSITION_INFO ++{ ++ UCHAR AtPartitionStart:1; ++ UCHAR AtPartitionEnd:1; ++ UCHAR PartitionBlockValid:1; ++ UCHAR FileSetValid:1; ++ UCHAR :4; ++ UCHAR Reserved1[3]; ++ ULONG Partition; ++ ULONGLONG BlockNumber; ++ ULONGLONG FileNumber; ++ ULONGLONG SetNumber; ++} TAPE_POSITION_INFO, *PTAPE_POSITION_INFO; ++ ++typedef struct _TAPE_HANDLE_INFO ++{ ++ HANDLE OSHandle; ++ bool bEOD; ++ bool bEOF; ++ bool bEOT; ++ bool bBlockValid; ++ ULONG FeaturesLow; ++ ULONG FeaturesHigh; ++ ULONG ulFile; ++ ULONGLONG ullFileStart; ++ ++} TAPE_HANDLE_INFO, *PTAPE_HANDLE_INFO; ++ ++TAPE_HANDLE_INFO TapeHandleTable[] = ++{ ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE }, ++ { INVALID_HANDLE_VALUE } ++}; ++ ++#define NUMBER_HANDLE_ENTRIES (sizeof(TapeHandleTable) / sizeof(TapeHandleTable[0])) ++ ++DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo); ++DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize); ++ ++int tape_get(int fd, struct mtget *mt_get); ++int tape_op(int fd, struct mtop *mt_com); ++int tape_pos(int fd, struct mtpos *mt_pos); ++ ++int ++tape_open(const char *file, int flags, int mode) ++{ ++ HANDLE hDevice = INVALID_HANDLE_VALUE; ++ char szDeviceName[256] = "\\\\.\\"; ++ int idxFile; ++ DWORD dwResult; ++ ++ for (idxFile = 0; idxFile < (int)NUMBER_HANDLE_ENTRIES; idxFile++) { ++ if (TapeHandleTable[idxFile].OSHandle == INVALID_HANDLE_VALUE) { ++ break; ++ } ++ } ++ ++ if (idxFile >= (int)NUMBER_HANDLE_ENTRIES) { ++ return EMFILE; ++ } ++ ++ memset(&TapeHandleTable[idxFile], 0, sizeof(TapeHandleTable[idxFile])); ++ ++ if (file[0] != '\\' && file[0] != '/') { ++ strncpy(&szDeviceName[4], file, sizeof(szDeviceName) - 4); ++ } else { ++ strncpy(&szDeviceName[0], file, sizeof(szDeviceName)); ++ } ++ ++ szDeviceName[sizeof(szDeviceName) - 1] = '\0'; ++ ++ hDevice = CreateFile(szDeviceName, FILE_ALL_ACCESS, 0, NULL, OPEN_EXISTING, 0, NULL); ++ ++ if (hDevice != INVALID_HANDLE_VALUE) { ++ PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[idxFile]; ++ ++ memset(pHandleInfo, 0, sizeof(*pHandleInfo)); ++ ++ pHandleInfo->OSHandle = hDevice; ++ ++ TAPE_GET_DRIVE_PARAMETERS TapeDriveParameters; ++ DWORD dwSize = sizeof(TapeDriveParameters); ++ ++ dwResult = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &dwSize, &TapeDriveParameters); ++ if (dwResult == NO_ERROR) { ++ pHandleInfo->FeaturesLow = TapeDriveParameters.FeaturesLow; ++ pHandleInfo->FeaturesHigh = TapeDriveParameters.FeaturesHigh; ++ } ++ ++ TAPE_POSITION_INFO TapePositionInfo; ++ ++ dwResult = GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo); ++ ++ if (dwResult == NO_ERROR) { ++ if (TapePositionInfo.AtPartitionStart || TapePositionInfo.AtPartitionEnd || ++ (TapePositionInfo.PartitionBlockValid && TapePositionInfo.BlockNumber == 0)) { ++ pHandleInfo->ulFile = 0; ++ pHandleInfo->bBlockValid = true; ++ pHandleInfo->ullFileStart = 0; ++ } else if (TapePositionInfo.FileSetValid) { ++ pHandleInfo->ulFile = (ULONG)TapePositionInfo.FileNumber; ++ } ++ } ++ } else { ++ DWORD dwError = GetLastError(); ++ ++ switch (dwError) { ++ case ERROR_FILE_NOT_FOUND: ++ case ERROR_PATH_NOT_FOUND: ++ errno = ENOENT; ++ break; ++ ++ case ERROR_TOO_MANY_OPEN_FILES: ++ errno = EMFILE; ++ break; ++ ++ default: ++ case ERROR_ACCESS_DENIED: ++ case ERROR_SHARING_VIOLATION: ++ case ERROR_LOCK_VIOLATION: ++ case ERROR_INVALID_NAME: ++ errno = EACCES; ++ break; ++ ++ case ERROR_FILE_EXISTS: ++ errno = EEXIST; ++ break; ++ ++ case ERROR_INVALID_PARAMETER: ++ errno = EINVAL; ++ break; ++ } ++ ++ return(int) -1; ++ } ++ ++ return (int)idxFile + 3; ++} ++ ++int ++tape_read(int fd, void *buffer, unsigned int count) ++{ ++ if (buffer == NULL) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || ++ TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) ++ { ++ errno = EBADF; ++ return -1; ++ } ++ ++ PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; ++ ++ DWORD bytes_read; ++ BOOL bResult; ++ ++ bResult = ReadFile(pHandleInfo->OSHandle, buffer, count, &bytes_read, NULL); ++ ++ if (bResult) { ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->bEOD = false; ++ return bytes_read; ++ } else { ++ int iReturnValue = 0; ++ DWORD last_error = GetLastError(); ++ ++ switch (last_error) { ++ ++ case ERROR_FILEMARK_DETECTED: ++ pHandleInfo->bEOF = true; ++ break; ++ ++ case ERROR_END_OF_MEDIA: ++ pHandleInfo->bEOT = true; ++ break; ++ ++ case ERROR_NO_MEDIA_IN_DRIVE: ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->bEOD = false; ++ errno = ENOMEDIUM; ++ iReturnValue = -1; ++ break; ++ ++ case ERROR_NO_DATA_DETECTED: ++ pHandleInfo->bEOD = true; ++ break; ++ ++ case ERROR_INVALID_HANDLE: ++ case ERROR_ACCESS_DENIED: ++ case ERROR_LOCK_VIOLATION: ++ errno = EBADF; ++ iReturnValue = -1; ++ break; ++ ++ default: ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->bEOD = false; ++ errno = EIO; ++ iReturnValue = -1; ++ } ++ ++ return iReturnValue; ++ } ++} ++ ++int ++tape_write(int fd, const void *buffer, unsigned int count) ++{ ++ if (buffer == NULL) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) ++ { ++ errno = EBADF; ++ return -1; ++ } ++ ++ PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; ++ ++ DWORD bytes_written; ++ BOOL bResult; ++ ++ bResult = WriteFile(pHandleInfo->OSHandle, buffer, count, &bytes_written, NULL); ++ ++ if (bResult) { ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ return bytes_written; ++ } else { ++ DWORD last_error = GetLastError(); ++ ++ switch (last_error) { ++ case ERROR_END_OF_MEDIA: ++ case ERROR_DISK_FULL: ++ pHandleInfo->bEOT = true; ++ errno = ENOSPC; ++ break; ++ ++ case ERROR_NO_MEDIA_IN_DRIVE: ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->bEOD = false; ++ errno = ENOMEDIUM; ++ break; ++ ++ case ERROR_INVALID_HANDLE: ++ case ERROR_ACCESS_DENIED: ++ errno = EBADF; ++ break; ++ ++ default: ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->bEOD = false; ++ errno = EIO; ++ break; ++ } ++ return -1; ++ } ++} ++ ++int ++tape_close(int fd) ++{ ++ if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || ++ TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { ++ errno = EBADF; ++ return -1; ++ } ++ ++ PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; ++ ++ if (!CloseHandle(pHandleInfo->OSHandle)) { ++ pHandleInfo->OSHandle = INVALID_HANDLE_VALUE; ++ errno = EBADF; ++ return -1; ++ } ++ ++ pHandleInfo->OSHandle = INVALID_HANDLE_VALUE; ++ ++ return 0; ++} ++ ++int ++tape_ioctl(int fd, unsigned long int request, ...) ++{ ++ va_list argp; ++ int result; ++ ++ va_start(argp, request); ++ ++ switch (request) { ++ case MTIOCTOP: ++ result = tape_op(fd, va_arg(argp, struct mtop *)); ++ break; ++ ++ case MTIOCGET: ++ result = tape_get(fd, va_arg(argp, struct mtget *)); ++ break; ++ ++ case MTIOCPOS: ++ result = tape_pos(fd, va_arg(argp, struct mtpos *)); ++ break; ++ ++ default: ++ errno = ENOTTY; ++ result = -1; ++ break; ++ } ++ ++ va_end(argp); ++ ++ return result; ++} ++ ++int tape_op(int fd, struct mtop *mt_com) ++{ ++ DWORD result = NO_ERROR; ++ int index; ++ ++ if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || ++ TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) ++ { ++ errno = EBADF; ++ return -1; ++ } ++ ++ PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; ++ ++ switch (mt_com->mt_op) ++ { ++ case MTRESET: ++ case MTNOP: ++ case MTSETDRVBUFFER: ++ break; ++ ++ default: ++ case MTRAS1: ++ case MTRAS2: ++ case MTRAS3: ++ case MTSETDENSITY: ++ errno = ENOTTY; ++ result = (DWORD)-1; ++ break; ++ ++ case MTFSF: ++ for (index = 0; index < mt_com->mt_count; index++) { ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->ulFile++; ++ pHandleInfo->bEOF = true; ++ pHandleInfo->bEOT = false; ++ } ++ } ++ break; ++ ++ case MTBSF: ++ for (index = 0; index < mt_com->mt_count; index++) { ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->ulFile--; ++ pHandleInfo->bBlockValid = false; ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ } ++ } ++ break; ++ ++ case MTFSR: ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_RELATIVE_BLOCKS, 0, mt_com->mt_count, 0, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ } else if (result == ERROR_FILEMARK_DETECTED) { ++ pHandleInfo->bEOF = true; ++ } ++ break; ++ ++ case MTBSR: ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_RELATIVE_BLOCKS, 0, -mt_com->mt_count, ~0, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ } else if (result == ERROR_FILEMARK_DETECTED) { ++ pHandleInfo->ulFile--; ++ pHandleInfo->bBlockValid = false; ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ } ++ break; ++ ++ case MTWEOF: ++ result = WriteTapemark(pHandleInfo->OSHandle, TAPE_FILEMARKS, mt_com->mt_count, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->bEOF = true; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->ulFile += mt_com->mt_count; ++ pHandleInfo->bBlockValid = true; ++ pHandleInfo->ullFileStart = 0; ++ } ++ break; ++ ++ case MTREW: ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_REWIND, 0, 0, 0, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->ulFile = 0; ++ pHandleInfo->bBlockValid = true; ++ pHandleInfo->ullFileStart = 0; ++ } ++ break; ++ ++ case MTOFFL: ++ result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOAD, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->ulFile = 0; ++ pHandleInfo->ullFileStart = 0; ++ } ++ break; ++ ++ case MTRETEN: ++ result = PrepareTape(pHandleInfo->OSHandle, TAPE_TENSION, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->ulFile = 0; ++ pHandleInfo->bBlockValid = true; ++ pHandleInfo->ullFileStart = 0; ++ } ++ break; ++ ++ case MTBSFM: ++ for (index = 0; index < mt_com->mt_count; index++) { ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); ++ if (result == NO_ERROR) { ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ } ++ } ++ break; ++ ++ case MTFSFM: ++ for (index = 0; index < mt_com->mt_count; index++) { ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, mt_com->mt_count, 0, FALSE); ++ if (result == NO_ERROR) { ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); ++ pHandleInfo->bEOD = false; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ } ++ } ++ break; ++ ++ case MTEOM: ++ for ( ; ; ) { ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); ++ if (result != NO_ERROR) { ++ pHandleInfo->bEOF = false; ++ ++ if (result == ERROR_END_OF_MEDIA) { ++ pHandleInfo->bEOD = true; ++ pHandleInfo->bEOT = true; ++ return 0; ++ } ++ if (result == ERROR_NO_DATA_DETECTED) { ++ pHandleInfo->bEOD = true; ++ pHandleInfo->bEOT = false; ++ return 0; ++ } ++ break; ++ } else { ++ pHandleInfo->bEOF = true; ++ pHandleInfo->ulFile++; ++ } ++ } ++ break; ++ ++ case MTERASE: ++ result = EraseTape(pHandleInfo->OSHandle, TAPE_ERASE_LONG, FALSE); ++ if (result == NO_ERROR) { ++ pHandleInfo->bEOD = true; ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->ulFile = 0; ++ pHandleInfo->bBlockValid = true; ++ pHandleInfo->ullFileStart = 0; ++ } ++ break; ++ ++ case MTSETBLK: ++ { ++ TAPE_SET_MEDIA_PARAMETERS SetMediaParameters; ++ ++ SetMediaParameters.BlockSize = mt_com->mt_count; ++ result = SetTapeParameters(pHandleInfo->OSHandle, SET_TAPE_MEDIA_INFORMATION, &SetMediaParameters); ++ } ++ break; ++ ++ case MTSEEK: ++ { ++ TAPE_POSITION_INFO TapePositionInfo; ++ ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, 0, mt_com->mt_count, 0, FALSE); ++ ++ memset(&TapePositionInfo, 0, sizeof(TapePositionInfo)); ++ DWORD dwPosResult = GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo); ++ if (dwPosResult == NO_ERROR && TapePositionInfo.FileSetValid) { ++ pHandleInfo->ulFile = (ULONG)TapePositionInfo.FileNumber; ++ } else { ++ pHandleInfo->ulFile = ~0U; ++ } ++ } ++ break; ++ ++ case MTTELL: ++ { ++ DWORD partition; ++ DWORD offset; ++ DWORD offsetHi; ++ ++ result = GetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, &partition, &offset, &offsetHi); ++ if (result == NO_ERROR) { ++ return offset; ++ } ++ } ++ break; ++ ++ case MTFSS: ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_SETMARKS, 0, mt_com->mt_count, 0, FALSE); ++ break; ++ ++ case MTBSS: ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_SETMARKS, 0, -mt_com->mt_count, ~0, FALSE); ++ break; ++ ++ case MTWSM: ++ result = WriteTapemark(pHandleInfo->OSHandle, TAPE_SETMARKS, mt_com->mt_count, FALSE); ++ break; ++ ++ case MTLOCK: ++ result = PrepareTape(pHandleInfo->OSHandle, TAPE_LOCK, FALSE); ++ break; ++ ++ case MTUNLOCK: ++ result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOCK, FALSE); ++ break; ++ ++ case MTLOAD: ++ result = PrepareTape(pHandleInfo->OSHandle, TAPE_LOAD, FALSE); ++ break; ++ ++ case MTUNLOAD: ++ result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOAD, FALSE); ++ break; ++ ++ case MTCOMPRESSION: ++ { ++ TAPE_GET_DRIVE_PARAMETERS GetDriveParameters; ++ TAPE_SET_DRIVE_PARAMETERS SetDriveParameters; ++ DWORD size; ++ ++ size = sizeof(GetDriveParameters); ++ ++ result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &size, &GetDriveParameters); ++ ++ if (result == NO_ERROR) ++ { ++ SetDriveParameters.ECC = GetDriveParameters.ECC; ++ SetDriveParameters.Compression = (BOOLEAN)mt_com->mt_count; ++ SetDriveParameters.DataPadding = GetDriveParameters.DataPadding; ++ SetDriveParameters.ReportSetmarks = GetDriveParameters.ReportSetmarks; ++ SetDriveParameters.EOTWarningZoneSize = GetDriveParameters.EOTWarningZoneSize; ++ ++ result = SetTapeParameters(pHandleInfo->OSHandle, SET_TAPE_DRIVE_INFORMATION, &SetDriveParameters); ++ } ++ } ++ break; ++ ++ case MTSETPART: ++ result = SetTapePosition(pHandleInfo->OSHandle, TAPE_LOGICAL_BLOCK, mt_com->mt_count, 0, 0, FALSE); ++ break; ++ ++ case MTMKPART: ++ if (mt_com->mt_count == 0) ++ { ++ result = CreateTapePartition(pHandleInfo->OSHandle, TAPE_INITIATOR_PARTITIONS, 1, 0); ++ } ++ else ++ { ++ result = CreateTapePartition(pHandleInfo->OSHandle, TAPE_INITIATOR_PARTITIONS, 2, mt_com->mt_count); ++ } ++ break; ++ } ++ ++ if ((result == NO_ERROR && pHandleInfo->bEOF) || ++ (result == ERROR_FILEMARK_DETECTED && mt_com->mt_op == MTFSR)) { ++ ++ TAPE_POSITION_INFO TapePositionInfo; ++ ++ if (GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo) == NO_ERROR) { ++ pHandleInfo->bBlockValid = true; ++ pHandleInfo->ullFileStart = TapePositionInfo.BlockNumber; ++ } ++ } ++ ++ switch (result) { ++ case NO_ERROR: ++ case (DWORD)-1: /* Error has already been translated into errno */ ++ break; ++ ++ default: ++ case ERROR_FILEMARK_DETECTED: ++ errno = EIO; ++ break; ++ ++ case ERROR_END_OF_MEDIA: ++ pHandleInfo->bEOT = true; ++ errno = EIO; ++ break; ++ ++ case ERROR_NO_DATA_DETECTED: ++ pHandleInfo->bEOD = true; ++ errno = EIO; ++ break; ++ ++ case ERROR_NO_MEDIA_IN_DRIVE: ++ pHandleInfo->bEOF = false; ++ pHandleInfo->bEOT = false; ++ pHandleInfo->bEOD = false; ++ errno = ENOMEDIUM; ++ break; ++ ++ case ERROR_INVALID_HANDLE: ++ case ERROR_ACCESS_DENIED: ++ case ERROR_LOCK_VIOLATION: ++ errno = EBADF; ++ break; ++ } ++ ++ return result == NO_ERROR ? 0 : -1; ++} ++ ++int tape_get(int fd, struct mtget *mt_get) ++{ ++ TAPE_POSITION_INFO pos_info; ++ BOOL result; ++ ++ if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || ++ TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { ++ errno = EBADF; ++ return -1; ++ } ++ ++ PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; ++ ++ if (GetTapePositionInfo(pHandleInfo->OSHandle, &pos_info) != NO_ERROR) { ++ return -1; ++ } ++ ++ DWORD density = 0; ++ DWORD blocksize = 0; ++ ++ result = GetDensityBlockSize(pHandleInfo->OSHandle, &density, &blocksize); ++ ++ if (result != NO_ERROR) { ++ TAPE_GET_DRIVE_PARAMETERS drive_params; ++ DWORD size; ++ ++ size = sizeof(drive_params); ++ ++ result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &size, &drive_params); ++ ++ if (result == NO_ERROR) { ++ blocksize = drive_params.DefaultBlockSize; ++ } ++ } ++ ++ mt_get->mt_type = MT_ISSCSI2; ++ ++ // Partition # ++ mt_get->mt_resid = pos_info.PartitionBlockValid ? pos_info.Partition : (ULONG)-1; ++ ++ // Density / Block Size ++ mt_get->mt_dsreg = ((density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK) | ++ ((blocksize << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK); ++ ++ mt_get->mt_gstat = 0x00010000; /* Immediate report mode.*/ ++ ++ if (pHandleInfo->bEOF) { ++ mt_get->mt_gstat |= 0x80000000; // GMT_EOF ++ } ++ ++ if (pos_info.PartitionBlockValid && pos_info.BlockNumber == 0) { ++ mt_get->mt_gstat |= 0x40000000; // GMT_BOT ++ } ++ ++ if (pHandleInfo->bEOT) { ++ mt_get->mt_gstat |= 0x20000000; // GMT_EOT ++ } ++ ++ if (pHandleInfo->bEOD) { ++ mt_get->mt_gstat |= 0x08000000; // GMT_EOD ++ } ++ ++ TAPE_GET_MEDIA_PARAMETERS media_params; ++ DWORD size = sizeof(media_params); ++ ++ result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_MEDIA_INFORMATION, &size, &media_params); ++ ++ if (result == NO_ERROR && media_params.WriteProtected) { ++ mt_get->mt_gstat |= 0x04000000; // GMT_WR_PROT ++ } ++ ++ result = GetTapeStatus(pHandleInfo->OSHandle); ++ ++ if (result != NO_ERROR) { ++ if (result == ERROR_NO_MEDIA_IN_DRIVE) { ++ mt_get->mt_gstat |= 0x00040000; // GMT_DR_OPEN ++ } ++ } else { ++ mt_get->mt_gstat |= 0x01000000; // GMT_ONLINE ++ } ++ ++ // Recovered Error Count ++ mt_get->mt_erreg = 0; ++ ++ // File Number ++ mt_get->mt_fileno = (__kernel_daddr_t)pHandleInfo->ulFile; ++ ++ // Block Number ++ mt_get->mt_blkno = (__kernel_daddr_t)(pHandleInfo->bBlockValid ? pos_info.BlockNumber - pHandleInfo->ullFileStart : (ULONGLONG)-1); ++ ++ return 0; ++} ++ ++#define SERVICEACTION_SHORT_FORM_BLOCKID 0 ++#define SERVICEACTION_SHORT_FORM_VENDOR_SPECIFIC 1 ++#define SERVICEACTION_LONG_FORM 6 ++#define SERVICEACTION_EXTENDED_FORM 8 ++ ++ ++typedef struct _SCSI_READ_POSITION_SHORT_BUFFER ++{ ++ UCHAR :1; ++ UCHAR PERR:1; ++ UCHAR BPU:1; ++ UCHAR :1; ++ UCHAR BYCU:1; ++ UCHAR BCU:1; ++ UCHAR EOP:1; ++ UCHAR BOP:1; ++ UCHAR Partition; ++ UCHAR Reserved1[2]; ++ UCHAR FirstBlock[4]; ++ UCHAR LastBlock[4]; ++ UCHAR Reserved2; ++ UCHAR NumberBufferBlocks[3]; ++ UCHAR NumberBufferBytes[4]; ++} SCSI_READ_POSITION_SHORT_BUFFER, *PSCSI_READ_POSITION_SHORT_BUFFER; ++ ++typedef struct _SCSI_READ_POSITION_LONG_BUFFER ++{ ++ UCHAR :2; ++ UCHAR BPU:1; ++ UCHAR MPU:1; ++ UCHAR :2; ++ UCHAR EOP:1; ++ UCHAR BOP:1; ++ UCHAR Reserved3[3]; ++ UCHAR Partition[4]; ++ UCHAR BlockNumber[8]; ++ UCHAR FileNumber[8]; ++ UCHAR SetNumber[8]; ++} SCSI_READ_POSITION_LONG_BUFFER, *PSCSI_READ_POSITION_LONG_BUFFER; ++ ++typedef struct _SCSI_READ_POSITION_EXTENDED_BUFFER ++{ ++ UCHAR :1; ++ UCHAR PERR:1; ++ UCHAR LOPU:1; ++ UCHAR :1; ++ UCHAR BYCU:1; ++ UCHAR LOCU:1; ++ UCHAR EOP:1; ++ UCHAR BOP:1; ++ UCHAR Partition; ++ UCHAR AdditionalLength[2]; ++ UCHAR Reserved1; ++ UCHAR NumberBufferObjects[3]; ++ UCHAR FirstLogicalObject[8]; ++ UCHAR LastLogicalObject[8]; ++ UCHAR NumberBufferObjectBytes[8]; ++} SCSI_READ_POSITION_EXTENDED_BUFFER, *PSCSI_READ_POSITION_EXTENDED_BUFFER; ++ ++typedef union _READ_POSITION_RESULT { ++ SCSI_READ_POSITION_SHORT_BUFFER ShortBuffer; ++ SCSI_READ_POSITION_LONG_BUFFER LongBuffer; ++ SCSI_READ_POSITION_EXTENDED_BUFFER ExtendedBuffer; ++} READ_POSITION_RESULT, *PREAD_POSITION_RESULT; ++ ++DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo) ++{ ++ PSCSI_PASS_THROUGH ScsiPassThrough; ++ BOOL bResult; ++ DWORD dwBytesReturned; ++ int pass; ++ ++ const DWORD dwBufferSize = sizeof(SCSI_PASS_THROUGH) + sizeof(READ_POSITION_RESULT) + 28; ++ ++ memset(TapePositionInfo, 0, sizeof(*TapePositionInfo)); ++ ++ ScsiPassThrough = (PSCSI_PASS_THROUGH)malloc(dwBufferSize); ++ ++ for (pass = 0; pass < 2; pass++) ++ { ++ memset(ScsiPassThrough, 0, dwBufferSize); ++ ++ ScsiPassThrough->Length = sizeof(SCSI_PASS_THROUGH); ++ ++ ScsiPassThrough->CdbLength = 10; ++ ScsiPassThrough->SenseInfoLength = 28; ++ ScsiPassThrough->DataIn = 1; ++ ScsiPassThrough->DataTransferLength = sizeof(SCSI_READ_POSITION_LONG_BUFFER); ++ ScsiPassThrough->TimeOutValue = 1000; ++ ScsiPassThrough->DataBufferOffset = sizeof(SCSI_PASS_THROUGH) + 28; ++ ScsiPassThrough->SenseInfoOffset = sizeof(SCSI_PASS_THROUGH); ++ ++ ScsiPassThrough->Cdb[0] = 0x34; // READ POSITION ++ ++ switch (pass) ++ { ++ case 0: ++ ScsiPassThrough->Cdb[1] = SERVICEACTION_LONG_FORM; ++ break; ++ ++ case 1: ++ ScsiPassThrough->Cdb[1] = SERVICEACTION_SHORT_FORM_BLOCKID; ++ break; ++ } ++ ++ bResult = DeviceIoControl( hDevice, ++ IOCTL_SCSI_PASS_THROUGH, ++ ScsiPassThrough, sizeof(SCSI_PASS_THROUGH), ++ ScsiPassThrough, dwBufferSize, ++ &dwBytesReturned, ++ NULL); ++ ++ if (bResult && dwBytesReturned >= (offsetof(SCSI_PASS_THROUGH, ScsiStatus) + sizeof(ScsiPassThrough->ScsiStatus))) { ++ if (ScsiPassThrough->ScsiStatus == SCSISTAT_GOOD) { ++ PREAD_POSITION_RESULT pPosResult = (PREAD_POSITION_RESULT)((PUCHAR)ScsiPassThrough + ScsiPassThrough->DataBufferOffset); ++ ++ switch (pass) ++ { ++ case 0: // SERVICEACTION_LONG_FORM ++ { ++ TapePositionInfo->AtPartitionStart = pPosResult->LongBuffer.BOP; ++ TapePositionInfo->AtPartitionEnd = pPosResult->LongBuffer.EOP; ++ ++ if (!TapePositionInfo->PartitionBlockValid) { ++ TapePositionInfo->PartitionBlockValid = !pPosResult->LongBuffer.BPU; ++ ++ if (TapePositionInfo->PartitionBlockValid) { ++ TapePositionInfo->Partition = Read32BitUnsigned(pPosResult->LongBuffer.Partition); ++ TapePositionInfo->BlockNumber = Read64BitUnsigned(pPosResult->LongBuffer.BlockNumber); ++ } ++ } ++ ++ TapePositionInfo->FileSetValid = !pPosResult->LongBuffer.MPU; ++ if (TapePositionInfo->FileSetValid) { ++ TapePositionInfo->FileNumber = Read64BitUnsigned(pPosResult->LongBuffer.FileNumber); ++ TapePositionInfo->SetNumber = Read64BitUnsigned(pPosResult->LongBuffer.SetNumber); ++ } ++ } ++ break; ++ ++ case 1: // SERVICEACTION_SHORT_FORM_BLOCKID ++ { ++ // pPosResult->ShortBuffer.PERR; ++ // pPosResult->ShortBuffer.BYCU; ++ // pPosResult->ShortBuffer.BCU; ++ TapePositionInfo->AtPartitionStart = pPosResult->ShortBuffer.BOP; ++ TapePositionInfo->AtPartitionEnd = pPosResult->ShortBuffer.EOP; ++ ++ if (!TapePositionInfo->PartitionBlockValid) { ++ TapePositionInfo->PartitionBlockValid = !pPosResult->ShortBuffer.BPU; ++ ++ if (TapePositionInfo->PartitionBlockValid) { ++ TapePositionInfo->Partition = pPosResult->ShortBuffer.Partition; ++ TapePositionInfo->BlockNumber = Read32BitUnsigned(pPosResult->ShortBuffer.FirstBlock); ++ } ++ } ++ // Read32BitsUnsigned(pPosResult->ShortBuffer.LastBlock); ++ // Read24BitsUnsigned(pPosResult->ShortBuffer.NumberBufferBlocks); ++ // Read32BitsUnsigned(pPosResult->ShortBuffer.NumberBufferBytes); ++ } ++ break; ++ } ++ } ++ } ++ } ++ free(ScsiPassThrough); ++ ++ return NO_ERROR; ++} ++ ++DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize) ++{ ++ DWORD dwBufferSize = sizeof(GET_MEDIA_TYPES) + 5 * sizeof(DEVICE_MEDIA_INFO); ++ GET_MEDIA_TYPES * pGetMediaTypes = (GET_MEDIA_TYPES *)malloc(dwBufferSize); ++ BOOL bResult; ++ DWORD dwResult; ++ DWORD idxMedia; ++ ++ if (pGetMediaTypes == NULL) { ++ return ERROR_OUTOFMEMORY; ++ } ++ ++ do { ++ DWORD dwBytesReturned; ++ ++ bResult = DeviceIoControl( hDevice, ++ IOCTL_STORAGE_GET_MEDIA_TYPES_EX, ++ NULL, 0, ++ (LPVOID)pGetMediaTypes, dwBufferSize, ++ &dwBytesReturned, ++ NULL); ++ ++ if (!bResult) { ++ dwResult = GetLastError(); ++ ++ if (dwResult != ERROR_INSUFFICIENT_BUFFER) { ++ free(pGetMediaTypes); ++ return dwResult; ++ } ++ ++ dwBufferSize += 6 * sizeof(DEVICE_MEDIA_INFO); ++ ++ GET_MEDIA_TYPES * pNewBuffer = (GET_MEDIA_TYPES *)realloc(pGetMediaTypes, dwBufferSize); ++ ++ if (pNewBuffer != pGetMediaTypes) { ++ free(pGetMediaTypes); ++ ++ if (pNewBuffer == NULL) { ++ return ERROR_OUTOFMEMORY; ++ } ++ ++ pGetMediaTypes = pNewBuffer; ++ } ++ } ++ } while (!bResult); ++ ++ if (pGetMediaTypes->DeviceType != FILE_DEVICE_TAPE) { ++ free(pGetMediaTypes); ++ return ERROR_BAD_DEVICE; ++ } ++ ++ for (idxMedia = 0; idxMedia < pGetMediaTypes->MediaInfoCount; idxMedia++) { ++ ++ if (pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.MediaCharacteristics & MEDIA_CURRENTLY_MOUNTED) { ++ ++ if (pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.BusType == BusTypeScsi) { ++ *pdwDensity = pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.BusSpecificData.ScsiInformation.DensityCode; ++ } else { ++ *pdwDensity = 0; ++ } ++ ++ *pdwBlockSize = pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.CurrentBlockSize; ++ ++ free(pGetMediaTypes); ++ ++ return NO_ERROR; ++ } ++ } ++ ++ free(pGetMediaTypes); ++ ++ return ERROR_NO_MEDIA_IN_DRIVE; ++} ++ ++int tape_pos(int fd, struct mtpos *mt_pos) ++{ ++ DWORD partition; ++ DWORD offset; ++ DWORD offsetHi; ++ BOOL result; ++ ++ if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || ++ TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { ++ errno = EBADF; ++ return -1; ++ } ++ ++ PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; ++ ++ result = GetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, &partition, &offset, &offsetHi); ++ if (result == NO_ERROR) { ++ mt_pos->mt_blkno = offset; ++ return 0; ++ } ++ ++ return -1; ++} +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ mtops.h 2006-08-09 03:26:58.372973300 -0700 +@@ -0,0 +1,15 @@ ++int tape_open(const char *file, int flags, int mode); ++int tape_read(int fd, void *buffer, unsigned int count); ++int tape_write(int fd, const void *buffer, unsigned int count); ++int tape_ioctl(int fd, unsigned long int request, ...); ++int tape_close(int fd); ++ ++typedef unsigned long __kernel_daddr_t; ++ ++#ifndef ENOMEDIUM ++#define ENOMEDIUM 123 ++#endif ++ ++#ifndef PATH_MAX ++#define PATH_MAX 1024 ++#endif +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ Makefile.msc 2006-08-09 04:00:53.970613100 -0700 +@@ -0,0 +1,20 @@ ++CC= cl ++CFLAGS= /nologo /Ox /Gy /Zi /W3 /TP \ ++ /D_CRT_SECURE_NO_DEPRECATE ++LDFLAGS= /link /DEBUG /INCREMENTAL:NO /OPT:NOREF /PDB:$*.pdb /OUT:$@ ++PREFIX= C:\ ++ ++all: mt.exe ++ ++mt.exe: mt.c ++ $(CC) $(CFLAGS) mt.c mtops.c $(LDFLAGS) ++ ++stinit.exe: stinit.c ++ $(CC) $(CFLAGS) stinit.c $(LDFLAGS) ++ ++install: mt.exe ++ if not exist $(PREFIX)\bin\nul mkdir $(PREFIX)\bin ++ !copy /y $** $(PREFIX)\bin ++ ++clean: ++ del /f *~ *.obj mt.exe stinit.exe diff --git a/bacula/src/win32/patches/mtx-msvc1.patch b/bacula/src/win32/patches/mtx-msvc1.patch new file mode 100644 index 0000000000..c4712c9d36 --- /dev/null +++ b/bacula/src/win32/patches/mtx-msvc1.patch @@ -0,0 +1,75 @@ +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ Makefile.msc 2006-08-09 02:52:26.191999700 -0700 +@@ -0,0 +1,72 @@ ++# WARNING -- THIS HAS BEEN RE-WRITTEN TO USE MICROSOFT NMAKE. ++# ++# Valid targets: ++# Microsoft Visual Studio ++# ++# Makefile changes by Lars Kellogg-Stedman for better integration with ++# GNU Autoconf. ++ ++# Version # for 'make dist'... ++VERSION=1.3.9 ++PREFIX=C:\ ++ ++BINS = mtx.exe tapeinfo.exe loaderinfo.exe scsitape.exe nsmhack.exe ++ ++CC = cl ++ ++CFLAGS = /nologo /Ox /Gy /Zi /W3 \ ++ -D_CRT_SECURE_NO_DEPRECATE \ ++ -DVERSION="\"$(VERSION)\"" \ ++ -DLONG_PRINT_REQUEST_SENSE=1 ++ ++LINK = link ++LDFLAGS = /nologo /DEBUG /INCREMENTAL:NO /OPT:NOREF /PDB:$*.pdb /OUT:$@ ++LIBS = ++ ++all: $(BINS) ++ ++install: $(BINS) ++ -mkdir $(PREFIX)\bin ++ !copy /y $** $(PREFIX)\bin ++ ++clean: ++ -del /f *.obj *~ ++ -del /f $(BINS) ++ -del /f mam2debug.exe mam2debug2.exe ++ ++loaderinfo.exe: loaderinfo.obj mtxl.obj mtxl.h mtx.h ++ $(LINK) $(LDFLAGS) loaderinfo.obj mtxl.obj $(LIBS) ++ ++nsmhack.exe: nsmhack.obj mtxl.obj ++ $(LINK) $(LDFLAGS) nsmhack.obj mtxl.obj $(LIBS) ++ ++mtx.exe: mtx.obj mtxl.obj mtxl.h mtx.h ++ $(LINK) $(LDFLAGS) mtx.obj mtxl.obj $(LIBS) ++ ++mam2debug.exe: mtxl.obj mam2debug.obj mtx.h ++ $(LINK) $(LDFLAGS) mtxl.obj mam2debug.obj $(LIBS) ++ ++tapeinfo.exe: tapeinfo.obj mtxl.obj mtx.h mtxl.h ++ $(LINK) $(LDFLAGS) tapeinfo.obj mtxl.obj $(LIBS) ++ ++mam2debug2.exe: mtxl.obj mam2debug2.obj mtx.h ++ $(LINK) $(LDFLAGS) mtxl.obj mam2debug2.obj $(LIBS) ++ ++scsitape.exe: scsitape.obj mtxl.obj mtxl.h mtx.h ++ $(LINK) $(LDFLAGS) scsitape.obj mtxl.obj $(LIBS) ++ ++scsitape.obj: scsitape.c mtx.h mtxl.h ++ ++loaderinfo.obj: loaderinfo.c mtx.h mtxl.h ++ ++tapeinfo.obj: tapeinfo.c mtx.h mtxl.h ++ ++mam2debug.obj: mam2debug.c mtx.h mtxl.h ++ ++mam2debug2.obj: mam2debug2.c mtx.h mtxl.h ++ ++mtx.obj: mtx.c mtx.h mtxl.h ++ ++mtxl.obj: mtxl.c mtx.h mtxl.h scsi_linux.c scsi_win32.c ++ ++nsmhack.obj: nsmhack.c mtxl.h mtx.h diff --git a/bacula/src/win32/patches/mtx-msvc2.patch b/bacula/src/win32/patches/mtx-msvc2.patch new file mode 100644 index 0000000000..e8261e2b18 --- /dev/null +++ b/bacula/src/win32/patches/mtx-msvc2.patch @@ -0,0 +1,40 @@ +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ msvc/config.h 2006-05-26 15:10:34.558337600 -0700 +@@ -0,0 +1,37 @@ ++/* config.h. Generated by configure. */ ++/* Copyright 2001 Enhanced Software Technologies Inc. ++ * Released under GNU General Public License V2 or Above ++ * See http://www.gnu.org for more information about the terms of ++ * the GNU General Public License. ++ * $Date: 2006-08-12 16:18:24 -0700 (Sat, 12 Aug 2006) $ ++ * $Revision: 3282 $ ++ */ ++ ++#ifndef CONFIG_H ++#define CONFIG_H 1 ++ ++/* autoconf changes these. */ ++#define HAVE_STRING_H 1 ++#define HAVE_UNISTD_H 0 ++#define HAVE_STDLIB_H 1 ++#define HAVE_STDARG_H 1 ++#define HAVE_SCSI_SCSI_H 0 ++#define HAVE_SCSI_SCSI_IOCTL_H 0 ++#define HAVE_SCSI_SG_H 0 ++#define HAVE_SYS_GSCDDS_H 0 ++#define HAVE_CAMLIB_H 0 ++#define HAVE_SYS_SCSI_IMPL_USCSI_H 0 ++#define HAVE_SYS_SCSI_CTL_H 0 ++#define HAVE_DSLIB_H 0 ++#define HAVE_DU_DEFS_H 0 ++#define HAVE_SYS_STAT_H 1 ++#define HAVE_SYS_TYPES_H 1 ++#define HAVE_FCNTL_H 1 ++#define HAVE_SYS_IOCTL_H 0 ++#define HAVE_SYS_MTIO_H 0 ++#define HAVE_DDK_NTDDSCSI_H 0 ++ ++#define WORDS_BIGENDIAN 0 ++ ++#endif ++ diff --git a/bacula/src/win32/patches/mtx.patch b/bacula/src/win32/patches/mtx.patch new file mode 100644 index 0000000000..d22e261119 --- /dev/null +++ b/bacula/src/win32/patches/mtx.patch @@ -0,0 +1,1576 @@ +Index: README.win32 +=================================================================== +--- /dev/null Sat Jul 29 14:54:52 2006 ++++ README.win32 Sat Jul 29 14:46:45 2006 +@@ -0,0 +1,22 @@ ++CHANGES FROM UNIX ++================= ++ ++The only difference is in the naming of devices. On Linux the changer is ++accessed using /dev/sg, on Windows you use Changer. ++ ++On Linux the tape drive is referenced using /dev/nst, on Windows you use ++Tape. ++ ++There is one exception in the case where there isn't a driver loaded for the ++device. This is usually only the case on Windows 2000 or if the Windows XP or ++Windows Server 2003 system supplied driver has been disabled. ++ ++In the case where there is no driver loaded you can access the device directly ++through the SCSI driver using the following notation: ++ ++ ::: ++ ++ Port is the adapter number ++ Bus is the SCSI bus number relative to the adapter ++ Target is the SCSI device's target ID ++ LUN is the SCSI device's logical unit number +Index: scsi_win32.c +=================================================================== +--- /dev/null Sat Jul 29 14:55:00 2006 ++++ scsi_win32.c Sat Jul 29 14:54:08 2006 +@@ -0,0 +1,353 @@ ++/* Copyright 2006 Robert Nelson ++ ++$Date: 2006-07-30 06:32:36 -0700 (Sun, 30 Jul 2006) $ ++$Revision: 3200 $ ++ ++ This program is free software; you may redistribute and/or modify it under ++ the terms of the GNU General Public License Version 2 as published by the ++ Free Software Foundation. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ for complete details. ++ ++*/ ++ ++/* These are the SCSI commands for Microsoft Windows. This is derived from ++ * the file scsi_linux.c substituting Windows specific emulation of the Linux ++ * behaviour. ++ */ ++ ++#include ++#include ++ ++#ifdef _MSC_VER ++#include ++#else ++#include ++#endif ++ ++#ifndef HZ ++#define HZ 1000 ++#endif ++ ++/* These are copied out of BRU 16.1, with all the boolean masks changed ++ * to our bitmasks. ++*/ ++#define S_NO_SENSE(s) ((s)->SenseKey == 0x0) ++#define S_RECOVERED_ERROR(s) ((s)->SenseKey == 0x1) ++ ++#define S_NOT_READY(s) ((s)->SenseKey == 0x2) ++#define S_MEDIUM_ERROR(s) ((s)->SenseKey == 0x3) ++#define S_HARDWARE_ERROR(s) ((s)->SenseKey == 0x4) ++#define S_UNIT_ATTENTION(s) ((s)->SenseKey == 0x6) ++#define S_BLANK_CHECK(s) ((s)->SenseKey == 0x8) ++#define S_VOLUME_OVERFLOW(s) ((s)->SenseKey == 0xd) ++ ++#define DEFAULT_TIMEOUT 3 * 60 /* 3 minutes here */ ++ ++/* Sigh, the T-10 SSC spec says all of the following is needed to ++ * detect a short read while in variable block mode, and that even ++ * though we got a BLANK_CHECK or MEDIUM_ERROR, it's still a valid read. ++ */ ++ ++#define HIT_FILEMARK(s) (S_NO_SENSE((s)) && (s)->Filemark && (s)->Valid) ++#define SHORT_READ(s) (S_NO_SENSE((s)) && (s)->ILI && (s)->Valid && (s)->AdditionalSenseCode==0 && (s)->AdditionalSenseCodeQualifier==0) ++#define HIT_EOD(s) (S_BLANK_CHECK((s)) && (s)->Valid) ++#define HIT_EOP(s) (S_MEDIUM_ERROR((s)) && (s)->EOM && (s)->Valid) ++#define HIT_EOM(s) ((s)->EOM && (s)->Valid) ++ ++#define STILL_A_VALID_READ(s) (HIT_FILEMARK(s) || SHORT_READ(s) || HIT_EOD(s) || HIT_EOP(s) || HIT_EOM(s)) ++ ++#define SCSI_DEFAULT_TIMEOUT 60 /* 1 minute */ ++#define SCSI_MAX_TIMEOUT 108 /* 1 minute 48 seconds */ ++ ++typedef struct _HANDLE_ENTRY { ++ HANDLE hDevice; ++ UCHAR PortId; ++ UCHAR PathId; ++ UCHAR TargetId; ++ UCHAR Lun; ++} HANDLE_ENTRY, *PHANDLE_ENTRY; ++ ++PHANDLE_ENTRY HandleTable = NULL; ++int nEntries = 0; ++ ++DEVICE_TYPE SCSI_OpenDevice(char *DeviceName) ++{ ++ int DeviceIndex; ++ TCHAR szDevicePath[256]; ++ ++ int nColons = 0; ++ int index; ++ ++ int port, path, target, lun; ++ ++ for (DeviceIndex = 0; DeviceIndex < nEntries; DeviceIndex++) ++ { ++ if (HandleTable[DeviceIndex].hDevice == INVALID_HANDLE_VALUE) ++ break; ++ } ++ ++ if (DeviceIndex >= nEntries) ++ { ++ PHANDLE_ENTRY pNewTable; ++ ++ nEntries += 4; ++ ++ if (HandleTable == NULL) ++ { ++ pNewTable = (PHANDLE_ENTRY)malloc(nEntries * sizeof(HANDLE_ENTRY)); ++ } ++ else ++ { ++ pNewTable = (PHANDLE_ENTRY)realloc(HandleTable, nEntries * sizeof(HANDLE_ENTRY)); ++ } ++ ++ if (pNewTable == NULL) ++ { ++ FatalError("cannot open SCSI device '%s' - %m\n", DeviceName); ++ } ++ ++ HandleTable = pNewTable; ++ } ++ ++ for (index = 0; DeviceName[index] != '\0'; index++) ++ { ++ if (DeviceName[index] == ':') ++ nColons++; ++ else if (DeviceName[index] < '0' || DeviceName[index] > '9') ++ break; ++ } ++ ++ if (DeviceName[index] == '\0' && nColons == 3 && ++ sscanf(DeviceName, "%d:%d:%d:%d", &port, &path, &target, &lun) == 4) { ++ ++ HandleTable[DeviceIndex].PortId = (UCHAR)port; ++ HandleTable[DeviceIndex].PathId = (UCHAR)path; ++ HandleTable[DeviceIndex].TargetId = (UCHAR)target; ++ HandleTable[DeviceIndex].Lun = (UCHAR)lun; ++ ++ sprintf(szDevicePath, "\\\\.\\scsi%d:", port); ++ } ++ else ++ { ++ int nPrefixLength = 0; ++ ++ if (DeviceName[0] != '\\') { ++ memcpy(szDevicePath, "\\\\.\\", 4 * sizeof(TCHAR)); ++ nPrefixLength = 4; ++ } ++ ++ HandleTable[DeviceIndex].PortId = 0; ++ HandleTable[DeviceIndex].PathId = 0; ++ HandleTable[DeviceIndex].TargetId = 0; ++ HandleTable[DeviceIndex].Lun = 0; ++ ++ strncpy( &szDevicePath[nPrefixLength], ++ DeviceName, ++ sizeof(szDevicePath) / sizeof(TCHAR) - nPrefixLength - 1); ++ ++ szDevicePath[sizeof(szDevicePath) / sizeof(TCHAR) - 1] = '\0'; ++ } ++ ++ HandleTable[DeviceIndex].hDevice = CreateFile(szDevicePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); ++ ++ if (HandleTable[DeviceIndex].hDevice == INVALID_HANDLE_VALUE) ++ { ++ DWORD dwError = GetLastError(); ++ ++#if DEBUG ++ LPSTR lpszMessage; ++ ++ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, (LPSTR)&lpszMessage, 0, NULL); ++ fputs(lpszMessage, stderr); ++#endif ++ ++ switch (dwError) { ++ case ERROR_FILE_NOT_FOUND: ++ case ERROR_PATH_NOT_FOUND: ++ errno = ENOENT; ++ break; ++ ++ case ERROR_TOO_MANY_OPEN_FILES: ++ errno = EMFILE; ++ break; ++ ++ default: ++ case ERROR_ACCESS_DENIED: ++ case ERROR_SHARING_VIOLATION: ++ case ERROR_LOCK_VIOLATION: ++ case ERROR_INVALID_NAME: ++ errno = EACCES; ++ break; ++ ++ case ERROR_FILE_EXISTS: ++ errno = EEXIST; ++ break; ++ ++ case ERROR_INVALID_PARAMETER: ++ errno = EINVAL; ++ break; ++ } ++ ++ FatalError("cannot open SCSI device '%s' - %m\n", DeviceName); ++ } ++ ++ return DeviceIndex; ++} ++ ++static int scsi_timeout = SCSI_DEFAULT_TIMEOUT; ++ ++void SCSI_Set_Timeout(int secs) ++{ ++ if (secs > SCSI_MAX_TIMEOUT) { ++ secs = SCSI_MAX_TIMEOUT; ++ } ++ scsi_timeout = secs * HZ; ++} ++ ++void SCSI_Default_Timeout(void) ++{ ++ scsi_timeout = SCSI_DEFAULT_TIMEOUT * HZ; ++} ++ ++void SCSI_CloseDevice(char *DeviceName, DEVICE_TYPE DeviceFD) ++{ ++ if (DeviceFD < nEntries) ++ { ++ CloseHandle(HandleTable[DeviceFD].hDevice); ++ HandleTable[DeviceFD].hDevice = INVALID_HANDLE_VALUE; ++ } ++ else ++ { ++ errno = EBADF; ++ FatalError("cannot close SCSI device '%s' - %m\n", DeviceName); ++ } ++} ++ ++ ++/* Added by Eric Green to deal with burping ++ * Seagate autoloader (hopefully!). ++ */ ++/* Get the SCSI ID and LUN... */ ++scsi_id_t *SCSI_GetIDLun(DEVICE_TYPE fd) { ++ scsi_id_t * retval; ++ ++ SCSI_ADDRESS ScsiAddress; ++ BOOL bResult; ++ DWORD dwBytesReturned; ++ ++ if (fd < nEntries) { ++ retval = (scsi_id_t *)xmalloc(sizeof(scsi_id_t)); ++ retval->id = HandleTable[fd].TargetId; ++ retval->lun = HandleTable[fd].Lun; ++ ++#ifdef DEBUG ++ fprintf(stderr,"SCSI:ID=%d LUN=%d\n", retval->id, retval->lun); ++#endif ++ return retval; ++ } else { ++ errno = EBADF; ++ FatalError("cannot close SCSI device - %m\n"); ++ } ++ ++ memset(&ScsiAddress, 0, sizeof(ScsiAddress)); ++ ++ ScsiAddress.Length = sizeof(ScsiAddress); ++ ++ bResult = DeviceIoControl(HandleTable[fd].hDevice, ++ IOCTL_SCSI_GET_ADDRESS, ++ &ScsiAddress, sizeof(ScsiAddress), ++ &ScsiAddress, sizeof(ScsiAddress), ++ &dwBytesReturned, ++ NULL); ++ ++ if (!bResult) { ++ return NULL; ++ } ++ ++ retval = (scsi_id_t *)xmalloc(sizeof(scsi_id_t)); ++ retval->id = ScsiAddress.TargetId; ++ retval->lun = ScsiAddress.Lun; ++ ++#ifdef DEBUG ++ fprintf(stderr,"SCSI:ID=%d LUN=%d\n",retval->id,retval->lun); ++#endif ++ return retval; ++} ++ ++int SCSI_ExecuteCommand(DEVICE_TYPE DeviceFD, ++ Direction_T Direction, ++ CDB_T *CDB, ++ int CDB_Length, ++ void *DataBuffer, ++ int DataBufferLength, ++ RequestSense_T *RequestSense) ++{ ++ PSCSI_PASS_THROUGH_DIRECT ScsiPassThrough; ++ ++ const DWORD dwBufferSize = sizeof(SCSI_PASS_THROUGH_DIRECT) + sizeof(RequestSense_T); ++ BOOL bResult; ++ DWORD dwBytesReturned; ++ ++ if (DeviceFD >= nEntries || HandleTable[DeviceFD].hDevice == INVALID_HANDLE_VALUE) ++ { ++ errno = EBADF; ++ return -1; ++ } ++ ++ ScsiPassThrough = (PSCSI_PASS_THROUGH_DIRECT)malloc(dwBufferSize); ++ ++ memset(ScsiPassThrough, 0, dwBufferSize); ++ ++ ScsiPassThrough->Length = sizeof(SCSI_PASS_THROUGH_DIRECT); ++ ++ ScsiPassThrough->PathId = HandleTable[DeviceFD].PathId; ++ ScsiPassThrough->TargetId = HandleTable[DeviceFD].TargetId; ++ ScsiPassThrough->Lun = HandleTable[DeviceFD].Lun; ++ ScsiPassThrough->CdbLength = (UCHAR)CDB_Length; ++ ScsiPassThrough->SenseInfoLength = sizeof(RequestSense_T); ++ ScsiPassThrough->DataIn = Direction == Input; ++ ScsiPassThrough->DataTransferLength = DataBufferLength; ++ ScsiPassThrough->TimeOutValue = scsi_timeout; ++ ScsiPassThrough->DataBuffer = DataBuffer; ++ ScsiPassThrough->SenseInfoOffset = sizeof(SCSI_PASS_THROUGH_DIRECT); ++ ++ memcpy(ScsiPassThrough->Cdb, CDB, CDB_Length); ++ dwBytesReturned = 0; ++ ++ bResult = DeviceIoControl(HandleTable[DeviceFD].hDevice, ++ IOCTL_SCSI_PASS_THROUGH_DIRECT, ++ ScsiPassThrough, sizeof(SCSI_PASS_THROUGH_DIRECT), ++ ScsiPassThrough, dwBufferSize, ++ &dwBytesReturned, ++ NULL); ++ if (bResult) { ++ if (ScsiPassThrough->ScsiStatus != 0) { ++ memcpy(RequestSense, &ScsiPassThrough[1], sizeof(RequestSense_T)); ++#if DEBUG ++ fprintf(stderr, "Command failed - ScsiStatus = %d\n", ScsiPassThrough->ScsiStatus); ++ PrintRequestSense(RequestSense); ++#endif ++ bResult = false; ++ } ++ } ++ else ++ { ++#if DEBUG ++ DWORD dwError = GetLastError(); ++ LPSTR lpszMessage; ++ ++ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, (LPSTR)&lpszMessage, 0, NULL); ++ fputs(lpszMessage, stderr); ++#endif ++ ++ memset(RequestSense, 0, sizeof(RequestSense_T)); ++ } ++ ++ free(ScsiPassThrough); ++ ++ return bResult ? 0 : -1; ++} +Index: tapeinfo.c +=================================================================== +--- tapeinfo.c (revision 139) ++++ tapeinfo.c (revision 147) +@@ -211,25 +211,18 @@ + unsigned int partition1_size; + } TapeCapacity; + ++#if defined(DEBUG) + /* DEBUG */ + static void dump_data(unsigned char *data, int len) { +- int i; + if (!len) { + fprintf(stderr,"**NO DATA**\n"); + return; + } + +- for (i=0;i argument '%d' to 'unload' command\n", + arg2); + } +- if (ElementStatus->DataTransferElementFull[arg2] < 0 ) { ++ if (!ElementStatus->DataTransferElementFull[arg2]) { + FatalError("Data Transfer Element %d is Empty\n", arg2); + } + /* Now see if something already lives where we wanna go... */ +@@ -715,7 +715,7 @@ + } + ElementStatus = ReadElementStatus(MediumChangerFD,&RequestSense,inquiry_info,&SCSI_Flags); + if (!ElementStatus) { +- PrintRequestSense(&RequestSense); ++ PrintRequestSense(&RequestSense); + FatalError("READ ELEMENT STATUS Command Failed\n"); + } + } +@@ -813,9 +813,6 @@ + + argv0=argv[0]; + +- +- +- + parse_args(); /* also executes them as it sees them, sigh. */ + + #ifndef VMS +Index: scsitape.c +=================================================================== +--- scsitape.c (revision 139) ++++ scsitape.c (revision 147) +@@ -41,11 +41,26 @@ + #include "mtx.h" + #include "mtxl.h" + ++#if HAVE_UNISTD_H + #include ++#endif ++ ++#if HAVE_SYS_TYPES_H + #include ++#endif ++ ++#if HAVE_SYS_IOCTL_H + #include ++#endif ++ ++#if HAVE_SYS_MTIO_H + #include /* will try issuing some ioctls for Solaris, sigh. */ ++#endif + ++#ifdef _MSC_VER ++#include ++#endif ++ + void Usage(void) { + FatalError("Usage: scsitape -f where is:\n setblk | fsf | bsf | eod | rewind | eject | mark |\n seek | read [ [] \n"); + } +@@ -54,7 +69,7 @@ + static int arg[4]; /* the argument for the command, sigh. */ + + /* the device handle we're operating upon, sigh. */ +-static unsigned char *device; /* the text of the device thingy. */ ++static char *device; /* the text of the device thingy. */ + static DEVICE_TYPE MediumChangerFD = (DEVICE_TYPE) 0; + + +@@ -96,43 +111,7 @@ + + char *argv0; + +-/* A table for printing out the peripheral device type as ASCII. */ +-static char *PeripheralDeviceType[32] = { +- "Disk Drive", +- "Tape Drive", +- "Printer", +- "Processor", +- "Write-once", +- "CD-ROM", +- "Scanner", +- "Optical", +- "Medium Changer", +- "Communications", +- "ASC IT8", +- "ASC IT8", +- "RAID Array", +- "Enclosure Services", +- "OCR/W", +- "Bridging Expander", /* 0x10 */ +- "Reserved", /* 0x11 */ +- "Reserved", /* 0x12 */ +- "Reserved", /* 0x13 */ +- "Reserved", /* 0x14 */ +- "Reserved", /* 0x15 */ +- "Reserved", /* 0x16 */ +- "Reserved", /* 0x17 */ +- "Reserved", /* 0x18 */ +- "Reserved", /* 0x19 */ +- "Reserved", /* 0x1a */ +- "Reserved", /* 0x1b */ +- "Reserved", /* 0x1c */ +- "Reserved", /* 0x1d */ +- "Reserved", /* 0x1e */ +- "Unknown" /* 0x1f */ +-}; + +- +- + /* open_device() -- set the 'fh' variable.... */ + void open_device(void) { + +@@ -301,7 +280,7 @@ + CDB[5]=0; + + /* we really don't care if this command works or not, sigh. */ +- slow_bzero((unsigned char *)&RequestSense,sizeof(RequestSense_T)); ++ slow_bzero((char *)&RequestSense,sizeof(RequestSense_T)); + if (SCSI_ExecuteCommand(MediumChangerFD,Input,&CDB,6,buffer,0,&RequestSense)!=0){ + PrintRequestSense(&RequestSense); + return 1; +@@ -324,7 +303,7 @@ + CDB[5]=0; + + /* we really don't care if this command works or not, sigh. */ +- slow_bzero((unsigned char *)&sense,sizeof(RequestSense_T)); ++ slow_bzero((char *)&sense,sizeof(RequestSense_T)); + if (SCSI_ExecuteCommand(MediumChangerFD,Input,&CDB,6,buffer,0,&sense)!=0){ + PrintRequestSense(&sense); + return 1; +@@ -349,7 +328,7 @@ + CDB[5]=0; + + /* we really don't care if this command works or not, sigh. */ +- slow_bzero((unsigned char *)&sense,sizeof(RequestSense_T)); ++ slow_bzero((char *)&sense,sizeof(RequestSense_T)); + if (SCSI_ExecuteCommand(MediumChangerFD,Input,&CDB,6,buffer,0,&sense)!=0){ + PrintRequestSense(&sense); + return 1; +@@ -392,7 +371,7 @@ + CDB[5]=0; + + /* we really don't care if this command works or not, sigh. */ +- slow_bzero((unsigned char *)&sense,sizeof(RequestSense_T)); ++ slow_bzero((char *)&sense,sizeof(RequestSense_T)); + if (SCSI_ExecuteCommand(MediumChangerFD,Input,&CDB,6,buffer,0,&sense)!=0){ + PrintRequestSense(&sense); + return 1; +@@ -422,7 +401,7 @@ + CDB[9]=0; + + /* we really don't care if this command works or not, sigh. */ +- slow_bzero((unsigned char *)&sense,sizeof(RequestSense_T)); ++ slow_bzero((char *)&sense,sizeof(RequestSense_T)); + if (SCSI_ExecuteCommand(MediumChangerFD,Input,&CDB,10,buffer,0,&sense)!=0){ + PrintRequestSense(&sense); + return 1; +@@ -462,7 +441,7 @@ + static int S_setblk(void) { + RequestSense_T sense; + CDB_T CDB; +- unsigned char buffer[12]; ++ char buffer[12]; + unsigned int count = (unsigned int) arg1; + + +@@ -473,7 +452,7 @@ + CDB[4]=12; /* length of data */ + CDB[5]=0; + +- slow_bzero((unsigned char *)&sense,sizeof(RequestSense_T)); ++ slow_bzero((char *)&sense,sizeof(RequestSense_T)); + slow_bzero(buffer,12); + + /* Now to set the mode page header: */ +@@ -679,9 +658,9 @@ + + /* S_write is not implemented yet! */ + static int S_write(void) { +- unsigned char *buffer; /* the buffer we're gonna read/write out of. */ ++ char *buffer; /* the buffer we're gonna read/write out of. */ + int buffersize; +- int len; /* the length of the data in the buffer */ ++ unsigned int len; /* the length of the data in the buffer */ + int blocksize=arg[0]; + int numblocks=arg[1]; + int varsize=0; /* variable size block flag */ +@@ -755,9 +734,9 @@ + + + static int S_read(void) { +- unsigned char *buffer; /* the buffer we're going to be reading out of */ ++ char *buffer; /* the buffer we're going to be reading out of */ + int buffersize; +- int len; /* the length of the data in the buffer */ ++ unsigned int len; /* the length of the data in the buffer */ + int blocksize=arg[0]; + int numblocks=arg[1]; + int varsize=0; /* variable size block flag. */ +Index: mtx.h +=================================================================== +--- mtx.h (revision 139) ++++ mtx.h (working copy) +@@ -18,7 +18,11 @@ + #include "[.vms]defs.h" + #else /* all the Unix stuff: */ + ++#ifdef _MSC_VER ++#include "msvc/config.h" /* all the autoconf stuff. */ ++#else + #include "config.h" /* all the autoconf stuff. */ ++#endif + + /* all the general Unix includes: */ + +@@ -59,7 +63,7 @@ + # include + #endif + +-/* Now greately modified to use GNU Autoconf stuff: */ ++/* Now greatly modified to use GNU Autoconf stuff: */ + /* If we use the 'sg' interface, like Linux, do this: */ + #if HAVE_SCSI_SG_H + # include +@@ -69,6 +73,27 @@ + # define HAVE_GET_ID_LUN 1 /* signal that we have it... */ + #endif + ++/* Windows Native programs built using MinGW */ ++#if HAVE_DDK_NTDDSCSI_H ++# include ++# include ++# undef DEVICE_TYPE ++ ++typedef int DEVICE_TYPE; ++# define HAVE_GET_ID_LUN 1 /* signal that we have it... */ ++#endif ++ ++/* Windows Native programs built using Microsoft Visual C */ ++#ifdef _MSC_VER ++# include ++# include ++# include ++# undef DEVICE_TYPE ++ ++typedef int DEVICE_TYPE; ++# define HAVE_GET_ID_LUN 1 /* signal that we have it... */ ++#endif ++ + /* The 'cam' interface, like FreeBSD: */ + #if HAVE_CAMLIB_H + # include /* easy (?) access to the CAM user library. */ +@@ -176,10 +201,23 @@ + unsigned char invert2; /* used for EXCHANGE command, sigh. */ + } SCSI_Flags_T; + ++#ifdef _MSC_VER ++typedef unsigned char boolean; ++ ++#define false 0 ++#define true 1 ++ ++ ++typedef unsigned char Direction_T; ++ ++#define Input 0 ++#define Output 1 ++#else + typedef enum { false, true } boolean; + + + typedef enum { Input, Output } Direction_T; ++#endif + + + typedef unsigned char CDB_T[12]; +@@ -354,6 +392,15 @@ + } ElementModeSense_T; + + ++#ifdef _MSC_VER ++typedef char ElementTypeCode_T; ++ ++#define AllElementTypes 0 ++#define MediumTransportElement 1 ++#define StorageElement 2 ++#define ImportExportElement 3 ++#define DataTransferElement 4 ++#else + typedef enum ElementTypeCode + { + AllElementTypes = 0, +@@ -363,6 +410,7 @@ + DataTransferElement = 4 + } + ElementTypeCode_T; ++#endif + + + typedef struct ElementStatusDataHeader +Index: nsmhack.c +=================================================================== +--- nsmhack.c (revision 139) ++++ nsmhack.c (revision 147) +@@ -33,13 +33,13 @@ + + #include "mtxl.h" /* get the SCSI routines out of the main file */ + +-/***************************************************************** ++/****************************************************************/ + /* Variables: */ + /****************************************************************/ + + /* the device handle we're operating upon, sigh. */ +-static unsigned char *device; /* the text of the device thingy. */ +-static DEVICE_TYPE MediumChangerFD = (DEVICE_TYPE) 0; ++static char *device; /* the text of the device thingy. */ ++static DEVICE_TYPE MediumChangerFD = (DEVICE_TYPE) -1; + char *argv0; + int arg[4]; /* arguments for the command. */ + #define arg1 (arg[0]) /* for backward compatibility, sigh */ +@@ -74,7 +74,7 @@ + /* open_device() -- set the 'fh' variable.... */ + void open_device(void) { + +- if (MediumChangerFD) { ++ if (MediumChangerFD != -1) { + SCSI_CloseDevice("Unknown",MediumChangerFD); /* close it, sigh... new device now! */ + } + +@@ -101,7 +101,7 @@ + /* if the device is not already open, then open it from the + * environment. + */ +- if (!MediumChangerFD) { ++ if (MediumChangerFD == -1) { + /* try to get it from STAPE or TAPE environment variable... */ + device=getenv("STAPE"); + if (device==NULL) { +@@ -302,7 +302,7 @@ + } + + static int S_tongue_in(void) { +- ++ return 0; + } + + /* okay, stick our tongue out. We need a slot ID to grab a caddy from. */ +@@ -326,6 +326,7 @@ + } + + /* Okay, we have element status, so now let's assume that */ ++ return 0; + } + + /* See parse_args for the scoop. parse_args does all. */ +Index: mtxl.h +=================================================================== +--- mtxl.h (revision 139) ++++ mtxl.h (revision 147) +@@ -27,6 +27,9 @@ + + #include "mtx.h" + ++#undef min ++#undef max ++ + void FatalError(char *ErrorMessage, ...); + void *xmalloc(size_t Size); + void *xzmalloc(size_t Size); +Index: config.h +=================================================================== +--- ../release/mtx-1.3.9/config.h.in 2003-09-29 19:43:20.000000000 -0700 ++++ config.h 2006-07-30 00:42:37.000000000 -0700 +@@ -1,3 +1,4 @@ ++/* config.h. Generated by configure. */ + /* Copyright 2001 Enhanced Software Technologies Inc. + * Released under GNU General Public License V2 or Above + * See http://www.gnu.org for more information about the terms of +@@ -10,10 +11,10 @@ + #define CONFIG_H 1 + + /* autoconf changes these. */ +-#define HAVE_STRING_H 0 +-#define HAVE_UNISTD_H 0 +-#define HAVE_STDLIB_H 0 +-#define HAVE_STDARG_H 0 ++#define HAVE_STRING_H 1 ++#define HAVE_UNISTD_H 1 ++#define HAVE_STDLIB_H 1 ++#define HAVE_STDARG_H 1 + #define HAVE_SCSI_SCSI_H 0 + #define HAVE_SCSI_SCSI_IOCTL_H 0 + #define HAVE_SCSI_SG_H 0 +@@ -23,10 +24,12 @@ + #define HAVE_SYS_SCSI_CTL_H 0 + #define HAVE_DSLIB_H 0 + #define HAVE_DU_DEFS_H 0 +-#define HAVE_SYS_STAT_H 0 +-#define HAVE_SYS_TYPES_H 0 +-#define HAVE_FCNTL_H 0 ++#define HAVE_SYS_STAT_H 1 ++#define HAVE_SYS_TYPES_H 1 ++#define HAVE_FCNTL_H 1 + #define HAVE_SYS_IOCTL_H 0 ++#define HAVE_SYS_MTIO_H 0 ++#define HAVE_DDK_NTDDSCSI_H 1 + + #define WORDS_BIGENDIAN 0 + +Index: mtxl.c +=================================================================== +--- ../release/mtx-1.3.9/mtxl.c 2003-10-02 23:03:20.000000000 -0700 ++++ mtxl.c 2006-07-30 00:49:31.000000000 -0700 +@@ -53,6 +53,11 @@ + # include "scsi_linux.c" + #endif + ++/* the IOCTL_SCSI_PASSTHROUGH interface is used on Windows. */ ++#if HAVE_DDK_NTDDSCSI_H || defined(_MSC_VER) ++# include "scsi_win32.c" ++#endif ++ + /* The 'uscsi' interface is used on Solaris. */ + #if HAVE_SYS_SCSI_IMPL_USCSI_H + # include "scsi_sun.c" +@@ -78,6 +83,7 @@ + #include "[.vms]scsi.c" + #endif + ++void PrintHex(int Indent, unsigned char *Buffer, int Length); + extern char *argv0; /* something to let us do good error messages. */ + + /* create a global RequestSenseT value. */ +@@ -104,6 +110,9 @@ + if (SCSI_ExecuteCommand(fd, Input, &CDB, 6, + Inquiry, sizeof(Inquiry_T), RequestSense) != 0) + { ++#ifdef DEBUG ++ fprintf(stderr, "SCSI Inquiry Command failed\n"); ++#endif + free(Inquiry); + return NULL; /* sorry! */ + } +@@ -111,36 +120,27 @@ + } + + ++#if defined(DEBUG_NSM) || defined(DEBUG_EXCHANGE) + /* DEBUG */ + static void dump_cdb(unsigned char *CDB, int len) { +- int i; + fprintf(stderr,"CDB:"); +- for (i=0;iNumStorageHi,sense_page->NumStorageLo, +- sense_page->NumImportExportHi, sense_page->NumImportExportLo); ++ sense_page->NumStorageHi,sense_page->NumStorageLo, ++ sense_page->NumImportExportHi, sense_page->NumImportExportLo); + fprintf(stderr,"rawNumTransport=%d %d rawNumDataTransfer=%d %d\n", +- sense_page->NumMediumTransportHi,sense_page->NumMediumTransportLo, +- sense_page->NumDataTransferHi,sense_page->NumDataTransferLo); ++ sense_page->NumMediumTransportHi,sense_page->NumMediumTransportLo, ++ sense_page->NumDataTransferHi,sense_page->NumDataTransferLo); + fflush(stderr); + #endif + +@@ -620,19 +618,16 @@ + CDB[11] = 0; /* Control */ + + #ifdef DEBUG_BARCODE +- { +- int i; +- fprintf(stderr,"CDB= "); +- for (i=0;i<12;i++) { +- fprintf(stderr,"%x ",CDB[i]); +- } +- fprintf(stderr,"\n"); +- fflush(stderr); +- } ++ fprintf(stderr,"CDB:\n"); ++ PrintHex(2, CDB, 12); + #endif + + if (SCSI_ExecuteCommand(MediumChangerFD, Input, &CDB, 12, + DataBuffer,NumBytes, RequestSense) != 0){ ++ ++#ifdef DEBUG ++ fprintf(stderr, "Read Element Status (0x%02X) failed\n", CDB[0]); ++#endif + /* okay, first see if we have sense key of 'illegal request', + additional sense code of '24', additional sense qualfier of + '0', and field in error of '4'. This means that we issued a request +@@ -654,15 +649,8 @@ + CDB[1] &= ~0x10; /* clear bar code flag! */ + + #ifdef DEBUG_BARCODE +- { +- int i; +- fprintf(stderr,"CDB= "); +- for (i=0;i<12;i++) { +- fprintf(stderr,"%x ",CDB[i]); +- } +- fprintf(stderr,"\n"); +- fflush(stderr); +- } ++ fprintf(stderr,"CDB:\n"); ++ PrintHex(2, CDB, 12); + #endif + + if (SCSI_ExecuteCommand(MediumChangerFD, Input, &CDB, 12, +@@ -679,14 +667,8 @@ + #ifdef DEBUG_BARCODE + /* print a bunch of extra debug data :-(. */ + PrintRequestSense(RequestSense); /* see what it sez :-(. */ +- { +- int i; +- fprintf(stderr,"Data:"); +- for (i=0;i<40;i++) { +- fprintf(stderr,"%02x ",DataBuffer[i]); +- } +- fprintf(stderr,"\n"); +- } ++ fprintf(stderr,"Data:\n"); ++ PrintHex(2, DataBuffer, 40); + #endif + return DataBuffer; /* we succeeded! */ + } +@@ -703,7 +685,7 @@ + ) { + + unsigned char *DataBuffer; /* size of data... */ +- unsigned int real_numbytes; ++ int real_numbytes; + + + DataBuffer=SendElementStatusRequestActual(MediumChangerFD, +@@ -950,34 +932,42 @@ + BigEndian16(TransportElementDescriptor + ->SourceStorageElementAddress); + +- if (ElementStatus->DataTransferElementCount >= mode_sense->NumDataTransfer) { +- FatalError("Too many Data Transfer Elements Reported\n"); +- } +- if (ElementStatusPage->VolBits & E2_PVOLTAG) { +- copy_barcode(TransportElementDescriptor->PrimaryVolumeTag, +- ElementStatus->DataTransferPrimaryVolumeTag[ElementStatus->DataTransferElementCount]); +- } else { +- ElementStatus->DataTransferPrimaryVolumeTag[ElementStatus->DataTransferElementCount][0]=0; /* null string */ +- } +- if (ElementStatusPage->VolBits & E2_AVOLTAG) { +- copy_barcode(TransportElementDescriptor->AlternateVolumeTag, +- ElementStatus->DataTransferAlternateVolumeTag[ElementStatus->DataTransferElementCount]); +- } else { +- ElementStatus->DataTransferAlternateVolumeTag[ElementStatus->DataTransferElementCount][0]=0; /* null string */ +- } +- ElementStatus->DataTransferElementCount++; +- /* 0 actually is a usable element address */ +- /* if (DataTransferElementAddress == 0) */ +- /* FatalError( */ +- /* "illegal Data Transfer Element Address %d reported\n", */ +- /* DataTransferElementAddress); */ +- break; +- default: +- FatalError("illegal Element Type Code %d reported\n", +- ElementStatusPage->ElementTypeCode); +- } +- } ++#if DEBUG ++ fprintf(stderr, "%d: ElementAddress = %d, Full = %d, SourceElement = %d\n", ++ ElementStatus->DataTransferElementCount, ++ ElementStatus->DataTransferElementAddress[ElementStatus->DataTransferElementCount], ++ ElementStatus->DataTransferElementFull[ElementStatus->DataTransferElementCount], ++ ElementStatus->DataTransferElementSourceStorageElementNumber[ElementStatus->DataTransferElementCount]); ++#endif ++ if (ElementStatus->DataTransferElementCount >= mode_sense->NumDataTransfer) { ++ FatalError("Too many Data Transfer Elements Reported\n"); ++ } ++ if (ElementStatusPage->VolBits & E2_PVOLTAG) { ++ copy_barcode(TransportElementDescriptor->PrimaryVolumeTag, ++ ElementStatus->DataTransferPrimaryVolumeTag[ElementStatus->DataTransferElementCount]); ++ } else { ++ ElementStatus->DataTransferPrimaryVolumeTag[ElementStatus->DataTransferElementCount][0]=0; /* null string */ ++ } ++ if (ElementStatusPage->VolBits & E2_AVOLTAG) { ++ copy_barcode(TransportElementDescriptor->AlternateVolumeTag, ++ ElementStatus->DataTransferAlternateVolumeTag[ElementStatus->DataTransferElementCount]); ++ } else { ++ ElementStatus->DataTransferAlternateVolumeTag[ElementStatus->DataTransferElementCount][0]=0; /* null string */ ++ } ++ ElementStatus->DataTransferElementCount++; ++ ++ /* 0 actually is a usable element address */ ++ /* if (DataTransferElementAddress == 0) */ ++ /* FatalError( */ ++ /* "illegal Data Transfer Element Address %d reported\n", */ ++ /* DataTransferElementAddress); */ ++ break; ++ default: ++ FatalError("illegal Element Type Code %d reported\n", ++ ElementStatusPage->ElementTypeCode); ++ } + } ++ } + } + + /********************* Real ReadElementStatus ********************* */ +@@ -1008,7 +998,6 @@ + int *EmptyStorageElementAddress; /* [MAX_STORAGE_ELEMENTS]; */ + + int empty_idx=0; +- int invalid_sources=0; + boolean is_attached = false; + int i,j; + +@@ -1049,7 +1038,7 @@ + + EmptyStorageElementAddress=(int *)xzmalloc((mode_sense->NumStorage+1)*sizeof(int)); + for (i=0;iNumStorage;i++) { +- EmptyStorageElementAddress[i]=-1; ++ EmptyStorageElementAddress[i] = -1; + } + + /* Okay, now to send some requests for the various types of stuff: */ +@@ -1076,6 +1065,9 @@ + #endif + /* darn. Free up stuff and return. */ + /****FIXME**** do a free on element data! */ ++#ifdef DEBUG_MODE_SENSE ++ PrintRequestSense(RequestSense); ++#endif + FreeElementData(ElementStatus); + return NULL; + } +@@ -1107,6 +1099,9 @@ + #endif + /* darn. Free up stuff and return. */ + /****FIXME**** do a free on element data! */ ++#ifdef DEBUG_MODE_SENSE ++ PrintRequestSense(RequestSense); ++#endif + FreeElementData(ElementStatus); + return NULL; + } +@@ -1138,6 +1133,9 @@ + #endif + /* darn. Free up stuff and return. */ + /****FIXME**** do a free on element data! */ ++#ifdef DEBUG_MODE_SENSE ++ PrintRequestSense(RequestSense); ++#endif + FreeElementData(ElementStatus); + return NULL; + } +@@ -1172,6 +1170,9 @@ + #endif + /* darn. Free up stuff and return. */ + /****FIXME**** do a free on element data! */ ++#ifdef DEBUG_MODE_SENSE ++ PrintRequestSense(RequestSense); ++#endif + FreeElementData(ElementStatus); + return NULL; + } +@@ -1223,34 +1224,24 @@ + * is obviously defective: + */ + /* pass one: */ +- invalid_sources=0; /* no invalid sources yet! */ + for (i=0;iDataTransferElementCount;i++) { + int elnum; +- int translated_elnum = -1; + /* if we have an element, then ... */ + if (ElementStatus->DataTransferElementFull[i]) { + elnum=ElementStatus->DataTransferElementSourceStorageElementNumber[i]; + /* if we have an element number, then ... */ + if (elnum >= 0) { +- /* Now to translate the elnum: */ +- for (j=0; jStorageElementCount; j++) { +- if (elnum == ElementStatus->StorageElementAddress[j]) { +- translated_elnum=j; +- } +- } +- /* now see if the element # is already occupied: */ +- if (ElementStatus->StorageElementFull[translated_elnum]) { +- invalid_sources=1; +- break; /* break out of the loop! */ +- } else { +- /* properly set the source... */ +- ElementStatus->DataTransferElementSourceStorageElementNumber[i]= +- translated_elnum; +- } +- +- } else { +- /* if element # was not >=0, then we had an invalid source anyhow! */ +- invalid_sources=1; ++ /* Now to translate the elnum: */ ++ ElementStatus->DataTransferElementSourceStorageElementNumber[i] = -1; ++ for (j=0; jStorageElementCount; j++) { ++ if (elnum == ElementStatus->StorageElementAddress[j]) { ++ /* now see if the element # is already occupied:*/ ++ if (!ElementStatus->StorageElementFull[j]) { ++ /* properly set the source... */ ++ ElementStatus->DataTransferElementSourceStorageElementNumber[i]= j; ++ } ++ } ++ } + } + } + } +@@ -1267,21 +1258,19 @@ + * by the user interface. This is an invalid value, but more useful for us + * to have than just crapping out here :-(. + */ +- if (invalid_sources) { +- empty_idx=0; +- for (i=0;iDataTransferElementCount;i++) { +- if (ElementStatus->DataTransferElementFull[i]) { ++ empty_idx=0; ++ for (i = 0; i < ElementStatus->DataTransferElementCount; i++) { ++ if (ElementStatus->DataTransferElementFull[i] && ++ ElementStatus->DataTransferElementSourceStorageElementNumber[i] < 0) { + #ifdef DEBUG_TAPELIST +- fprintf(stderr,"for drive %d, changing source %d to %d (empty slot #%d)\n", +- i, +- ElementStatus->DataTransferElementSourceStorageElementNumber[i], +- EmptyStorageElementAddress[empty_idx], +- empty_idx); ++ fprintf(stderr,"for drive %d, changing to %d (empty slot #%d)\n", ++ i, ++ EmptyStorageElementAddress[empty_idx], ++ empty_idx); + #endif + + ElementStatus->DataTransferElementSourceStorageElementNumber[i]= + EmptyStorageElementAddress[empty_idx++]; +- } + } + } + +@@ -1337,9 +1326,9 @@ + CDB[2] = (ElementStatus->TransportElementAddress >> 8) & 0xFF; /* Transport Element Address MSB */ + CDB[3] = (ElementStatus->TransportElementAddress) & 0xff; /* Transport Element Address LSB */ + CDB[4] = (SourceAddress >> 8) & 0xFF; /* Source Address MSB */ +- CDB[5] = SourceAddress & 0xFF; /* Source Address MSB */ ++ CDB[5] = SourceAddress & 0xFF; /* Source Address LSB */ + CDB[6] = (DestinationAddress >> 8) & 0xFF; /* Destination Address MSB */ +- CDB[7] = DestinationAddress & 0xFF; /* Destination Address MSB */ ++ CDB[7] = DestinationAddress & 0xFF; /* Destination Address LSB */ + CDB[8] = 0; /* Reserved */ + CDB[9] = 0; /* Reserved */ + if (flags->invert) { +@@ -1351,7 +1340,11 @@ + CDB[11] = 0 | (flags->eepos <<6); /* Control */ + + if (SCSI_ExecuteCommand(MediumChangerFD, Output, &CDB, 12, +- NULL, 0, RequestSense) != 0) { ++ NULL, 0, RequestSense) != 0) { ++ ++#ifdef DEBUG ++ fprintf(stderr, "Move Medium (0x%02X) failed\n", CDB[0]); ++#endif + return RequestSense; + } + free(RequestSense); +@@ -1372,9 +1365,9 @@ + CDB[2] = (ElementStatus->TransportElementAddress >> 8) & 0xFF; /* Transport Element Address MSB */ + CDB[3] = (ElementStatus->TransportElementAddress) & 0xff; /* Transport Element Address LSB */ + CDB[4] = (SourceAddress >> 8) & 0xFF; /* Source Address MSB */ +- CDB[5] = SourceAddress & 0xFF; /* Source Address MSB */ ++ CDB[5] = SourceAddress & 0xFF; /* Source Address LSB */ + CDB[6] = (DestinationAddress >> 8) & 0xFF; /* Destination Address MSB */ +- CDB[7] = DestinationAddress & 0xFF; /* Destination Address MSB */ ++ CDB[7] = DestinationAddress & 0xFF; /* Destination Address LSB */ + CDB[8] = (Dest2Address>>8) & 0xFF; /* move destination back to source? */ + CDB[9] = Dest2Address & 0xFF; /* move destination back to source? */ + CDB[10]=0; +@@ -1418,12 +1411,53 @@ + + if (SCSI_ExecuteCommand(MediumChangerFD, Output, &CDB, 6, + NULL, 0, RequestSense) != 0) { ++#ifdef DEBUG ++ fprintf(stderr, "Erase (0x19) failed\n"); ++#endif + return RequestSense; + } + free(RequestSense); + return NULL; /* Success! */ + } + ++static char Spaces[] = " "; ++ ++void PrintHex(int Indent, unsigned char *Buffer, int Length) ++{ ++ int idxBuffer; ++ int idxAscii; ++ int PadLength; ++ char cAscii; ++ ++ for (idxBuffer = 0; idxBuffer < Length; idxBuffer++) { ++ if ((idxBuffer % 16) == 0) { ++ if (idxBuffer > 0) { ++ fputc('\'', stderr); ++ ++ for (idxAscii = idxBuffer - 16; idxAscii < idxBuffer; idxAscii++) { ++ cAscii = Buffer[idxAscii] >= 0x20 && Buffer[idxAscii] < 0x7F ? Buffer[idxAscii] : '.'; ++ fputc(cAscii, stderr); ++ } ++ fputs("'\n", stderr); ++ } ++ fprintf(stderr, "%.*s%04X: ", Indent, Spaces, idxBuffer); ++ } ++ fprintf(stderr, "%02X ", (unsigned char)Buffer[idxBuffer]); ++ } ++ ++ PadLength = 16 - (Length % 16); ++ ++ if (PadLength > 0) { ++ fprintf(stderr, "%.*s'", 3 * PadLength, Spaces); ++ ++ for (idxAscii = idxBuffer - (16 - PadLength); idxAscii < idxBuffer; idxAscii++) { ++ cAscii = Buffer[idxAscii] >= 0x20 && Buffer[idxAscii] < 0x80 ? Buffer[idxAscii] : '.'; ++ fputc(cAscii, stderr); ++ } ++ fputs("'\n", stderr); ++ } ++ fflush(stderr); ++} + + #ifdef LONG_PRINT_REQUEST_SENSE + +@@ -1488,12 +1522,9 @@ + #else + void PrintRequestSense(RequestSense_T *RequestSense) + { +- int i; +- fprintf(stderr, "mtx: Request Sense: %02X", +- ((unsigned char *) RequestSense)[0]); +- for (i = 1; i < sizeof(RequestSense_T); i++) +- fprintf(stderr, " %02X", ((unsigned char *) RequestSense)[i]); +- fprintf(stderr, "\n"); ++ fprintf(stderr, "mtx: Request Sense: %02X\n", ++ ((unsigned char *) RequestSense)[0]); ++ PrintHex(2, (char *)RequestSense, sizeof(RequestSense_T)); + } + + #endif +Index: Makefile +=================================================================== +--- ../release/mtx-1.3.9/Makefile.in 2006-02-20 13:42:10.000000000 -0800 ++++ Makefile 2006-07-30 01:22:00.000000000 -0700 +@@ -11,26 +11,28 @@ + # Version # for 'make dist'... + VERSION=1.3.9 + +-BINS = mtx tapeinfo loaderinfo scsitape nsmhack ++BINS = mtx.exe tapeinfo.exe loaderinfo.exe scsitape.exe nsmhack.exe ++DBGS := $(BINS:%.exe=%.dbg) + +-TARGET = @TARGET@ +-CPU = @CPU@ +-CC = @CC@ +-INSTALL = @INSTALL@ +- +-CFLAGS = @CFLAGS@ +-CPPFLAGS = @CPPFLAGS@ -DVERSION="\"$(VERSION)\"" +-LDFLAGS = @LDFLAGS@ +-LIBS = @LIBS@ ++TARGET = mingw ++CPU = 386 ++CC = mingw32-gcc ++INSTALL = install -c ++ ++CFLAGS = -g -O2 ++CPPFLAGS = -DVERSION="\"$(VERSION)\"" ++LDFLAGS = ++LIBS = ++USE_OBJCOPY = yes + + INSTALL_DOC = $(INSTALL) -m 644 + INSTALL_BIN = $(INSTALL) -m 755 + INSTALL_DIR = $(INSTALL) -m 755 -d + +-prefix = @prefix@ +-exec_prefix = @exec_prefix@ +-sbindir = @sbindir@ +-mandir = @mandir@ ++prefix = dummy ++exec_prefix = ${prefix} ++sbindir = ${exec_prefix}/bin ++mandir = ${prefix}/man + + # + # Linux on x86... +@@ -40,6 +42,11 @@ + CPPFLAGS += -I/usr/src/linux/include -DLONG_PRINT_REQUEST_SENSE=1 + endif + ++ifeq ($(TARGET),mingw) ++CFLAGS += -Wall ++CPPFLAGS += -DLONG_PRINT_REQUEST_SENSE=1 ++endif ++ + # + # FreeBSD on x86... + # +@@ -82,12 +89,22 @@ + See vms/000readme for information. + endif + ++%.dbg : %.exe ++ifeq ($(USE_OBJCOPY),yes) ++ mingw32-objcopy --only-keep-debug $< $@ ++ mingw32-objcopy --strip-debug $< ++ mingw32-objcopy --add-gnu-debuglink=$@ $< ++else ++ strip $< -o $@ ++endif ++ + all: $(BINS) + +-install: $(BINS) ++dbgs: $(DBGS) ++ ++install: $(BINS) $(DBGS) + $(INSTALL_DIR) $(sbindir) + for file in $(BINS); do \ +- strip "$$file" ; \ + $(INSTALL_BIN) "$$file" $(sbindir) ; \ + done + $(INSTALL_DIR) $(mandir) $(mandir)/man1 +@@ -98,7 +115,9 @@ + clean: + rm -f *.o *~ + rm -f $(BINS) +- rm -f mam2debug mam2debug2 ++ rm -f $(DBGS) ++ rm -f mam2debug.exe mam2debug2.exe ++ rm -rf autom4te.cache + + distclean: clean + rm -f Makefile config.log config.cache config.status +@@ -106,27 +125,26 @@ + dist: distclean + ./makedist $(VERSION) + +-loaderinfo: loaderinfo.o mtxl.o mtxl.h mtx.h $(EXTRA) +- $(CC) $(LDFLAGS) -o loaderinfo loaderinfo.o mtxl.o $(EXTRA) $(LIBS) +- ++loaderinfo.exe: loaderinfo.o mtxl.o mtxl.h mtx.h $(EXTRA) ++ $(CC) $(LDFLAGS) -o $@ loaderinfo.o mtxl.o $(EXTRA) $(LIBS) + +-nsmhack: nsmhack.o mtxl.o $(EXTRA) +- $(CC) $(LDFLAGS) -o nsmhack nsmhack.o mtxl.o $(EXTRA) $(LIBS) ++nsmhack.exe: nsmhack.o mtxl.o $(EXTRA) ++ $(CC) $(LDFLAGS) -o $@ nsmhack.o mtxl.o $(EXTRA) $(LIBS) + +-mtx: mtx.o mtxl.o mtxl.h mtx.h $(EXTRA) +- $(CC) $(LDFLAGS) -o mtx mtx.o mtxl.o $(EXTRA) $(LIBS) ++mtx.exe: mtx.o mtxl.o mtxl.h mtx.h $(EXTRA) ++ $(CC) $(LDFLAGS) -o $@ mtx.o mtxl.o $(EXTRA) $(LIBS) + +-mam2debug: mtxl.o mam2debug.o mtx.h $(EXTRA) +- $(CC) $(LDFLAGS) -o mam2debug mtxl.o mam2debug.o $(EXTRA) $(LIBS) ++mam2debug.exe: mtxl.o mam2debug.o mtx.h $(EXTRA) ++ $(CC) $(LDFLAGS) -o $@ mtxl.o mam2debug.o $(EXTRA) $(LIBS) + +-tapeinfo: tapeinfo.o mtxl.o mtx.h mtxl.h $(EXTRA) +- $(CC) $(LDFLAGS) -o tapeinfo tapeinfo.o mtxl.o $(EXTRA) $(LIBS) ++tapeinfo.exe: tapeinfo.o mtxl.o mtx.h mtxl.h $(EXTRA) ++ $(CC) $(LDFLAGS) -o $@ tapeinfo.o mtxl.o $(EXTRA) $(LIBS) + +-mam2debug2: mtxl.o mam2debug2.o mtx.h $(EXTRA) +- $(CC) $(LDFLAGS) -o mam2debug2 mtxl.o mam2debug2.o $(EXTRA) $(LIBS) ++mam2debug2.exe: mtxl.o mam2debug2.o mtx.h $(EXTRA) ++ $(CC) $(LDFLAGS) -o $@ mtxl.o mam2debug2.o $(EXTRA) $(LIBS) + +-scsitape: scsitape.o mtxl.o mtxl.h mtx.h $(EXTRA) +- $(CC) $(LDFLAGS) -o scsitape scsitape.o mtxl.o $(EXTRA) $(LIBS) ++scsitape.exe: scsitape.o mtxl.o mtxl.h mtx.h $(EXTRA) ++ $(CC) $(LDFLAGS) -o $@ scsitape.o mtxl.o $(EXTRA) $(LIBS) + + scsitape.o: scsitape.c mtx.h mtxl.h + +@@ -140,6 +158,6 @@ + + mtx.o: mtx.c mtx.h mtxl.h + +-mtxl.o: mtxl.c mtx.h mtxl.h scsi_linux.c ++mtxl.o: mtxl.c mtx.h mtxl.h scsi_linux.c scsi_win32.c + + nsmhack.o: nsmhack.c mtxl.h mtx.h diff --git a/bacula/src/win32/patches/nsis.patch b/bacula/src/win32/patches/nsis.patch new file mode 100644 index 0000000000..0a37cd7c22 --- /dev/null +++ b/bacula/src/win32/patches/nsis.patch @@ -0,0 +1,428 @@ +Index: SCons/Config/gnu +--- ../release/nsis-2.17-src/SCons/Config/gnu 2006-04-28 08:54:41.000000000 -0700 ++++ SCons/Config/gnu 2006-08-07 18:49:47.000000000 -0700 +@@ -65,7 +65,7 @@ + cross_env(stub_env) + + if not defenv['DEBUG']: +- stub_env.Append(CCFLAGS = '-Os') # optimize for size ++ stub_env.Append(CCFLAGS = '-Os -fno-strict-aliasing') # optimize for size + stub_env.Append(CCFLAGS = '-Wall') # all warnings + stub_env.Append(CCFLAGS = '-x c') # force compile as c + +@@ -82,8 +82,8 @@ + makensis_env = defenv.Copy() + + if not defenv['DEBUG']: +- makensis_env.Append(CCFLAGS = '-O2') # optimize ++ makensis_env.Append(CCFLAGS = '-O2 -fno-strict-aliasing') # optimize + makensis_env.Append(CCFLAGS = '-Wall') # all warnings + + conf = FlagsConfigure(makensis_env) + conf.CheckLinkFlag('$MAP_FLAG') # generate map file +@@ -97,7 +97,7 @@ + cross_env(plugin_env) + + if not defenv['DEBUG']: +- plugin_env.Append(CCFLAGS = '-Os') # optimize for size ++ plugin_env.Append(CCFLAGS = '-Os -fno-strict-aliasing') # optimize for size + plugin_env.Append(CCFLAGS = '-Wall') # level 3 warnings + + if not defenv['DEBUG']: +@@ -111,7 +111,7 @@ + cp_util_env = defenv.Copy() + + if not defenv['DEBUG']: +- cp_util_env.Append(CCFLAGS = '-O2') # optimize ++ cp_util_env.Append(CCFLAGS = '-O2 -fno-strict-aliasing') # optimize + cp_util_env.Append(CCFLAGS = '-Wall') # all warnings + + conf = FlagsConfigure(cp_util_env) +Index: Source/build.cpp +--- ../release/nsis-2.17-src/Source/build.cpp 2006-04-14 03:05:01.000000000 -0700 ++++ ./Source/build.cpp 2006-07-31 13:26:38.000000000 -0700 +@@ -2384,7 +2384,7 @@ + return PS_ERROR; + } + #ifdef NSIS_CONFIG_CRC_SUPPORT +- crc_writer_sink crc_sink((unsigned long *) &crc); ++ crc_writer_sink crc_sink((unsigned int *) &crc); + firstheader_writer w(&crc_sink); + w.write(&fh); + +Index: Source/build.h +--- ../release/nsis-2.17-src/Source/build.h 2005-04-02 04:04:06.000000000 -0800 ++++ ./Source/build.h 2006-07-31 13:28:44.000000000 -0700 +@@ -38,7 +38,7 @@ + #ifdef NSIS_CONFIG_CRC_SUPPORT + extern "C" + { +- unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len); ++ unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len); + }; + #endif + +Index: Source/crc32.c +--- ../release/nsis-2.17-src/Source/crc32.c 2004-03-12 12:43:54.000000000 -0800 ++++ ./Source/crc32.c 2006-07-31 13:27:12.000000000 -0700 +@@ -3,18 +3,18 @@ + #ifdef NSIS_CONFIG_CRC_SUPPORT + + // this is based on the (slow,small) CRC32 implementation from zlib. +-unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len) ++unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len) + { +- static unsigned long crc_table[256]; ++ static unsigned int crc_table[256]; + + if (!crc_table[1]) + { +- unsigned long c; ++ unsigned int c; + int n, k; + + for (n = 0; n < 256; n++) + { +- c = (unsigned long)n; ++ c = (unsigned int)n; + for (k = 0; k < 8; k++) c = (c >> 1) ^ (c & 1 ? 0xedb88320L : 0); + crc_table[n] = c; + } +Index: Source/DialogTemplate.cpp +--- ../release/nsis-2.17-src/Source/DialogTemplate.cpp 2006-03-24 10:36:24.000000000 -0800 ++++ ./Source/DialogTemplate.cpp 2006-07-31 05:48:44.000000000 -0700 +@@ -93,7 +93,7 @@ + if (IS_INTRESOURCE(x)) { \ + *(WORD*)seeker = 0xFFFF; \ + seeker += sizeof(WORD); \ +- *(WORD*)seeker = ConvertEndianness(WORD(DWORD(x))); \ ++ *(WORD*)seeker = ConvertEndianness(WORD(ULONG_PTR(x))); \ + seeker += sizeof(WORD); \ + } \ + else { \ +@@ -629,7 +629,7 @@ + } + } + +- assert((DWORD) seeker - (DWORD) pbDlg == dwSize); ++ assert((ULONG_PTR) seeker - (ULONG_PTR) pbDlg == dwSize); + + // DONE! + return pbDlg; +Index: Source/exehead/fileform.c +--- ../release/nsis-2.17-src/Source/exehead/fileform.c 2005-09-09 09:08:44.000000000 -0700 ++++ ./Source/exehead/fileform.c 2006-07-31 13:26:08.000000000 -0700 +@@ -95,7 +95,7 @@ + static z_stream g_inflate_stream; + #endif + +-extern unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len); ++extern unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len); + + const char * NSISCALL loadHeaders(int cl_flags) + { +Index: Source/Platform.h +--- ../release/nsis-2.17-src/Source/Platform.h 2006-05-03 08:43:54.000000000 -0700 ++++ ./Source/Platform.h 2006-07-31 05:48:44.000000000 -0700 +@@ -16,15 +16,15 @@ + // basic types + typedef unsigned char BYTE, *PBYTE, *LPBYTE; + typedef unsigned short WORD, *LPWORD; +-typedef unsigned long DWORD, *LPDWORD; ++typedef unsigned int DWORD, *LPDWORD; + typedef short SHORT; + typedef unsigned short USHORT; + typedef unsigned int UINT; + typedef unsigned int UINT32; + typedef int INT; + typedef int INT32; +-typedef long LONG; +-typedef unsigned long ULONG; ++typedef int LONG; ++typedef unsigned int ULONG; + typedef long long INT64, LARGE_INTEGER; + typedef unsigned long long UINT64, ULARGE_INTEGER; + typedef int BOOL, *LPBOOL; +@@ -35,13 +35,14 @@ + typedef const char *LPCCH, *PCSTR, *LPCSTR; + typedef unsigned short WCHAR, *PWCHAR, *LPWCH, *PWCH, *NWPSTR, *LPWSTR, *PWSTR; + typedef const unsigned short *LPCWCH, *PCWCH, *LPCWSTR, *PCWSTR; +-typedef unsigned int UINT_PTR; ++typedef unsigned long UINT_PTR; ++typedef unsigned long ULONG_PTR; + // basic stuff + typedef void * HANDLE; +-typedef unsigned long HKEY; ++typedef unsigned int HKEY; + // some gdi +-typedef unsigned long COLORREF; +-typedef unsigned long HBRUSH; ++typedef unsigned int COLORREF; ++typedef unsigned int HBRUSH; + // bool + # define FALSE 0 + # define TRUE 1 +@@ -129,13 +130,13 @@ + + #ifndef _WIN32 + # ifndef FIELD_OFFSET +-# define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f)) ++# define FIELD_OFFSET(t,f) ((ULONG_PTR)&(((t*)0)->f)) + # endif + # ifndef MAKEINTRESOURCE + # define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i))) + # endif + # ifndef IMAGE_FIRST_SECTION +-# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (DWORD) h + \ ++# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (ULONG_PTR) h + \ + FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader) + \ + FIX_ENDIAN_INT16(PIMAGE_NT_HEADERS(h)->FileHeader.SizeOfOptionalHeader) ) ) + # endif +@@ -166,9 +167,9 @@ + # define FOF_NOERRORUI 0x0400 + #endif + +-#ifndef ULONG_PTR +-# define ULONG_PTR DWORD +-#endif ++//#ifndef ULONG_PTR ++//# define ULONG_PTR ULONG ++//#endif + + #ifndef IDC_HAND + # define IDC_HAND MAKEINTRESOURCE(32649) +Index: Source/Plugins.cpp +--- ../release/nsis-2.17-src/Source/Plugins.cpp 2006-04-05 11:42:12.000000000 -0700 ++++ ./Source/Plugins.cpp 2006-07-31 06:50:08.000000000 -0700 +@@ -120,8 +120,8 @@ + DWORD prd = FIX_ENDIAN_INT32(sections[i].PointerToRawData); + PIMAGE_EXPORT_DIRECTORY exports = PIMAGE_EXPORT_DIRECTORY(&dlldata[0] + prd + ExportDirVA - va); + DWORD na = FIX_ENDIAN_INT32(exports->AddressOfNames); +- unsigned long *names = (unsigned long*)((unsigned long) exports + (char *) na - ExportDirVA); +- for (unsigned long j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++) ++ unsigned int *names = (unsigned int*)((unsigned long) exports + (char *) na - ExportDirVA); ++ for (unsigned int j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++) + { + const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA); + const string signature = dllName + "::" + name; +Index: Source/ResourceEditor.cpp +--- ../release/nsis-2.17-src/Source/ResourceEditor.cpp 2006-04-05 11:40:09.000000000 -0700 ++++ ./Source/ResourceEditor.cpp 2006-07-31 05:48:44.000000000 -0700 +@@ -545,7 +545,7 @@ + rdDir.NumberOfIdEntries = ConvertEndianness(rdDir.NumberOfIdEntries); + + CopyMemory(seeker, &rdDir, sizeof(IMAGE_RESOURCE_DIRECTORY)); +- crd->m_dwWrittenAt = DWORD(seeker); ++ crd->m_dwWrittenAt = ULONG_PTR(seeker); + seeker += sizeof(IMAGE_RESOURCE_DIRECTORY); + + for (int i = 0; i < crd->CountEntries(); i++) { +@@ -566,7 +566,7 @@ + rDirE.NameString.NameIsString = (crd->GetEntry(i)->HasName()) ? 1 : 0; + + CopyMemory(seeker, &rDirE, sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY)); +- crd->GetEntry(i)->m_dwWrittenAt = DWORD(seeker); ++ crd->GetEntry(i)->m_dwWrittenAt = ULONG_PTR(seeker); + seeker += sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY); + } + qDirs.pop(); +@@ -582,7 +582,7 @@ + rDataE.Size = ConvertEndianness(cRDataE->GetSize()); + + CopyMemory(seeker, &rDataE, sizeof(IMAGE_RESOURCE_DATA_ENTRY)); +- cRDataE->m_dwWrittenAt = DWORD(seeker); ++ cRDataE->m_dwWrittenAt = ULONG_PTR(seeker); + seeker += sizeof(IMAGE_RESOURCE_DATA_ENTRY); + + qDataEntries.pop(); +@@ -594,7 +594,7 @@ + while (!qStrings.empty()) { + CResourceDirectoryEntry* cRDirE = qStrings.front(); + +- PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(seeker) - DWORD(pbRsrcSec)); ++ PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(ULONG_PTR(seeker) - ULONG_PTR(pbRsrcSec))); + + char* szName = cRDirE->GetName(); + WORD iLen = strlen(szName) + 1; +@@ -626,7 +626,7 @@ + while (!qDataEntries2.empty()) { + CResourceDataEntry* cRDataE = qDataEntries2.front(); + CopyMemory(seeker, cRDataE->GetData(), cRDataE->GetSize()); +- PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(seeker - pbRsrcSec + m_dwResourceSectionVA); ++ PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(DWORD(seeker - pbRsrcSec + m_dwResourceSectionVA)); + + seeker += RALIGN(cRDataE->GetSize(), 8); + +@@ -636,7 +636,7 @@ + /* + * Set all of the directory entries offsets. + */ +- SetOffsets(m_cResDir, DWORD(pbRsrcSec)); ++ SetOffsets(m_cResDir, ULONG_PTR(pbRsrcSec)); + } + + // Sets the offsets in directory entries +@@ -650,7 +650,7 @@ + SetOffsets(resDir->GetEntry(i)->GetSubDirectory(), newResDirAt); + } + else { +- rde->OffsetToData = ConvertEndianness(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt); ++ rde->OffsetToData = ConvertEndianness(DWORD(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt)); + } + } + } +@@ -758,7 +758,7 @@ + // Returns -1 if can not be found + int CResourceDirectory::Find(char* szName) { + if (IS_INTRESOURCE(szName)) +- return Find((WORD) (DWORD) szName); ++ return Find((WORD) (ULONG_PTR) szName); + else + if (szName[0] == '#') + return Find(WORD(atoi(szName + 1))); +@@ -836,7 +836,7 @@ + if (IS_INTRESOURCE(szName)) { + m_bHasName = false; + m_szName = 0; +- m_wId = (WORD) (DWORD) szName; ++ m_wId = (WORD) (ULONG_PTR) szName; + } + else { + m_bHasName = true; +@@ -851,7 +851,7 @@ + if (IS_INTRESOURCE(szName)) { + m_bHasName = false; + m_szName = 0; +- m_wId = (WORD) (DWORD) szName; ++ m_wId = (WORD) (ULONG_PTR) szName; + } + else { + m_bHasName = true; +Index: Source/ResourceEditor.h +--- ../release/nsis-2.17-src/Source/ResourceEditor.h 2006-04-28 08:54:42.000000000 -0700 ++++ ./Source/ResourceEditor.h 2006-07-31 05:48:44.000000000 -0700 +@@ -173,7 +173,7 @@ + + void Destroy(); + +- DWORD m_dwWrittenAt; ++ ULONG_PTR m_dwWrittenAt; + + private: + IMAGE_RESOURCE_DIRECTORY m_rdDir; +@@ -197,7 +197,7 @@ + + CResourceDataEntry* GetDataEntry(); + +- DWORD m_dwWrittenAt; ++ ULONG_PTR m_dwWrittenAt; + + private: + bool m_bHasName; +@@ -226,7 +226,7 @@ + DWORD GetSize(); + DWORD GetCodePage(); + +- DWORD m_dwWrittenAt; ++ ULONG_PTR m_dwWrittenAt; + + private: + BYTE* m_pbData; +Index: Source/script.cpp +--- ../release/nsis-2.17-src/Source/script.cpp 2006-03-28 10:22:34.000000000 -0800 ++++ ./Source/script.cpp 2006-07-31 20:56:03.000000000 -0700 +@@ -4748,8 +4748,8 @@ + { + struct + { +- long l; +- long h; ++ int l; ++ int h; + } words; + long long ll; + }; +@@ -6075,8 +6075,8 @@ + { + struct + { +- long l; +- long h; ++ int l; ++ int h; + } words; + long long ll; + }; +Index: Source/util.cpp +--- ../release/nsis-2.17-src/Source/util.cpp 2006-04-28 08:54:42.000000000 -0700 ++++ ./Source/util.cpp 2006-07-31 05:48:44.000000000 -0700 +@@ -312,7 +312,7 @@ + FIX_ENDIAN_INT32_INPLACE(rdEntry.OffsetToData); + MY_ASSERT(!rdEntry.DirectoryOffset.DataIsDirectory, "bad resource directory"); + +- PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot)); ++ PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + ULONG_PTR(rdRoot)); + + MY_ASSERT((size_t)rdIcons - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer"); + +@@ -325,7 +325,7 @@ + FIX_ENDIAN_INT32_INPLACE(icoEntry.OffsetToData); + + MY_ASSERT(!icoEntry.DirectoryOffset.DataIsDirectory, "bad resource directory"); +- PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot)); ++ PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + ULONG_PTR(rdRoot)); + + MY_ASSERT((size_t)rd - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer"); + +@@ -334,7 +334,7 @@ + + MY_ASSERT(datEntry.DirectoryOffset.DataIsDirectory, "bad resource directory"); + +- PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + DWORD(rdRoot)); ++ PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + ULONG_PTR(rdRoot)); + + MY_ASSERT((size_t)rde - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer"); + +@@ -355,10 +355,10 @@ + } + + // Set offset +- DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + DWORD(rdRoot) - dwResourceSectionVA - DWORD(exeHeader); ++ DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + ULONG_PTR(rdRoot) - dwResourceSectionVA - ULONG_PTR(exeHeader); + *(LPDWORD) seeker = FIX_ENDIAN_INT32(dwOffset); + +- MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (DWORD)rdRoot - (DWORD)exeHeader, "invalid data offset - icon resource probably compressed"); ++ MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (ULONG_PTR)rdRoot - (ULONG_PTR)exeHeader, "invalid data offset - icon resource probably compressed"); + } + + LPBYTE seeker = uninstIconData; +Index: Source/writer.cpp +--- ../release/nsis-2.17-src/Source/writer.cpp 2006-03-11 03:13:07.000000000 -0800 ++++ ./Source/writer.cpp 2006-07-31 13:27:37.000000000 -0700 +@@ -64,7 +64,7 @@ + } + + #ifdef NSIS_CONFIG_CRC_SUPPORT +-extern "C" unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len); ++extern "C" unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len); + + void crc_writer_sink::write_data(const void *data, const size_t size) + { +Index: Source/writer.h +--- ../release/nsis-2.17-src/Source/writer.h 2006-03-11 03:13:07.000000000 -0800 ++++ ./Source/writer.h 2006-07-31 13:27:58.000000000 -0700 +@@ -57,12 +57,12 @@ + #ifdef NSIS_CONFIG_CRC_SUPPORT + class crc_writer_sink : public writer_sink { + public: +- crc_writer_sink(unsigned long *crc) : m_crc(crc) {} ++ crc_writer_sink(unsigned int *crc) : m_crc(crc) {} + + virtual void write_data(const void *data, const size_t size); + + private: +- unsigned long *m_crc; ++ unsigned int *m_crc; + + }; + #endif diff --git a/bacula/src/win32/patches/openssl-w64.patch b/bacula/src/win32/patches/openssl-w64.patch new file mode 100644 index 0000000000..2c75428595 --- /dev/null +++ b/bacula/src/win32/patches/openssl-w64.patch @@ -0,0 +1,2663 @@ +diff -Naur ../openssl-0.9.8j/Configure ./Configure +--- ../openssl-0.9.8j/Configure 2008-12-29 01:18:23.000000000 +0100 ++++ ./Configure 2009-01-08 10:24:35.000000000 +0100 +@@ -477,6 +477,8 @@ + # MinGW + "mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a", + ++"mingw64", "mingw32-gcc:-mno-cygwin -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -Wall -D_WIN32_WINNT=0x333:::MINGW64:-lws2_32 -lgdi32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a", ++ + # UWIN + "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32", + +@@ -1055,7 +1057,7 @@ + + $no_shared = 0 if ($fipsdso && !$IsMK1MF); + +-$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw"); ++$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/); + $exe_ext=".nlm" if ($target =~ /netware/); + $exe_ext=".pm" if ($target =~ /vos/); + if ($openssldir eq "" and $prefix eq "") +@@ -1501,6 +1503,7 @@ + s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/; + s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/; + s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_FIPS) \$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared); ++ s/^DIRS= crypto ssl engines apps test tools/DIRS= crypto ssl apps test tools/ if ($disabled{'hw'}); + if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/) + { + my $sotmp = $1; +diff -Naur ../openssl-0.9.8j/Configure.orig ./Configure.orig +--- ../openssl-0.9.8j/Configure.orig 1970-01-01 01:00:00.000000000 +0100 ++++ ./Configure.orig 2008-12-29 01:18:23.000000000 +0100 +@@ -0,0 +1,2030 @@ ++: ++eval 'exec perl -S $0 ${1+"$@"}' ++ if $running_under_some_shell; ++## ++## Configure -- OpenSSL source tree configuration script ++## ++ ++require 5.000; ++eval 'use strict;'; ++ ++print STDERR "Warning: perl module strict not found.\n" if ($@); ++ ++# see INSTALL for instructions. ++ ++my $usage="Usage: Configure [no- ...] [enable- ...] [experimental- ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [enable-montasm] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n"; ++ ++# Options: ++# ++# --openssldir install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the ++# --prefix option is given; /usr/local/ssl otherwise) ++# --prefix prefix for the OpenSSL include, lib and bin directories ++# (Default: the OPENSSLDIR directory) ++# ++# --install_prefix Additional prefix for package builders (empty by ++# default). This needn't be set in advance, you can ++# just as well use "make INSTALL_PREFIX=/whatever install". ++# ++# --with-krb5-dir Declare where Kerberos 5 lives. The libraries are expected ++# to live in the subdirectory lib/ and the header files in ++# include/. A value is required. ++# --with-krb5-lib Declare where the Kerberos 5 libraries live. A value is ++# required. ++# (Default: KRB5_DIR/lib) ++# --with-krb5-include Declare where the Kerberos 5 header files live. A ++# value is required. ++# (Default: KRB5_DIR/include) ++# --with-krb5-flavor Declare what flavor of Kerberos 5 is used. Currently ++# supported values are "MIT" and "Heimdal". A value is required. ++# ++# --test-sanity Make a number of sanity checks on the data in this file. ++# This is a debugging tool for OpenSSL developers. ++# ++# no-hw-xxx do not compile support for specific crypto hardware. ++# Generic OpenSSL-style methods relating to this support ++# are always compiled but return NULL if the hardware ++# support isn't compiled. ++# no-hw do not compile support for any crypto hardware. ++# [no-]threads [don't] try to create a library that is suitable for ++# multithreaded applications (default is "threads" if we ++# know how to do it) ++# [no-]shared [don't] try to create shared libraries when supported. ++# no-asm do not use assembler ++# no-dso do not compile in any native shared-library methods. This ++# will ensure that all methods just return NULL. ++# no-krb5 do not compile in any KRB5 library or code. ++# [no-]zlib [don't] compile support for zlib compression. ++# zlib-dynamic Like "zlib", but the zlib library is expected to be a shared ++# library and will be loaded in run-time by the OpenSSL library. ++# enable-montasm 0.9.8 branch only: enable Montgomery x86 assembler backport ++# from 0.9.9 ++# 386 generate 80386 code ++# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2 ++# no- build without specified algorithm (rsa, idea, rc5, ...) ++# - + compiler options are passed through ++# ++# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items ++# provided to stack calls. Generates unique stack functions for ++# each possible stack type. ++# DES_PTR use pointer lookup vs arrays in the DES in crypto/des/des_locl.h ++# DES_RISC1 use different DES_ENCRYPT macro that helps reduce register ++# dependancies but needs to more registers, good for RISC CPU's ++# DES_RISC2 A different RISC variant. ++# DES_UNROLL unroll the inner DES loop, sometimes helps, somtimes hinders. ++# DES_INT use 'int' instead of 'long' for DES_LONG in crypto/des/des.h ++# This is used on the DEC Alpha where long is 8 bytes ++# and int is 4 ++# BN_LLONG use the type 'long long' in crypto/bn/bn.h ++# MD2_CHAR use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h ++# MD2_LONG use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h ++# IDEA_SHORT use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h ++# IDEA_LONG use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h ++# RC2_SHORT use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h ++# RC2_LONG use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h ++# RC4_CHAR use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h ++# RC4_LONG use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h ++# RC4_INDEX define RC4_INDEX in crypto/rc4/rc4_locl.h. This turns on ++# array lookups instead of pointer use. ++# RC4_CHUNK enables code that handles data aligned at long (natural CPU ++# word) boundary. ++# RC4_CHUNK_LL enables code that handles data aligned at long long boundary ++# (intended for 64-bit CPUs running 32-bit OS). ++# BF_PTR use 'pointer arithmatic' for Blowfish (unsafe on Alpha). ++# BF_PTR2 intel specific version (generic version is more efficient). ++# ++# Following are set automatically by this script ++# ++# MD5_ASM use some extra md5 assember, ++# SHA1_ASM use some extra sha1 assember, must define L_ENDIAN for x86 ++# RMD160_ASM use some extra ripemd160 assember, ++# SHA256_ASM sha256_block is implemented in assembler ++# SHA512_ASM sha512_block is implemented in assembler ++# AES_ASM ASE_[en|de]crypt is implemented in assembler ++ ++my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL"; ++ ++# MD2_CHAR slags pentium pros ++my $x86_gcc_opts="RC4_INDEX MD2_INT"; ++ ++# MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT ++# Don't worry about these normally ++ ++my $tcc="cc"; ++my $tflags="-fast -Xa"; ++my $tbn_mul=""; ++my $tlib="-lnsl -lsocket"; ++#$bits1="SIXTEEN_BIT "; ++#$bits2="THIRTY_TWO_BIT "; ++my $bits1="THIRTY_TWO_BIT "; ++my $bits2="SIXTY_FOUR_BIT "; ++ ++my $x86_elf_asm="x86cpuid-elf.o:bn86-elf.o co86-elf.o MAYBE-MO86-elf.o:dx86-elf.o yx86-elf.o:ax86-elf.o:bx86-elf.o:mx86-elf.o:sx86-elf.o s512sse2-elf.o:cx86-elf.o:rx86-elf.o rc4_skey.o:rm86-elf.o:r586-elf.o"; ++my $x86_coff_asm="x86cpuid-cof.o:bn86-cof.o co86-cof.o MAYBE-MO86-cof.o:dx86-cof.o yx86-cof.o:ax86-cof.o:bx86-cof.o:mx86-cof.o:sx86-cof.o s512sse2-cof.o:cx86-cof.o:rx86-cof.o rc4_skey.o:rm86-cof.o:r586-cof.o"; ++my $x86_out_asm="x86cpuid-out.o:bn86-out.o co86-out.o MAYBE-MO86-out.o:dx86-out.o yx86-out.o:ax86-out.o:bx86-out.o:mx86-out.o:sx86-out.o s512sse2-out.o:cx86-out.o:rx86-out.o rc4_skey.o:rm86-out.o:r586-out.o"; ++ ++my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o::"; ++my $ia64_asm=":bn-ia64.o::aes_core.o aes_cbc.o aes-ia64.o:::sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o::"; ++ ++my $no_asm="::::::::::"; ++ ++# As for $BSDthreads. Idea is to maintain "collective" set of flags, ++# which would cover all BSD flavors. -pthread applies to them all, ++# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD ++# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r, ++# which has to be accompanied by explicit -D_THREAD_SAFE and ++# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which ++# seems to be sufficient? ++my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT"; ++ ++#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags ++ ++my %table=( ++# File 'TABLE' (created by 'make TABLE') contains the data from this list, ++# formatted for better readability. ++ ++ ++#"b", "${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::", ++#"bl-4c-2c", "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::", ++#"bl-4c-ri", "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::", ++#"b2-is-ri-dp", "${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::", ++ ++# Our development configs ++"purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::", ++"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::", ++"debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::bn86-elf.o co86-elf.o", ++"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", ++"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", ++"debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::::", ++"debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::", ++"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", ++"debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", ++"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll", ++"debug-steve64", "gcc:-m64 -DL_ENDIAN -DTERMIO -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -DOPENSSL_NO_DEPRECATED -g -pedantic -Wall -Werror -Wno-long-long -Wsign-compare -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-steve32", "gcc:-m32 -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -DOPENSSL_NO_DEPRECATED -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared", ++"debug-steve-opt", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -O3 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared", ++"debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared", ++"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-geoff","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", ++"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", ++"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"dist", "cc:-O::(unknown)::::::", ++ ++# Basic configs that should work on any (32 and less bit) box ++"gcc", "gcc:-O3::(unknown):::BN_LLONG:::", ++"cc", "cc:-O::(unknown)::::::", ++ ++####VOS Configurations ++"vos-gcc","gcc:-O3 -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", ++"debug-vos-gcc","gcc:-O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", ++ ++#### Solaris x86 with GNU C setups ++# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it ++# here because whenever GNU C instantiates an assembler template it ++# surrounds it with #APP #NO_APP comment pair which (at least Solaris ++# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic" ++# error message. ++"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -march=pentium -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# -shared -static-libgcc might appear controversial, but modules taken ++# from static libgcc do not have relocations and linking them into our ++# shared objects doesn't have any negative side-effects. On the contrary, ++# doing so makes it possible to use gcc shared build with Sun C. Given ++# that gcc generates faster code [thanks to inline assembler], I would ++# actually recommend to consider using gcc shared build even with vendor ++# compiler:-) ++# ++"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++#### Solaris x86 with Sun C setups ++"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++#### SPARC Solaris with GNU C setups ++"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc ++"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++#### ++"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++#### SPARC Solaris with Sun C setups ++# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2. ++# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8 ++# SC5.0 note: Compiler common patch 107357-01 or later is required! ++"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs", ++#### ++"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++#### SunOS configs, assuming sparc for the gcc one. ++#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::", ++"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::", ++ ++#### IRIX 5.x configs ++# -mips2 flag is added by ./config when appropriate. ++"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${no_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++#### IRIX 6.x configs ++# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke ++# './Configure irix-cc -o32' manually. ++"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# N64 ABI builds. ++"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++#### Unified HP-UX ANSI C configs. ++# Special notes: ++# - Originally we were optimizing at +O4 level. It should be noted ++# that the only difference between +O3 and +O4 is global inter- ++# procedural analysis. As it has to be performed during the link ++# stage the compiler leaves behind certain pseudo-code in lib*.a ++# which might be release or even patch level specific. Generating ++# the machine code for and analyzing the *whole* program appears ++# to be *extremely* memory demanding while the performance gain is ++# actually questionable. The situation is intensified by the default ++# HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB ++# which is way too low for +O4. In other words, doesn't +O3 make ++# more sense? ++# - Keep in mind that the HP compiler by default generates code ++# suitable for execution on the host you're currently compiling at. ++# If the toolkit is ment to be used on various PA-RISC processors ++# consider './config +DAportable'. ++# - +DD64 is chosen in favour of +DA2.0W because it's meant to be ++# compatible with *future* releases. ++# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to ++# pass -D_REENTRANT on HP-UX 10 and later. ++# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in ++# 32-bit message digests. (For the moment of this writing) HP C ++# doesn't seem to "digest" too many local variables (they make "him" ++# chew forever:-). For more details look-up MD32_XARRAY comment in ++# crypto/sha/sha_lcl.h. ++# ++# ++# Since there is mention of this in shlib/hpux10-cc.sh ++"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"hpux-parisc2-gcc","gcc:-march=2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1::pa-risc2.o::::::::::dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++# More attempts at unified 10.X and 11.X targets for HP C compiler. ++# ++# Chris Ruemmler ++# Kevin Steves ++"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"hpux-parisc1_0-cc","cc:+DAportable +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2.o::::::::::dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++# HP/UX IA-64 targets ++"hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# Frank Geurts has patiently assisted with ++# with debugging of the following config. ++"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# GCC builds... ++"hpux-ia64-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"hpux64-ia64-gcc","gcc:-mlp64 -O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-mlp64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++# Legacy HPUX 9.X configs... ++"hpux-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O2 -z::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"hpux-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++#### HP MPE/iX http://jazz.external.hp.com/src/openssl/ ++"MPE/iX-gcc", "gcc:-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB::(unknown):MPE:-L/SYSLOG/PUB -lsyslog -lsocket -lcurses:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::", ++ ++# DEC Alpha OSF/1/Tru64 targets. ++# ++# "What's in a name? That which we call a rose ++# By any other word would smell as sweet." ++# ++# - William Shakespeare, "Romeo & Juliet", Act II, scene II. ++# ++# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version ++# ++"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${no_asm}:dlfcn:alpha-osf1-shared:::.so", ++"osf1-alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared:::.so", ++"tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared::-msym:.so", ++ ++#### ++#### Variety of LINUX:-) ++#### ++# *-generic* is endian-neutral target, but ./config is free to ++# throw in -D[BL]_ENDIAN, whichever appropriate... ++"linux-generic32","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc32.o::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++#### IA-32 targets... ++"linux-ia32-icc", "icc:-DL_ENDIAN -DTERMIO -O2 -no_cpprt::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}", ++#### ++"linux-generic64","gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-ppc64", "gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc64.o::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++#### SPARC Linux setups ++# Ray Miller has patiently ++# assisted with debugging of following two configs. ++"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# it's a real mess with -mcpu=ultrasparc option under Linux, but ++# -Wa,-Av8plus should do the trick no matter what. ++"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# GCC 3.1 is a requirement ++"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++#### Alpha Linux with GNU C and Compaq C setups ++# Special notes: ++# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you ++# ought to run './Configure linux-alpha+bwx-gcc' manually, do ++# complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever ++# which is appropriate. ++# - If you use ccc keep in mind that -fast implies -arch host and the ++# compiler is free to issue instructions which gonna make elder CPU ++# choke. If you wish to build "blended" toolkit, add -arch generic ++# *after* -fast and invoke './Configure linux-alpha-ccc' manually. ++# ++# ++# ++"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}", ++"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}", ++ ++#### *BSD [do see comment about ${BSDthreads} above!] ++"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-sparcv8", "gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it ++# simply *happens* to work around a compiler bug in gcc 3.3.3, ++# triggered by RIPEMD160 code. ++"BSD-sparc64", "gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-ia64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-x86_64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++"nextstep", "cc:-O -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", ++"nextstep3.3", "cc:-O3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", ++ ++# NCR MP-RAS UNIX ver 02.03.01 ++"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::", ++ ++# QNX ++"qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:", ++"qnx6", "cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:", ++ ++#### SCO/Caldera targets. ++# ++# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc. ++# Now we only have blended unixware-* as it's the only one used by ./config. ++# If you want to optimize for particular microarchitecture, bypass ./config ++# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate. ++# Note that not all targets include assembler support. Mostly because of ++# lack of motivation to support out-of-date platforms with out-of-date ++# compiler drivers and assemblers. Tim Rice has ++# patiently assisted to debug most of it. ++# ++# UnixWare 2.0x fails destest with -O. ++"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::", ++"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::", ++"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++# SCO 5 - Ben Laurie says the -O breaks the SCO cc. ++"sco5-cc", "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ ++#### IBM's AIX. ++"aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::", ++"aix-gcc", "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", ++"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64", ++# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE ++# at build time. $OBJECT_MODE is respected at ./config stage! ++"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", ++"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", ++ ++# ++# Cray T90 and similar (SDSC) ++# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT ++# defined. The T90 ints and longs are 8 bytes long, and apparently the ++# B_ENDIAN code assumes 4 byte ints. Fortunately, the non-B_ENDIAN and ++# non L_ENDIAN code aligns the bytes in each word correctly. ++# ++# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors: ++#'Taking the address of a bit field is not allowed. ' ++#'An expression with bit field exists as the operand of "sizeof" ' ++# (written by Wayne Schroeder ) ++# ++# j90 is considered the base machine type for unicos machines, ++# so this configuration is now called "cray-j90" ... ++"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::", ++ ++# ++# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov) ++# ++# The BIT_FIELD_LIMITS define was written for the C90 (it seems). I added ++# another use. Basically, the problem is that the T3E uses some bit fields ++# for some st_addr stuff, and then sizeof and address-of fails ++# I could not use the ams/alpha.o option because the Cray assembler, 'cam' ++# did not like it. ++"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::", ++ ++# DGUX, 88100. ++"dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::", ++"dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::", ++"dgux-R4-x86-gcc", "gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown)::-lnsl -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", ++ ++# Sinix/ReliantUNIX RM400 ++# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g */ ++"ReliantUNIX","cc:-KPIC -g -DTERMIOS -DB_ENDIAN::-Kthread:SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dlfcn:reliantunix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::", ++"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::", ++ ++# SIEMENS BS2000/OSD: an EBCDIC-based mainframe ++"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::", ++ ++# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe ++# You need to compile using the c89.sh wrapper in the tools directory, because the ++# IBM compiler does not like the -L switch after any object modules. ++# ++"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::", ++ ++# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64 ++"VC-WIN64I","cl::::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32", ++"VC-WIN64A","cl::::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32", ++ ++# Visual C targets ++"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32", ++"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32", ++"VC-WIN32","cl::::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32", ++ ++# Borland C++ 4.5 ++"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32", ++ ++# MinGW ++"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a", ++ ++# UWIN ++"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32", ++ ++# Cygwin ++"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32", ++"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_coff_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a", ++"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a", ++ ++# NetWare from David Ward (dsward@novell.com) ++# requires either MetroWerks NLM development tools, or gcc / nlmconv ++# NetWare defaults socket bio to WinSock sockets. However, ++# the builds can be configured to use BSD sockets instead. ++# netware-clib => legacy CLib c-runtime support ++"netware-clib", "mwccnlm::::::${x86_gcc_opts}::", ++"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::", ++"netware-clib-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -I/ndk/ws295sdk/include -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::", ++"netware-clib-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -DNETWARE_BSDSOCK -DNETDB_USE_INTERNET -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::", ++# netware-libc => LibC/NKS support ++"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::", ++"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::", ++"netware-libc-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -I/ndk/libc/include/winsock -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::", ++"netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::", ++ ++# DJGPP ++"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:", ++ ++# Ultrix from Bernhard Simon ++"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::", ++"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::", ++# K&R C is no longer supported; you need gcc on old Ultrix installations ++##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::", ++ ++##### MacOS X (a.k.a. Rhapsody or Darwin) setup ++"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::", ++"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc64.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -fomit-frame-pointer -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++ ++##### A/UX ++"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::", ++ ++##### Sony NEWS-OS 4.x ++"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::", ++ ++##### GNU Hurd ++"hurd-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC", ++ ++##### OS/2 EMX ++"OS2-EMX", "gcc::::::::", ++ ++##### VxWorks for various targets ++"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", ++"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::", ++"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::", ++"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", ++"vxworks-mipsle","ccmips:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -DL_ENDIAN -EL -Wl,-EL -mips2 -mno-branch-likely -G 0 -fno-builtin -msoft-float -DCPU=MIPS32 -DMIPSEL -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r::${no_asm}::::::ranlibmips:", ++ ++##### Compaq Non-Stop Kernel (Tandem) ++"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::", ++ ++); ++ ++my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A ++ VC-NT VC-CE VC-WIN32 ++ BC-32 OS2-EMX ++ netware-clib netware-clib-bsdsock ++ netware-libc netware-libc-bsdsock); ++ ++my $idx = 0; ++my $idx_cc = $idx++; ++my $idx_cflags = $idx++; ++my $idx_unistd = $idx++; ++my $idx_thread_cflag = $idx++; ++my $idx_sys_id = $idx++; ++my $idx_lflags = $idx++; ++my $idx_bn_ops = $idx++; ++my $idx_cpuid_obj = $idx++; ++my $idx_bn_obj = $idx++; ++my $idx_des_obj = $idx++; ++my $idx_aes_obj = $idx++; ++my $idx_bf_obj = $idx++; ++my $idx_md5_obj = $idx++; ++my $idx_sha1_obj = $idx++; ++my $idx_cast_obj = $idx++; ++my $idx_rc4_obj = $idx++; ++my $idx_rmd160_obj = $idx++; ++my $idx_rc5_obj = $idx++; ++my $idx_dso_scheme = $idx++; ++my $idx_shared_target = $idx++; ++my $idx_shared_cflag = $idx++; ++my $idx_shared_ldflag = $idx++; ++my $idx_shared_extension = $idx++; ++my $idx_ranlib = $idx++; ++my $idx_arflags = $idx++; ++ ++my $prefix=""; ++my $openssldir=""; ++my $exe_ext=""; ++my $install_prefix=""; ++my $fipslibdir="/usr/local/ssl/fips-1.0/lib/"; ++my $nofipscanistercheck=0; ++my $fipsdso=0; ++my $fipscanisterinternal="n"; ++my $baseaddr="0xFB00000"; ++my $no_threads=0; ++my $threads=0; ++my $no_shared=0; # but "no-shared" is default ++my $zlib=1; # but "no-zlib" is default ++my $no_krb5=0; # but "no-krb5" is implied unless "--with-krb5-..." is used ++my $no_rfc3779=1; # but "no-rfc3779" is default ++my $montasm=1; # but "no-montasm" is default ++my $no_asm=0; ++my $no_dso=0; ++my $no_gmp=0; ++my @skip=(); ++my $Makefile="Makefile"; ++my $des_locl="crypto/des/des_locl.h"; ++my $des ="crypto/des/des.h"; ++my $bn ="crypto/bn/bn.h"; ++my $md2 ="crypto/md2/md2.h"; ++my $rc4 ="crypto/rc4/rc4.h"; ++my $rc4_locl="crypto/rc4/rc4_locl.h"; ++my $idea ="crypto/idea/idea.h"; ++my $rc2 ="crypto/rc2/rc2.h"; ++my $bf ="crypto/bf/bf_locl.h"; ++my $bn_asm ="bn_asm.o"; ++my $des_enc="des_enc.o fcrypt_b.o"; ++my $fips_des_enc="fips_des_enc.o"; ++my $aes_enc="aes_core.o aes_cbc.o"; ++my $bf_enc ="bf_enc.o"; ++my $cast_enc="c_enc.o"; ++my $rc4_enc="rc4_enc.o rc4_skey.o"; ++my $rc5_enc="rc5_enc.o"; ++my $md5_obj=""; ++my $sha1_obj=""; ++my $rmd160_obj=""; ++my $processor=""; ++my $default_ranlib; ++my $perl; ++my $fips=0; ++ ++ ++# All of the following is disabled by default (RC5 was enabled before 0.9.8): ++ ++my %disabled = ( # "what" => "comment" [or special keyword "experimental"] ++ "camellia" => "default", ++ "capieng" => "default", ++ "cms" => "default", ++ "gmp" => "default", ++ "jpake" => "experimental", ++ "mdc2" => "default", ++ "montasm" => "default", # explicit option in 0.9.8 only (implicitly enabled in 0.9.9) ++ "rc5" => "default", ++ "rfc3779" => "default", ++ "seed" => "default", ++ "shared" => "default", ++ "zlib" => "default", ++ "zlib-dynamic" => "default" ++ ); ++my @experimental = (); ++ ++# This is what $depflags will look like with the above defaults ++# (we need this to see if we should advise the user to run "make depend"): ++my $default_depflags = " -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED"; ++ ++ ++# Explicit "no-..." options will be collected in %disabled along with the defaults. ++# To remove something from %disabled, use "enable-foo" (unless it's experimental). ++# For symmetry, "disable-foo" is a synonym for "no-foo". ++ ++# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable. ++# We will collect such requests in @experimental. ++# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO. ++ ++ ++my $no_sse2=0; ++ ++&usage if ($#ARGV < 0); ++ ++my $flags; ++my $depflags; ++my $openssl_experimental_defines; ++my $openssl_algorithm_defines; ++my $openssl_thread_defines; ++my $openssl_sys_defines=""; ++my $openssl_other_defines; ++my $libs; ++my $libkrb5=""; ++my $target; ++my $options; ++my $symlink; ++my $make_depend=0; ++my %withargs=(); ++ ++my @argvcopy=@ARGV; ++my $argvstring=""; ++my $argv_unprocessed=1; ++ ++while($argv_unprocessed) ++ { ++ $flags=""; ++ $depflags=""; ++ $openssl_experimental_defines=""; ++ $openssl_algorithm_defines=""; ++ $openssl_thread_defines=""; ++ $openssl_sys_defines=""; ++ $openssl_other_defines=""; ++ $libs=""; ++ $target=""; ++ $options=""; ++ $symlink=1; ++ ++ $argv_unprocessed=0; ++ $argvstring=join(' ',@argvcopy); ++ ++PROCESS_ARGS: ++ foreach (@argvcopy) ++ { ++ s /^-no-/no-/; # some people just can't read the instructions ++ ++ # rewrite some options in "enable-..." form ++ s /^-?-?shared$/enable-shared/; ++ s /^threads$/enable-threads/; ++ s /^zlib$/enable-zlib/; ++ s /^zlib-dynamic$/enable-zlib-dynamic/; ++ ++ if (/^no-(.+)$/ || /^disable-(.+)$/) ++ { ++ if (!($disabled{$1} eq "experimental")) ++ { ++ if ($1 eq "ssl") ++ { ++ $disabled{"ssl2"} = "option(ssl)"; ++ $disabled{"ssl3"} = "option(ssl)"; ++ } ++ elsif ($1 eq "tls") ++ { ++ $disabled{"tls1"} = "option(tls)" ++ } ++ else ++ { ++ $disabled{$1} = "option"; ++ } ++ } ++ } ++ elsif (/^enable-(.+)$/ || /^experimental-(.+)$/) ++ { ++ my $algo = $1; ++ if ($disabled{$algo} eq "experimental") ++ { ++ die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n" ++ unless (/^experimental-/); ++ push @experimental, $algo; ++ } ++ delete $disabled{$algo}; ++ ++ $threads = 1 if ($algo eq "threads"); ++ } ++ elsif (/^--test-sanity$/) ++ { ++ exit(&test_sanity()); ++ } ++ elsif (/^reconfigure/ || /^reconf/) ++ { ++ if (open(IN,"<$Makefile")) ++ { ++ while () ++ { ++ chomp; ++ if (/^CONFIGURE_ARGS=(.*)/) ++ { ++ $argvstring=$1; ++ @argvcopy=split(' ',$argvstring); ++ die "Incorrect data to reconfigure, please do a normal configuration\n" ++ if (grep(/^reconf/,@argvcopy)); ++ print "Reconfiguring with: $argvstring\n"; ++ $argv_unprocessed=1; ++ close(IN); ++ last PROCESS_ARGS; ++ } ++ } ++ close(IN); ++ } ++ die "Insufficient data to reconfigure, please do a normal configuration\n"; ++ } ++ elsif (/^386$/) ++ { $processor=386; } ++ elsif (/^fips$/) ++ { ++ $fips=1; ++ } ++ elsif (/^rsaref$/) ++ { ++ # No RSAref support any more since it's not needed. ++ # The check for the option is there so scripts aren't ++ # broken ++ } ++ elsif (/^nofipscanistercheck$/) ++ { ++ $fips = 1; ++ $nofipscanistercheck = 1; ++ } ++ elsif (/^fipscanisterbuild$/) ++ { ++ $fips = 1; ++ $nofipscanistercheck = 1; ++ $fipslibdir=""; ++ $fipscanisterinternal="y"; ++ } ++ elsif (/^fipsdso$/) ++ { ++ $fips = 1; ++ $nofipscanistercheck = 1; ++ $fipslibdir=""; ++ $fipscanisterinternal="y"; ++ $fipsdso = 1; ++ } ++ elsif (/^[-+]/) ++ { ++ if (/^-[lL](.*)$/) ++ { ++ $libs.=$_." "; ++ } ++ elsif (/^-[^-]/ or /^\+/) ++ { ++ $flags.=$_." "; ++ } ++ elsif (/^--prefix=(.*)$/) ++ { ++ $prefix=$1; ++ } ++ elsif (/^--openssldir=(.*)$/) ++ { ++ $openssldir=$1; ++ } ++ elsif (/^--install.prefix=(.*)$/) ++ { ++ $install_prefix=$1; ++ } ++ elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/) ++ { ++ $withargs{"krb5-".$1}=$2; ++ } ++ elsif (/^--with-zlib-lib=(.*)$/) ++ { ++ $withargs{"zlib-lib"}=$1; ++ } ++ elsif (/^--with-zlib-include=(.*)$/) ++ { ++ $withargs{"zlib-include"}="-I$1"; ++ } ++ elsif (/^--with-fipslibdir=(.*)$/) ++ { ++ $fipslibdir="$1/"; ++ } ++ elsif (/^--with-baseaddr=(.*)$/) ++ { ++ $baseaddr="$1"; ++ } ++ else ++ { ++ print STDERR $usage; ++ exit(1); ++ } ++ } ++ elsif ($_ =~ /^([^:]+):(.+)$/) ++ { ++ eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string ++ $target=$1; ++ } ++ else ++ { ++ die "target already defined - $target (offending arg: $_)\n" if ($target ne ""); ++ $target=$_; ++ } ++ ++ unless ($_ eq $target || /^no-/ || /^disable-/) ++ { ++ # "no-..." follows later after implied disactivations ++ # have been derived. (Don't take this too seroiusly, ++ # we really only write OPTIONS to the Makefile out of ++ # nostalgia.) ++ ++ if ($options eq "") ++ { $options = $_; } ++ else ++ { $options .= " ".$_; } ++ } ++ } ++ } ++ ++ ++ ++if ($processor eq "386") ++ { ++ $disabled{"sse2"} = "forced"; ++ } ++ ++if (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "") ++ { ++ $disabled{"krb5"} = "krb5-flavor not specified"; ++ } ++ ++if (!defined($disabled{"zlib-dynamic"})) ++ { ++ # "zlib-dynamic" was specifically enabled, so enable "zlib" ++ delete $disabled{"zlib"}; ++ } ++ ++if (defined($disabled{"rijndael"})) ++ { ++ $disabled{"aes"} = "forced"; ++ } ++if (defined($disabled{"des"})) ++ { ++ $disabled{"mdc2"} = "forced"; ++ } ++if (defined($disabled{"ec"})) ++ { ++ $disabled{"ecdsa"} = "forced"; ++ $disabled{"ecdh"} = "forced"; ++ } ++ ++# SSL 2.0 requires MD5 and RSA ++if (defined($disabled{"md5"}) || defined($disabled{"rsa"})) ++ { ++ $disabled{"ssl2"} = "forced"; ++ } ++ ++# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH ++if (defined($disabled{"md5"}) || defined($disabled{"sha"}) ++ || (defined($disabled{"rsa"}) ++ && (defined($disabled{"dsa"}) || defined($disabled{"dh"})))) ++ { ++ $disabled{"ssl3"} = "forced"; ++ $disabled{"tls1"} = "forced"; ++ } ++ ++if (defined($disabled{"tls1"})) ++ { ++ $disabled{"tlsext"} = "forced"; ++ } ++ ++if ($target eq "TABLE") { ++ foreach $target (sort keys %table) { ++ print_table_entry($target); ++ } ++ exit 0; ++} ++ ++if ($target eq "LIST") { ++ foreach (sort keys %table) { ++ print; ++ print "\n"; ++ } ++ exit 0; ++} ++ ++if ($target =~ m/^CygWin32(-.*)$/) { ++ $target = "Cygwin".$1; ++} ++ ++print "Configuring for $target\n"; ++ ++&usage if (!defined($table{$target})); ++ ++my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1); ++my $cc = $fields[$idx_cc]; ++my $cflags = $fields[$idx_cflags]; ++my $unistd = $fields[$idx_unistd]; ++my $thread_cflag = $fields[$idx_thread_cflag]; ++my $sys_id = $fields[$idx_sys_id]; ++my $lflags = $fields[$idx_lflags]; ++my $bn_ops = $fields[$idx_bn_ops]; ++my $cpuid_obj = $fields[$idx_cpuid_obj]; ++my $bn_obj = $fields[$idx_bn_obj]; ++my $des_obj = $fields[$idx_des_obj]; ++my $aes_obj = $fields[$idx_aes_obj]; ++my $bf_obj = $fields[$idx_bf_obj]; ++my $md5_obj = $fields[$idx_md5_obj]; ++my $sha1_obj = $fields[$idx_sha1_obj]; ++my $cast_obj = $fields[$idx_cast_obj]; ++my $rc4_obj = $fields[$idx_rc4_obj]; ++my $rmd160_obj = $fields[$idx_rmd160_obj]; ++my $rc5_obj = $fields[$idx_rc5_obj]; ++my $dso_scheme = $fields[$idx_dso_scheme]; ++my $shared_target = $fields[$idx_shared_target]; ++my $shared_cflag = $fields[$idx_shared_cflag]; ++my $shared_ldflag = $fields[$idx_shared_ldflag]; ++my $shared_extension = $fields[$idx_shared_extension]; ++my $ranlib = $fields[$idx_ranlib]; ++my $arflags = $fields[$idx_arflags]; ++ ++if ($fips) ++ { ++ delete $disabled{"shared"} if ($disabled{"shared"} eq "default"); ++ $disabled{"asm"}="forced" ++ if ($target !~ "VC\-.*" && ++ "$cpuid_obj:$bn_obj:$aes_obj:$des_obj:$sha1_obj" eq "::::"); ++ } ++ ++foreach (sort @experimental) ++ { ++ my $ALGO; ++ ($ALGO = $_) =~ tr/[a-z]/[A-Z]/; ++ ++ # opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined ++ $openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n"; ++ $cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO"; ++ } ++ ++foreach (sort (keys %disabled)) ++ { ++ $options .= " no-$_"; ++ ++ printf " no-%-12s %-10s", $_, "[$disabled{$_}]"; ++ ++ if (/^dso$/) ++ { $no_dso = 1; } ++ elsif (/^threads$/) ++ { $no_threads = 1; } ++ elsif (/^shared$/) ++ { $no_shared = 1; } ++ elsif (/^zlib$/) ++ { $zlib = 0; } ++ elsif (/^montasm$/) ++ { $montasm = 0; } ++ elsif (/^static-engine$/) ++ { } ++ elsif (/^zlib-dynamic$/) ++ { } ++ elsif (/^symlinks$/) ++ { $symlink = 0; } ++ elsif (/^sse2$/) ++ { $no_sse2 = 1; } ++ else ++ { ++ my ($ALGO, $algo); ++ ($ALGO = $algo = $_) =~ tr/[a-z]/[A-Z]/; ++ ++ if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/) ++ { ++ $openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n"; ++ print " OPENSSL_NO_$ALGO"; ++ ++ if (/^err$/) { $flags .= "-DOPENSSL_NO_ERR "; } ++ elsif (/^asm$/) { $no_asm = 1; } ++ } ++ else ++ { ++ $openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n"; ++ print " OPENSSL_NO_$ALGO"; ++ ++ if (/^krb5$/) ++ { $no_krb5 = 1; } ++ else ++ { ++ push @skip, $algo; ++ print " (skip dir)"; ++ ++ $depflags .= " -DOPENSSL_NO_$ALGO"; ++ } ++ } ++ } ++ ++ print "\n"; ++ } ++ ++ ++my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds; ++ ++$IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys()); ++ ++$no_shared = 0 if ($fipsdso && !$IsMK1MF); ++ ++$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw"); ++$exe_ext=".nlm" if ($target =~ /netware/); ++$exe_ext=".pm" if ($target =~ /vos/); ++if ($openssldir eq "" and $prefix eq "") ++ { ++ if ($fips) ++ { ++ $openssldir="/usr/local/ssl/fips"; ++ } ++ else ++ { ++ $openssldir="/usr/local/ssl"; ++ } ++ } ++$prefix=$openssldir if $prefix eq ""; ++ ++$default_ranlib= &which("ranlib") or $default_ranlib="true"; ++$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl") ++ or $perl="perl"; ++ ++chop $openssldir if $openssldir =~ /\/$/; ++chop $prefix if $prefix =~ /.\/$/; ++ ++$openssldir=$prefix . "/ssl" if $openssldir eq ""; ++$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/; ++ ++ ++print "IsMK1MF=$IsMK1MF\n"; ++ ++# '%' in $lflags is used to split flags to "pre-" and post-flags ++my ($prelflags,$postlflags)=split('%',$lflags); ++if (defined($postlflags)) { $lflags=$postlflags; } ++else { $lflags=$prelflags; undef $prelflags; } ++ ++my $no_shared_warn=0; ++my $no_user_cflags=0; ++ ++if ($flags ne "") { $cflags="$flags$cflags"; } ++else { $no_user_cflags=1; } ++ ++# Kerberos settings. The flavor must be provided from outside, either through ++# the script "config" or manually. ++if (!$no_krb5) ++ { ++ my ($lresolv, $lpath, $lext); ++ if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/) ++ { ++ die "Sorry, Heimdal is currently not supported\n"; ++ } ++ ##### HACK to force use of Heimdal. ++ ##### WARNING: Since we don't really have adequate support for Heimdal, ++ ##### using this will break the build. You'll have to make ++ ##### changes to the source, and if you do, please send ++ ##### patches to openssl-dev@openssl.org ++ if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/) ++ { ++ warn "Heimdal isn't really supported. Your build WILL break\n"; ++ warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n"; ++ $withargs{"krb5-dir"} = "/usr/heimdal" ++ if $withargs{"krb5-dir"} eq ""; ++ $withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}. ++ "/lib -lgssapi -lkrb5 -lcom_err" ++ if $withargs{"krb5-lib"} eq "" && !$IsMK1MF; ++ $cflags="-DKRB5_HEIMDAL $cflags"; ++ } ++ if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/) ++ { ++ $withargs{"krb5-dir"} = "/usr/kerberos" ++ if $withargs{"krb5-dir"} eq ""; ++ $withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}. ++ "/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto" ++ if $withargs{"krb5-lib"} eq "" && !$IsMK1MF; ++ $cflags="-DKRB5_MIT $cflags"; ++ $withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//; ++ if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/) ++ { ++ $cflags="-DKRB5_MIT_OLD11 $cflags"; ++ } ++ } ++ LRESOLV: ++ foreach $lpath ("/lib", "/usr/lib") ++ { ++ foreach $lext ("a", "so") ++ { ++ $lresolv = "$lpath/libresolv.$lext"; ++ last LRESOLV if (-r "$lresolv"); ++ $lresolv = ""; ++ } ++ } ++ $withargs{"krb5-lib"} .= " -lresolv" ++ if ("$lresolv" ne ""); ++ $withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include" ++ if $withargs{"krb5-include"} eq "" && ++ $withargs{"krb5-dir"} ne ""; ++ } ++ ++# The DSO code currently always implements all functions so that no ++# applications will have to worry about that from a compilation point ++# of view. However, the "method"s may return zero unless that platform ++# has support compiled in for them. Currently each method is enabled ++# by a define "DSO_" ... we translate the "dso_scheme" config ++# string entry into using the following logic; ++my $dso_cflags; ++if (!$no_dso && $dso_scheme ne "") ++ { ++ $dso_scheme =~ tr/[a-z]/[A-Z]/; ++ if ($dso_scheme eq "DLFCN") ++ { ++ $dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H"; ++ } ++ elsif ($dso_scheme eq "DLFCN_NO_H") ++ { ++ $dso_cflags = "-DDSO_DLFCN"; ++ } ++ else ++ { ++ $dso_cflags = "-DDSO_$dso_scheme"; ++ } ++ $cflags = "$dso_cflags $cflags"; ++ } ++ ++my $thread_cflags; ++my $thread_defines; ++if ($thread_cflag ne "(unknown)" && !$no_threads) ++ { ++ # If we know how to do it, support threads by default. ++ $threads = 1; ++ } ++if ($thread_cflag eq "(unknown)" && $threads) ++ { ++ # If the user asked for "threads", [s]he is also expected to ++ # provide any system-dependent compiler options that are ++ # necessary. ++ if ($no_user_cflags) ++ { ++ print "You asked for multi-threading support, but didn't\n"; ++ print "provide any system-specific compiler options\n"; ++ exit(1); ++ } ++ $thread_cflags="-DOPENSSL_THREADS $cflags" ; ++ $thread_defines .= "#define OPENSSL_THREADS\n"; ++ } ++else ++ { ++ $thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags"; ++ $thread_defines .= "#define OPENSSL_THREADS\n"; ++# my $def; ++# foreach $def (split ' ',$thread_cflag) ++# { ++# if ($def =~ s/^-D// && $def !~ /^_/) ++# { ++# $thread_defines .= "#define $def\n"; ++# } ++# } ++ } ++ ++$lflags="$libs$lflags" if ($libs ne ""); ++ ++if ($no_asm) ++ { ++ $cpuid_obj=$bn_obj=$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=""; ++ $sha1_obj=$md5_obj=$rmd160_obj=""; ++ $cflags=~s/\-D[BL]_ENDIAN// if ($fips); ++ $thread_cflags=~s/\-D[BL]_ENDIAN// if ($fips); ++ } ++if ($montasm) ++ { ++ $bn_obj =~ s/MAYBE-MO86-/mo86-/; ++ } ++else ++ { ++ $bn_obj =~ s/MAYBE-MO86-[a-z.]*//; ++ } ++ ++if (!$no_shared) ++ { ++ $cast_obj=""; # CAST assembler is not PIC ++ } ++ ++if ($threads) ++ { ++ $cflags=$thread_cflags; ++ $openssl_thread_defines .= $thread_defines; ++ } ++ ++if ($zlib) ++ { ++ $cflags = "-DZLIB $cflags"; ++ if (defined($disabled{"zlib-dynamic"})) ++ { ++ $lflags = "$lflags -lz"; ++ } ++ else ++ { ++ $cflags = "-DZLIB_SHARED $cflags"; ++ } ++ } ++ ++# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org ++my $shared_mark = ""; ++if ($shared_target eq "") ++ { ++ $no_shared_warn = 1 if !$no_shared && !$fips; ++ $no_shared = 1; ++ } ++if (!$no_shared) ++ { ++ if ($shared_cflag ne "") ++ { ++ $cflags = "$shared_cflag -DOPENSSL_PIC $cflags"; ++ } ++ } ++ ++if (!$IsMK1MF) ++ { ++ if ($no_shared) ++ { ++ $openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n"; ++ } ++ else ++ { ++ $openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n"; ++ } ++ } ++ ++$cpuid_obj.=" uplink.o uplink-cof.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/); ++ ++# ++# Platform fix-ups ++# ++if ($target =~ /\-icc$/) # Intel C compiler ++ { ++ my $iccver=0; ++ if (open(FD,"$cc -V 2>&1 |")) ++ { ++ while() { $iccver=$1 if (/Version ([0-9]+)\./); } ++ close(FD); ++ } ++ if ($iccver>=8) ++ { ++ # Eliminate unnecessary dependency from libirc.a. This is ++ # essential for shared library support, as otherwise ++ # apps/openssl can end up in endless loop upon startup... ++ $cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset"; ++ } ++ if ($iccver>=9) ++ { ++ $cflags.=" -i-static"; ++ $cflags=~s/\-no_cpprt/-no-cpprt/; ++ } ++ if ($iccver>=10) ++ { ++ $cflags=~s/\-i\-static/-static-intel/; ++ } ++ } ++ ++# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time ++# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on ++# .so objects. Apparently application RPATH is not global and does ++# not apply to .so linked with other .so. Problem manifests itself ++# when libssl.so fails to load libcrypto.so. One can argue that we ++# should engrave this into Makefile.shared rules or into BSD-* config ++# lines above. Meanwhile let's try to be cautious and pass -rpath to ++# linker only when --prefix is not /usr. ++if ($target =~ /^BSD\-/) ++ { ++ $shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|); ++ } ++ ++if ($sys_id ne "") ++ { ++ #$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags"; ++ $openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n"; ++ } ++ ++if ($ranlib eq "") ++ { ++ $ranlib = $default_ranlib; ++ } ++ ++#my ($bn1)=split(/\s+/,$bn_obj); ++#$bn1 = "" unless defined $bn1; ++#$bn1=$bn_asm unless ($bn1 =~ /\.o$/); ++#$bn_obj="$bn1"; ++ ++$cpuid_obj="" if ($processor eq "386"); ++ ++$bn_obj = $bn_asm unless $bn_obj ne ""; ++# bn86* is the only one implementing bn_*_part_words ++$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn86/); ++$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /bn86/); ++ ++$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /\-mont|mo86\-/); ++ ++if ($fips) ++ { ++ $openssl_other_defines.="#define OPENSSL_FIPS\n"; ++ } ++ ++$des_obj=$des_enc unless ($des_obj =~ /\.o$/); ++$bf_obj=$bf_enc unless ($bf_obj =~ /\.o$/); ++$cast_obj=$cast_enc unless ($cast_obj =~ /\.o$/); ++$rc4_obj=$rc4_enc unless ($rc4_obj =~ /\.o$/); ++$rc5_obj=$rc5_enc unless ($rc5_obj =~ /\.o$/); ++if ($sha1_obj =~ /\.o$/) ++ { ++# $sha1_obj=$sha1_enc; ++ $cflags.=" -DSHA1_ASM" if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/); ++ $cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/); ++ $cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/); ++ if ($sha1_obj =~ /sse2/) ++ { if ($no_sse2) ++ { $sha1_obj =~ s/\S*sse2\S+//; } ++ elsif ($cflags !~ /OPENSSL_IA32_SSE2/) ++ { $cflags.=" -DOPENSSL_IA32_SSE2"; } ++ } ++ } ++if ($md5_obj =~ /\.o$/) ++ { ++# $md5_obj=$md5_enc; ++ $cflags.=" -DMD5_ASM"; ++ } ++if ($rmd160_obj =~ /\.o$/) ++ { ++# $rmd160_obj=$rmd160_enc; ++ $cflags.=" -DRMD160_ASM"; ++ } ++if ($aes_obj =~ /\.o$/) ++ { ++ $cflags.=" -DAES_ASM"; ++ } ++else { ++ $aes_obj=$aes_enc; ++ } ++ ++# "Stringify" the C flags string. This permits it to be made part of a string ++# and works as well on command lines. ++$cflags =~ s/([\\\"])/\\\1/g; ++ ++my $version = "unknown"; ++my $version_num = "unknown"; ++my $major = "unknown"; ++my $minor = "unknown"; ++my $shlib_version_number = "unknown"; ++my $shlib_version_history = "unknown"; ++my $shlib_major = "unknown"; ++my $shlib_minor = "unknown"; ++ ++open(IN,') ++ { ++ $version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /; ++ $version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/; ++ $shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/; ++ $shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/; ++ } ++close(IN); ++if ($shlib_version_history ne "") { $shlib_version_history .= ":"; } ++ ++if ($version =~ /(^[0-9]*)\.([0-9\.]*)/) ++ { ++ $major=$1; ++ $minor=$2; ++ } ++ ++if ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/) ++ { ++ $shlib_major=$1; ++ $shlib_minor=$2; ++ } ++ ++open(IN,'$Makefile.new") || die "unable to create $Makefile.new:$!\n"; ++print OUT "### Generated automatically from Makefile.org by Configure.\n\n"; ++my $sdirs=0; ++while () ++ { ++ chomp; ++ $sdirs = 1 if /^SDIRS=/; ++ if ($sdirs) { ++ my $dir; ++ foreach $dir (@skip) { ++ s/(\s)$dir\s/$1/; ++ s/\s$dir$//; ++ } ++ } ++ $sdirs = 0 unless /\\$/; ++ s/^VERSION=.*/VERSION=$version/; ++ s/^MAJOR=.*/MAJOR=$major/; ++ s/^MINOR=.*/MINOR=$minor/; ++ s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/; ++ s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/; ++ s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/; ++ s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/; ++ s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/; ++ s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/; ++ s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/; ++ s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/; ++ s/^PLATFORM=.*$/PLATFORM=$target/; ++ s/^OPTIONS=.*$/OPTIONS=$options/; ++ s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/; ++ s/^CC=.*$/CC= $cc/; ++ s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc"; ++ s/^CFLAG=.*$/CFLAG= $cflags/; ++ s/^DEPFLAG=.*$/DEPFLAG=$depflags/; ++ s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/; ++ s/^EX_LIBS=.*$/EX_LIBS= $lflags/; ++ s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/; ++ s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/; ++ s/^BN_ASM=.*$/BN_ASM= $bn_obj/; ++ s/^DES_ENC=.*$/DES_ENC= $des_obj/; ++ s/^AES_ASM_OBJ=.*$/AES_ASM_OBJ= $aes_obj/; ++ s/^BF_ENC=.*$/BF_ENC= $bf_obj/; ++ s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/; ++ s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/; ++ s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/; ++ s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/; ++ s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/; ++ s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/; ++ s/^PROCESSOR=.*/PROCESSOR= $processor/; ++ s/^RANLIB=.*/RANLIB= $ranlib/; ++ s/^ARFLAGS=.*/ARFLAGS= $arflags/; ++ s/^PERL=.*/PERL= $perl/; ++ s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/; ++ s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/; ++ s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/; ++ s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/; ++ s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/; ++ if ($fipsdso) ++ { ++ s/^FIPSCANLIB=.*/FIPSCANLIB=libfips/; ++ s/^SHARED_FIPS=.*/SHARED_FIPS=libfips\$(SHLIB_EXT)/; ++ s/^SHLIBDIRS=.*/SHLIBDIRS= crypto ssl fips/; ++ } ++ else ++ { ++ s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips; ++ s/^SHARED_FIPS=.*/SHARED_FIPS=/; ++ s/^SHLIBDIRS=.*/SHLIBDIRS= crypto ssl/; ++ } ++ s/^FIPSCANISTERINTERNAL=.*/FIPSCANISTERINTERNAL=$fipscanisterinternal/; ++ s/^BASEADDR=.*/BASEADDR=$baseaddr/; ++ s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/; ++ s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/; ++ s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_FIPS) \$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared); ++ if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/) ++ { ++ my $sotmp = $1; ++ s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/; ++ } ++ elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/) ++ { ++ s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/; ++ } ++ elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/) ++ { ++ my $sotmp = $1; ++ s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/; ++ } ++ elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/) ++ { ++ s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/; ++ } ++ s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/; ++ print OUT $_."\n"; ++ } ++close(IN); ++close(OUT); ++rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; ++rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; ++ ++print "CC =$cc\n"; ++print "CFLAG =$cflags\n"; ++print "EX_LIBS =$lflags\n"; ++print "CPUID_OBJ =$cpuid_obj\n"; ++print "BN_ASM =$bn_obj\n"; ++print "DES_ENC =$des_obj\n"; ++print "AES_ASM_OBJ =$aes_obj\n"; ++print "BF_ENC =$bf_obj\n"; ++print "CAST_ENC =$cast_obj\n"; ++print "RC4_ENC =$rc4_obj\n"; ++print "RC5_ENC =$rc5_obj\n"; ++print "MD5_OBJ_ASM =$md5_obj\n"; ++print "SHA1_OBJ_ASM =$sha1_obj\n"; ++print "RMD160_OBJ_ASM=$rmd160_obj\n"; ++print "PROCESSOR =$processor\n"; ++print "RANLIB =$ranlib\n"; ++print "ARFLAGS =$arflags\n"; ++print "PERL =$perl\n"; ++print "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n" ++ if $withargs{"krb5-include"} ne ""; ++ ++my $des_ptr=0; ++my $des_risc1=0; ++my $des_risc2=0; ++my $des_unroll=0; ++my $bn_ll=0; ++my $def_int=2; ++my $rc4_int=$def_int; ++my $md2_int=$def_int; ++my $idea_int=$def_int; ++my $rc2_int=$def_int; ++my $rc4_idx=0; ++my $rc4_chunk=0; ++my $bf_ptr=0; ++my @type=("char","short","int","long"); ++my ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0); ++my $export_var_as_fn=0; ++ ++my $des_int; ++ ++foreach (sort split(/\s+/,$bn_ops)) ++ { ++ $des_ptr=1 if /DES_PTR/; ++ $des_risc1=1 if /DES_RISC1/; ++ $des_risc2=1 if /DES_RISC2/; ++ $des_unroll=1 if /DES_UNROLL/; ++ $des_int=1 if /DES_INT/; ++ $bn_ll=1 if /BN_LLONG/; ++ $rc4_int=0 if /RC4_CHAR/; ++ $rc4_int=3 if /RC4_LONG/; ++ $rc4_idx=1 if /RC4_INDEX/; ++ $rc4_chunk=1 if /RC4_CHUNK/; ++ $rc4_chunk=2 if /RC4_CHUNK_LL/; ++ $md2_int=0 if /MD2_CHAR/; ++ $md2_int=3 if /MD2_LONG/; ++ $idea_int=1 if /IDEA_SHORT/; ++ $idea_int=3 if /IDEA_LONG/; ++ $rc2_int=1 if /RC2_SHORT/; ++ $rc2_int=3 if /RC2_LONG/; ++ $bf_ptr=1 if $_ eq "BF_PTR"; ++ $bf_ptr=2 if $_ eq "BF_PTR2"; ++ ($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/; ++ ($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/; ++ ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/; ++ ($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/; ++ ($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/; ++ $export_var_as_fn=1 if /EXPORT_VAR_AS_FN/; ++ } ++ ++open(IN,'crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n"; ++print OUT "/* opensslconf.h */\n"; ++print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n"; ++ ++print OUT "/* OpenSSL was configured with the following options: */\n"; ++my $openssl_algorithm_defines_trans = $openssl_algorithm_defines; ++$openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n# define OPENSSL_NO_$1\n# endif\n#endif/mg; ++$openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n# define $1\n# endif/mg; ++$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg; ++$openssl_algorithm_defines = " /* no ciphers excluded */\n" if $openssl_algorithm_defines eq ""; ++$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg; ++$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg; ++$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg; ++print OUT $openssl_sys_defines; ++print OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n"; ++print OUT $openssl_experimental_defines; ++print OUT "\n"; ++print OUT $openssl_algorithm_defines; ++print OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n"; ++print OUT $openssl_thread_defines; ++print OUT $openssl_other_defines,"\n"; ++ ++print OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n"; ++print OUT " asks for it. This is a transient feature that is provided for those\n"; ++print OUT " who haven't had the time to do the appropriate changes in their\n"; ++print OUT " applications. */\n"; ++print OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n"; ++print OUT $openssl_algorithm_defines_trans; ++print OUT "#endif\n\n"; ++ ++print OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj); ++ ++while () ++ { ++ if (/^#define\s+OPENSSLDIR/) ++ { print OUT "#define OPENSSLDIR \"$openssldir\"\n"; } ++ elsif (/^#define\s+ENGINESDIR/) ++ { print OUT "#define ENGINESDIR \"$prefix/lib/engines\"\n"; } ++ elsif (/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/) ++ { printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n" ++ if $export_var_as_fn; ++ printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n", ++ ($export_var_as_fn)?"define":"undef"; } ++ elsif (/^#define\s+OPENSSL_UNISTD/) ++ { ++ $unistd = "" if $unistd eq ""; ++ print OUT "#define OPENSSL_UNISTD $unistd\n"; ++ } ++ elsif (/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/) ++ { printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; } ++ elsif (/^#((define)|(undef))\s+SIXTY_FOUR_BIT/) ++ { printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; } ++ elsif (/^#((define)|(undef))\s+THIRTY_TWO_BIT/) ++ { printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; } ++ elsif (/^#((define)|(undef))\s+SIXTEEN_BIT/) ++ { printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; } ++ elsif (/^#((define)|(undef))\s+EIGHT_BIT/) ++ { printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; } ++ elsif (/^#((define)|(undef))\s+BN_LLONG\s*$/) ++ { printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; } ++ elsif (/^\#define\s+DES_LONG\s+.*/) ++ { printf OUT "#define DES_LONG unsigned %s\n", ++ ($des_int)?'int':'long'; } ++ elsif (/^\#(define|undef)\s+DES_PTR/) ++ { printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; } ++ elsif (/^\#(define|undef)\s+DES_RISC1/) ++ { printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; } ++ elsif (/^\#(define|undef)\s+DES_RISC2/) ++ { printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; } ++ elsif (/^\#(define|undef)\s+DES_UNROLL/) ++ { printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; } ++ elsif (/^#define\s+RC4_INT\s/) ++ { printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; } ++ elsif (/^#undef\s+RC4_CHUNK/) ++ { ++ printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0; ++ printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1; ++ printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2; ++ } ++ elsif (/^#((define)|(undef))\s+RC4_INDEX/) ++ { printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; } ++ elsif (/^#(define|undef)\s+I386_ONLY/) ++ { printf OUT "#%s I386_ONLY\n", ($processor eq "386")? ++ "define":"undef"; } ++ elsif (/^#define\s+MD2_INT\s/) ++ { printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; } ++ elsif (/^#define\s+IDEA_INT\s/) ++ {printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];} ++ elsif (/^#define\s+RC2_INT\s/) ++ {printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];} ++ elsif (/^#(define|undef)\s+BF_PTR/) ++ { ++ printf OUT "#undef BF_PTR\n" if $bf_ptr == 0; ++ printf OUT "#define BF_PTR\n" if $bf_ptr == 1; ++ printf OUT "#define BF_PTR2\n" if $bf_ptr == 2; ++ } ++ else ++ { print OUT $_; } ++ } ++close(IN); ++close(OUT); ++rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; ++rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; ++ ++ ++# Fix the date ++ ++print "SIXTY_FOUR_BIT_LONG mode\n" if $b64l; ++print "SIXTY_FOUR_BIT mode\n" if $b64; ++print "THIRTY_TWO_BIT mode\n" if $b32; ++print "SIXTEEN_BIT mode\n" if $b16; ++print "EIGHT_BIT mode\n" if $b8; ++print "DES_PTR used\n" if $des_ptr; ++print "DES_RISC1 used\n" if $des_risc1; ++print "DES_RISC2 used\n" if $des_risc2; ++print "DES_UNROLL used\n" if $des_unroll; ++print "DES_INT used\n" if $des_int; ++print "BN_LLONG mode\n" if $bn_ll; ++print "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int; ++print "RC4_INDEX mode\n" if $rc4_idx; ++print "RC4_CHUNK is undefined\n" if $rc4_chunk==0; ++print "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1; ++print "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2; ++print "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int; ++print "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int; ++print "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int; ++print "BF_PTR used\n" if $bf_ptr == 1; ++print "BF_PTR2 used\n" if $bf_ptr == 2; ++ ++if($IsMK1MF) { ++ open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; ++ printf OUT <ms/version32.rc") || die "Can't open ms/version32.rc"; ++ print OUT < ++ ++LANGUAGE 0x09,0x01 ++ ++1 VERSIONINFO ++ FILEVERSION $v1,$v2,$v3,$v4 ++ PRODUCTVERSION $v1,$v2,$v3,$v4 ++ FILEFLAGSMASK 0x3fL ++#ifdef _DEBUG ++ FILEFLAGS 0x01L ++#else ++ FILEFLAGS 0x00L ++#endif ++ FILEOS VOS__WINDOWS32 ++ FILETYPE VFT_DLL ++ FILESUBTYPE 0x0L ++BEGIN ++ BLOCK "StringFileInfo" ++ BEGIN ++ BLOCK "040904b0" ++ BEGIN ++#if defined(FIPS) ++ VALUE "Comments", "WARNING: TEST VERSION ONLY ***NOT*** FIPS 140-2 VALIDATED.\\0" ++#endif ++ // Required: ++ VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0" ++#if defined(FIPS) ++ VALUE "FileDescription", "TEST UNVALIDATED FIPS140-2 DLL\\0" ++#else ++ VALUE "FileDescription", "OpenSSL Shared Library\\0" ++#endif ++ VALUE "FileVersion", "$version\\0" ++#if defined(CRYPTO) ++ VALUE "InternalName", "libeay32\\0" ++ VALUE "OriginalFilename", "libeay32.dll\\0" ++#elif defined(SSL) ++ VALUE "InternalName", "ssleay32\\0" ++ VALUE "OriginalFilename", "ssleay32.dll\\0" ++#elif defined(FIPS) ++ VALUE "InternalName", "libosslfips\\0" ++ VALUE "OriginalFilename", "libosslfips.dll\\0" ++#endif ++ VALUE "ProductName", "The OpenSSL Toolkit\\0" ++ VALUE "ProductVersion", "$version\\0" ++ // Optional: ++ //VALUE "Comments", "\\0" ++ VALUE "LegalCopyright", "Copyright © 1998-2007 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0" ++ //VALUE "LegalTrademarks", "\\0" ++ //VALUE "PrivateBuild", "\\0" ++ //VALUE "SpecialBuild", "\\0" ++ END ++ END ++ BLOCK "VarFileInfo" ++ BEGIN ++ VALUE "Translation", 0x409, 0x4b0 ++ END ++END ++EOF ++ close(OUT); ++ } ++ ++print < 78) ++ { ++ print STDERR "\n"; ++ $k=length($i); ++ } ++ print STDERR $i . " "; ++ } ++ foreach $i (sort keys %table) ++ { ++ next if $i !~ /^debug/; ++ $k += length($i) + 1; ++ if ($k > 78) ++ { ++ print STDERR "\n"; ++ $k=length($i); ++ } ++ print STDERR $i . " "; ++ } ++ print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n"; ++ exit(1); ++ } ++ ++sub which ++ { ++ my($name)=@_; ++ my $path; ++ foreach $path (split /:/, $ENV{PATH}) ++ { ++ if (-f "$path/$name$exe_ext" and -x _) ++ { ++ return "$path/$name$exe_ext" unless ($name eq "perl" and ++ system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\'')); ++ } ++ } ++ } ++ ++sub dofile ++ { ++ my $f; my $p; my %m; my @a; my $k; my $ff; ++ ($f,$p,%m)=@_; ++ ++ open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n"; ++ @a=; ++ close(IN); ++ foreach $k (keys %m) ++ { ++ grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a); ++ } ++ open(OUT,">$f.new") || die "unable to open $f.new:$!\n"; ++ print OUT @a; ++ close(OUT); ++ rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f; ++ rename("$f.new",$f) || die "unable to rename $f.new\n"; ++ } ++ ++sub print_table_entry ++ { ++ my $target = shift; ++ ++ (my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags, ++ my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj, ++ my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj, ++ my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag, ++ my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags)= ++ split(/\s*:\s*/,$table{$target} . ":" x 30 , -1); ++ ++ print < + #include + #include ++#include + + /* + * In the definition, (xa, xb, xc, xd) are Alice's (x1, x2, x3, x4) or +diff -Naur ../openssl-0.9.8j/crypto/sha/sha512.c ./crypto/sha/sha512.c +--- ../openssl-0.9.8j/crypto/sha/sha512.c 2008-09-16 12:47:28.000000000 +0200 ++++ ./crypto/sha/sha512.c 2009-01-08 10:24:35.000000000 +0100 +@@ -314,7 +314,7 @@ + #ifndef PEDANTIC + # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) + # if defined(__x86_64) || defined(__x86_64__) +-# define ROTR(a,n) ({ unsigned long ret; \ ++# define ROTR(a,n) ({ SHA_LONG64 ret; \ + asm ("rorq %1,%0" \ + : "=r"(ret) \ + : "J"(n),"0"(a) \ +diff -Naur ../openssl-0.9.8j/crypto/sha/sha512.c.orig ./crypto/sha/sha512.c.orig +--- ../openssl-0.9.8j/crypto/sha/sha512.c.orig 1970-01-01 01:00:00.000000000 +0100 ++++ ./crypto/sha/sha512.c.orig 2009-01-08 10:24:35.000000000 +0100 +@@ -0,0 +1,547 @@ ++/* crypto/sha/sha512.c */ ++/* ==================================================================== ++ * Copyright (c) 2004 The OpenSSL Project. All rights reserved ++ * according to the OpenSSL license [found in ../../LICENSE]. ++ * ==================================================================== ++ */ ++#include ++#ifdef OPENSSL_FIPS ++#include ++#endif ++ ++#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512) ++/* ++ * IMPLEMENTATION NOTES. ++ * ++ * As you might have noticed 32-bit hash algorithms: ++ * ++ * - permit SHA_LONG to be wider than 32-bit (case on CRAY); ++ * - optimized versions implement two transform functions: one operating ++ * on [aligned] data in host byte order and one - on data in input ++ * stream byte order; ++ * - share common byte-order neutral collector and padding function ++ * implementations, ../md32_common.h; ++ * ++ * Neither of the above applies to this SHA-512 implementations. Reasons ++ * [in reverse order] are: ++ * ++ * - it's the only 64-bit hash algorithm for the moment of this writing, ++ * there is no need for common collector/padding implementation [yet]; ++ * - by supporting only one transform function [which operates on ++ * *aligned* data in input stream byte order, big-endian in this case] ++ * we minimize burden of maintenance in two ways: a) collector/padding ++ * function is simpler; b) only one transform function to stare at; ++ * - SHA_LONG64 is required to be exactly 64-bit in order to be able to ++ * apply a number of optimizations to mitigate potential performance ++ * penalties caused by previous design decision; ++ * ++ * Caveat lector. ++ * ++ * Implementation relies on the fact that "long long" is 64-bit on ++ * both 32- and 64-bit platforms. If some compiler vendor comes up ++ * with 128-bit long long, adjustment to sha.h would be required. ++ * As this implementation relies on 64-bit integer type, it's totally ++ * inappropriate for platforms which don't support it, most notably ++ * 16-bit platforms. ++ * ++ */ ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include "cryptlib.h" ++ ++const char SHA512_version[]="SHA-512" OPENSSL_VERSION_PTEXT; ++ ++#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ ++ defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) || \ ++ defined(__s390__) || defined(__s390x__) || \ ++ defined(SHA512_ASM) ++#define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA ++#endif ++ ++int SHA384_Init (SHA512_CTX *c) ++ { ++#ifdef OPENSSL_FIPS ++ FIPS_selftest_check(); ++#endif ++ c->h[0]=U64(0xcbbb9d5dc1059ed8); ++ c->h[1]=U64(0x629a292a367cd507); ++ c->h[2]=U64(0x9159015a3070dd17); ++ c->h[3]=U64(0x152fecd8f70e5939); ++ c->h[4]=U64(0x67332667ffc00b31); ++ c->h[5]=U64(0x8eb44a8768581511); ++ c->h[6]=U64(0xdb0c2e0d64f98fa7); ++ c->h[7]=U64(0x47b5481dbefa4fa4); ++ c->Nl=0; c->Nh=0; ++ c->num=0; c->md_len=SHA384_DIGEST_LENGTH; ++ return 1; ++ } ++ ++int SHA512_Init (SHA512_CTX *c) ++ { ++#ifdef OPENSSL_FIPS ++ FIPS_selftest_check(); ++#endif ++ c->h[0]=U64(0x6a09e667f3bcc908); ++ c->h[1]=U64(0xbb67ae8584caa73b); ++ c->h[2]=U64(0x3c6ef372fe94f82b); ++ c->h[3]=U64(0xa54ff53a5f1d36f1); ++ c->h[4]=U64(0x510e527fade682d1); ++ c->h[5]=U64(0x9b05688c2b3e6c1f); ++ c->h[6]=U64(0x1f83d9abfb41bd6b); ++ c->h[7]=U64(0x5be0cd19137e2179); ++ c->Nl=0; c->Nh=0; ++ c->num=0; c->md_len=SHA512_DIGEST_LENGTH; ++ return 1; ++ } ++ ++#ifndef SHA512_ASM ++static ++#endif ++void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num); ++ ++int SHA512_Final (unsigned char *md, SHA512_CTX *c) ++ { ++ unsigned char *p=(unsigned char *)c->u.p; ++ size_t n=c->num; ++ ++ p[n]=0x80; /* There always is a room for one */ ++ n++; ++ if (n > (sizeof(c->u)-16)) ++ memset (p+n,0,sizeof(c->u)-n), n=0, ++ sha512_block_data_order (c,p,1); ++ ++ memset (p+n,0,sizeof(c->u)-16-n); ++#ifdef B_ENDIAN ++ c->u.d[SHA_LBLOCK-2] = c->Nh; ++ c->u.d[SHA_LBLOCK-1] = c->Nl; ++#else ++ p[sizeof(c->u)-1] = (unsigned char)(c->Nl); ++ p[sizeof(c->u)-2] = (unsigned char)(c->Nl>>8); ++ p[sizeof(c->u)-3] = (unsigned char)(c->Nl>>16); ++ p[sizeof(c->u)-4] = (unsigned char)(c->Nl>>24); ++ p[sizeof(c->u)-5] = (unsigned char)(c->Nl>>32); ++ p[sizeof(c->u)-6] = (unsigned char)(c->Nl>>40); ++ p[sizeof(c->u)-7] = (unsigned char)(c->Nl>>48); ++ p[sizeof(c->u)-8] = (unsigned char)(c->Nl>>56); ++ p[sizeof(c->u)-9] = (unsigned char)(c->Nh); ++ p[sizeof(c->u)-10] = (unsigned char)(c->Nh>>8); ++ p[sizeof(c->u)-11] = (unsigned char)(c->Nh>>16); ++ p[sizeof(c->u)-12] = (unsigned char)(c->Nh>>24); ++ p[sizeof(c->u)-13] = (unsigned char)(c->Nh>>32); ++ p[sizeof(c->u)-14] = (unsigned char)(c->Nh>>40); ++ p[sizeof(c->u)-15] = (unsigned char)(c->Nh>>48); ++ p[sizeof(c->u)-16] = (unsigned char)(c->Nh>>56); ++#endif ++ ++ sha512_block_data_order (c,p,1); ++ ++ if (md==0) return 0; ++ ++ switch (c->md_len) ++ { ++ /* Let compiler decide if it's appropriate to unroll... */ ++ case SHA384_DIGEST_LENGTH: ++ for (n=0;nh[n]; ++ ++ *(md++) = (unsigned char)(t>>56); ++ *(md++) = (unsigned char)(t>>48); ++ *(md++) = (unsigned char)(t>>40); ++ *(md++) = (unsigned char)(t>>32); ++ *(md++) = (unsigned char)(t>>24); ++ *(md++) = (unsigned char)(t>>16); ++ *(md++) = (unsigned char)(t>>8); ++ *(md++) = (unsigned char)(t); ++ } ++ break; ++ case SHA512_DIGEST_LENGTH: ++ for (n=0;nh[n]; ++ ++ *(md++) = (unsigned char)(t>>56); ++ *(md++) = (unsigned char)(t>>48); ++ *(md++) = (unsigned char)(t>>40); ++ *(md++) = (unsigned char)(t>>32); ++ *(md++) = (unsigned char)(t>>24); ++ *(md++) = (unsigned char)(t>>16); ++ *(md++) = (unsigned char)(t>>8); ++ *(md++) = (unsigned char)(t); ++ } ++ break; ++ /* ... as well as make sure md_len is not abused. */ ++ default: return 0; ++ } ++ ++ return 1; ++ } ++ ++int SHA384_Final (unsigned char *md,SHA512_CTX *c) ++{ return SHA512_Final (md,c); } ++ ++int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len) ++ { ++ SHA_LONG64 l; ++ unsigned char *p=c->u.p; ++ const unsigned char *data=(const unsigned char *)_data; ++ ++ if (len==0) return 1; ++ ++ l = (c->Nl+(((SHA_LONG64)len)<<3))&U64(0xffffffffffffffff); ++ if (l < c->Nl) c->Nh++; ++ if (sizeof(len)>=8) c->Nh+=(((SHA_LONG64)len)>>61); ++ c->Nl=l; ++ ++ if (c->num != 0) ++ { ++ size_t n = sizeof(c->u) - c->num; ++ ++ if (len < n) ++ { ++ memcpy (p+c->num,data,len), c->num += len; ++ return 1; ++ } ++ else { ++ memcpy (p+c->num,data,n), c->num = 0; ++ len-=n, data+=n; ++ sha512_block_data_order (c,p,1); ++ } ++ } ++ ++ if (len >= sizeof(c->u)) ++ { ++#ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA ++ if ((size_t)data%sizeof(c->u.d[0]) != 0) ++ while (len >= sizeof(c->u)) ++ memcpy (p,data,sizeof(c->u)), ++ sha512_block_data_order (c,p,1), ++ len -= sizeof(c->u), ++ data += sizeof(c->u); ++ else ++#endif ++ sha512_block_data_order (c,data,len/sizeof(c->u)), ++ data += len, ++ len %= sizeof(c->u), ++ data -= len; ++ } ++ ++ if (len != 0) memcpy (p,data,len), c->num = (int)len; ++ ++ return 1; ++ } ++ ++int SHA384_Update (SHA512_CTX *c, const void *data, size_t len) ++{ return SHA512_Update (c,data,len); } ++ ++void SHA512_Transform (SHA512_CTX *c, const unsigned char *data) ++{ sha512_block_data_order (c,data,1); } ++ ++unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md) ++ { ++ SHA512_CTX c; ++ static unsigned char m[SHA384_DIGEST_LENGTH]; ++ ++ if (md == NULL) md=m; ++ SHA384_Init(&c); ++ SHA512_Update(&c,d,n); ++ SHA512_Final(md,&c); ++ OPENSSL_cleanse(&c,sizeof(c)); ++ return(md); ++ } ++ ++unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md) ++ { ++ SHA512_CTX c; ++ static unsigned char m[SHA512_DIGEST_LENGTH]; ++ ++ if (md == NULL) md=m; ++ SHA512_Init(&c); ++ SHA512_Update(&c,d,n); ++ SHA512_Final(md,&c); ++ OPENSSL_cleanse(&c,sizeof(c)); ++ return(md); ++ } ++ ++#ifndef SHA512_ASM ++static const SHA_LONG64 K512[80] = { ++ U64(0x428a2f98d728ae22),U64(0x7137449123ef65cd), ++ U64(0xb5c0fbcfec4d3b2f),U64(0xe9b5dba58189dbbc), ++ U64(0x3956c25bf348b538),U64(0x59f111f1b605d019), ++ U64(0x923f82a4af194f9b),U64(0xab1c5ed5da6d8118), ++ U64(0xd807aa98a3030242),U64(0x12835b0145706fbe), ++ U64(0x243185be4ee4b28c),U64(0x550c7dc3d5ffb4e2), ++ U64(0x72be5d74f27b896f),U64(0x80deb1fe3b1696b1), ++ U64(0x9bdc06a725c71235),U64(0xc19bf174cf692694), ++ U64(0xe49b69c19ef14ad2),U64(0xefbe4786384f25e3), ++ U64(0x0fc19dc68b8cd5b5),U64(0x240ca1cc77ac9c65), ++ U64(0x2de92c6f592b0275),U64(0x4a7484aa6ea6e483), ++ U64(0x5cb0a9dcbd41fbd4),U64(0x76f988da831153b5), ++ U64(0x983e5152ee66dfab),U64(0xa831c66d2db43210), ++ U64(0xb00327c898fb213f),U64(0xbf597fc7beef0ee4), ++ U64(0xc6e00bf33da88fc2),U64(0xd5a79147930aa725), ++ U64(0x06ca6351e003826f),U64(0x142929670a0e6e70), ++ U64(0x27b70a8546d22ffc),U64(0x2e1b21385c26c926), ++ U64(0x4d2c6dfc5ac42aed),U64(0x53380d139d95b3df), ++ U64(0x650a73548baf63de),U64(0x766a0abb3c77b2a8), ++ U64(0x81c2c92e47edaee6),U64(0x92722c851482353b), ++ U64(0xa2bfe8a14cf10364),U64(0xa81a664bbc423001), ++ U64(0xc24b8b70d0f89791),U64(0xc76c51a30654be30), ++ U64(0xd192e819d6ef5218),U64(0xd69906245565a910), ++ U64(0xf40e35855771202a),U64(0x106aa07032bbd1b8), ++ U64(0x19a4c116b8d2d0c8),U64(0x1e376c085141ab53), ++ U64(0x2748774cdf8eeb99),U64(0x34b0bcb5e19b48a8), ++ U64(0x391c0cb3c5c95a63),U64(0x4ed8aa4ae3418acb), ++ U64(0x5b9cca4f7763e373),U64(0x682e6ff3d6b2b8a3), ++ U64(0x748f82ee5defb2fc),U64(0x78a5636f43172f60), ++ U64(0x84c87814a1f0ab72),U64(0x8cc702081a6439ec), ++ U64(0x90befffa23631e28),U64(0xa4506cebde82bde9), ++ U64(0xbef9a3f7b2c67915),U64(0xc67178f2e372532b), ++ U64(0xca273eceea26619c),U64(0xd186b8c721c0c207), ++ U64(0xeada7dd6cde0eb1e),U64(0xf57d4f7fee6ed178), ++ U64(0x06f067aa72176fba),U64(0x0a637dc5a2c898a6), ++ U64(0x113f9804bef90dae),U64(0x1b710b35131c471b), ++ U64(0x28db77f523047d84),U64(0x32caab7b40c72493), ++ U64(0x3c9ebe0a15c9bebc),U64(0x431d67c49c100d4c), ++ U64(0x4cc5d4becb3e42b6),U64(0x597f299cfc657e2a), ++ U64(0x5fcb6fab3ad6faec),U64(0x6c44198c4a475817) }; ++ ++#ifndef PEDANTIC ++# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) ++# if defined(__x86_64) || defined(__x86_64__) ++# define ROTR(a,n) ({ unsigned long ret; \ ++ asm ("rorq %1,%0" \ ++ : "=r"(ret) \ ++ : "J"(n),"0"(a) \ ++ : "cc"); ret; }) ++# if !defined(B_ENDIAN) ++# define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \ ++ asm ("bswapq %0" \ ++ : "=r"(ret) \ ++ : "0"(ret)); ret; }) ++# endif ++# elif (defined(__i386) || defined(__i386__)) && !defined(B_ENDIAN) ++# if defined(I386_ONLY) ++# define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ ++ unsigned int hi=p[0],lo=p[1]; \ ++ asm("xchgb %%ah,%%al;xchgb %%dh,%%dl;"\ ++ "roll $16,%%eax; roll $16,%%edx; "\ ++ "xchgb %%ah,%%al;xchgb %%dh,%%dl;" \ ++ : "=a"(lo),"=d"(hi) \ ++ : "0"(lo),"1"(hi) : "cc"); \ ++ ((SHA_LONG64)hi)<<32|lo; }) ++# else ++# define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ ++ unsigned int hi=p[0],lo=p[1]; \ ++ asm ("bswapl %0; bswapl %1;" \ ++ : "=r"(lo),"=r"(hi) \ ++ : "0"(lo),"1"(hi)); \ ++ ((SHA_LONG64)hi)<<32|lo; }) ++# endif ++# elif (defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64) ++# define ROTR(a,n) ({ unsigned long ret; \ ++ asm ("rotrdi %0,%1,%2" \ ++ : "=r"(ret) \ ++ : "r"(a),"K"(n)); ret; }) ++# endif ++# elif defined(_MSC_VER) ++# if defined(_WIN64) /* applies to both IA-64 and AMD64 */ ++# define ROTR(a,n) _rotr64((a),n) ++# endif ++# if defined(_M_IX86) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) ++# if defined(I386_ONLY) ++ static SHA_LONG64 __fastcall __pull64be(const void *x) ++ { _asm mov edx, [ecx + 0] ++ _asm mov eax, [ecx + 4] ++ _asm xchg dh,dl ++ _asm xchg ah,al ++ _asm rol edx,16 ++ _asm rol eax,16 ++ _asm xchg dh,dl ++ _asm xchg ah,al ++ } ++# else ++ static SHA_LONG64 __fastcall __pull64be(const void *x) ++ { _asm mov edx, [ecx + 0] ++ _asm mov eax, [ecx + 4] ++ _asm bswap edx ++ _asm bswap eax ++ } ++# endif ++# define PULL64(x) __pull64be(&(x)) ++# if _MSC_VER<=1200 ++# pragma inline_depth(0) ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef PULL64 ++#define B(x,j) (((SHA_LONG64)(*(((const unsigned char *)(&x))+j)))<<((7-j)*8)) ++#define PULL64(x) (B(x,0)|B(x,1)|B(x,2)|B(x,3)|B(x,4)|B(x,5)|B(x,6)|B(x,7)) ++#endif ++ ++#ifndef ROTR ++#define ROTR(x,s) (((x)>>s) | (x)<<(64-s)) ++#endif ++ ++#define Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39)) ++#define Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41)) ++#define sigma0(x) (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7)) ++#define sigma1(x) (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6)) ++ ++#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) ++#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) ++ ++#if defined(OPENSSL_IA32_SSE2) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY) ++#define GO_FOR_SSE2(ctx,in,num) do { \ ++ void sha512_block_sse2(void *,const void *,size_t); \ ++ if (!(OPENSSL_ia32cap_P & (1<<26))) break; \ ++ sha512_block_sse2(ctx->h,in,num); return; \ ++ } while (0) ++#endif ++ ++#ifdef OPENSSL_SMALL_FOOTPRINT ++ ++static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num) ++ { ++ const SHA_LONG64 *W=in; ++ SHA_LONG64 a,b,c,d,e,f,g,h,s0,s1,T1,T2; ++ SHA_LONG64 X[16]; ++ int i; ++ ++#ifdef GO_FOR_SSE2 ++ GO_FOR_SSE2(ctx,in,num); ++#endif ++ ++ while (num--) { ++ ++ a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; ++ e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; ++ ++ for (i=0;i<16;i++) ++ { ++#ifdef B_ENDIAN ++ T1 = X[i] = W[i]; ++#else ++ T1 = X[i] = PULL64(W[i]); ++#endif ++ T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i]; ++ T2 = Sigma0(a) + Maj(a,b,c); ++ h = g; g = f; f = e; e = d + T1; ++ d = c; c = b; b = a; a = T1 + T2; ++ } ++ ++ for (;i<80;i++) ++ { ++ s0 = X[(i+1)&0x0f]; s0 = sigma0(s0); ++ s1 = X[(i+14)&0x0f]; s1 = sigma1(s1); ++ ++ T1 = X[i&0xf] += s0 + s1 + X[(i+9)&0xf]; ++ T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i]; ++ T2 = Sigma0(a) + Maj(a,b,c); ++ h = g; g = f; f = e; e = d + T1; ++ d = c; c = b; b = a; a = T1 + T2; ++ } ++ ++ ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d; ++ ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h; ++ ++ W+=SHA_LBLOCK; ++ } ++ } ++ ++#else ++ ++#define ROUND_00_15(i,a,b,c,d,e,f,g,h) do { \ ++ T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i]; \ ++ h = Sigma0(a) + Maj(a,b,c); \ ++ d += T1; h += T1; } while (0) ++ ++#define ROUND_16_80(i,a,b,c,d,e,f,g,h,X) do { \ ++ s0 = X[(i+1)&0x0f]; s0 = sigma0(s0); \ ++ s1 = X[(i+14)&0x0f]; s1 = sigma1(s1); \ ++ T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f]; \ ++ ROUND_00_15(i,a,b,c,d,e,f,g,h); } while (0) ++ ++static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num) ++ { ++ const SHA_LONG64 *W=in; ++ SHA_LONG64 a,b,c,d,e,f,g,h,s0,s1,T1; ++ SHA_LONG64 X[16]; ++ int i; ++ ++#ifdef GO_FOR_SSE2 ++ GO_FOR_SSE2(ctx,in,num); ++#endif ++ ++ while (num--) { ++ ++ a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; ++ e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; ++ ++#ifdef B_ENDIAN ++ T1 = X[0] = W[0]; ROUND_00_15(0,a,b,c,d,e,f,g,h); ++ T1 = X[1] = W[1]; ROUND_00_15(1,h,a,b,c,d,e,f,g); ++ T1 = X[2] = W[2]; ROUND_00_15(2,g,h,a,b,c,d,e,f); ++ T1 = X[3] = W[3]; ROUND_00_15(3,f,g,h,a,b,c,d,e); ++ T1 = X[4] = W[4]; ROUND_00_15(4,e,f,g,h,a,b,c,d); ++ T1 = X[5] = W[5]; ROUND_00_15(5,d,e,f,g,h,a,b,c); ++ T1 = X[6] = W[6]; ROUND_00_15(6,c,d,e,f,g,h,a,b); ++ T1 = X[7] = W[7]; ROUND_00_15(7,b,c,d,e,f,g,h,a); ++ T1 = X[8] = W[8]; ROUND_00_15(8,a,b,c,d,e,f,g,h); ++ T1 = X[9] = W[9]; ROUND_00_15(9,h,a,b,c,d,e,f,g); ++ T1 = X[10] = W[10]; ROUND_00_15(10,g,h,a,b,c,d,e,f); ++ T1 = X[11] = W[11]; ROUND_00_15(11,f,g,h,a,b,c,d,e); ++ T1 = X[12] = W[12]; ROUND_00_15(12,e,f,g,h,a,b,c,d); ++ T1 = X[13] = W[13]; ROUND_00_15(13,d,e,f,g,h,a,b,c); ++ T1 = X[14] = W[14]; ROUND_00_15(14,c,d,e,f,g,h,a,b); ++ T1 = X[15] = W[15]; ROUND_00_15(15,b,c,d,e,f,g,h,a); ++#else ++ T1 = X[0] = PULL64(W[0]); ROUND_00_15(0,a,b,c,d,e,f,g,h); ++ T1 = X[1] = PULL64(W[1]); ROUND_00_15(1,h,a,b,c,d,e,f,g); ++ T1 = X[2] = PULL64(W[2]); ROUND_00_15(2,g,h,a,b,c,d,e,f); ++ T1 = X[3] = PULL64(W[3]); ROUND_00_15(3,f,g,h,a,b,c,d,e); ++ T1 = X[4] = PULL64(W[4]); ROUND_00_15(4,e,f,g,h,a,b,c,d); ++ T1 = X[5] = PULL64(W[5]); ROUND_00_15(5,d,e,f,g,h,a,b,c); ++ T1 = X[6] = PULL64(W[6]); ROUND_00_15(6,c,d,e,f,g,h,a,b); ++ T1 = X[7] = PULL64(W[7]); ROUND_00_15(7,b,c,d,e,f,g,h,a); ++ T1 = X[8] = PULL64(W[8]); ROUND_00_15(8,a,b,c,d,e,f,g,h); ++ T1 = X[9] = PULL64(W[9]); ROUND_00_15(9,h,a,b,c,d,e,f,g); ++ T1 = X[10] = PULL64(W[10]); ROUND_00_15(10,g,h,a,b,c,d,e,f); ++ T1 = X[11] = PULL64(W[11]); ROUND_00_15(11,f,g,h,a,b,c,d,e); ++ T1 = X[12] = PULL64(W[12]); ROUND_00_15(12,e,f,g,h,a,b,c,d); ++ T1 = X[13] = PULL64(W[13]); ROUND_00_15(13,d,e,f,g,h,a,b,c); ++ T1 = X[14] = PULL64(W[14]); ROUND_00_15(14,c,d,e,f,g,h,a,b); ++ T1 = X[15] = PULL64(W[15]); ROUND_00_15(15,b,c,d,e,f,g,h,a); ++#endif ++ ++ for (i=16;i<80;i+=8) ++ { ++ ROUND_16_80(i+0,a,b,c,d,e,f,g,h,X); ++ ROUND_16_80(i+1,h,a,b,c,d,e,f,g,X); ++ ROUND_16_80(i+2,g,h,a,b,c,d,e,f,X); ++ ROUND_16_80(i+3,f,g,h,a,b,c,d,e,X); ++ ROUND_16_80(i+4,e,f,g,h,a,b,c,d,X); ++ ROUND_16_80(i+5,d,e,f,g,h,a,b,c,X); ++ ROUND_16_80(i+6,c,d,e,f,g,h,a,b,X); ++ ROUND_16_80(i+7,b,c,d,e,f,g,h,a,X); ++ } ++ ++ ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d; ++ ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h; ++ ++ W+=SHA_LBLOCK; ++ } ++ } ++ ++#endif ++ ++#endif /* SHA512_ASM */ ++ ++#endif /* OPENSSL_NO_SHA512 */ +diff -Naur ../openssl-0.9.8j/engines/e_aep.c ./engines/e_aep.c +--- ../openssl-0.9.8j/engines/e_aep.c 2008-12-30 14:30:57.000000000 +0100 ++++ ./engines/e_aep.c 2009-01-08 10:24:35.000000000 +0100 +@@ -62,8 +62,10 @@ + #include + #else + #include ++#ifndef _PID_T_ + typedef int pid_t; + #endif ++#endif + + #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) + #define getpid GetThreadID +diff -Naur ../openssl-0.9.8j/e_os2.h ./e_os2.h +--- ../openssl-0.9.8j/e_os2.h 2005-12-18 19:57:07.000000000 +0100 ++++ ./e_os2.h 2009-01-08 10:24:35.000000000 +0100 +@@ -264,7 +264,7 @@ + # define OPENSSL_IMPLEMENT_GLOBAL(type,name) \ + extern type _hide_##name; \ + type *_shadow_##name(void) { return &_hide_##name; } \ +- static type _hide_##name ++ type _hide_##name + # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) + # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) + #else diff --git a/bacula/src/win32/patches/openssl.patch b/bacula/src/win32/patches/openssl.patch new file mode 100644 index 0000000000..626f37929b --- /dev/null +++ b/bacula/src/win32/patches/openssl.patch @@ -0,0 +1,309 @@ +Index: Configure +--- ../tmp/openssl-0.9.8b/Configure 2006-04-03 02:15:40.000000000 -0700 ++++ ./Configure 2006-06-27 02:39:02.000000000 -0700 +@@ -132,7 +132,7 @@ + # seems to be sufficient? + my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT"; + +-#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags ++#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $ar : $nm + + my %table=( + # File 'TABLE' (created by 'make TABLE') contains the data from this list, +@@ -468,6 +468,9 @@ + # Borland C++ 4.5 + "BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32", + ++# MinGW32 ++"mingw32", "mingw32-gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a:mingw32-ranlib::mingw32-ar:mingw32-nm", ++ + # MinGW + "mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a", + +@@ -558,6 +561,8 @@ + my $idx_shared_extension = $idx++; + my $idx_ranlib = $idx++; + my $idx_arflags = $idx++; ++my $idx_ar= $idx++; ++my $idx_nm= $idx++; + + my $prefix=""; + my $openssldir=""; +@@ -920,7 +925,7 @@ + + $IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin"); + +-$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw"); ++$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw" || $target eq "mingw32"); + $exe_ext=".pm" if ($target =~ /vos/); + $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq ""); + $prefix=$openssldir if $prefix eq ""; +@@ -964,6 +969,8 @@ + my $shared_extension = $fields[$idx_shared_extension]; + my $ranlib = $fields[$idx_ranlib]; + my $arflags = $fields[$idx_arflags]; ++my $ar = $fields[$idx_ar]; ++my $nm = $fields[$idx_nm]; + + my $no_shared_warn=0; + my $no_user_cflags=0; +@@ -1172,6 +1179,18 @@ + { + $ranlib = $default_ranlib; + } ++if ($arflags eq "") ++ { ++ $arflags = "r"; ++ } ++if ($ar eq "") ++ { ++ $ar = "ar"; ++ } ++if ($nm eq "") ++ { ++ $nm = "nm"; ++ } + + #my ($bn1)=split(/\s+/,$bn_obj); + #$bn1 = "" unless defined $bn1; +@@ -1307,6 +1326,8 @@ + s/^PROCESSOR=.*/PROCESSOR= $processor/; + s/^RANLIB=.*/RANLIB= $ranlib/; + s/^ARFLAGS=.*/ARFLAGS= $arflags/; ++ s/^AR=.*/AR= $ar/; ++ s/^NM=.*/NM= $nm/; + s/^PERL=.*/PERL= $perl/; + s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/; + s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/; +@@ -1358,6 +1379,8 @@ + print "PROCESSOR =$processor\n"; + print "RANLIB =$ranlib\n"; + print "ARFLAGS =$arflags\n"; ++print "AR =$ar\n"; ++print "NM =$nm\n"; + print "PERL =$perl\n"; + print "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n" + if $withargs{"krb5-include"} ne ""; +@@ -1737,7 +1760,7 @@ + my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj, + my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj, + my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag, +- my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags)= ++ my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags, my $ar, my $nm)= + split(/\s*:\s*/,$table{$target} . ":" x 30 , -1); + + print < lib$(LIBNAME).exp; \ ++ ${NM} -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \ + LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \ + LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \ + LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \ +@@ -112,7 +113,20 @@ + ( $(SET_X); rm -f lib$(LIBNAME).exp ) + + SYMLINK_SO= \ +- if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \ ++ if [ -n "$$INHIBIT_SYMLINKS" ]; then \ ++ prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \ ++ if [ -n "$$SHLIB_COMPAT" ]; then \ ++ for x in $$SHLIB_COMPAT; do \ ++ ( $(SET_X); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \ ++ ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \ ++ prev=$$SHLIB$$x$$SHLIB_SUFFIX; \ ++ done; \ ++ fi; \ ++ if [ -n "$$SHLIB_SOVER" ]; then \ ++ ( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \ ++ cp -p $$prev $$SHLIB$$SHLIB_SUFFIX ); \ ++ fi; \ ++ else \ + prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \ + if [ -n "$$SHLIB_COMPAT" ]; then \ + for x in $$SHLIB_COMPAT; do \ +@@ -249,6 +263,9 @@ + INHIBIT_SYMLINKS=yes; \ + SHLIB=cyg$(LIBNAME); \ + expr $(PLATFORM) : 'mingw' > /dev/null && SHLIB=$(LIBNAME)eay32; \ ++ if [ "$(PLATFORM)" = "mingw32" -a "$(LIBNAME)" = "crypto" ]; then \ ++ SHLIB=libeay32; \ ++ fi; \ + SHLIB_SUFFIX=.dll; \ + SHLIB_SOVER=-$(LIBVERSION); \ + ALLSYMSFLAGS='-Wl,--whole-archive'; \ +@@ -258,8 +275,8 @@ + [ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \ + [ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \ + $(LINK_SO_A) || exit 1; \ +- cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX apps/; \ +- cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX test/ ++ cp -p $$SHLIB$$SHLIB_SUFFIX apps/; \ ++ cp -p $$SHLIB$$SHLIB_SUFFIX test/ + link_app.cygwin: + $(LINK_APP) + +Index: util/mkdef.pl +--- ../tmp/openssl-0.9.8b/util/mkdef.pl 2006-01-02 06:08:22.000000000 -0800 ++++ ./util/mkdef.pl 2006-07-26 23:21:46.000000000 -0700 +@@ -1204,7 +1204,7 @@ + ; Definition file for the DLL version of the $name library from OpenSSL + ; + +-LIBRARY $libname $liboptions ++LIBRARY $libname.DLL $liboptions + + DESCRIPTION '$description' + diff --git a/bacula/src/win32/patches/pcre.patch b/bacula/src/win32/patches/pcre.patch new file mode 100644 index 0000000000..189ac45555 --- /dev/null +++ b/bacula/src/win32/patches/pcre.patch @@ -0,0 +1,130 @@ +Index: /Makefile.in +--- ../orig/pcre-6.3/Makefile.in 2005-08-18 06:08:28.000000000 -0700 ++++ ./Makefile.in 2006-06-30 09:11:02.000000000 -0700 +@@ -103,12 +103,10 @@ + LIBTOOL = @LIBTOOL@ + LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) -I. -I$(top_srcdir) $(NEWLINE) $(LINK_SIZE) $(MATCH_LIMIT) $(NO_RECURSE) $(EBCDIC) + LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) -c $(CXXFLAGS) -I. -I$(top_srcdir) $(NEWLINE) $(LINK_SIZE) $(MATCH_LIMIT) $(NO_RECURSE) $(EBCDIC) +-@ON_WINDOWS@LINK = $(CC) $(LDFLAGS) -I. -I$(top_srcdir) -L.libs +-@NOT_ON_WINDOWS@LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -I. -I$(top_srcdir) ++LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -I. -I$(top_srcdir) + LINKLIB = $(LIBTOOL) --mode=link $(CC) -export-symbols-regex '^[^_]|__?pcre_.*utf8|__?pcre_printint' $(LDFLAGS) -I. -I$(top_srcdir) + LINK_FOR_BUILD = $(LIBTOOL) --mode=link $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -I. -I$(top_srcdir) +-@ON_WINDOWS@CXXLINK = $(CXX) $(LDFLAGS) -I. -I$(top_srcdir) -L.libs +-@NOT_ON_WINDOWS@CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -I. -I$(top_srcdir) ++CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -I. -I$(top_srcdir) + CXXLINKLIB = $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -I. -I$(top_srcdir) + + # These are the version numbers for the shared libraries +@@ -355,54 +353,54 @@ + + # Some Windows-specific targets for MinGW. Do not use for Cygwin. + +-winshared : .libs/@WIN_PREFIX@pcre.dll .libs/@WIN_PREFIX@pcreposix.dll \ +- .libs/@WIN_PREFIX@pcrecpp.dll ++winshared : .libs/pcre.dll .libs/pcreposix.dll \ ++ .libs/pcrecpp.dll + +-.libs/@WIN_PREFIX@pcre.dll : libpcre.la ++.libs/pcre.dll : libpcre.la + $(CC) $(CFLAGS) -shared -o $@ \ + -Wl,--whole-archive .libs/libpcre.a \ + -Wl,--out-implib,.libs/libpcre.dll.a \ +- -Wl,--output-def,.libs/@WIN_PREFIX@pcre.dll-def \ ++ -Wl,--output-def,.libs/pcre.dll-def \ + -Wl,--export-all-symbols \ + -Wl,--no-whole-archive +- sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX@pcre.dll'#" \ ++ sed -e "s#dlname=''#dlname='../bin/pcre.dll'#" \ + -e "s#library_names=''#library_names='libpcre.dll.a'#" \ + < .libs/libpcre.lai > .libs/libpcre.lai.tmp && \ + mv -f .libs/libpcre.lai.tmp .libs/libpcre.lai +- sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX@pcre.dll'#" \ ++ sed -e "s#dlname=''#dlname='../bin/pcre.dll'#" \ + -e "s#library_names=''#library_names='libpcre.dll.a'#" \ + < libpcre.la > libpcre.la.tmp && \ + mv -f libpcre.la.tmp libpcre.la + + +-.libs/@WIN_PREFIX@pcreposix.dll: libpcreposix.la libpcre.la ++.libs/pcreposix.dll: libpcreposix.la libpcre.la + $(CC) $(CFLAGS) -shared -o $@ \ + -Wl,--whole-archive .libs/libpcreposix.a \ +- -Wl,--out-implib,.libs/@WIN_PREFIX@pcreposix.dll.a \ +- -Wl,--output-def,.libs/@WIN_PREFIX@libpcreposix.dll-def \ ++ -Wl,--out-implib,.libs/libpcreposix.dll.a \ ++ -Wl,--output-def,.libs/libpcreposix.dll-def \ + -Wl,--export-all-symbols \ + -Wl,--no-whole-archive .libs/libpcre.a +- sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX@pcreposix.dll'#" \ ++ sed -e "s#dlname=''#dlname='../bin/pcreposix.dll'#" \ + -e "s#library_names=''#library_names='libpcreposix.dll.a'#"\ + < .libs/libpcreposix.lai > .libs/libpcreposix.lai.tmp && \ + mv -f .libs/libpcreposix.lai.tmp .libs/libpcreposix.lai +- sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX@pcreposix.dll'#" \ ++ sed -e "s#dlname=''#dlname='../bin/pcreposix.dll'#" \ + -e "s#library_names=''#library_names='libpcreposix.dll.a'#"\ + < libpcreposix.la > libpcreposix.la.tmp && \ + mv -f libpcreposix.la.tmp libpcreposix.la + +-.libs/@WIN_PREFIX@pcrecpp.dll: libpcrecpp.la libpcre.la ++.libs/pcrecpp.dll: libpcrecpp.la libpcre.la + $(CXX) $(CXXFLAGS) -shared -o $@ \ + -Wl,--whole-archive .libs/libpcrecpp.a \ +- -Wl,--out-implib,.libs/@WIN_PREFIX@pcrecpp.dll.a \ +- -Wl,--output-def,.libs/@WIN_PREFIX@libpcrecpp.dll-def \ ++ -Wl,--out-implib,.libs/libpcrecpp.dll.a \ ++ -Wl,--output-def,.libs/libpcrecpp.dll-def \ + -Wl,--export-all-symbols \ + -Wl,--no-whole-archive .libs/libpcre.a +- sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX@pcrecpp.dll'#" \ ++ sed -e "s#dlname=''#dlname='../bin/pcrecpp.dll'#" \ + -e "s#library_names=''#library_names='libpcrecpp.dll.a'#"\ + < .libs/libpcrecpp.lai > .libs/libpcrecpp.lai.tmp && \ + mv -f .libs/libpcrecpp.lai.tmp .libs/libpcrecpp.lai +- sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX@pcrecpp.dll'#" \ ++ sed -e "s#dlname=''#dlname='../bin/pcrecpp.dll'#" \ + -e "s#library_names=''#library_names='libpcrecpp.dll.a'#"\ + < libpcrecpp.la > libpcrecpp.la.tmp && \ + mv -f libpcrecpp.la.tmp libpcrecpp.la +@@ -411,15 +409,15 @@ + wininstall : winshared + $(mkinstalldirs) $(DESTDIR)$(LIBDIR) + $(mkinstalldirs) $(DESTDIR)$(BINDIR) +- $(INSTALL) .libs/@WIN_PREFIX@pcre.dll $(DESTDIR)$(BINDIR)/@WIN_PREFIX@pcre.dll +- $(INSTALL) .libs/@WIN_PREFIX@pcreposix.dll $(DESTDIR)$(BINDIR)/@WIN_PREFIX@pcreposix.dll +- $(INSTALL) .libs/@WIN_PREFIX@libpcreposix.dll.a $(DESTDIR)$(LIBDIR)/@WIN_PREFIX@libpcreposix.dll.a +- $(INSTALL) .libs/@WIN_PREFIX@libpcre.dll.a $(DESTDIR)$(LIBDIR)/@WIN_PREFIX@libpcre.dll.a +-@HAVE_CPP@ $(INSTALL) .libs/@WIN_PREFIX@pcrecpp.dll $(DESTDIR)$(BINDIR)/@WIN_PREFIX@pcrecpp.dll +-@HAVE_CPP@ $(INSTALL) .libs/@WIN_PREFIX@libpcrecpp.dll.a $(DESTDIR)$(LIBDIR)/@WIN_PREFIX@libpcrecpp.dll.a +- -strip -g $(DESTDIR)$(BINDIR)/@WIN_PREFIX@pcre.dll +- -strip -g $(DESTDIR)$(BINDIR)/@WIN_PREFIX@pcreposix.dll +-@HAVE_CPP@ -strip -g $(DESTDIR)$(BINDIR)/@WIN_PREFIX@pcrecpp.dll ++ $(INSTALL) .libs/pcre.dll $(DESTDIR)$(BINDIR)/pcre.dll ++ $(INSTALL) .libs/pcreposix.dll $(DESTDIR)$(BINDIR)/pcreposix.dll ++ $(INSTALL) .libs/libpcreposix.dll.a $(DESTDIR)$(LIBDIR)/libpcreposix.dll.a ++ $(INSTALL) .libs/libpcre.dll.a $(DESTDIR)$(LIBDIR)/libpcre.dll.a ++@HAVE_CPP@ $(INSTALL) .libs/pcrecpp.dll $(DESTDIR)$(BINDIR)/pcrecpp.dll ++@HAVE_CPP@ $(INSTALL) .libs/libpcrecpp.dll.a $(DESTDIR)$(LIBDIR)/libpcrecpp.dll.a ++ -strip -g $(DESTDIR)$(BINDIR)/pcre.dll ++ -strip -g $(DESTDIR)$(BINDIR)/pcreposix.dll ++@HAVE_CPP@ -strip -g $(DESTDIR)$(BINDIR)/pcrecpp.dll + -strip $(DESTDIR)$(BINDIR)/pcregrep@EXEEXT@ + -strip $(DESTDIR)$(BINDIR)/pcretest@EXEEXT@ + +@@ -555,12 +553,12 @@ + + check: runtest + +-@WIN_PREFIX@pcre.dll : winshared +- cp .libs/@WIN_PREFIX@pcre.dll . ++pcre.dll : winshared ++ cp .libs/pcre.dll . + + test: runtest + +-runtest: all @ON_WINDOWS@ @WIN_PREFIX@pcre.dll ++runtest: all @ON_WINDOWS@ pcre.dll + @./RunTest + @./RunGrepTest + @HAVE_CPP@ @echo "" diff --git a/bacula/src/win32/patches/postgresql.patch b/bacula/src/win32/patches/postgresql.patch new file mode 100644 index 0000000000..d270d2c1a7 --- /dev/null +++ b/bacula/src/win32/patches/postgresql.patch @@ -0,0 +1,123 @@ +Index: doc/Makefile +--- ../original/postgresql-8.1.4/doc/Makefile 2003-11-29 11:51:36.000000000 -0800 ++++ ./doc/Makefile 2006-06-29 03:44:10.000000000 -0700 +@@ -101,4 +101,4 @@ + + clean distclean maintainer-clean: + rm -rf man1/ man$(sqlmansectnum)/ man$(sqlmansect_dummy)/ +- $(MAKE) -C src $@ ++ -$(MAKE) -C src $@ +Index: src/bin/pgevent/Makefile +--- ../original/postgresql-8.1.4/src/bin/pgevent/Makefile 2004-12-31 14:03:14.000000000 -0800 ++++ ./src/bin/pgevent/Makefile 2006-06-29 01:19:18.000000000 -0700 +@@ -14,16 +14,18 @@ + + OBJS=pgevent.o pgmsgevent.o + NAME=pgevent.dll ++DLLWRAP=dllwrap ++WINDRES=windres + + all: $(NAME) + + install: all install-lib + + pgevent.dll: $(OBJS) pgevent.def +- dllwrap --def pgevent.def -o $(NAME) $(OBJS) ++ $(DLLWRAP) --def pgevent.def -o $(NAME) $(OBJS) + + pgmsgevent.o: pgmsgevent.rc win32ver.rc +- windres pgmsgevent.rc -o pgmsgevent.o --include-dir=$(top_builddir)/src/include ++ $(WINDRES) pgmsgevent.rc -o pgmsgevent.o --include-dir=$(top_builddir)/src/include + + all-lib: $(NAME) + +Index: src/interfaces/libpq/Makefile +--- ../original/postgresql-8.1.4/src/interfaces/libpq/Makefile 2005-08-28 17:47:35.000000000 -0700 ++++ ./src/interfaces/libpq/Makefile 2006-06-29 01:15:35.000000000 -0700 +@@ -13,6 +13,7 @@ + top_builddir = ../../.. + include $(top_builddir)/src/Makefile.global + ++WINDRES=windres + + # shared library parameters + NAME= pq +@@ -42,7 +43,7 @@ + DLL_DEFFILE=libpqdll.def + + libpqrc.o: libpq.rc +- windres -i libpq.rc -o libpqrc.o ++ $(WINDRES) -i libpq.rc -o libpqrc.o + + ifeq ($(enable_thread_safety), yes) + OBJS += pthread-win32.o +Index: src/Makefile +--- ../original/postgresql-8.1.4/src/Makefile 2005-01-13 10:23:21.000000000 -0800 ++++ ./src/Makefile 2006-06-29 04:07:54.000000000 -0700 +@@ -52,10 +52,10 @@ + $(MAKE) -C bin $@ + $(MAKE) -C pl $@ + $(MAKE) -C makefiles $@ +- $(MAKE) -C test $@ +- $(MAKE) -C tutorial NO_PGXS=1 $@ ++ -$(MAKE) -C test $@ ++ -$(MAKE) -C tutorial NO_PGXS=1 $@ + $(MAKE) -C utils $@ +- $(MAKE) -C tools/thread $@ ++ -$(MAKE) -C tools/thread $@ + + distclean maintainer-clean: + -$(MAKE) -C port $@ +Index: src/Makefile.global.in +--- ../original/postgresql-8.1.4/src/Makefile.global.in 2005-09-27 10:39:32.000000000 -0700 ++++ ./src/Makefile.global.in 2006-06-29 01:11:44.000000000 -0700 +@@ -31,6 +31,7 @@ + # PostgreSQL version number + VERSION = @PACKAGE_VERSION@ + ++WINDRES=windres + # Support for VPATH builds + vpath_build = @vpath_build@ + abs_top_srcdir = @abs_top_srcdir@ +@@ -456,7 +457,7 @@ + sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc + win32ver.o: $(top_builddir)/src/port/win32ver.rc + sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc +- windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include ++ $(WINDRES) -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include + rm -f win32ver.rc + endif + +Index: src/timezone/Makefile +--- ../original/postgresql-8.1.4/src/timezone/Makefile 2005-07-06 14:40:09.000000000 -0700 ++++ ./src/timezone/Makefile 2006-06-29 03:22:26.000000000 -0700 +@@ -12,6 +12,8 @@ + top_builddir = ../.. + include $(top_builddir)/src/Makefile.global + ++ZIC=./zic ++ + override CPPFLAGS := $(CPPFLAGS) + + # files to build into backend +@@ -25,16 +27,16 @@ + pacificnew etcetera factory backward systemv solar87 solar88 solar89 + TZDATAFILES := $(TZDATA:%=$(srcdir)/data/%) + +-all: SUBSYS.o submake-libpgport zic ++all: SUBSYS.o submake-libpgport zic$(X) + + SUBSYS.o: $(OBJS) + $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) + +-zic: $(ZICOBJS) +- $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X) ++zic$(X): $(ZICOBJS) ++ $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@ + + install: all installdirs +- ./zic -d $(DESTDIR)$(datadir)/timezone $(TZDATAFILES) ++ $(ZIC) -d $(DESTDIR)$(datadir)/timezone $(TZDATAFILES) + + installdirs: + $(mkinstalldirs) $(DESTDIR)$(datadir) diff --git a/bacula/src/win32/patches/pthreads-w64.patch b/bacula/src/win32/patches/pthreads-w64.patch new file mode 100644 index 0000000000..209ff6dc82 --- /dev/null +++ b/bacula/src/win32/patches/pthreads-w64.patch @@ -0,0 +1,970 @@ +diff -Naur ../pthreads-snap-2004-06-22/GNUmakefile ./GNUmakefile +--- ../pthreads-snap-2004-06-22/GNUmakefile 2004-05-20 02:56:52.000000000 +0200 ++++ ./GNUmakefile 2009-01-07 15:57:36.000000000 +0100 +@@ -48,9 +48,9 @@ + + #OPT = -g + #OPT = -O3 -DTEST_ICE +-OPT = -O3 -finline-functions ++OPT = $(CLEANUP) -O3 -DHAVE_STRUCT_TIMESPEC -D__MINGW32__ -finline-functions + +-LFLAGS = -lwsock32 ++LFLAGS = -lws2_32 + + GC_CFLAGS = -D__CLEANUP_C + GCE_CFLAGS = -D__CLEANUP_CXX -mthreads +@@ -408,16 +408,16 @@ + @ $(MAKE) clean GC + + GC: +- $(MAKE) CC=gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL) ++ $(MAKE) CC=mingw32-gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL) + + GCE: +- $(MAKE) CC=g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL) ++ $(MAKE) CC=mingw32-g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL) + + GC-inlined: +- $(MAKE) CC=gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP) ++ $(MAKE) CC=mingw32-gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP) + + GCE-inlined: +- $(MAKE) CC=g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP) ++ $(MAKE) CC=mingw32-g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP) + + tests: + @ cd tests +@@ -436,24 +436,24 @@ + + $(GC_DLL): $(DLL_OBJS) + $(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_OBJS) $(LFLAGS) +- dlltool -z pthread.def $(DLL_OBJS) +- dlltool -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF) ++ mingw32-dlltool -z pthread.def $(DLL_OBJS) ++ mingw32-dlltool -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF) + + $(GCE_DLL): $(DLL_OBJS) + $(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_OBJS) $(LFLAGS) +- dlltool -z pthread.def $(DLL_OBJS) +- dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) ++ mingw32-dlltool -z pthread.def $(DLL_OBJS) ++ mingw32-dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) + + $(GC_INLINED_STAMP): $(DLL_INLINED_OBJS) + $(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_INLINED_OBJS) $(LFLAGS) +- dlltool -z pthread.def $(DLL_INLINED_OBJS) +- dlltool -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF) ++ mingw32-dlltool -z pthread.def $(DLL_INLINED_OBJS) ++ mingw32-dlltool -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF) + echo touched > $(GC_INLINED_STAMP) + + $(GCE_INLINED_STAMP): $(DLL_INLINED_OBJS) + $(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_INLINED_OBJS) $(LFLAGS) +- dlltool -z pthread.def $(DLL_INLINED_OBJS) +- dlltool -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) ++ mingw32-dlltool -z pthread.def $(DLL_INLINED_OBJS) ++ mingw32-dlltool -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) + echo touched > $(GCE_INLINED_STAMP) + + clean: +diff -Naur ../pthreads-snap-2004-06-22/implement.h ./implement.h +--- ../pthreads-snap-2004-06-22/implement.h 2004-06-22 08:12:54.000000000 +0200 ++++ ./implement.h 2009-01-07 15:57:36.000000000 +0100 +@@ -38,7 +38,9 @@ + #ifndef _IMPLEMENT_H + #define _IMPLEMENT_H + ++#ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x400 ++#endif + + #include + +diff -Naur ../pthreads-snap-2004-06-22/pthread_cancel.c ./pthread_cancel.c +--- ../pthreads-snap-2004-06-22/pthread_cancel.c 2004-05-17 03:38:02.000000000 +0200 ++++ ./pthread_cancel.c 2009-01-07 15:57:36.000000000 +0100 +@@ -70,7 +70,7 @@ + } + + static void CALLBACK +-ptw32_cancel_callback (DWORD unused) ++ptw32_cancel_callback (ULONG_PTR unused) + { + ptw32_throw (PTW32_EPS_CANCEL); + +diff -Naur ../pthreads-snap-2004-06-22/pthread_exit.c ./pthread_exit.c +--- ../pthreads-snap-2004-06-22/pthread_exit.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./pthread_exit.c 2009-01-07 15:57:36.000000000 +0100 +@@ -89,7 +89,7 @@ + */ + + #if ! defined (__MINGW32__) || defined (__MSVCRT__) +- _endthreadex ((unsigned) value_ptr); ++ _endthreadex ((unsigned) ((ULONG_PTR)value_ptr)); + #else + _endthread (); + #endif +diff -Naur ../pthreads-snap-2004-06-22/pthread_getspecific.c ./pthread_getspecific.c +--- ../pthreads-snap-2004-06-22/pthread_getspecific.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./pthread_getspecific.c 2009-01-07 15:57:36.000000000 +0100 +@@ -63,13 +63,18 @@ + * ------------------------------------------------------ + */ + { +- int lasterror = GetLastError (); +- int lastWSAerror = WSAGetLastError (); ++ void *ptr; + +- void *ptr = TlsGetValue (key->key); ++ if (key == NULL) { ++ ptr = NULL; ++ } else { ++ int lasterror = GetLastError (); ++ int lastWSAerror = WSAGetLastError (); + +- SetLastError (lasterror); +- WSASetLastError (lastWSAerror); ++ ptr = TlsGetValue(key->key); + ++ SetLastError(lasterror); ++ WSASetLastError(lastWSAerror); ++ } + return ptr; + } +diff -Naur ../pthreads-snap-2004-06-22/pthread.h ./pthread.h +--- ../pthreads-snap-2004-06-22/pthread.h 2004-06-22 08:12:54.000000000 +0200 ++++ ./pthread.h 2009-01-07 15:57:36.000000000 +0100 +@@ -274,10 +274,6 @@ + #endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + + #ifndef HAVE_STRUCT_TIMESPEC +-struct timespec { +- long tv_sec; +- long tv_nsec; +-}; + #endif /* HAVE_STRUCT_TIMESPEC */ + + #ifndef SIG_BLOCK +diff -Naur ../pthreads-snap-2004-06-22/ptw32_InterlockedCompareExchange.c ./ptw32_InterlockedCompareExchange.c +--- ../pthreads-snap-2004-06-22/ptw32_InterlockedCompareExchange.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./ptw32_InterlockedCompareExchange.c 2009-01-07 15:57:36.000000000 +0100 +@@ -101,6 +101,19 @@ + #endif + + #else ++#if defined(_WIN64) ++ /* ++ * Microsoft Visual C++ 7.1 and newer have _Interlocked intrinsics ++ */ ++ { ++ result = InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand); ++ } ++ else ++ { ++ result = InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand); ++ } ++ #else ++ + + /* + * If execution gets to here then we should be running on a Win95 system +@@ -110,7 +123,8 @@ + */ + + result = 0; +- ++#error Unsupported platform or compiler! ++#endif + #endif + + /* *INDENT-ON* */ +diff -Naur ../pthreads-snap-2004-06-22/ptw32_semwait.c ./ptw32_semwait.c +--- ../pthreads-snap-2004-06-22/ptw32_semwait.c 2004-05-17 09:59:47.000000000 +0200 ++++ ./ptw32_semwait.c 2009-01-07 15:57:36.000000000 +0100 +@@ -41,7 +41,7 @@ + #include "implement.h" + + +-INLINE int ++int + ptw32_semwait (sem_t * sem) + /* + * ------------------------------------------------------ +diff -Naur ../pthreads-snap-2004-06-22/ptw32_threadStart.c ./ptw32_threadStart.c +--- ../pthreads-snap-2004-06-22/ptw32_threadStart.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./ptw32_threadStart.c 2009-01-07 15:57:36.000000000 +0100 +@@ -356,7 +356,7 @@ + } + + #if ! defined (__MINGW32__) || defined (__MSVCRT__) +- _endthreadex ((unsigned) status); ++ _endthreadex ((unsigned) ((ULONG_PTR)status)); + #else + _endthread (); + #endif +@@ -366,7 +366,7 @@ + */ + + #if ! defined (__MINGW32__) || defined (__MSVCRT__) +- return (unsigned) status; ++ return (unsigned) ((ULONG_PTR)status); + #endif + + } /* ptw32_threadStart */ +diff -Naur ../pthreads-snap-2004-06-22/ptw32_throw.c ./ptw32_throw.c +--- ../pthreads-snap-2004-06-22/ptw32_throw.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./ptw32_throw.c 2009-01-07 15:57:36.000000000 +0100 +@@ -78,10 +78,10 @@ + switch (exception) + { + case PTW32_EPS_CANCEL: +- exitCode = (unsigned) PTHREAD_CANCELED; ++ exitCode = (unsigned) ((ULONG_PTR)PTHREAD_CANCELED); + break; + case PTW32_EPS_EXIT: +- exitCode = (unsigned) self->exitStatus;; ++ exitCode = (unsigned) ((ULONG_PTR)self->exitStatus);; + break; + } + +diff -Naur ../pthreads-snap-2004-06-22/tests/barrier3.c ./tests/barrier3.c +--- ../pthreads-snap-2004-06-22/tests/barrier3.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/barrier3.c 2009-01-07 15:57:36.000000000 +0100 +@@ -41,7 +41,7 @@ + #include "test.h" + + pthread_barrier_t barrier = NULL; +-static int result = 1; ++static DWORD_PTR result = 1; + + void * func(void * arg) + { +diff -Naur ../pthreads-snap-2004-06-22/tests/barrier5.c ./tests/barrier5.c +--- ../pthreads-snap-2004-06-22/tests/barrier5.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/barrier5.c 2009-01-07 15:57:36.000000000 +0100 +@@ -90,7 +90,7 @@ + main() + { + int i, j; +- int result; ++ DWORD_PTR result; + int serialThreadsTotal; + pthread_t t[NUMTHREADS + 1]; + +@@ -112,7 +112,7 @@ + for (i = 1; i <= j; i++) + { + assert(pthread_join(t[i], (void **) &result) == 0); +- serialThreadsTotal += result; ++ serialThreadsTotal += (int)result; + } + + assert(serialThreadsTotal == BARRIERS - 1); +diff -Naur ../pthreads-snap-2004-06-22/tests/cancel2.c ./tests/cancel2.c +--- ../pthreads-snap-2004-06-22/tests/cancel2.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/cancel2.c 2009-01-07 15:57:36.000000000 +0100 +@@ -217,7 +217,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + assert(pthread_join(t[i], (void **) &result) == 0); + fail = (result != (int) PTHREAD_CANCELED); +diff -Naur ../pthreads-snap-2004-06-22/tests/cancel3.c ./tests/cancel3.c +--- ../pthreads-snap-2004-06-22/tests/cancel3.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./tests/cancel3.c 2009-01-07 15:57:36.000000000 +0100 +@@ -173,7 +173,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + /* + * The thread does not contain any cancelation points, so +diff -Naur ../pthreads-snap-2004-06-22/tests/cancel4.c ./tests/cancel4.c +--- ../pthreads-snap-2004-06-22/tests/cancel4.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./tests/cancel4.c 2009-01-07 15:57:36.000000000 +0100 +@@ -173,7 +173,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + /* + * The thread does not contain any cancelation points, so +diff -Naur ../pthreads-snap-2004-06-22/tests/cancel5.c ./tests/cancel5.c +--- ../pthreads-snap-2004-06-22/tests/cancel5.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./tests/cancel5.c 2009-01-07 15:57:36.000000000 +0100 +@@ -171,7 +171,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + /* + * The thread does not contain any cancelation points, so +diff -Naur ../pthreads-snap-2004-06-22/tests/cancel6a.c ./tests/cancel6a.c +--- ../pthreads-snap-2004-06-22/tests/cancel6a.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./tests/cancel6a.c 2009-01-07 15:57:36.000000000 +0100 +@@ -161,7 +161,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + /* + * The thread does not contain any cancelation points, so +diff -Naur ../pthreads-snap-2004-06-22/tests/cancel6d.c ./tests/cancel6d.c +--- ../pthreads-snap-2004-06-22/tests/cancel6d.c 2004-05-17 03:38:03.000000000 +0200 ++++ ./tests/cancel6d.c 2009-01-07 15:57:36.000000000 +0100 +@@ -165,7 +165,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + /* + * The thread does not contain any cancelation points, so +diff -Naur ../pthreads-snap-2004-06-22/tests/cleanup0.c ./tests/cleanup0.c +--- ../pthreads-snap-2004-06-22/tests/cleanup0.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/cleanup0.c 2009-01-07 15:57:36.000000000 +0100 +@@ -180,7 +180,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + assert(pthread_join(t[i], (void **) &result) == 0); + +diff -Naur ../pthreads-snap-2004-06-22/tests/cleanup1.c ./tests/cleanup1.c +--- ../pthreads-snap-2004-06-22/tests/cleanup1.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/cleanup1.c 2009-01-07 15:57:36.000000000 +0100 +@@ -195,7 +195,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + assert(pthread_join(t[i], (void **) &result) == 0); + +diff -Naur ../pthreads-snap-2004-06-22/tests/cleanup2.c ./tests/cleanup2.c +--- ../pthreads-snap-2004-06-22/tests/cleanup2.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/cleanup2.c 2009-01-07 15:57:36.000000000 +0100 +@@ -169,7 +169,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + assert(pthread_join(t[i], (void **) &result) == 0); + +diff -Naur ../pthreads-snap-2004-06-22/tests/cleanup3.c ./tests/cleanup3.c +--- ../pthreads-snap-2004-06-22/tests/cleanup3.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/cleanup3.c 2009-01-07 15:57:36.000000000 +0100 +@@ -172,7 +172,7 @@ + for (i = 1; i <= NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + assert(pthread_join(t[i], (void **) &result) == 0); + +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar1_2.c ./tests/condvar1_2.c +--- ../pthreads-snap-2004-06-22/tests/condvar1_2.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar1_2.c 2009-01-07 15:57:36.000000000 +0100 +@@ -89,7 +89,7 @@ + main() + { + int i, j, k; +- int result = -1; ++ DWORD_PTR result = -1; + pthread_t t; + + for (k = 0; k < NUM_LOOPS; k++) +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar2_1.c ./tests/condvar2_1.c +--- ../pthreads-snap-2004-06-22/tests/condvar2_1.c 2004-05-20 02:56:52.000000000 +0200 ++++ ./tests/condvar2_1.c 2009-01-07 15:57:36.000000000 +0100 +@@ -105,7 +105,7 @@ + { + int i; + pthread_t t[NUMTHREADS + 1]; +- int result = 0; ++ DWORD_PTR result = 0; + struct _timeb currSysTime; + const DWORD NANOSEC_PER_MILLISEC = 1000000; + +@@ -116,7 +116,7 @@ + /* get current system time */ + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar2.c ./tests/condvar2.c +--- ../pthreads-snap-2004-06-22/tests/condvar2.c 2004-05-20 02:56:52.000000000 +0200 ++++ ./tests/condvar2.c 2009-01-07 15:57:36.000000000 +0100 +@@ -99,7 +99,7 @@ + /* get current system time */ + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +@@ -109,7 +109,7 @@ + assert(pthread_mutex_unlock(&mutex) == 0); + + { +- int result = pthread_cond_destroy(&cv); ++ DWORD_PTR result = pthread_cond_destroy(&cv); + if (result != 0) + { + fprintf(stderr, "Result = %s\n", error_string[result]); +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar3_1.c ./tests/condvar3_1.c +--- ../pthreads-snap-2004-06-22/tests/condvar3_1.c 2004-05-20 02:56:52.000000000 +0200 ++++ ./tests/condvar3_1.c 2009-01-07 15:57:36.000000000 +0100 +@@ -125,7 +125,7 @@ + { + int i; + pthread_t t[NUMTHREADS + 1]; +- int result = 0; ++ DWORD_PTR result = 0; + struct _timeb currSysTime; + const DWORD NANOSEC_PER_MILLISEC = 1000000; + +@@ -137,7 +137,7 @@ + /* get current system time */ + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar3_2.c ./tests/condvar3_2.c +--- ../pthreads-snap-2004-06-22/tests/condvar3_2.c 2004-05-20 02:56:52.000000000 +0200 ++++ ./tests/condvar3_2.c 2009-01-07 15:57:36.000000000 +0100 +@@ -127,7 +127,7 @@ + { + int i; + pthread_t t[NUMTHREADS + 1]; +- int result = 0; ++ DWORD_PTR result = 0; + struct _timeb currSysTime; + const DWORD NANOSEC_PER_MILLISEC = 1000000; + +@@ -138,7 +138,7 @@ + /* get current system time */ + _ftime(&currSysTime); + +- abstime.tv_sec = abstime.tv_sec = currSysTime.time + 5; ++ abstime.tv_sec = abstime.tv_sec = (long)currSysTime.time + 5; + abstime.tv_nsec = abstime2.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + assert(pthread_mutex_lock(&mutex) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar3_3.c ./tests/condvar3_3.c +--- ../pthreads-snap-2004-06-22/tests/condvar3_3.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar3_3.c 2009-01-07 15:57:36.000000000 +0100 +@@ -96,7 +96,7 @@ + /* get current system time */ + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + abstime.tv_sec += 1; + +@@ -120,7 +120,7 @@ + + assert(pthread_mutex_lock(&mtx) == 0); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + abstime.tv_sec += 1; + +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar3.c ./tests/condvar3.c +--- ../pthreads-snap-2004-06-22/tests/condvar3.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar3.c 2009-01-07 15:57:36.000000000 +0100 +@@ -127,7 +127,7 @@ + /* get current system time */ + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar4.c ./tests/condvar4.c +--- ../pthreads-snap-2004-06-22/tests/condvar4.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar4.c 2009-01-07 15:57:36.000000000 +0100 +@@ -132,7 +132,7 @@ + /* get current system time */ + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +@@ -145,7 +145,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar5.c ./tests/condvar5.c +--- ../pthreads-snap-2004-06-22/tests/condvar5.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar5.c 2009-01-07 15:57:36.000000000 +0100 +@@ -131,7 +131,7 @@ + /* get current system time */ + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +@@ -144,7 +144,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar6.c ./tests/condvar6.c +--- ../pthreads-snap-2004-06-22/tests/condvar6.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar6.c 2009-01-07 15:57:36.000000000 +0100 +@@ -159,7 +159,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar7.c ./tests/condvar7.c +--- ../pthreads-snap-2004-06-22/tests/condvar7.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar7.c 2009-01-07 15:57:36.000000000 +0100 +@@ -169,7 +169,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 10; +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar8.c ./tests/condvar8.c +--- ../pthreads-snap-2004-06-22/tests/condvar8.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar8.c 2009-01-07 15:57:36.000000000 +0100 +@@ -166,7 +166,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 10; +diff -Naur ../pthreads-snap-2004-06-22/tests/condvar9.c ./tests/condvar9.c +--- ../pthreads-snap-2004-06-22/tests/condvar9.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/condvar9.c 2009-01-07 15:57:36.000000000 +0100 +@@ -172,7 +172,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 5; +diff -Naur ../pthreads-snap-2004-06-22/tests/context1.c ./tests/context1.c +--- ../pthreads-snap-2004-06-22/tests/context1.c 2004-05-20 02:56:52.000000000 +0200 ++++ ./tests/context1.c 2009-01-07 15:57:36.000000000 +0100 +@@ -125,7 +125,11 @@ + /* + *_x86 only!!! + */ ++#if defined(_M_IX86) + context.Eip = (DWORD) anotherEnding; ++#else ++ context.Rip = (DWORD64) anotherEnding; ++#endif + SetThreadContext(hThread, &context); + ResumeThread(hThread); + } +diff -Naur ../pthreads-snap-2004-06-22/tests/delay2.c ./tests/delay2.c +--- ../pthreads-snap-2004-06-22/tests/delay2.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/delay2.c 2009-01-07 15:57:36.000000000 +0100 +@@ -65,7 +65,7 @@ + main(int argc, char * argv[]) + { + pthread_t t; +- int result = 0; ++ DWORD_PTR result = 0; + + assert(pthread_mutex_lock(&mx) == 0); + +diff -Naur ../pthreads-snap-2004-06-22/tests/exception1.c ./tests/exception1.c +--- ../pthreads-snap-2004-06-22/tests/exception1.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/exception1.c 2009-01-07 15:57:36.000000000 +0100 +@@ -226,7 +226,7 @@ + for (i = 0; i < NUMTHREADS; i++) + { + int fail = 0; +- int result = 0; ++ DWORD_PTR result = 0; + + /* Canceled thread */ + assert(pthread_join(ct[i], (void **) &result) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/GNUmakefile ./tests/GNUmakefile +--- ../pthreads-snap-2004-06-22/tests/GNUmakefile 2004-06-22 08:12:55.000000000 +0200 ++++ ./tests/GNUmakefile 2009-01-07 15:57:36.000000000 +0100 +@@ -64,7 +64,7 @@ + DLL = pthread$(GCX).dll + QAPC = ../QueueUserAPCEx/User/quserex.dll + +-COPYFILES = $(HDR) $(LIB) $(DLL) $(QAPC) ++COPYFILES = $(HDR) $(LIB) $(DLL) + + # If a test case returns a non-zero exit code to the shell, make will + # stop. +diff -Naur ../pthreads-snap-2004-06-22/tests/join0.c ./tests/join0.c +--- ../pthreads-snap-2004-06-22/tests/join0.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/join0.c 2009-01-07 15:57:36.000000000 +0100 +@@ -53,7 +53,7 @@ + main(int argc, char * argv[]) + { + pthread_t id; +- int result; ++ DWORD_PTR result; + + /* Create a single thread and wait for it to exit. */ + assert(pthread_create(&id, NULL, func, (void *) 123) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/join1.c ./tests/join1.c +--- ../pthreads-snap-2004-06-22/tests/join1.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/join1.c 2009-01-07 15:57:36.000000000 +0100 +@@ -56,7 +56,7 @@ + { + pthread_t id[4]; + int i; +- int result; ++ DWORD_PTR result; + + /* Create a few threads and then exit. */ + for (i = 0; i < 4; i++) +diff -Naur ../pthreads-snap-2004-06-22/tests/join2.c ./tests/join2.c +--- ../pthreads-snap-2004-06-22/tests/join2.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/join2.c 2009-01-07 15:57:36.000000000 +0100 +@@ -50,7 +50,7 @@ + { + pthread_t id[4]; + int i; +- int result; ++ DWORD_PTR result; + + /* Create a few threads and then exit. */ + for (i = 0; i < 4; i++) +diff -Naur ../pthreads-snap-2004-06-22/tests/join3.c ./tests/join3.c +--- ../pthreads-snap-2004-06-22/tests/join3.c 2004-05-22 03:17:58.000000000 +0200 ++++ ./tests/join3.c 2009-01-07 15:57:36.000000000 +0100 +@@ -50,7 +50,7 @@ + { + pthread_t id[4]; + int i; +- int result; ++ DWORD_PTR result; + + /* Create a few threads and then exit. */ + for (i = 0; i < 4; i++) +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex6e.c ./tests/mutex6e.c +--- ../pthreads-snap-2004-06-22/tests/mutex6e.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/mutex6e.c 2009-01-07 15:57:36.000000000 +0100 +@@ -74,7 +74,7 @@ + main() + { + pthread_t t; +- int result = 0; ++ DWORD_PTR result = 0; + int mxType = -1; + + assert(pthread_mutexattr_init(&mxAttr) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex6es.c ./tests/mutex6es.c +--- ../pthreads-snap-2004-06-22/tests/mutex6es.c 2004-06-22 08:12:55.000000000 +0200 ++++ ./tests/mutex6es.c 2009-01-07 15:57:36.000000000 +0100 +@@ -73,7 +73,7 @@ + main() + { + pthread_t t; +- int result = 0; ++ DWORD_PTR result = 0; + + assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); + +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex6r.c ./tests/mutex6r.c +--- ../pthreads-snap-2004-06-22/tests/mutex6r.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/mutex6r.c 2009-01-07 15:57:36.000000000 +0100 +@@ -73,7 +73,7 @@ + main() + { + pthread_t t; +- int result = 0; ++ DWORD_PTR result = 0; + int mxType = -1; + + assert(pthread_mutexattr_init(&mxAttr) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex6rs.c ./tests/mutex6rs.c +--- ../pthreads-snap-2004-06-22/tests/mutex6rs.c 2004-06-22 08:12:55.000000000 +0200 ++++ ./tests/mutex6rs.c 2009-01-07 15:57:36.000000000 +0100 +@@ -72,7 +72,7 @@ + main() + { + pthread_t t; +- int result = 0; ++ DWORD_PTR result = 0; + + assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER); + +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex7e.c ./tests/mutex7e.c +--- ../pthreads-snap-2004-06-22/tests/mutex7e.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/mutex7e.c 2009-01-07 15:57:36.000000000 +0100 +@@ -74,7 +74,7 @@ + main() + { + pthread_t t; +- int result = 0; ++ DWORD_PTR result = 0; + int mxType = -1; + + assert(pthread_mutexattr_init(&mxAttr) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex7r.c ./tests/mutex7r.c +--- ../pthreads-snap-2004-06-22/tests/mutex7r.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/mutex7r.c 2009-01-07 15:57:36.000000000 +0100 +@@ -73,7 +73,7 @@ + main() + { + pthread_t t; +- int result = 0; ++ DWORD_PTR result = 0; + int mxType = -1; + + assert(pthread_mutexattr_init(&mxAttr) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex8.c ./tests/mutex8.c +--- ../pthreads-snap-2004-06-22/tests/mutex8.c 2002-02-20 05:39:56.000000000 +0100 ++++ ./tests/mutex8.c 2009-01-07 15:57:36.000000000 +0100 +@@ -49,7 +49,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex8e.c ./tests/mutex8e.c +--- ../pthreads-snap-2004-06-22/tests/mutex8e.c 2002-02-20 05:39:56.000000000 +0100 ++++ ./tests/mutex8e.c 2009-01-07 15:57:36.000000000 +0100 +@@ -57,7 +57,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex8n.c ./tests/mutex8n.c +--- ../pthreads-snap-2004-06-22/tests/mutex8n.c 2002-02-20 05:39:56.000000000 +0100 ++++ ./tests/mutex8n.c 2009-01-07 15:57:36.000000000 +0100 +@@ -57,7 +57,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/mutex8r.c ./tests/mutex8r.c +--- ../pthreads-snap-2004-06-22/tests/mutex8r.c 2002-02-20 05:39:56.000000000 +0100 ++++ ./tests/mutex8r.c 2009-01-07 15:57:36.000000000 +0100 +@@ -57,7 +57,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/rwlock2_t.c ./tests/rwlock2_t.c +--- ../pthreads-snap-2004-06-22/tests/rwlock2_t.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/rwlock2_t.c 2009-01-07 15:57:36.000000000 +0100 +@@ -55,7 +55,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/rwlock3_t.c ./tests/rwlock3_t.c +--- ../pthreads-snap-2004-06-22/tests/rwlock3_t.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/rwlock3_t.c 2009-01-07 15:57:36.000000000 +0100 +@@ -68,7 +68,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/rwlock4_t.c ./tests/rwlock4_t.c +--- ../pthreads-snap-2004-06-22/tests/rwlock4_t.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/rwlock4_t.c 2009-01-07 15:57:36.000000000 +0100 +@@ -68,7 +68,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/rwlock5_t.c ./tests/rwlock5_t.c +--- ../pthreads-snap-2004-06-22/tests/rwlock5_t.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/rwlock5_t.c 2009-01-07 15:57:36.000000000 +0100 +@@ -70,7 +70,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/rwlock6.c ./tests/rwlock6.c +--- ../pthreads-snap-2004-06-22/tests/rwlock6.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/rwlock6.c 2009-01-07 15:57:36.000000000 +0100 +@@ -77,9 +77,9 @@ + pthread_t wrt1; + pthread_t wrt2; + pthread_t rdt; +- int wr1Result = 0; +- int wr2Result = 0; +- int rdResult = 0; ++ DWORD_PTR wr1Result = 0; ++ DWORD_PTR wr2Result = 0; ++ DWORD_PTR rdResult = 0; + + bankAccount = 0; + +diff -Naur ../pthreads-snap-2004-06-22/tests/rwlock6_t2.c ./tests/rwlock6_t2.c +--- ../pthreads-snap-2004-06-22/tests/rwlock6_t2.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/rwlock6_t2.c 2009-01-07 15:57:36.000000000 +0100 +@@ -86,15 +86,15 @@ + pthread_t wrt1; + pthread_t wrt2; + pthread_t rdt; +- int wr1Result = 0; +- int wr2Result = 0; +- int rdResult = 0; ++ DWORD_PTR wr1Result = 0; ++ DWORD_PTR wr2Result = 0; ++ DWORD_PTR rdResult = 0; + struct _timeb currSysTime; + const DWORD NANOSEC_PER_MILLISEC = 1000000; + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + abstime.tv_sec += 1; +diff -Naur ../pthreads-snap-2004-06-22/tests/rwlock6_t.c ./tests/rwlock6_t.c +--- ../pthreads-snap-2004-06-22/tests/rwlock6_t.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/rwlock6_t.c 2009-01-07 15:57:36.000000000 +0100 +@@ -67,7 +67,7 @@ + + _ftime(&currSysTime); + +- abstime.tv_sec = currSysTime.time; ++ abstime.tv_sec = (long)currSysTime.time; + abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; + + +@@ -95,10 +95,10 @@ + pthread_t wrt2; + pthread_t rdt1; + pthread_t rdt2; +- int wr1Result = 0; +- int wr2Result = 0; +- int rd1Result = 0; +- int rd2Result = 0; ++ DWORD_PTR wr1Result = 0; ++ DWORD_PTR wr2Result = 0; ++ DWORD_PTR rd1Result = 0; ++ DWORD_PTR rd2Result = 0; + + bankAccount = 0; + +diff -Naur ../pthreads-snap-2004-06-22/tests/semaphore1.c ./tests/semaphore1.c +--- ../pthreads-snap-2004-06-22/tests/semaphore1.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/semaphore1.c 2009-01-07 15:57:36.000000000 +0100 +@@ -117,7 +117,7 @@ + { + pthread_t t; + sem_t s; +- int result; ++ DWORD_PTR result; + + assert(pthread_create(&t, NULL, thr, NULL) == 0); + assert(pthread_join(t, (void **)&result) == 0); +diff -Naur ../pthreads-snap-2004-06-22/tests/spin4.c ./tests/spin4.c +--- ../pthreads-snap-2004-06-22/tests/spin4.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/spin4.c 2009-01-07 15:57:36.000000000 +0100 +@@ -63,7 +63,7 @@ + int + main() + { +- long result = 0; ++ DWORD_PTR result = 0; + pthread_t t; + int CPUs; + struct _timeb sysTime; +diff -Naur ../pthreads-snap-2004-06-22/tests/tsd1.c ./tests/tsd1.c +--- ../pthreads-snap-2004-06-22/tests/tsd1.c 2003-08-19 05:31:51.000000000 +0200 ++++ ./tests/tsd1.c 2009-01-07 15:57:36.000000000 +0100 +@@ -171,7 +171,7 @@ + */ + for (i = 1; i < 10; i++) + { +- int result = 0; ++ DWORD_PTR result = 0; + + assert(pthread_join(thread[i], (void **) &result) == 0); + } diff --git a/bacula/src/win32/patches/pthreads.patch b/bacula/src/win32/patches/pthreads.patch new file mode 100644 index 0000000000..3f6113738e --- /dev/null +++ b/bacula/src/win32/patches/pthreads.patch @@ -0,0 +1,95 @@ +Index: GNUmakefile +--- ../tmp/pthreads-snap-2004-06-22/GNUmakefile 2004-05-19 17:56:52.000000000 -0700 ++++ ./GNUmakefile 2006-06-27 05:48:10.000000000 -0700 +@@ -408,16 +408,16 @@ + @ $(MAKE) clean GC + + GC: +- $(MAKE) CC=gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL) ++ $(MAKE) CC=mingw32-gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL) + + GCE: +- $(MAKE) CC=g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL) ++ $(MAKE) CC=mingw32-g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL) + + GC-inlined: +- $(MAKE) CC=gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP) ++ $(MAKE) CC=mingw32-gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP) + + GCE-inlined: +- $(MAKE) CC=g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP) ++ $(MAKE) CC=mingw32-g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP) + + tests: + @ cd tests +@@ -436,24 +436,24 @@ + + $(GC_DLL): $(DLL_OBJS) + $(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_OBJS) $(LFLAGS) +- dlltool -z pthread.def $(DLL_OBJS) +- dlltool -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF) ++ mingw32-dlltool -z pthread.def $(DLL_OBJS) ++ mingw32-dlltool -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF) + + $(GCE_DLL): $(DLL_OBJS) + $(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_OBJS) $(LFLAGS) +- dlltool -z pthread.def $(DLL_OBJS) +- dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) ++ mingw32-dlltool -z pthread.def $(DLL_OBJS) ++ mingw32-dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) + + $(GC_INLINED_STAMP): $(DLL_INLINED_OBJS) + $(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_INLINED_OBJS) $(LFLAGS) +- dlltool -z pthread.def $(DLL_INLINED_OBJS) +- dlltool -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF) ++ mingw32-dlltool -z pthread.def $(DLL_INLINED_OBJS) ++ mingw32-dlltool -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF) + echo touched > $(GC_INLINED_STAMP) + + $(GCE_INLINED_STAMP): $(DLL_INLINED_OBJS) + $(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_INLINED_OBJS) $(LFLAGS) +- dlltool -z pthread.def $(DLL_INLINED_OBJS) +- dlltool -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) ++ mingw32-dlltool -z pthread.def $(DLL_INLINED_OBJS) ++ mingw32-dlltool -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) + echo touched > $(GCE_INLINED_STAMP) + + clean: +Index: ptw32_semwait.c +--- ../tmp/pthreads-snap-2004-06-22/ptw32_semwait.c 2004-05-17 00:59:47.000000000 -0700 ++++ ./ptw32_semwait.c 2006-06-27 05:52:59.000000000 -0700 +@@ -41,7 +41,7 @@ + #include "implement.h" + + +-INLINE int ++int + ptw32_semwait (sem_t * sem) + /* + * ------------------------------------------------------ +--- /tmp/pthread_getspecific.c.bak 2008-07-12 17:26:03.000000000 +0200 ++++ pthread_getspecific.c 2008-07-12 17:26:03.000000000 +0200 +@@ -63,13 +63,18 @@ + * ------------------------------------------------------ + */ + { +- int lasterror = GetLastError (); +- int lastWSAerror = WSAGetLastError (); ++ void *ptr; + +- void *ptr = TlsGetValue (key->key); ++ if (key == NULL) { ++ ptr = NULL; ++ } else { ++ int lasterror = GetLastError (); ++ int lastWSAerror = WSAGetLastError (); + +- SetLastError (lasterror); +- WSASetLastError (lastWSAerror); ++ ptr = TlsGetValue(key->key); + ++ SetLastError(lasterror); ++ WSASetLastError(lastWSAerror); ++ } + return ptr; + } diff --git a/bacula/src/win32/patches/qt4-compilation-see.patch b/bacula/src/win32/patches/qt4-compilation-see.patch new file mode 100644 index 0000000000..55582caab7 --- /dev/null +++ b/bacula/src/win32/patches/qt4-compilation-see.patch @@ -0,0 +1,21 @@ +diff -rup a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h +--- a/src/corelib/tools/qsimd_p.h 2012-11-23 11:09:55.000000000 +0100 ++++ b/src/corelib/tools/qsimd_p.h 2014-07-22 17:11:48.552071394 +0200 +@@ -48,7 +48,7 @@ + QT_BEGIN_HEADER + + +-#if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) ++//#if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) + // Disable MMX and SSE on Mac/PPC builds, or if the compiler + // does not support -Xarch argument passing + #undef QT_HAVE_SSE +@@ -60,7 +60,7 @@ QT_BEGIN_HEADER + #undef QT_HAVE_AVX + #undef QT_HAVE_3DNOW + #undef QT_HAVE_MMX +-#endif ++//#endif + + // SSE intrinsics + #if defined(QT_HAVE_SSE2) && (defined(__SSE2__) || defined(Q_CC_MSVC)) diff --git a/bacula/src/win32/patches/qt4-compilation.patch b/bacula/src/win32/patches/qt4-compilation.patch new file mode 100644 index 0000000000..03488b966e --- /dev/null +++ b/bacula/src/win32/patches/qt4-compilation.patch @@ -0,0 +1,45 @@ +diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp +index b0f14ca..8e69e5f 100644 (file) +--- a/src/gui/widgets/qdialogbuttonbox.cpp ++++ b/src/gui/widgets/qdialogbuttonbox.cpp +@@ -212,7 +212,7 @@ static QDialogButtonBox::ButtonRole roleFor(QDialogButtonBox::StandardButton but + return QDialogButtonBox::InvalidRole; + } + +-static const int layouts[2][5][14] = ++static const uint layouts[2][5][14] = + { + // Qt::Horizontal + { +@@ -407,7 +407,7 @@ void QDialogButtonBoxPrivate::layoutButtons() + tmpPolicy = 4; // Mac modeless + } + +- const int *currentLayout = layouts[orientation == Qt::Vertical][tmpPolicy]; ++ const uint *currentLayout = layouts[orientation == Qt::Vertical][tmpPolicy]; + + if (center) + buttonLayout->addStretch(); +diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp +index 3e9dbb8..e8d7db5 100644 (file) +--- a/src/opengl/gl2paintengineex/qtriangulator.cpp ++++ b/src/opengl/gl2paintengineex/qtriangulator.cpp +@@ -1710,7 +1710,7 @@ void QTriangulator::ComplexToSimple::initEdges() + } else { + Q_ASSERT(i + 1 < m_parent->m_indices.size()); + // {node, from, to, next, previous, winding, mayIntersect, pointingUp, originallyPointingUp} +- Edge edge = {0, m_parent->m_indices.at(i), m_parent->m_indices.at(i + 1), -1, -1, 0, true, false, false}; ++ Edge edge = {0, int(m_parent->m_indices.at(i)), int(m_parent->m_indices.at(i + 1)), -1, -1, 0, true, false, false}; + m_edges.add(edge); + } + } +--- ./src/plugins/accessible/widgets/itemviews.cpp 2018-04-11 19:01:29.073721147 +0000 ++++ /home/bsbuild/dev/git/depkgs-mingw32/src/qt-everywhere-opensource-src-4.8.4/src/plugins/accessible/widgets/itemviews.cpp 2012-11-23 10:09:55.000000000 +0000 +@@ -393,7 +393,7 @@ + QModelIndex index = view()->model()->index(0, column, view()->rootIndex()); + if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection) + return false; +- view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect); ++ view()->selectionModel()->select(index, (QItemSelectionModel::SelectionFlag)(QItemSelectionModel::Columns & QItemSelectionModel::Deselect)); + return true; + } diff --git a/bacula/src/win32/patches/qt4-intrinsics.patch b/bacula/src/win32/patches/qt4-intrinsics.patch new file mode 100644 index 0000000000..884c421b17 --- /dev/null +++ b/bacula/src/win32/patches/qt4-intrinsics.patch @@ -0,0 +1,13 @@ +diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp +index 540b615..1ce1e00 100644 +--- a/src/corelib/tools/qsimd.cpp ++++ b/src/corelib/tools/qsimd.cpp +@@ -47,7 +47,7 @@ + #include + #endif + +-#if defined(Q_OS_WIN64) && !defined(Q_CC_GNU) ++#if defined(Q_OS_WIN64) || defined(Q_OS_WIN32) + #include + #endif + diff --git a/bacula/src/win32/patches/qt4-widget-ui.patch b/bacula/src/win32/patches/qt4-widget-ui.patch new file mode 100644 index 0000000000..ef8589c3f4 --- /dev/null +++ b/bacula/src/win32/patches/qt4-widget-ui.patch @@ -0,0 +1,12 @@ +diff -rup a/src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/widget.ui b/src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/widget.ui +--- a/src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/widget.ui 2014-07-22 17:04:10.504085732 +0200 ++++ b/src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/widget.ui 2014-07-22 17:01:08.000000000 +0200 +@@ -87,7 +87,7 @@ + + WebView + QWidget +-

widget.h
++
../../widget.h
+ + + diff --git a/bacula/src/win32/patches/sed.patch b/bacula/src/win32/patches/sed.patch new file mode 100644 index 0000000000..a599cb3b24 --- /dev/null +++ b/bacula/src/win32/patches/sed.patch @@ -0,0 +1,15 @@ +Index: regex_internal.h +--- ../released/sed-4.1.5/lib/regex_internal.h 2005-12-06 00:50:56.000000000 -0800 ++++ ./lib/regex_internal.h 2006-08-31 02:24:05.000000000 -0700 +@@ -410,7 +410,11 @@ + #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) + #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) + ++#if defined(WIN32) ++#include ++#else + #include ++#endif + + #ifndef _LIBC + # if HAVE_ALLOCA diff --git a/bacula/src/win32/patches/sed_msc.patch b/bacula/src/win32/patches/sed_msc.patch new file mode 100644 index 0000000000..b347e25044 --- /dev/null +++ b/bacula/src/win32/patches/sed_msc.patch @@ -0,0 +1,927 @@ +diff -Nru ../release/sed-4.1.5/config_h.msc ./config_h.msc +--- ../release/sed-4.1.5/config_h.msc 1969-12-31 16:00:00.000000000 -0800 ++++ ./config_h.msc 2006-09-28 19:34:18.620414300 -0700 +@@ -0,0 +1,387 @@ ++/* config_h.in. Generated from configure.ac by autoheader. */ ++/* config_h.msc. Modified for Microsoft Visual Studio. */ ++ ++#define O_CREAT _O_CREAT ++#define O_EXCL _O_EXCL ++#define O_RDWR _O_RDWR ++ ++#define popen _popen ++#define pclose _pclose ++#define alloca _alloca ++#define strcasecmp stricmp ++ ++#define S_ISREG(x) (((x) & _S_IFMT) == _S_IFREG) ++ ++#define HAVE_FCNTL_H 1 ++ ++/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP ++ systems. This function is required for `alloca.c' support on those systems. ++ */ ++#undef CRAY_STACKSEG_END ++ ++/* Define to 1 if using `alloca.c'. */ ++#undef C_ALLOCA ++ ++/* Define to 1 if translation of program messages to the user's native ++ language is requested. */ ++#undef ENABLE_NLS ++ ++/* Define to 1 if you have `alloca', as a function or macro. */ ++#define HAVE_ALLOCA 1 ++ ++/* Define to 1 if you have and it should be used (not on Ultrix). ++ */ ++#undef HAVE_ALLOCA_H ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_ARGZ_H ++ ++/* Define to 1 if you have the `bcopy' function. */ ++#undef HAVE_BCOPY ++ ++/* Define to 1 if you have the `btowc' function. */ ++#undef HAVE_BTOWC ++ ++/* Define to 1 if you have the `bzero' function. */ ++#undef HAVE_BZERO ++ ++/* Define if the GNU dcgettext() function is already present or preinstalled. ++ */ ++#undef HAVE_DCGETTEXT ++ ++/* Define to 1 if you have the header file, and it defines `DIR'. ++ */ ++#define HAVE_DIRENT_H 1 ++ ++/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ ++#undef HAVE_DOPRNT ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_ERRNO_H 1 ++ ++/* Define to 1 if you have the `fchmod' function. */ ++#undef HAVE_FCHMOD ++ ++/* Define to 1 if you have the `fchown' function. */ ++#undef HAVE_FCHOWN ++ ++/* Define to 1 if you have the `feof_unlocked' function. */ ++#undef HAVE_FEOF_UNLOCKED ++ ++/* Define to 1 if you have the `fgets_unlocked' function. */ ++#undef HAVE_FGETS_UNLOCKED ++ ++/* Define to 1 if you have the `getcwd' function. */ ++#define HAVE_GETCWD 1 ++ ++/* Define to 1 if you have the `getc_unlocked' function. */ ++#undef HAVE_GETC_UNLOCKED ++ ++/* Define to 1 if you have the `getegid' function. */ ++#undef HAVE_GETEGID ++ ++/* Define to 1 if you have the `geteuid' function. */ ++#undef HAVE_GETEUID ++ ++/* Define to 1 if you have the `getgid' function. */ ++#undef HAVE_GETGID ++ ++/* Define to 1 if you have the `getpagesize' function. */ ++#undef HAVE_GETPAGESIZE ++ ++/* Define if the GNU gettext() function is already present or preinstalled. */ ++#undef HAVE_GETTEXT ++ ++/* Define to 1 if you have the `getuid' function. */ ++#undef HAVE_GETUID ++ ++/* Define if you have the iconv() function. */ ++#undef HAVE_ICONV ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_INTTYPES_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_IO_H 1 ++ ++/* Define to 1 if you have the `isascii' function. */ ++#define HAVE_ISASCII 1 ++ ++/* Define to 1 if you have the `isatty' function. */ ++#undef HAVE_ISATTY ++ ++/* Define to 1 if you have the `isblank' function. */ ++#undef HAVE_ISBLANK ++ ++/* Define if you have and nl_langinfo(CODESET). */ ++#undef HAVE_LANGINFO_CODESET ++ ++/* Define if your file defines LC_MESSAGES. */ ++#define HAVE_LC_MESSAGES 1 ++ ++/* Define to 1 if you have the `regex' library (-lregex). */ ++#undef HAVE_LIBREGEX ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_LIMITS_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_LOCALE_H ++ ++/* Define to 1 if you support file names longer than 14 characters. */ ++#define HAVE_LONG_FILE_NAMES 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_MALLOC_H 1 ++ ++/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ ++#undef HAVE_MBRTOWC ++ ++/* Define to 1 if declares mbstate_t. */ ++#undef HAVE_MBSTATE_T ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_MCHECK_H ++ ++/* Define to 1 if you have the `memchr' function. */ ++#define HAVE_MEMCHR 1 ++ ++/* Define to 1 if you have the `memcmp' function. */ ++#define HAVE_MEMCMP 1 ++ ++/* Define to 1 if you have the `memcpy' function. */ ++#define HAVE_MEMCPY 1 ++ ++/* Define to 1 if you have the `memmove' function. */ ++#define HAVE_MEMMOVE 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the `mempcpy' function. */ ++#undef HAVE_MEMPCPY ++ ++/* Define to 1 if you have the `memset' function. */ ++#define HAVE_MEMSET 1 ++ ++/* Define to 1 if you have the `mkstemp' function. */ ++#undef HAVE_MKSTEMP ++ ++/* Define to 1 if you have a working `mmap' system call. */ ++#undef HAVE_MMAP ++ ++/* Define to 1 if you have the `munmap' function. */ ++#undef HAVE_MUNMAP ++ ++/* Define to 1 if you have the header file, and it defines `DIR'. */ ++#undef HAVE_NDIR_H ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_NL_TYPES_H ++ ++/* Define to 1 if libc includes obstacks. */ ++#undef HAVE_OBSTACK ++ ++/* Define to 1 if you have the `pathconf' function. */ ++#undef HAVE_PATHCONF ++ ++/* Define to 1 if you have the `popen' function. */ ++#define HAVE_POPEN 1 ++ ++/* Define to 1 if you have the `putenv' function. */ ++#define HAVE_PUTENV 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_REGEX_H ++ ++/* Define to 1 if you have the `setenv' function. */ ++#define HAVE_SETENV 1 ++ ++/* Define to 1 if you have the `setlocale' function. */ ++#undef HAVE_SETLOCALE ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDARG_H 1 ++ ++/* Define to 1 if stdbool.h conforms to C99. */ ++#undef HAVE_STDBOOL_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDDEF_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_STDINT_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the `stpcpy' function. */ ++#undef HAVE_STPCPY ++ ++/* Define to 1 if you have the `strcasecmp' function. */ ++#undef HAVE_STRCASECMP ++ ++/* Define to 1 if you have the `strchr' function. */ ++#define HAVE_STRCHR 1 ++ ++/* Define to 1 if you have the `strdup' function. */ ++#define HAVE_STRDUP 1 ++ ++/* Define to 1 if you have the `strerror' function. */ ++#define HAVE_STRERROR 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_STRINGS_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the `strtoul' function. */ ++#define HAVE_STRTOUL 1 ++ ++/* Define to 1 if you have the `strverscmp' function. */ ++#undef HAVE_STRVERSCMP ++ ++/* Define to 1 if you have the header file, and it defines `DIR'. ++ */ ++#define HAVE_SYS_DIR_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_SYS_FILE_H ++ ++/* Define to 1 if you have the header file, and it defines `DIR'. ++ */ ++#define HAVE_SYS_NDIR_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_PARAM_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_TYPES_H 1 ++ ++/* Define to 1 if you have the `tsearch' function. */ ++#define HAVE_TSEARCH 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_UNISTD_H ++ ++/* Define to 1 if you have the `vprintf' function. */ ++#define HAVE_VPRINTF 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_WCHAR_H ++ ++/* Define to 1 if you have the `wcrtomb' function. */ ++#undef HAVE_WCRTOMB ++ ++/* Define to 1 if you have the `wcscoll' function. */ ++#undef HAVE_WCSCOLL ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_WCTYPE_H ++ ++/* Define to 1 if the system has the type `_Bool'. */ ++#undef HAVE__BOOL ++ ++/* Define to 1 if you have the `__argz_count' function. */ ++#undef HAVE___ARGZ_COUNT ++ ++/* Define to 1 if you have the `__argz_next' function. */ ++#undef HAVE___ARGZ_NEXT ++ ++/* Define to 1 if you have the `__argz_stringify' function. */ ++#undef HAVE___ARGZ_STRINGIFY ++ ++/* Define as const if the declaration of iconv() needs const. */ ++#undef ICONV_CONST ++ ++/* Name of package */ ++#define PACKAGE "sed" ++ ++/* Define to the address where bug reports for this package should be sent. */ ++#undef PACKAGE_BUGREPORT ++ ++/* Define to the full name of this package. */ ++#undef PACKAGE_NAME ++ ++/* Define to the full name and version of this package. */ ++#undef PACKAGE_STRING ++ ++/* Define to the one symbol short name of this package. */ ++#undef PACKAGE_TARNAME ++ ++/* Define to the version of this package. */ ++#undef PACKAGE_VERSION ++ ++/* Define to the version of GNU sed whose features are supported by this sed. ++ */ ++#define SED_FEATURE_VERSION "5.1" ++ ++/* If using the C implementation of alloca, define if you know the ++ direction of stack growth for your system; otherwise it will be ++ automatically deduced at run-time. ++ STACK_DIRECTION > 0 => grows toward higher addresses ++ STACK_DIRECTION < 0 => grows toward lower addresses ++ STACK_DIRECTION = 0 => direction of growth unknown */ ++#undef STACK_DIRECTION ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define STDC_HEADERS 1 ++ ++/* Version number of package */ ++#define VERSION "4.1.5" ++ ++/* Define to 1 if on AIX 3. ++ System headers sometimes define this. ++ We just want to avoid a redefinition error message. */ ++#ifndef _ALL_SOURCE ++# undef _ALL_SOURCE ++#endif ++ ++/* Number of bits in a file offset, on hosts where this is settable. */ ++#undef _FILE_OFFSET_BITS ++ ++/* Enable GNU extensions on systems that have them. */ ++#ifndef _GNU_SOURCE ++# undef _GNU_SOURCE ++#endif ++ ++/* Define for large files, on AIX-style hosts. */ ++#undef _LARGE_FILES ++ ++/* Define to 1 if on MINIX. */ ++#undef _MINIX ++ ++/* Define to 2 if the system does not provide POSIX.1 features except with ++ this defined. */ ++#undef _POSIX_1_SOURCE ++ ++/* Define to 1 if you need to in order for `stat' and other things to work. */ ++#undef _POSIX_SOURCE ++ ++/* Include BSD functions in regex, used by the testsuite */ ++#undef _REGEX_RE_COMP ++ ++/* Define to empty if `const' does not conform to ANSI C. */ ++#undef const ++ ++/* Define to `__inline__' or `__inline' if that's what the C compiler ++ calls it, or to nothing if 'inline' is not supported under any name. */ ++#ifndef __cplusplus ++#define inline __inline ++#endif ++ ++/* Define to a type if does not define. */ ++#define mbstate_t int ++ ++/* Define to `long' if does not define. */ ++#undef off_t ++ ++/* Define to `unsigned' if does not define. */ ++#undef size_t ++ ++/* Define to `int' if does not define. */ ++#undef ssize_t +diff -Nru ../release/sed-4.1.5/config_h.msc~ ./config_h.msc~ +--- ../release/sed-4.1.5/config_h.msc~ 1969-12-31 16:00:00.000000000 -0800 ++++ ./config_h.msc~ 2006-09-28 13:56:59.922178500 -0700 +@@ -0,0 +1,386 @@ ++/* config_h.in. Generated from configure.ac by autoheader. */ ++ ++#define O_CREAT _O_CREAT ++#define O_EXCL _O_EXCL ++#define O_RDWR _O_RDWR ++ ++#define popen _popen ++#define pclose _pclose ++#define alloca _alloca ++#define strcasecmp stricmp ++ ++#define S_ISREG(x) (((x) & _S_IFMT) == _S_IFREG) ++ ++#define HAVE_FCNTL_H 1 ++ ++/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP ++ systems. This function is required for `alloca.c' support on those systems. ++ */ ++#undef CRAY_STACKSEG_END ++ ++/* Define to 1 if using `alloca.c'. */ ++#undef C_ALLOCA ++ ++/* Define to 1 if translation of program messages to the user's native ++ language is requested. */ ++#undef ENABLE_NLS ++ ++/* Define to 1 if you have `alloca', as a function or macro. */ ++#define HAVE_ALLOCA 1 ++ ++/* Define to 1 if you have and it should be used (not on Ultrix). ++ */ ++#undef HAVE_ALLOCA_H ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_ARGZ_H ++ ++/* Define to 1 if you have the `bcopy' function. */ ++#undef HAVE_BCOPY ++ ++/* Define to 1 if you have the `btowc' function. */ ++#undef HAVE_BTOWC ++ ++/* Define to 1 if you have the `bzero' function. */ ++#undef HAVE_BZERO ++ ++/* Define if the GNU dcgettext() function is already present or preinstalled. ++ */ ++#undef HAVE_DCGETTEXT ++ ++/* Define to 1 if you have the header file, and it defines `DIR'. ++ */ ++#define HAVE_DIRENT_H 1 ++ ++/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ ++#undef HAVE_DOPRNT ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_ERRNO_H 1 ++ ++/* Define to 1 if you have the `fchmod' function. */ ++#undef HAVE_FCHMOD ++ ++/* Define to 1 if you have the `fchown' function. */ ++#undef HAVE_FCHOWN ++ ++/* Define to 1 if you have the `feof_unlocked' function. */ ++#undef HAVE_FEOF_UNLOCKED ++ ++/* Define to 1 if you have the `fgets_unlocked' function. */ ++#undef HAVE_FGETS_UNLOCKED ++ ++/* Define to 1 if you have the `getcwd' function. */ ++#define HAVE_GETCWD 1 ++ ++/* Define to 1 if you have the `getc_unlocked' function. */ ++#undef HAVE_GETC_UNLOCKED ++ ++/* Define to 1 if you have the `getegid' function. */ ++#undef HAVE_GETEGID ++ ++/* Define to 1 if you have the `geteuid' function. */ ++#undef HAVE_GETEUID ++ ++/* Define to 1 if you have the `getgid' function. */ ++#undef HAVE_GETGID ++ ++/* Define to 1 if you have the `getpagesize' function. */ ++#undef HAVE_GETPAGESIZE ++ ++/* Define if the GNU gettext() function is already present or preinstalled. */ ++#undef HAVE_GETTEXT ++ ++/* Define to 1 if you have the `getuid' function. */ ++#undef HAVE_GETUID ++ ++/* Define if you have the iconv() function. */ ++#undef HAVE_ICONV ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_INTTYPES_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_IO_H 1 ++ ++/* Define to 1 if you have the `isascii' function. */ ++#define HAVE_ISASCII 1 ++ ++/* Define to 1 if you have the `isatty' function. */ ++#undef HAVE_ISATTY ++ ++/* Define to 1 if you have the `isblank' function. */ ++#undef HAVE_ISBLANK ++ ++/* Define if you have and nl_langinfo(CODESET). */ ++#undef HAVE_LANGINFO_CODESET ++ ++/* Define if your file defines LC_MESSAGES. */ ++#define HAVE_LC_MESSAGES 1 ++ ++/* Define to 1 if you have the `regex' library (-lregex). */ ++#undef HAVE_LIBREGEX ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_LIMITS_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_LOCALE_H ++ ++/* Define to 1 if you support file names longer than 14 characters. */ ++#define HAVE_LONG_FILE_NAMES 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_MALLOC_H 1 ++ ++/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ ++#undef HAVE_MBRTOWC ++ ++/* Define to 1 if declares mbstate_t. */ ++#undef HAVE_MBSTATE_T ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_MCHECK_H ++ ++/* Define to 1 if you have the `memchr' function. */ ++#define HAVE_MEMCHR 1 ++ ++/* Define to 1 if you have the `memcmp' function. */ ++#define HAVE_MEMCMP 1 ++ ++/* Define to 1 if you have the `memcpy' function. */ ++#define HAVE_MEMCPY 1 ++ ++/* Define to 1 if you have the `memmove' function. */ ++#define HAVE_MEMMOVE 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the `mempcpy' function. */ ++#undef HAVE_MEMPCPY ++ ++/* Define to 1 if you have the `memset' function. */ ++#define HAVE_MEMSET 1 ++ ++/* Define to 1 if you have the `mkstemp' function. */ ++#undef HAVE_MKSTEMP ++ ++/* Define to 1 if you have a working `mmap' system call. */ ++#undef HAVE_MMAP ++ ++/* Define to 1 if you have the `munmap' function. */ ++#undef HAVE_MUNMAP ++ ++/* Define to 1 if you have the header file, and it defines `DIR'. */ ++#undef HAVE_NDIR_H ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_NL_TYPES_H ++ ++/* Define to 1 if libc includes obstacks. */ ++#undef HAVE_OBSTACK ++ ++/* Define to 1 if you have the `pathconf' function. */ ++#undef HAVE_PATHCONF ++ ++/* Define to 1 if you have the `popen' function. */ ++#define HAVE_POPEN 1 ++ ++/* Define to 1 if you have the `putenv' function. */ ++#define HAVE_PUTENV 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_REGEX_H ++ ++/* Define to 1 if you have the `setenv' function. */ ++#define HAVE_SETENV 1 ++ ++/* Define to 1 if you have the `setlocale' function. */ ++#undef HAVE_SETLOCALE ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDARG_H 1 ++ ++/* Define to 1 if stdbool.h conforms to C99. */ ++#undef HAVE_STDBOOL_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDDEF_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_STDINT_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the `stpcpy' function. */ ++#undef HAVE_STPCPY ++ ++/* Define to 1 if you have the `strcasecmp' function. */ ++#undef HAVE_STRCASECMP ++ ++/* Define to 1 if you have the `strchr' function. */ ++#define HAVE_STRCHR 1 ++ ++/* Define to 1 if you have the `strdup' function. */ ++#define HAVE_STRDUP 1 ++ ++/* Define to 1 if you have the `strerror' function. */ ++#define HAVE_STRERROR 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_STRINGS_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the `strtoul' function. */ ++#define HAVE_STRTOUL 1 ++ ++/* Define to 1 if you have the `strverscmp' function. */ ++#undef HAVE_STRVERSCMP ++ ++/* Define to 1 if you have the header file, and it defines `DIR'. ++ */ ++#define HAVE_SYS_DIR_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_SYS_FILE_H ++ ++/* Define to 1 if you have the header file, and it defines `DIR'. ++ */ ++#define HAVE_SYS_NDIR_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_PARAM_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_TYPES_H 1 ++ ++/* Define to 1 if you have the `tsearch' function. */ ++#define HAVE_TSEARCH 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_UNISTD_H ++ ++/* Define to 1 if you have the `vprintf' function. */ ++#define HAVE_VPRINTF 1 ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_WCHAR_H ++ ++/* Define to 1 if you have the `wcrtomb' function. */ ++#undef HAVE_WCRTOMB ++ ++/* Define to 1 if you have the `wcscoll' function. */ ++#undef HAVE_WCSCOLL ++ ++/* Define to 1 if you have the header file. */ ++#undef HAVE_WCTYPE_H ++ ++/* Define to 1 if the system has the type `_Bool'. */ ++#undef HAVE__BOOL ++ ++/* Define to 1 if you have the `__argz_count' function. */ ++#undef HAVE___ARGZ_COUNT ++ ++/* Define to 1 if you have the `__argz_next' function. */ ++#undef HAVE___ARGZ_NEXT ++ ++/* Define to 1 if you have the `__argz_stringify' function. */ ++#undef HAVE___ARGZ_STRINGIFY ++ ++/* Define as const if the declaration of iconv() needs const. */ ++#undef ICONV_CONST ++ ++/* Name of package */ ++#define PACKAGE "sed" ++ ++/* Define to the address where bug reports for this package should be sent. */ ++#undef PACKAGE_BUGREPORT ++ ++/* Define to the full name of this package. */ ++#undef PACKAGE_NAME ++ ++/* Define to the full name and version of this package. */ ++#undef PACKAGE_STRING ++ ++/* Define to the one symbol short name of this package. */ ++#undef PACKAGE_TARNAME ++ ++/* Define to the version of this package. */ ++#undef PACKAGE_VERSION ++ ++/* Define to the version of GNU sed whose features are supported by this sed. ++ */ ++#define SED_FEATURE_VERSION "5.1" ++ ++/* If using the C implementation of alloca, define if you know the ++ direction of stack growth for your system; otherwise it will be ++ automatically deduced at run-time. ++ STACK_DIRECTION > 0 => grows toward higher addresses ++ STACK_DIRECTION < 0 => grows toward lower addresses ++ STACK_DIRECTION = 0 => direction of growth unknown */ ++#undef STACK_DIRECTION ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define STDC_HEADERS 1 ++ ++/* Version number of package */ ++#define VERSION "4.1.5" ++ ++/* Define to 1 if on AIX 3. ++ System headers sometimes define this. ++ We just want to avoid a redefinition error message. */ ++#ifndef _ALL_SOURCE ++# undef _ALL_SOURCE ++#endif ++ ++/* Number of bits in a file offset, on hosts where this is settable. */ ++#undef _FILE_OFFSET_BITS ++ ++/* Enable GNU extensions on systems that have them. */ ++#ifndef _GNU_SOURCE ++# undef _GNU_SOURCE ++#endif ++ ++/* Define for large files, on AIX-style hosts. */ ++#undef _LARGE_FILES ++ ++/* Define to 1 if on MINIX. */ ++#undef _MINIX ++ ++/* Define to 2 if the system does not provide POSIX.1 features except with ++ this defined. */ ++#undef _POSIX_1_SOURCE ++ ++/* Define to 1 if you need to in order for `stat' and other things to work. */ ++#undef _POSIX_SOURCE ++ ++/* Include BSD functions in regex, used by the testsuite */ ++#undef _REGEX_RE_COMP ++ ++/* Define to empty if `const' does not conform to ANSI C. */ ++#undef const ++ ++/* Define to `__inline__' or `__inline' if that's what the C compiler ++ calls it, or to nothing if 'inline' is not supported under any name. */ ++#ifndef __cplusplus ++#define inline __inline ++#endif ++ ++/* Define to a type if does not define. */ ++#define mbstate_t int ++ ++/* Define to `long' if does not define. */ ++#undef off_t ++ ++/* Define to `unsigned' if does not define. */ ++#undef size_t ++ ++/* Define to `int' if does not define. */ ++#undef ssize_t +diff -Nru ../release/sed-4.1.5/lib/Makefile.msc ./lib/Makefile.msc +--- ../release/sed-4.1.5/lib/Makefile.msc 1969-12-31 16:00:00.000000000 -0800 ++++ ./lib/Makefile.msc 2006-09-28 19:10:18.880835600 -0700 +@@ -0,0 +1,20 @@ ++SOURCES=getline.c getopt.c getopt1.c mkstemp.c obstack.c regex.c strverscmp.c utils.c ++ ++OBJECTS=$(SOURCES:.c=.obj) ++ ++CFLAGS=-I.. -I. -DBOOTSTRAP -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_CONFIG_H ++ ++all : libsed.lib ++ ++install : ++ ++clean : ++ del $(OBJECTS) regex.h libsed.lib *~ 2>nul ++ ++regex.h : regex_.h ++ copy /b $**+nul $@ ++ ++$(OBJECTS) : ..\config.h ++ ++libsed.lib : regex.h $(OBJECTS) ++ lib /out:$@ $(OBJECTS) +diff -Nru ../release/sed-4.1.5/lib/regcomp.c ./lib/regcomp.c +--- ../release/sed-4.1.5/lib/regcomp.c 2005-12-06 00:46:51.000000000 -0800 ++++ ./lib/regcomp.c 2006-09-28 04:36:14.084476200 -0700 +@@ -506,11 +506,7 @@ + from either regcomp or regexec. We don't use PREG here. */ + + size_t +-regerror (errcode, preg, errbuf, errbuf_size) +- int errcode; +- const regex_t *__restrict preg; +- char *__restrict errbuf; +- size_t errbuf_size; ++regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf, size_t errbuf_size) + { + const char *msg; + size_t msg_size; +diff -Nru ../release/sed-4.1.5/lib/regex_internal.h ./lib/regex_internal.h +--- ../release/sed-4.1.5/lib/regex_internal.h 2005-12-06 00:50:56.000000000 -0800 ++++ ./lib/regex_internal.h 2006-09-28 04:33:10.987210800 -0700 +@@ -410,7 +410,9 @@ + #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) + #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) + ++#ifdef HAVE_ALLOCA_H + #include ++#endif + + #ifndef _LIBC + # if HAVE_ALLOCA +diff -Nru ../release/sed-4.1.5/lib/regexec.c ./lib/regexec.c +--- ../release/sed-4.1.5/lib/regexec.c 2005-12-06 00:46:56.000000000 -0800 ++++ ./lib/regexec.c 2006-09-28 04:50:51.101314600 -0700 +@@ -18,6 +18,12 @@ + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + ++#ifdef BOOTSTRAP ++#define bool int ++#define true 1 ++#define false 0 ++#endif ++ + static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, + int n) internal_function; + static void match_ctx_clean (re_match_context_t *mctx) internal_function; +@@ -2894,7 +2900,7 @@ + sizeof (re_dfastate_t *) * (path->alloc - old_alloc)); + } + +- str_idx = path->next_idx ?: top_str; ++ str_idx = path->next_idx ? path->next_idx : top_str; + + /* Temporary modify MCTX. */ + backup_state_log = mctx->state_log; +diff -Nru ../release/sed-4.1.5/Makefile.msc ./Makefile.msc +--- ../release/sed-4.1.5/Makefile.msc 1969-12-31 16:00:00.000000000 -0800 ++++ ./Makefile.msc 2006-09-28 19:10:18.552737900 -0700 +@@ -0,0 +1,17 @@ ++DIRS=lib sed ++ ++all : config.h ++ ++dummy_target : ++ ++install : dummy_target ++ ++all install : ++ @for %%i in ( $(DIRS) ) do @( cd %%i & nmake /nologo -f Makefile.msc $@ & cd .. ) ++ ++clean : ++ del config.h *~ 2>nul ++ @for %%i in ( $(DIRS) ) do @( cd %%i & nmake /nologo -f Makefile.msc $@ & cd .. ) ++ ++config.h : config_h.msc ++ copy /b $**+nul $@ +diff -Nru ../release/sed-4.1.5/sed/compile.c ./sed/compile.c +--- ../release/sed-4.1.5/sed/compile.c 2006-02-03 01:06:26.000000000 -0800 ++++ ./sed/compile.c 2006-09-28 05:48:12.636140800 -0700 +@@ -451,9 +451,7 @@ + + static int snarf_char_class P_((struct buffer *b, mbstate_t *cur_stat)); + static int +-snarf_char_class(b, cur_stat) +- struct buffer *b; +- mbstate_t *cur_stat; ++snarf_char_class(struct buffer *b, mbstate_t *cur_stat) + { + int ch; + int state = 0; +@@ -531,9 +529,7 @@ + + static struct buffer *match_slash P_((int slash, bool regex)); + static struct buffer * +-match_slash(slash, regex) +- int slash; +- bool regex; ++match_slash(int slash, bool regex) + { + struct buffer *b; + int ch; +diff -Nru ../release/sed-4.1.5/sed/Makefile.msc ./sed/Makefile.msc +--- ../release/sed-4.1.5/sed/Makefile.msc 1969-12-31 16:00:00.000000000 -0800 ++++ ./sed/Makefile.msc 2006-09-28 19:10:19.193309600 -0700 +@@ -0,0 +1,18 @@ ++SOURCES=sed.c compile.c execute.c regexp.c fmt.c mbcs.c ++ ++OBJECTS=$(SOURCES:.c=.obj) ++ ++CFLAGS=-I.. -I. -I../lib -DBOOTSTRAP -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_CONFIG_H ++ ++all : sed.exe ++ ++install : ++ copy sed.exe ..\..\..\bin ++ ++clean : ++ del $(OBJECTS) sed.exe *~ 2>nul ++ ++$(OBJECTS) : ..\config.h ++ ++sed.exe : $(OBJECTS) ++ link /out:sed.exe /subsystem:console /opt:ref $(OBJECTS) ..\lib\libsed.lib diff --git a/bacula/src/win32/patches/sqlite.patch b/bacula/src/win32/patches/sqlite.patch new file mode 100644 index 0000000000..4898bbb255 --- /dev/null +++ b/bacula/src/win32/patches/sqlite.patch @@ -0,0 +1,162 @@ +Index: main.mk +--- ../orig/sqlite-3.3.6/main.mk 2006-06-06 03:52:26.000000000 -0700 ++++ ./main.mk 2006-06-30 15:16:28.000000000 -0700 +@@ -60,7 +60,7 @@ + expr.o func.o hash.o insert.o \ + main.o opcodes.o os.o os_os2.o os_unix.o os_win.o \ + pager.o parse.o pragma.o prepare.o printf.o random.o \ +- select.o table.o tclsqlite.o tokenize.o trigger.o \ ++ select.o table.o tokenize.o trigger.o \ + update.o util.o vacuum.o \ + vdbe.o vdbeapi.o vdbeaux.o vdbefifo.o vdbemem.o \ + where.o utf.o legacy.o +@@ -394,8 +394,8 @@ + + # Rules for building test programs and for running tests + # +-tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a +- $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \ ++tclsqlite3$(EXE): $(TOP)/src/tclsqlite.c libsqlite3.a ++ $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3$(EXE) \ + $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB) + + testfixture$(EXE): $(TOP)/src/tclsqlite.c libsqlite3.a $(TESTSRC) +@@ -604,8 +604,8 @@ + + # Standard install and cleanup targets + # +-install: sqlite3 libsqlite3.a sqlite3.h +- mv sqlite3 /usr/bin ++install: sqlite3$(EXE) libsqlite3.a sqlite3.h ++ mv sqlite3$(EXE) /usr/bin + mv libsqlite3.a /usr/lib + mv sqlite3.h /usr/include + +Index: Makefile.mingw32 +--- ../orig/sqlite-3.3.6/Makefile.mingw32 1969-12-31 16:00:00.000000000 -0800 ++++ ./Makefile.mingw32 2006-06-30 15:14:29.000000000 -0700 +@@ -0,0 +1,124 @@ ++#!/usr/make ++# ++# Makefile for SQLITE ++# ++# This is a template makefile for SQLite. Most people prefer to ++# use the autoconf generated "configure" script to generate the ++# makefile automatically. But that does not work for everybody ++# and in every situation. If you are having problems with the ++# "configure" script, you might want to try this makefile as an ++# alternative. Create a copy of this file, edit the parameters ++# below and type "make". ++# ++ ++#### The toplevel directory of the source tree. This is the directory ++# that contains this "Makefile.in" and the "configure.in" script. ++# ++TOP = .. ++ ++#### C Compiler and options for use in building executables that ++# will run on the platform that is doing the build. ++# ++BCC = gcc -g -O2 ++#BCC = /opt/ancic/bin/c89 -0 ++ ++#### If the target operating system supports the "usleep()" system ++# call, then define the HAVE_USLEEP macro for all C modules. ++# ++#USLEEP = ++USLEEP = -DHAVE_USLEEP=1 ++ ++#### If you want the SQLite library to be safe for use within a ++# multi-threaded program, then define the following macro ++# appropriately: ++# ++THREADSAFE = -DTHREADSAFE=1 ++#THREADSAFE = -DTHREADSAFE=0 ++ ++#### Specify any extra linker options needed to make the library ++# thread safe ++# ++THREADLIB = -lpthreadGCE ++#THREADLIB = ++ ++#### Specify any extra libraries needed to access required functions. ++# ++#TLIBS = -lrt # fdatasync on Solaris 8 ++TLIBS = ++ ++#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1 ++# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all ++# malloc()s and free()s in order to track down memory leaks. ++# ++# SQLite uses some expensive assert() statements in the inner loop. ++# You can make the library go almost twice as fast if you compile ++# with -DNDEBUG=1 ++# ++#OPTS = -DSQLITE_DEBUG=2 ++#OPTS = -DSQLITE_DEBUG=1 ++#OPTS = ++OPTS = -DNDEBUG=1 ++OPTS += -DHAVE_FDATASYNC=1 ++ ++#### The suffix to add to executable files. ".exe" for windows. ++# Nothing for unix. ++# ++EXE = .exe ++#EXE = ++ ++#### C Compile and options for use in building executables that ++# will run on the target platform. This is usually the same ++# as BCC, unless you are cross-compiling. ++# ++#TCC = gcc -O6 ++#TCC = gcc -g -O0 -Wall ++#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage ++TCC = $(CROSSTOOLS)/mingw32-gcc -O6 ++#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive ++ ++#### Tools used to build a static library. ++# ++#AR = ar cr ++AR = $(CROSSTOOLS)/mingw32-ar cr ++#RANLIB = ranlib ++RANLIB = $(CROSSTOOLS)/mingw32-ranlib ++ ++#### Extra compiler options needed for programs that use the TCL library. ++# ++#TCL_FLAGS = ++#TCL_FLAGS = -DSTATIC_BUILD=1 ++#TCL_FLAGS = -I/home/drh/tcltk/8.4linux ++#TCL_FLAGS = -I/home/drh/tcltk/8.4win -DSTATIC_BUILD=1 ++#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux ++ ++#### Linker options needed to link against the TCL library. ++# ++#LIBTCL = -ltcl84 ++#LIBTCL = /home/drh/tcltk/8.4linux/libtcl8.4g.a -lm -ldl ++#LIBTCL = /home/drh/tcltk/8.4win/libtcl84s.a -lmsvcrt ++#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc ++ ++#### Compiler options needed for programs that use the readline() library. ++# ++READLINE_FLAGS = ++#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline ++ ++#### Linker options needed by programs using readline() must link against. ++# ++LIBREADLINE = ++#LIBREADLINE = -static -lreadline -ltermcap ++ ++#### Should the database engine assume text is coded as UTF-8 or iso8859? ++# ++# ENCODING = UTF8 ++ENCODING = ISO8859 ++ ++ ++#### Which "awk" program provides nawk compatibilty ++# ++# NAWK = nawk ++NAWK = awk ++ ++# You should not have to change anything below this line ++############################################################################### ++include $(TOP)/main.mk diff --git a/bacula/src/win32/patches/sqlite_msc.patch b/bacula/src/win32/patches/sqlite_msc.patch new file mode 100644 index 0000000000..5f8161d8de --- /dev/null +++ b/bacula/src/win32/patches/sqlite_msc.patch @@ -0,0 +1,768 @@ +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ Makefile.msvc 2006-11-23 12:38:22.724805900 -0800 +@@ -0,0 +1,136 @@ ++#!/usr/make ++# ++# Makefile for SQLITE ++# ++# This is a template makefile for SQLite. Most people prefer to ++# use the autoconf generated "configure" script to generate the ++# makefile automatically. But that does not work for everybody ++# and in every situation. If you are having problems with the ++# "configure" script, you might want to try this makefile as an ++# alternative. Create a copy of this file, edit the parameters ++# below and type "make". ++# ++ ++#### The toplevel directory of the source tree. This is the directory ++# that contains this "Makefile.in" and the "configure.in" script. ++# ++TOP = .. ++ ++#### C Compiler and options for use in building executables that ++# will run on the platform that is doing the build. ++# ++BCC = cl /Zi /Ox /Gy /MD ++#BCC = /opt/ancic/bin/c89 -0 ++ ++#### If the target operating system supports the "usleep()" system ++# call, then define the HAVE_USLEEP macro for all C modules. ++# ++USLEEP = ++#USLEEP = -DHAVE_USLEEP=1 ++ ++#### If you want the SQLite library to be safe for use within a ++# multi-threaded program, then define the following macro ++# appropriately: ++# ++THREADSAFE = -DTHREADSAFE=1 ++#THREADSAFE = -DTHREADSAFE=0 ++ ++#### Specify any extra linker options needed to make the library ++# thread safe ++# ++#THREADLIB = -lpthread ++THREADLIB = ++ ++#### Specify any extra libraries needed to access required functions. ++# ++#TLIBS = -lrt # fdatasync on Solaris 8 ++TLIBS = ++ ++#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1 ++# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all ++# malloc()s and free()s in order to track down memory leaks. ++# ++# SQLite uses some expensive assert() statements in the inner loop. ++# You can make the library go almost twice as fast if you compile ++# with -DNDEBUG=1 ++# ++#OPTS = -DSQLITE_DEBUG=2 ++#OPTS = -DSQLITE_DEBUG=1 ++#OPTS = ++OPTS = -DNDEBUG=1 -D_CRT_SECURE_NO_DEPRECATE ++#OPTS += -DHAVE_FDATASYNC=1 ++ ++#### The suffix to add to executable files. ".exe" for windows. ++# Nothing for unix. ++# ++EXE = .exe ++#EXE = ++ ++#### C Compile and options for use in building executables that ++# will run on the target platform. This is usually the same ++# as BCC, unless you are cross-compiling. ++# ++#TCC = gcc -O6 ++#TCC = gcc -g -O0 -Wall ++#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage ++#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6 ++#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive ++TCC = cl /Zi /Ox /Gy /MD ++ ++#### Tools used to build a static library. ++# ++AR = lib ++#AR = /opt/mingw/bin/i386-mingw32-ar cr ++#RANLIB = ranlib ++#RANLIB = /opt/mingw/bin/i386-mingw32-ranlib ++ ++#MKSHLIB = gcc -shared ++#SO = so ++#SHPREFIX = lib ++SO = dll ++SHPREFIX = ++ ++#### Extra compiler options needed for programs that use the TCL library. ++# ++#TCL_FLAGS = ++#TCL_FLAGS = -DSTATIC_BUILD=1 ++#TCL_FLAGS = -I/home/drh/tcltk/8.4linux ++#TCL_FLAGS = -I/home/drh/tcltk/8.4win -DSTATIC_BUILD=1 ++#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux ++ ++#### Linker options needed to link against the TCL library. ++# ++#LIBTCL = -ltcl -lm -ldl ++#LIBTCL = /home/drh/tcltk/8.4linux/libtcl8.4g.a -lm -ldl ++#LIBTCL = /home/drh/tcltk/8.4win/libtcl84s.a -lmsvcrt ++#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc ++ ++#### Compiler options needed for programs that use the readline() library. ++# ++READLINE_FLAGS = ++#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline ++ ++#### Linker options needed by programs using readline() must link against. ++# ++LIBREADLINE = ++#LIBREADLINE = -static -lreadline -ltermcap ++ ++#### Should the database engine assume text is coded as UTF-8 or iso8859? ++# ++ENCODING = UTF8 ++#ENCODING = ISO8859 ++ ++ ++#### Which "awk" program provides nawk compatibilty ++# ++NAWK = nawk ++# NAWK = awk ++ ++#### Where to install ++BINDIR = /usr/bin ++LIBDIR = /usr/lib ++INCDIR = /usr/include ++ ++# You should not have to change anything below this line ++############################################################################### ++include ../main.mk.msvc +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ main.mk.msvc 2006-11-23 12:38:22.709180800 -0800 +@@ -0,0 +1,619 @@ ++############################################################################### ++# The following macros should be defined before this script is ++# invoked: ++# ++# TOP The toplevel directory of the source tree. This is the ++# directory that contains this "Makefile.in" and the ++# "configure.in" script. ++# ++# BCC C Compiler and options for use in building executables that ++# will run on the platform that is doing the build. ++# ++# USLEEP If the target operating system supports the "usleep()" system ++# call, then define the HAVE_USLEEP macro for all C modules. ++# ++# THREADSAFE If you want the SQLite library to be safe for use within a ++# multi-threaded program, then define the following macro ++# appropriately: ++# ++# THREADLIB Specify any extra linker options needed to make the library ++# thread safe ++# ++# OPTS Extra compiler command-line options. ++# ++# EXE The suffix to add to executable files. ".exe" for windows ++# and "" for Unix. ++# ++# TCC C Compiler and options for use in building executables that ++# will run on the target platform. This is usually the same ++# as BCC, unless you are cross-compiling. ++# ++# AR Tools used to build a static library. ++# RANLIB ++# ++# TCL_FLAGS Extra compiler options needed for programs that use the ++# TCL library. ++# ++# LIBTCL Linker options needed to link against the TCL library. ++# ++# READLINE_FLAGS Compiler options needed for programs that use the ++# readline() library. ++# ++# LIBREADLINE Linker options needed by programs using readline() must ++# link against. ++# ++# NAWK Nawk compatible awk program. Older (obsolete?) solaris ++# systems need this to avoid using the original AT&T AWK. ++# ++# Once the macros above are defined, the rest of this make script will ++# build the SQLite library and testing tools. ++################################################################################ ++ ++# This is how we compile ++# ++TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src ++ ++# Object files for the SQLite library. ++# ++LIBOBJ = alter.obj analyze.obj attach.obj auth.obj btree.obj build.obj \ ++ callback.obj complete.obj date.obj delete.obj \ ++ expr.obj func.obj hash.obj insert.obj loadext.obj \ ++ main.obj opcodes.obj os.obj os_os2.obj os_unix.obj os_win.obj \ ++ pager.obj parse.obj pragma.obj prepare.obj printf.obj random.obj \ ++ select.obj table.obj tokenize.obj trigger.obj \ ++ update.obj util.obj vacuum.obj \ ++ vdbe.obj vdbeapi.obj vdbeaux.obj vdbefifo.obj vdbemem.obj \ ++ where.obj utf.obj legacy.obj vtab.obj ++# tclsqlite.obj ++ ++# ++# All of the source code files. ++# ++SRC = \ ++ $(TOP)/src/alter.c \ ++ $(TOP)/src/analyze.c \ ++ $(TOP)/src/attach.c \ ++ $(TOP)/src/auth.c \ ++ $(TOP)/src/btree.c \ ++ $(TOP)/src/btree.h \ ++ $(TOP)/src/build.c \ ++ $(TOP)/src/callback.c \ ++ $(TOP)/src/complete.c \ ++ $(TOP)/src/date.c \ ++ $(TOP)/src/delete.c \ ++ $(TOP)/src/expr.c \ ++ $(TOP)/src/func.c \ ++ $(TOP)/src/hash.c \ ++ $(TOP)/src/hash.h \ ++ $(TOP)/src/insert.c \ ++ $(TOP)/src/legacy.c \ ++ $(TOP)/src/loadext.c \ ++ $(TOP)/src/main.c \ ++ $(TOP)/src/os.c \ ++ $(TOP)/src/os_os2.c \ ++ $(TOP)/src/os_unix.c \ ++ $(TOP)/src/os_win.c \ ++ $(TOP)/src/pager.c \ ++ $(TOP)/src/pager.h \ ++ $(TOP)/src/parse.y \ ++ $(TOP)/src/pragma.c \ ++ $(TOP)/src/prepare.c \ ++ $(TOP)/src/printf.c \ ++ $(TOP)/src/random.c \ ++ $(TOP)/src/select.c \ ++ $(TOP)/src/shell.c \ ++ $(TOP)/src/sqlite.h.in \ ++ $(TOP)/src/sqliteInt.h \ ++ $(TOP)/src/table.c \ ++ $(TOP)/src/tclsqlite.c \ ++ $(TOP)/src/tokenize.c \ ++ $(TOP)/src/trigger.c \ ++ $(TOP)/src/utf.c \ ++ $(TOP)/src/update.c \ ++ $(TOP)/src/util.c \ ++ $(TOP)/src/vacuum.c \ ++ $(TOP)/src/vdbe.c \ ++ $(TOP)/src/vdbe.h \ ++ $(TOP)/src/vdbeapi.c \ ++ $(TOP)/src/vdbeaux.c \ ++ $(TOP)/src/vdbefifo.c \ ++ $(TOP)/src/vdbemem.c \ ++ $(TOP)/src/vdbeInt.h \ ++ $(TOP)/src/vtab.c \ ++ $(TOP)/src/where.c ++ ++# Source code for extensions ++# ++SRC = \ ++ $(TOP)/ext/fts1/fts1.c \ ++ $(TOP)/ext/fts1/fts1.h \ ++ $(TOP)/ext/fts1/fts1_hash.c \ ++ $(TOP)/ext/fts1/fts1_hash.h \ ++ $(TOP)/ext/fts1/fts1_porter.c \ ++ $(TOP)/ext/fts1/fts1_tokenizer.h \ ++ $(TOP)/ext/fts1/fts1_tokenizer1.c ++ ++ ++# Source code to the test files. ++# ++TESTSRC = \ ++ $(TOP)/src/btree.c \ ++ $(TOP)/src/date.c \ ++ $(TOP)/src/func.c \ ++ $(TOP)/src/main.c \ ++ $(TOP)/src/os.c \ ++ $(TOP)/src/os_os2.c \ ++ $(TOP)/src/os_unix.c \ ++ $(TOP)/src/os_win.c \ ++ $(TOP)/src/pager.c \ ++ $(TOP)/src/pragma.c \ ++ $(TOP)/src/printf.c \ ++ $(TOP)/src/test1.c \ ++ $(TOP)/src/test2.c \ ++ $(TOP)/src/test3.c \ ++ $(TOP)/src/test4.c \ ++ $(TOP)/src/test5.c \ ++ $(TOP)/src/test6.c \ ++ $(TOP)/src/test7.c \ ++ $(TOP)/src/test8.c \ ++ $(TOP)/src/test_autoext.c \ ++ $(TOP)/src/test_async.c \ ++ $(TOP)/src/test_md5.c \ ++ $(TOP)/src/test_schema.c \ ++ $(TOP)/src/test_server.c \ ++ $(TOP)/src/test_tclvar.c \ ++ $(TOP)/src/utf.c \ ++ $(TOP)/src/util.c \ ++ $(TOP)/src/vdbe.c \ ++ $(TOP)/src/vdbeaux.c \ ++ $(TOP)/src/where.c ++ ++# Header files used by all library source files. ++# ++HDR = \ ++ sqlite3.h \ ++ $(TOP)/src/btree.h \ ++ $(TOP)/src/hash.h \ ++ opcodes.h \ ++ $(TOP)/src/os.h \ ++ $(TOP)/src/os_common.h \ ++ $(TOP)/src/sqlite3ext.h \ ++ $(TOP)/src/sqliteInt.h \ ++ $(TOP)/src/vdbe.h \ ++ parse.h ++ ++# Header files used by extensions ++# ++HDR = \ ++ $(TOP)/ext/fts1/fts1.h \ ++ $(TOP)/ext/fts1/fts1_hash.h \ ++ $(TOP)/ext/fts1/fts1_tokenizer.h ++ ++ ++# Header files used by the VDBE submodule ++# ++VDBEHDR = \ ++ $(HDR) \ ++ $(TOP)/src/vdbeInt.h ++ ++# This is the default Makefile target. The objects listed here ++# are what get build when you type just "make" with no arguments. ++# ++all: sqlite3.h parse.h opcodes.h sqlite3.lib sqlite3$(EXE) ++ ++# Generate the file "last_change" which contains the date of change ++# of the most recently modified source code file ++# ++last_change: $(SRC) ++ cat $(SRC) | grep '$Id: ' | sort -k 5 | tail -1 \ ++ | $(NAWK) '{print $5,$6}' >last_change ++ ++sqlite3.lib: $(LIBOBJ) ++ $(AR) /out:sqlite3.lib $(LIBOBJ) ++ ++sqlite3$(EXE): $(TOP)/src/shell.c sqlite3.lib sqlite3.h ++ $(TCCX) $(READLINE_FLAGS) /Fesqlite3$(EXE) $(TOP)/src/shell.c \ ++ sqlite3.lib $(LIBREADLINE) $(TLIBS) $(THREADLIB) ++ ++objects: $(LIBOBJ_ORIG) ++ ++# This target creates a directory named "tsrc" and fills it with ++# copies of all of the C source code and header files needed to ++# build on the target system. Some of the C source code and header ++# files are automatically generated. This target takes care of ++# all that automatic generation. ++# ++target_source: $(SRC) $(VDBEHDR) opcodes.c keywordhash.h ++ rd /s /q tsrc ++ mkdir tsrc ++ copy $(SRC) $(VDBEHDR) tsrc ++ del tsrc\sqlite.h.in tsrc\parse.y ++ copy parse.c opcodes.c keywordhash.h tsrc ++ ++# Rules to build the LEMON compiler generator ++# ++lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c ++ $(BCC) /Felemon $(OPTS) $(TOP)/tool/lemon.c ++ copy $(TOP)\tool\lempar.c . ++ ++# Rules to build individual files ++# ++alter.obj: $(TOP)/src/alter.c $(HDR) ++ $(TCCX) -c $(TOP)/src/alter.c ++ ++analyze.obj: $(TOP)/src/analyze.c $(HDR) ++ $(TCCX) -c $(TOP)/src/analyze.c ++ ++attach.obj: $(TOP)/src/attach.c $(HDR) ++ $(TCCX) -c $(TOP)/src/attach.c ++ ++auth.obj: $(TOP)/src/auth.c $(HDR) ++ $(TCCX) -c $(TOP)/src/auth.c ++ ++btree.obj: $(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h ++ $(TCCX) -c $(TOP)/src/btree.c ++ ++build.obj: $(TOP)/src/build.c $(HDR) ++ $(TCCX) -c $(TOP)/src/build.c ++ ++callback.obj: $(TOP)/src/callback.c $(HDR) ++ $(TCCX) -c $(TOP)/src/callback.c ++ ++complete.obj: $(TOP)/src/complete.c $(HDR) ++ $(TCCX) -c $(TOP)/src/complete.c ++ ++date.obj: $(TOP)/src/date.c $(HDR) ++ $(TCCX) -c $(TOP)/src/date.c ++ ++delete.obj: $(TOP)/src/delete.c $(HDR) ++ $(TCCX) -c $(TOP)/src/delete.c ++ ++expr.obj: $(TOP)/src/expr.c $(HDR) ++ $(TCCX) -c $(TOP)/src/expr.c ++ ++func.obj: $(TOP)/src/func.c $(HDR) ++ $(TCCX) -c $(TOP)/src/func.c ++ ++hash.obj: $(TOP)/src/hash.c $(HDR) ++ $(TCCX) -c $(TOP)/src/hash.c ++ ++insert.obj: $(TOP)/src/insert.c $(HDR) ++ $(TCCX) -c $(TOP)/src/insert.c ++ ++legacy.obj: $(TOP)/src/legacy.c $(HDR) ++ $(TCCX) -c $(TOP)/src/legacy.c ++ ++loadext.obj: $(TOP)/src/loadext.c $(HDR) ++ $(TCCX) -c $(TOP)/src/loadext.c ++ ++main.obj: $(TOP)/src/main.c $(HDR) ++ $(TCCX) -c $(TOP)/src/main.c ++ ++pager.obj: $(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h ++ $(TCCX) -c $(TOP)/src/pager.c ++ ++opcodes.obj: opcodes.c ++ $(TCCX) -c opcodes.c ++ ++opcodes.c: opcodes.h $(TOP)/mkopcodec.awk ++ sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c ++ ++opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk ++ copy parse.h+$(TOP)\src\vdbe.c input.tmp ++ $(NAWK) -f $(TOP)/mkopcodeh.awk opcodes.h ++ del input.tmp ++ ++os.obj: $(TOP)/src/os.c $(HDR) ++ $(TCCX) -c $(TOP)/src/os.c ++ ++os_os2.obj: $(TOP)/src/os_os2.c $(HDR) ++ $(TCCX) -c $(TOP)/src/os_os2.c ++ ++os_unix.obj: $(TOP)/src/os_unix.c $(HDR) ++ $(TCCX) -c $(TOP)/src/os_unix.c ++ ++os_win.obj: $(TOP)/src/os_win.c $(HDR) ++ $(TCCX) -c $(TOP)/src/os_win.c ++ ++parse.obj: parse.c $(HDR) ++ $(TCCX) -c parse.c ++ ++#parse.h: parse.c ++ ++parse.c parse.h: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk ++ copy $(TOP)\src\parse.y . ++ lemon $(OPTS) parse.y ++ ren parse.h parse.h.temp ++ nawk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h ++ del parse.h.temp ++ ++pragma.obj: $(TOP)/src/pragma.c $(HDR) ++ $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/pragma.c ++ ++prepare.obj: $(TOP)/src/prepare.c $(HDR) ++ $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/prepare.c ++ ++printf.obj: $(TOP)/src/printf.c $(HDR) ++ $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/printf.c ++ ++random.obj: $(TOP)/src/random.c $(HDR) ++ $(TCCX) -c $(TOP)/src/random.c ++ ++select.obj: $(TOP)/src/select.c $(HDR) ++ $(TCCX) -c $(TOP)/src/select.c ++ ++sqlite3.h: $(TOP)/src/sqlite.h.in ++ ..\update_ver $(TOP)\src\sqlite.h.in >sqlite3.h ++ ++table.obj: $(TOP)/src/table.c $(HDR) ++ $(TCCX) -c $(TOP)/src/table.c ++ ++tclsqlite.obj: $(TOP)/src/tclsqlite.c $(HDR) ++ $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c ++ ++tokenize.obj: $(TOP)/src/tokenize.c keywordhash.h $(HDR) ++ $(TCCX) -c $(TOP)/src/tokenize.c ++ ++keywordhash.h: $(TOP)/tool/mkkeywordhash.c ++ $(BCC) /Femkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c ++ mkkeywordhash >keywordhash.h ++ ++trigger.obj: $(TOP)/src/trigger.c $(HDR) ++ $(TCCX) -c $(TOP)/src/trigger.c ++ ++update.obj: $(TOP)/src/update.c $(HDR) ++ $(TCCX) -c $(TOP)/src/update.c ++ ++utf.obj: $(TOP)/src/utf.c $(HDR) ++ $(TCCX) -c $(TOP)/src/utf.c ++ ++util.obj: $(TOP)/src/util.c $(HDR) ++ $(TCCX) -c $(TOP)/src/util.c ++ ++vacuum.obj: $(TOP)/src/vacuum.c $(HDR) ++ $(TCCX) -c $(TOP)/src/vacuum.c ++ ++vdbe.obj: $(TOP)/src/vdbe.c $(VDBEHDR) ++ $(TCCX) -c $(TOP)/src/vdbe.c ++ ++vdbeapi.obj: $(TOP)/src/vdbeapi.c $(VDBEHDR) ++ $(TCCX) -c $(TOP)/src/vdbeapi.c ++ ++vdbeaux.obj: $(TOP)/src/vdbeaux.c $(VDBEHDR) ++ $(TCCX) -c $(TOP)/src/vdbeaux.c ++ ++vdbefifo.obj: $(TOP)/src/vdbefifo.c $(VDBEHDR) ++ $(TCCX) -c $(TOP)/src/vdbefifo.c ++ ++vdbemem.obj: $(TOP)/src/vdbemem.c $(VDBEHDR) ++ $(TCCX) -c $(TOP)/src/vdbemem.c ++ ++vtab.obj: $(TOP)/src/vtab.c $(VDBEHDR) ++ $(TCCX) -c $(TOP)/src/vtab.c ++ ++where.obj: $(TOP)/src/where.c $(HDR) ++ $(TCCX) -c $(TOP)/src/where.c ++ ++# Rules for building test programs and for running tests ++# ++tclsqlite3: $(TOP)/src/tclsqlite.c sqlite3.lib ++ $(TCCX) $(TCL_FLAGS) -DTCLSH=1 /Fetclsqlite3 \ ++ $(TOP)/src/tclsqlite.c sqlite3.lib $(LIBTCL) $(THREADLIB) ++ ++testfixture$(EXE): $(TOP)/src/tclsqlite.c sqlite3.lib $(TESTSRC) ++ $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \ ++ -DSQLITE_SERVER=1 /Fetestfixture$(EXE) \ ++ $(TESTSRC) $(TOP)/src/tclsqlite.c \ ++ sqlite3.lib $(LIBTCL) $(THREADLIB) ++ ++fulltest: testfixture$(EXE) sqlite3$(EXE) ++ testfixture$(EXE) $(TOP)/test/all.test ++ ++test: testfixture$(EXE) sqlite3$(EXE) ++ testfixture$(EXE) $(TOP)/test/quick.test ++ ++sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.lib $(TESTSRC) \ ++ $(TOP)/tool/spaceanal.tcl ++ sed \ ++ -e '/^#/d' \ ++ -e 's,\\,\\\\,g' \ ++ -e 's,",\\",g' \ ++ -e 's,^,",' \ ++ -e 's,$$,\\n",' \ ++ $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h ++ $(TCCX) $(TCL_FLAGS) -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 \ ++ /Fesqlite3_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \ ++ sqlite3.lib $(LIBTCL) $(THREADLIB) ++ ++TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO) ++$(TEST_EXTENSION): $(TOP)/src/test_loadext.c ++ $(MKSHLIB) $(TOP)/src/test_loadext.c /Fe$(TEST_EXTENSION) ++ ++extensiontest: testfixture$(EXE) $(TEST_EXTENSION) ++ testfixture$(EXE) $(TOP)/test/loadext.test ++ ++# Rules used to build documentation ++# ++arch.html: $(TOP)/www/arch.tcl ++ tclsh $(TOP)/www/arch.tcl >arch.html ++ ++autoinc.html: $(TOP)/www/autoinc.tcl ++ tclsh $(TOP)/www/autoinc.tcl >autoinc.html ++ ++c_interface.html: $(TOP)/www/c_interface.tcl ++ tclsh $(TOP)/www/c_interface.tcl >c_interface.html ++ ++capi3.html: $(TOP)/www/capi3.tcl ++ tclsh $(TOP)/www/capi3.tcl >capi3.html ++ ++capi3ref.html: $(TOP)/www/capi3ref.tcl ++ tclsh $(TOP)/www/capi3ref.tcl >capi3ref.html ++ ++changes.html: $(TOP)/www/changes.tcl ++ tclsh $(TOP)/www/changes.tcl >changes.html ++ ++compile.html: $(TOP)/www/compile.tcl ++ tclsh $(TOP)/www/compile.tcl >compile.html ++ ++copyright.html: $(TOP)/www/copyright.tcl ++ tclsh $(TOP)/www/copyright.tcl >copyright.html ++ ++copyright-release.html: $(TOP)/www/copyright-release.html ++ copy $(TOP)/www/copyright-release.html . ++ ++copyright-release.pdf: $(TOP)/www/copyright-release.pdf ++ copy $(TOP)/www/copyright-release.pdf . ++ ++common.tcl: $(TOP)/www/common.tcl ++ copy $(TOP)/www/common.tcl . ++ ++conflict.html: $(TOP)/www/conflict.tcl ++ tclsh $(TOP)/www/conflict.tcl >conflict.html ++ ++datatypes.html: $(TOP)/www/datatypes.tcl ++ tclsh $(TOP)/www/datatypes.tcl >datatypes.html ++ ++datatype3.html: $(TOP)/www/datatype3.tcl ++ tclsh $(TOP)/www/datatype3.tcl >datatype3.html ++ ++different.html: $(TOP)/www/different.tcl ++ tclsh $(TOP)/www/different.tcl >different.html ++ ++docs.html: $(TOP)/www/docs.tcl ++ tclsh $(TOP)/www/docs.tcl >docs.html ++ ++download.html: $(TOP)/www/download.tcl ++ mkdir -p doc ++ tclsh $(TOP)/www/download.tcl >download.html ++ ++faq.html: $(TOP)/www/faq.tcl ++ tclsh $(TOP)/www/faq.tcl >faq.html ++ ++fileformat.html: $(TOP)/www/fileformat.tcl ++ tclsh $(TOP)/www/fileformat.tcl >fileformat.html ++ ++formatchng.html: $(TOP)/www/formatchng.tcl ++ tclsh $(TOP)/www/formatchng.tcl >formatchng.html ++ ++index.html: $(TOP)/www/index.tcl last_change ++ tclsh $(TOP)/www/index.tcl >index.html ++ ++lang.html: $(TOP)/www/lang.tcl ++ tclsh $(TOP)/www/lang.tcl doc >lang.html ++ ++pragma.html: $(TOP)/www/pragma.tcl ++ tclsh $(TOP)/www/pragma.tcl >pragma.html ++ ++lockingv3.html: $(TOP)/www/lockingv3.tcl ++ tclsh $(TOP)/www/lockingv3.tcl >lockingv3.html ++ ++sharedcache.html: $(TOP)/www/sharedcache.tcl ++ tclsh $(TOP)/www/sharedcache.tcl >sharedcache.html ++ ++mingw.html: $(TOP)/www/mingw.tcl ++ tclsh $(TOP)/www/mingw.tcl >mingw.html ++ ++nulls.html: $(TOP)/www/nulls.tcl ++ tclsh $(TOP)/www/nulls.tcl >nulls.html ++ ++oldnews.html: $(TOP)/www/oldnews.tcl ++ tclsh $(TOP)/www/oldnews.tcl >oldnews.html ++ ++omitted.html: $(TOP)/www/omitted.tcl ++ tclsh $(TOP)/www/omitted.tcl >omitted.html ++ ++opcode.html: $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c ++ tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html ++ ++optimizer.html: $(TOP)/www/optimizer.tcl ++ tclsh $(TOP)/www/optimizer.tcl >optimizer.html ++ ++optoverview.html: $(TOP)/www/optoverview.tcl ++ tclsh $(TOP)/www/optoverview.tcl >optoverview.html ++ ++quickstart.html: $(TOP)/www/quickstart.tcl ++ tclsh $(TOP)/www/quickstart.tcl >quickstart.html ++ ++speed.html: $(TOP)/www/speed.tcl ++ tclsh $(TOP)/www/speed.tcl >speed.html ++ ++sqlite.html: $(TOP)/www/sqlite.tcl ++ tclsh $(TOP)/www/sqlite.tcl >sqlite.html ++ ++support.html: $(TOP)/www/support.tcl ++ tclsh $(TOP)/www/support.tcl >support.html ++ ++tclsqlite.html: $(TOP)/www/tclsqlite.tcl ++ tclsh $(TOP)/www/tclsqlite.tcl >tclsqlite.html ++ ++vdbe.html: $(TOP)/www/vdbe.tcl ++ tclsh $(TOP)/www/vdbe.tcl >vdbe.html ++ ++version3.html: $(TOP)/www/version3.tcl ++ tclsh $(TOP)/www/version3.tcl >version3.html ++ ++whentouse.html: $(TOP)/www/whentouse.tcl ++ tclsh $(TOP)/www/whentouse.tcl >whentouse.html ++ ++ ++# Files to be published on the website. ++# ++DOC = \ ++ arch.html \ ++ autoinc.html \ ++ c_interface.html \ ++ capi3.html \ ++ capi3ref.html \ ++ changes.html \ ++ compile.html \ ++ copyright.html \ ++ copyright-release.html \ ++ copyright-release.pdf \ ++ conflict.html \ ++ datatypes.html \ ++ datatype3.html \ ++ different.html \ ++ docs.html \ ++ download.html \ ++ faq.html \ ++ fileformat.html \ ++ formatchng.html \ ++ index.html \ ++ lang.html \ ++ lockingv3.html \ ++ mingw.html \ ++ nulls.html \ ++ oldnews.html \ ++ omitted.html \ ++ opcode.html \ ++ optimizer.html \ ++ optoverview.html \ ++ pragma.html \ ++ quickstart.html \ ++ sharedcache.html \ ++ speed.html \ ++ sqlite.html \ ++ support.html \ ++ tclsqlite.html \ ++ vdbe.html \ ++ version3.html \ ++ whentouse.html ++ ++doc: common.tcl $(DOC) ++ mkdir -p doc ++ ren $(DOC) doc ++ copy $(TOP)/www/*.gif $(TOP)/art/*.gif doc ++ ++# Standard install and cleanup targets ++# ++install: sqlite3 sqlite3.lib sqlite3.h ++ copy sqlite3 $(BINDIR) ++ copy sqlite3.lib $(LIBDIR) ++ copy sqlite3.h $(INCDIR) ++ ++clean: ++ -del *~ *.obj *.ilk *.pdb sqlite3.exe sqlite3.lib sqlite3.h opcodes.* 2>nul ++ -del lemon.exe lempar.c parse.* sqlite*.tar.gz mkkeywordhash.exe keywordhash.h 2>nul ++ -del *.da *.bb *.bbg gmon.out 2>nul ++ -rd /s /q tsrc 2>nul ++ -del testloadext.dll 2>nul +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ update_ver.cmd 2006-11-23 07:09:03.334906700 -0800 +@@ -0,0 +1,4 @@ ++@echo off ++for /f %%i in ( ..\VERSION ) do set VERSION=%%i ++for /f "usebackq" %%i in ( `cmd /c sed "s/[^0-9]/ /g" ^< ..\VERSION ^| nawk "{printf \"%%d%%03d%%03d\",$1,$2,$3}"` ) do set VERS_NUM=%%i ++sed -e s/--VERS--/%VERSION%/ -e s/--VERSION-NUMBER--/%VERS_NUM%/ %1 diff --git a/bacula/src/win32/patches/stab2cv.patch b/bacula/src/win32/patches/stab2cv.patch new file mode 100644 index 0000000000..696eea1aba --- /dev/null +++ b/bacula/src/win32/patches/stab2cv.patch @@ -0,0 +1,11 @@ +--- src/PEExecutable.cpp.orig 2014-07-09 15:34:55.630375959 +0200 ++++ src/PEExecutable.cpp 2014-07-09 15:35:35.966377397 +0200 +@@ -16,6 +16,8 @@ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + ++#include ++#include + #include "stdafx.h" + #include "defs.h" + #include "ntexe.h" diff --git a/bacula/src/win32/patches/wx.sed b/bacula/src/win32/patches/wx.sed new file mode 100644 index 0000000000..3d33c132e2 --- /dev/null +++ b/bacula/src/win32/patches/wx.sed @@ -0,0 +1,9 @@ +s%config.gcc%config.mingw32% +s%\\\(.\)%/\1%g +s%ranlib%mingw32-ranlib% +s%windres%mingw32-windres% +s%ar rc%mingw32-ar rc% +s%makefile\.gcc%makefile\.mingw32% +s%if exist \([^ ][^ ]*\) del \1%if [ -e \1 ]; then rm \1; fi% +s%if not exist \([^ ][^ ]*\) mkdir \1%if [ ! -e \1 ]; then mkdir \1; fi% +s%if not exist \([^ ][^ ]*\) copy \([^ ][^ ]*\) \1%if [ ! -e \1 ]; then cp \2 \1; fi% diff --git a/bacula/src/win32/patches/wx1.patch b/bacula/src/win32/patches/wx1.patch new file mode 100644 index 0000000000..268497ffe0 --- /dev/null +++ b/bacula/src/win32/patches/wx1.patch @@ -0,0 +1,37 @@ +--- build/msw/config.gcc Sun Feb 5 13:37:26 2006 ++++ build/msw/config.mingw32 Mon Jun 26 16:54:42 2006 +@@ -11,10 +11,10 @@ + # ------------------------------------------------------------------------- + + # C compiler +-CC = gcc ++CC = mingw32-gcc + + # C++ compiler +-CXX = g++ ++CXX = mingw32-g++ + + # Standard flags for CC + CFLAGS = +@@ -23,10 +23,10 @@ + CXXFLAGS = + + # Standard preprocessor flags (common for CC and CXX) +-CPPFLAGS = ++CPPFLAGS = -I../../../zlib + + # Standard linker flags +-LDFLAGS = ++LDFLAGS = -L../../../zlib + + # The C preprocessor + CPP = $(CC) -E +@@ -44,7 +44,7 @@ + MSLU = 0 + + # Type of compiled binaries [debug,release] +-BUILD = debug ++BUILD = release + + # Should debugging info be included in the executables? The default value + # "default" means that debug info will be included if BUILD=debug diff --git a/bacula/src/win32/patches/wx2.patch b/bacula/src/win32/patches/wx2.patch new file mode 100644 index 0000000000..f074d3d578 --- /dev/null +++ b/bacula/src/win32/patches/wx2.patch @@ -0,0 +1,22 @@ +--- ../release/wxWidgets-2.6.3/include/wx/string.h 2005-12-15 11:26:27.000000000 -0800 ++++ ./include/wx/string.h 2006-07-31 20:50:32.000000000 -0700 +@@ -229,7 +229,7 @@ + #endif + // VC++ free must take place in same DLL as allocation when using non dll + // run-time library (e.g. Multithreaded instead of Multithreaded DLL) +-#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) ++#if 1 || defined(__VISUALC__) && defined(_MT) && !defined(_DLL) + void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } + // we must not inline deallocation since allocation is not inlined + void Free(); +--- ../release/wxWidgets-2.6.3/src/common/string.cpp 2005-11-30 05:30:08.000000000 -0800 ++++ ./src/common/string.cpp 2006-07-31 20:48:53.000000000 -0700 +@@ -172,7 +172,7 @@ + // wxStringData class deallocation + // =========================================================================== + +-#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) ++#if 1 || defined(__VISUALC__) && defined(_MT) && !defined(_DLL) + # pragma message (__FILE__ ": building with Multithreaded non DLL runtime has a performance impact on wxString!") + void wxStringData::Free() + { diff --git a/bacula/src/win32/patches/wxWidgets.patch b/bacula/src/win32/patches/wxWidgets.patch new file mode 100644 index 0000000000..64afc4dc0d --- /dev/null +++ b/bacula/src/win32/patches/wxWidgets.patch @@ -0,0 +1,67 @@ +diff -ur wxWidgets-2.8.7-rel/build/msw/config.gcc wxWidgets-2.8.7/build/msw/config.gcc +--- build/msw/config.mingw32 2007-11-21 13:42:45.000000000 +0100 ++++ build/msw/config.mingw32 2008-03-11 15:45:30.000000000 +0100 +@@ -11,10 +11,10 @@ + # ------------------------------------------------------------------------- + + # C compiler +-CC := gcc ++CC := mingw32-gcc + + # C++ compiler +-CXX := g++ ++CXX := mingw32-g++ + + # Standard flags for CC + CFLAGS := +@@ -23,10 +23,10 @@ + CXXFLAGS := + + # Standard preprocessor flags (common for CC and CXX) +-CPPFLAGS := ++CPPFLAGS := -I../../../zlib + + # Standard linker flags +-LDFLAGS := ++LDFLAGS := -L../../../zlib + + # The C preprocessor + CPP := $(CC) -E +@@ -44,7 +44,7 @@ + MSLU := 0 + + # Type of compiled binaries [debug,release] +-BUILD := debug ++BUILD := release + + # Should debugging info be included in the executables? The default value + # "default" means that debug info will be included if BUILD=debug +@@ -131,4 +131,3 @@ + # "3" ...... this is for Mingw 2.0 or newer (comes with gcc3) + # "2.95" ... for Mingw 1.1 or any of the older versions [3,2.95] + GCC_VERSION := 3 +- +diff -ur wxWidgets-2.8.7-rel/include/wx/string.h wxWidgets-2.8.7/include/wx/string.h +--- include/wx/string.h 2007-11-21 13:41:54.000000000 +0100 ++++ include/wx/string.h 2008-03-11 15:50:58.000000000 +0100 +@@ -235,7 +235,7 @@ + #endif + // VC++ free must take place in same DLL as allocation when using non dll + // run-time library (e.g. Multithreaded instead of Multithreaded DLL) +-#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) ++#if 1 || defined(__VISUALC__) && defined(_MT) && !defined(_DLL) + void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } + // we must not inline deallocation since allocation is not inlined + void Free(); +diff -ur wxWidgets-2.8.7-rel/src/common/string.cpp wxWidgets-2.8.7/src/common/string.cpp +--- src/common/string.cpp 2007-11-21 13:41:57.000000000 +0100 ++++ src/common/string.cpp 2008-03-11 15:53:17.000000000 +0100 +@@ -140,7 +140,7 @@ + // wxStringData class deallocation + // =========================================================================== + +-#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) ++#if 1 || defined(__VISUALC__) && defined(_MT) && !defined(_DLL) + # pragma message (__FILE__ ": building with Multithreaded non DLL runtime has a performance impact on wxString!") + void wxStringData::Free() + { diff --git a/bacula/src/win32/patches/zlib.patch b/bacula/src/win32/patches/zlib.patch new file mode 100644 index 0000000000..6b51f492ef --- /dev/null +++ b/bacula/src/win32/patches/zlib.patch @@ -0,0 +1,150 @@ +--- /dev/null Sun Jun 25 06:11:31 2006 ++++ win32/Makefile.mingw32 Sun Jun 25 06:11:06 2006 +@@ -0,0 +1,147 @@ ++# Makefile for zlib, derived from Makefile.dj2. ++# Modified for mingw32 by C. Spieler, 6/16/98. ++# Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. ++# Last updated: 1-Aug-2003. ++# Tested under Cygwin and MinGW. ++ ++# Copyright (C) 1995-2003 Jean-loup Gailly. ++# For conditions of distribution and use, see copyright notice in zlib.h ++ ++# To compile, or to compile and test, type: ++# ++# make -fmakefile.gcc; make test testdll -fmakefile.gcc ++# ++# To use the asm code, type: ++# cp contrib/asm?86/match.S ./match.S ++# make LOC=-DASMV OBJA=match.o -fmakefile.gcc ++# ++# To install libz.a, zconf.h and zlib.h in the system directories, type: ++# ++# make install -fmakefile.gcc ++ ++# Note: ++# If the platform is *not* MinGW (e.g. it is Cygwin or UWIN), ++# the DLL name should be changed from "zlib1.dll". ++ ++STATICLIB = libz.a ++SHAREDLIB = zlib1.dll ++IMPLIB = libzdll.a ++ ++PREFIX = /usr/local ++EXEC_PREFIX = $(prefix) ++ ++INCLUDE_PATH = $(PREFIX)/include ++LIBRARY_PATH = $(PREFIX)/lib ++BIN_PATH = $(PREFIX)/bin ++ ++#LOC = -DASMV ++#LOC = -DDEBUG -g ++ ++CC = mingw32-gcc ++CFLAGS = $(LOC) -O3 -Wall ++ ++AS = $(CC) ++ASFLAGS = $(LOC) -Wall ++ ++LD = $(CC) ++LDFLAGS = $(LOC) -s ++ ++AR = mingw32-ar ++ARFLAGS = rcs ++ ++RC = mingw32-windres ++RCFLAGS = --define GCC_WINDRES ++ ++CP = cp -fp ++# If GNU install is available, replace $(CP) with install. ++INSTALL = $(CP) ++RM = rm -f ++ ++OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \ ++ inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o ++OBJA = ++ ++all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe ++ ++test: example.exe minigzip.exe ++ ./example.exe ++ echo hello world | ./minigzip.exe | ./minigzip.exe -d ++ ++testdll: example_d.exe minigzip_d.exe ++ ./example_d.exe ++ echo hello world | ./minigzip_d.exe | ./minigzip_d.exe -d ++ ++.c.o: ++ $(CC) $(CFLAGS) -c -o $@ $< ++ ++.S.o: ++ $(AS) $(ASFLAGS) -c -o $@ $< ++ ++$(STATICLIB): $(OBJS) $(OBJA) ++ $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) ++ ++$(IMPLIB): $(SHAREDLIB) ++ ++$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o ++ mingw32-dllwrap --dlltool-name mingw32-dlltool --driver-name $(CC) --def win32/zlib.def \ ++ --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o ++ mingw32-strip $@ ++ ++example.exe: example.o $(STATICLIB) ++ $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) ++ ++minigzip.exe: minigzip.o $(STATICLIB) ++ $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) ++ ++example_d.exe: example.o $(IMPLIB) ++ $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) ++ ++minigzip_d.exe: minigzip.o $(IMPLIB) ++ $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB) ++ ++zlibrc.o: win32/zlib1.rc ++ $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc ++ ++ ++# INCLUDE_PATH and LIBRARY_PATH must be set. ++ ++.PHONY: install uninstall clean ++ ++install: zlib.h zconf.h $(STATICLIB) $(SHAREDLIB) $(IMPLIB) ++ -@if test ! -e $(INCLUDE_PATH); then mkdir $(INCLUDE_PATH); fi ++ -@if test ! -e $(LIBRARY_PATH); then mkdir $(LIBRARY_PATH); fi ++ -@if test ! -e $(BIN_PATH); then mkdir $(BIN_PATH); fi ++ -$(INSTALL) zlib.h $(INCLUDE_PATH) ++ -$(INSTALL) zconf.h $(INCLUDE_PATH) ++ -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH) ++ -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH) ++ -$(INSTALL) $(SHAREDLIB) $(BIN_PATH) ++ ++uninstall: ++ -$(RM) $(INCLUDE_PATH)/zlib.h ++ -$(RM) $(INCLUDE_PATH)/zconf.h ++ -$(RM) $(LIBRARY_PATH)/$(STATICLIB) ++ -$(RM) $(LIBRARY_PATH)/$(IMPLIB) ++ ++clean: ++ -$(RM) $(STATICLIB) ++ -$(RM) $(SHAREDLIB) ++ -$(RM) $(IMPLIB) ++ -$(RM) *.o ++ -$(RM) *.exe ++ -$(RM) foo.gz ++ ++adler32.o: zlib.h zconf.h ++compress.o: zlib.h zconf.h ++crc32.o: crc32.h zlib.h zconf.h ++deflate.o: deflate.h zutil.h zlib.h zconf.h ++example.o: zlib.h zconf.h ++gzio.o: zutil.h zlib.h zconf.h ++inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h ++inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h ++infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h ++inftrees.o: zutil.h zlib.h zconf.h inftrees.h ++minigzip.o: zlib.h zconf.h ++trees.o: deflate.h zutil.h zlib.h zconf.h trees.h ++uncompr.o: zlib.h zconf.h ++zutil.o: zutil.h zlib.h zconf.h diff --git a/bacula/src/win32/pebuilder/Makefile.in b/bacula/src/win32/pebuilder/Makefile.in new file mode 100644 index 0000000000..075b4215d5 --- /dev/null +++ b/bacula/src/win32/pebuilder/Makefile.in @@ -0,0 +1,55 @@ +# +# Makefile to build the BartPE plugin +# +# +# D. Scott Barninger, Nov 2004 +# + +srcdir = . +VPATH = . +.PATH: . + +# one up +basedir = .. +# top dir +topdir = ../../.. +# this dir relative to top dir +thisdir = src/win32/pebuilder + +first_rule: all + +dummy: + +all: pebuilder zip + +pebuilder: + mkdir -p bacula/files + cp -f ../baculafd/bacula-fd.conf bacula/files/ + cp -f ../console/bconsole.conf bacula/files/ + cp -f ../wx-console/wx-console.conf bacula/files/ + cp -f ../baculafd/Release/bacula-fd.exe bacula/files/ + cp -f ../console/Release/bconsole.exe bacula/files/ + cp -f ../wx-console/Release/wx-console.exe bacula/files/ + cp -f ../../../../depkgs-win32/pthreads/pthreadVCE.dll bacula/files/ + cp -f c:/windows/system32/msvcr71.dll bacula/files + cp -f ../../../LICENSE bacula/files/ + +zip: pebuilder + zip -r ../winbacula-bartpe-@VERSION@.zip bacula README + +depend: + + +#------------------------------------------------------------------------- + + +install: + +uninstall: + + +clean: + rm -rf bacula/files + +# clean for distribution +distclean: clean diff --git a/bacula/src/win32/pebuilder/README b/bacula/src/win32/pebuilder/README new file mode 100644 index 0000000000..228e96e455 --- /dev/null +++ b/bacula/src/win32/pebuilder/README @@ -0,0 +1,13 @@ +Bacula plugin for BartPE +http://www.nu2.nu/pebuilder/ +Wed Nov 10 2004 +Copyright 2004 D. Scott Barninger +Licensed under the GNU GPL v2 + +Copy the bacula plugin folder to the plugins directory of your +BartPE build directory. Edit the config files in the files directory +to suit your bacula installation. + +Build your BartPE disk according to the instructions at +http://www.nu2.nu/pebuilder/#build along with whatever other plugins +you want. Be sure that 'Bacula Client' is enabled on the plugin selection screen. diff --git a/bacula/src/win32/pebuilder/bacula/bacula.inf b/bacula/src/win32/pebuilder/bacula/bacula.inf new file mode 100644 index 0000000000..c57fb447ba --- /dev/null +++ b/bacula/src/win32/pebuilder/bacula/bacula.inf @@ -0,0 +1,37 @@ +; PE Builder v3 plug-in INF file for bacula +; Copyright (C) 2004-2006 Free Software Foundation Europe e.V. + +; Thu Dec 09 2004 D. Scott Barninger +; ASSIGNMENT OF COPYRIGHT +; FOR VALUE RECEIVED, D. Scott Barninger hereby sells, transfers and +; assigns unto Kern Sibbald, his successors, assigns and personal representatives, +; all right, title and interest in and to the copyright in this software. +; D. Scott Barninger warrants good title to said copyright, that it is +; free of all liens, encumbrances or any known claims against said copyright. + +; licensed under the GNU GPL v2 + +[Version] +Signature= "$Windows NT$" + +[PEBuilder] +Name="Bacula Client" +Enable=1 + +[WinntDirectories] +a="Programs\bacula",3 + +[SourceDisksFiles] +files\bacula-fd.exe=a,,1 +files\bacula-fd.conf=a,,1 +files\bconsole.exe=a,,1 +files\bconsole.conf=a,,1 +files\License.txt=a,,1 +files\pthreadVCE.dll=a,,1 +files\msvcr71.dll=a,,1 +files\wx-console.exe=a,,1 +files\wx-console.conf=a,,1 +files\msvcr71.dll=a,,1 + +[Append] +nu2menu.xml, bacula_nu2menu.xml diff --git a/bacula/src/win32/pebuilder/bacula/bacula_nu2menu.xml b/bacula/src/win32/pebuilder/bacula/bacula_nu2menu.xml new file mode 100644 index 0000000000..7b41bda25f --- /dev/null +++ b/bacula/src/win32/pebuilder/bacula/bacula_nu2menu.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + Install Bacula Client Service + Start Bacula Client Service + Bacula WX-Console + + diff --git a/bacula/src/win32/scripts/Makefile b/bacula/src/win32/scripts/Makefile new file mode 100644 index 0000000000..a0f844e9ad --- /dev/null +++ b/bacula/src/win32/scripts/Makefile @@ -0,0 +1,39 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written by Robert Nelson, June 2006 +# + +include ../Makefile.inc + +########################################################################## + +BSLEEP_OBJS = \ + $(OBJDIR)/bsleep.o + +ALL_OBJS = \ + $(BSLEEP_OBJS) + +###################################################################### + +# Targets + +.PHONY: all clean + +all: $(BINDIR)/bsleep.exe + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(ALL_OBJS)) + $(call clean_exe,$(BINDIR)/bsleep.exe) + $(ECHO_CMD)rm -rf $(OBJDIRS) + +# +# Rules +# + +$(BINDIR)/bsleep.exe: $(BSLEEP_OBJS) + $(call link_conapp) + +include ../Makefile.rules diff --git a/bacula/src/win32/scripts/bsleep.c b/bacula/src/win32/scripts/bsleep.c new file mode 100644 index 0000000000..4fd6cd666d --- /dev/null +++ b/bacula/src/win32/scripts/bsleep.c @@ -0,0 +1,23 @@ +#include +#include + +int +main(int argc, const char ** argv) +{ + int nsecs; + + if (argc != 2) + { + fputs("usage: bsleep \n n = number of seconds\n", stderr); + exit(1); + } + + if (sscanf(argv[1], "%d", &nsecs) != 1) + { + fputs("sleep: incorrect argument, must be number of seconds to sleep\n", stderr); + exit(1); + } + + Sleep(nsecs * 1000); + exit(0); +} diff --git a/bacula/src/win32/scripts/bsleep.vcproj b/bacula/src/win32/scripts/bsleep.vcproj new file mode 100644 index 0000000000..9d9ad1ec30 --- /dev/null +++ b/bacula/src/win32/scripts/bsleep.vcproj @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/scripts/disk-changer.cmd b/bacula/src/win32/scripts/disk-changer.cmd new file mode 100644 index 0000000000..4deb4e9ccb --- /dev/null +++ b/bacula/src/win32/scripts/disk-changer.cmd @@ -0,0 +1,201 @@ +@ECHO off +setlocal ENABLEDELAYEDEXPANSION +REM +REM +REM Bacula interface to virtual autoloader using disk storage +REM +REM $Id: disk-changer.in,v 1.3 2006/07/30 16:00:32 kerns Exp $ +REM +REM If you set in your Device resource +REM +REM Changer Command = "disk-changer %c %o %S %a %d" +REM you will have the following input to this script: +REM +REM So Bacula will always call with all the following arguments, even though +REM in some cases, not all are used. +REM +REM disk-changer "changer-device" "command" "slot" "archive-device" "drive-index" +REM %1 %2 %3 %4 %5 +REM +REM By default the autochanger has 10 Volumes and 1 Drive. +REM +REM Note: For this script to work, you *must" specify +REM Device Type = File +REM in each of the Devices associated with your AutoChanger resource. +REM +REM changer-device is the name of a file that overrides the default +REM volumes and drives. It may have: +REM maxslot=n where n is one based (default 10) +REM maxdrive=m where m is zero based (default 1 -- i.e. 2 drives) +REM +REM This code can also simulate barcodes. You simply put +REM a list of the slots and barcodes in the "base" directory/barcodes. +REM See below for the base directory definition. Example of a +REM barcodes file: +REM C:\TEMP\bacula\barcodes +REM 1:Vol001 +REM 2:Vol002 +REM ... +REM +REM archive-device is the name of the base directory where you want the +REM Volumes stored appended with \drive0 for the first drive; \drive1 +REM for the second drive, ... For example, you might use +REM C:\Temp\bacula\drive0 Note: you must not have a trailing slash, and +REM the string (e.g. \drive0) must be unique, and it must not match +REM any other part of the directory name. These restrictions could be +REM easily removed by any clever script jockey. +REM +REM Full example: disk-changer C:\Temp\bacula\conf load 1 C:\Temp\bacula\drive0 0 +REM +REM The Volumes will be created with names slot1, slot2, slot3, ... maxslot in the +REM base directory. In the above example the base directory is C:\Temp\bacula. +REM However, as with tapes, their Bacula Volume names will be stored inside the +REM Volume label. In addition to the Volumes (e.g. C:\Temp\bacula\slot1, +REM C:\Temp\bacula\slot3, ...) this script will create a C:\Temp\bacula\loadedn +REM file to keep track of what Slot is loaded. You should not change this file. +REM + +SET dbgfile=%CD%\disk-changer.log + +REM to turn on logging, uncomment the following line +IF NOT EXIST %dbgfile% COPY nul %dbgfile% >nul + +REM +REM check parameter count on commandline +REM +REM Check for special cases where only 2 arguments are needed, +REM all others are a minimum of 5 +REM +IF "%1" EQU "" goto :param_count_invalid +IF "%2" EQU "" goto :param_count_invalid +IF "%2" EQU "list" goto :param_count_valid +IF "%2" EQU "slots" goto :param_count_valid +IF "%3" EQU "" goto :param_count_invalid +IF "%4" EQU "" goto :param_count_invalid +IF "%5" EQU "" goto :param_count_invalid +GOTO :param_count_valid + +:param_count_invalid + echo Insufficient number of arguments given. + IF "%2" EQU "" ( + echo At least two arguments must be specified. + ) else echo Command expected 5 arguments. +:usage + ECHO. + ECHO usage: disk-changer ctl-device command [slot archive-device drive-index] + ECHO Valid commands are: unload, load, list, loaded, and slots. + EXIT /B 1 + +:param_count_valid + +REM Setup arguments +SET ctl=%1 +SET cmd=%2 +SET slot=%3 +SET device=%4 +SET drive=%5 + +REM set defaults +SET maxdrive=1 +SET maxslot=10 + +SET ctl=%ctl:/=\% +SET ctl=%ctl:\\=\% + +SET device=%device:/=\% +SET device=%device:\\=\% + +REM Pull in conf file +IF EXIST %ctl% CALL %ctl% + +FOR %%i IN ( %ctl% ) DO SET dirname=%%~dpi +IF NOT EXIST %dirname%nul ( + ECHO ERROR: Autochanger directory "%dirname%" does not exist. + ECHO You must create it. + EXIT /b 1 +) + +CALL :debug "Parms: %ctl% %cmd% %slot% %device% %drive%" +IF "%cmd%" EQU "unload" GOTO :cmdUnload +IF "%cmd%" EQU "load" GOTO :cmdLoad +IF "%cmd%" EQU "list" GOTO :cmdList +IF "%cmd%" EQU "loaded" GOTO :cmdLoaded +IF "%cmd%" EQU "slots" GOTO :cmdSlots +GOTO :cmdUnknown + +:cmdUnload + CALL :debug "Doing disk -f %ctl% unload %slot% %device% %drive%" + IF NOT EXIST %dirname%loaded%drive% ECHO 0 >%dirname%loaded%drive% + FOR /f %%i IN ( %dirname%loaded%drive% ) DO SET ld=%%i + + IF "%slot%" EQU "%ld%" ( + CALL :debug "Unloaded slot %ld% from drive %drive%" + ECHO 0 >%dirname%loaded%drive% + DEL %dirname%%device% >nul 2>nul + SET rtn=0 + ) ELSE ( + ECHO Storage Element %slot% is Already Full + CALL :debug "Storage Element %slot% is Already Full" + SET rtn=1 + ) + GOTO :cmdExit + +:cmdLoad + CALL :debug "Doing disk -f %ctl% load %slot% %device% %drive%" + SET ld=0 + IF NOT EXIST %dirname%loaded%drive% ECHO 0 >%dirname%loaded%drive% + FOR /f %%i IN ( %dirname%loaded%drive% ) DO SET ld=%%i + IF %ld% EQU 0 ( + IF NOT EXIST %dirname%slot%slot% COPY nul %dirname%slot%slot% >nul + DEL %device% + fsutil hardlink create %device% %dirname%slot%slot% >nul 2>&1 + SET rtn=%ERRORLEVEL% + IF !rtn! EQU 0 ( + ECHO %slot% >%dirname%loaded%drive% + CALL :debug "Loaded slot %slot% into drive %drive%" + ) ELSE ( + CALL :debug "Create hardlink failed, return = !rtn!" + ) + ) ELSE ( + ECHO Drive %drive% Full - Storage element %ld% loaded + CALL :debug "Drive %drive% Full - Storage element %ld% loaded" + ) + GOTO :cmdExit + +:cmdList + CALL :debug "Doing disk -f %ctl% -- to list volumes" + IF EXIST %dirname%barcodes ( + TYPE %dirname%barcodes + ) ELSE ( + FOR /l %%i IN ( 1, 1, %maxslot% ) DO ECHO %%i: + ) + SET rtn=0 + GOTO :cmdExit + +:cmdLoaded + CALL :debug "Doing disk -f %ctl% %drive% -- to find what is loaded" + IF EXIST %dirname%loaded%drive% ( TYPE %dirname%loaded%drive% ) ELSE ECHO 0 + SET rtn=0 + GOTO :cmdExit + +:cmdSlots + CALL :debug "Doing disk -f %ctl% -- to get count of slots" + ECHO %maxslot% + SET rtn=0 + GOTO :cmdExit + +:cmdExit + EXIT /b %rtn% + +:cmdUnknown + ECHO '%cmd%' is an invalid command. + GOTO :usage + +REM +REM log whats done +REM +:debug + IF NOT EXIST %dbgfile% GOTO :EOF + FOR /f "usebackq tokens=2-4,5-7 delims=/:. " %%i IN ( '%DATE% %TIME%' ) do SET TIMESTAMP=%%k%%i%%j-%%l:%%m:%%n + ECHO %TIMESTAMP% %* >> %dbgfile% + GOTO :EOF diff --git a/bacula/src/win32/scripts/dvd-handler.cmd b/bacula/src/win32/scripts/dvd-handler.cmd new file mode 100644 index 0000000000..2f21e7e0e5 --- /dev/null +++ b/bacula/src/win32/scripts/dvd-handler.cmd @@ -0,0 +1,387 @@ +@ECHO off +REM +REM Check the free space available on a writable DVD +REM Should always exit with 0 status, otherwise it indicates a serious error. +REM (wrong number of arguments, Python exception...) +REM +REM called: dvd-handler operation args +REM +REM operations used by Bacula: +REM +REM free (no arguments) +REM Scan the device and report the available space. It returns: +REM Prints on the first output line the free space available in +REM bytes. +REM If an error occurs, prints a negative number (-errno), followed, +REM on the second line, by an error message. +REM +REM write op filename +REM Write a part file to disk. +REM This operation needs two additional arguments. +REM The first (op) indicates to +REM 0 -- append +REM 1 -- first write to a blank disk +REM 2 -- blank or truncate a disk +REM +REM The second is the filename to write +REM +REM operations available but not used by Bacula: +REM +REM test Scan the device and report the information found. +REM This operation needs no further arguments. +REM prepare Prepare a DVD+/-RW for being used by Bacula. +REM Note: This is only useful if you already have some +REM non-Bacula data on a medium, and you want to use +REM it with Bacula. Don't run this on blank media, it +REM is useless. +REM +REM +REM $Id: dvd-handler.in,v 1.11 2006/08/30 16:19:30 kerns Exp $ +REM + +setlocal ENABLEDELAYEDEXPANSION +SET PATH=%PATH%;@bin_dir_cmd@ +REM Configurable values: + +SET dvdrwmediainfo=dvd+rw-mediainfo.exe +SET growcmd=growisofs.exe +SET dvdrwformat=dvd+rw-format.exe +SET dd=dd.exe +SET margin=10485760 + +REM Comment the following line if you want the tray to be reloaded +REM when writing ends. +SET growcmd=%growcmd% -use-the-force-luke^^^^^=notray + +REM end of configurable values + +IF "%1" == "" GOTO :usage +IF "%2" == "" GOTO :usage + +CALL :init %1 + +IF "%2" == "free" ( + CALL :free + ECHO !ERRORLEVEL! + ECHO No Error reported. +) ELSE IF "%2" == "prepare" ( + CALL :prepare + ECHO Medium prepared successfully. +) ELSE IF "%2" == "test" ( + IF %freespace_collected% EQU 0 CALL :collect_freespace + IF %mediumtype_collected% EQU 0 CALL :collect_mediumtype + ECHO Class disk, initialized with device %device% + ECHO type = '!disktype!' mode='!diskmode!' status = '!diskstatus!' + ECHO next_session = !next_session! capacity = !capacity! + ECHO Hardware device is '!hardwaredevice!' + ECHO growcmd = '!growcmd!' + ECHO growparams = '!growparams!' + ECHO. + SET empty_disk=false + CALL :is_blank + IF !ERRORLEVEL! EQU 1 SET empty_disk=true + SET rewritable=false + CALL :is_RW + IF !ERRORLEVEL! EQU 1 SET rewritable=true + SET plus_RW_disk=false + CALL :is_plus_RW + IF !ERRORLEVEL! EQU 1 SET plus_RW_disk=true + SET minus_RW_disk=false + CALL :is_minus_RW + IF !ERRORLEVEL! EQU 1 SET minus_RW_disk=true + SET restricted_overwrite_disk=false + CALL :is_restricted_overwrite + IF !ERRORLEVEL! EQU 1 SET restricted_overwrite_disk=true + SET blank_disk=false + CALL :is_blank + IF !ERRORLEVEL! EQU 1 SET blank_disk=true + ECHO Empty disk: !empty_disk! Blank Disk: !blank_disk! ReWritable disk: !rewritable! + ECHO Plus RW: !plus_RW_disk! Minus RW: !minus_RW_disk! Restricted Overwrite: !restricted_overwrite_disk! + CALL :free + ECHO Free space: !ERRORLEVEL! +) ELSE IF "%2" == "write" ( + IF "%3" == "" GOTO :usage + IF "%4" == "" GOTO :usage + CALL :write %3 %4 + ECHO Part file %4 successfully written to disk. +) ELSE ( + ECHO No operation - use test, free, prepare or write. + ECHO THIS MIGHT BE A CASE OF DEBUGGING BACULA OR AN ERROR! +) +EXIT /b 0 + +REM ########################################################################## +REM +REM The rest of this file is a set of subroutines that return DVD disk +REM information. +REM +REM Status information about the device and the disk loaded is collected +REM only when asked for (for example dvd-freespace doesn't need to know the +REM media type, and dvd-writepart doesn't not always need to know the free +REM space). +REM +REM The following subroutines are implemented: +REM init we need that... +REM is_empty Set ERRORLEVEL to TRUE if the disk is empty, blank... +REM this needs more work, especially concerning non-RW media +REM and blank vs. no filesystem considerations. Here, we +REM should also look for other filesystems - probably we don't +REM want to silently overwrite UDF or ext2 or anything not +REM mentioned in fstab... +REM (NB: I don't think it is a problem) +REM is_RW Set ERRORLEVEL to TRUE if the disk is RW (DVD-RW or DVD+RW) +REM is_plus_RW Set ERRORLEVEL to TRUE if the disk is DVD+RW +REM is_minus_RW Set ERRORLEVEL to TRUE if the disk is DVD-RW +REM is_blank Set ERRORLEVEL to TRUE if the disk is blank +REM free Returns the available free space. +REM write Writes one part file to disk, either starting a new file +REM system on disk, or appending to it. +REM This method should also prepare a blank disk so that a +REM certain part of the disk is used to allow detection of a +REM used disk by all / more disk drives. +REM blank Blank the device +REM +REM ########################################################################## + +:init +SET device=%1 +SET disktype=none +SET diskmode=none +SET diskstatus=none +SET hardwaredevice=none +SET pid=0 +SET next_session=-1 +SET capacity=-1 + +SET freespace_collected=0 +SET mediumtype_collected=0 + +SET growcmd=%growcmd% -quiet -use-the-force-luke^^^=4gms + +SET growparams=-A "Bacula Data" -input-charset=default -iso-level 3 -pad +SET growparams=%growparams% -p "dvd-handler / growisofs" -sysid "BACULADATA" -R +GOTO :EOF + +:collect_freespace +SET next_session=0 +SET capacity=0 +FOR /f "delims== tokens=1*" %%i in ( '%growcmd% -F %device%' ) DO ( + IF "%%i" == "next_session" ( + SET next_session=%%j + ) ELSE IF "%%i" == "capacity" ( + SET capacity=%%j + ) ELSE IF "%%j" == "" ( + SET result=!result! %%i + ) ELSE ( + SET RESULT=!result! %%i=%%j + ) +) +SET status=%ERRORLEVEL% +IF %STATUS% NEQ 0 ( + SET /a STATUS=STATUS ^& 0x7F + IF !STATUS! EQU 112 ( + REM Kludge to force dvd-handler to return a free space of 0 + next_session = 1 + capacity = 1 + freespace_collected = 1 + GOTO :EOF + ) ELSE ( + ECHO growisofs returned with an error !STATUS!. Please check you are using a patched version of dvd+rw-tools. + EXIT !STATUS! + ) +) + +IF %next_session% EQU 0 IF %capacity% EQU 0 ( + ECHO Cannot get next_session and capacity from growisofs. + ECHO Returned: %result:|=^|% + EXIT 1 +) +SET freespace_collected=1 +GOTO :EOF + +:collect_mediumtype +SET hardwaredevice= +SET disktype= +SET diskmode= +SET diskstatus= +SET lasterror= +FOR /f "delims=: tokens=1,2 usebackq" %%i in ( `"%dvdrwmediainfo%" %device%` ) DO ( + IF "%%i" == "INQUIRY" FOR /f "tokens=*" %%k in ( "%%j" ) DO SET hardwaredevice=%%k + IF "%%i" == " Mounted Media" FOR /f "tokens=1,2* delims=, " %%k in ( "%%j" ) DO ( + SET disktype=%%l + SET diskmode=%%m + ) + IF "%%i" == " Disc status" FOR /f "tokens=*" %%k in ( "%%j" ) DO SET diskstatus=%%k +) + +IF NOT DEFINED disktype ( + ECHO Media type not found in %dvdrwmediainfo% output + EXIT 1 +) + +IF "%disktype%" == "DVD-RW" IF NOT DEFINED diskmode ( + ECHO Media mode not found for DVD-RW in %dvdrwmediainfo% output + EXIT 1 +) + +IF NOT DEFINED diskstatus ( + ECHO Disc status not found in %dvdrwmediainfo% output + EXIT 1 +) + +SET mediumtype_collected=1 +GOTO :EOF + +:is_empty +IF %freespace_collected% EQU 0 CALL :collect_freespace +IF %next_session% EQU 0 ( EXIT /b 1 ) ELSE EXIT /b 0 + +:is_RW +IF %mediumtype_collected% EQU 0 CALL :collect_mediumtype +IF %disktype% == "DVD-RW" EXIT /b 1 +IF %disktype% == "DVD+RW" EXIT /b 1 +IF %disktype% == "DVD-RAM" EXIT /b 1 +EXIT /b 0 + +:is_plus_RW +IF %mediumtype_collected% EQU 0 CALL :collect_mediumtype +IF "%disktype%" == "DVD+RW" EXIT /b 1 +EXIT /b 0 + +:is_minus_RW +IF %mediumtype_collected% EQU 0 CALL :collect_mediumtype +IF "%disktype%" == "DVD-RW" EXIT /b 1 +EXIT /b 0 + +:is_restricted_overwrite +IF %mediumtype_collected% EQU 0 CALL :collect_mediumtype +IF "%diskmode%" == "Restricted Overwrite" EXIT /b 1 +EXIT /b 0 + +:is_blank +IF %mediumtype_collected% EQU 0 CALL :collect_mediumtype +IF "%diskstatus%" == "blank" EXIT /b 1 +EXIT /b 0 + +:free +IF %freespace_collected% EQU 0 CALL :collect_freespace +FOR /f %%i in ( 'expr64 "capacity - next_session - margin"' ) DO SET fr=%%i +expr64 /q "fr < 0" && ( EXIT /b 0 ) || EXIT /b %fr% + +REM %1 - newvol, %2 - partfile +:write +REM Blank DVD+RW when there is no data on it +CALL :is_plus_RW +SET tmpvar=%ERRORLEVEL% +CALL :is_blank +SET /a tmpvar=tmpvar + ERRORLEVEL +IF %1 EQU 1 IF %tmpvar% EQU 2 ( + ECHO DVD+RW looks brand-new, blank it to fix some DVD-writers bugs. + CALL :blank + ECHO Done, now writing the part file. +) +CALL :is_minus_RW +IF %ERRORLEVEL% NEQ 0 IF %1 NEQ 0 ( + CALL :is_restricted_overwrite + IF !ERRORLEVEL! EQU 0 ( + ECHO DVD-RW is in %diskmode% mode, reformating it to Restricted Overwrite + CALL :reformat_minus_RW + ECHO Done, now writing the part file. + ) +) +if %1 NEQ 0 ( + REM Ignore any existing iso9660 filesystem - used for truncate + if %1 EQU 2 ( + SET cmd_opts= -use-the-force-luke^^^=tty -Z + ) ELSE ( + SET cmd_opts= -Z + ) +) ELSE ( + SET cmd_opts= -M +) +ECHO Running %growcmd% %growparams% %cmd_opts% %device% %2 +%growcmd% %growparams% %cmd_opts% %device% %2 +IF %ERRORLEVEL% NEQ 0 ( + ECHO Exited with status !ERRORLEVEL! + EXIT !ERRORLEVEL! +) +GOTO :EOF + +:prepare +CALL :is_RW +IF %ERRORLEVEL% EQU 0 ( + ECHO I won't prepare a non-rewritable medium + EXIT /b 1 +) + +REM Blank DVD+RW when there is no data on it +CALL :is_plus_RW +SET result=%ERRORLEVEL% +CALL :is_blank +SET /a result=result + ERRORLEVEL +IF %result% EQU 2 ( + ECHO DVD+RW looks brand-new, blank it to fix some DVD-writers bugs. + CALL :blank + GOTO :EOF +) + +CALL :is_minus_RW +IF %ERRORLEVEL% EQU 1 ( + CALL :is_restricted_overwrite + IF !ERRORLEVEL! EQU 0 ( + ECHO DVD-RW is in %diskmode% mode, reformating it to Restricted Overwrite + CALL :reformat_minus_RW + GOTO :EOF + ) +) +CALL :blank +GOTO :EOF + +:blank +ECHO Running %growcmd% -Z %device% =/dev/zero +%growcmd% -Z %device% =/dev/zero +IF %ERRORLEVEL% NEQ 0 ( + ECHO Exited with status !ERRORLEVEL! + EXIT !ERRORLEVEL! +) +GOTO :EOF + +:reformat_minus_RW +ECHO Running %dvdrwformat% -force %device% +%dvdrwformat% -force %device% +IF %ERRORLEVEL% NEQ 0 ( + ECHO Exited with status !ERRORLEVEL! + EXIT !ERRORLEVEL! +) +GOTO :EOF + +REM class disk ends here. + +:usage +ECHO Wrong number of arguments. +ECHO. +ECHO Usage: +ECHO. +ECHO dvd-handler DVD-DRIVE test +ECHO dvd-handler DVD-DRIVE free +ECHO dvd-handler DVD-DRIVE write APPEND FILE +ECHO dvd-handler DVD-DRIVE blank +ECHO. +ECHO where DVD-DRIVE is the drive letter of the DVD burner like D: +ECHO. +ECHO Operations: +ECHO test Scan the device and report the information found. +ECHO This operation needs no further arguments. +ECHO free Scan the device and report the available space. +ECHO write Write a part file to disk. +ECHO This operation needs two additional arguments. +ECHO The first indicates to append (0), restart the +ECHO disk (1) or restart existing disk (2). The second +ECHO is the file to write. +ECHO prepare Prepare a DVD+/-RW for being used by Bacula. +ECHO Note: This is only useful if you already have some +ECHO non-Bacula data on a medium, and you want to use +ECHO it with Bacula. Don't run this on blank media, it +ECHO is useless. + +EXIT /b 1 diff --git a/bacula/src/win32/scripts/mtx-changer.cmd b/bacula/src/win32/scripts/mtx-changer.cmd new file mode 100644 index 0000000000..8cc2c81d1a --- /dev/null +++ b/bacula/src/win32/scripts/mtx-changer.cmd @@ -0,0 +1,189 @@ +@echo off +REM +REM +REM Bacula interface to mtx autoloader +REM +REM $Id: mtx-changer.cmd 3718 2006-12-01 08:45:40Z robertnelson $ +REM +REM If you set in your Device resource +REM +REM Changer Command = "mtx-changer %c %o %S %a %d" +REM you will have the following input to this script: +REM +REM Bacula will always call with all the following arguments, even though +REM in some cases, not all are used. +REM +REM mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index" +REM %1 %2 %3 %4 %5 +REM +REM for example: +REM +REM mtx-changer Changer0 load 1 Tape0 0 +REM +REM will request to load the first cartidge into drive 0, where +REM the changer device is Changer0, and the read/write device +REM is Tape0. +REM +REM If you need to an offline, refer to the drive as %4 +REM e.g. mt -f %4 offline +REM +REM Many changers need an offline after the unload. Also many +REM changers need a sleep 60 after the mtx load. +REM +REM N.B. If you change the script, take care to return either +REM the mtx exit code or a 0. If the script exits with a non-zero +REM exit code, Bacula will assume the request failed. +REM + +SET MTX="@bin_dir_cmd@\mtx.exe" +SET MT="@bin_dir_cmd@\mt.exe" +SET working_dir=@working_dir_cmd@ + +SET dbgfile="%working_dir%\mtx.log" + +REM to turn on logging, uncomment the following line +REM copy nul "%working_dir%\mtx.log" + +REM +REM check parameter count on commandline +REM +REM Check for special cases where only 2 arguments are needed, +REM all others are a minimum of 5 +REM +IF "%1" EQU "" goto :param_count_invalid +IF "%2" EQU "" goto :param_count_invalid +IF "%2" EQU "list" goto :param_count_valid +IF "%2" EQU "slots" goto :param_count_valid +IF "%3" EQU "" goto :param_count_invalid +IF "%4" EQU "" goto :param_count_invalid +IF "%5" EQU "" goto :param_count_invalid +GOTO :param_count_valid + +:param_count_invalid + echo Insufficient number of arguments given. + IF "%2" EQU "" ( + echo At least two arguments must be specified. + ) else echo Command expected 5 arguments. +:usage + ECHO. + ECHO usage: mtx-changer ctl-device command [slot archive-device drive-index] + ECHO Valid commands are: unload, load, list, loaded, and slots. + EXIT /B 1 + +:param_count_valid + +REM Setup arguments +SET ctl=%1 +SET cmd=%2 +SET slot=%3 +SET device=%4 +SET drive=%5 + +CALL :debug "Parms: %ctl% %cmd% %slot% %device% %drive%" +IF "%cmd%" EQU "unload" GOTO :cmdUnload +IF "%cmd%" EQU "load" GOTO :cmdLoad +IF "%cmd%" EQU "list" GOTO :cmdList +IF "%cmd%" EQU "loaded" GOTO :cmdLoaded +IF "%cmd%" EQU "slots" GOTO :cmdSlots +GOTO :cmdUnknown + +:cmdUnload + CALL :debug "Doing mtx -f %ctl% unload %slot% %drive%" + %MT% -f %device% eject + %MTX% -f %ctl% unload %slot% %drive% + SET rtn=%ERRORLEVEL% + GOTO :cmdExit + +:cmdLoad + CALL :debug "Doing mtx -f %ctl% load %slot% %drive%" + %MTX% -f %ctl% load %slot% %drive% + SET rtn=%ERRORLEVEL% + IF ERRORLEVEL 1 GOTO :cmdExit +REM %MT% -f %device% load +REM bsleep 5 + CALL :wait_for_drive %device% + REM Force block size to 0 for variable + %MT% -f %device% setblk 0 + GOTO :cmdExit + +:cmdList + CALL :debug "Doing mtx -f %ctl% -- to list volumes" + CALL :make_temp_file +REM Enable the following if you are using barcodes and need an inventory +REM %MTX% -f %ctl% inventory + %MTX% -f %ctl% status >%TMPFILE% + SET rtn=%ERRORLEVEL% + IF ERRORLEVEL 1 GOTO :cmdExit + FOR /F "usebackq tokens=3,6 delims==: " %%i in ( `findstr /R /C:" *Storage Element [0-9]*:.*Full" %TMPFILE%` ) do echo %%i:%%j + FOR /F "usebackq tokens=7,10" %%i in ( `findstr /R /C:"^Data Transfer Element [0-9]*:Full (Storage Element [0-9]" %TMPFILE%` ) do echo %%i:%%j + DEL /F %TMPFILE% >nul 2>&1 +REM +REM If you have a VXA PacketLoader and the above does not work, try +REM turning it off and enabling the following line. +REM %MTX% -f %ctl% status | grep " *Storage Element [0-9]*:.*Full" | sed "s/*Storage Element //" | sed "s/Full :VolumeTag=//" + + GOTO :cmdExit + +:cmdLoaded + CALL :debug "Doing mtx -f %ctl% %drive% -- to find what is loaded" + CALL :make_temp_file + %MTX% -f %ctl% status >%TMPFILE% + SET rtn=%ERRORLEVEL% + IF ERRORLEVEL 1 GOTO :cmdExit + FOR /F "usebackq tokens=7" %%i in ( `findstr /R /C:"^Data Transfer Element %drive%:Full" %TMPFILE%` ) do echo %%i + findstr /R /C:"^Data Transfer Element %drive%:Empty" %TMPFILE% >nul && echo 0 + DEL /F %TMPFILE% >nul 2>&1 + GOTO :cmdExit + +:cmdSlots + CALL :debug "Doing mtx -f %ctl% -- to get count of slots" + CALL :make_temp_file + %MTX% -f %ctl% status >%TMPFILE% + SET rtn=%ERRORLEVEL% + IF ERRORLEVEL 1 GOTO :cmdExit + FOR /F "usebackq tokens=5" %%i in ( `findstr /R /C:" *Storage Changer" %TMPFILE%` ) do echo %%i + DEL /F %TMPFILE% >nul 2>&1 + GOTO :cmdExit + +:cmdExit + EXIT /B %rtn% + +:cmdUnknown + ECHO '%cmd%' is an invalid command. + GOTO :usage + +REM +REM log whats done +REM +:debug + IF NOT EXIST %dbgfile% GOTO :EOF + FOR /F "usebackq tokens=2-4,5-7 delims=/:. " %%i in ( '%DATE% %TIME%' ) do SET TIMESTAMP=%%k%%i%%j-%%l:%%m:%%n + ECHO %TIMESTAMP% %*>> %dbgfile% + GOTO :EOF + +REM +REM Create a temporary file +REM +:make_temp_file + SET TMPFILE="%working_dir%\mtx.tmp" + IF EXIST %TMPFILE% ( + ECHO Temp file security problem on: %TMPFILE% + EXIT /B 1 + ) + GOTO :EOF + +REM +REM The purpose of this function to wait a maximum +REM time for the drive. It will return as soon as +REM the drive is ready, or after waiting a maximum +REM of 300 seconds. +REM +:wait_for_drive + FOR /L %%i IN ( 1, 1, 300 ) DO ( + %MT% -f %1 status | findstr ONLINE >NUL 2>&1 + IF %ERRORLEVEL%==0 GOTO :EOF + CALL :debug "Device %1 - not ready, retrying..." + bsleep 1 + ) + CALL :debug "Device %1 - not ready, timed out..." + GOTO :EOF diff --git a/bacula/src/win32/stored/Makefile b/bacula/src/win32/stored/Makefile new file mode 100644 index 0000000000..28b5464709 --- /dev/null +++ b/bacula/src/win32/stored/Makefile @@ -0,0 +1,182 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# +# Author: Robert Nelson +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Written by Robert Nelson, June 2006 +# + +# Configuration + +include ../Makefile.inc + +INCLUDES = \ + -I. \ + -I$(MAINDIR)/src/stored \ + $(INCLUDE_DDK) \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_OPENSSL) \ + $(INCLUDE_ICONS) + +DEFINES = \ + -DUSING_DLL \ + -DWINVER=0x500 \ + $(HAVES) + +# -DHAVE_TRAY_MONITOR \ + + +vpath %.c $(MAINDIR)/src/stored $(BUILDDIR)/libwin32 +vpath %.cpp $(MAINDIR)/src/stored $(BUILDDIR)/libwin32 + +########################################################################## + +COMMON_OBJS = \ + $(OBJDIR)/askdir.o \ + $(OBJDIR)/tape_alert.o \ + $(OBJDIR)/vtape_dev.o \ + $(OBJDIR)/tape_dev.o \ + $(OBJDIR)/init_dev.o \ + $(OBJDIR)/global.o \ + $(OBJDIR)/acquire.o \ + $(OBJDIR)/aligned_dev.o \ + $(OBJDIR)/aligned_read.o \ + $(OBJDIR)/aligned_write.o \ + $(OBJDIR)/ansi_label.o \ + $(OBJDIR)/authenticate.o \ + $(OBJDIR)/autochanger.o \ + $(OBJDIR)/block.o \ + $(OBJDIR)/block_util.o \ + $(OBJDIR)/butil.o \ + $(OBJDIR)/dev.o \ + $(OBJDIR)/device.o \ + $(OBJDIR)/ebcdic.o \ + $(OBJDIR)/hello.o \ + $(OBJDIR)/label.o \ + $(OBJDIR)/lock.o \ + $(OBJDIR)/match_bsr.o \ + $(OBJDIR)/mount.o \ + $(OBJDIR)/parse_bsr.o \ + $(OBJDIR)/read_records.o \ + $(OBJDIR)/record_read.o \ + $(OBJDIR)/record_util.o \ + $(OBJDIR)/record_write.o \ + $(OBJDIR)/reserve.o \ + $(OBJDIR)/scan.o \ + $(OBJDIR)/spool.o \ + $(OBJDIR)/stored_conf.o \ + $(OBJDIR)/vol_mgr.o \ + $(OBJDIR)/wait.o \ + $(OBJDIR)/file_dev.o \ + $(OBJDIR)/sd_plugins.o \ + $(OBJDIR)/os.o + + + +# $(OBJDIR)/mtops.o + +# bacula-sd +SD_OBJS = \ + $(OBJDIR)/stored.o \ + $(OBJDIR)/append.o \ + $(OBJDIR)/dircmd.o \ + $(OBJDIR)/fd_cmds.o \ + $(OBJDIR)/job.o \ + $(OBJDIR)/read.o \ + $(OBJDIR)/vbackup.o \ + $(OBJDIR)/dde_cmd.o \ + $(OBJDIR)/status.o + +# bextract +BEXTRACT_OBJS = \ + $(OBJDIR)/bextract.o + +OBJS_WIN = \ + $(OBJDIR)/service.o \ + $(OBJDIR)/main.o \ + $(OBJDIR)/bacula.res + +# $(OBJDIR)/trayMonitor.o \ +# $(OBJDIR)/aboutDialog.o \ +# $(OBJDIR)/statusDialog.o \ + + +ALL_OBJS = \ + $(COMMON_OBJS) \ + $(SD_OBJS) \ + $(BEXTRACT_OBJS) \ + $(OBJS_WIN) \ + $(OBJDIR)/bcopy.o \ + $(OBJDIR)/bls.o \ + $(OBJDIR)/btape.o \ + $(OBJDIR)/bscan.o + +LIBS_STORED = \ + $(LIBS_PTHREADS) \ + $(LIBS_NETWORK) \ + -lole32 \ + -loleaut32 \ + -luuid \ + -lcomctl32 + +###################################################################### + +# Targets + +.PHONY: all clean + +all: $(BINDIR)/bacula-sd.exe $(BINDIR)/bcopy.exe $(BINDIR)/bextract.exe $(BINDIR)/bls.exe +# $(BINDIR)/bscan.exe $(BINDIR)/btape.exe + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(ALL_OBJS)) + $(call clean_exe,$(BINDIR)/bacula-sd.exe) + $(call clean_exe,$(BINDIR)/bcopy.exe) + $(call clean_exe,$(BINDIR)/bextract.exe) + $(call clean_exe,$(BINDIR)/bls.exe) + $(call clean_exe,$(BINDIR)/bscan.exe) + $(call clean_exe,$(BINDIR)/btape.exe) + $(ECHO_CMD)rm -rf $(OBJDIRS) + +realclean: clean + rm -f tags bacula-sd.conf + +# +# Rules +# + +$(BINDIR)/bacula-sd.exe: $(SD_OBJS) $(COMMON_OBJS) $(OBJS_WIN) $(LIBS_BACULA) + $(call link_winapp,$(LIBS_STORED)) + +$(BINDIR)/btape.exe: $(OBJDIR)/btape.o $(COMMON_OBJS) $(LIBS_BACULA) + $(call link_conapp,$(LIBS_STORED)) + +$(BINDIR)/bls.exe: $(OBJDIR)/bls.o $(COMMON_OBJS) $(LIBS_BACULA) + $(call link_conapp,$(LIBS_STORED)) + +$(BINDIR)/bextract.exe: $(BEXTRACT_OBJS) $(COMMON_OBJS) $(LIBS_BACULA) $(LIBS_LZO) + $(call link_conapp,$(LIBS_STORED) $(LIBS_ZLIB)) + +$(BINDIR)/bscan.exe: $(OBJDIR)/bscan.o $(COMMON_OBJS) $(LIBS_CATS) $(LIBS_BACULA) + $(call link_conapp,$(LIBS_STORED)) + +$(BINDIR)/bcopy.exe: $(OBJDIR)/bcopy.o $(COMMON_OBJS) $(LIBS_BACULA) + $(call link_conapp,$(LIBS_STORED)) + +$(OBJDIR)/mtops.o: mtops.cpp + @echo "Compiling $@" + $(call checkdir,$@) + $(ECHO_CMD)$(CXX) $(CFLAGS) $(INCLUDE_DDK) -I../../stored -c $< -o $@ + +$(OBJDIR)/winres.res: baculasd/winres.rc + @echo "Compiling $@" + $(call checkdir,$@) + $(ECHO_CMD)$(WINDRES) $(INCLUDE_ICONS) -I baculasd -O coff $< -o $@ + +include ../Makefile.rules diff --git a/bacula/src/win32/stored/bacula.rc b/bacula/src/win32/stored/bacula.rc new file mode 100644 index 0000000000..92b889cb41 --- /dev/null +++ b/bacula/src/win32/stored/bacula.rc @@ -0,0 +1 @@ +#include "../libwin32/bacula.rc" diff --git a/bacula/src/win32/stored/baculasd.vcproj b/bacula/src/win32/stored/baculasd.vcproj new file mode 100644 index 0000000000..a9de8f2eda --- /dev/null +++ b/bacula/src/win32/stored/baculasd.vcproj @@ -0,0 +1,396 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/stored/bcopy/bcopy.vcproj b/bacula/src/win32/stored/bcopy/bcopy.vcproj new file mode 100644 index 0000000000..e721e2f47b --- /dev/null +++ b/bacula/src/win32/stored/bcopy/bcopy.vcproj @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/stored/bextract/bextract.vcproj b/bacula/src/win32/stored/bextract/bextract.vcproj new file mode 100644 index 0000000000..8a17343404 --- /dev/null +++ b/bacula/src/win32/stored/bextract/bextract.vcproj @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/stored/bls/bls.vcproj b/bacula/src/win32/stored/bls/bls.vcproj new file mode 100644 index 0000000000..1a07d41848 --- /dev/null +++ b/bacula/src/win32/stored/bls/bls.vcproj @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/stored/bscan/bscan.vcproj b/bacula/src/win32/stored/bscan/bscan.vcproj new file mode 100644 index 0000000000..15caf4bf84 --- /dev/null +++ b/bacula/src/win32/stored/bscan/bscan.vcproj @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/stored/btape/btape.vcproj b/bacula/src/win32/stored/btape/btape.vcproj new file mode 100644 index 0000000000..14ed030c01 --- /dev/null +++ b/bacula/src/win32/stored/btape/btape.vcproj @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/stored/main.cpp b/bacula/src/win32/stored/main.cpp new file mode 100644 index 0000000000..a20a657adb --- /dev/null +++ b/bacula/src/win32/stored/main.cpp @@ -0,0 +1,24 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#include "who.h" +#include "../libwin32/main.cpp" diff --git a/bacula/src/win32/stored/mtops.cpp b/bacula/src/win32/stored/mtops.cpp new file mode 100644 index 0000000000..2eeeafa611 --- /dev/null +++ b/bacula/src/win32/stored/mtops.cpp @@ -0,0 +1,1175 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2006-2008 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * mtops.cpp - Emulate the Linux st (scsi tape) driver on Microsoft Windows. + * + * Author: Robert Nelson, May, 2006 + * + * Version $Id$ + * + * This file was contributed to the Bacula project by Robert Nelson. + * + * Robert Nelson has been granted a perpetual, worldwide, + * non-exclusive, no-charge, royalty-free, irrevocable copyright + * license to reproduce, prepare derivative works of, publicly + * display, publicly perform, sublicense, and distribute the original + * work contributed by Robert Nelson to the Bacula project in source + * or object form. + * + * If you wish to license contributions from Robert Nelson + * under an alternate open source license please contact + * Robert Nelson . + */ + +#include +#include + +#include "bacula.h" /* pull in global headers */ +#include "stored.h" /* pull in Storage Deamon headers */ + +#include "sys/mtio.h" +#if defined(_MSC_VER) +#include +#else +#include +#endif +#include + +// +// SCSI bus status codes. +// + +#define SCSISTAT_GOOD 0x00 +#define SCSISTAT_CHECK_CONDITION 0x02 +#define SCSISTAT_CONDITION_MET 0x04 +#define SCSISTAT_BUSY 0x08 +#define SCSISTAT_INTERMEDIATE 0x10 +#define SCSISTAT_INTERMEDIATE_COND_MET 0x14 +#define SCSISTAT_RESERVATION_CONFLICT 0x18 +#define SCSISTAT_COMMAND_TERMINATED 0x22 +#define SCSISTAT_QUEUE_FULL 0x28 + +inline SHORT Read16BitSigned(const unsigned char *pValue) +{ + return (SHORT)(((USHORT)pValue[0] << 8) | (USHORT)pValue[1]); +} + +inline USHORT Read16BitUnsigned(const unsigned char *pValue) +{ + return (((USHORT)pValue[0] << 8) | (USHORT)pValue[1]); +} + +inline LONG Read24BitSigned(const unsigned char *pValue) +{ + return ((LONG)(((ULONG)pValue[0] << 16) | ((ULONG)pValue[1] << 8) | + (ULONG)pValue[2])) << 8 >> 8; +} + +inline ULONG Read24BitUnsigned(const unsigned char *pValue) +{ + return ((ULONG)pValue[0] << 16) | ((ULONG)pValue[1] << 8) | (ULONG)pValue[2]; +} + +inline LONG Read32BitSigned(const unsigned char *pValue) +{ + return (LONG)(((ULONG)pValue[0] << 24) | ((ULONG)pValue[1] << 16) | + ((ULONG)pValue[2] << 8) | (ULONG)pValue[3]); +} + +inline ULONG Read32BitUnsigned(const unsigned char *pValue) +{ + return (((ULONG)pValue[0] << 24) | ((ULONG)pValue[1] << 16) | + ((ULONG)pValue[2] << 8) | (ULONG)pValue[3]); +} + +inline LONGLONG Read64BitSigned(const unsigned char *pValue) +{ + return (LONGLONG)(((ULONGLONG)pValue[0] << 56) | ((ULONGLONG)pValue[1] << 48) | + ((ULONGLONG)pValue[2] << 40) | ((ULONGLONG)pValue[3] << 32) | + ((ULONGLONG)pValue[4] << 24) | ((ULONGLONG)pValue[5] << 16) | + ((ULONGLONG)pValue[6] << 8) | (ULONGLONG)pValue[7]); +} + +inline ULONGLONG Read64BitUnsigned(const unsigned char *pValue) +{ + return (LONGLONG)(((ULONGLONG)pValue[0] << 56) | ((ULONGLONG)pValue[1] << 48) | + ((ULONGLONG)pValue[2] << 40) | ((ULONGLONG)pValue[3] << 32) | + ((ULONGLONG)pValue[4] << 24) | ((ULONGLONG)pValue[5] << 16) | + ((ULONGLONG)pValue[6] << 8) | (ULONGLONG)pValue[7]); +} + +typedef struct _TAPE_POSITION_INFO +{ + UCHAR AtPartitionStart:1; + UCHAR AtPartitionEnd:1; + UCHAR PartitionBlockValid:1; + UCHAR FileSetValid:1; + UCHAR :4; + UCHAR Reserved1[3]; + ULONG Partition; + ULONGLONG BlockNumber; + ULONGLONG FileNumber; + ULONGLONG SetNumber; +} TAPE_POSITION_INFO, *PTAPE_POSITION_INFO; + +typedef struct _TAPE_HANDLE_INFO +{ + HANDLE OSHandle; + bool bEOD; + bool bEOF; + bool bEOT; + bool bBlockValid; + ULONG FeaturesLow; + ULONG FeaturesHigh; + ULONG ulFile; + ULONGLONG ullFileStart; + +} TAPE_HANDLE_INFO, *PTAPE_HANDLE_INFO; + +TAPE_HANDLE_INFO TapeHandleTable[] = +{ + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE } +}; + +#define NUMBER_HANDLE_ENTRIES (sizeof(TapeHandleTable) / sizeof(TapeHandleTable[0])) + +static DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo); +static DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize); + +static int tape_get(int fd, struct mtget *mt_get); +static int tape_op(int fd, struct mtop *mt_com); +static int tape_pos(int fd, struct mtpos *mt_pos); + +int +win32_tape_open(const char *file, int flags, ...) +{ + HANDLE hDevice = INVALID_HANDLE_VALUE; + char szDeviceName[256] = "\\\\.\\"; + int idxFile; + DWORD dwResult; + + for (idxFile = 0; idxFile < (int)NUMBER_HANDLE_ENTRIES; idxFile++) { + if (TapeHandleTable[idxFile].OSHandle == INVALID_HANDLE_VALUE) { + break; + } + } + + if (idxFile >= (int)NUMBER_HANDLE_ENTRIES) { + return EMFILE; + } + + memset(&TapeHandleTable[idxFile], 0, sizeof(TapeHandleTable[idxFile])); + + if (!IsPathSeparator(file[0])) { + bstrncpy(&szDeviceName[4], file, sizeof(szDeviceName) - 4); + } else { + bstrncpy(&szDeviceName[0], file, sizeof(szDeviceName)); + } + + hDevice = CreateFile(szDeviceName, FILE_ALL_ACCESS, 0, NULL, OPEN_EXISTING, 0, NULL); + + if (hDevice != INVALID_HANDLE_VALUE) { + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[idxFile]; + + memset(pHandleInfo, 0, sizeof(*pHandleInfo)); + + pHandleInfo->OSHandle = hDevice; + + TAPE_GET_DRIVE_PARAMETERS TapeDriveParameters; + DWORD dwSize = sizeof(TapeDriveParameters); + + dwResult = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &dwSize, &TapeDriveParameters); + if (dwResult == NO_ERROR) { + pHandleInfo->FeaturesLow = TapeDriveParameters.FeaturesLow; + pHandleInfo->FeaturesHigh = TapeDriveParameters.FeaturesHigh; + } + + TAPE_POSITION_INFO TapePositionInfo; + + dwResult = GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo); + + if (dwResult == NO_ERROR) { + if (TapePositionInfo.AtPartitionStart || TapePositionInfo.AtPartitionEnd || + (TapePositionInfo.PartitionBlockValid && TapePositionInfo.BlockNumber == 0)) { + pHandleInfo->ulFile = 0; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } else if (TapePositionInfo.FileSetValid) { + pHandleInfo->ulFile = (ULONG)TapePositionInfo.FileNumber; + } + } + } else { + DWORD dwError = GetLastError(); + + switch (dwError) { + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: + errno = ENOENT; + break; + + case ERROR_TOO_MANY_OPEN_FILES: + errno = EMFILE; + break; + + default: + case ERROR_ACCESS_DENIED: + case ERROR_SHARING_VIOLATION: + case ERROR_LOCK_VIOLATION: + case ERROR_INVALID_NAME: + errno = EACCES; + break; + + case ERROR_FILE_EXISTS: + errno = EEXIST; + break; + + case ERROR_INVALID_PARAMETER: + errno = EINVAL; + break; + } + + return(int) -1; + } + + return (int)idxFile + 3; +} + +ssize_t +win32_read(int fd, void *buffer, size_t count) +{ + return read(fd, buffer, count); +} + +ssize_t +win32_write(int fd, const void *buffer, size_t count) +{ + return write(fd, buffer, count); +} + +int +win32_ioctl(int d, unsigned long int req, ...) +{ + return -1; +} + +ssize_t +win32_tape_read(int fd, void *buffer, size_t count) +{ + if (buffer == NULL) { + errno = EINVAL; + return -1; + } + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + DWORD bytes_read; + BOOL bResult; + + bResult = ReadFile(pHandleInfo->OSHandle, buffer, count, &bytes_read, NULL); + + if (bResult) { + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + return bytes_read; + } else { + int iReturnValue = 0; + DWORD last_error = GetLastError(); + + switch (last_error) { + + case ERROR_FILEMARK_DETECTED: + pHandleInfo->bEOF = true; + break; + + case ERROR_END_OF_MEDIA: + pHandleInfo->bEOT = true; + break; + + case ERROR_NO_MEDIA_IN_DRIVE: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = ENOMEDIUM; + iReturnValue = -1; + break; + + case ERROR_NO_DATA_DETECTED: + pHandleInfo->bEOD = true; + break; + + case ERROR_INVALID_HANDLE: + case ERROR_ACCESS_DENIED: + case ERROR_LOCK_VIOLATION: + errno = EBADF; + iReturnValue = -1; + break; + + default: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = EIO; + iReturnValue = -1; + } + + return iReturnValue; + } +} + +ssize_t +win32_tape_write(int fd, const void *buffer, size_t count) +{ + if (buffer == NULL) { + errno = EINVAL; + return -1; + } + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + DWORD bytes_written; + BOOL bResult; + + bResult = WriteFile(pHandleInfo->OSHandle, buffer, count, &bytes_written, NULL); + + if (bResult) { + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + return bytes_written; + } else { + DWORD last_error = GetLastError(); + + switch (last_error) { + case ERROR_END_OF_MEDIA: + case ERROR_DISK_FULL: + pHandleInfo->bEOT = true; + errno = ENOSPC; + break; + + case ERROR_NO_MEDIA_IN_DRIVE: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = ENOMEDIUM; + break; + + case ERROR_INVALID_HANDLE: + case ERROR_ACCESS_DENIED: + errno = EBADF; + break; + + default: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = EIO; + break; + } + return -1; + } +} + +int +win32_tape_close(int fd) +{ + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + if (!CloseHandle(pHandleInfo->OSHandle)) { + pHandleInfo->OSHandle = INVALID_HANDLE_VALUE; + errno = EBADF; + return -1; + } + + pHandleInfo->OSHandle = INVALID_HANDLE_VALUE; + + return 0; +} + +int +win32_tape_ioctl(int fd, unsigned long int request, ...) +{ + va_list argp; + int result; + + va_start(argp, request); + + switch (request) { + case MTIOCTOP: + result = tape_op(fd, va_arg(argp, mtop *)); + break; + + case MTIOCGET: + result = tape_get(fd, va_arg(argp, mtget *)); + break; + + case MTIOCPOS: + result = tape_pos(fd, va_arg(argp, mtpos *)); + break; + + default: + errno = ENOTTY; + result = -1; + break; + } + + va_end(argp); + + return result; +} + +static int tape_op(int fd, struct mtop *mt_com) +{ + DWORD result = NO_ERROR; + int index; + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + switch (mt_com->mt_op) + { + case MTRESET: + case MTNOP: + case MTSETDRVBUFFER: + break; + + default: + case MTRAS1: + case MTRAS2: + case MTRAS3: + case MTSETDENSITY: + errno = ENOTTY; + result = (DWORD)-1; + break; + + case MTFSF: + for (index = 0; index < mt_com->mt_count; index++) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->ulFile++; + pHandleInfo->bEOF = true; + pHandleInfo->bEOT = false; + } + } + break; + + case MTBSF: + for (index = 0; index < mt_com->mt_count; index++) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->ulFile--; + pHandleInfo->bBlockValid = false; + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } + } + break; + + case MTFSR: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_RELATIVE_BLOCKS, 0, mt_com->mt_count, 0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } else if (result == ERROR_FILEMARK_DETECTED) { + pHandleInfo->bEOF = true; + } + break; + + case MTBSR: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_RELATIVE_BLOCKS, 0, -mt_com->mt_count, ~0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } else if (result == ERROR_FILEMARK_DETECTED) { + pHandleInfo->ulFile--; + pHandleInfo->bBlockValid = false; + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } + break; + + case MTWEOF: + result = WriteTapemark(pHandleInfo->OSHandle, TAPE_FILEMARKS, mt_com->mt_count, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOF = true; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile += mt_com->mt_count; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTREW: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_REWIND, 0, 0, 0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile = 0; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTOFFL: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOAD, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile = 0; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTRETEN: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_TENSION, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile = 0; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTBSFM: + for (index = 0; index < mt_com->mt_count; index++) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); + if (result == NO_ERROR) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } + } + break; + + case MTFSFM: + for (index = 0; index < mt_com->mt_count; index++) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, mt_com->mt_count, 0, FALSE); + if (result == NO_ERROR) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } + } + break; + + case MTEOM: + for ( ; ; ) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); + if (result != NO_ERROR) { + pHandleInfo->bEOF = false; + + if (result == ERROR_END_OF_MEDIA) { + pHandleInfo->bEOD = true; + pHandleInfo->bEOT = true; + return 0; + } + if (result == ERROR_NO_DATA_DETECTED) { + pHandleInfo->bEOD = true; + pHandleInfo->bEOT = false; + return 0; + } + break; + } else { + pHandleInfo->bEOF = true; + pHandleInfo->ulFile++; + } + } + break; + + case MTERASE: + result = EraseTape(pHandleInfo->OSHandle, TAPE_ERASE_LONG, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = true; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile = 0; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTSETBLK: + { + TAPE_SET_MEDIA_PARAMETERS SetMediaParameters; + + SetMediaParameters.BlockSize = mt_com->mt_count; + result = SetTapeParameters(pHandleInfo->OSHandle, SET_TAPE_MEDIA_INFORMATION, &SetMediaParameters); + } + break; + + case MTSEEK: + { + TAPE_POSITION_INFO TapePositionInfo; + + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, 0, mt_com->mt_count, 0, FALSE); + + memset(&TapePositionInfo, 0, sizeof(TapePositionInfo)); + DWORD dwPosResult = GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo); + if (dwPosResult == NO_ERROR && TapePositionInfo.FileSetValid) { + pHandleInfo->ulFile = (ULONG)TapePositionInfo.FileNumber; + } else { + pHandleInfo->ulFile = ~0U; + } + } + break; + + case MTTELL: + { + DWORD partition; + DWORD offset; + DWORD offsetHi; + + result = GetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, &partition, &offset, &offsetHi); + if (result == NO_ERROR) { + return offset; + } + } + break; + + case MTFSS: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_SETMARKS, 0, mt_com->mt_count, 0, FALSE); + break; + + case MTBSS: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_SETMARKS, 0, -mt_com->mt_count, ~0, FALSE); + break; + + case MTWSM: + result = WriteTapemark(pHandleInfo->OSHandle, TAPE_SETMARKS, mt_com->mt_count, FALSE); + break; + + case MTLOCK: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_LOCK, FALSE); + break; + + case MTUNLOCK: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOCK, FALSE); + break; + + case MTLOAD: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_LOAD, FALSE); + break; + + case MTUNLOAD: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOAD, FALSE); + break; + + case MTCOMPRESSION: + { + TAPE_GET_DRIVE_PARAMETERS GetDriveParameters; + TAPE_SET_DRIVE_PARAMETERS SetDriveParameters; + DWORD size; + + size = sizeof(GetDriveParameters); + + result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &size, &GetDriveParameters); + + if (result == NO_ERROR) + { + SetDriveParameters.ECC = GetDriveParameters.ECC; + SetDriveParameters.Compression = (BOOLEAN)mt_com->mt_count; + SetDriveParameters.DataPadding = GetDriveParameters.DataPadding; + SetDriveParameters.ReportSetmarks = GetDriveParameters.ReportSetmarks; + SetDriveParameters.EOTWarningZoneSize = GetDriveParameters.EOTWarningZoneSize; + + result = SetTapeParameters(pHandleInfo->OSHandle, SET_TAPE_DRIVE_INFORMATION, &SetDriveParameters); + } + } + break; + + case MTSETPART: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_LOGICAL_BLOCK, mt_com->mt_count, 0, 0, FALSE); + break; + + case MTMKPART: + if (mt_com->mt_count == 0) + { + result = CreateTapePartition(pHandleInfo->OSHandle, TAPE_INITIATOR_PARTITIONS, 1, 0); + } + else + { + result = CreateTapePartition(pHandleInfo->OSHandle, TAPE_INITIATOR_PARTITIONS, 2, mt_com->mt_count); + } + break; + } + + if ((result == NO_ERROR && pHandleInfo->bEOF) || + (result == ERROR_FILEMARK_DETECTED && mt_com->mt_op == MTFSR)) { + + TAPE_POSITION_INFO TapePositionInfo; + + if (GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo) == NO_ERROR) { + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = TapePositionInfo.BlockNumber; + } + } + + switch (result) { + case NO_ERROR: + case (DWORD)-1: /* Error has already been translated into errno */ + break; + + default: + case ERROR_FILEMARK_DETECTED: + errno = EIO; + break; + + case ERROR_END_OF_MEDIA: + pHandleInfo->bEOT = true; + errno = EIO; + break; + + case ERROR_NO_DATA_DETECTED: + pHandleInfo->bEOD = true; + errno = EIO; + break; + + case ERROR_NO_MEDIA_IN_DRIVE: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = ENOMEDIUM; + break; + + case ERROR_INVALID_HANDLE: + case ERROR_ACCESS_DENIED: + case ERROR_LOCK_VIOLATION: + errno = EBADF; + break; + } + + return result == NO_ERROR ? 0 : -1; +} + +static int tape_get(int fd, struct mtget *mt_get) +{ + TAPE_POSITION_INFO pos_info; + BOOL result; + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + if (GetTapePositionInfo(pHandleInfo->OSHandle, &pos_info) != NO_ERROR) { + return -1; + } + + DWORD density = 0; + DWORD blocksize = 0; + + result = GetDensityBlockSize(pHandleInfo->OSHandle, &density, &blocksize); + + if (result != NO_ERROR) { + TAPE_GET_DRIVE_PARAMETERS drive_params; + DWORD size; + + size = sizeof(drive_params); + + result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &size, &drive_params); + + if (result == NO_ERROR) { + blocksize = drive_params.DefaultBlockSize; + } + } + + mt_get->mt_type = MT_ISSCSI2; + + // Partition # + mt_get->mt_resid = pos_info.PartitionBlockValid ? pos_info.Partition : (ULONG)-1; + + // Density / Block Size + mt_get->mt_dsreg = ((density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK) | + ((blocksize << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK); + + mt_get->mt_gstat = 0x00010000; /* Immediate report mode.*/ + + if (pHandleInfo->bEOF) { + mt_get->mt_gstat |= 0x80000000; // GMT_EOF + } + + if (pos_info.PartitionBlockValid && pos_info.BlockNumber == 0) { + mt_get->mt_gstat |= 0x40000000; // GMT_BOT + } + + if (pHandleInfo->bEOT) { + mt_get->mt_gstat |= 0x20000000; // GMT_EOT + } + + if (pHandleInfo->bEOD) { + mt_get->mt_gstat |= 0x08000000; // GMT_EOD + } + + TAPE_GET_MEDIA_PARAMETERS media_params; + DWORD size = sizeof(media_params); + + result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_MEDIA_INFORMATION, &size, &media_params); + + if (result == NO_ERROR && media_params.WriteProtected) { + mt_get->mt_gstat |= 0x04000000; // GMT_WR_PROT + } + + result = GetTapeStatus(pHandleInfo->OSHandle); + + if (result != NO_ERROR) { + if (result == ERROR_NO_MEDIA_IN_DRIVE) { + mt_get->mt_gstat |= 0x00040000; // GMT_DR_OPEN + } + } else { + mt_get->mt_gstat |= 0x01000000; // GMT_ONLINE + } + + // Recovered Error Count + mt_get->mt_erreg = 0; + + // File Number + mt_get->mt_fileno = (__daddr_t)pHandleInfo->ulFile; + + // Block Number + mt_get->mt_blkno = (__daddr_t)(pHandleInfo->bBlockValid ? pos_info.BlockNumber - pHandleInfo->ullFileStart : (ULONGLONG)-1); + + return 0; +} + +#define SERVICEACTION_SHORT_FORM_BLOCKID 0 +#define SERVICEACTION_SHORT_FORM_VENDOR_SPECIFIC 1 +#define SERVICEACTION_LONG_FORM 6 +#define SERVICEACTION_EXTENDED_FORM 8 + + +typedef struct _SCSI_READ_POSITION_SHORT_BUFFER +{ + UCHAR :1; + UCHAR PERR:1; + UCHAR BPU:1; + UCHAR :1; + UCHAR BYCU:1; + UCHAR BCU:1; + UCHAR EOP:1; + UCHAR BOP:1; + UCHAR Partition; + UCHAR Reserved1[2]; + UCHAR FirstBlock[4]; + UCHAR LastBlock[4]; + UCHAR Reserved2; + UCHAR NumberBufferBlocks[3]; + UCHAR NumberBufferBytes[4]; +} SCSI_READ_POSITION_SHORT_BUFFER, *PSCSI_READ_POSITION_SHORT_BUFFER; + +typedef struct _SCSI_READ_POSITION_LONG_BUFFER +{ + UCHAR :2; + UCHAR BPU:1; + UCHAR MPU:1; + UCHAR :2; + UCHAR EOP:1; + UCHAR BOP:1; + UCHAR Reserved3[3]; + UCHAR Partition[4]; + UCHAR BlockNumber[8]; + UCHAR FileNumber[8]; + UCHAR SetNumber[8]; +} SCSI_READ_POSITION_LONG_BUFFER, *PSCSI_READ_POSITION_LONG_BUFFER; + +typedef struct _SCSI_READ_POSITION_EXTENDED_BUFFER +{ + UCHAR :1; + UCHAR PERR:1; + UCHAR LOPU:1; + UCHAR :1; + UCHAR BYCU:1; + UCHAR LOCU:1; + UCHAR EOP:1; + UCHAR BOP:1; + UCHAR Partition; + UCHAR AdditionalLength[2]; + UCHAR Reserved1; + UCHAR NumberBufferObjects[3]; + UCHAR FirstLogicalObject[8]; + UCHAR LastLogicalObject[8]; + UCHAR NumberBufferObjectBytes[8]; +} SCSI_READ_POSITION_EXTENDED_BUFFER, *PSCSI_READ_POSITION_EXTENDED_BUFFER; + +typedef union _READ_POSITION_RESULT { + SCSI_READ_POSITION_SHORT_BUFFER ShortBuffer; + SCSI_READ_POSITION_LONG_BUFFER LongBuffer; + SCSI_READ_POSITION_EXTENDED_BUFFER ExtendedBuffer; +} READ_POSITION_RESULT, *PREAD_POSITION_RESULT; + +static DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo) +{ + PSCSI_PASS_THROUGH ScsiPassThrough; + BOOL bResult; + DWORD dwBytesReturned; + + const DWORD dwBufferSize = sizeof(SCSI_PASS_THROUGH) + sizeof(READ_POSITION_RESULT) + 28; + + memset(TapePositionInfo, 0, sizeof(*TapePositionInfo)); + + ScsiPassThrough = (PSCSI_PASS_THROUGH)malloc(dwBufferSize); + + for (int pass = 0; pass < 2; pass++) + { + memset(ScsiPassThrough, 0, dwBufferSize); + + ScsiPassThrough->Length = sizeof(SCSI_PASS_THROUGH); + + ScsiPassThrough->CdbLength = 10; + ScsiPassThrough->SenseInfoLength = 28; + ScsiPassThrough->DataIn = 1; + ScsiPassThrough->DataTransferLength = sizeof(SCSI_READ_POSITION_LONG_BUFFER); + ScsiPassThrough->TimeOutValue = 1000; + ScsiPassThrough->DataBufferOffset = sizeof(SCSI_PASS_THROUGH) + 28; + ScsiPassThrough->SenseInfoOffset = sizeof(SCSI_PASS_THROUGH); + + ScsiPassThrough->Cdb[0] = 0x34; // READ POSITION + + switch (pass) + { + case 0: + ScsiPassThrough->Cdb[1] = SERVICEACTION_LONG_FORM; + break; + + case 1: + ScsiPassThrough->Cdb[1] = SERVICEACTION_SHORT_FORM_BLOCKID; + break; + } + + bResult = DeviceIoControl( hDevice, + IOCTL_SCSI_PASS_THROUGH, + ScsiPassThrough, sizeof(SCSI_PASS_THROUGH), + ScsiPassThrough, dwBufferSize, + &dwBytesReturned, + NULL); + + if (bResult && dwBytesReturned >= (offsetof(SCSI_PASS_THROUGH, ScsiStatus) + sizeof(ScsiPassThrough->ScsiStatus))) { + if (ScsiPassThrough->ScsiStatus == SCSISTAT_GOOD) { + PREAD_POSITION_RESULT pPosResult = (PREAD_POSITION_RESULT)((PUCHAR)ScsiPassThrough + ScsiPassThrough->DataBufferOffset); + + switch (pass) + { + case 0: // SERVICEACTION_LONG_FORM + { + TapePositionInfo->AtPartitionStart = pPosResult->LongBuffer.BOP; + TapePositionInfo->AtPartitionEnd = pPosResult->LongBuffer.EOP; + + if (!TapePositionInfo->PartitionBlockValid) { + TapePositionInfo->PartitionBlockValid = !pPosResult->LongBuffer.BPU; + + if (TapePositionInfo->PartitionBlockValid) { + TapePositionInfo->Partition = Read32BitUnsigned(pPosResult->LongBuffer.Partition); + TapePositionInfo->BlockNumber = Read64BitUnsigned(pPosResult->LongBuffer.BlockNumber); + } + } + + TapePositionInfo->FileSetValid = !pPosResult->LongBuffer.MPU; + if (TapePositionInfo->FileSetValid) { + TapePositionInfo->FileNumber = Read64BitUnsigned(pPosResult->LongBuffer.FileNumber); + TapePositionInfo->SetNumber = Read64BitUnsigned(pPosResult->LongBuffer.SetNumber); + } + } + break; + + case 1: // SERVICEACTION_SHORT_FORM_BLOCKID + { + // pPosResult->ShortBuffer.PERR; + // pPosResult->ShortBuffer.BYCU; + // pPosResult->ShortBuffer.BCU; + TapePositionInfo->AtPartitionStart = pPosResult->ShortBuffer.BOP; + TapePositionInfo->AtPartitionEnd = pPosResult->ShortBuffer.EOP; + + if (!TapePositionInfo->PartitionBlockValid) { + TapePositionInfo->PartitionBlockValid = !pPosResult->ShortBuffer.BPU; + + if (TapePositionInfo->PartitionBlockValid) { + TapePositionInfo->Partition = pPosResult->ShortBuffer.Partition; + TapePositionInfo->BlockNumber = Read32BitUnsigned(pPosResult->ShortBuffer.FirstBlock); + } + } + // Read32BitsUnsigned(pPosResult->ShortBuffer.LastBlock); + // Read24BitsUnsigned(pPosResult->ShortBuffer.NumberBufferBlocks); + // Read32BitsUnsigned(pPosResult->ShortBuffer.NumberBufferBytes); + } + break; + } + } + } + } + free(ScsiPassThrough); + + return NO_ERROR; +} + +static DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize) +{ + DWORD dwBufferSize = sizeof(GET_MEDIA_TYPES) + 5 * sizeof(DEVICE_MEDIA_INFO); + GET_MEDIA_TYPES * pGetMediaTypes = (GET_MEDIA_TYPES *)malloc(dwBufferSize); + BOOL bResult; + DWORD dwResult; + + if (pGetMediaTypes == NULL) { + return ERROR_OUTOFMEMORY; + } + + do { + DWORD dwBytesReturned; + + bResult = DeviceIoControl( hDevice, + IOCTL_STORAGE_GET_MEDIA_TYPES_EX, + NULL, 0, + (LPVOID)pGetMediaTypes, dwBufferSize, + &dwBytesReturned, + NULL); + + if (!bResult) { + dwResult = GetLastError(); + + if (dwResult != ERROR_INSUFFICIENT_BUFFER) { + free(pGetMediaTypes); + return dwResult; + } + + dwBufferSize += 6 * sizeof(DEVICE_MEDIA_INFO); + + GET_MEDIA_TYPES * pNewBuffer = (GET_MEDIA_TYPES *)realloc(pGetMediaTypes, dwBufferSize); + + if (pNewBuffer != pGetMediaTypes) { + free(pGetMediaTypes); + + if (pNewBuffer == NULL) { + return ERROR_OUTOFMEMORY; + } + + pGetMediaTypes = pNewBuffer; + } + } + } while (!bResult); + + if (pGetMediaTypes->DeviceType != FILE_DEVICE_TAPE) { + free(pGetMediaTypes); + return ERROR_BAD_DEVICE; + } + + for (DWORD idxMedia = 0; idxMedia < pGetMediaTypes->MediaInfoCount; idxMedia++) { + + if (pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.MediaCharacteristics & MEDIA_CURRENTLY_MOUNTED) { + + if (pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.BusType == BusTypeScsi) { + *pdwDensity = pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.BusSpecificData.ScsiInformation.DensityCode; + } else { + *pdwDensity = 0; + } + + *pdwBlockSize = pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.CurrentBlockSize; + + free(pGetMediaTypes); + + return NO_ERROR; + } + } + + free(pGetMediaTypes); + + return ERROR_NO_MEDIA_IN_DRIVE; +} + +static int tape_pos(int fd, struct mtpos *mt_pos) +{ + DWORD partition; + DWORD offset; + DWORD offsetHi; + BOOL result; + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + result = GetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, &partition, &offset, &offsetHi); + if (result == NO_ERROR) { + mt_pos->mt_blkno = offset; + return 0; + } + + return -1; +} diff --git a/bacula/src/win32/stored/postest/postest.cpp b/bacula/src/win32/stored/postest/postest.cpp new file mode 100644 index 0000000000..597691a65d --- /dev/null +++ b/bacula/src/win32/stored/postest/postest.cpp @@ -0,0 +1,299 @@ +#ifdef HAVE_WIN32 +#include +typedef int __daddr_t; +#else +#define tape_open open +#define tape_write write +#define tape_ioctl ioctl +#define tape_close close + +typedef unsigned char UCHAR, *PUCHAR; +typedef unsigned int UINT, *PUINT; +typedef unsigned long ULONG, *PULONG; +typedef unsigned long long ULONGLONG, *PULONGLONG; +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +char *szCommands[] = +{ + "MTRESET", + "MTFSF", + "MTBSF", + "MTFSR", + "MTBSR", + "MTWEOF", + "MTREW", + "MTOFFL", + "MTNOP", + "MTRETEN", + "MTBSFM", + "MTFSFM ", + "MTEOM", + "MTERASE", + "MTRAS1", + "MTRAS2", + "MTRAS3", + "UNKNOWN_17", + "UNKNOWN_18", + "UNKNOWN_19", + "MTSETBLK", + "MTSETDENSITY", + "MTSEEK", + "MTTELL", + "MTSETDRVBUFFER", + "MTFSS", + "MTBSS", + "MTWSM", + "MTLOCK", + "MTUNLOCK", + "MTLOAD", + "MTUNLOAD", + "MTCOMPRESSION", + "MTSETPART", + "MTMKPART", +}; + +#define NUMBER_COMMANDS (sizeof(szCommands) / sizeof(szCommands[0])) + +typedef struct _SCRIPT_ENTRY { + short Command; + int Count; + PUCHAR pszDescription; + ULONG ExpectedFile; + ULONGLONG ExpectedBlock; +} SCRIPT_ENTRY, *PSCRIPT_ENTRY; + +SCRIPT_ENTRY TestScript[] = +{ + { MTREW, 1, 0, 0 }, + { MTFSF, 2, 0, 0 }, + { MTBSR, 1, 0, 0 }, + { MTBSR, 3, 0, 0 }, + { MTFSR, 6, 0, 0 }, + { MTREW, 1, 0, 0 }, + { MTFSF, 3, 0, 0 }, + { MTFSR, 8, 0, 0 }, + { MTFSF, 1, 0, 0 }, + { MTBSF, 1, 0, 0 } +}; + +#define SCRIPT_LENGTH (sizeof(TestScript) / sizeof(TestScript[0])) + +void printpos(int fd, ULONG ulFile, ULONG ulBlock); + +void +run_script(int fd, PSCRIPT_ENTRY entries, size_t count) +{ + mtop op; + + for (size_t idxScript = 0; idxScript < count; idxScript++) + { + PSCRIPT_ENTRY pEntry = &entries[idxScript]; + + fprintf(stderr, "%s %d: ", szCommands[pEntry->Command], pEntry->Count); + + op.mt_op = pEntry->Command; + op.mt_count = pEntry->Count; + + int iResult = tape_ioctl(fd, MTIOCTOP, &op); + + if (iResult >= 0) + { + printpos(fd, pEntry->ExpectedFile, (ULONG)pEntry->ExpectedBlock); + } + else + { + fprintf(stderr, "tape_ioctl returned %d, error = %s\n", errno, strerror(errno)); + } + } +} + +void +weof(int fd) +{ + mtop op; + + op.mt_op = MTWEOF; + op.mt_count = 1; + + if (tape_ioctl(fd, MTIOCTOP, &op) != 0) + { + fprintf(stderr, "tape_ioctl return error %d - %s", errno, strerror(errno)); + } +} + +void +wdata(int fd, ULONG ulBufferNumber, void *pBuffer, size_t size) +{ + ((PUCHAR)pBuffer)[0] = (UCHAR)ulBufferNumber; + ((PUCHAR)pBuffer)[1] = (UCHAR)(ulBufferNumber >> 8); + ((PUCHAR)pBuffer)[2] = (UCHAR)(ulBufferNumber >> 16); + ((PUCHAR)pBuffer)[3] = (UCHAR)(ulBufferNumber >> 24); + + UCHAR ucChar = (UCHAR)ulBufferNumber; + UCHAR ucIncrement = (UCHAR)(ulBufferNumber >> 8); + + if (ucIncrement == 0) + { + ucIncrement++; + } + + for (size_t index = 4; index < size; index++) + { + ((PUCHAR)pBuffer)[index] = ucChar; + ucChar += ucIncrement; + } + + + if (tape_write(fd, pBuffer, (UINT)size) < 0) + { + fprintf(stderr, "tape_write returned error %d - %s", errno, strerror(errno)); + } +} + +void +printpos(int fd, ULONG ulExpectedFile, ULONG ulExpectedBlock) +{ + mtget st; + + tape_ioctl(fd, MTIOCGET, &st); + if (tape_ioctl(fd, MTIOCGET, &st) != 0) + { + fprintf(stderr, "tape_ioctl(MTIOCGET) returned error %d - %s\n", errno, strerror(errno)); + } + + mtpos pos; + + if (tape_ioctl(fd, MTIOCPOS, &pos) != 0) + { + fprintf(stderr, "tape_ioctl(MTIOCPOS) returned error %d - %s\n", errno, strerror(errno)); + } + + fprintf( stderr, "File = %d s/b %d, Block = %d, s/b %d, Absolute = %d, Flags =%s%s%s%s%s%s%s%s\n", + st.mt_fileno, ulExpectedFile, st.mt_blkno, ulExpectedBlock, pos.mt_blkno, + GMT_EOF(st.mt_gstat) ? " EOF" : "", + GMT_BOT(st.mt_gstat) ? " BOT" : "", + GMT_EOT(st.mt_gstat) ? " EOT" : "", + GMT_EOD(st.mt_gstat) ? " EOD" : "", + GMT_WR_PROT(st.mt_gstat) ? " WR_PROT" : "", + GMT_ONLINE(st.mt_gstat) ? " ONLINE" : "", + GMT_DR_OPEN(st.mt_gstat) ? " DR_OPEN" : "", + GMT_IM_REP_EN(st.mt_gstat) ? " IM_REP_EN" : ""); +} + +void +rewind(int fd) +{ + mtop op; + + op.mt_op = MTREW; + op.mt_count = 1; + + if (tape_ioctl(fd, MTIOCTOP, &op) != 0) + { + fprintf(stderr, "tape_ioctl return error %d - %s", errno, strerror(errno)); + } +} + +#define BLOCK_SIZE 32768 + +int +main(int argc, char **argv) +{ + PUCHAR pBuffer; + ULONG ulBlockNumber = 0; + ULONG filenumber = 0; + int index; + + OSDependentInit(); + + int fd = tape_open(argv[1], O_RDWR, 0); + + if (fd == -1) + { + fprintf(stderr, "tape_open return error %d - %s", errno, strerror(errno)); + exit(1); + } + pBuffer = (PUCHAR)malloc(BLOCK_SIZE); + + rewind(fd); + + printpos(fd, 0, 0); + + fprintf(stderr, "file = %d, first block = %d\n", filenumber, ulBlockNumber); + + for (index = 0; index < 10; index++) + { + wdata(fd, ulBlockNumber++, pBuffer, BLOCK_SIZE); + } + + weof(fd); + filenumber++; + ulBlockNumber++; + + fprintf(stderr, "file = %d, first block = %d\n", filenumber, ulBlockNumber); + + for (index = 0; index < 5; index++) + { + wdata(fd, ulBlockNumber++, pBuffer, BLOCK_SIZE); + } + + weof(fd); + filenumber++; + ulBlockNumber++; + + fprintf(stderr, "file = %d, first block = %d\n", filenumber, ulBlockNumber); + + for (index = 0; index < 11; index++) + { + wdata(fd, ulBlockNumber++, pBuffer, BLOCK_SIZE); + } + + weof(fd); + filenumber++; + ulBlockNumber++; + + fprintf(stderr, "file = %d, first block = %d\n", filenumber, ulBlockNumber); + + for (index = 0; index < 8; index++) + { + wdata(fd, ulBlockNumber++, pBuffer, BLOCK_SIZE); + } + + weof(fd); + filenumber++; + ulBlockNumber++; + + fprintf(stderr, "file = %d, first block = %d\n", filenumber, ulBlockNumber); + for (index = 0; index < 12; index++) + { + wdata(fd, ulBlockNumber++, pBuffer, BLOCK_SIZE); + } + + weof(fd); + filenumber++; + ulBlockNumber++; + + fprintf(stderr, "file = %d, first block = %d\n", filenumber, ulBlockNumber); + for (index = 0; index < 7; index++) + { + wdata(fd, ulBlockNumber++, pBuffer, BLOCK_SIZE); + } + + weof(fd); + filenumber++; + ulBlockNumber++; + + run_script(fd, TestScript, SCRIPT_LENGTH); + tape_close(fd); + free(pBuffer); + return 0; +} diff --git a/bacula/src/win32/stored/postest/postest.vcproj b/bacula/src/win32/stored/postest/postest.vcproj new file mode 100644 index 0000000000..345f1956a5 --- /dev/null +++ b/bacula/src/win32/stored/postest/postest.vcproj @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/stored/service.cpp b/bacula/src/win32/stored/service.cpp new file mode 100644 index 0000000000..c8f4a6f630 --- /dev/null +++ b/bacula/src/win32/stored/service.cpp @@ -0,0 +1,25 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#include "who.h" +#include "../libwin32/service.cpp" diff --git a/bacula/src/win32/stored/storelib/storelib.vcproj b/bacula/src/win32/stored/storelib/storelib.vcproj new file mode 100644 index 0000000000..d33e4ea1da --- /dev/null +++ b/bacula/src/win32/stored/storelib/storelib.vcproj @@ -0,0 +1,827 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/stored/trayMonitor.cpp b/bacula/src/win32/stored/trayMonitor.cpp new file mode 100644 index 0000000000..2549434073 --- /dev/null +++ b/bacula/src/win32/stored/trayMonitor.cpp @@ -0,0 +1,25 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + */ + +#include "who.h" +#include "../libwin32/trayMonitor.cpp" diff --git a/bacula/src/win32/stored/who.h b/bacula/src/win32/stored/who.h new file mode 100644 index 0000000000..c267699fde --- /dev/null +++ b/bacula/src/win32/stored/who.h @@ -0,0 +1,31 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * Kern Sibbald, August 2007 + * + * This file is pulled in by certain generic routines in libwin32 + * to define the names of the daemon that is being built. + */ + +#define APP_NAME "Bacula-sd" +#define LC_APP_NAME "bacula-sd" +#define APP_DESC "Bacula Storage Service" + +#define terminate_app(x) terminate_stored(x) +extern void terminate_stored(int sig); diff --git a/bacula/src/win32/stored/win_tape_device.cpp b/bacula/src/win32/stored/win_tape_device.cpp new file mode 100644 index 0000000000..dcb903e711 --- /dev/null +++ b/bacula/src/win32/stored/win_tape_device.cpp @@ -0,0 +1,1142 @@ +/* + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2018 Kern Sibbald + + The original author of Bacula is Kern Sibbald, with contributions + from many others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. +*/ +/* + * mtops.cpp - Emulate the Linux st (scsi tape) driver on Microsoft Windows. + * + * Author: Robert Nelson, May, 2006 + * + * + * This file was contributed to the Bacula project by Robert Nelson. + * + * Robert Nelson has been granted a perpetual, worldwide, + * non-exclusive, no-charge, royalty-free, irrevocable copyright + * license to reproduce, prepare derivative works of, publicly + * display, publicly perform, sublicense, and distribute the original + * work contributed by Robert Nelson to the Bacula project in source + * or object form. + * + * If you wish to license contributions from Robert Nelson + * under an alternate open source license please contact + * Robert Nelson . + */ + +#include +#include + +#include "bacula.h" /* pull in global headers */ +#include "stored.h" /* pull in Storage Deamon headers */ +#include "win_tape_device.h" + +#include "sys/mtio.h" +#if defined(_MSC_VER) +#include +#else +#include +#endif +#include + +// +// SCSI bus status codes. +// + +#define SCSISTAT_GOOD 0x00 +#define SCSISTAT_CHECK_CONDITION 0x02 +#define SCSISTAT_CONDITION_MET 0x04 +#define SCSISTAT_BUSY 0x08 +#define SCSISTAT_INTERMEDIATE 0x10 +#define SCSISTAT_INTERMEDIATE_COND_MET 0x14 +#define SCSISTAT_RESERVATION_CONFLICT 0x18 +#define SCSISTAT_COMMAND_TERMINATED 0x22 +#define SCSISTAT_QUEUE_FULL 0x28 + +static inline SHORT Read16BitSigned(const unsigned char *pValue) +{ + return (SHORT)(((USHORT)pValue[0] << 8) | (USHORT)pValue[1]); +} + +static inline USHORT Read16BitUnsigned(const unsigned char *pValue) +{ + return (((USHORT)pValue[0] << 8) | (USHORT)pValue[1]); +} + +static inline LONG Read24BitSigned(const unsigned char *pValue) +{ + return ((LONG)(((ULONG)pValue[0] << 16) | ((ULONG)pValue[1] << 8) | + (ULONG)pValue[2])) << 8 >> 8; +} + +static inline ULONG Read24BitUnsigned(const unsigned char *pValue) +{ + return ((ULONG)pValue[0] << 16) | ((ULONG)pValue[1] << 8) | (ULONG)pValue[2]; +} + +static inline LONG Read32BitSigned(const unsigned char *pValue) +{ + return (LONG)(((ULONG)pValue[0] << 24) | ((ULONG)pValue[1] << 16) | + ((ULONG)pValue[2] << 8) | (ULONG)pValue[3]); +} + +static inline ULONG Read32BitUnsigned(const unsigned char *pValue) +{ + return (((ULONG)pValue[0] << 24) | ((ULONG)pValue[1] << 16) | + ((ULONG)pValue[2] << 8) | (ULONG)pValue[3]); +} + +static inline LONGLONG Read64BitSigned(const unsigned char *pValue) +{ + return (LONGLONG)(((ULONGLONG)pValue[0] << 56) | ((ULONGLONG)pValue[1] << 48) | + ((ULONGLONG)pValue[2] << 40) | ((ULONGLONG)pValue[3] << 32) | + ((ULONGLONG)pValue[4] << 24) | ((ULONGLONG)pValue[5] << 16) | + ((ULONGLONG)pValue[6] << 8) | (ULONGLONG)pValue[7]); +} + +static inline ULONGLONG Read64BitUnsigned(const unsigned char *pValue) +{ + return (LONGLONG)(((ULONGLONG)pValue[0] << 56) | ((ULONGLONG)pValue[1] << 48) | + ((ULONGLONG)pValue[2] << 40) | ((ULONGLONG)pValue[3] << 32) | + ((ULONGLONG)pValue[4] << 24) | ((ULONGLONG)pValue[5] << 16) | + ((ULONGLONG)pValue[6] << 8) | (ULONGLONG)pValue[7]); +} + +typedef struct _TAPE_POSITION_INFO +{ + UCHAR AtPartitionStart:1; + UCHAR AtPartitionEnd:1; + UCHAR PartitionBlockValid:1; + UCHAR FileSetValid:1; + UCHAR :4; + UCHAR Reserved1[3]; + ULONG Partition; + ULONGLONG BlockNumber; + ULONGLONG FileNumber; + ULONGLONG SetNumber; +} TAPE_POSITION_INFO, *PTAPE_POSITION_INFO; + +typedef struct _TAPE_HANDLE_INFO +{ + HANDLE OSHandle; + bool bEOD; + bool bEOF; + bool bEOT; + bool bBlockValid; + ULONG FeaturesLow; + ULONG FeaturesHigh; + ULONG ulFile; + ULONGLONG ullFileStart; + +} TAPE_HANDLE_INFO, *PTAPE_HANDLE_INFO; + +TAPE_HANDLE_INFO TapeHandleTable[] = +{ + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE }, + { INVALID_HANDLE_VALUE } +}; + +#define NUMBER_HANDLE_ENTRIES (sizeof(TapeHandleTable) / sizeof(TapeHandleTable[0])) + +static DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo); +static DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize); + +win_tape_device::win_tape_device() +{ + m_fd = -1; +} + +win_tape_device::~win_tape_device() +{ } + +int +win_tape_device::d_open(const char *file, int flags, ...) +{ + HANDLE hDevice = INVALID_HANDLE_VALUE; + char szDeviceName[256] = "\\\\.\\"; + int idxFile; + DWORD dwResult; + + for (idxFile = 0; idxFile < (int)NUMBER_HANDLE_ENTRIES; idxFile++) { + if (TapeHandleTable[idxFile].OSHandle == INVALID_HANDLE_VALUE) { + break; + } + } + + if (idxFile >= (int)NUMBER_HANDLE_ENTRIES) { + return EMFILE; + } + + memset(&TapeHandleTable[idxFile], 0, sizeof(TapeHandleTable[idxFile])); + + if (!IsPathSeparator(file[0])) { + bstrncpy(&szDeviceName[4], file, sizeof(szDeviceName) - 4); + } else { + bstrncpy(&szDeviceName[0], file, sizeof(szDeviceName)); + } + + hDevice = CreateFile(szDeviceName, FILE_ALL_ACCESS, 0, NULL, OPEN_EXISTING, 0, NULL); + + if (hDevice != INVALID_HANDLE_VALUE) { + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[idxFile]; + + memset(pHandleInfo, 0, sizeof(*pHandleInfo)); + + pHandleInfo->OSHandle = hDevice; + + TAPE_GET_DRIVE_PARAMETERS TapeDriveParameters; + DWORD dwSize = sizeof(TapeDriveParameters); + + dwResult = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &dwSize, &TapeDriveParameters); + if (dwResult == NO_ERROR) { + pHandleInfo->FeaturesLow = TapeDriveParameters.FeaturesLow; + pHandleInfo->FeaturesHigh = TapeDriveParameters.FeaturesHigh; + } + + TAPE_POSITION_INFO TapePositionInfo; + + dwResult = GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo); + + if (dwResult == NO_ERROR) { + if (TapePositionInfo.AtPartitionStart || TapePositionInfo.AtPartitionEnd || + (TapePositionInfo.PartitionBlockValid && TapePositionInfo.BlockNumber == 0)) { + pHandleInfo->ulFile = 0; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } else if (TapePositionInfo.FileSetValid) { + pHandleInfo->ulFile = (ULONG)TapePositionInfo.FileNumber; + } + } + } else { + DWORD dwError = GetLastError(); + + switch (dwError) { + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: + errno = ENOENT; + break; + + case ERROR_TOO_MANY_OPEN_FILES: + errno = EMFILE; + break; + + default: + case ERROR_ACCESS_DENIED: + case ERROR_SHARING_VIOLATION: + case ERROR_LOCK_VIOLATION: + case ERROR_INVALID_NAME: + errno = EACCES; + break; + + case ERROR_FILE_EXISTS: + errno = EEXIST; + break; + + case ERROR_INVALID_PARAMETER: + errno = EINVAL; + break; + } + + return(int) -1; + } + + return (int)idxFile + 3; +} + +ssize_t win_tape_device::d_read(int fd, void *buffer, size_t count) +{ + if (buffer == NULL) { + errno = EINVAL; + return -1; + } + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + DWORD bytes_read; + BOOL bResult; + + bResult = ReadFile(pHandleInfo->OSHandle, buffer, count, &bytes_read, NULL); + + if (bResult) { + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + return bytes_read; + } else { + int iReturnValue = 0; + DWORD last_error = GetLastError(); + + switch (last_error) { + + case ERROR_FILEMARK_DETECTED: + pHandleInfo->bEOF = true; + break; + + case ERROR_END_OF_MEDIA: + pHandleInfo->bEOT = true; + break; + + case ERROR_NO_MEDIA_IN_DRIVE: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = ENOMEDIUM; + iReturnValue = -1; + break; + + case ERROR_NO_DATA_DETECTED: + pHandleInfo->bEOD = true; + break; + + case ERROR_INVALID_HANDLE: + case ERROR_ACCESS_DENIED: + case ERROR_LOCK_VIOLATION: + errno = EBADF; + iReturnValue = -1; + break; + + default: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = EIO; + iReturnValue = -1; + } + + return iReturnValue; + } +} + +ssize_t win_tape_device::d_write(int fd, const void *buffer, size_t count) +{ + if (buffer == NULL) { + errno = EINVAL; + return -1; + } + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + DWORD bytes_written; + BOOL bResult; + + bResult = WriteFile(pHandleInfo->OSHandle, buffer, count, &bytes_written, NULL); + + if (bResult) { + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + return bytes_written; + } else { + DWORD last_error = GetLastError(); + + switch (last_error) { + case ERROR_END_OF_MEDIA: + case ERROR_DISK_FULL: + pHandleInfo->bEOT = true; + errno = ENOSPC; + break; + + case ERROR_NO_MEDIA_IN_DRIVE: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = ENOMEDIUM; + break; + + case ERROR_INVALID_HANDLE: + case ERROR_ACCESS_DENIED: + errno = EBADF; + break; + + default: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = EIO; + break; + } + return -1; + } +} + +int win_tape_device::d_close(int fd) +{ + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + if (!CloseHandle(pHandleInfo->OSHandle)) { + pHandleInfo->OSHandle = INVALID_HANDLE_VALUE; + errno = EBADF; + return -1; + } + + pHandleInfo->OSHandle = INVALID_HANDLE_VALUE; + + return 0; +} + +int win_tape_device::d_ioctl(int fd, ioctl_req_t request, char *op) +{ + va_list argp; + int result; + + va_start(argp, request); + + switch (request) { + case MTIOCTOP: + result = tape_op(fd, va_arg(argp, mtop *)); + break; + + case MTIOCGET: + result = tape_get(fd, va_arg(argp, mtget *)); + break; + + case MTIOCPOS: + result = tape_pos(fd, va_arg(argp, mtpos *)); + break; + + default: + errno = ENOTTY; + result = -1; + break; + } + + va_end(argp); + + return result; +} + +int win_tape_device::tape_op(int fd, struct mtop *mt_com) +{ + DWORD result = NO_ERROR; + int index; + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + switch (mt_com->mt_op) { + case MTRESET: + case MTNOP: + case MTSETDRVBUFFER: + break; + + default: + case MTRAS1: + case MTRAS2: + case MTRAS3: + case MTSETDENSITY: + errno = ENOTTY; + result = (DWORD)-1; + break; + + case MTFSF: + for (index = 0; index < mt_com->mt_count; index++) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->ulFile++; + pHandleInfo->bEOF = true; + pHandleInfo->bEOT = false; + } + } + break; + + case MTBSF: + for (index = 0; index < mt_com->mt_count; index++) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->ulFile--; + pHandleInfo->bBlockValid = false; + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } + } + break; + + case MTFSR: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_RELATIVE_BLOCKS, 0, mt_com->mt_count, 0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } else if (result == ERROR_FILEMARK_DETECTED) { + pHandleInfo->bEOF = true; + } + break; + + case MTBSR: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_RELATIVE_BLOCKS, 0, -mt_com->mt_count, ~0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } else if (result == ERROR_FILEMARK_DETECTED) { + pHandleInfo->ulFile--; + pHandleInfo->bBlockValid = false; + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } + break; + + case MTWEOF: + result = WriteTapemark(pHandleInfo->OSHandle, TAPE_FILEMARKS, mt_com->mt_count, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOF = true; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile += mt_com->mt_count; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTREW: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_REWIND, 0, 0, 0, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile = 0; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTOFFL: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOAD, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile = 0; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTRETEN: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_TENSION, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile = 0; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTBSFM: + for (index = 0; index < mt_com->mt_count; index++) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); + if (result == NO_ERROR) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } + } + break; + + case MTFSFM: + for (index = 0; index < mt_com->mt_count; index++) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, mt_com->mt_count, 0, FALSE); + if (result == NO_ERROR) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, (DWORD)-1, ~0, FALSE); + pHandleInfo->bEOD = false; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + } + } + break; + + case MTEOM: + for ( ; ; ) { + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_FILEMARKS, 0, 1, 0, FALSE); + if (result != NO_ERROR) { + pHandleInfo->bEOF = false; + + if (result == ERROR_END_OF_MEDIA) { + pHandleInfo->bEOD = true; + pHandleInfo->bEOT = true; + return 0; + } + if (result == ERROR_NO_DATA_DETECTED) { + pHandleInfo->bEOD = true; + pHandleInfo->bEOT = false; + return 0; + } + break; + } else { + pHandleInfo->bEOF = true; + pHandleInfo->ulFile++; + } + } + break; + + case MTERASE: + result = EraseTape(pHandleInfo->OSHandle, TAPE_ERASE_LONG, FALSE); + if (result == NO_ERROR) { + pHandleInfo->bEOD = true; + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->ulFile = 0; + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = 0; + } + break; + + case MTSETBLK: + { + TAPE_SET_MEDIA_PARAMETERS SetMediaParameters; + + SetMediaParameters.BlockSize = mt_com->mt_count; + result = SetTapeParameters(pHandleInfo->OSHandle, SET_TAPE_MEDIA_INFORMATION, &SetMediaParameters); + } + break; + + case MTSEEK: + { + TAPE_POSITION_INFO TapePositionInfo; + + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, 0, mt_com->mt_count, 0, FALSE); + + memset(&TapePositionInfo, 0, sizeof(TapePositionInfo)); + DWORD dwPosResult = GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo); + if (dwPosResult == NO_ERROR && TapePositionInfo.FileSetValid) { + pHandleInfo->ulFile = (ULONG)TapePositionInfo.FileNumber; + } else { + pHandleInfo->ulFile = ~0U; + } + } + break; + + case MTTELL: + { + DWORD partition; + DWORD offset; + DWORD offsetHi; + + result = GetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, &partition, &offset, &offsetHi); + if (result == NO_ERROR) { + return offset; + } + } + break; + + case MTFSS: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_SETMARKS, 0, mt_com->mt_count, 0, FALSE); + break; + + case MTBSS: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_SPACE_SETMARKS, 0, -mt_com->mt_count, ~0, FALSE); + break; + + case MTWSM: + result = WriteTapemark(pHandleInfo->OSHandle, TAPE_SETMARKS, mt_com->mt_count, FALSE); + break; + + case MTLOCK: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_LOCK, FALSE); + break; + + case MTUNLOCK: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOCK, FALSE); + break; + + case MTLOAD: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_LOAD, FALSE); + break; + + case MTUNLOAD: + result = PrepareTape(pHandleInfo->OSHandle, TAPE_UNLOAD, FALSE); + break; + + case MTCOMPRESSION: + { + TAPE_GET_DRIVE_PARAMETERS GetDriveParameters; + TAPE_SET_DRIVE_PARAMETERS SetDriveParameters; + DWORD size; + + size = sizeof(GetDriveParameters); + + result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &size, &GetDriveParameters); + + if (result == NO_ERROR) { + SetDriveParameters.ECC = GetDriveParameters.ECC; + SetDriveParameters.Compression = (BOOLEAN)mt_com->mt_count; + SetDriveParameters.DataPadding = GetDriveParameters.DataPadding; + SetDriveParameters.ReportSetmarks = GetDriveParameters.ReportSetmarks; + SetDriveParameters.EOTWarningZoneSize = GetDriveParameters.EOTWarningZoneSize; + + result = SetTapeParameters(pHandleInfo->OSHandle, SET_TAPE_DRIVE_INFORMATION, &SetDriveParameters); + } + } + break; + + case MTSETPART: + result = SetTapePosition(pHandleInfo->OSHandle, TAPE_LOGICAL_BLOCK, mt_com->mt_count, 0, 0, FALSE); + break; + + case MTMKPART: + if (mt_com->mt_count == 0) { + result = CreateTapePartition(pHandleInfo->OSHandle, TAPE_INITIATOR_PARTITIONS, 1, 0); + } else { + result = CreateTapePartition(pHandleInfo->OSHandle, TAPE_INITIATOR_PARTITIONS, 2, mt_com->mt_count); + } + break; + } + + if ((result == NO_ERROR && pHandleInfo->bEOF) || + (result == ERROR_FILEMARK_DETECTED && mt_com->mt_op == MTFSR)) { + + TAPE_POSITION_INFO TapePositionInfo; + + if (GetTapePositionInfo(pHandleInfo->OSHandle, &TapePositionInfo) == NO_ERROR) { + pHandleInfo->bBlockValid = true; + pHandleInfo->ullFileStart = TapePositionInfo.BlockNumber; + } + } + + switch (result) { + case NO_ERROR: + case (DWORD)-1: /* Error has already been translated into errno */ + break; + + default: + case ERROR_FILEMARK_DETECTED: + errno = EIO; + break; + + case ERROR_END_OF_MEDIA: + pHandleInfo->bEOT = true; + errno = EIO; + break; + + case ERROR_NO_DATA_DETECTED: + pHandleInfo->bEOD = true; + errno = EIO; + break; + + case ERROR_NO_MEDIA_IN_DRIVE: + pHandleInfo->bEOF = false; + pHandleInfo->bEOT = false; + pHandleInfo->bEOD = false; + errno = ENOMEDIUM; + break; + + case ERROR_INVALID_HANDLE: + case ERROR_ACCESS_DENIED: + case ERROR_LOCK_VIOLATION: + errno = EBADF; + break; + } + + return result == NO_ERROR ? 0 : -1; +} + +int win_tape_device::tape_get(int fd, struct mtget *mt_get) +{ + TAPE_POSITION_INFO pos_info; + BOOL result; + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + if (GetTapePositionInfo(pHandleInfo->OSHandle, &pos_info) != NO_ERROR) { + return -1; + } + + DWORD density = 0; + DWORD blocksize = 0; + + result = GetDensityBlockSize(pHandleInfo->OSHandle, &density, &blocksize); + + if (result != NO_ERROR) { + TAPE_GET_DRIVE_PARAMETERS drive_params; + DWORD size; + + size = sizeof(drive_params); + + result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_DRIVE_INFORMATION, &size, &drive_params); + + if (result == NO_ERROR) { + blocksize = drive_params.DefaultBlockSize; + } + } + + mt_get->mt_type = MT_ISSCSI2; + + // Partition # + mt_get->mt_resid = pos_info.PartitionBlockValid ? pos_info.Partition : (ULONG)-1; + + // Density / Block Size + mt_get->mt_dsreg = ((density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK) | + ((blocksize << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK); + + mt_get->mt_gstat = 0x00010000; /* Immediate report mode.*/ + + if (pHandleInfo->bEOF) { + mt_get->mt_gstat |= 0x80000000; // GMT_EOF + } + + if (pos_info.PartitionBlockValid && pos_info.BlockNumber == 0) { + mt_get->mt_gstat |= 0x40000000; // GMT_BOT + } + + if (pHandleInfo->bEOT) { + mt_get->mt_gstat |= 0x20000000; // GMT_EOT + } + + if (pHandleInfo->bEOD) { + mt_get->mt_gstat |= 0x08000000; // GMT_EOD + } + + TAPE_GET_MEDIA_PARAMETERS media_params; + DWORD size = sizeof(media_params); + + result = GetTapeParameters(pHandleInfo->OSHandle, GET_TAPE_MEDIA_INFORMATION, &size, &media_params); + + if (result == NO_ERROR && media_params.WriteProtected) { + mt_get->mt_gstat |= 0x04000000; // GMT_WR_PROT + } + + result = GetTapeStatus(pHandleInfo->OSHandle); + + if (result != NO_ERROR) { + if (result == ERROR_NO_MEDIA_IN_DRIVE) { + mt_get->mt_gstat |= 0x00040000; // GMT_DR_OPEN + } + } else { + mt_get->mt_gstat |= 0x01000000; // GMT_ONLINE + } + + // Recovered Error Count + mt_get->mt_erreg = 0; + + // File Number + mt_get->mt_fileno = (__daddr_t)pHandleInfo->ulFile; + + // Block Number + mt_get->mt_blkno = (__daddr_t)(pHandleInfo->bBlockValid ? pos_info.BlockNumber - pHandleInfo->ullFileStart : (ULONGLONG)-1); + + return 0; +} + +#define SERVICEACTION_SHORT_FORM_BLOCKID 0 +#define SERVICEACTION_SHORT_FORM_VENDOR_SPECIFIC 1 +#define SERVICEACTION_LONG_FORM 6 +#define SERVICEACTION_EXTENDED_FORM 8 + + +typedef struct _SCSI_READ_POSITION_SHORT_BUFFER +{ + UCHAR :1; + UCHAR PERR:1; + UCHAR BPU:1; + UCHAR :1; + UCHAR BYCU:1; + UCHAR BCU:1; + UCHAR EOP:1; + UCHAR BOP:1; + UCHAR Partition; + UCHAR Reserved1[2]; + UCHAR FirstBlock[4]; + UCHAR LastBlock[4]; + UCHAR Reserved2; + UCHAR NumberBufferBlocks[3]; + UCHAR NumberBufferBytes[4]; +} SCSI_READ_POSITION_SHORT_BUFFER, *PSCSI_READ_POSITION_SHORT_BUFFER; + +typedef struct _SCSI_READ_POSITION_LONG_BUFFER +{ + UCHAR :2; + UCHAR BPU:1; + UCHAR MPU:1; + UCHAR :2; + UCHAR EOP:1; + UCHAR BOP:1; + UCHAR Reserved3[3]; + UCHAR Partition[4]; + UCHAR BlockNumber[8]; + UCHAR FileNumber[8]; + UCHAR SetNumber[8]; +} SCSI_READ_POSITION_LONG_BUFFER, *PSCSI_READ_POSITION_LONG_BUFFER; + +typedef struct _SCSI_READ_POSITION_EXTENDED_BUFFER +{ + UCHAR :1; + UCHAR PERR:1; + UCHAR LOPU:1; + UCHAR :1; + UCHAR BYCU:1; + UCHAR LOCU:1; + UCHAR EOP:1; + UCHAR BOP:1; + UCHAR Partition; + UCHAR AdditionalLength[2]; + UCHAR Reserved1; + UCHAR NumberBufferObjects[3]; + UCHAR FirstLogicalObject[8]; + UCHAR LastLogicalObject[8]; + UCHAR NumberBufferObjectBytes[8]; +} SCSI_READ_POSITION_EXTENDED_BUFFER, *PSCSI_READ_POSITION_EXTENDED_BUFFER; + +typedef union _READ_POSITION_RESULT { + SCSI_READ_POSITION_SHORT_BUFFER ShortBuffer; + SCSI_READ_POSITION_LONG_BUFFER LongBuffer; + SCSI_READ_POSITION_EXTENDED_BUFFER ExtendedBuffer; +} READ_POSITION_RESULT, *PREAD_POSITION_RESULT; + +static DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo) +{ + PSCSI_PASS_THROUGH ScsiPassThrough; + BOOL bResult; + DWORD dwBytesReturned; + + const DWORD dwBufferSize = sizeof(SCSI_PASS_THROUGH) + sizeof(READ_POSITION_RESULT) + 28; + + memset(TapePositionInfo, 0, sizeof(*TapePositionInfo)); + + ScsiPassThrough = (PSCSI_PASS_THROUGH)malloc(dwBufferSize); + + for (int pass = 0; pass < 2; pass++) + { + memset(ScsiPassThrough, 0, dwBufferSize); + + ScsiPassThrough->Length = sizeof(SCSI_PASS_THROUGH); + + ScsiPassThrough->CdbLength = 10; + ScsiPassThrough->SenseInfoLength = 28; + ScsiPassThrough->DataIn = 1; + ScsiPassThrough->DataTransferLength = sizeof(SCSI_READ_POSITION_LONG_BUFFER); + ScsiPassThrough->TimeOutValue = 1000; + ScsiPassThrough->DataBufferOffset = sizeof(SCSI_PASS_THROUGH) + 28; + ScsiPassThrough->SenseInfoOffset = sizeof(SCSI_PASS_THROUGH); + + ScsiPassThrough->Cdb[0] = 0x34; // READ POSITION + + switch (pass) + { + case 0: + ScsiPassThrough->Cdb[1] = SERVICEACTION_LONG_FORM; + break; + + case 1: + ScsiPassThrough->Cdb[1] = SERVICEACTION_SHORT_FORM_BLOCKID; + break; + } + + bResult = DeviceIoControl( hDevice, + IOCTL_SCSI_PASS_THROUGH, + ScsiPassThrough, sizeof(SCSI_PASS_THROUGH), + ScsiPassThrough, dwBufferSize, + &dwBytesReturned, + NULL); + + if (bResult && dwBytesReturned >= (offsetof(SCSI_PASS_THROUGH, ScsiStatus) + sizeof(ScsiPassThrough->ScsiStatus))) { + if (ScsiPassThrough->ScsiStatus == SCSISTAT_GOOD) { + PREAD_POSITION_RESULT pPosResult = (PREAD_POSITION_RESULT)((PUCHAR)ScsiPassThrough + ScsiPassThrough->DataBufferOffset); + + switch (pass) + { + case 0: // SERVICEACTION_LONG_FORM + { + TapePositionInfo->AtPartitionStart = pPosResult->LongBuffer.BOP; + TapePositionInfo->AtPartitionEnd = pPosResult->LongBuffer.EOP; + + if (!TapePositionInfo->PartitionBlockValid) { + TapePositionInfo->PartitionBlockValid = !pPosResult->LongBuffer.BPU; + + if (TapePositionInfo->PartitionBlockValid) { + TapePositionInfo->Partition = Read32BitUnsigned(pPosResult->LongBuffer.Partition); + TapePositionInfo->BlockNumber = Read64BitUnsigned(pPosResult->LongBuffer.BlockNumber); + } + } + + TapePositionInfo->FileSetValid = !pPosResult->LongBuffer.MPU; + if (TapePositionInfo->FileSetValid) { + TapePositionInfo->FileNumber = Read64BitUnsigned(pPosResult->LongBuffer.FileNumber); + TapePositionInfo->SetNumber = Read64BitUnsigned(pPosResult->LongBuffer.SetNumber); + } + } + break; + + case 1: // SERVICEACTION_SHORT_FORM_BLOCKID + { + // pPosResult->ShortBuffer.PERR; + // pPosResult->ShortBuffer.BYCU; + // pPosResult->ShortBuffer.BCU; + TapePositionInfo->AtPartitionStart = pPosResult->ShortBuffer.BOP; + TapePositionInfo->AtPartitionEnd = pPosResult->ShortBuffer.EOP; + + if (!TapePositionInfo->PartitionBlockValid) { + TapePositionInfo->PartitionBlockValid = !pPosResult->ShortBuffer.BPU; + + if (TapePositionInfo->PartitionBlockValid) { + TapePositionInfo->Partition = pPosResult->ShortBuffer.Partition; + TapePositionInfo->BlockNumber = Read32BitUnsigned(pPosResult->ShortBuffer.FirstBlock); + } + } + // Read32BitsUnsigned(pPosResult->ShortBuffer.LastBlock); + // Read24BitsUnsigned(pPosResult->ShortBuffer.NumberBufferBlocks); + // Read32BitsUnsigned(pPosResult->ShortBuffer.NumberBufferBytes); + } + break; + } + } + } + } + free(ScsiPassThrough); + + return NO_ERROR; +} + +static DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize) +{ + DWORD dwBufferSize = sizeof(GET_MEDIA_TYPES) + 5 * sizeof(DEVICE_MEDIA_INFO); + GET_MEDIA_TYPES * pGetMediaTypes = (GET_MEDIA_TYPES *)malloc(dwBufferSize); + BOOL bResult; + DWORD dwResult; + + if (pGetMediaTypes == NULL) { + return ERROR_OUTOFMEMORY; + } + + do { + DWORD dwBytesReturned; + + bResult = DeviceIoControl( hDevice, + IOCTL_STORAGE_GET_MEDIA_TYPES_EX, + NULL, 0, + (LPVOID)pGetMediaTypes, dwBufferSize, + &dwBytesReturned, + NULL); + + if (!bResult) { + dwResult = GetLastError(); + + if (dwResult != ERROR_INSUFFICIENT_BUFFER) { + free(pGetMediaTypes); + return dwResult; + } + + dwBufferSize += 6 * sizeof(DEVICE_MEDIA_INFO); + + GET_MEDIA_TYPES * pNewBuffer = (GET_MEDIA_TYPES *)realloc(pGetMediaTypes, dwBufferSize); + + if (pNewBuffer != pGetMediaTypes) { + free(pGetMediaTypes); + + if (pNewBuffer == NULL) { + return ERROR_OUTOFMEMORY; + } + + pGetMediaTypes = pNewBuffer; + } + } + } while (!bResult); + + if (pGetMediaTypes->DeviceType != FILE_DEVICE_TAPE) { + free(pGetMediaTypes); + return ERROR_BAD_DEVICE; + } + + for (DWORD idxMedia = 0; idxMedia < pGetMediaTypes->MediaInfoCount; idxMedia++) { + + if (pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.MediaCharacteristics & MEDIA_CURRENTLY_MOUNTED) { + + if (pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.BusType == BusTypeScsi) { + *pdwDensity = pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.BusSpecificData.ScsiInformation.DensityCode; + } else { + *pdwDensity = 0; + } + + *pdwBlockSize = pGetMediaTypes->MediaInfo[idxMedia].DeviceSpecific.TapeInfo.CurrentBlockSize; + + free(pGetMediaTypes); + + return NO_ERROR; + } + } + + free(pGetMediaTypes); + + return ERROR_NO_MEDIA_IN_DRIVE; +} + +int win_tape_device::tape_pos(int fd, struct mtpos *mt_pos) +{ + DWORD partition; + DWORD offset; + DWORD offsetHi; + BOOL result; + + if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || + TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { + errno = EBADF; + return -1; + } + + PTAPE_HANDLE_INFO pHandleInfo = &TapeHandleTable[fd - 3]; + + result = GetTapePosition(pHandleInfo->OSHandle, TAPE_ABSOLUTE_BLOCK, &partition, &offset, &offsetHi); + if (result == NO_ERROR) { + mt_pos->mt_blkno = offset; + return 0; + } + + return -1; +} diff --git a/bacula/src/win32/tools/Makefile b/bacula/src/win32/tools/Makefile new file mode 100644 index 0000000000..a5757123ac --- /dev/null +++ b/bacula/src/win32/tools/Makefile @@ -0,0 +1,107 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written by Robert Nelson, June 2006 +# + +include ../Makefile.inc + +INCLUDES = \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ZLIB) \ + $(INCLUDE_OPENSSL) \ + $(INCLUDE_ICONS) + +DEFINES = \ + -DUSING_DLL \ + -DUSING_CATS \ + $(HAVES) + +LDFLAGS:=$(LDFLAGS) -lstdc++ + +vpath %.c $(MAINDIR)/src/tools $(MAINDIR)/src/dird +vpath %.cpp $(MAINDIR)/src/tools $(MAINDIR)/src/dird + +########################################################################## + +DIRCONF_OBJS = \ + $(OBJDIR)/dird_conf.o \ + $(OBJDIR)/run_conf.o \ + $(OBJDIR)/inc_conf.o + +ALL_OBJS = \ + $(DIRCONF_OBJS) \ + $(OBJDIR)/bsmtp.o \ + $(OBJDIR)/dbcheck.o \ + $(OBJDIR)/scsilist.o \ + $(OBJDIR)/ScsiDeviceList.o \ + $(OBJDIR)/fstype.o \ + $(OBJDIR)/drivetype.o \ + $(OBJDIR)/testfind.o \ + $(OBJDIR)/testls.o \ + $(OBJDIR)/bregex.o \ + $(OBJDIR)/bwild.o + +########################################################################## + +# Targets + +.PHONY: all clean bsmtp + +all: \ + $(BINDIR)/bsmtp.exe $(BINDIR)/dbcheck.exe $(BINDIR)/scsilist.exe \ + $(BINDIR)/drivetype.exe $(BINDIR)/fstype.exe \ + $(BINDIR)/testfind.exe $(BINDIR)/testls.exe \ + $(BINDIR)/bregex.exe $(BINDIR)/bwild.exe + +bsmtp: \ + $(BINDIR)/bsmtp.exe + +clean: + @echo "Cleaning `pwd`" + $(call clean_obj,$(ALL_OBJS)) + $(call clean_exe,$(BINDIR)/bsmtp.exe) + $(call clean_exe,$(BINDIR)/dbcheck.exe) + $(call clean_exe,$(BINDIR)/scsilist.exe) + $(call clean_exe,$(BINDIR)/drivetype.exe) + $(call clean_exe,$(BINDIR)/fstype.exe) + $(call clean_exe,$(BINDIR)/testfind.exe) + $(call clean_exe,$(BINDIR)/testls.exe) + $(call clean_exe,$(BINDIR)/bregex.exe) + $(call clean_exe,$(BINDIR)/bwild.exe) + $(ECHO_CMD)rm -rf $(OBJDIRS) + +# +# Rules +# + +$(BINDIR)/bsmtp.exe: $(OBJDIR)/bsmtp.o $(LIBS_BACULA) + $(call link_conapp,-lws2_32) + +$(BINDIR)/dbcheck.exe: $(OBJDIR)/dbcheck.o $(DIRCONF_OBJS) $(LIBS_BACULA) $(LIBS_CATS) + $(call link_conapp,) + +$(BINDIR)/scsilist.exe: $(OBJDIR)/scsilist.o $(OBJDIR)/ScsiDeviceList.o $(LIBS_BACULA) + $(call link_conapp,) + +$(BINDIR)/drivetype.exe: $(OBJDIR)/drivetype.o $(LIBS_BACULA) + $(call link_conapp,) + +$(BINDIR)/fstype.exe: $(OBJDIR)/fstype.o $(LIBS_BACULA) + $(call link_conapp,) + +$(BINDIR)/testfind.exe: $(OBJDIR)/testfind.o $(DIRCONF_OBJS) $(LIBS_BACULA) + $(call link_conapp,) + +$(BINDIR)/testls.exe: $(OBJDIR)/testls.o $(LIBS_BACULA) + $(call link_conapp,) + +$(BINDIR)/bregex.exe: $(OBJDIR)/bregex.o $(LIBS_BACULA) + $(call link_conapp,) + +$(BINDIR)/bwild.exe: $(OBJDIR)/bwild.o $(LIBS_BACULA) + $(call link_conapp,) + +include ../Makefile.rules diff --git a/bacula/src/win32/tools/ScsiDeviceList.cpp b/bacula/src/win32/tools/ScsiDeviceList.cpp new file mode 100644 index 0000000000..fcaecba2f3 --- /dev/null +++ b/bacula/src/win32/tools/ScsiDeviceList.cpp @@ -0,0 +1,363 @@ +/* + * ScsiDeviceList.cpp - Class which provides information on installed devices. + * + * Author: Robert Nelson, August, 2006 + * + * Version $Id$ + * + * This file was contributed to the Bacula project by Robert Nelson. + * + * Robert Nelson has been granted a perpetual, worldwide, + * non-exclusive, no-charge, royalty-free, irrevocable copyright + * license to reproduce, prepare derivative works of, publicly + * display, publicly perform, sublicense, and distribute the original + * work contributed by Robert Nelson to the Bacula project in source + * or object form. + * + * If you wish to license contributions from Robert Nelson + * under an alternate open source license please contact + * Robert Nelson . + */ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2006-2006 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +#if defined(_MSC_VER) && defined(_DEBUG) +#include +#else +#include +#endif + +#include +#include + +#include "ScsiDeviceList.h" + +#if defined(_MSC_VER) && defined(_DEBUG) +#define new DEBUG_NEW +#endif + +TCHAR CScsiDeviceList::c_ScsiPath[] = _T("HARDWARE\\DEVICEMAP\\Scsi"); + +LPCTSTR CScsiDeviceList::c_lpszFormatList[] = +{ + _T("Logical Unit Id %d"), + _T("Target Id %d"), + _T("Scsi Bus %d"), + _T("Scsi Port %d") +}; + +LPCTSTR CScsiDeviceListEntry::c_DeviceTypes[] = +{ + _T("Unknown"), + _T("CDRom"), + _T("Changer"), + _T("Disk"), + _T("Tape") +}; + +CScsiDeviceListEntry::CScsiDeviceListEntry(const CScsiDeviceListEntry &other) +{ + m_eDeviceType = other.m_eDeviceType; + + m_lpszIdentifier = other.m_lpszIdentifier != NULL ? _tcsdup(other.m_lpszIdentifier) : NULL; + + m_lpszDeviceName = other.m_lpszDeviceName != NULL ? _tcsdup(other.m_lpszDeviceName) : NULL; + + m_dwDeviceId = other.m_dwDeviceId; + _tcscpy(m_szDevicePath, other.m_szDevicePath); +} + +CScsiDeviceListEntry::CScsiDeviceListEntry(void) +{ + m_eDeviceType = Unknown; + m_lpszIdentifier = NULL; + m_lpszDeviceName = NULL; + m_dwDeviceId = 0; + m_szDevicePath[0] = _T('\0'); +} + +CScsiDeviceListEntry::~CScsiDeviceListEntry(void) +{ + if (m_lpszIdentifier != NULL) + { + free(m_lpszIdentifier); + } + + if (m_lpszDeviceName != NULL) + { + free(m_lpszDeviceName); + } +} + +bool +CScsiDeviceList::Populate() +{ + this->clear(); + + HKEY hScsiKey; + + _tcscpy(m_szLastKey, _T("\\Scsi")); + m_dwLastKeyLength = 5; + + m_lLastError = RegOpenKeyEx( HKEY_LOCAL_MACHINE, + c_ScsiPath, + 0, + KEY_READ, + &hScsiKey); + + if (m_lLastError != ERROR_SUCCESS) { + _tcscpy(m_szLastOperation, _T("Opening key ")); + _tcscpy(m_szLastKey, c_ScsiPath); + return false; + } + + if (!ProcessKey(hScsiKey, c_MaxKeyDepth - 1, 0)) { + return false; + } + +#if defined(_DEBUG) + _fputtc(_T('\n'), stderr); +#endif + + return true; +} + +bool +CScsiDeviceList::ProcessKey(HKEY hKey, int iLevel, DWORD dwDeviceId) +{ +#if defined(_DEBUG) + switch (iLevel) + { + case 3: + _ftprintf( stderr, + _T("%-64s\n"), + &m_szLastKey[1]); + break; + + case 2: + _ftprintf( stderr, + _T("%-64s%d\n"), + &m_szLastKey[1], + dwDeviceId & 0xFF); + break; + + case 1: + _ftprintf( stderr, + _T("%-64s%d:%d\n"), + &m_szLastKey[1], + (dwDeviceId >> 8) & 0xFF, + dwDeviceId & 0xFF); + break; + + case 0: + _ftprintf( stderr, + _T("%-64s%d:%d:%d\n"), + &m_szLastKey[1], + (dwDeviceId >> 16) & 0xFF, + (dwDeviceId >> 8) & 0xFF, + dwDeviceId & 0xFF); + break; + } +#endif + + for (int idxSubkey = 0; ; idxSubkey++) { + + TCHAR szSubkeyName[c_MaxSubkeyLength + 1]; + DWORD dwLength; + + dwLength = sizeof(szSubkeyName); + + m_lLastError = RegEnumKeyEx( hKey, + idxSubkey, + szSubkeyName, + &dwLength, + NULL, + NULL, + NULL, + NULL); + + if (m_lLastError == ERROR_NO_MORE_ITEMS) { + break; + } else if (m_lLastError == ERROR_MORE_DATA) { +#if defined(_DEBUG) + _tcscpy(m_szLastOperation, _T("Enumerating subkeys of ")); + PrintLastError(); +#endif + // Subkey name is too long + continue; + } else if (m_lLastError != ERROR_SUCCESS) { + // Unexpected Error + _tcscpy(m_szLastOperation, _T("Enumerating subkeys of ")); + return false; + } + + int iValue; + + if (_stscanf(szSubkeyName, c_lpszFormatList[iLevel], &iValue) != 1) { + // Ignore this subkey, it is probably Initiator Id n + continue; + } + + m_szLastKey[m_dwLastKeyLength++] = _T('\\'); + + DWORD dwSubkeyLength = (DWORD)_tcslen(szSubkeyName); + memcpy(&m_szLastKey[m_dwLastKeyLength], szSubkeyName, (dwSubkeyLength + 1) * sizeof(TCHAR)); + m_dwLastKeyLength += dwSubkeyLength; + + HKEY hSubkey; + + m_lLastError = RegOpenKeyEx(hKey, szSubkeyName, 0, KEY_READ, &hSubkey); + + if (m_lLastError != ERROR_SUCCESS) { + _tcscpy(m_szLastOperation, _T("Opening key ")); + return false; + } + + if (iLevel == 0) { +#if defined(_DEBUG) + _ftprintf( stderr, + _T("%-64s%d:%d:%d:%d\n"), + &m_szLastKey[1], + (dwDeviceId >> 16) & 0xFF, + (dwDeviceId >> 8) & 0xFF, + dwDeviceId & 0xFF, + iValue); +#endif + + ProcessValues(hSubkey, (dwDeviceId << 8) | iValue); + } else { + if (!ProcessKey(hSubkey, iLevel - 1, (dwDeviceId << 8) | iValue)) { + return false; + } + } + + m_dwLastKeyLength -= dwSubkeyLength; + m_dwLastKeyLength--; + m_szLastKey[m_dwLastKeyLength] = _T('\0'); + } + + return true; +} + +bool +CScsiDeviceList::ProcessValues(HKEY hKey, DWORD dwDeviceId) +{ + CScsiDeviceListEntry EntryTemplate; + DWORD dwType; + DWORD dwSize; + TCHAR szValue[c_MaxValueLength + 1]; + + this->push_back(EntryTemplate); + CScsiDeviceListEntry & entry = this->back(); + + dwSize = sizeof(szValue); + + m_lLastError = RegQueryValueEx( hKey, + _T("Identifier"), + NULL, + &dwType, + (LPBYTE)&szValue[0], + &dwSize); + + if (m_lLastError == ERROR_SUCCESS) { + entry.m_lpszIdentifier = _tcsdup(szValue); + } else { +#if defined(_DEBUG) + _tcscpy(m_szLastOperation, _T("Reading value ")); + PrintLastError(_T("Identifier")); +#endif + } + + dwSize = sizeof(szValue); + + m_lLastError = RegQueryValueEx( hKey, + _T("DeviceName"), + NULL, + &dwType, + (LPBYTE)&szValue[0], + &dwSize); + + if (m_lLastError == ERROR_SUCCESS) { + entry.m_lpszDeviceName = _tcsdup(szValue); + } else { +#if defined(_DEBUG) + _tcscpy(m_szLastOperation, _T("Reading value ")); + PrintLastError(_T("DeviceName")); +#endif + } + + dwSize = sizeof(szValue); + + m_lLastError = RegQueryValueEx( hKey, + _T("Type"), + NULL, + &dwType, + (LPBYTE)&szValue[0], + &dwSize); + + if (m_lLastError == ERROR_SUCCESS) { + if (_tcscmp(_T("CdRomPeripheral"), szValue) == 0) { + entry.m_eDeviceType = CScsiDeviceListEntry::CDRom; + } else if (_tcscmp(_T("DiskPeripheral"), szValue) == 0) { + entry.m_eDeviceType = CScsiDeviceListEntry::Disk; + } else if (_tcscmp(_T("MediumChangerPeripheral"), szValue) == 0) { + entry.m_eDeviceType = CScsiDeviceListEntry::Changer; + } else if (_tcscmp(_T("TapePeripheral"), szValue) == 0) { + entry.m_eDeviceType = CScsiDeviceListEntry::Tape; + } + } else { +#if defined(_DEBUG) + _tcscpy(m_szLastOperation, _T("Reading value ")); + PrintLastError(_T("Type")); +#endif + } + + entry.m_dwDeviceId = dwDeviceId; + + return true; +} + +void +CScsiDeviceList::PrintLastError(LPTSTR lpszName) +{ + LPTSTR lpszMessage = NULL; + + _fputts(_T("Error: "), stderr); + _fputts(m_szLastOperation, stderr); + _fputtc(_T('"'), stderr); + _fputts(lpszName != NULL ? lpszName : m_szLastKey, stderr); + _fputts(_T("\" - "), stderr); + + FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, m_lLastError, 0, (LPTSTR)&lpszMessage, 0, NULL); + + if (lpszMessage != NULL) { + _fputts(lpszMessage, stderr); + LocalFree(lpszMessage); + } +} diff --git a/bacula/src/win32/tools/ScsiDeviceList.h b/bacula/src/win32/tools/ScsiDeviceList.h new file mode 100644 index 0000000000..ce88981ae0 --- /dev/null +++ b/bacula/src/win32/tools/ScsiDeviceList.h @@ -0,0 +1,169 @@ +/* + * ScsiDeviceList.cpp - Class which provides information on installed devices. + * + * Author: Robert Nelson, August, 2006 + * + * Version $Id$ + * + * This file was contributed to the Bacula project by Robert Nelson. + * + * Robert Nelson has been granted a perpetual, worldwide, + * non-exclusive, no-charge, royalty-free, irrevocable copyright + * license to reproduce, prepare derivative works of, publicly + * display, publicly perform, sublicense, and distribute the original + * work contributed by Robert Nelson to the Bacula project in source + * or object form. + * + * If you wish to license contributions from Robert Nelson + * under an alternate open source license please contact + * Robert Nelson . + */ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2006-2006 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +#pragma once +#include "vector" + +class CScsiDeviceListEntry +{ + friend class CScsiDeviceList; + + static LPCTSTR c_DeviceTypes[]; + static const int c_MaxDevicePathLength = 16; // :255:255:255:255 + +public: + enum DeviceType { Unknown, CDRom, Changer, Disk, Tape }; + + CScsiDeviceListEntry(void); + CScsiDeviceListEntry(const CScsiDeviceListEntry &other); + ~CScsiDeviceListEntry(void); + + inline CScsiDeviceListEntry &operator =(const CScsiDeviceListEntry &other); + + inline DeviceType GetType() { return m_eDeviceType; } + inline LPCTSTR GetTypeName() { return c_DeviceTypes[m_eDeviceType]; } + inline LPCTSTR GetIdentifier() { return m_lpszIdentifier != NULL ? m_lpszIdentifier : _T(""); } + inline LPCTSTR GetDeviceName() { return m_lpszDeviceName != NULL ? m_lpszDeviceName : _T(""); } + inline LPCTSTR GetDevicePath(); + +private: + DeviceType m_eDeviceType; + LPTSTR m_lpszIdentifier; + LPTSTR m_lpszDeviceName; + DWORD m_dwDeviceId; + TCHAR m_szDevicePath[c_MaxDevicePathLength + 1]; +}; + +CScsiDeviceListEntry & +CScsiDeviceListEntry::operator =(const CScsiDeviceListEntry &other) +{ + m_eDeviceType = other.m_eDeviceType; + + if (m_lpszIdentifier != NULL) + { + free(m_lpszIdentifier); + } + m_lpszIdentifier = other.m_lpszIdentifier != NULL ? _tcsdup(other.m_lpszIdentifier) : NULL; + + if (m_lpszDeviceName != NULL) + { + free(m_lpszDeviceName); + } + m_lpszDeviceName = other.m_lpszDeviceName != NULL ? _tcsdup(other.m_lpszDeviceName) : NULL; + + m_dwDeviceId = other.m_dwDeviceId; + _tcscpy(m_szDevicePath, other.m_szDevicePath); + + return *this; +} + +LPCTSTR +CScsiDeviceListEntry::GetDevicePath() +{ + if (m_szDevicePath[0] == _T('\0')) + { + _sntprintf( m_szDevicePath, c_MaxDevicePathLength, + _T("%d:%d:%d:%d"), + (m_dwDeviceId >> 24) & 0xFF, + (m_dwDeviceId >> 16) & 0xFF, + (m_dwDeviceId >> 8) & 0xFF, + m_dwDeviceId & 0xFF); + m_szDevicePath[c_MaxDevicePathLength] = _T('\0'); + } + + return m_szDevicePath; +} + +class CScsiDeviceList : + public std::vector +{ + static TCHAR c_ScsiPath[]; + static LPCTSTR c_lpszFormatList[]; + +// \\Scsi\\Scsi Port 255\\Scsi Bus 255\\Target Id 255\\Logical Unit Id 255 +// 1 4 1 13 1 12 1 13 1 19 = 66 + static const int c_MaxKeyPathLength = 66; + +// Logical Unit Id 255 + static const int c_MaxSubkeyLength = 19; + +// Identifier = 28, DeviceName = 10+, Type = 23 + static const int c_MaxValueLength = 30; + +// Adapter \\ Bus \\ Target \\ LUN + static const int c_MaxKeyDepth = 4; + +public: + inline CScsiDeviceList(void); + inline ~CScsiDeviceList(void); + + bool Populate(); + void PrintLastError(LPTSTR lpszName = NULL); + +protected: + bool ProcessKey(HKEY hKey, int iLevel, DWORD dwDeviceId); + bool ProcessValues(HKEY hKey, DWORD dwDeviceId); + +private: + TCHAR m_szLastOperation[80 + 1]; // Max length "Enumerating subkeys of " + TCHAR m_szLastKey[c_MaxKeyPathLength + 1]; + DWORD m_dwLastKeyLength; + LONG m_lLastError; +}; + +CScsiDeviceList::CScsiDeviceList(void) +{ + m_szLastOperation[0] = _T('\0'); + m_szLastKey[0] = _T('\0'); + m_dwLastKeyLength = 0; + m_lLastError = 0; +} + +CScsiDeviceList::~CScsiDeviceList(void) +{ +} diff --git a/bacula/src/win32/tools/bsmtp/bsmtp.vcproj b/bacula/src/win32/tools/bsmtp/bsmtp.vcproj new file mode 100644 index 0000000000..97fb96b124 --- /dev/null +++ b/bacula/src/win32/tools/bsmtp/bsmtp.vcproj @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/tools/dbcheck/dbcheck.vcproj b/bacula/src/win32/tools/dbcheck/dbcheck.vcproj new file mode 100644 index 0000000000..d847d39e6b --- /dev/null +++ b/bacula/src/win32/tools/dbcheck/dbcheck.vcproj @@ -0,0 +1,293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/tools/drivetype/drivetype.vcproj b/bacula/src/win32/tools/drivetype/drivetype.vcproj new file mode 100644 index 0000000000..cbd8568d7f --- /dev/null +++ b/bacula/src/win32/tools/drivetype/drivetype.vcproj @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/tools/fstype/fstype.vcproj b/bacula/src/win32/tools/fstype/fstype.vcproj new file mode 100644 index 0000000000..6a52b0f0dd --- /dev/null +++ b/bacula/src/win32/tools/fstype/fstype.vcproj @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/tools/scsilist.cpp b/bacula/src/win32/tools/scsilist.cpp new file mode 100644 index 0000000000..7b9f3ecfed --- /dev/null +++ b/bacula/src/win32/tools/scsilist.cpp @@ -0,0 +1,119 @@ +/* + * scsilist.cpp - Outputs the contents of a ScsiDeviceList. + * + * Author: Robert Nelson, August, 2006 + * + * Version $Id$ + * + * This file was contributed to the Bacula project by Robert Nelson. + * + * Robert Nelson has been granted a perpetual, worldwide, + * non-exclusive, no-charge, royalty-free, irrevocable copyright + * license to reproduce, prepare derivative works of, publicly + * display, publicly perform, sublicense, and distribute the original + * work contributed by Robert Nelson to the Bacula project in source + * or object form. + * + * If you wish to license contributions from Robert Nelson + * under an alternate open source license please contact + * Robert Nelson . + */ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2006-2006 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +#if defined(_MSC_VER) && defined(_DEBUG) +#include +#else +#include +#endif + +#include +#include +#include + +#include "ScsiDeviceList.h" + +#if defined(_MSC_VER) && defined(_DEBUG) +#define new DEBUG_NEW +#endif + +int _tmain(int argc, _TCHAR* argv[]) +{ +#if defined(_MSC_VER) && defined(_DEBUG) + CMemoryState InitialMemState, FinalMemState, DiffMemState; + + InitialMemState.Checkpoint(); + + { +#endif + + CScsiDeviceList DeviceList; + + if (!DeviceList.Populate()) + { + DeviceList.PrintLastError(); + return 1; + } + +#define HEADING \ + _T("Device Type Physical Name\n") \ + _T("====== ==== ======== ====\n") + + _fputts(HEADING, stdout); + + for (DWORD index = 0; index < DeviceList.size(); index++) { + + CScsiDeviceListEntry &entry = DeviceList[index]; + + if (entry.GetType() != CScsiDeviceListEntry::Disk) { + + _tprintf(_T("%-28s %-7s %-11s %-27s\n"), + entry.GetIdentifier(), + entry.GetTypeName(), + entry.GetDevicePath(), + entry.GetDeviceName()); + } + } + +#if defined(_MSC_VER) && defined(_DEBUG) + } + + InitialMemState.DumpAllObjectsSince(); + + FinalMemState.Checkpoint(); + DiffMemState.Difference(InitialMemState, FinalMemState); + DiffMemState.DumpStatistics(); +#endif + + if (argc > 1 && _tcsnicmp(argv[1], _T("/pause"), sizeof(_T("/pause")) - sizeof(TCHAR)) == 0) { + _fputts(_T("\nPress any key to continue\n"), stderr); + _getch(); + } + + return 0; +} diff --git a/bacula/src/win32/tools/scsilist/scsilist.vcproj b/bacula/src/win32/tools/scsilist/scsilist.vcproj new file mode 100644 index 0000000000..3afa5ca31d --- /dev/null +++ b/bacula/src/win32/tools/scsilist/scsilist.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/tools/testfind/testfind.vcproj b/bacula/src/win32/tools/testfind/testfind.vcproj new file mode 100644 index 0000000000..e94d458740 --- /dev/null +++ b/bacula/src/win32/tools/testfind/testfind.vcproj @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/tools/testls/testls.vcproj b/bacula/src/win32/tools/testls/testls.vcproj new file mode 100644 index 0000000000..a56303cbc6 --- /dev/null +++ b/bacula/src/win32/tools/testls/testls.vcproj @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/win32_installer/ConfigPage1.nsh b/bacula/src/win32/win32_installer/ConfigPage1.nsh new file mode 100644 index 0000000000..2a16fb55fe --- /dev/null +++ b/bacula/src/win32/win32_installer/ConfigPage1.nsh @@ -0,0 +1,294 @@ +Function EnterConfigPage1 + ${If} $AutomaticInstall = 1 + Abort + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsFileAndStorage} + + ${If} $R0 = 0 + Abort + ${EndIf} + + FileOpen $R5 "$PLUGINSDIR\ConfigPage1.ini" w + + StrCpy $R6 1 ; Field Number + StrCpy $R7 0 ; Top + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 52 + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Client"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigClientName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigClientPort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigClientMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigClientPassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigClientInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigClientStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 52 + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Storage"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigStorageName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigStoragePort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigStorageMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigStoragePassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigStorageInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigStorageStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + ${Endif} + + IntOp $R6 $R6 - 1 + + FileWrite $R5 "[Settings]$\r$\nNumFields=$R6$\r$\n" + + FileClose $R5 + + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage1)" "$(SUBTITLE_ConfigPage1)" + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ConfigPage1.ini" + Pop $HDLG ;HWND of dialog + + ; Initialize Controls + + StrCpy $R6 1 ; Field Number + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + + ; Client Name + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + + IntOp $R6 $R6 + 2 + + ; Client Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + + IntOp $R6 $R6 + 2 + + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 5 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + + ; Storage Name + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + + IntOp $R6 $R6 + 2 + + ; Storage Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + + IntOp $R6 $R6 + 2 + + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 5 + ${Endif} + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process results + + StrCpy $R6 3 + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientName "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPort "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientMaxJobs "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPassword "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientInstallService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientStartService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 3 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageName "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStoragePort "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageMaxJobs "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStoragePassword "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageInstallService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageStartService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 3 + ${Endif} +FunctionEnd + +Function LeaveConfigPage1 + StrCpy $R6 5 + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 9 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 9 + ${Endif} +FunctionEnd diff --git a/bacula/src/win32/win32_installer/ConfigPage2.nsh b/bacula/src/win32/win32_installer/ConfigPage2.nsh new file mode 100644 index 0000000000..d1cafb1fed --- /dev/null +++ b/bacula/src/win32/win32_installer/ConfigPage2.nsh @@ -0,0 +1,454 @@ +Function EnterConfigPage2 + IntOp $R0 $NewComponents & ${ComponentsRequiringUserConfig} + + ${If} $R0 = 0 + Abort + ${EndIf} + + FileOpen $R5 "$PLUGINSDIR\ConfigPage2.ini" w + + StrCpy $R6 1 ; Field Number + StrCpy $R7 0 ; Top + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + ${If} $AutomaticInstall = 1 + IntOp $R8 $R7 + 54 + ${Else} + IntOp $R8 $R7 + 92 + ${EndIf} + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Director"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 54 + ${Else} + IntOp $R8 $R7 + 26 + ${EndIf} + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Enter Director Information"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + ${EndIf} + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + ${If} "$ConfigDirectorName" == "" + StrCpy $ConfigDirectorName "$HostName-dir" + ${EndIf} + ${If} "$ConfigDirectorPassword" == "" + StrCpy $ConfigDirectorPassword "$LocalDirectorPassword" + ${EndIf} + ${Else} + ${If} "$ConfigDirectorName" == "$HostName-dir" + StrCpy $ConfigDirectorName "" + ${EndIf} + ${If} "$ConfigDirectorPassword" == "$LocalDirectorPassword" + StrCpy $ConfigDirectorPassword "" + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="DIR Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=60$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorName$\r$\nLeft=60$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="DIR Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigDirectorPort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigDirectorMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + IntOp $R7 $R7 + 14 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="DIR Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=60$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorPassword$\r$\nLeft=60$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Mail Server"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=48$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorMailServer$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Mail Address"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=48$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorMailAddress$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Database"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + ${If} $ConfigDirectorDB = 0 + ${If} $MySQLPath != "" + StrCpy $ConfigDirectorDB 1 + ${ElseIf} $PostgreSQLPath != "" + StrCpy $ConfigDirectorDB 2 + ${Else} + StrCpy $ConfigDirectorDB 3 + ${EndIf} + ${EndIf} + + ${If} $ConfigDirectorDB = 1 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="MySQL"$\r$\nFlags="GROUP"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=90$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + + ${If} $ConfigDirectorDB = 2 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="PostgreSQL"$\r$\nFlags="NOTABSTOP"$\r$\nLeft=94$\r$\nTop=$R7$\r$\nRight=146$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + + ${If} $ConfigDirectorDB = 3 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="Sqlite"$\r$\nFlags="NOTABSTOP"$\r$\nLeft=150$\r$\nTop=$R7$\r$\nRight=182$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + ${If} $AutomaticInstall = 0 + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigDirectorInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigDirectorStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="DIR Address"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=60$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorAddress$\r$\nLeft=60$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + IntOp $R8 $R7 + 8 + ${EndIf} + ${EndIf} + + IntOp $R7 $R7 + 4 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 42 + + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Monitor"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigMonitorName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=150$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigMonitorPassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 20 + ${EndIf} + ${EndIf} + + IntOp $R6 $R6 - 1 + FileWrite $R5 "[Settings]$\r$\nNumFields=$R6$\r$\n" + + FileClose $R5 + + IntOp $R0 $NewComponents & ${ComponentsFileAndStorage} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 1 + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage1)" "$(SUBTITLE_ConfigPage1)" + ${Else} + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage2)" "$(SUBTITLE_ConfigPage2)" + ${EndIf} + + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ConfigPage2.ini" + Pop $HDLG ;HWND of dialog + + ; Initialize Controls + StrCpy $R6 2 ; Field Number + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + ; Name + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + ; Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 9 + + ${If} $AutomaticInstall = 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process results + + StrCpy $R6 2 + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorName "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorPort "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMaxJobs "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorPassword "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMailServer "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMailAddress "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 1 + ${Endif} + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 2 + ${Endif} + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 3 + ${Endif} + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorInstallService "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorStartService "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorAddress "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMonitorName "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMonitorPassword "ConfigPage2.ini" "Field $R6" "State" + ${EndIf} + ${EndIf} +FunctionEnd + +Function LeaveConfigPage2 + ${If} $AutomaticInstall = 0 + StrCpy $R6 4 + + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} +FunctionEnd diff --git a/bacula/src/win32/win32_installer/DumpLog.nsh b/bacula/src/win32/win32_installer/DumpLog.nsh new file mode 100644 index 0000000000..064a370076 --- /dev/null +++ b/bacula/src/win32/win32_installer/DumpLog.nsh @@ -0,0 +1,48 @@ +!ifndef LVM_GETITEMCOUNT + !define LVM_GETITEMCOUNT 0x1004 +!endif +!define LVM_GETITEMTEXT 0x102D + +Function DumpLog + Exch $5 + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $6 + + FindWindow $0 "#32770" "" $HWNDPARENT + GetDlgItem $0 $0 1016 + StrCmp $0 0 error + FileOpen $5 $5 "w" + StrCmp $5 0 error + SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6 + System::Alloc ${NSIS_MAX_STRLEN} + Pop $3 + StrCpy $2 0 + System::Call "*(i, i, i, i, i, i, i, i, i) i \ + (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1" + loop: StrCmp $2 $6 done + System::Call "User32::SendMessageA(i, i, i, i) i \ + ($0, ${LVM_GETITEMTEXT}, $2, r1)" + System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)" + FileWrite $5 "$4$\r$\n" + IntOp $2 $2 + 1 + Goto loop + done: + FileClose $5 + System::Free $1 + System::Free $3 + Goto exit + error: + MessageBox MB_OK error + exit: + Pop $6 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + Exch $5 +FunctionEnd diff --git a/bacula/src/win32/win32_installer/InstallType.ini b/bacula/src/win32/win32_installer/InstallType.ini new file mode 100644 index 0000000000..73fb8d9390 --- /dev/null +++ b/bacula/src/win32/win32_installer/InstallType.ini @@ -0,0 +1,56 @@ +; +; Note: certain text in this file is overwritten by the code in +; InstallType.nsh +; + +[Settings] +NumFields=6 + +[Field 1] +Type=Label +Text=This is a new installation. Please choose the installation type. +Left=0 +Right=300 +Top=0 +Bottom=28 + +[Field 2] +Type=GroupBox +Text=Installation Type +Left=0 +Right=300 +Top=32 +Bottom=136 + +[Field 3] +Type=RadioButton +Text=Automatic +State=1 +Left=6 +Right=52 +Top=44 +Bottom=54 + +[Field 4] +Type=RadioButton +Text=Custom (not recommended) +Left=6 +Right=252 +Top=90 +Bottom=100 + +[Field 5] +Type=Label +Text=The software will be installed in the default directory "Program Files\\Bacula". The configuration files will be generated using defaults applicable to most installations. +Left=17 +Right=295 +Top=58 +Bottom=86 + +[Field 6] +Type=Label +Text=You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work. +Left=17 +Right=295 +Top=104 +Bottom=132 diff --git a/bacula/src/win32/win32_installer/InstallType.nsh b/bacula/src/win32/win32_installer/InstallType.nsh new file mode 100644 index 0000000000..e4a9711df7 --- /dev/null +++ b/bacula/src/win32/win32_installer/InstallType.nsh @@ -0,0 +1,93 @@ +Function EnterInstallType + Push $R0 + Push $R1 + Push $R2 + + ; Check if this is an upgrade by looking for an uninstaller configured + ; in the registry. + ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" + + ${If} "$R0" != "" + ; Check registry for new installer + ReadRegStr $R1 HKLM "Software\Bacula" "InstallLocation" + ${If} "$R1" != "" + ; New Installer + StrCpy $OldInstallDir $R1 + StrCpy $InstallType ${UpgradeInstall} + + SetShellVarContext all + + StrCpy $R1 "$APPDATA\Bacula" + StrCpy $R2 "$INSTDIR\Doc" + + ReadRegDWORD $PreviousComponents HKLM "Software\Bacula" "Components" + + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "A previous installation has been found in $OldInstallDir. Please choose the installation type for any additional components you select." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The configuration files for additional components will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + + ReadRegDWORD $ConfigDirectorDB HKLM Software\Bacula Database + + ${If} $ConfigDirectorDB = 0 + IntOp $R0 $PreviousComponents & ${ComponentDirector} + ${If} $R0 <> 0 + StrCpy $ConfigDirectorDB 1 + ${EndIf} + ${EndIf} + ${Else} + ; Processing Upgrade - Get Install Directory + ${StrRep} $R0 $R0 '"' '' + ${GetParent} $R0 $OldInstallDir + + ; Old Installer + StrCpy $InstallType ${MigrateInstall} + StrCpy $R1 "$OldInstallDir\bin" + StrCpy $R2 "$OldInstallDir\Doc" + + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "An old installation has been found in $OldInstallDir. The Configuration will be migrated. Please choose the installation type for any additional components you select." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"C:\Program Files\Bacula$\". The configuration files for additional components will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + ${EndIf} + ${Else} + ; New Install + StrCpy $InstallType ${NewInstall} + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"C:\Program Files\Bacula$\". The configuration files will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + ${EndIf} + + ${If} $InstallType <> ${NewInstall} + ${AndIf} $PreviousComponents = 0 + ${If} ${FileExists} "$R1\bacula-fd.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentFile} + ${EndIf} + ${If} ${FileExists} "$R1\bconsole.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole} + ${EndIf} + ${If} ${FileExists} "$R1\bat.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentBatConsole} + ${EndIf} + ${If} ${FileExists} "$R2\main.pdf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs} + ${EndIf} + ${EndIf} + + !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)" + !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini" + Pop $HDLG ;HWND of dialog + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process Results + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State" + + ${If} $R0 = 1 + StrCpy $AutomaticInstall 1 + ${Else} + StrCpy $AutomaticInstall 0 + ${EndIf} + + Pop $R2 + Pop $R1 + Pop $R0 +FunctionEnd diff --git a/bacula/src/win32/win32_installer/Makefile b/bacula/src/win32/win32_installer/Makefile new file mode 100644 index 0000000000..f374cbf137 --- /dev/null +++ b/bacula/src/win32/win32_installer/Makefile @@ -0,0 +1,178 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written by Robert Nelson, June 2006 +# + +include ../Makefile.inc + +VERSION := $(shell sed -ne 's/^.define[ \t]VERSION[ \t][ \t]*"\(.*\)"/\1/p' < ../../version.h) +RELEASE ?= $(shell awk '/define RELEASE [0-9]+/ { print $$3 }' ../../version.h) + +DEFINES := \ + -DVERSION=$(VERSION) \ + -DOUT_DIR=$(BUILDDIR)/release32 \ + -DSRC_DIR=release32 \ + -DBUILD_TOOLS=MinGW32 \ + -DWINVER=32 \ + -DBUILD_BAT=$(BUILD_BAT) + +INSTALL_EXE := $(BUILDDIR)/release32/winbacula-$(VERSION).exe + +BACULABINARIES := \ + bacula.dll \ + alldrives-fd.dll \ + exchange-fd.dll \ + bacula-fd.exe \ + bconsole.exe \ + bsleep.exe \ + bsmtp.exe \ + bacula-sd.exe \ + bextract.exe \ + bls.exe \ + bcopy.exe + +ifeq ($(bat),no) + BACULA_BINARIES=$(BACULABINARIES) + HELP= +else + BACULA_BINARIES=$(BACULABINARIES) bat.exe #bacula-tray-monitor.exe + HELP=help +endif + +EXTRA= + +# bacula-sd.exe \ + + +DEPKGS_BINARIES := \ + libeay32.dll \ + pthreadGCE2.dll \ + zlib1.dll \ + ssleay32.dll \ + openssl.exe \ + sed.exe \ + expr64.exe \ + snooze.exe \ + QtCore4.dll \ + QtGui4.dll \ + libwinpthread-1.dll \ + libgcc_s_sjlj-1.dll \ + libstdc++-6.dll +# libgcc_s_dw2-1.dll + + +NONGCC_BINARIES := + +NONGCC_LIBRARIES := + +MINGW_BINARIES := + +SCRIPT_FILES := + +CAT_FILES := + +DIRD_FILES := + +SSL_FILES := \ + openssl.cnf + +LICENSE_FILES := \ + LICENSE + +########################################################################## + +# Targets + +.PHONY: all clean installer distclean + +all: $(HELP) docs $(INSTALL_EXE) $(EXTRA) + +installer: $(HELP) docs $(INSTALL_EXE) + +distclean: clean + +clean: + @echo "Cleaning `pwd`" + $(CMD_ECHO)-rm -f $(INSTALL_EXE) + $(CMD_ECHO)-rm -rf release32 + +help: + rm -rf release32/help + mkdir -p release32/help + cp -f $(BINDIR)/help/* release32/help/ + +docs: + rm -rf release32/docs + mkdir -p release32/docs/manuals/en/console + mkdir -p release32/docs/manuals/en/main + mkdir -p release32/docs/manuals/en/misc + mkdir -p release32/docs/manuals/en/problems + mkdir -p release32/docs/manuals/en/utility + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/console/console.pdf release32/docs/manuals/en/console/ + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/main/main.pdf release32/docs/manuals/en/main/ + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/misc/misc.pdf release32/docs/manuals/en/misc/ + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/problems/problems.pdf release32/docs/manuals/en/problems/ + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/utility/utility.pdf release32/docs/manuals/en/utility/ + +# +# Rules +# + +define Convert_Binary +release32/$$(notdir $(1)): $(1) + $$(call checkdir,$$@) + $(ECHO_CMD)cp -f $$^ $$@ ; \ + $(STAB2CV) $$@ +endef + +define Copy_Binary +release32/$$(notdir $(1)): $(1) + $$(call checkdir,$$@) + $(ECHO_CMD)cp -f $$^ $$@ +endef + +define Copy_Docs +release32/$(1): $(DOCDIR)/$(1) + $$(call checkdir,$$@) + cp -f $$^ $$(dir $$@) + $(ECHO_CMD)cp -f $$^ $$(dir $$@) +endef + +define Copy_Licenses +release32/$$(notdir $(1)): $(1) + $$(call checkdir,$$@) + $(ECHO_CMD)cp -f $$^ $$(dir $$@) +endef + +$(foreach file,$(addprefix $(DEPKGS)/bin/, $(DEPKGS_BINARIES)),$(eval $(call Convert_Binary,$(file)))) + +$(foreach file,$(addprefix $(DEPKGS)/bin/, $(NONGCC_BINARIES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix $(DEPKGS)/lib/, $(NONGCC_LIBRARIES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix $(BINDIR)/, $(BACULA_BINARIES)),$(eval $(call Convert_Binary,$(file)))) + +$(foreach file,$(addprefix $(DEPKGS)/ssl/, $(SSL_FILES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix ../scripts/, $(SCRIPT_FILES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix ../cats/, $(CAT_FILES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix ../../dird/, $(DIRD_FILES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix $(MAINDIR)/, $(LICENSE_FILES)),$(eval $(call Copy_Licenses,$(file)))) + +#$(foreach file,$(DOC_FILES),$(eval $(call Copy_Docs,$(file)))) + + +$(INSTALL_EXE): winbacula.nsi $(addprefix release32/,$(BACULA_BINARIES) $(SCRIPT_FILES) $(CAT_FILES) $(DEPKGS_BINARIES) $(NONGCC_BINARIES) $(NONGCC_LIBRARIES) $(MINGW_BINARIES) $(SSL_FILES) $(DIRD_FILES) $(LICENSE_FILES) ) + echo "makensis -V3 $(DEFINES) winbacula.nsi" + makensis -V3 $(DEFINES) winbacula.nsi + +include $(BUILDDIR)/Makefile.rules diff --git a/bacula/src/win32/win32_installer/Readme.txt b/bacula/src/win32/win32_installer/Readme.txt new file mode 100755 index 0000000000..5068751aa9 --- /dev/null +++ b/bacula/src/win32/win32_installer/Readme.txt @@ -0,0 +1,47 @@ +Bacula - Windows Version Disclaimer +=================================== + +Please note, only the Win32 Client (File daemon) is supported, and the other +components (Director, Storage daemon, their utilities) are not provided +because they have not been ported. + + +Bacula - Windows Version Notes +============================== + +These notes highlight how the Windows version of Bacula differs from the +other versions. It also provides any notes additional to the documentation. + +For detailed documentation on using, configuring and troubleshooting Bacula, +please consult the installed documentation or the online documentation at +http://www.bacula.org/?page=documentation. + + +Start Menu Items +---------------- +A number of menu items have been created in the Start menu under All Programs +in the Bacula submenu. They may be selected to edit the configuration files, +view the documentation or run one of the console or utility programs. The +choices available will vary depending on the options you chose to install. + + +File Locations +-------------- +Everything is installed in the directory +"C:\Program Files\Bacula" unless a different directory was selected during +installation. + + +Code Page Problems +------------------- +Please note that Bacula expects the contents of the configuration files to be +written in UTF-8 format. Some translations of "Application Data" have accented +characters, and apparently the installer writes this translated data in the +standard Windows code page coding. This occurs for the Working Directory, and +when it happens the daemon will not start since Bacula cannot find the directory. +The workaround is to manually edit the appropriate conf file and ensure that it +is written out in UTF-8 format. + +The conf files can be edited with any UTF-8 compatible editor, or on most +modern Windows machines, you can edit them with notepad, then choose UTF-8 +output encoding before saving them. diff --git a/bacula/src/win32/win32_installer/Start.bat b/bacula/src/win32/win32_installer/Start.bat new file mode 100644 index 0000000000..9d297aad91 --- /dev/null +++ b/bacula/src/win32/win32_installer/Start.bat @@ -0,0 +1,5 @@ +rem +rem Bacula start file for Win95/98/Me +rem +cd c:\Program Files\Bacula +c:\Program Files\Bacula\bacula-fd /service -c c:\Program Files\Bacula\bacula-fd.conf diff --git a/bacula/src/win32/win32_installer/Stop.bat b/bacula/src/win32/win32_installer/Stop.bat new file mode 100644 index 0000000000..6330d95859 --- /dev/null +++ b/bacula/src/win32/win32_installer/Stop.bat @@ -0,0 +1,5 @@ +rem +rem Bacula stop file for Win95/98/Me +rem +cd c:\Program Files\Bacula +c:\Program Files\Bacula\bacula-fd /kill diff --git a/bacula/src/win32/win32_installer/WriteTemplates.ini b/bacula/src/win32/win32_installer/WriteTemplates.ini new file mode 100644 index 0000000000..3b3631c3ff --- /dev/null +++ b/bacula/src/win32/win32_installer/WriteTemplates.ini @@ -0,0 +1,30 @@ +[Settings] +NumFields=3 +CancelEnabled=0 +BackEnabled=0 + +[Field 1] +Type="Label" +Text="A Template of the Client resource can be generated that contains the information about this Client. This template can then be copied to the Director computer and included in the Director's configuration file." +Left=7 +Right=293 +Top=6 +Bottom=32 + +[Field 2] +Type="CheckBox" +Text="Save Client template in:" +Left=6 +Right=240 +Top=38 +Bottom=48 + +[Field 3] +Type="FileRequest" +State="Client.conf" +Flags= +Filter=Configuration Files|*.conf|All Files|*.* +Left=16 +Right=288 +Top=50 +Bottom=62 diff --git a/bacula/src/win32/win32_installer/bacula-dir.conf.in b/bacula/src/win32/win32_installer/bacula-dir.conf.in new file mode 100644 index 0000000000..d13bc77ab6 --- /dev/null +++ b/bacula/src/win32/win32_installer/bacula-dir.conf.in @@ -0,0 +1,383 @@ +# +# Default Bacula Director Configuration file +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# The only thing that MUST be changed is to add one or more +# file or directory names in the Include directive of the +# FileSet resource. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ @DISTVER@ +# +# You might also want to change the default email address +# from root to your address. See the "mail" and "operator" +# directives in the Messages resource. +# + +Director { # define myself + Name = @director_name@ + DIRport = @director_port@ # where we listen for UA connections + QueryFile = "@bin_dir@\\query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@working_dir@" + Maximum Concurrent Jobs = @director_maxjobs@ + Password = "@director_password@" # Console password + Messages = Daemon +} + +JobDefs { + Name = "DefaultJob" + Type = Backup + Level = Incremental + Client = @client_name@ + FileSet = "Test Set" + Schedule = "WeeklyCycle" + Storage = File + Messages = Standard + Pool = Default + Priority = 10 +} + + +# +# Define the main nightly save backup job +# By default, this job will back up to disk in C:/tmp +Job { + Name = "Client1" + JobDefs = "DefaultJob" + Write Bootstrap = "@working_dir@\\Client1.bsr" +} + +#Job { +# Name = "Client2" +# Client = @client_name@2 +# JobDefs = "DefaultJob" +# Write Bootstrap = "@working_dir@\\Client2.bsr" +#} + +# Backup the catalog database (after the nightly save) +Job { + Name = "BackupCatalog" + JobDefs = "DefaultJob" + Level = Full + FileSet="Catalog" + Schedule = "WeeklyCycleAfterBackup" + # This creates an ASCII copy of the catalog + RunBeforeJob = "\"@bin_dir@\\make_catalog_backup\" bacula bacula" + # This deletes the copy of the catalog + RunAfterJob = "\"@bin_dir@\\delete_catalog_backup\"" + Write Bootstrap = "@working_dir@\\BackupCatalog.bsr" + Priority = 11 # run after main backup +} + +# +# Standard Restore template, to be changed by Console program +# Only one such job is needed for all Jobs/Clients/Storage ... +# +Job { + Name = "RestoreFiles" + Type = Restore + Client=@client_name@ + FileSet="Test Set" + Storage = File + Pool = Default + Messages = Standard + Where = "C:\\tmp\\bacula-restores" +} + +# +# Note: Windows path separators do NOT work correctly in FileSets. +# +# List of files to be backed up +FileSet { + Name = "Test Set" + Include { + Options { + signature = MD5 + ignore case = yes + } +# +# Put your list of files here, preceded by 'File =', one per line +# or include an external list with: +# +# File = (+Y|FC8 zmOZw|Gal!0nw_-c-FyN6M;J?6wOu2tU|-(=h88B z5AY}T*@vv8B%KuzG!o#k% zKlj}qbANtOKV}LkZ4*Tw-zc%MP9o$@0sA|Kxj@Lng0#SQE>^6i{O-h$H1hdtLNYLD z?HYe<_kW)JOcZ~zRA_2mM92-6{fJ@j6Y@CB+xz{6N`75*u~0NFg1t9hba%Xnj*siJ z+5|eR{7UcX>)Z%M^oDzD`3e4f%1SH~|Lqi1$JdSk0w@i9Tb*e2$?DC-+HQ2Bdy^%Q zMl^m3ZXs((U40QZblBqMS-2%EQ^gHJ*Rn$1^9JF^S)uUTo;+bI&sRrY2L+x}-C3rJ z100@ih4^)y`9D9qRkCxtj3}LA*;@?z1tITvxQ2hYNJCbv{SI&&$-gyx@@9Yb4Mp~K zMb`D+%o}}K&uQ2DvKAGY=zMb^_x51ko#B&cw}$d=4(6ia27h8qER8Z~4J#?mpnR?K9^t)W~Dcz3h_4L6jM zft(vy2nKn^Lhut_ys5~(4H`f{ULPyGKUR2;8v&Hu0woxngJSX7gDlg)L3fKThqjyj zIdo~mbX}CBr*NQ51nfMu6ttY%gSqGoG5`+c?;6nfd%W`XgHlb69HKnTvad7DXGGzD`Aa|)ZW1&0kT4(ar&g3iYNw_|zt#nAiE7yC|mwK~qV7)zbgoUoO z>pggq364-q0L~hccqUSQ_2*pg$w1G=o^-s35w7=TF9G(R^lM$Ibn1?zm06xi3GL94 zyi9`vJk7zdOW~T$U2j#V`t%eObVM$_U;kq~OClWe+B)NMH#V1jJly5ua~NI9s1E-w=y- z_8D!yA!fcl=3ITkg~r5-Euu@UQmhoOUuu3X=t#S8<@0f2fY68u`cl>u2Q?)z*ak8^hdYnKKOgF2jJ2{Xdz{eEBq0MyLRAz@lcW!lufD zPob3_KV5p_blFCYK0khnwiDBpAv0CsXKEuk&c>dpi=L~Fn5~YOtBJy*z$Pr=&T#%6 zEP;1h)RN@GSS@s=V43r@f8?w@;!JH6P&(HTccwn(Om*Z;Wf+~h95g(e40I?xK3R5R zsvKm5&DX|&p%+^rMdEW!!ui_h8F@I?a=I)SeL(QK533gg2hrwHbMjA0IO5wp!NiY0_7lPx(Y9b&d7m7FZ116LpCNkPu=xyRc@5_J4Cfvh zD>yb$5;$2Lgyl>Y1&kN^VUUR;|EY=)$SSmQsXvQa70yuL=H_4?>=-};$AQlTeZ~J& zX&^-Xu&a#4DZ2guc54Glab{OQqglP{}|rFjI&kYvsDqe0Wo6*ejslk z#~Y+>xR!xzufZJe(UV8Viu}NFh#&Osd{aD>3!()Uj}{(V9sy)L8;!wiA39X7&q%KC zX#PU8l^U-r4CgsF<) z;gi0KH22<=LtRM+JEcyY(t}+xr>7g9)1Q)@(0Wo1^`#%~&+w$|righe(%kyeTn92e zu_7$td{ZLq25(&u+U&tXI_9SC1&Xm;U&dbZ8OGt8}4;l77mT6YyYv76=MZylm*92#E{S!g$hPabWOP$HZM&p4Ju-(5*}3WIuXBAO|x&q1vN)M+ftcK)OH-D8UGLy;B4z)(^549Ik_H zx5Tz3aeupLe}~AvO|-u+*&bx{rMrz6_yGq<@6En!io;j|aJbr;GG8A{amb=L^d>v@ zBpvKaa|0vhYNFxm5x%bS@y+uUeWhN6e1J5LfJHLr0mD9G*fECvTSD3^QsW=b6)be7 zK%KFQcFDnBiD_k+VNHZ#b%bF}q``Aqb%X)>RE8PMWSTZ7ShXbBvN#ExJJ!0eUUj-?ovhhiZZVf|X< z5&9hcxEfZ58_r~zw~1`qB#u;}QeAsfTsRr9pG-Hepd+B^KN|{u3QC4N(x6Xl)(~q^ z7i}>pGcO4?8c(-w6CZ$9o+=HRZ-_?(%k4_?5aA;nnyw5T&hu@T9vn@xlZTshi%mOa z2cVmNr&Z0dDLH=}k2rO!w z*zsJhsS+{fmhTbaY|$B~*AZis;j7OPKo`Z0&(Dt9GBnJ~->hEogc3lAr@oFG#HlXA zxFO1PM7Amkz!pS;)YVt`8-59R5wD{IZXD;b4I5(2A&~XaW~b61&wv8;Y#;*-BRoCG z>X>+)Z{7k`_YsNCkQk+J;4ehfxjjz5Q(^}fJXsuwxD;B0y%mC3_+qGDo7myPNmEW> zFpG!G+j>0P8T>`GkEnH(kB`q*4pev&@~S{Ez_70}?AJ7(!(3q5$Am1N6vw_Xm4lrQ zB82{AhoT^!co5)9h`Y)bUnONPB_&UyqGO8Wdfl3OD*YeEgill0V8 zF)~;H2H9(92JhMx$GnvMS z8~`!`p85J{ga-(35M%eIxb{h{QjhRj4;=h50{4%k9{?ZEH41O^rrjG`-gmrxp{z11 z5J3*h%rXq}08q)7;VactyHO~al@RvEbRJkwqq}7L!sEPA1%}>at8lw63MoSgIZjB> zcdz&}fcBwfm+l-xy`7Bgd*XBlMEkTDe)&Mgy)M$QOJdWPdI&Kj0(+Q!=q7dn2#wC< zLI^P(?3ME#v+A}Ooz|#*sXn|qD1QSGi zn%UL#OAUKds6HaTMQRk=G~TYhb+)Wk4nBUvFkdjt3?DBSPPt&Vh~( zWPA3??2CdhAPlvuwx(-Wyg_BCX-SY#aiC#I(E5gl#X$zmQTxnxgKJ)pSpA)jeF?ht z;rnW-V}fXbelJaR2Z$mZJ;J|XY}4}nu*stFxx}XA1n9@RmZ8Dj=VzuWj;Qp-?={;6 z!wxaFc>CvndgW4ovER<(00VAzqY{u2i0g7&p~|S_xN+GDlMbnqJV2`|#1O{W+Y&|< z7#a=?yz+-He^%`|xK~*TVrETL!e6;K*q3Bce!?8Dqm_qR&=H<$cwQT2-H~*tE=(73LQAYk*$IFN zgFtc6(XyY)Fm97NBH$T0=?hK7E{SfJq}Ex!STg*$nK*IuRDX9%#0#*%*j6LGgALlM zU48d*QAT_UA%9@mUoh-H2n1CuGsv<}wyHwc9wtQ|dpwp^1_bulw##ph`j8%7b)HQKJg4`SIQ5{@T@{hVl^o{zSc! z$g)#p(Hw747irX*VAm3FSs!ISlL0=$Cb$wMD7)97bYF+at~2SNBEx+k0~_Q+%|iR@ z#jvQr0lM!8YD;~TT7-6B@pM%vHfy&OImq4d`uN_}qLeUXR{xe^-)GtP81@gW;HH2n zVFZ(eER-b%y>>bmi9zh&VOLl9=%TFRqs6$X3tZLJoHf)AYN$Cq-PF|_wHVOpq^#_t z#>TpuyLQFyt`0S*4b$rv0vWg!SY6m&*Qs>9rZ}rsp

|ZBx9>V3L`)6|ao@{_V+= z>mwC;uB0wZzb%G0s@9WJkL3Z3Ja}(SsJ=Wz53M>>|Eb15G^h$Tz@#-{w4u+i7}fxT zn|1X(Qe=6`PwZ@pv&1F>nGHaP%mBm*tvA&L5k5A0*dxFv20H*u_iZ}y#=D$*<98{j zmxp_`D=A;>5LwlR@8bu-D+t@LFQzTk9XS)U{&Za3dXfFW4L5jCvP-+fp>q0u~c&hJgqwNT1kkJpf%N@dcbo?yvNl9VQ|sND zK$ZGv^Y+C30G7|cVSB}=0Y^_BL(B{d-y*bai8HGT!PHLMcL=Rbj`zmDpb+XRQFxvF zk9Q&fZi+Q&7uiD$hH`yq0T)0E8l0>pEK-#W0-1q`8;Xf@0F=u5IMI=;-uZCa6D9u;=`)3&M}RaWud zqT;({i|>}LxE@6itFq-Np*9ozMOf>yYgf#UJ=rNfhAol%5F}vtQ6FJEDuqhIOM>qZ zMYpMx-L(-WHIc>xVq+H*UI_I;{Dsb(B2PhWs8M5tK|>^7L4IDX=FF&dzzmBll9$ z##ER{cnzX-e7PwH5#KpFx^ZZXMw-Ynn@Yz|u&a>XqiNoTU9o#tm9Ylq zdR+_IhbQoioJ#7$GIRIvkC+su?1-^VNsmwm9vN{3P(>_2p9PYA+J~&9{=W1)xE)tvyBNjZs<)yyb2?L z!QGr4<4z@zp1AD;i93fxIzytJgNZtWB6^P-`b4~IShQ;{ZO3t&UE6gt6g`UvY-4-k zcecbMooEl&&?2-MPcySO0LxrBBkU1*(CBL3F3$fNL`C+2{xmxRj??%@WQUv46cY_K zh$!4HG~KOFr~|=(j`zgv>58M*o`k(?uide_^w;>k+;w+-n0{4=!3a&HSScy{C5p#e zBDG=Jur;2kq~RYu)EmshxgHMOfj>?^rz%b$ghn`B7Y!3(r@13GIiaW}RD+AtAPjCH z5sJDP^G=B^lxwz{Cj3!tf@25_vbN!15r5u9Nd_$@$;CwUK&L8fB>!l;)M+Zy%xo7> zMc@jR^pJWOT+G(tgjp{ua|SphTNA`ZgIV5?Hz?zco^+fFtt*E4Y$;UFPjt?DBJ z9)|MqmMlEsXBP{v_hn%JIEZ*P33&iW4&8(A+bgs+4%Ak6(PA98vyPgA16s_1?Odbx z^iMpu*Jjb#{&--`7r*`{CoZWeayL@VIQHsGbwvWdU1U3y1XBr7gsFryI=Y#`BS7P9 zK>Wf)bD6I?vUB_~M~B35AjvYw9=lhlFgjz&2en!2?W~m+W2Gsu;F_f-W2q@vzG?_8 zwzHP_bsJ;5jX6*iy0<=DZ&(68+No=XPE5a39msY{9FRqUkW-H{bP~sZw5SQkM*X=+ z62i3Ne6vex-x>?My5H0yy{~ap?!UEPxSR8j9@De0*Mu2$i0wvB9-Xg?!65WZ5ax~> z1lP3*=~9k~StlV#$1VFu0rN|i{g{xN#=`J7=Sxv*1U?Ss9O(xiPe32xp`1-j z#QMgW9GI9FTtLIk+J+}^jcaNo&=B&EL>#tAIEp%zVQ#$#DhU+> zYw$WEAKMr2{T%&MYzejlJ*h7Aq!`(xG}jJ^!)OY>UN^*7oL1sRuoZ6sgs0o;bDEjd z-(laMxMx_r8+_clH3(CjbXV$>IwCZMH-s6a$MLA9;0o&Q44u5znR=!=3dfE;GW*6T z2(YdDp`v@Y7fU^q`V#0MSoNR&`AJ=zb$g->&dSd=#G~{D8}qwdWg5oWxJ?w_8O=wu zdAVJRB0ihj8JD3;9!|1XX*}~9L6XO(BRc~dL zBQ#j$8x2`$;Hs?R#l_N|#)e66z4<=qDLEo&6WN1_$T%T5#92J@5*_dkGC%}&gYWJv zb7FLG5uK+ye-kkEkqj28zWT*vVZ{+vv=aI%02a#vFF*47Ty&b$L$!CfCUFsRQxeZ`B60-iK0#bs(~CA)R6Z$&>9pn zEq0}ysf)o0X2L78x7P80c5I)->sQh z4Mq4HhzfWOnOW#c$1A5w0u>pDJH>V#iNJx67Ccxsc=7ThP&i(nQx%|%Y%?k%=4zwi z8L2X^(7ATx&+q1KV``ODuxG^P5f&9$9n>LL5OT9JujuV_`6w%bF&`^D)}QLqD}kGU z%p5`b)X+57$u(DNhg4lFPJKICyvFu84Q*WG)wSbUtr%7H2(6tWr^Ds5mp(n;o?Lxm zCpN;!A0iWuv;JuWY+y~2%c)Fr^W9KMxV*!*7Re7EzWdcT|54ydJp!r-uuPohpcn(y zFHlUJ#GTDG*3m?I!IvlnYwZ+k>qyw`ag0_RuAt%Dt9HEFwir$A1be57hcCbX>DT{S zA`w;xYL3ywCR8cn^|!u;UBx~Q59*rA zM;hvDgVaZ57z9aX|LeCuZVA_f(VHv{#2Gzger*i77U$J_s_$I=AquE2wM%h)jJgr1 z^t z%^}=;d&QqqJT_+7LbzLI{q-s>7b3BngTG6-F}lbf%Ha+tOyA^&v9{Zt7(MJnar+(luAt!&WYl zUI7hdg)dz`T^qKyF3O}S#=IiLDDsd~d8l1avLklxQLZ5_g?h9A*-LC9 zKqSPeKV`qf(=yh}70K16So5Y>v-(Km1ExN;QC1ydTWklA*`}xY{n@JpGfzXk`h?B` zl^jADQW{lB;E>_oE^?gBGTgEiICv8hm6dm~Lu%6;YobUy3>>iWM1dtArml-{_+dX> zD0FpB$G15Q3%3YmM8Gq|Ft>=(f7f{-^Y;%+pvViIsYvJ{3xQ&l!BpGPRP#ZZX}`=^ zAvGM38VyK|pKkq9qkf6epwy^4(Xctj1cffh0ORN%@ixvGQCmeTPpZS=R$w$*6YXcR z45eOHA}^=r=siu5`rS!1Hv%C92eBPMpbpkUF(JC(FIcaT*^H)`4}b;hx;4-IXDW0 zzMv|pEBVl1n!Q45hOil16$IPuiNL|6CBd>MpHx0V=j*lO;G*jfD{6 za2yrOKnZ~a_Gnlawq1~@b_u4i=WAWoQ?iCU9D#vgq-AI^71y|uCnuy+;Pj^}gHeNu zAZIzwT(MWc8QTX$m8j^0_zmWI!w=Gfm=qTbf*X28%}lB*CvVt(3gJ&_!gI}@ZXMKX z|D>@HqT-=kibErgjDxXr!QgH1CdoFyp;ctpo#KL&IB-CLC6<4yKL@P8H@QI>IY$2F zVquUwBF_&5%tr$HWd}|n=NP7)W#@^~|1sQqpdtBSb(SzSPIj{^bh_&3h3bGFuHX$z zprsdF>DRg|p7Raf2XQH)Q=FGUo6a>S@O3zV2mu=u4Y4|`3LGVRA~dDdFKLJ22PcaI zupL7Q3L*!T(xHAEH4Hc<=l15o69s+)IX>9gA&BKCT1No?CnXP*q#aUZxFN5IVNrdD zJSr_gL^WfLcOASy{vWDbbdnnda%QF+))E7s;}A`qBiuZQ#bRL#Q`T)D5XP8SQ0oVkDxg8W$-oR zYX@0-|JM1cmLh~Mj~V7y3=6HC2NN0QO;%8)q5cz;=pb+<s(2LEf*u6kU?oCCY@87jVtWf0fWoTb zTwerKs8EIGB7cRHKA1>LI_ZZV=%0aD9W?_}m0PJ>CGt%*c`yv2l2aen%qXC*eRSl5+SDOia@Xetm+$@BrUPS3E@LyBV%i}|5T#hQUVfvtz@YHzgTvHsqHsYFqn+r`s zq-0V0jtGR3x=|##4)E1Kc|PJT)EgtT9JO^=(Kya63kSFg|Q++{GLoN`!iQLZPdva`N0zLQt%Rl|E=p$}-6jDej zUt_=VwGH1dpaNgQMKwu~C}<*dkbaee9TxZT0$svD4ib-G4S)hBw6)+<4k@66!J!-T zF>3D6AAtwmJ`d*NLlxk5xh)CZFg{1dvngp4Bk7I7LB?f#bc1hdxTxuBCqAo5!KXSX z0R2jd)A*+g<)L> zFa$ADU!5&q7>Oceie*1w1Rn|n|DmCNOlw%(_jSqK|o5Rmrd^?e;C%aejyq|xxP%n-iR1D%<0(>L*%7(N_R&`ijn4d9f zuWM^ps8>aP$2*JT(ix)_L(%**`u`A*6*? z&9NT~1o+n;E(-(~G&Jw1Y<{HyZ7X?f&`Q(ob&|e7KPL>5a;du9tqWSoqy~*b!l6eUINt3gq?V}sf{-VKTp}c0Lt~N< zJx|wdp@9c&?1OQRBiM=rdjozVq!HyMn(PUEy;6f+zIM(@Me$zmT&&#G${)gr|CBy( zaIei*e|e|;v)eTv-H?BFyZ+1j6<^#c94_%pjXb8Ojicmkgv{WpbC_AwDiiWCAzu=5 zN@Yup8uMhU+BaLa{7O}IK~3#9@T5o^a7m#uC1TTC68HFA)qe_+n}hrX2vB2qs`T;s z>i4e7zkJa6_1%j4Y?q@h!Qr0A4%+8%s)vJMB=?#Ki6dl)kT9IQ;9ti&aL{9*H1KkZ z|E;OY-@V-M%524E6!aJ1|6lP6=io|zda?S$>s9YBR(*V<__r_T|L&puH!oHH@loN6 z^Q9MiGVafm{{2tNfBQ22jV$@&^Odj7S3R1+Mr?h;IXKmn1WfY<>AMFBwt*F`LxmG$7R!qUVFa=;bzAh?u6 zR$ZhB?&1M8ltqdnMLJ>tW$C>WlG*Q@m$`55y!$FIl0fF1FSkwk=l|}^{PWM;m$nc5 zWw=nGDgM?0UIFd_5=3?U6`~EEcP!w8x`97Z%F7a{Sz(|(Fah`u*bbb`2G4nq&lsoh z<*J9vtzO`&IxrSE0mul!xJ*<1a?{7B07wNc02Z&AhlDt_MTotteBe3n+3{3b z=F#AC(Mw*h2e@bj{5z1V3wwl^o+d<#O&o^2!Do!axB*-<&sKR|KY3Ap=sf{=5a1YU zwbip2TZb$WqR=^SPQAEhT&7`KJ3mzh%Syo7OU2Ay3Cya${D zOkU3jv22kL*P|V4{r_G^mdUauWN^tu87b?vxlxywQYLUz3aIYK2)JX`%n%|S?K2&` z9?s@A>zEL8(}bwBA8~Q-Qi3v27Ruz}IRn>IfO?lwr@5(Y@HDhksZz3f_3ECu`s%B} zWnt*8VCJRe)a!jJd0dE(7h-O;*WwvAnw$f)$W6Nby=6iD6EHVT9XfO(VF5Ti8vP#Ukl>hUJnOmX0i9iov9p;=e9KR;> z)2C0*h5TyH3!snbyG)1^8&NlMYXWsubxuTm@Z|CX>Q@Bl3#0?tbswVI<-&yvr5Dz( zUoSH0N4&+;7W{Fb<>eQuKg%lw5Y6Cub%ACp@XZuFztM04|?WX?y`^!_OPK7OE z`SRr|eb|WE5q9m`C2zXvrhqbUz4cbPdGqFgY-kTqCZclX%JPE`K9J|moePMkZ|vQ> zS5~Z8QD3T~-N(H0$}6ttK6w(*ucZop;49OneTl!tA(T)A>e-+cG&cDroZGWqt~ zZ#&>Ss)Od&d~Tn=`|i8)n{U3+Nz}1Zr%n#P4?g&y>lrT=En1|?yX&sIFqS09IdkT? z;!uVK3l>P`ZI(B1;J_H$FZ+nA;0vq0->dz;^wLYNa?CO*!{?uW?y^hRM}V)tKUE{q_Y}}`Cqkal`K%8fGdt!ZfyOtuWro8i(euBit>o(_rXm40zRIRh&v`5AK|!n z-MV#7Jr*xsO!*e$MpXQkFJE3ZYt}4c+;PVpvQM8ra`foYlD3fDHnl+1ed*Gr<&#f7 zsc)%c_wL;T^cXF_%$J;*!Q^+uh!N%^*|cd>SDCN9_L}QCZ4ma?UZCxjGyG;krcZ&} z0QPnM_p5mE;%dw_=M~xfra|y%_^ph0q7D4{*n>81f)Mi$3z3Gh9Kd#)h&e#Rbi~8` zK+rZkdGe%7U;2V`S=ys!pxtBV6O7-x@4j30!yE(cd9s-&&wKRf;p9vE#|*a3_r(`q zn2$rA$3Fi0b>-cDs~(^oK5N!2xqJ6+dG_qtka7$kKAiO%iAYiKD=UGr5deIxNazRV zIIH1%Yk>U@emR4k&zLd8Q?}=ye_qW^%!hUA)Ny#w`FZi%x^?TYoa%h1Oqt@!)8?1$ zPnX5xh7B8Z(y+&z;+ON%!-o%tEuRtCb}>i8ell?#F2nMRD%Jwf$4mHDO*|J5hS+m9yjC-;D^JkxNYU2--lkL_Fd-m*+OO`Bg>c=+EafWmE zgoHBSrDJ!*56LaEZ30XO;9D|z&BR)EYMKyNAJICB=J?Z3KbfLB=WK&dJ@u4x&67y@ zEmMX|>i$4GBb5DP%NmZ~4?q0SpE=H6eDTGAcf`!|V)^~*tFN5$IG1DIoJZ<#=+GfG z_WR0A$`GO!+G>0Bq5TkdGH?!1oRPaGNax}i_sRkP1Q^f2`Co+?y-0{6r_K6AdQQK^ zgb5S0n66`HW~QW_Fkrv{*ZoNN<^0(U8#iv0w3j25D;&SK+;WSVy=41s(xgeyGGgVI zGSh}IZP2xA*Q#>PoH^sjz<#=H*|JvsxL2$+cu4`@wegHt0x15-WjSO(l~e(CX5Y_# zetIjWQvVeq5oz81aJ6dHly8jo%F8dmEIFSs=Vm;gG-;Cj{`>D;ay!CipRj*r-uC)Y zB>ZxIYL88P$2qU2-^UB|V{=Z-XLedMUEjWam0Vsn7TcDcH~UPRU*>PdGutAopPrts zo*y}K#8!(OIdY^bpFRLHaQ;nyitG3%`^nTE8jx5SVsaFnP8AiazDk)YM?nocmt(mGdyllV5-R zRhBGSQt9Q+JMUC}sYtV+9V0~RE!KVma{E6YzvQ+i`eS!{jYXH?WTL&N*Xm>CmvV9L zJbChDxpnK-a7C*9A<^)w^}u;FZ5i4SUVi9{;g|E*g9i^v+7Iu&_nyP8E}Lr%v<28_ zb36+beEgC-a_HK2xVomGqhD{Am|)9MaJD z&12!hh1D7j+f=aiAl~QmU|^rF^LhXM_g$iL%+cvWjpLM6$J0mVNm=!EG{;b7nf2#6 zedeL^_S=`_Q1hv{?QL8`*28PfKAN^mEP+06jzhow_M7BbyJE!(H7?s@wbwQ0>d!s* zoU;A7E~on}yUx76_uhMzpNwso{Ts*OqeqVhVBfxdlH(oUS1 z%=ajoK%bBoznotN3)#N=fVo_-`1(F&H3R47ycezQz&yk1q$Gigfy9Mhf{bh@|@~h>bZ(En)HJ-Blk}C~fn;{&(9AjzkvTbV6 zrsn*_w!6=tKkvk0Tzed&oMs@u)EnEU9S$5g;K)qb*&mp}%`fMxqcCsf{ME%PbfY+I zjI<87<~g2|XUvoToW;41S9tyP*Bu>eU3(ql*?zSgY_FXEa(&SZ^eNKsVaq{(wi$x) zOFNDGA?)<}n*F00xYtjwaq2i;eq=KZ`L*ZP^XJc3`$Kdd`e^&*ef$=KpDHyC>&Eam zxp-xJrEeoBuaLvVw-D9Fat`Aa=oiDjDU=mxYn%6Sf?vwRwIJFW=K2Zewr1J-+>2lR z%skS5F|X}&`moI4n{T@79|^x4|IMJ+N$v8y`TgAfc7pz6`jKlPPZxjTu2J4&-1FlV z=!;EC;(n?Zw!s&Td6m1K`Z^T9oD;Brut7VAeuPkA=gysqi`A=FyP~lT({F2nc7hq` z^QLdc3@^O!LP%~|AGbCAK9vwB zDqeMb$Xt(W7{TUU)a}zxKP?}6=po59-$soZseMk|Bd6;dir-1_abb@gKp(1!Zt%5M zl;)ldvz|O>AIDgB8 zzSg$OwfyEWp8PUj`b{{W3%72q>)@LomF|q|i{@450Xf=o-YV)^?JL?y^kHjoACnpA_an@peUkn>1IL?q z^Q+6^JhDQC3bJ!rcH&)knSZrnJR?PQm`bm>yXsZU2w;k>7D?dFE#fEhT?p+3#Pxro;uT3`OY z{Nm3q=dQP>V^28xT#o_e+2g}(?&4;AKd4n(~TcL-c=0y zNv;{u*TnQDSf}{$OI}kBagVxLhCZi`>B}+a2HEfP0mz;Np`+q1()h@`9WWKx%RZaF zqt2Z>OYVp3*|Vqmj)?v@-<+^VSD0seLiNusKdti z99~)KH7nFX?T7yP=bycz1>B?VhcB}7F%r$fRnK-{O z-wWo!?`D`MpN9(Z<+mf`jErCQ%e40)E52b8r6FUEa2iX#kSDJEa=qKjKgDsWc=5ds zzvQ@V*=}kbf$u%-PL8+aGZ^?CdE>^7m4CZ;@7~HkOdqiZ$7b%KWq$e|_nz4Kah|20 z^T_9B@cEzH!6#8?8`u8KxICxtm2=L=AAellbI(28Kg@57Qh~CuaFCN}AX8lVrJlG> z9wI{|dDewbc;F5pJ`BQd;#`!)vF=$9^ufKSfyV*HiP?XV zliV_Igt+rdj=2}g{FVsipfK9gCciwtgF?gsNywuUFc+v1BtPzj`r~pTj{fA9!>j#@ z**UHI-y{EU{BmCc`y&(Vqb5$A7}9q|j@|nit3l_PfX(k)LAZ#7^J|cH2Cx=52{7-S zfSoq!ybyzy2yte6VEGc?z+Soh^1E4dMZg#XqjBCt?e!v$!2;(GeqH|+=Qg*zUS-6w zc?osRadn+Xo|BFIlCicjZXv!|-))tRcI^Lcm3)3@d+3qeRFUb}V;C&Z=dAa|U|)BT zJhE_~-|d9r(tcJA@#hE0uP5#o#kwnhk2DM4=}=AwXvcxSjl{C~J)8!=gT=ioqJQ?a z-@&NwR|aO`e3079?X{Q9`f^OoqO3=1_1eGORK$DWbI zo3Td-YcGePdoNyiuQ&ZaIBL|#`Dq|neEa@?uur1+Z$gyFRldR8@Gj&8zx;-Pzj=hb zp9D4uu>x~Un-lZ;6ZG5N(Wh1bPyO*8oUrx)n{n;)mGt@Yo7!5rL7%xz2IwWEeFb?V z3Y-hAT)9#X9z0kkCnujkzFmNk`0qckt!z&0Ywi_j1ni5V%`%T2uzL&QeZY?+;4&Y9 zIv~GXGp27oS~P6fQ0;-`T0FktK$}zRC)k58QmAW$!M<-SY(DMl1>k5=l-$zCSQPCY z6YG3#gTC9)PfdX9h_Rp{(xm{UfdZzUas3Yf+i4!{N0t|fX@50B+#NLQMtU%uB06*>y`rhV0%URt( z|Mh_>7$1)cu|CWgybGK?hVQO)`}8{gg0Z#&{1pPIj-VF!EhnuXs4`WyOVu^))*zSBtSkRLDfy98dUf@A!4_JW1r@IoMuC-FV|En5Tc z9{}&y?MC{UK>2(^lzrssVojHpAA&e2VngKV;9db + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/win32_installer/storage.conf.in b/bacula/src/win32/win32_installer/storage.conf.in new file mode 100644 index 0000000000..ed4933d776 --- /dev/null +++ b/bacula/src/win32/win32_installer/storage.conf.in @@ -0,0 +1,14 @@ +# +# Copyright (C) 2000-2015 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Definition of file storage device +Storage { + Name = File +# Do not use "localhost" here + Address = @storage_address@ # N.B. Use a fully qualified name here + SDPort = @storage_port@ + Password = "@storage_password@" + Device = FileStorage + Media Type = File +} diff --git a/bacula/src/win32/win32_installer/tray-monitor.conf.in b/bacula/src/win32/win32_installer/tray-monitor.conf.in new file mode 100644 index 0000000000..a9812256cf --- /dev/null +++ b/bacula/src/win32/win32_installer/tray-monitor.conf.in @@ -0,0 +1,30 @@ +# +# Bacula Tray Monitor Configuration File +# + +Monitor { + Name = @monitor_name@ + Password = "@mon_password@" # password for the Directors + RefreshInterval = 30 seconds +} + +Client { + Name = @client_name@ + Address = localhost + FDPort = @client_port@ + Password = "@monitor_password@" +} + +#Storage { +# Name = @basename@-sd +# Address = @hostname@ +# SDPort = @sd_port@ +# Password = "@mon_sd_password@" # password for StorageDaemon +#} +# +#Director { +# Name = @basename@-dir +# DIRport = @dir_port@ +# address = @hostname@ +#} +# diff --git a/bacula/src/win32/win32_installer/winbacula.nsi b/bacula/src/win32/win32_installer/winbacula.nsi new file mode 100644 index 0000000000..e88602023d --- /dev/null +++ b/bacula/src/win32/win32_installer/winbacula.nsi @@ -0,0 +1,1241 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +##{{NSIS_PLUS_BEGIN_PROJECT_SETTINGS}}## +#NAME "Release" +# CMD -DSRC_DIR=release32 -DSRC32_DIR=..\win32_installer\release32 -DSRC64_DIR=..\win64_installer\release64 -DOUT_DIR=release32 -DWINVER=32 -DVERSION=6.7.9 -DBUILD_TOOLS=NSIS-3.0b0 +# EXE C:\Program Files (x86)\NSIS\makensis.exe +# FLAGS 2 +##{{NSIS_PLUS_END_PROJECT_SETTINGS}}## + +; winbacula.nsi +; +; Began as a version written by Michel Meyers (michel@tcnnet.dyndns.org) +; +; Adapted by Kern Sibbald for native Win32 Bacula +; added a number of elements from Christopher Hull's installer +; +; D. Scott Barninger Nov 13 2004 +; D. Scott Barninger Dec 05 2004 +; D. Scott Barninger Apr 17 2005 +; Robert Nelson May 15 2006 +; +; Kern Sibbald October 2010 +; Remove server installs and +; install into a single bacula directory +; +; +; Command line options: +; +; /service - +; /start +; +; netsh firewall add portopening protocol=tcp port=9102 name="Bacula-FD" + + +!define PRODUCT "Bacula" + +; +; Include the Modern UI +; + +!include "MUI.nsh" +!include "LogicLib.nsh" +!include "FileFunc.nsh" +!include "Sections.nsh" +!include "StrFunc.nsh" +!include "WinMessages.nsh" +!include "x64.nsh" + +; +; Basics +; +; Name in Welcome screen +Name "Bacula 32 bit" +OutFile "${OUT_DIR}\bacula-win${WINVER}-${VERSION}.exe" +SetCompressor lzma +Caption "Bacula 32 bit Edition ${VERSION}" +VIProductVersion ${VERSION}.1 +VIAddVersionKey CompanyName "Bacula Project" +VIAddVersionKey LegalCopyright "Kern Sibbald" +VIAddVersionKey FileDescription "Bacula network backup and restore" +VIAddVersionKey FileVersion win${WINVER}-${VERSION} +VIAddVersionKey ProductVersion win${WINVER}-${VERSION} +VIAddVersionKey ProductName "Bacula" +VIAddVersionKey InternalName "Bacula" +VIAddVersionKey LegalTrademarks "Bacula is a registered trademark of Kern Sibbald" +VIAddVersionKey OriginalFilename "bacula.exe" + +InstallDir "C:\Program Files\Bacula" +InstallDirRegKey HKLM "Software\Bacula" "InstallLocation" + +InstType "Client" +InstType "Server" +;InstType "Full" + +!insertmacro GetParent + +${StrCase} +${StrRep} +${StrTok} +${StrTrimNewLines} + +; +; Pull in pages +; + +!define MUI_COMPONENTSPAGE_SMALLDESC + +!define MUI_HEADERIMAGE +!define MUI_BGCOLOR 739AB9 +!define MUI_HEADERIMAGE_BITMAP "bacula-logo.bmp" +!define MUI_HEADERIMAGE_LEFT +!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH + +!InsertMacro MUI_PAGE_WELCOME +!InsertMacro MUI_PAGE_LICENSE "${SRC_DIR}\LICENSE" +Page custom EnterInstallType +!define MUI_PAGE_CUSTOMFUNCTION_SHOW PageComponentsShow +!InsertMacro MUI_PAGE_COMPONENTS +!define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre +!InsertMacro MUI_PAGE_DIRECTORY +Page custom EnterConfigPage1 LeaveConfigPage1 +Page custom EnterConfigPage2 LeaveConfigPage2 +!Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage +!InsertMacro MUI_PAGE_INSTFILES +Page custom EnterWriteTemplates +!Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt +!InsertMacro MUI_PAGE_FINISH + +!InsertMacro MUI_UNPAGE_WELCOME +!InsertMacro MUI_UNPAGE_CONFIRM +!InsertMacro MUI_UNPAGE_INSTFILES +!InsertMacro MUI_UNPAGE_FINISH + +!define MUI_ABORTWARNING + +!InsertMacro MUI_LANGUAGE "English" + +!InsertMacro GetParameters +!InsertMacro GetOptions + +DirText "Setup will install Bacula 32 bit ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder." + +!InsertMacro MUI_RESERVEFILE_INSTALLOPTIONS +; +; Global Variables +; +Var OptService +Var OptStart +Var OptSilent + +Var CommonFilesDone + +Var OsIsNT + +Var HostName + +Var ConfigClientName +Var ConfigClientPort +Var ConfigClientMaxJobs +Var ConfigClientPassword +Var ConfigClientInstallService +Var ConfigClientStartService + +Var ConfigStorageName +Var ConfigStoragePort +Var ConfigStorageMaxJobs +Var ConfigStoragePassword +Var ConfigStorageInstallService +Var ConfigStorageStartService + +Var ConfigDirectorName +Var ConfigDirectorPort +Var ConfigDirectorMaxJobs +Var ConfigDirectorPassword +Var ConfigDirectorAddress +Var ConfigDirectorMailServer +Var ConfigDirectorMailAddress +Var ConfigDirectorDB +Var ConfigDirectorInstallService +Var ConfigDirectorStartService + +Var ConfigMonitorName +Var ConfigMonitorPassword + +Var LocalDirectorPassword +Var LocalHostAddress + +Var MySQLPath +Var MySQLVersion +Var PostgreSQLPath +Var PostgreSQLVersion + +Var AutomaticInstall +Var InstallType + +!define NewInstall 0 +!define UpgradeInstall 1 +!define MigrateInstall 2 + +Var OldInstallDir +Var PreviousComponents +Var NewComponents + +; Bit 0 = File Service +; 1 = Storage Service +; 2 = Director Service +; 3 = Command Console +; 4 = Bat Console +; 5 = wxWidgits Console +; 6 = Documentation (PDF) +; 7 = Documentation (HTML) +; 8 = alldrives Plugin +; 9 = Old Exchange Plugin +; 10 = Tray Monitor +; 11 = winbmr Plugin + +!define ComponentFile 1 +!define ComponentStorage 2 +!define ComponentDirector 4 +!define ComponentTextConsole 8 +!define ComponentBatConsole 16 +!define ComponentGUIConsole 32 +!define ComponentPDFDocs 64 +!define ComponentHTMLDocs 128 +!define MUI_PAGE_LICENSE "${SRC_DIR}\INSTALL" +!define ComponentAllDrivesPlugin 256 +!define ComponentOldExchangePlugin 512 +!define ComponentTrayMonitor 1024 +; !define ComponentWinBMRPlugin 2048 + +!define ComponentsRequiringUserConfig 63 +!define ComponentsFileAndStorage 3 +!define ComponentsFileAndStorageAndDirector 7 +!define ComponentsDirectorAndTextGuiConsoles 60 +!define ComponentsTextAndGuiConsoles 56 + +Var HDLG +Var HCTL + +Function .onInit + Push $R0 + Push $R1 + + ; Process Command Line Options + StrCpy $OptService 1 + StrCpy $OptStart 1 + StrCpy $OptSilent 0 + StrCpy $CommonFilesDone 0 + StrCpy $OsIsNT 0 + StrCpy $AutomaticInstall 0 + StrCpy $InstallType ${NewInstall} + StrCpy $OldInstallDir "" + StrCpy $PreviousComponents 0 + StrCpy $NewComponents 0 + StrCpy $MySQLPath "" + StrCpy $MySQLVersion "" + StrCpy $PostgreSQLPath "" + StrCpy $PostgreSQLVersion "" + StrCpy $LocalDirectorPassword "" + + ${GetParameters} $R0 + + ClearErrors + ${If} ${RunningX64} + MessageBox MB_OK "This is a 32 bit program, but the OS is an x64. Aborting ..." /SD IDOK + Abort + ${EndIf} + + + ${GetOptions} $R0 "/noservice" $R1 + IfErrors +2 + StrCpy $OptService 0 + + ClearErrors + ${GetOptions} $R0 "/nostart" $R1 + IfErrors +2 + StrCpy $OptStart 0 + + IfSilent 0 +2 + StrCpy $OptSilent 1 + + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + ${If} $R0 != "" + StrCpy $OsIsNT 1 + ${EndIf} + + Call GetComputerName + Pop $HostName + + Call GetHostName + Pop $LocalHostAddress + + Call GetUserName + + ; Configuration Defaults + + StrCpy $ConfigClientName "$HostName-fd" + StrCpy $ConfigClientPort 9102 + StrCpy $ConfigClientMaxJobs 10 + ;StrCpy $ConfigClientPassword + StrCpy $ConfigClientInstallService "$OptService" + StrCpy $ConfigClientStartService "$OptStart" + + StrCpy $ConfigStorageName "$HostName-sd" + StrCpy $ConfigStoragePort 9103 + StrCpy $ConfigStorageMaxJobs 10 + ;StrCpy $ConfigStoragePassword + StrCpy $ConfigStorageInstallService "$OptService" + StrCpy $ConfigStorageStartService "$OptStart" + + StrCpy $ConfigDirectorPort 9101 + + StrCpy $ConfigMonitorName "$HostName-mon" + ;StrCpy $ConfigMonitorPassword + +; PLUGINSDIR refers to temporary helper programs and not Bacula plugins! + InitPluginsDir + File "/oname=$PLUGINSDIR\openssl.exe" "${SRC_DIR}\openssl.exe" + File "/oname=$PLUGINSDIR\libeay32.dll" "${SRC_DIR}\libeay32.dll" + File "/oname=$PLUGINSDIR\ssleay32.dll" "${SRC_DIR}\ssleay32.dll" + File "/oname=$PLUGINSDIR\sed.exe" "${SRC_DIR}\sed.exe" + + !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini" + !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini" + + SetPluginUnload alwaysoff + +; Generate random client password + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigClientPassword $R0 + FileClose $R1 + ${EndIf} + + SetPluginUnload manual + +; Generate random Storage daemon password + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigStoragePassword $R0 + FileClose $R1 + ${EndIf} + +; Generate random monitor password + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigMonitorPassword $R0 + FileClose $R1 + ${EndIf} + + Pop $R1 + Pop $R0 +FunctionEnd + +Function .onSelChange + Call UpdateComponentUI +FunctionEnd + +Function InstallCommonFiles + ${If} $CommonFilesDone = 0 + SetOutPath "$INSTDIR" + File "Readme.txt" + + SetOutPath "$INSTDIR" +!if "${BUILD_TOOLS}" == "MinGW32" + File "${SRC_DIR}\pthreadGCE2.dll" + File "${SRC_DIR}\ssleay32.dll" + File "${SRC_DIR}\libeay32.dll" + File "${SRC_DIR}\libwinpthread-1.dll" + File "${SRC_DIR}\libgcc_s_sjlj-1.dll" + File "${SRC_DIR}\libstdc++-6.dll" +!endif +!if "${BUILD_TOOLS}" == "MinGW64" + File "${SRC_DIR}\pthreadGCE.dll" + File "${SRC_DIR}\cryptoeay32-0.9.8.dll" + File "${SRC_DIR}\ssleay32-0.9.8.dll" +!endif + File "${SRC_DIR}\zlib1.dll" + File "${SRC_DIR}\bacula.dll" + + File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf" + File "${SRC_DIR}\openssl.exe" + File "${SRC_DIR}\bsleep.exe" + File "${SRC_DIR}\bsmtp.exe" + File "${SRC_DIR}\expr64.exe" + File "${SRC_DIR}\snooze.exe" + + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"' + + StrCpy $CommonFilesDone 1 + ${EndIf} +FunctionEnd + +Section "-Initialize" + + WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR" + + Call GetSelectedComponents + Pop $R2 + WriteRegDWORD HKLM Software\Bacula Components $R2 + + ; remove start menu items + SetShellVarContext all + + Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*" + Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*" + Delete /REBOOTOK "$SMPROGRAMS\Bacula\*" + RMDir "$SMPROGRAMS\Bacula\Configuration" + RMDir "$SMPROGRAMS\Bacula\Documentation" + RMDir "$SMPROGRAMS\Bacula" + CreateDirectory "$SMPROGRAMS\Bacula" + CreateDirectory "$SMPROGRAMS\Bacula\Configuration" + CreateDirectory "$SMPROGRAMS\Bacula\Documentation" + + CreateDirectory "$INSTDIR" + CreateDirectory "$INSTDIR\working" + CreateDirectory "$INSTDIR\plugins" + + SetOutPath "$INSTDIR" + File "${SRC_DIR}\LICENSE" + Delete /REBOOTOK "$INSTDIR\License.txt" + +; Output a series of SED commands to configure the .conf file(s) + FileOpen $R1 $PLUGINSDIR\config.sed w + FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n" + FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n" + FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n" + + StrCpy $R2 ${BUILD_TOOLS} + + Call GetHostName + Exch $R3 + Pop $R3 + + FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n" + + ${StrRep} $R2 "$INSTDIR\working" "\" "\\\\" + FileWrite $R1 's;@working_dir@;$R2;g$\r$\n' +; ${StrRep} $R2 "$INSTDIR\working" "\" "\\" +; FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n' + + ${StrRep} $R2 "$INSTDIR\plugins" "\" "\\\\" + FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n' + + ${StrRep} $R2 "$INSTDIR" "\" "/" + FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n" + + FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n" + FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n" + FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n" + FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n" + FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n" + FileWrite $R1 "s;@storage_address@;$LocalHostAddress;g$\r$\n" + FileWrite $R1 "s;@storage_name@;$ConfigStorageName;g$\r$\n" + FileWrite $R1 "s;@storage_port@;$ConfigStoragePort;g$\r$\n" + FileWrite $R1 "s;@storage_maxjobs@;$ConfigStorageMaxJobs;g$\r$\n" + FileWrite $R1 "s;@storage_password@;$ConfigStoragePassword;g$\r$\n" + FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n" + FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n" + FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n" + FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n" + FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n" + FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n" + + FileClose $R1 + + ${If} ${FileExists} "$OldInstallDir\bacula-fd.exe" + nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::Exec /TIMEOUT=200 'net stop bacula-fd' + Sleep 1000 + nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /remove' ; Remove existing service + ${EndIf} + + ${If} ${FileExists} "$INSTDIR\bacula-fd.exe" + nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::Exec /TIMEOUT=200 'net stop bacula-fd' + ${EndIf} + + ${If} ${FileExists} "$OldInstallDir\bin\bacula-sd.exe" + nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::Exec /TIMEOUT=200 'net stop bacula-sd' + Sleep 1000 + nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /remove' ; Remove existing service + ${EndIf} + + ${If} ${FileExists} "$INSTDIR\bacula-sd.exe" + nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::Exec /TIMEOUT=200 'net stop bacula-sd' + ${EndIf} + Sleep 1000 + + +SectionEnd + +SectionGroup "Client" SecGroupClient + +Section "File Service" SecFileDaemon + SectionIn 1 2 3 + + SetOutPath "$INSTDIR" + + File "${SRC_DIR}\bacula-fd.exe" + File "/oname=$PLUGINSDIR\bacula-fd.conf" "bacula-fd.conf.in" + + StrCpy $0 "$INSTDIR" + StrCpy $1 bacula-fd.conf + Call ConfigEditAndCopy + + StrCpy $0 bacula-fd + StrCpy $1 "File Service" + StrCpy $2 $ConfigClientInstallService + StrCpy $3 $ConfigClientStartService + + Call InstallDaemon + + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$INSTDIR\bacula-fd.conf"' +SectionEnd + +SectionGroupEnd + +SectionGroup "Server" SecGroupServer + +Section "Storage Service" SecStorageDaemon + SectionIn 2 3 + + SetOutPath "$INSTDIR" + + File "${SRC_DIR}\bacula-sd.exe" + File "${SRC_DIR}\bcopy.exe" + File "${SRC_DIR}\bextract.exe" + File "${SRC_DIR}\bls.exe" + + File "/oname=$PLUGINSDIR\bacula-sd.conf" "bacula-sd.conf.in" + + StrCpy $0 "$INSTDIR" + StrCpy $1 bacula-sd.conf + Call ConfigEditAndCopy + + StrCpy $0 bacula-sd + StrCpy $1 "Storage Service" + StrCpy $2 $ConfigStorageInstallService + StrCpy $3 $ConfigStorageStartService + Call InstallDaemon + + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Storage Configuration.lnk" "write.exe" '"$INSTDIR\bacula-sd.conf"' +SectionEnd + +SectionGroupEnd + + +SectionGroup "Consoles" SecGroupConsoles + +Section "Command Console" SecConsole + SectionIn 1 2 3 + + SetOutPath "$INSTDIR" + + File "${SRC_DIR}\bconsole.exe" + Call InstallCommonFiles + + File "/oname=$PLUGINSDIR\bconsole.conf" "bconsole.conf.in" + StrCpy $0 "$INSTDIR" + StrCpy $1 bconsole.conf + Call ConfigEditAndCopy + + CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bconsole.exe" '-c "$INSTDIR\bconsole.conf"' "$INSTDIR\bconsole.exe" 0 + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$INSTDIR\bconsole.conf"' + +SectionEnd + +Section "Bat Console" SecBatConsole + SectionIn 1 2 3 + + SetOutPath "$INSTDIR" + +!if "${BUILD_BAT}" == "yes" + Call InstallCommonFiles + File "${SRC_DIR}\QtCore4.dll" + File "${SRC_DIR}\QtGui4.dll" + File "${SRC_DIR}\libgcc_s_sjlj-1.dll" + + File "${SRC_DIR}\bat.exe" + + File "/oname=$PLUGINSDIR\bat.conf" "bat.conf.in" + StrCpy $0 "$INSTDIR" + StrCpy $1 bat.conf + Call ConfigEditAndCopy + + SetOutPath "$INSTDIR\help" + File "${SRC_DIR}\help\*" + SetOutPath "$INSTDIR" + + ; Create Start Menu entry + CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bat.exe" '-c "$INSTDIR\bat.conf"' "$INSTDIR\bat.exe" 0 + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$INSTDIR\bat.conf"' +!endif + +SectionEnd + +Section "Bacula Tray Monitor" SecTrayMonitor + SectionIn 1 2 3 + + SetOutPath "$INSTDIR" + +!if "${BUILD_BAT}" == "yes" + Call InstallCommonFiles + File "${SRC_DIR}\QtCore4.dll" + File "${SRC_DIR}\QtGui4.dll" + File "${SRC_DIR}\libgcc_s_sjlj-1.dll" +; File "${SRC_DIR}\bacula-tray-monitor.exe" + +; File "/oname=$PLUGINSDIR\bacula-tray-monitor.conf" "bacula-tray-monitor.conf.in" +; StrCpy $0 "$INSTDIR" +; StrCpy $1 bacula-tray-monitor.conf +; Call ConfigEditAndCopy + + ; Create Start Menu entry +; CreateShortCut "$SMPROGRAMS\Bacula\TrayMonitor.lnk" "$INSTDIR\bacula-tray-monitor.exe" "" "$INSTDIR\bacula-tray-monitor.exe" 0 +!endif + +SectionEnd + + +; Deleted because wxconsole is deprecated +;Section "Graphical Console" SecWxConsole +; SectionIn 1 2 3 + +; SetOutPath "$INSTDIR" +; +;SectionEnd + +SectionGroupEnd + + +SectionGroup "Plugins" SecGroupPlugins + +Section "alldrives Plugin" SecAllDrivesPlugin + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\plugins" + File "${SRC_DIR}\alldrives-fd.dll" + SetOutPath "$INSTDIR" + +SectionEnd + +;Section "winbmr Plugin" SecWinBMRPlugin +; SectionIn 1 2 3 + +; SetOutPath "$INSTDIR\plugins" +; File "${SRC_DIR}\winbmr-fd.dll" +; SetOutPath "$INSTDIR" + +;SectionEnd + +Section "Old (deprecated) Exchange Plugin" SecOldExchangePlugin + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\plugins" + File "${SRC_DIR}\exchange-fd.dll" + SetOutPath "$INSTDIR" + +SectionEnd + +SectionGroupEnd + + + +SectionGroup "Documentation" SecGroupDocumentation + +Section "Documentation (Acrobat Format)" SecDocPdf + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\doc" + CreateDirectory "$INSTDIR\doc" + + File "${SRC_DIR}\docs\manuals\en\console\console.pdf" + File "${SRC_DIR}\docs\manuals\en\misc\misc.pdf" + File "${SRC_DIR}\docs\manuals\en\main\main.pdf" + File "${SRC_DIR}\docs\manuals\en\utility\utility.pdf" + File "${SRC_DIR}\docs\manuals\en\problems\problems.pdf" + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Console.lnk" '"$INSTDIR\doc\console.pdf"' + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Main.lnk" '"$INSTDIR\doc\main.pdf"' + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Misc.lnk" '"$INSTDIR\doc\misc.pdf"' + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Utility.lnk" '"$INSTDIR\doc\utility.pdf"' + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Problems.lnk" '"$INSTDIR\doc\problems.pdf"' + SetOutPath "$INSTDIR" +SectionEnd + +;Section "Documentation (HTML Format)" SecDocHtml +; SectionIn 3 + +; SetOutPath "$INSTDIR\doc" +; CreateDirectory "$INSTDIR\doc" + +; File "${SRC_DIR}\manual\bacula\*.html" +; File "${SRC_DIR}\manual\bacula\*.png" +; File "${SRC_DIR}\manual\bacula\*.css" +; CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual (HTML).lnk" '"$INSTDIR\doc\index.html"' +;SectionEnd + +SectionGroupEnd + +Section "-Finish" + Push $R0 + + ${If} $OsIsNT = 1 + nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bacula-fd.conf" /G SYSTEM:F Administrators:F' + nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bacula-sd.conf" /G SYSTEM:F Administrators:F' + nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bat.conf" /G SYSTEM:F Administrators:F' + ${EndIf} + + ; Write the uninstall keys for Windows & create Start Menu entry + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Systems(R) Enterprise" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}" + ${StrTok} $R0 "${VERSION}" "." 0 0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0 + ${StrTok} $R0 "${VERSION}" "." 1 0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1 + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://www.baculasystems.com" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.baculasystems.com" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.baculasystems.com" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"' + WriteUninstaller "$INSTDIR\Uninstall.exe" + CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 + + ${If} $OsIsNT = 1 + nsExec::ExecToLog 'net start bacula-fd' + nsExec::ExecToLog 'net start bacula-sd' + ${Else} + Exec '"$INSTDIR\bacula-fd.exe" /service -c "$INSTDIR\bacula-fd.conf"' + Exec '"$INSTDIR\bacula-sd.exe" /service -c "$INSTDIR\bacula-sd.conf"' + ${EndIf} + + Pop $R0 +SectionEnd + +; Extra Page descriptions + +LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula 32 bit File Daemon on this system." +LangString DESC_SecStorageDaemon ${LANG_ENGLISH} "Install Bacula 32 bit Storage Daemon on this system." +LangString DESC_SecConsole ${LANG_ENGLISH} "Install bconsole program on this system." +LangString DESC_SecBatConsole ${LANG_ENGLISH} "Install Bat graphical console program on this system." +; LangString DESC_SecTrayMonitor ${LANG_ENGLISH} "Install Tray Monitor graphical program on this system." + LangString DESC_SecAllDrivesPlugin ${LANG_ENGLISH} "Install alldrives Plugin on this system." +; LangString DESC_SecWinBMRPlugin ${LANG_ENGLISH} "Install winbmr Plugin on this system." +LangString DESC_SecOldExchangePlugin ${LANG_ENGLISH} "Install old (deprecated) Exchange Plugin on this system." + + +LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration" +LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration." + +LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)" +LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration." + +LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type" +LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type." + +LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates" +LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create a resource template for inclusion in the Director's configuration file." + +!InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN + !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecStorageDaemon} $(DESC_SecStorageDaemon) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecBatConsole} $(DESC_SecBatConsole) +; !InsertMacro MUI_DESCRIPTION_TEXT ${SecTrayMonitor} $(DESC_SecTrayMonitor) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecAllDrivesPlugin} $(DESC_SecAllDrivesPlugin) +; !InsertMacro MUI_DESCRIPTION_TEXT ${SecWinBMRPlugin} $(DESC_SecWinBMRPlugin) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecOldExchangePlugin} $(DESC_SecOldExchangePlugin) +!InsertMacro MUI_FUNCTION_DESCRIPTION_END + +; Uninstall section + +UninstallText "This will uninstall Bacula. Click Uninstall to continue." + +Section "Uninstall" + ; Shutdown any baculum that could be running + nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill' + nsExec::Exec /TIMEOUT=200 'net stop bacula-fd' + Sleep 3000 + +; ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd" + ; Remove Bacula File Daemon service + nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /remove' + + ; Remove Bacula Storage Daemon service + nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /remove' + + ; remove registry keys + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" + DeleteRegKey HKLM "Software\Bacula" + + ; remove start menu items + SetShellVarContext all + Delete /REBOOTOK "$SMPROGRAMS\Bacula\*" + RMDir "$SMPROGRAMS\Bacula" + + ; remove files and uninstaller (preserving config for now) + Delete /REBOOTOK "$INSTDIR\doc\*" + Delete /REBOOTOK "$INSTDIR\openssl.exe" + Delete /REBOOTOK "$INSTDIR\bacula-fd.exe" + Delete /REBOOTOK "$INSTDIR\bsleep.exe" + Delete /REBOOTOK "$INSTDIR\bsmtp.exe" + Delete /REBOOTOK "$INSTDIR\bconsole.exe" + Delete /REBOOTOK "$INSTDIR\expr64.exe" + Delete /REBOOTOK "$INSTDIR\snooze.exe" + Delete /REBOOTOK "$INSTDIR\LICENSE" + Delete /REBOOTOK "$INSTDIR\Readme.txt" + Delete /REBOOTOK "$INSTDIR\*.dll" + Delete /REBOOTOK "$INSTDIR\*.cnf" + Delete /REBOOTOK "$INSTDIR\*.sed" + Delete /REBOOTOK "$INSTDIR\*.cmd" + Delete /REBOOTOK "$INSTDIR\*.sql" + Delete /REBOOTOK "$INSTDIR\help\*" + Delete /REBOOTOK "$INSTDIR\plugins\alldrives-fd.dll" + Delete /REBOOTOK "$INSTDIR\plugins\exchange-fd.dll" +; Delete /REBOOTOK "$INSTDIR\plugins\winbmr-fd.dll" + + ; Check for existing installation + IfSilent +2 + MessageBox MB_YESNO|MB_ICONQUESTION \ + "Would you like to delete the current configuration files and the working state file?" /SD IDNO IDNO NoDel + + + Delete /REBOOTOK "$INSTDIR\*" + Delete /REBOOTOK "$INSTDIR\working\*" + Delete /REBOOTOK "$PLUGINSDIR\bacula-*.conf" + Delete /REBOOTOK "$PLUGINSDIR\*console.conf" + Delete /REBOOTOK "$PLUGINSDIR\*conf.in" + RMDir /REBOOTOK "$INSTDIR\plugins" + RMDir /REBOOTOK "$INSTDIR\working" + RMDir /REBOOTOK "$INSTDIR" +NoDel: + ; remove directories used + + RMDir "$INSTDIR\plugins" + RMDir "$INSTDIR\working" + RMDir "$INSTDIR\doc" + RMDir "$INSTDIR\help" + RMDir "$INSTDIR" +SectionEnd + +; +; $0 - Service Name (ie Bacula-FD) +; $1 - Service Description (ie Bacula File Daemon) +; $2 - Install as Service +; $3 - Start Service now +; +Function InstallDaemon + Call InstallCommonFiles + + WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2 + + ${If} $2 = 1 + nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill' + nsExec::Exec /TIMEOUT=200 'net stop bacula-fd' + nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /kill' + nsExec::Exec /TIMEOUT=200 'net stop bacula-sd' + nsExec::ExecToLog '"$INSTDIR\$0.exe" /remove' + nsExec::ExecToLog '"$INSTDIR\$0.exe" /install -c "$INSTDIR\$0.conf"' + + ${If} $OsIsNT <> 1 + File "Start.bat" + File "Stop.bat" + ${EndIf} + + ${EndIf} + +FunctionEnd + +Function GetComputerName + Push $R0 + Push $R1 + Push $R2 + + System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2" + + ${StrCase} $R0 $R0 "L" + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +!define ComputerNameDnsFullyQualified 3 + +Function GetHostName + Push $R0 + Push $R1 + Push $R2 + + ${If} $OsIsNT = 1 + System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetComputerNameExA failed - LastError = $R2" + Call GetComputerName + Pop $R0 + ${Else} + Pop $R2 + ${EndIf} + ${Else} + Call GetComputerName + Pop $R0 + ${EndIf} + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +!define NameUserPrincipal 8 + +Function GetUserName + Push $R0 + Push $R1 + Push $R2 + + ${If} $OsIsNT = 1 + System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetUserNameExA failed - LastError = $R2" + Pop $R0 + StrCpy $R0 "" + ${Else} + Pop $R2 + ${EndIf} + ${Else} + StrCpy $R0 "" + ${EndIf} + + ${If} $R0 == "" + System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetUserNameA failed - LastError = $R2" + StrCpy $R0 "" + ${Else} + Pop $R2 + ${EndIf} + ${EndIf} + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +Function ConfigEditAndCopy + Push $R1 + + ${If} ${FileExists} "$0\$1" + StrCpy $R1 ".new" + ${Else} + StrCpy $R1 "" + ${EndIf} + + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\$1"' + CopyFiles "$PLUGINSDIR\$1" "$0\$1$R1" + + Pop $R1 +FunctionEnd + +Function GetSelectedComponents + Push $R0 + StrCpy $R0 0 + ${If} ${SectionIsSelected} ${SecFileDaemon} + IntOp $R0 $R0 | ${ComponentFile} + ${EndIf} + ${If} ${SectionIsSelected} ${SecStorageDaemon} + IntOp $R0 $R0 | ${ComponentStorage} + ${EndIf} + ${If} ${SectionIsSelected} ${SecConsole} + IntOp $R0 $R0 | ${ComponentTextConsole} + ${EndIf} + ${If} ${SectionIsSelected} ${SecBatConsole} + IntOp $R0 $R0 | ${ComponentBatConsole} + ${EndIf} +; ${If} ${SectionIsSelected} ${SecTrayMonitor} +; IntOp $R0 $R0 | ${ComponentTrayMonitor} +; ${EndIf} + ${If} ${SectionIsSelected} ${SecAllDrivesPlugin} + IntOp $R0 $R0 | ${ComponentAllDrivesPlugin} + ${EndIf} +; ${If} ${SectionIsSelected} ${SecWinBMRPlugin} +; IntOp $R0 $R0 | ${ComponentWinBMRPlugin} +; ${EndIf} + ${If} ${SectionIsSelected} ${SecOldExchangePlugin} + IntOp $R0 $R0 | ${ComponentOldExchangePlugin} + ${EndIf} + ${If} ${SectionIsSelected} ${SecDocPdf} + IntOp $R0 $R0 | ${ComponentPDFDocs} + ${EndIf} + Exch $R0 +FunctionEnd + +Function PageComponentsShow + Call SelectPreviousComponents + Call UpdateComponentUI +FunctionEnd + +Function PageDirectoryPre + ${If} $AutomaticInstall = 1 + ${OrIf} $InstallType = ${UpgradeInstall} + Abort + ${EndIf} +FunctionEnd + +Function LeaveInstallPage + Push "$INSTDIR\install.log" + Call DumpLog +FunctionEnd + +Function EnterWriteTemplates + Push $R0 + Push $R1 + + Call GetSelectedComponents + Pop $R0 + + IntOp $R0 $R0 & ${ComponentDirector} + IntOp $R1 $NewComponents & ${ComponentsFileAndStorage} + + ${If} $R0 <> 0 + ${OrIf} $R1 = 0 + Pop $R1 + Pop $R0 + Abort + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 = 0 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED + DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED + ${Else} + ;; TODO: See why this procedure causes a problem on Windows 2012 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0 + DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "$INSTDIR\$ConfigClientName.conf" + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST + + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 = 0 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 0 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags DISABLED + DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED + ${Else} + ;; TODO: See why this procedure causes a problem on Windows 2012 + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 0 + DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State "$INSTDIR\$ConfigStorageName.conf" + WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST + ${EndIf} + + !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)" + !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini" + + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State + ${If} $R0 <> 0 + File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in" + + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"' + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State + ${If} $R0 != "" + CopyFiles "$PLUGINSDIR\client.conf.in" "$R0" + ${EndIf} + ${EndIf} + + + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 4" State + ${If} $R0 <> 0 + File "/oname=$PLUGINSDIR\storage.conf.in" "storage.conf.in" + + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\storage.conf.in"' + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 5" State + ${If} $R0 != "" + CopyFiles "$PLUGINSDIR\storage.conf.in" "$R0" + ${EndIf} + ${EndIf} + + Pop $R1 + Pop $R0 +FunctionEnd + +Function SelectPreviousComponents + ${If} $InstallType <> ${NewInstall} + IntOp $R1 $PreviousComponents & ${ComponentFile} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecFileDaemon} + !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecFileDaemon} + !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentStorage} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecStorageDaemon} + !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecStorageDaemon} + !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentTextConsole} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecConsole} + !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecConsole} + !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentBatConsole} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecBatConsole} + !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecBatConsole} + !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_RO} + ${EndIf} +; IntOp $R1 $PreviousComponents & ${ComponentTrayMonitor} +; ${If} $R1 <> 0 +; !InsertMacro SelectSection ${SecTrayMonitor} +; !InsertMacro SetSectionFlag ${SecTrayMonitor} ${SF_RO} +; ${Else} +; !InsertMacro UnselectSection ${SecTrayMonitor} +; !InsertMacro ClearSectionFlag ${SecTrayMonitor} ${SF_RO} +; ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentAllDrivesPlugin} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecAllDrivesPlugin} + !InsertMacro SetSectionFlag ${SecAllDrivesPlugin} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecAllDrivesPlugin} + !InsertMacro ClearSectionFlag ${SecAllDrivesPlugin} ${SF_RO} + ${EndIf} +; IntOp $R1 $PreviousComponents & ${ComponentWinBMRPlugin} +; ${If} $R1 <> 0 +; !InsertMacro SelectSection ${SecWinBMRPlugin} +; !InsertMacro SetSectionFlag ${SecWinBMRPlugin} ${SF_RO} +; ${Else} +; !InsertMacro UnselectSection ${SecWinBMRPlugin} +; !InsertMacro ClearSectionFlag ${SecWinBMRPlugin} ${SF_RO} +; ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentOldExchangePlugin} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecOldExchangePlugin} + !InsertMacro SetSectionFlag ${SecOldExchangePlugin} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecOldExchangePlugin} + !InsertMacro ClearSectionFlag ${SecOldExchangePlugin} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentPDFDocs} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecDocPdf} + !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecDocPdf} + !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO} + ${EndIf} + ${EndIf} +FunctionEnd + +Function UpdateComponentUI + Push $R0 + Push $R1 + + Call GetSelectedComponents + Pop $R0 + + IntOp $R1 $R0 ^ $PreviousComponents + IntOp $NewComponents $R0 & $R1 + + ${If} $InstallType <> ${NewInstall} + IntOp $R1 $NewComponents & ${ComponentFile} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentStorage} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentTextConsole} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentBatConsole} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_BOLD} + ${EndIf} +; IntOp $R1 $NewComponents & ${ComponentTrayMonitor} +; ${If} $R1 <> 0 +; !InsertMacro SetSectionFlag ${SecTrayMonitor} ${SF_BOLD} +; ${Else} +; !InsertMacro ClearSectionFlag ${SecTrayMonitor} ${SF_BOLD} +; ${EndIf} + IntOp $R1 $NewComponents & ${ComponentAllDrivesPlugin} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecAllDrivesPlugin} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecAllDrivesPlugin} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentOldExchangePlugin} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecOldExchangePlugin} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecOldExchangePlugin} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentPDFDocs} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_BOLD} + ${EndIf} + ${EndIf} + + GetDlgItem $R0 $HWNDPARENT 1 + + IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig} + ${If} $R1 = 0 + SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install" + ${Else} + SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >" + ${EndIf} + + Pop $R1 + Pop $R0 +FunctionEnd + +!include "InstallType.nsh" +!include "ConfigPage1.nsh" +!include "ConfigPage2.nsh" +!include "DumpLog.nsh" diff --git a/bacula/src/win32/win32_installer/x64.nsh b/bacula/src/win32/win32_installer/x64.nsh new file mode 100644 index 0000000000..e694c1e613 --- /dev/null +++ b/bacula/src/win32/win32_installer/x64.nsh @@ -0,0 +1,54 @@ +; --------------------- +; x64.nsh +; --------------------- +; +; A few simple macros to handle installations on x64 machines. +; +; RunningX64 checks if the installer is running on x64. +; +; ${If} ${RunningX64} +; MessageBox MB_OK "running on x64" +; ${EndIf} +; +; DisableX64FSRedirection disables file system redirection. +; EnableX64FSRedirection enables file system redirection. +; +; SetOutPath $SYSDIR +; ${DisableX64FSRedirection} +; File some.dll # extracts to C:\Windows\System32 +; ${EnableX64FSRedirection} +; File some.dll # extracts to C:\Windows\SysWOW64 +; + +!ifndef ___X64__NSH___ +!define ___X64__NSH___ + +!include LogicLib.nsh + +!macro _RunningX64 _a _b _t _f + !insertmacro _LOGICLIB_TEMP + System::Call kernel32::GetCurrentProcess()i.s + System::Call kernel32::IsWow64Process(is,*i.s) + Pop $_LOGICLIB_TEMP + !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` +!macroend + +!define RunningX64 `"" RunningX64 ""` + +!macro DisableX64FSRedirection + + System::Call kernel32::Wow64EnableWow64FsRedirection(i0) + +!macroend + +!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection" + +!macro EnableX64FSRedirection + + System::Call kernel32::Wow64EnableWow64FsRedirection(i1) + +!macroend + +!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection" + +!endif # !___X64__NSH___ diff --git a/bacula/src/win32/win64_installer/ConfigPage1.nsh b/bacula/src/win32/win64_installer/ConfigPage1.nsh new file mode 100644 index 0000000000..2a16fb55fe --- /dev/null +++ b/bacula/src/win32/win64_installer/ConfigPage1.nsh @@ -0,0 +1,294 @@ +Function EnterConfigPage1 + ${If} $AutomaticInstall = 1 + Abort + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsFileAndStorage} + + ${If} $R0 = 0 + Abort + ${EndIf} + + FileOpen $R5 "$PLUGINSDIR\ConfigPage1.ini" w + + StrCpy $R6 1 ; Field Number + StrCpy $R7 0 ; Top + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 52 + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Client"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigClientName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigClientPort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigClientMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigClientPassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigClientInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigClientStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 52 + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Storage"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigStorageName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigStoragePort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 2 + + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigStorageMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigStoragePassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigStorageInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigStorageStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + ${Endif} + + IntOp $R6 $R6 - 1 + + FileWrite $R5 "[Settings]$\r$\nNumFields=$R6$\r$\n" + + FileClose $R5 + + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage1)" "$(SUBTITLE_ConfigPage1)" + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ConfigPage1.ini" + Pop $HDLG ;HWND of dialog + + ; Initialize Controls + + StrCpy $R6 1 ; Field Number + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + + ; Client Name + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + + IntOp $R6 $R6 + 2 + + ; Client Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + + IntOp $R6 $R6 + 2 + + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 5 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + + ; Storage Name + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + + IntOp $R6 $R6 + 2 + + ; Storage Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + + IntOp $R6 $R6 + 2 + + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 5 + ${Endif} + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process results + + StrCpy $R6 3 + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientName "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPort "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientMaxJobs "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPassword "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientInstallService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientStartService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 3 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageName "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStoragePort "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageMaxJobs "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStoragePassword "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageInstallService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 1 + + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageStartService "ConfigPage1.ini" "Field $R6" "State" + + IntOp $R6 $R6 + 3 + ${Endif} +FunctionEnd + +Function LeaveConfigPage1 + StrCpy $R6 5 + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 9 + ${Endif} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 <> 0 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 2 + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + + IntOp $R6 $R6 + 9 + ${Endif} +FunctionEnd diff --git a/bacula/src/win32/win64_installer/ConfigPage2.nsh b/bacula/src/win32/win64_installer/ConfigPage2.nsh new file mode 100644 index 0000000000..ed7c5f519c --- /dev/null +++ b/bacula/src/win32/win64_installer/ConfigPage2.nsh @@ -0,0 +1,455 @@ +Function EnterConfigPage2 + IntOp $R0 $NewComponents & ${ComponentsRequiringUserConfig} + + ${If} $R0 = 0 + Abort + ${EndIf} + + FileOpen $R5 "$PLUGINSDIR\ConfigPage2.ini" w + + StrCpy $R6 1 ; Field Number + StrCpy $R7 0 ; Top + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + ${If} $AutomaticInstall = 1 + IntOp $R8 $R7 + 54 + ${Else} + IntOp $R8 $R7 + 92 + ${EndIf} + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Director"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R8 $R7 + 54 + ${Else} + IntOp $R8 $R7 + 26 + ${EndIf} + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Enter Director Information"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + ${EndIf} + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + ${If} "$ConfigDirectorName" == "" + StrCpy $ConfigDirectorName "$HostName-dir" + ${EndIf} + ${If} "$ConfigDirectorPassword" == "" + StrCpy $ConfigDirectorPassword "$LocalDirectorPassword" + ${EndIf} + ${Else} + ${If} "$ConfigDirectorName" == "$HostName-dir" + StrCpy $ConfigDirectorName "" + ${EndIf} + ${If} "$ConfigDirectorPassword" == "$LocalDirectorPassword" + StrCpy $ConfigDirectorPassword "" + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="DIR Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=60$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorName$\r$\nLeft=60$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="DIR Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigDirectorPort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R8 - 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigDirectorMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + IntOp $R7 $R7 + 14 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="DIR Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=60$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorPassword$\r$\nLeft=60$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Mail Server"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=48$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorMailServer$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Mail Address"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=48$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorMailAddress$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Database"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + ${If} $ConfigDirectorDB = 0 + ${If} $MySQLPath != "" + StrCpy $ConfigDirectorDB 1 + ${ElseIf} $PostgreSQLPath != "" + StrCpy $ConfigDirectorDB 2 + ${Else} + StrCpy $ConfigDirectorDB 3 + ${EndIf} + ${EndIf} + + ${If} $ConfigDirectorDB = 1 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="MySQL"$\r$\nFlags="GROUP"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=90$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + + ${If} $ConfigDirectorDB = 2 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="PostgreSQL"$\r$\nFlags="NOTABSTOP"$\r$\nLeft=94$\r$\nTop=$R7$\r$\nRight=146$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + + ${If} $ConfigDirectorDB = 3 + StrCpy $R9 1 + ${Else} + StrCpy $R9 0 + ${EndIf} + + FileWrite $R5 '[Field $R6]$\r$\nType="RadioButton"$\r$\nState=$R9$\r$\nText="Sqlite"$\r$\nFlags="NOTABSTOP"$\r$\nLeft=150$\r$\nTop=$R7$\r$\nRight=182$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + ${If} $AutomaticInstall = 0 + IntOp $R8 $R7 + 10 + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigDirectorInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + + FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigDirectorStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R7 $R7 + 2 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="DIR Address"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=60$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigDirectorAddress$\r$\nLeft=60$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 14 + IntOp $R8 $R7 + 8 + ${EndIf} + ${EndIf} + + IntOp $R7 $R7 + 4 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + IntOp $R0 0 & 0 + ${If} $R0 <> 0 + IntOp $R8 $R7 + 42 + + FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Monitor"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 12 + + IntOp $R8 $R7 + 8 + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + + IntOp $R8 $R8 + 2 + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigMonitorName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=150$\r$\nBottom=$R8$\r$\n$\r$\n' + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 16 + IntOp $R8 $R7 + 8 + + FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 - 2 + IntOp $R8 $R8 + 2 + + FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigMonitorPassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n' + + IntOp $R6 $R6 + 1 + IntOp $R7 $R7 + 20 + ${EndIf} + ${EndIf} + + IntOp $R6 $R6 - 1 + FileWrite $R5 "[Settings]$\r$\nNumFields=$R6$\r$\n" + + FileClose $R5 + + IntOp $R0 $NewComponents & ${ComponentsFileAndStorage} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 1 + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage1)" "$(SUBTITLE_ConfigPage1)" + ${Else} + !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage2)" "$(SUBTITLE_ConfigPage2)" + ${EndIf} + + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ConfigPage2.ini" + Pop $HDLG ;HWND of dialog + + ; Initialize Controls + StrCpy $R6 2 ; Field Number + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + ; Name + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + ; Port Number + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 5 0 + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + ; Max Jobs + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 3 0 + + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 9 + + ${If} $AutomaticInstall = 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage2.ini" "Field $R6" "HWND" + SendMessage $HCTL ${EM_LIMITTEXT} 30 0 + IntOp $R6 $R6 + 2 + ${EndIf} + ${EndIf} + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process results + + StrCpy $R6 2 + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 = 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorName "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorPort "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMaxJobs "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + ${OrIf} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorPassword "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMailServer "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorMailAddress "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 1 + ${Endif} + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 2 + ${Endif} + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R5 = 1 + StrCpy $ConfigDirectorDB 3 + ${Endif} + IntOp $R6 $R6 + 1 + + ${If} $AutomaticInstall = 0 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorInstallService "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorStartService "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${Else} + IntOp $R0 $NewComponents & ${ComponentsTextAndGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorAddress "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} + + ${If} $AutomaticInstall = 0 + IntOp $R0 $NewComponents & ${ComponentsFileAndStorageAndDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMonitorName "ConfigPage2.ini" "Field $R6" "State" + IntOp $R6 $R6 + 2 + !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMonitorPassword "ConfigPage2.ini" "Field $R6" "State" + ${EndIf} + ${EndIf} +FunctionEnd + +Function LeaveConfigPage2 + ${If} $AutomaticInstall = 0 + StrCpy $R6 4 + + IntOp $R0 $NewComponents & ${ComponentsDirectorAndTextGuiConsoles} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R0 < 1024 + ${OrIf} $R0 > 65535 + MessageBox MB_OK "Port must be between 1024 and 65535 inclusive." + Abort + ${EndIf} + IntOp $R6 $R6 + 1 + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentDirector} + ${If} $R0 <> 0 + IntOp $R6 $R6 + 1 + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage2.ini" "Field $R6" "State" + ${If} $R0 < 1 + ${OrIf} $R0 > 99 + MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive." + Abort + ${EndIf} + IntOp $R6 $R6 + 1 + ${EndIf} + ${EndIf} +FunctionEnd diff --git a/bacula/src/win32/win64_installer/DumpLog.nsh b/bacula/src/win32/win64_installer/DumpLog.nsh new file mode 100644 index 0000000000..71fb258074 --- /dev/null +++ b/bacula/src/win32/win64_installer/DumpLog.nsh @@ -0,0 +1,48 @@ +!ifndef LVM_GETITEMCOUNT +!define LVM_GETITEMCOUNT 0x1004 +!endif +!define LVM_GETITEMTEXT 0x102D + +Function DumpLog + Exch $5 + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $6 + + FindWindow $0 "#32770" "" $HWNDPARENT + GetDlgItem $0 $0 1016 + StrCmp $0 0 error + FileOpen $5 $5 "w" + StrCmp $5 0 error + SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6 + System::Alloc ${NSIS_MAX_STRLEN} + Pop $3 + StrCpy $2 0 + System::Call "*(i, i, i, i, i, i, i, i, i) i \ + (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1" + loop: StrCmp $2 $6 done + System::Call "User32::SendMessageA(i, i, i, i) i \ + ($0, ${LVM_GETITEMTEXT}, $2, r1)" + System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)" + FileWrite $5 "$4$\r$\n" + IntOp $2 $2 + 1 + Goto loop + done: + FileClose $5 + System::Free $1 + System::Free $3 + Goto exit + error: + MessageBox MB_OK error + exit: + Pop $6 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + Exch $5 +FunctionEnd diff --git a/bacula/src/win32/win64_installer/InstallType.ini b/bacula/src/win32/win64_installer/InstallType.ini new file mode 100644 index 0000000000..73fb8d9390 --- /dev/null +++ b/bacula/src/win32/win64_installer/InstallType.ini @@ -0,0 +1,56 @@ +; +; Note: certain text in this file is overwritten by the code in +; InstallType.nsh +; + +[Settings] +NumFields=6 + +[Field 1] +Type=Label +Text=This is a new installation. Please choose the installation type. +Left=0 +Right=300 +Top=0 +Bottom=28 + +[Field 2] +Type=GroupBox +Text=Installation Type +Left=0 +Right=300 +Top=32 +Bottom=136 + +[Field 3] +Type=RadioButton +Text=Automatic +State=1 +Left=6 +Right=52 +Top=44 +Bottom=54 + +[Field 4] +Type=RadioButton +Text=Custom (not recommended) +Left=6 +Right=252 +Top=90 +Bottom=100 + +[Field 5] +Type=Label +Text=The software will be installed in the default directory "Program Files\\Bacula". The configuration files will be generated using defaults applicable to most installations. +Left=17 +Right=295 +Top=58 +Bottom=86 + +[Field 6] +Type=Label +Text=You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work. +Left=17 +Right=295 +Top=104 +Bottom=132 diff --git a/bacula/src/win32/win64_installer/InstallType.nsh b/bacula/src/win32/win64_installer/InstallType.nsh new file mode 100644 index 0000000000..cde1791b82 --- /dev/null +++ b/bacula/src/win32/win64_installer/InstallType.nsh @@ -0,0 +1,99 @@ +Function EnterInstallType + Push $R0 + Push $R1 + Push $R2 + + ; Check if this is an upgrade by looking for an uninstaller configured + ; in the registry. + ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" + + ${If} "$R0" != "" + ; Check registry for new installer + ReadRegStr $R1 HKLM "Software\Bacula" "InstallLocation" + ${If} "$R1" != "" + ; New Installer + StrCpy $OldInstallDir $R1 + StrCpy $InstallType ${UpgradeInstall} + + SetShellVarContext all + + StrCpy $R1 "$APPDATA\Bacula" + StrCpy $R2 "$INSTDIR\Doc" + + ReadRegDWORD $PreviousComponents HKLM "Software\Bacula" "Components" + + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "A previous installation has been found in $OldInstallDir. Please choose the installation type for any additional components you select." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The configuration files for additional components will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + + ReadRegDWORD $ConfigDirectorDB HKLM Software\Bacula Database + + ${If} $ConfigDirectorDB = 0 + IntOp $R0 $PreviousComponents & ${ComponentDirector} + ${If} $R0 <> 0 + StrCpy $ConfigDirectorDB 1 + ${EndIf} + ${EndIf} + ${Else} + ; Processing Upgrade - Get Install Directory + ${StrRep} $R0 $R0 '"' '' + ${GetParent} $R0 $OldInstallDir + + ; Old Installer + StrCpy $InstallType ${MigrateInstall} + StrCpy $R1 "$OldInstallDir\bin" + StrCpy $R2 "$OldInstallDir\Doc" + + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "An old installation has been found in $OldInstallDir. The Configuration will be migrated. Please choose the installation type for any additional components you select." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"C:\Program Files\Bacula$\". The configuration files for additional components will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + ${EndIf} + ${Else} + ; New Install + StrCpy $InstallType ${NewInstall} + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"C:\Program Files\Bacula$\". The configuration files will be generated using defaults applicable to most installations." + WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." + ${EndIf} + + ${If} $InstallType <> ${NewInstall} + ${AndIf} $PreviousComponents = 0 + ${If} ${FileExists} "$R1\bacula-fd.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentFile} + ${EndIf} + ${If} ${FileExists} "$R1\bconsole.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole} + ${EndIf} + ${If} ${FileExists} "$R1\bat.conf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentBatConsole} + ${EndIf} + ${If} ${FileExists} "$R1\plugins\alldrives-fd.dll" + IntOp $PreviousComponents $PreviousComponents | ${ComponentAllDrivesPlugin} + ${EndIf} + ${If} ${FileExists} "$R1\plugins\exchange-fd.dll" + IntOp $PreviousComponents $PreviousComponents | ${ComponentOldExchangePlugin} + ${EndIf} + ${If} ${FileExists} "$R2\main.pdf" + IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs} + ${EndIf} + ${EndIf} + + !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)" + !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini" + Pop $HDLG ;HWND of dialog + + !insertmacro MUI_INSTALLOPTIONS_SHOW + + ; Process Results + + !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State" + + ${If} $R0 = 1 + StrCpy $AutomaticInstall 1 + ${Else} + StrCpy $AutomaticInstall 0 + ${EndIf} + + Pop $R2 + Pop $R1 + Pop $R0 +FunctionEnd diff --git a/bacula/src/win32/win64_installer/Makefile b/bacula/src/win32/win64_installer/Makefile new file mode 100644 index 0000000000..753fb06d96 --- /dev/null +++ b/bacula/src/win32/win64_installer/Makefile @@ -0,0 +1,207 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written by Eric Bollengier, March 2009 +# based on work by Robert Nelson +# + +include ../Makefile.inc + +VERSION := $(shell sed -ne 's/^.define[ \t]VERSION[ \t][ \t]*"\(.*\)"/\1/p' < ../../version.h) +RELEASE ?= $(shell awk '/define RELEASE [0-9]+/ { print $$3 }' ../../version.h) + +DEFINES := \ + -DVERSION=$(VERSION) \ + -DOUT_DIR=$(BUILDDIR)/release64 \ + -DSRC_DIR=release64 \ + -DSRC64_DIR=$(BUILDDIR)/win64_installer/release64 \ + -DSRC32_DIR=$(BUILDDIR)/win32_installer/release32 \ + -DWINVER=64 \ + -DBUILD_TOOLS=MinGW64 \ + -DBUILD_BAT=$(BUILD_BAT) + +INSTALL_EXE := $(BUILDDIR)/release64/winbacula-$(VERSION).exe + +BACULABINARIES := \ + bacula.dll \ + alldrives-fd.dll \ + exchange-fd.dll \ + bsleep.exe \ + bsmtp.exe \ + bconsole.exe \ + bacula-fd.exe \ + bacula-sd.exe \ + bextract.exe \ + bls.exe \ + bcopy.exe + +DEPKGS_BINARIES := \ + openssl.exe \ + sed.exe \ + expr64.exe \ + snooze.exe \ + QtCore4.dll \ + QtGui4.dll \ + pthreadGCE2.dll \ + libwinpthread-1.dll \ + libgcc_s_seh-1.dll \ + libstdc++-6.dll \ + libeay32.dll \ + ssleay32.dll \ + zlib1.dll + +# libgcc_s_dw2-1.dll + +NONGCC_BINARIES := \ + libmysql.dll + +NONGCC_LIBRARIES := \ + libpq.dll + +MINGW_BINARIES := + +SCRIPT_FILES := \ + mtx-changer.cmd \ + disk-changer.cmd \ + dvd-handler.cmd + +CAT_FILES := \ + create_mysql_database.cmd \ + drop_mysql_database.cmd \ + make_mysql_tables.cmd \ + make_mysql_tables.sql \ + drop_mysql_tables.cmd \ + drop_mysql_tables.sql \ + grant_mysql_privileges.cmd \ + grant_mysql_privileges.sql \ + make_mysql_catalog_backup.cmd \ + create_postgresql_database.cmd \ + create_postgresql_database.sql \ + drop_postgresql_database.cmd \ + make_postgresql_tables.cmd \ + make_postgresql_tables.sql \ + drop_postgresql_tables.cmd \ + drop_postgresql_tables.sql \ + grant_postgresql_privileges.cmd \ + grant_postgresql_privileges.sql \ + make_postgresql_catalog_backup.cmd \ + create_sqlite3_database.cmd \ + drop_sqlite3_database.cmd \ + make_sqlite3_tables.cmd \ + make_sqlite3_tables.sql \ + drop_sqlite3_tables.cmd \ + grant_sqlite3_privileges.cmd \ + make_sqlite3_catalog_backup.cmd \ + delete_catalog_backup.cmd + +DIRD_FILES := \ + query.sql + +SSL_FILES := \ + openssl.cnf + +LICENSE_FILES := \ + LICENSE + +ifeq ($(bat),no) + BACULA_BINARIES=$(BACULABINARIES) + HELP= +else + BACULA_BINARIES=$(BACULABINARIES) bat.exe #bacula-tray-monitor.exe + HELP=help +endif + + +EXTRA= + +########################################################################## + +# Targets + +.PHONY: all clean installer distclean + +all: $(HELP) docs $(INSTALL_EXE) $(EXTRA) + +installer: $(HELP) docs $(INSTALL_EXE) + +distclean: clean + +clean: + @echo "Cleaning `pwd`" + $(CMD_ECHO)-rm -f $(INSTALL_EXE) + $(CMD_ECHO)-rm -rf release64 + +help: + rm -rf release64/help + mkdir -p release64/help + cp -f $(BINDIR)/help/* release64/help/ + +docs: + rm -rf release64/docs + mkdir -p release64/docs/manuals/en/console + mkdir -p release64/docs/manuals/en/main + mkdir -p release64/docs/manuals/en/misc + mkdir -p release64/docs/manuals/en/problems + mkdir -p release64/docs/manuals/en/utility + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/console/console.pdf release64/docs/manuals/en/console/ + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/main/main.pdf release64/docs/manuals/en/main/ + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/misc/misc.pdf release64/docs/manuals/en/misc/ + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/problems/problems.pdf release64/docs/manuals/en/problems/ + cp -f $(DOCDIR)/docs/manuals/en/pdf-and-html/utility/utility.pdf release64/docs/manuals/en/utility/ + +# +# Rules +# + +define Convert_Binary +release64/$$(notdir $(1)): $(1) + $$(call checkdir,$$@) + $(ECHO_CMD)cp -f $$^ $$@ +endef + +define Copy_Binary +release64/$$(notdir $(1)): $(1) + $$(call checkdir,$$@) + $(ECHO_CMD)cp -f $$^ $$@ +endef + +define Copy_Docs +release64/$(1): $(DOCDIR)/$(1) + $$(call checkdir,$$@) + $(ECHO_CMD)cp -f $$^ $$(dir $$@) +endef + +define Copy_Licenses +release64/$$(notdir $(1)): $(1) + $$(call checkdir,$$@) + $(ECHO_CMD)cp -f $$^ $$(dir $$@) +endef + +$(foreach file,$(addprefix $(DEPKGS)/bin/, $(DEPKGS_BINARIES)),$(eval $(call Convert_Binary,$(file)))) + +$(foreach file,$(addprefix $(DEPKGS)/bin/, $(NONGCC_BINARIES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix $(DEPKGS)/lib/, $(NONGCC_LIBRARIES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix $(BINDIR)/, $(BACULA_BINARIES)),$(eval $(call Convert_Binary,$(file)))) + +$(foreach file,$(addprefix $(MINGW_DLLDIR)/, $(MINGW_BINARIES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix $(DEPKGS)/ssl/, $(SSL_FILES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix ../scripts/, $(SCRIPT_FILES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix ../cats/, $(CAT_FILES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix ../../dird/, $(DIRD_FILES)),$(eval $(call Copy_Binary,$(file)))) + +$(foreach file,$(addprefix $(MAINDIR)/, $(LICENSE_FILES)),$(eval $(call Copy_Licenses,$(file)))) + +#$(foreach file,$(DOC_FILES),$(eval $(call Copy_Docs,$(file)))) + +$(INSTALL_EXE): winbacula.nsi $(addprefix release64/,$(BACULA_BINARIES) $(DEPKGS_BINARIES) $(SSL_FILES) $(LICENSE_FILES)) + makensis -V3 $(DEFINES) winbacula.nsi + echo " " + +include $(BUILDDIR)/Makefile.rules diff --git a/bacula/src/win32/win64_installer/Readme.txt b/bacula/src/win32/win64_installer/Readme.txt new file mode 100755 index 0000000000..2e5a3d1d17 --- /dev/null +++ b/bacula/src/win32/win64_installer/Readme.txt @@ -0,0 +1,50 @@ +Bacula - Windows Version Disclaimer +=================================== + +Please note, only the Win64 Client (File daemon) is supported. +The other components (Director, Storage daemon, +their utilities) are not provided because they have not been ported. + +Note: the Win64 Client can only be installed on 64 bit Windows Operating +systems. + + +Bacula - Windows Version Notes +============================== + +These notes highlight how the Windows version of Bacula differs from the +other versions. It also provides any notes additional to the documentation. + +For detailed documentation on using, configuring and troubleshooting Bacula, +please consult the installed documentation or the online documentation at +http://www.bacula.org/?page=documentation. + + +Start Menu Items +---------------- +A number of menu items have been created in the Start menu under All Programs +in the Bacula submenu. They may be selected to edit the configuration files, +view the documentation or run one of the console or utility programs. The +choices available will vary depending on the options you chose to install. + + +File Locations +-------------- +Everything is installed in the directory +"C:\Program Files\Bacula" unless a different directory was selected during +installation. Note: due to a bug in the NSIS installer we are using, on +64 bit machines appears to install Bacula in "C:\Program Files (x86)\Bacula". + +Code Page Problems +------------------- +Please note that Bacula expects the contents of the configuration files to be +written in UTF-8 format. Some translations of "Application Data" have accented +characters, and apparently the installer writes this translated data in the +standard Windows code page coding. This occurs for the Working Directory, and +when it happens the daemon will not start since Bacula cannot find the directory. +The workaround is to manually edit the appropriate conf file and ensure that it +is written out in UTF-8 format. + +The conf files can be edited with any UTF-8 compatible editor, or on most +modern Windows machines, you can edit them with notepad, then choose UTF-8 +output encoding before saving them. diff --git a/bacula/src/win32/win64_installer/Start.bat b/bacula/src/win32/win64_installer/Start.bat new file mode 100644 index 0000000000..0b61f7ec1d --- /dev/null +++ b/bacula/src/win32/win64_installer/Start.bat @@ -0,0 +1,5 @@ +rem +rem Bacula start file for Win95/98/Me +rem +cd c:\bacula\bin +c:\bacula\bin\bacula-fd.exe /service -c c:\bacula\bin\bacula-fd.conf diff --git a/bacula/src/win32/win64_installer/Stop.bat b/bacula/src/win32/win64_installer/Stop.bat new file mode 100644 index 0000000000..3b1d0e5b91 --- /dev/null +++ b/bacula/src/win32/win64_installer/Stop.bat @@ -0,0 +1,5 @@ +rem +rem Bacula stop file for Win95/98/Me +rem +cd c:\bacula\bin +c:\bacula\bin\bacula-fd.exe /kill diff --git a/bacula/src/win32/win64_installer/WriteTemplates.ini b/bacula/src/win32/win64_installer/WriteTemplates.ini new file mode 100644 index 0000000000..3b3631c3ff --- /dev/null +++ b/bacula/src/win32/win64_installer/WriteTemplates.ini @@ -0,0 +1,30 @@ +[Settings] +NumFields=3 +CancelEnabled=0 +BackEnabled=0 + +[Field 1] +Type="Label" +Text="A Template of the Client resource can be generated that contains the information about this Client. This template can then be copied to the Director computer and included in the Director's configuration file." +Left=7 +Right=293 +Top=6 +Bottom=32 + +[Field 2] +Type="CheckBox" +Text="Save Client template in:" +Left=6 +Right=240 +Top=38 +Bottom=48 + +[Field 3] +Type="FileRequest" +State="Client.conf" +Flags= +Filter=Configuration Files|*.conf|All Files|*.* +Left=16 +Right=288 +Top=50 +Bottom=62 diff --git a/bacula/src/win32/win64_installer/bacula-dir.conf.in b/bacula/src/win32/win64_installer/bacula-dir.conf.in new file mode 100644 index 0000000000..35c4dddfb4 --- /dev/null +++ b/bacula/src/win32/win64_installer/bacula-dir.conf.in @@ -0,0 +1,383 @@ +# +# Default Bacula Director Configuration file +# +# Copyright (C) 2000-2015 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# The only thing that MUST be changed is to add one or more +# file or directory names in the Include directive of the +# FileSet resource. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ @DISTVER@ +# +# You might also want to change the default email address +# from root to your address. See the "mail" and "operator" +# directives in the Messages resource. +# + +Director { # define myself + Name = @director_name@ + DIRport = @director_port@ # where we listen for UA connections + QueryFile = "@bin_dir@\\query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@working_dir@" + Maximum Concurrent Jobs = @director_maxjobs@ + Password = "@director_password@" # Console password + Messages = Daemon +} + +JobDefs { + Name = "DefaultJob" + Type = Backup + Level = Incremental + Client = @client_name@ + FileSet = "Test Set" + Schedule = "WeeklyCycle" + Storage = File + Messages = Standard + Pool = Default + Priority = 10 +} + + +# +# Define the main nightly save backup job +# By default, this job will back up to disk in C:/tmp +Job { + Name = "Client1" + JobDefs = "DefaultJob" + Write Bootstrap = "@working_dir@\\Client1.bsr" +} + +#Job { +# Name = "Client2" +# Client = @client_name@2 +# JobDefs = "DefaultJob" +# Write Bootstrap = "@working_dir@\\Client2.bsr" +#} + +# Backup the catalog database (after the nightly save) +Job { + Name = "BackupCatalog" + JobDefs = "DefaultJob" + Level = Full + FileSet="Catalog" + Schedule = "WeeklyCycleAfterBackup" + # This creates an ASCII copy of the catalog + RunBeforeJob = "\"@bin_dir@\\make_catalog_backup\" bacula bacula" + # This deletes the copy of the catalog + RunAfterJob = "\"@bin_dir@\\delete_catalog_backup\"" + Write Bootstrap = "@working_dir@\\BackupCatalog.bsr" + Priority = 11 # run after main backup +} + +# +# Standard Restore template, to be changed by Console program +# Only one such job is needed for all Jobs/Clients/Storage ... +# +Job { + Name = "RestoreFiles" + Type = Restore + Client=@client_name@ + FileSet="Test Set" + Storage = File + Pool = Default + Messages = Standard + Where = "C:\\tmp\\bacula-restores" +} + +# +# Note: Windows path separators do NOT work correctly in FileSets. +# +# List of files to be backed up +FileSet { + Name = "Test Set" + Include { + Options { + signature = MD5 + ignore case = yes + } +# +# Put your list of files here, preceded by 'File =', one per line +# or include an external list with: +# +# File = (+Y|FC8 zmOZw|Gal!0nw_-c-FyN6M;J?6wOu2tU|-(=h88B z5AY}T*@vv8B%KuzG!o#k% zKlj}qbANtOKV}LkZ4*Tw-zc%MP9o$@0sA|Kxj@Lng0#SQE>^6i{O-h$H1hdtLNYLD z?HYe<_kW)JOcZ~zRA_2mM92-6{fJ@j6Y@CB+xz{6N`75*u~0NFg1t9hba%Xnj*siJ z+5|eR{7UcX>)Z%M^oDzD`3e4f%1SH~|Lqi1$JdSk0w@i9Tb*e2$?DC-+HQ2Bdy^%Q zMl^m3ZXs((U40QZblBqMS-2%EQ^gHJ*Rn$1^9JF^S)uUTo;+bI&sRrY2L+x}-C3rJ z100@ih4^)y`9D9qRkCxtj3}LA*;@?z1tITvxQ2hYNJCbv{SI&&$-gyx@@9Yb4Mp~K zMb`D+%o}}K&uQ2DvKAGY=zMb^_x51ko#B&cw}$d=4(6ia27h8qER8Z~4J#?mpnR?K9^t)W~Dcz3h_4L6jM zft(vy2nKn^Lhut_ys5~(4H`f{ULPyGKUR2;8v&Hu0woxngJSX7gDlg)L3fKThqjyj zIdo~mbX}CBr*NQ51nfMu6ttY%gSqGoG5`+c?;6nfd%W`XgHlb69HKnTvad7DXGGzD`Aa|)ZW1&0kT4(ar&g3iYNw_|zt#nAiE7yC|mwK~qV7)zbgoUoO z>pggq364-q0L~hccqUSQ_2*pg$w1G=o^-s35w7=TF9G(R^lM$Ibn1?zm06xi3GL94 zyi9`vJk7zdOW~T$U2j#V`t%eObVM$_U;kq~OClWe+B)NMH#V1jJly5ua~NI9s1E-w=y- z_8D!yA!fcl=3ITkg~r5-Euu@UQmhoOUuu3X=t#S8<@0f2fY68u`cl>u2Q?)z*ak8^hdYnKKOgF2jJ2{Xdz{eEBq0MyLRAz@lcW!lufD zPob3_KV5p_blFCYK0khnwiDBpAv0CsXKEuk&c>dpi=L~Fn5~YOtBJy*z$Pr=&T#%6 zEP;1h)RN@GSS@s=V43r@f8?w@;!JH6P&(HTccwn(Om*Z;Wf+~h95g(e40I?xK3R5R zsvKm5&DX|&p%+^rMdEW!!ui_h8F@I?a=I)SeL(QK533gg2hrwHbMjA0IO5wp!NiY0_7lPx(Y9b&d7m7FZ116LpCNkPu=xyRc@5_J4Cfvh zD>yb$5;$2Lgyl>Y1&kN^VUUR;|EY=)$SSmQsXvQa70yuL=H_4?>=-};$AQlTeZ~J& zX&^-Xu&a#4DZ2guc54Glab{OQqglP{}|rFjI&kYvsDqe0Wo6*ejslk z#~Y+>xR!xzufZJe(UV8Viu}NFh#&Osd{aD>3!()Uj}{(V9sy)L8;!wiA39X7&q%KC zX#PU8l^U-r4CgsF<) z;gi0KH22<=LtRM+JEcyY(t}+xr>7g9)1Q)@(0Wo1^`#%~&+w$|righe(%kyeTn92e zu_7$td{ZLq25(&u+U&tXI_9SC1&Xm;U&dbZ8OGt8}4;l77mT6YyYv76=MZylm*92#E{S!g$hPabWOP$HZM&p4Ju-(5*}3WIuXBAO|x&q1vN)M+ftcK)OH-D8UGLy;B4z)(^549Ik_H zx5Tz3aeupLe}~AvO|-u+*&bx{rMrz6_yGq<@6En!io;j|aJbr;GG8A{amb=L^d>v@ zBpvKaa|0vhYNFxm5x%bS@y+uUeWhN6e1J5LfJHLr0mD9G*fECvTSD3^QsW=b6)be7 zK%KFQcFDnBiD_k+VNHZ#b%bF}q``Aqb%X)>RE8PMWSTZ7ShXbBvN#ExJJ!0eUUj-?ovhhiZZVf|X< z5&9hcxEfZ58_r~zw~1`qB#u;}QeAsfTsRr9pG-Hepd+B^KN|{u3QC4N(x6Xl)(~q^ z7i}>pGcO4?8c(-w6CZ$9o+=HRZ-_?(%k4_?5aA;nnyw5T&hu@T9vn@xlZTshi%mOa z2cVmNr&Z0dDLH=}k2rO!w z*zsJhsS+{fmhTbaY|$B~*AZis;j7OPKo`Z0&(Dt9GBnJ~->hEogc3lAr@oFG#HlXA zxFO1PM7Amkz!pS;)YVt`8-59R5wD{IZXD;b4I5(2A&~XaW~b61&wv8;Y#;*-BRoCG z>X>+)Z{7k`_YsNCkQk+J;4ehfxjjz5Q(^}fJXsuwxD;B0y%mC3_+qGDo7myPNmEW> zFpG!G+j>0P8T>`GkEnH(kB`q*4pev&@~S{Ez_70}?AJ7(!(3q5$Am1N6vw_Xm4lrQ zB82{AhoT^!co5)9h`Y)bUnONPB_&UyqGO8Wdfl3OD*YeEgill0V8 zF)~;H2H9(92JhMx$GnvMS z8~`!`p85J{ga-(35M%eIxb{h{QjhRj4;=h50{4%k9{?ZEH41O^rrjG`-gmrxp{z11 z5J3*h%rXq}08q)7;VactyHO~al@RvEbRJkwqq}7L!sEPA1%}>at8lw63MoSgIZjB> zcdz&}fcBwfm+l-xy`7Bgd*XBlMEkTDe)&Mgy)M$QOJdWPdI&Kj0(+Q!=q7dn2#wC< zLI^P(?3ME#v+A}Ooz|#*sXn|qD1QSGi zn%UL#OAUKds6HaTMQRk=G~TYhb+)Wk4nBUvFkdjt3?DBSPPt&Vh~( zWPA3??2CdhAPlvuwx(-Wyg_BCX-SY#aiC#I(E5gl#X$zmQTxnxgKJ)pSpA)jeF?ht z;rnW-V}fXbelJaR2Z$mZJ;J|XY}4}nu*stFxx}XA1n9@RmZ8Dj=VzuWj;Qp-?={;6 z!wxaFc>CvndgW4ovER<(00VAzqY{u2i0g7&p~|S_xN+GDlMbnqJV2`|#1O{W+Y&|< z7#a=?yz+-He^%`|xK~*TVrETL!e6;K*q3Bce!?8Dqm_qR&=H<$cwQT2-H~*tE=(73LQAYk*$IFN zgFtc6(XyY)Fm97NBH$T0=?hK7E{SfJq}Ex!STg*$nK*IuRDX9%#0#*%*j6LGgALlM zU48d*QAT_UA%9@mUoh-H2n1CuGsv<}wyHwc9wtQ|dpwp^1_bulw##ph`j8%7b)HQKJg4`SIQ5{@T@{hVl^o{zSc! z$g)#p(Hw747irX*VAm3FSs!ISlL0=$Cb$wMD7)97bYF+at~2SNBEx+k0~_Q+%|iR@ z#jvQr0lM!8YD;~TT7-6B@pM%vHfy&OImq4d`uN_}qLeUXR{xe^-)GtP81@gW;HH2n zVFZ(eER-b%y>>bmi9zh&VOLl9=%TFRqs6$X3tZLJoHf)AYN$Cq-PF|_wHVOpq^#_t z#>TpuyLQFyt`0S*4b$rv0vWg!SY6m&*Qs>9rZ}rsp

|ZBx9>V3L`)6|ao@{_V+= z>mwC;uB0wZzb%G0s@9WJkL3Z3Ja}(SsJ=Wz53M>>|Eb15G^h$Tz@#-{w4u+i7}fxT zn|1X(Qe=6`PwZ@pv&1F>nGHaP%mBm*tvA&L5k5A0*dxFv20H*u_iZ}y#=D$*<98{j zmxp_`D=A;>5LwlR@8bu-D+t@LFQzTk9XS)U{&Za3dXfFW4L5jCvP-+fp>q0u~c&hJgqwNT1kkJpf%N@dcbo?yvNl9VQ|sND zK$ZGv^Y+C30G7|cVSB}=0Y^_BL(B{d-y*bai8HGT!PHLMcL=Rbj`zmDpb+XRQFxvF zk9Q&fZi+Q&7uiD$hH`yq0T)0E8l0>pEK-#W0-1q`8;Xf@0F=u5IMI=;-uZCa6D9u;=`)3&M}RaWud zqT;({i|>}LxE@6itFq-Np*9ozMOf>yYgf#UJ=rNfhAol%5F}vtQ6FJEDuqhIOM>qZ zMYpMx-L(-WHIc>xVq+H*UI_I;{Dsb(B2PhWs8M5tK|>^7L4IDX=FF&dzzmBll9$ z##ER{cnzX-e7PwH5#KpFx^ZZXMw-Ynn@Yz|u&a>XqiNoTU9o#tm9Ylq zdR+_IhbQoioJ#7$GIRIvkC+su?1-^VNsmwm9vN{3P(>_2p9PYA+J~&9{=W1)xE)tvyBNjZs<)yyb2?L z!QGr4<4z@zp1AD;i93fxIzytJgNZtWB6^P-`b4~IShQ;{ZO3t&UE6gt6g`UvY-4-k zcecbMooEl&&?2-MPcySO0LxrBBkU1*(CBL3F3$fNL`C+2{xmxRj??%@WQUv46cY_K zh$!4HG~KOFr~|=(j`zgv>58M*o`k(?uide_^w;>k+;w+-n0{4=!3a&HSScy{C5p#e zBDG=Jur;2kq~RYu)EmshxgHMOfj>?^rz%b$ghn`B7Y!3(r@13GIiaW}RD+AtAPjCH z5sJDP^G=B^lxwz{Cj3!tf@25_vbN!15r5u9Nd_$@$;CwUK&L8fB>!l;)M+Zy%xo7> zMc@jR^pJWOT+G(tgjp{ua|SphTNA`ZgIV5?Hz?zco^+fFtt*E4Y$;UFPjt?DBJ z9)|MqmMlEsXBP{v_hn%JIEZ*P33&iW4&8(A+bgs+4%Ak6(PA98vyPgA16s_1?Odbx z^iMpu*Jjb#{&--`7r*`{CoZWeayL@VIQHsGbwvWdU1U3y1XBr7gsFryI=Y#`BS7P9 zK>Wf)bD6I?vUB_~M~B35AjvYw9=lhlFgjz&2en!2?W~m+W2Gsu;F_f-W2q@vzG?_8 zwzHP_bsJ;5jX6*iy0<=DZ&(68+No=XPE5a39msY{9FRqUkW-H{bP~sZw5SQkM*X=+ z62i3Ne6vex-x>?My5H0yy{~ap?!UEPxSR8j9@De0*Mu2$i0wvB9-Xg?!65WZ5ax~> z1lP3*=~9k~StlV#$1VFu0rN|i{g{xN#=`J7=Sxv*1U?Ss9O(xiPe32xp`1-j z#QMgW9GI9FTtLIk+J+}^jcaNo&=B&EL>#tAIEp%zVQ#$#DhU+> zYw$WEAKMr2{T%&MYzejlJ*h7Aq!`(xG}jJ^!)OY>UN^*7oL1sRuoZ6sgs0o;bDEjd z-(laMxMx_r8+_clH3(CjbXV$>IwCZMH-s6a$MLA9;0o&Q44u5znR=!=3dfE;GW*6T z2(YdDp`v@Y7fU^q`V#0MSoNR&`AJ=zb$g->&dSd=#G~{D8}qwdWg5oWxJ?w_8O=wu zdAVJRB0ihj8JD3;9!|1XX*}~9L6XO(BRc~dL zBQ#j$8x2`$;Hs?R#l_N|#)e66z4<=qDLEo&6WN1_$T%T5#92J@5*_dkGC%}&gYWJv zb7FLG5uK+ye-kkEkqj28zWT*vVZ{+vv=aI%02a#vFF*47Ty&b$L$!CfCUFsRQxeZ`B60-iK0#bs(~CA)R6Z$&>9pn zEq0}ysf)o0X2L78x7P80c5I)->sQh z4Mq4HhzfWOnOW#c$1A5w0u>pDJH>V#iNJx67Ccxsc=7ThP&i(nQx%|%Y%?k%=4zwi z8L2X^(7ATx&+q1KV``ODuxG^P5f&9$9n>LL5OT9JujuV_`6w%bF&`^D)}QLqD}kGU z%p5`b)X+57$u(DNhg4lFPJKICyvFu84Q*WG)wSbUtr%7H2(6tWr^Ds5mp(n;o?Lxm zCpN;!A0iWuv;JuWY+y~2%c)Fr^W9KMxV*!*7Re7EzWdcT|54ydJp!r-uuPohpcn(y zFHlUJ#GTDG*3m?I!IvlnYwZ+k>qyw`ag0_RuAt%Dt9HEFwir$A1be57hcCbX>DT{S zA`w;xYL3ywCR8cn^|!u;UBx~Q59*rA zM;hvDgVaZ57z9aX|LeCuZVA_f(VHv{#2Gzger*i77U$J_s_$I=AquE2wM%h)jJgr1 z^t z%^}=;d&QqqJT_+7LbzLI{q-s>7b3BngTG6-F}lbf%Ha+tOyA^&v9{Zt7(MJnar+(luAt!&WYl zUI7hdg)dz`T^qKyF3O}S#=IiLDDsd~d8l1avLklxQLZ5_g?h9A*-LC9 zKqSPeKV`qf(=yh}70K16So5Y>v-(Km1ExN;QC1ydTWklA*`}xY{n@JpGfzXk`h?B` zl^jADQW{lB;E>_oE^?gBGTgEiICv8hm6dm~Lu%6;YobUy3>>iWM1dtArml-{_+dX> zD0FpB$G15Q3%3YmM8Gq|Ft>=(f7f{-^Y;%+pvViIsYvJ{3xQ&l!BpGPRP#ZZX}`=^ zAvGM38VyK|pKkq9qkf6epwy^4(Xctj1cffh0ORN%@ixvGQCmeTPpZS=R$w$*6YXcR z45eOHA}^=r=siu5`rS!1Hv%C92eBPMpbpkUF(JC(FIcaT*^H)`4}b;hx;4-IXDW0 zzMv|pEBVl1n!Q45hOil16$IPuiNL|6CBd>MpHx0V=j*lO;G*jfD{6 za2yrOKnZ~a_Gnlawq1~@b_u4i=WAWoQ?iCU9D#vgq-AI^71y|uCnuy+;Pj^}gHeNu zAZIzwT(MWc8QTX$m8j^0_zmWI!w=Gfm=qTbf*X28%}lB*CvVt(3gJ&_!gI}@ZXMKX z|D>@HqT-=kibErgjDxXr!QgH1CdoFyp;ctpo#KL&IB-CLC6<4yKL@P8H@QI>IY$2F zVquUwBF_&5%tr$HWd}|n=NP7)W#@^~|1sQqpdtBSb(SzSPIj{^bh_&3h3bGFuHX$z zprsdF>DRg|p7Raf2XQH)Q=FGUo6a>S@O3zV2mu=u4Y4|`3LGVRA~dDdFKLJ22PcaI zupL7Q3L*!T(xHAEH4Hc<=l15o69s+)IX>9gA&BKCT1No?CnXP*q#aUZxFN5IVNrdD zJSr_gL^WfLcOASy{vWDbbdnnda%QF+))E7s;}A`qBiuZQ#bRL#Q`T)D5XP8SQ0oVkDxg8W$-oR zYX@0-|JM1cmLh~Mj~V7y3=6HC2NN0QO;%8)q5cz;=pb+<s(2LEf*u6kU?oCCY@87jVtWf0fWoTb zTwerKs8EIGB7cRHKA1>LI_ZZV=%0aD9W?_}m0PJ>CGt%*c`yv2l2aen%qXC*eRSl5+SDOia@Xetm+$@BrUPS3E@LyBV%i}|5T#hQUVfvtz@YHzgTvHsqHsYFqn+r`s zq-0V0jtGR3x=|##4)E1Kc|PJT)EgtT9JO^=(Kya63kSFg|Q++{GLoN`!iQLZPdva`N0zLQt%Rl|E=p$}-6jDej zUt_=VwGH1dpaNgQMKwu~C}<*dkbaee9TxZT0$svD4ib-G4S)hBw6)+<4k@66!J!-T zF>3D6AAtwmJ`d*NLlxk5xh)CZFg{1dvngp4Bk7I7LB?f#bc1hdxTxuBCqAo5!KXSX z0R2jd)A*+g<)L> zFa$ADU!5&q7>Oceie*1w1Rn|n|DmCNOlw%(_jSqK|o5Rmrd^?e;C%aejyq|xxP%n-iR1D%<0(>L*%7(N_R&`ijn4d9f zuWM^ps8>aP$2*JT(ix)_L(%**`u`A*6*? z&9NT~1o+n;E(-(~G&Jw1Y<{HyZ7X?f&`Q(ob&|e7KPL>5a;du9tqWSoqy~*b!l6eUINt3gq?V}sf{-VKTp}c0Lt~N< zJx|wdp@9c&?1OQRBiM=rdjozVq!HyMn(PUEy;6f+zIM(@Me$zmT&&#G${)gr|CBy( zaIei*e|e|;v)eTv-H?BFyZ+1j6<^#c94_%pjXb8Ojicmkgv{WpbC_AwDiiWCAzu=5 zN@Yup8uMhU+BaLa{7O}IK~3#9@T5o^a7m#uC1TTC68HFA)qe_+n}hrX2vB2qs`T;s z>i4e7zkJa6_1%j4Y?q@h!Qr0A4%+8%s)vJMB=?#Ki6dl)kT9IQ;9ti&aL{9*H1KkZ z|E;OY-@V-M%524E6!aJ1|6lP6=io|zda?S$>s9YBR(*V<__r_T|L&puH!oHH@loN6 z^Q9MiGVafm{{2tNfBQ22jV$@&^Odj7S3R1+Mr?h;IXKmn1WfY<>AMFBwt*F`LxmG$7R!qUVFa=;bzAh?u6 zR$ZhB?&1M8ltqdnMLJ>tW$C>WlG*Q@m$`55y!$FIl0fF1FSkwk=l|}^{PWM;m$nc5 zWw=nGDgM?0UIFd_5=3?U6`~EEcP!w8x`97Z%F7a{Sz(|(Fah`u*bbb`2G4nq&lsoh z<*J9vtzO`&IxrSE0mul!xJ*<1a?{7B07wNc02Z&AhlDt_MTotteBe3n+3{3b z=F#AC(Mw*h2e@bj{5z1V3wwl^o+d<#O&o^2!Do!axB*-<&sKR|KY3Ap=sf{=5a1YU zwbip2TZb$WqR=^SPQAEhT&7`KJ3mzh%Syo7OU2Ay3Cya${D zOkU3jv22kL*P|V4{r_G^mdUauWN^tu87b?vxlxywQYLUz3aIYK2)JX`%n%|S?K2&` z9?s@A>zEL8(}bwBA8~Q-Qi3v27Ruz}IRn>IfO?lwr@5(Y@HDhksZz3f_3ECu`s%B} zWnt*8VCJRe)a!jJd0dE(7h-O;*WwvAnw$f)$W6Nby=6iD6EHVT9XfO(VF5Ti8vP#Ukl>hUJnOmX0i9iov9p;=e9KR;> z)2C0*h5TyH3!snbyG)1^8&NlMYXWsubxuTm@Z|CX>Q@Bl3#0?tbswVI<-&yvr5Dz( zUoSH0N4&+;7W{Fb<>eQuKg%lw5Y6Cub%ACp@XZuFztM04|?WX?y`^!_OPK7OE z`SRr|eb|WE5q9m`C2zXvrhqbUz4cbPdGqFgY-kTqCZclX%JPE`K9J|moePMkZ|vQ> zS5~Z8QD3T~-N(H0$}6ttK6w(*ucZop;49OneTl!tA(T)A>e-+cG&cDroZGWqt~ zZ#&>Ss)Od&d~Tn=`|i8)n{U3+Nz}1Zr%n#P4?g&y>lrT=En1|?yX&sIFqS09IdkT? z;!uVK3l>P`ZI(B1;J_H$FZ+nA;0vq0->dz;^wLYNa?CO*!{?uW?y^hRM}V)tKUE{q_Y}}`Cqkal`K%8fGdt!ZfyOtuWro8i(euBit>o(_rXm40zRIRh&v`5AK|!n z-MV#7Jr*xsO!*e$MpXQkFJE3ZYt}4c+;PVpvQM8ra`foYlD3fDHnl+1ed*Gr<&#f7 zsc)%c_wL;T^cXF_%$J;*!Q^+uh!N%^*|cd>SDCN9_L}QCZ4ma?UZCxjGyG;krcZ&} z0QPnM_p5mE;%dw_=M~xfra|y%_^ph0q7D4{*n>81f)Mi$3z3Gh9Kd#)h&e#Rbi~8` zK+rZkdGe%7U;2V`S=ys!pxtBV6O7-x@4j30!yE(cd9s-&&wKRf;p9vE#|*a3_r(`q zn2$rA$3Fi0b>-cDs~(^oK5N!2xqJ6+dG_qtka7$kKAiO%iAYiKD=UGr5deIxNazRV zIIH1%Yk>U@emR4k&zLd8Q?}=ye_qW^%!hUA)Ny#w`FZi%x^?TYoa%h1Oqt@!)8?1$ zPnX5xh7B8Z(y+&z;+ON%!-o%tEuRtCb}>i8ell?#F2nMRD%Jwf$4mHDO*|J5hS+m9yjC-;D^JkxNYU2--lkL_Fd-m*+OO`Bg>c=+EafWmE zgoHBSrDJ!*56LaEZ30XO;9D|z&BR)EYMKyNAJICB=J?Z3KbfLB=WK&dJ@u4x&67y@ zEmMX|>i$4GBb5DP%NmZ~4?q0SpE=H6eDTGAcf`!|V)^~*tFN5$IG1DIoJZ<#=+GfG z_WR0A$`GO!+G>0Bq5TkdGH?!1oRPaGNax}i_sRkP1Q^f2`Co+?y-0{6r_K6AdQQK^ zgb5S0n66`HW~QW_Fkrv{*ZoNN<^0(U8#iv0w3j25D;&SK+;WSVy=41s(xgeyGGgVI zGSh}IZP2xA*Q#>PoH^sjz<#=H*|JvsxL2$+cu4`@wegHt0x15-WjSO(l~e(CX5Y_# zetIjWQvVeq5oz81aJ6dHly8jo%F8dmEIFSs=Vm;gG-;Cj{`>D;ay!CipRj*r-uC)Y zB>ZxIYL88P$2qU2-^UB|V{=Z-XLedMUEjWam0Vsn7TcDcH~UPRU*>PdGutAopPrts zo*y}K#8!(OIdY^bpFRLHaQ;nyitG3%`^nTE8jx5SVsaFnP8AiazDk)YM?nocmt(mGdyllV5-R zRhBGSQt9Q+JMUC}sYtV+9V0~RE!KVma{E6YzvQ+i`eS!{jYXH?WTL&N*Xm>CmvV9L zJbChDxpnK-a7C*9A<^)w^}u;FZ5i4SUVi9{;g|E*g9i^v+7Iu&_nyP8E}Lr%v<28_ zb36+beEgC-a_HK2xVomGqhD{Am|)9MaJD z&12!hh1D7j+f=aiAl~QmU|^rF^LhXM_g$iL%+cvWjpLM6$J0mVNm=!EG{;b7nf2#6 zedeL^_S=`_Q1hv{?QL8`*28PfKAN^mEP+06jzhow_M7BbyJE!(H7?s@wbwQ0>d!s* zoU;A7E~on}yUx76_uhMzpNwso{Ts*OqeqVhVBfxdlH(oUS1 z%=ajoK%bBoznotN3)#N=fVo_-`1(F&H3R47ycezQz&yk1q$Gigfy9Mhf{bh@|@~h>bZ(En)HJ-Blk}C~fn;{&(9AjzkvTbV6 zrsn*_w!6=tKkvk0Tzed&oMs@u)EnEU9S$5g;K)qb*&mp}%`fMxqcCsf{ME%PbfY+I zjI<87<~g2|XUvoToW;41S9tyP*Bu>eU3(ql*?zSgY_FXEa(&SZ^eNKsVaq{(wi$x) zOFNDGA?)<}n*F00xYtjwaq2i;eq=KZ`L*ZP^XJc3`$Kdd`e^&*ef$=KpDHyC>&Eam zxp-xJrEeoBuaLvVw-D9Fat`Aa=oiDjDU=mxYn%6Sf?vwRwIJFW=K2Zewr1J-+>2lR z%skS5F|X}&`moI4n{T@79|^x4|IMJ+N$v8y`TgAfc7pz6`jKlPPZxjTu2J4&-1FlV z=!;EC;(n?Zw!s&Td6m1K`Z^T9oD;Brut7VAeuPkA=gysqi`A=FyP~lT({F2nc7hq` z^QLdc3@^O!LP%~|AGbCAK9vwB zDqeMb$Xt(W7{TUU)a}zxKP?}6=po59-$soZseMk|Bd6;dir-1_abb@gKp(1!Zt%5M zl;)ldvz|O>AIDgB8 zzSg$OwfyEWp8PUj`b{{W3%72q>)@LomF|q|i{@450Xf=o-YV)^?JL?y^kHjoACnpA_an@peUkn>1IL?q z^Q+6^JhDQC3bJ!rcH&)knSZrnJR?PQm`bm>yXsZU2w;k>7D?dFE#fEhT?p+3#Pxro;uT3`OY z{Nm3q=dQP>V^28xT#o_e+2g}(?&4;AKd4n(~TcL-c=0y zNv;{u*TnQDSf}{$OI}kBagVxLhCZi`>B}+a2HEfP0mz;Np`+q1()h@`9WWKx%RZaF zqt2Z>OYVp3*|Vqmj)?v@-<+^VSD0seLiNusKdti z99~)KH7nFX?T7yP=bycz1>B?VhcB}7F%r$fRnK-{O z-wWo!?`D`MpN9(Z<+mf`jErCQ%e40)E52b8r6FUEa2iX#kSDJEa=qKjKgDsWc=5ds zzvQ@V*=}kbf$u%-PL8+aGZ^?CdE>^7m4CZ;@7~HkOdqiZ$7b%KWq$e|_nz4Kah|20 z^T_9B@cEzH!6#8?8`u8KxICxtm2=L=AAellbI(28Kg@57Qh~CuaFCN}AX8lVrJlG> z9wI{|dDewbc;F5pJ`BQd;#`!)vF=$9^ufKSfyV*HiP?XV zliV_Igt+rdj=2}g{FVsipfK9gCciwtgF?gsNywuUFc+v1BtPzj`r~pTj{fA9!>j#@ z**UHI-y{EU{BmCc`y&(Vqb5$A7}9q|j@|nit3l_PfX(k)LAZ#7^J|cH2Cx=52{7-S zfSoq!ybyzy2yte6VEGc?z+Soh^1E4dMZg#XqjBCt?e!v$!2;(GeqH|+=Qg*zUS-6w zc?osRadn+Xo|BFIlCicjZXv!|-))tRcI^Lcm3)3@d+3qeRFUb}V;C&Z=dAa|U|)BT zJhE_~-|d9r(tcJA@#hE0uP5#o#kwnhk2DM4=}=AwXvcxSjl{C~J)8!=gT=ioqJQ?a z-@&NwR|aO`e3079?X{Q9`f^OoqO3=1_1eGORK$DWbI zo3Td-YcGePdoNyiuQ&ZaIBL|#`Dq|neEa@?uur1+Z$gyFRldR8@Gj&8zx;-Pzj=hb zp9D4uu>x~Un-lZ;6ZG5N(Wh1bPyO*8oUrx)n{n;)mGt@Yo7!5rL7%xz2IwWEeFb?V z3Y-hAT)9#X9z0kkCnujkzFmNk`0qckt!z&0Ywi_j1ni5V%`%T2uzL&QeZY?+;4&Y9 zIv~GXGp27oS~P6fQ0;-`T0FktK$}zRC)k58QmAW$!M<-SY(DMl1>k5=l-$zCSQPCY z6YG3#gTC9)PfdX9h_Rp{(xm{UfdZzUas3Yf+i4!{N0t|fX@50B+#NLQMtU%uB06*>y`rhV0%URt( z|Mh_>7$1)cu|CWgybGK?hVQO)`}8{gg0Z#&{1pPIj-VF!EhnuXs4`WyOVu^))*zSBtSkRLDfy98dUf@A!4_JW1r@IoMuC-FV|En5Tc z9{}&y?MC{UK>2(^lzrssVojHpAA&e2VngKV;9db + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/win32/win64_installer/storage.conf.in b/bacula/src/win32/win64_installer/storage.conf.in new file mode 100644 index 0000000000..e4fe666545 --- /dev/null +++ b/bacula/src/win32/win64_installer/storage.conf.in @@ -0,0 +1,14 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Definition of file storage device +Storage { + Name = File +# Do not use "localhost" here + Address = @storage_address@ # N.B. Use a fully qualified name here + SDPort = @storage_port@ + Password = "@storage_password@" + Device = FileStorage + Media Type = File +} diff --git a/bacula/src/win32/win64_installer/tray-monitor.conf.in b/bacula/src/win32/win64_installer/tray-monitor.conf.in new file mode 100644 index 0000000000..55ff2d427c --- /dev/null +++ b/bacula/src/win32/win64_installer/tray-monitor.conf.in @@ -0,0 +1,34 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# +# Bacula Tray Monitor Configuration File +# + +Monitor { + Name = @monitor_name@ + Password = "@mon_password@" # password for the Directors + RefreshInterval = 30 seconds +} + +Client { + Name = @client_name@ + Address = localhost + FDPort = @client_port@ + Password = "@monitor_password@" +} + +#Storage { +# Name = @basename@-sd +# Address = @hostname@ +# SDPort = @sd_port@ +# Password = "@mon_sd_password@" # password for StorageDaemon +#} +# +#Director { +# Name = @basename@-dir +# DIRport = @dir_port@ +# address = @hostname@ +#} +# diff --git a/bacula/src/win32/win64_installer/winbacula.nsi b/bacula/src/win32/win64_installer/winbacula.nsi new file mode 100644 index 0000000000..f0391bb512 --- /dev/null +++ b/bacula/src/win32/win64_installer/winbacula.nsi @@ -0,0 +1,1220 @@ +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +##{{NSIS_PLUS_BEGIN_PROJECT_SETTINGS}}## +#NAME "Release" +# CMD -DSRC_DIR=release64 -DSRC32_DIR=..\win32_installer\release32 -DSRC64_DIR=..\win64_installer\release64 -DOUT_DIR=release64 -DWINVER=64 -DVERSION=9.0.7 -DBUILD_TOOLS=NSIS-3.0b0 +# EXE C:\Program Files (x86)\NSIS\makensis.exe +# FLAGS 2 +##{{NSIS_PLUS_END_PROJECT_SETTINGS}}## + +; winbacula.nsi +; +; Began as a version written by Michel Meyers (michel@tcnnet.dyndns.org) +; +; Adapted by Kern Sibbald for native Win32 Bacula +; added a number of elements from Christopher Hull's installer +; +; D. Scott Barninger Nov 13 2004 +; added configuration editing for bconsole.conf and bwx-console.conf +; better explanation in dialog boxes for editing config files +; added Start Menu items +; fix uninstall of config files to do all not just bacula-fd.conf +; +; D. Scott Barninger Dec 05 2004 +; added specification of default permissions for bacula-fd.conf +; - thanks to Jamie Ffolliott for pointing me at cacls +; added removal of working-dir files if user selects to remove config +; uninstall is now 100% clean +; +; D. Scott Barninger Apr 17 2005 +; 1.36.3 release docs update +; add pdf manual and menu shortcut +; +; Robert Nelson May 15 2006 +; Added server installs and implemented Microsoft install locations +; Use LogicLib.nsh +; Added Bacula-SD and Bacula-DIR +; Replaced ParameterGiven with standard GetOptions +; +; Kern Sibbald October 2008 +; Remove server installs +; Install into single bacula directory +; (i.e. undo a large part of what Robert Nelson did) +; +; Eric Bollengier March 2009 +; Updated to handle Win64 installation +; +; Kern Sibbald April 2009 +; Correct some Win64 install problems +; It is mind boggling how many lines of this insane scripting language +; have been written with absolutely no comments +; +; Command line options: +; +; /service - +; /start +; +; netsh firewall add portopening protocol=tcp port=9102 name="Bacula-FD" + + +!define PRODUCT "Bacula" + +; +; Include the Modern UI +; + +!include "MUI.nsh" +!include "LogicLib.nsh" +!include "FileFunc.nsh" +!include "Sections.nsh" +!include "StrFunc.nsh" +!include "WinMessages.nsh" +!include "x64.nsh" +; +; Basics +; +Name "Bacula" +OutFile "${OUT_DIR}\bacula-win${WINVER}-${VERSION}.exe" +SetCompressor lzma +Caption "Bacula 64 bit Edition ${VERSION}" +VIProductVersion ${VERSION}.1 +VIAddVersionKey CompanyName "Bacula Project" +VIAddVersionKey LegalCopyright "Kern Sibbald" +VIAddVersionKey FileDescription "Bacula network backup and restore" +VIAddVersionKey FileVersion win${WINVER}-${VERSION} +VIAddVersionKey ProductVersion win${WINVER}-${VERSION} +VIAddVersionKey ProductName "Bacula" +VIAddVersionKey InternalName "Bacula" +VIAddVersionKey LegalTrademarks "Bacula is a registered trademark of Kern Sibbald" +VIAddVersionKey OriginalFilename "bacula.exe" + +InstallDir "C:\Program Files\Bacula" +InstallDirRegKey HKLM "Software\Bacula" "InstallLocation" + +InstType "Client" +InstType "Server" +;InstType "Full" + +!insertmacro GetParent + +${StrCase} +${StrRep} +${StrTok} +${StrTrimNewLines} + +; +; Pull in pages +; + +!define MUI_COMPONENTSPAGE_SMALLDESC + +!define MUI_HEADERIMAGE +!define MUI_BGCOLOR 739AB9 +!define MUI_HEADERIMAGE_BITMAP "bacula-logo.bmp" + +!InsertMacro MUI_PAGE_WELCOME +!InsertMacro MUI_PAGE_LICENSE "${SRC_DIR}\LICENSE" +Page custom EnterInstallType +!define MUI_PAGE_CUSTOMFUNCTION_SHOW PageComponentsShow +!InsertMacro MUI_PAGE_COMPONENTS +!define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre +!InsertMacro MUI_PAGE_DIRECTORY +Page custom EnterConfigPage1 LeaveConfigPage1 +Page custom EnterConfigPage2 LeaveConfigPage2 +!Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage +!InsertMacro MUI_PAGE_INSTFILES +Page custom EnterWriteTemplates +!Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt +!InsertMacro MUI_PAGE_FINISH + +!InsertMacro MUI_UNPAGE_WELCOME +!InsertMacro MUI_UNPAGE_CONFIRM +!InsertMacro MUI_UNPAGE_INSTFILES +!InsertMacro MUI_UNPAGE_FINISH + +!define MUI_ABORTWARNING + +!InsertMacro MUI_LANGUAGE "English" + +!InsertMacro GetParameters +!InsertMacro GetOptions + +DirText "Setup will install Bacula 64 bit ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder." + +!InsertMacro MUI_RESERVEFILE_INSTALLOPTIONS +; +; Global Variables +; +Var OptService +Var OptStart +Var OptSilent + +Var CommonFilesDone + +Var OsIsNT + +Var HostName + +Var ConfigClientName +Var ConfigClientPort +Var ConfigClientMaxJobs +Var ConfigClientPassword +Var ConfigClientInstallService +Var ConfigClientStartService + +Var ConfigStorageName +Var ConfigStoragePort +Var ConfigStorageMaxJobs +Var ConfigStoragePassword +Var ConfigStorageInstallService +Var ConfigStorageStartService + +Var ConfigDirectorName +Var ConfigDirectorPort +Var ConfigDirectorMaxJobs +Var ConfigDirectorPassword +Var ConfigDirectorAddress +Var ConfigDirectorMailServer +Var ConfigDirectorMailAddress +Var ConfigDirectorDB +Var ConfigDirectorInstallService +Var ConfigDirectorStartService + +Var ConfigMonitorName +Var ConfigMonitorPassword + +Var LocalDirectorPassword +Var LocalHostAddress + +Var MySQLPath +Var MySQLVersion +Var PostgreSQLPath +Var PostgreSQLVersion + +Var AutomaticInstall +Var InstallType + +!define NewInstall 0 +!define UpgradeInstall 1 +!define MigrateInstall 2 + +Var OldInstallDir +Var PreviousComponents +Var NewComponents + +; Bit 0 = File Service +; 1 = Storage Service +; 2 = Director Service +; 3 = Command Console +; 4 = Bat Console +; 5 = wxWidgits Console +; 6 = Documentation (PDF) +; 7 = Documentation (HTML) +; 8 = alldrives Plugin +; 9 = Old Exchange Plugin +; 10 = Tray Monitor +; 11 = winbmr Plugin (not implemented in community version) + +!define ComponentFile 1 +!define ComponentStorage 2 +!define ComponentDirector 4 +!define ComponentTextConsole 8 +!define ComponentBatConsole 16 +!define ComponentGUIConsole 32 +!define ComponentPDFDocs 64 +!define ComponentHTMLDocs 128 +!define ComponentAllDrivesPlugin 256 +!define ComponentOldExchangePlugin 512 +!define ComponentTrayMonitor 1024 + +!define ComponentsRequiringUserConfig 63 +!define ComponentsFileAndStorage 3 +!define ComponentsFileAndStorageAndDirector 7 +!define ComponentsDirectorAndTextGuiConsoles 60 +!define ComponentsTextAndGuiConsoles 56 + +Var HDLG +Var HCTL + +Function .onInit + Push $R0 + Push $R1 + + ; Process Command Line Options + StrCpy $OptService 1 + StrCpy $OptStart 1 + StrCpy $OptSilent 0 + StrCpy $CommonFilesDone 0 + StrCpy $OsIsNT 0 + StrCpy $AutomaticInstall 0 + StrCpy $InstallType ${NewInstall} + StrCpy $OldInstallDir "" + StrCpy $PreviousComponents 0 + StrCpy $NewComponents 0 + StrCpy $MySQLPath "" + StrCpy $MySQLVersion "" + StrCpy $PostgreSQLPath "" + StrCpy $PostgreSQLVersion "" + StrCpy $LocalDirectorPassword "" + + ${GetParameters} $R0 + + ClearErrors + + ${If} ${RunningX64} + ${Else} + MessageBox MB_OK "This is a 64 bit installer, but the OS is not an x64 -- Aborting ..." /SD IDOK + Abort + ${EndIf} + + ${GetOptions} $R0 "/noservice" $R1 + IfErrors +2 + StrCpy $OptService 0 + + ClearErrors + ${GetOptions} $R0 "/nostart" $R1 + IfErrors +2 + StrCpy $OptStart 0 + + IfSilent 0 +2 + StrCpy $OptSilent 1 + + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + ${If} $R0 != "" + StrCpy $OsIsNT 1 + ${EndIf} + + Call GetComputerName + Pop $HostName + + Call GetHostName + Pop $LocalHostAddress + + Call GetUserName + + ; Configuration Defaults + + StrCpy $ConfigClientName "$HostName-fd" + StrCpy $ConfigClientPort 9102 + StrCpy $ConfigClientMaxJobs 10 + ;StrCpy $ConfigClientPassword + StrCpy $ConfigClientInstallService "$OptService" + StrCpy $ConfigClientStartService "$OptStart" + + StrCpy $ConfigStorageName "$HostName-sd" + StrCpy $ConfigStoragePort 9103 + StrCpy $ConfigStorageMaxJobs 10 + ;StrCpy $ConfigStoragePassword + StrCpy $ConfigStorageInstallService "$OptService" + StrCpy $ConfigStorageStartService "$OptStart" + StrCpy $ConfigDirectorPort 9101 + + StrCpy $ConfigMonitorName "$HostName-mon" + ;StrCpy $ConfigMonitorPassword + +; TEMP refers to temporary helper programs and not Bacula plugins! +; InitTEMP + CreateDirectory "$INSTDIR" + CreateDirectory "$INSTDIR\working" + File "/oname=$INSTDIR\working\openssl.exe" "${SRC_DIR}\openssl.exe" + File "/oname=$INSTDIR\working\libeay32.dll" "${SRC_DIR}\libeay32.dll" + File "/oname=$INSTDIR\working\ssleay32.dll" "${SRC_DIR}\ssleay32.dll" + File "/oname=$INSTDIR\working\sed.exe" "${SRC_DIR}\sed.exe" + + !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini" + !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini" + + SetPluginUnload alwaysoff + +; Generate random File daemon password + nsExec::Exec '"$INSTDIR\working\openssl.exe" rand -base64 -out $INSTDIR\working\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$INSTDIR\working\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigClientPassword $R0 + FileClose $R1 + ${EndIf} + +; Generate random Storage daemon password + nsExec::Exec '"$INSTDIR\working\openssl.exe" rand -base64 -out $INSTDIR\working\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$INSTDIR\working\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigStoragePassword $R0 + FileClose $R1 + ${EndIf} + + SetPluginUnload manual + +; Generate random monitor password + nsExec::Exec '"$INSTDIR\working\openssl.exe" rand -base64 -out $INSTDIR\working\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$INSTDIR\working\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $ConfigMonitorPassword $R0 + FileClose $R1 + ${EndIf} + + Pop $R1 + Pop $R0 +FunctionEnd + +Function .onSelChange + Call UpdateComponentUI +FunctionEnd + +Function InstallCommonFiles + ${If} $CommonFilesDone = 0 + SetOutPath "$INSTDIR" + File "Readme.txt" + + SetOutPath "$INSTDIR" +!if "${BUILD_TOOLS}" == "MinGW32" + File "${SRC_DIR}\mingwm10.dll" +!endif + File "${SRC_DIR}\libwinpthread-1.dll" + File "${SRC_DIR}\pthreadGCE2.dll" + File "${SRC_DIR}\libgcc_s_seh-1.dll" + File "${SRC_DIR}\libstdc++-6.dll" + File "${SRC_DIR}\ssleay32.dll" + File "${SRC_DIR}\libeay32.dll" + File "${SRC_DIR}\zlib1.dll" + File "${SRC_DIR}\bacula.dll" + + File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf" + File "${SRC_DIR}\openssl.exe" + File "${SRC_DIR}\bsleep.exe" + File "${SRC_DIR}\bsmtp.exe" + File "${SRC_DIR}\expr64.exe" + File "${SRC_DIR}\snooze.exe" + + CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"' + + StrCpy $CommonFilesDone 1 + ${EndIf} +FunctionEnd + +Section "-Initialize" + + WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR" + + Call GetSelectedComponents + Pop $R2 + WriteRegDWORD HKLM Software\Bacula Components $R2 + + ; remove start menu items + SetShellVarContext all + + Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*" + Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*" + Delete /REBOOTOK "$SMPROGRAMS\Bacula\*" + RMDir "$SMPROGRAMS\Bacula\Configuration" + RMDir "$SMPROGRAMS\Bacula\Documentation" + RMDir "$SMPROGRAMS\Bacula" + CreateDirectory "$SMPROGRAMS\Bacula" + CreateDirectory "$SMPROGRAMS\Bacula\Configuration" + CreateDirectory "$SMPROGRAMS\Bacula\Documentation" + + CreateDirectory "$INSTDIR" + CreateDirectory "$INSTDIR\working" + CreateDirectory "$INSTDIR\plugins" + + SetOutPath "$INSTDIR" + File "${SRC_DIR}\LICENSE" + Delete /REBOOTOK "$INSTDIR\License.txt" + +; Output a series of SED commands to configure the .conf file(s) + FileOpen $R1 $INSTDIR\working\config.sed w + FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n" + FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n" + FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n" + + StrCpy $R2 ${BUILD_TOOLS} + + Call GetHostName + Exch $R3 + Pop $R3 + + FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n" + + ${StrRep} $R2 "$INSTDIR\working" "\" "\\\\" + FileWrite $R1 's;@working_dir@;$R2;g$\r$\n' + + ${StrRep} $R2 "$INSTDIR" "\" "\\\\" + FileWrite $R1 's;@bin_dir@;$R2;g$\r$\n' + ${StrRep} $R2 "$INSTDIR" "\" "\\" + FileWrite $R1 's;@bin_dir_cmd@;$R2;g$\r$\n' + + ${StrRep} $R2 "$INSTDIR\plugins" "\" "\\\\" + FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n' + + ${StrRep} $R2 "$INSTDIR" "\" "/" + FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n" + + FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n" + FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n" + FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n" + FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n" + FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n" + FileWrite $R1 "s;@storage_address@;$LocalHostAddress;g$\r$\n" + FileWrite $R1 "s;@storage_name@;$ConfigStorageName;g$\r$\n" + FileWrite $R1 "s;@storage_port@;$ConfigStoragePort;g$\r$\n" + FileWrite $R1 "s;@storage_maxjobs@;$ConfigStorageMaxJobs;g$\r$\n" + FileWrite $R1 "s;@storage_password@;$ConfigStoragePassword;g$\r$\n" + FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n" + FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n" + FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n" + FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n" + FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n" + FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n" + + FileClose $R1 + + ${If} ${FileExists} "$OldInstallDir\bacula-fd.exe" + nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running + Sleep 1000 + nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /remove' ; Remove existing service + ${EndIf} + + ${If} ${FileExists} "$INSTDIR\bacula-fd.exe" + nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::Exec /TIMEOUT=200 'net stop bacula-fd' + ${EndIf} + + ${If} ${FileExists} "$OldInstallDir\bin\bacula-sd.exe" + nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::Exec /TIMEOUT=200 'net stop bacula-sd' + Sleep 1000 + nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /remove' ; Remove existing service + ${EndIf} + + ${If} ${FileExists} "$INSTDIR\bacula-sd.exe" + nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running + nsExec::Exec /TIMEOUT=200 'net stop bacula-sd' + ${EndIf} + Sleep 1000 + + +SectionEnd + +SectionGroup "Client" SecGroupClient + +Section "File Service" SecFileDaemon + SectionIn 1 2 3 + + SetOutPath "$INSTDIR" + + File "${SRC_DIR}\bacula-fd.exe" + Delete "$INSTDIR\working\bacula-fd.conf.in" + File "/oname=$INSTDIR\working\bacula-fd.conf.in" "bacula-fd.conf.in" + + StrCpy $0 "$INSTDIR" + StrCpy $1 bacula-fd.conf + Call ConfigEditAndCopy + + StrCpy $0 bacula-fd + StrCpy $1 "File Service" + StrCpy $2 $ConfigClientInstallService + StrCpy $3 $ConfigClientStartService + + Call InstallDaemon + + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$INSTDIR\bacula-fd.conf"' +SectionEnd + +SectionGroupEnd + +SectionGroup "Server" SecGroupServer + +Section "Storage Service" SecStorageDaemon + SectionIn 2 3 + + SetOutPath "$INSTDIR" + + File "${SRC_DIR}\bacula-sd.exe" + File "${SRC_DIR}\bcopy.exe" + File "${SRC_DIR}\bextract.exe" + File "${SRC_DIR}\bls.exe" + + File "/oname=$INSTDIR\working\bacula-sd.conf.in" "bacula-sd.conf.in" + + StrCpy $0 "$INSTDIR" + StrCpy $1 bacula-sd.conf + Call ConfigEditAndCopy + +# File "${SRC_DIR}\loaderinfo.exe" +# File "${SRC_DIR}\mt.exe" +# File "${SRC_DIR}\mtx.exe" +# File "${SRC_DIR}\scsitape.exe" +# File "${SRC_DIR}\tapeinfo.exe" +# File "${SRC_DIR}\bscan.exe" +# File "${SRC_DIR}\btape.exe" +# File "${SRC_DIR}\scsilist.exe" +# File "${SRC_DIR}\mkisofs.exe" +# File "${SRC_DIR}\growisofs.exe" + +# File "/oname=$INSTDIR\working\mtx-changer.cmd" "scripts\mtx-changer.cmd" + +# StrCpy $0 "$INSTDIR\bin" +# StrCpy $1 mtx-changer.cmd +# Call ConfigEditAndCopy + +# File "/oname=$INSTDIR\working\disk-changer.cmd" "scripts\disk-changer.cmd" + +# StrCpy $0 "$INSTDIR" +# StrCpy $1 disk-changer.cmd +# Call ConfigEditAndCopy + + StrCpy $0 bacula-sd + StrCpy $1 "Storage Service" + StrCpy $2 $ConfigStorageInstallService + StrCpy $3 $ConfigStorageStartService + Call InstallDaemon + +# CreateShortCut "$SMPROGRAMS\Bacula\Configuration\List Devices.lnk" "$INSTDIR\bin\scsilist.exe" "/pause" + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Storage Configuration.lnk" "write.exe" '"$INSTDIR\bacula-sd.conf"' +SectionEnd + +SectionGroupEnd + +SectionGroup "Consoles" SecGroupConsoles + +Section "Command Console" SecConsole + SectionIn 1 2 3 + + SetOutPath "$INSTDIR" + + File "${SRC_DIR}\bconsole.exe" + Call InstallCommonFiles + + File "/oname=$INSTDIR\working\bconsole.conf.in" "bconsole.conf.in" + StrCpy $0 "$INSTDIR" + StrCpy $1 bconsole.conf + Call ConfigEditAndCopy + + CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bconsole.exe" '-c "$INSTDIR\bconsole.conf"' "$INSTDIR\bconsole.exe" 0 + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$INSTDIR\bconsole.conf"' + +SectionEnd + +Section "Bat Console" SecBatConsole + SectionIn 1 2 3 + + SetOutPath "$INSTDIR" + +!if "${BUILD_BAT}" == "yes" + Call InstallCommonFiles + File "${SRC64_DIR}\QtCore4.dll" + File "${SRC64_DIR}\QtGui4.dll" + File "${SRC64_DIR}\bat.exe" + + File "/oname=$INSTDIR\working\bat.conf.in" "bat.conf.in" + StrCpy $0 "$INSTDIR" + StrCpy $1 bat.conf + Call ConfigEditAndCopy + + SetOutPath "$INSTDIR\help" + File "${SRC64_DIR}\help\*" + SetOutPath "$INSTDIR" + + ; Create Start Menu entry + CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bat.exe" '-c "$INSTDIR\bat.conf"' "$INSTDIR\bat.exe" 0 + CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$INSTDIR\bat.conf"' + SetOutPath "$INSTDIR" +!endif + +SectionEnd + +Section "Tray Monitor" SecTrayMonitor + SectionIn 1 2 3 + + SetOutPath "$INSTDIR" + +!if "${BUILD_BAT}" == "yes" + Call InstallCommonFiles + File "${SRC64_DIR}\QtCore4.dll" + File "${SRC64_DIR}\QtGui4.dll" + ;File "${SRC64_DIR}\bacula-tray-monitor.exe" + + ;File "/oname=$INSTDIR\working\bacula-tray-monitor.conf.in" "bacula-tray-monitor.conf.in" + ;StrCpy $0 "$INSTDIR" + ;StrCpy $1 bacula-tray-monitor.conf + ;Call ConfigEditAndCopy + + ; Create Start Menu entry + ;CreateShortCut "$SMPROGRAMS\Bacula\TrayMonitor.lnk" "$INSTDIR\bacula-tray-monitor.exe" "" "$INSTDIR\bacula-tray-monitor.exe" 0 + SetOutPath "$INSTDIR" +!endif + +SectionEnd + +SectionGroupEnd + +SectionGroup "Plugins" SecGroupPlugins + +Section "alldrives Plugin" SecAllDrivesPlugin + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\plugins" + File "${SRC_DIR}\alldrives-fd.dll" + SetOutPath "$INSTDIR" + +SectionEnd + +Section "Old (deprecated) Exchange Plugin" SecOldExchangePlugin + SectionIn 1 2 3 + + SetOutPath "$INSTDIR\plugins" + File "${SRC_DIR}\exchange-fd.dll" + SetOutPath "$INSTDIR" + +SectionEnd + +SectionGroupEnd + +Section "-Finish" + Push $R0 + + ${If} $OsIsNT = 1 + nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bacula-fd.conf" /G SYSTEM:F Administrators:F' + nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bacula-sd.conf" /G SYSTEM:F Administrators:F' + nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bat.conf" /G SYSTEM:F Administrators:F' + ${EndIf} + + ; Write the uninstall keys for Windows & create Start Menu entry + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}" + ${StrTok} $R0 "${VERSION}" "." 0 0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0 + ${StrTok} $R0 "${VERSION}" "." 1 0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1 + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://www.bacula.org" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.bacula.org" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.bacula.org?page=support" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"' + WriteUninstaller "$INSTDIR\Uninstall.exe" + CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 + + ${If} $OsIsNT = 1 + nsExec::ExecToLog 'net start bacula-fd' + nsExec::ExecToLog 'net start bacula-sd' + ${Else} + Exec '"$INSTDIR\bacula-fd.exe" /service -c "$INSTDIR\bacula-fd.conf"' + Exec '"$INSTDIR\bacula-sd.exe" /service -c "$INSTDIR\bacula-sd.conf"' + ${EndIf} + + Pop $R0 +SectionEnd + +; Extra Page descriptions + +LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula 64 bit File Daemon on this system." +LangString DESC_SecStorageDaemon ${LANG_ENGLISH} "Install Bacula 64 bit Storage Daemon on this system." +LangString DESC_SecConsole ${LANG_ENGLISH} "Install command console program on this system." +LangString DESC_SecBatConsole ${LANG_ENGLISH} "Install Bat graphical console program on this system." +LangString DESC_SecTrayMonitor ${LANG_ENGLISH} "Install Tray Monitor graphical program on this system." +LangString DESC_SecAllDrivesPlugin ${LANG_ENGLISH} "Install alldrives Plugin on this system." +LangString DESC_SecOldExchangePlugin ${LANG_ENGLISH} "Install old (deprecated) Exchange Plugin on this system." + +LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration" +LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration." + +LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)" +LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration." + +LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type" +LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type." + +LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates" +LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create a resource template for inclusion in the Director's configuration file." + +!InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN + !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecStorageDaemon} $(DESC_SecStorageDaemon) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecBatConsole} $(DESC_SecBatConsole) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecTrayMonitor} $(DESC_SecTrayMonitor) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecAllDrivesPlugin} $(DESC_SecAllDrivesPlugin) + !InsertMacro MUI_DESCRIPTION_TEXT ${SecOldExchangePlugin} $(DESC_SecOldExchangePlugin) +!InsertMacro MUI_FUNCTION_DESCRIPTION_END + +; Uninstall section + +UninstallText "This will uninstall Bacula. Click Uninstall to continue." + +Section "Uninstall" + ; Shutdown any baculum that could be running + nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill' + nsExec::Exec /TIMEOUT=200 'net stop bacula-fd' + nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /kill' + nsExec::Exec /TIMEOUT=200 'net stop bacula-sd' + Sleep 3000 + +; ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd" + ; Remove Bacula File Daemon service + nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /remove' + +; Remove Bacula Storage Daemon service + nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /remove' + + nsExec::ExecToLog '"$INSTDIR\plugins\exchange-fd.dll" /remove' + + ; remove registry keys + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" + DeleteRegKey HKLM "Software\Bacula" + + ; remove start menu items + SetShellVarContext all + Delete /REBOOTOK "$SMPROGRAMS\Bacula\*" + RMDir /REBOOTOK "$SMPROGRAMS\Bacula" + + ; remove files and uninstaller (preserving config for now) + Delete /REBOOTOK "$INSTDIR\doc\*" + Delete /REBOOTOK "$INSTDIR\help\*" + Delete /REBOOTOK "$INSTDIR\plugins\*" + Delete /REBOOTOK "$INSTDIR\openssl.exe" + Delete /REBOOTOK "$INSTDIR\bacula-fd.exe" + Delete /REBOOTOK "$INSTDIR\bat.exe" + Delete /REBOOTOK "$INSTDIR\bacula-tray-monitor.exe" + Delete /REBOOTOK "$INSTDIR\bsleep.exe" + Delete /REBOOTOK "$INSTDIR\bsmtp.exe" + Delete /REBOOTOK "$INSTDIR\bconsole.exe" + Delete /REBOOTOK "$INSTDIR\expr64.exe" + Delete /REBOOTOK "$INSTDIR\snooze.exe" + Delete /REBOOTOK "$INSTDIR\Uninstall.exe" + Delete /REBOOTOK "$INSTDIR\LICENSE" + Delete /REBOOTOK "$INSTDIR\Readme.txt" + Delete /REBOOTOK "$INSTDIR\*.dll" + Delete /REBOOTOK "$INSTDIR\plugins\alldrives-fd.dll" + Delete /REBOOTOK "$INSTDIR\plugins\exchange-fd.dll" + + ; Check for existing installation + MessageBox MB_YESNO|MB_ICONQUESTION \ + "Would you like to delete the current configuration files and the working state file?" IDNO NoDel + Delete /REBOOTOK "$INSTDIR\*" + Delete /REBOOTOK "$INSTDIR\bin32\*" + Delete /REBOOTOK "$INSTDIR\working\*" + Delete /REBOOTOK "$INSTDIR\plugins\*" + Delete /REBOOTOK "$INSTDIR\working\*" + Delete /REBOOTOK "$INSTDIR\*" + RMDir "$INSTDIR\plugins" + RMDir "$INSTDIR\working" + RMDir "$INSTDIR\bin32" + RMDir /REBOOTOK "$INSTDIR\plugins" + RMDir /REBOOTOK "$INSTDIR\working" + RMDir /REBOOTOK "$INSTDIR" +NoDel: + + ; remove directories used + RMDir "$INSTDIR\plugins" + RMDir "$INSTDIR\working" + RMDir "$INSTDIR\doc" + RMDir "$INSTDIR\help" + RMDir "$INSTDIR" +SectionEnd + +; +; $0 - Service Name (ie Bacula-FD) +; $1 - Service Description (ie Bacula File Daemon) +; $2 - Install as Service +; $3 - Start Service now +; +Function InstallDaemon + Call InstallCommonFiles + + WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2 + + ${If} $2 = 1 + nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill' + nsExec::Exec /TIMEOUT=200 'net stop bacula-fd' + nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /kill' + nsExec::Exec /TIMEOUT=200 'net stop bacula-sd' + sleep 3000 + nsExec::ExecToLog '"$INSTDIR\$0.exe" /remove' + nsExec::ExecToLog '"$INSTDIR\$0.exe" /install -c "$INSTDIR\$0.conf"' + + ${If} $OsIsNT <> 1 + File "Start.bat" + File "Stop.bat" + ${EndIf} + + ; Start the service? + + ${If} $3 = 1 + ${If} $OsIsNT = 1 + nsExec::ExecToLog 'net start $0' + ${Else} + Exec '"$INSTDIR\$0.exe" /service -c "$INSTDIR\$0.conf"' + ${EndIf} + ${EndIf} + ${Else} + CreateShortCut "$SMPROGRAMS\Bacula\Start $1.lnk" "$INSTDIR\$0.exe" '-c "$INSTDIR\$0.conf"' "$INSTDIR\$0.exe" 0 + ${EndIf} +FunctionEnd + +Function GetComputerName + Push $R0 + Push $R1 + Push $R2 + + System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2" + + ${StrCase} $R0 $R0 "L" + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +!define ComputerNameDnsFullyQualified 3 + +Function GetHostName + Push $R0 + Push $R1 + Push $R2 + + ${If} $OsIsNT = 1 + System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetComputerNameExA failed - LastError = $R2" + Call GetComputerName + Pop $R0 + ${Else} + Pop $R2 + ${EndIf} + ${Else} + Call GetComputerName + Pop $R0 + ${EndIf} + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +!define NameUserPrincipal 8 + +Function GetUserName + Push $R0 + Push $R1 + Push $R2 + + ${If} $OsIsNT = 1 + System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetUserNameExA failed - LastError = $R2" + Pop $R0 + StrCpy $R0 "" + ${Else} + Pop $R2 + ${EndIf} + ${Else} + StrCpy $R0 "" + ${EndIf} + + ${If} $R0 == "" + System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e" + ${If} $R2 = 0 + Pop $R2 + DetailPrint "GetUserNameA failed - LastError = $R2" + StrCpy $R0 "" + ${Else} + Pop $R2 + ${EndIf} + ${EndIf} + + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +Function ConfigEditAndCopy + Push $R1 + + ${If} ${FileExists} "$0\$1" + StrCpy $R1 ".new" + ${Else} + StrCpy $R1 "" + ${EndIf} + + nsExec::ExecToLog '$INSTDIR\working\sed.exe -i.bak -f "$INSTDIR\working\config.sed" "$INSTDIR\working\$1.in"' + CopyFiles "$INSTDIR\working\$1.in" "$0\$1$R1" + + Pop $R1 +FunctionEnd + +Function GetSelectedComponents + Push $R0 + StrCpy $R0 0 + ${If} ${SectionIsSelected} ${SecFileDaemon} + IntOp $R0 $R0 | ${ComponentFile} + ${EndIf} + ${If} ${SectionIsSelected} ${SecStorageDaemon} + IntOp $R0 $R0 | ${ComponentStorage} + ${EndIf} + ${If} ${SectionIsSelected} ${SecConsole} + IntOp $R0 $R0 | ${ComponentTextConsole} + ${EndIf} + ${If} ${SectionIsSelected} ${SecBatConsole} + IntOp $R0 $R0 | ${ComponentBatConsole} + ${EndIf} + ${If} ${SectionIsSelected} ${SecTrayMonitor} + ;IntOp $R0 $R0 | ${ComponentTrayMonitor} + ${EndIf} + ${If} ${SectionIsSelected} ${SecAllDrivesPlugin} + IntOp $R0 $R0 | ${ComponentAllDrivesPlugin} + ${EndIf} + ${If} ${SectionIsSelected} ${SecOldExchangePlugin} + IntOp $R0 $R0 | ${ComponentOldExchangePlugin} + ${EndIf} + Exch $R0 +FunctionEnd + +Function PageComponentsShow + + Call SelectPreviousComponents + Call UpdateComponentUI +FunctionEnd + +Function PageDirectoryPre + ${If} $AutomaticInstall = 1 + ${OrIf} $InstallType = ${UpgradeInstall} + Abort + ${EndIf} +FunctionEnd + +Function LeaveInstallPage + Push "$INSTDIR\install.log" + Call DumpLog +FunctionEnd + +Function EnterWriteTemplates + Push $R0 + Push $R1 + + Call GetSelectedComponents + Pop $R0 + + IntOp $R0 $R0 & ${ComponentDirector} + IntOp $R1 $NewComponents & ${ComponentsFileAndStorage} + + ${If} $R0 <> 0 + ${OrIf} $R1 = 0 + Pop $R1 + Pop $R0 + Abort + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentFile} + ${If} $R0 = 0 + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 2" State 0 + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 2" Flags DISABLED + DeleteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 3" State + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED + ${Else} + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 2" State 1 + DeleteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 2" Flags + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 3" State "C:\$ConfigClientName.conf" + ${EndIf} + + IntOp $R0 $NewComponents & ${ComponentStorage} + ${If} $R0 = 0 + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 4" State 0 + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 4" Flags DISABLED + DeleteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 5" State + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED + ${Else} + ;; TODO: See why this procedure causes a problem on Windows 2012 + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 4" State 0 + DeleteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 4" Flags + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 5" State "$INSTDIR\$ConfigStorageName.conf" + WriteINIStr "$INSTDIR\working\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST + ${EndIf} + + + !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)" + !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini" + + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State + ${If} $R0 <> 0 + File "/oname=$INSTDIR\working\client.conf.in" "client.conf.in" + + nsExec::ExecToLog '$INSTDIR\working\sed.exe -f "$INSTDIR\working\config.sed" "$INSTDIR\working\client.conf.in" "$INSTDIR\working\client.conf"' + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State + ${If} $R0 != "" + CopyFiles "$INSTDIR\working\client.conf" "$R0" + ${EndIf} + ${EndIf} + + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 4" State + ${If} $R0 <> 0 + File "/oname=$INSTDIR\working\storage.conf.in" "storage.conf.in" + + nsExec::ExecToLog '$INSTDIR\working\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\storage.conf.in"' + !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 5" State + ${If} $R0 != "" + CopyFiles "$INSTDIR\working\storage.conf.in" "$R0" + ${EndIf} + ${EndIf} + + + Pop $R1 + Pop $R0 +FunctionEnd + +Function SelectPreviousComponents + ${If} $InstallType <> ${NewInstall} + IntOp $R1 $PreviousComponents & ${ComponentFile} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecFileDaemon} + !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecFileDaemon} + !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentStorage} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecStorageDaemon} + !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecStorageDaemon} + !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentTextConsole} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecConsole} + !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecConsole} + !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentBatConsole} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecBatConsole} + !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecBatConsole} + !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentTrayMonitor} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecTrayMonitor} + ;!InsertMacro SetSectionFlag ${SecTrayMonitor} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecTrayMonitor} + !InsertMacro ClearSectionFlag ${SecTrayMonitor} ${SF_RO} + ${EndIf} + IntOp $R1 $PreviousComponents & ${ComponentAllDrivesPlugin} + ${If} $R1 <> 0 + !InsertMacro SelectSection ${SecAllDrivesPlugin} + !InsertMacro SetSectionFlag ${SecAllDrivesPlugin} ${SF_RO} + ${Else} + !InsertMacro UnselectSection ${SecAllDrivesPlugin} + !InsertMacro ClearSectionFlag ${SecAllDrivesPlugin} ${SF_RO} + ${EndIf} +; IntOp $R1 $PreviousComponents & ${ComponentWinBMRPlugin} +; ${If} $R1 <> 0 +; !InsertMacro SelectSection ${SecWinBMRPlugin} +; !InsertMacro SetSectionFlag ${SecWinBMRPlugin} ${SF_RO} +; ${Else} +; !InsertMacro UnselectSection ${SecWinBMRPlugin} +; !InsertMacro ClearSectionFlag ${SecWinBMRPlugin} ${SF_RO} +; ${EndIf} +; IntOp $R1 $PreviousComponents & ${ComponentOldExchangePlugin} +; ${If} $R1 <> 0 +; !InsertMacro SelectSection ${SecOldExchangePlugin} +; !InsertMacro SetSectionFlag ${SecOldExchangePlugin} ${SF_RO} +; ${Else} +; !InsertMacro UnselectSection ${SecOldExchangePlugin} +; !InsertMacro ClearSectionFlag ${SecOldExchangePlugin} ${SF_RO} +; ${EndIf} + ${EndIf} +FunctionEnd + +Function UpdateComponentUI + Push $R0 + Push $R1 + + Call GetSelectedComponents + Pop $R0 + + IntOp $R1 $R0 ^ $PreviousComponents + IntOp $NewComponents $R0 & $R1 + + ${If} $InstallType <> ${NewInstall} + IntOp $R1 $NewComponents & ${ComponentFile} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentStorage} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentTextConsole} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentBatConsole} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentTrayMonitor} + ${If} $R1 <> 0 + ;!InsertMacro SetSectionFlag ${SecTrayMonitor} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecTrayMonitor} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentAllDrivesPlugin} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecAllDrivesPlugin} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecAllDrivesPlugin} ${SF_BOLD} + ${EndIf} + IntOp $R1 $NewComponents & ${ComponentOldExchangePlugin} + ${If} $R1 <> 0 + !InsertMacro SetSectionFlag ${SecOldExchangePlugin} ${SF_BOLD} + ${Else} + !InsertMacro ClearSectionFlag ${SecOldExchangePlugin} ${SF_BOLD} + ${EndIf} + ${EndIf} + + GetDlgItem $R0 $HWNDPARENT 1 + + IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig} + ${If} $R1 = 0 + SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install" + ${Else} + SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >" + ${EndIf} + + Pop $R1 + Pop $R0 +FunctionEnd + +!include "InstallType.nsh" +!include "ConfigPage1.nsh" +!include "ConfigPage2.nsh" +!include "DumpLog.nsh" diff --git a/bacula/src/win32/winapi.h b/bacula/src/win32/winapi.h new file mode 100644 index 0000000000..b4027dc9a3 --- /dev/null +++ b/bacula/src/win32/winapi.h @@ -0,0 +1,215 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2003-2010 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Windows APIs that are different for each system. + * We use pointers to the entry points so that a + * single binary will run on all Windows systems. + * + * Kern Sibbald MMIII + */ + +#ifndef __WINAPI_H +#define __WINAPI_H + +#if defined(HAVE_WIN32) +/* + * Commented out native.h include statement, which is not distributed with the + * free version of VC++, and which is not used in bacula. + * + * #if !defined(HAVE_MINGW) // native.h not present on mingw + * #include + * #endif + */ +#include + +#ifndef POOLMEM +typedef char POOLMEM; +#endif + +// unicode enabling of win 32 needs some defines and functions + +// using an average of 3 bytes per character is probably fine in +// practice but I believe that Windows actually uses UTF-16 encoding +// as opposed to UCS2 which means characters 0x10000-0x10ffff are +// valid and result in 4 byte UTF-8 encodings. +#define MAX_PATH_UTF8 MAX_PATH*4 // strict upper bound on UTF-16 to UTF-8 conversion + +// from +// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getfileattributesex.asp +// In the ANSI version of this function, the name is limited to +// MAX_PATH characters. To extend this limit to 32,767 wide +// characters, call the Unicode version of the function and prepend +// "\\?\" to the path. For more information, see Naming a File. +#define MAX_PATH_W 32767 + +int wchar_2_UTF8(POOLMEM **pszUTF, const wchar_t *pszUCS); +int wchar_2_UTF8(char *pszUTF, const WCHAR *pszUCS, int cchChar = MAX_PATH_UTF8); +int UTF8_2_wchar(POOLMEM **pszUCS, const char *pszUTF); +int make_win32_path_UTF8_2_wchar(POOLMEM **pszUCS, const char *pszUTF, BOOL* pBIsRawPath = NULL); + +// init with win9x, but maybe set to NT in InitWinAPI +extern DWORD DLL_IMP_EXP g_platform_id; +extern DWORD DLL_IMP_EXP g_MinorVersion; +extern DWORD DLL_IMP_EXP g_MajorVersion; + +/* In ADVAPI32.DLL */ +typedef BOOL (WINAPI * t_OpenProcessToken)(HANDLE, DWORD, PHANDLE); +typedef BOOL (WINAPI * t_AdjustTokenPrivileges)(HANDLE, BOOL, + PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); +typedef BOOL (WINAPI * t_LookupPrivilegeValue)(LPCTSTR, LPCTSTR, PLUID); + +extern t_OpenProcessToken DLL_IMP_EXP p_OpenProcessToken; +extern t_AdjustTokenPrivileges DLL_IMP_EXP p_AdjustTokenPrivileges; +extern t_LookupPrivilegeValue DLL_IMP_EXP p_LookupPrivilegeValue; + +/* In MSVCRT.DLL */ +typedef int (__cdecl * t_wunlink) (const wchar_t *); +typedef int (__cdecl * t_wmkdir) (const wchar_t *); +typedef int (__cdecl * t_wopen) (const wchar_t *, int, ...); + +extern t_wunlink DLL_IMP_EXP p_wunlink; +extern t_wmkdir DLL_IMP_EXP p_wmkdir; + +/* In KERNEL32.DLL */ +typedef BOOL (WINAPI * t_GetFileAttributesExA)(LPCSTR, GET_FILEEX_INFO_LEVELS, + LPVOID); +typedef BOOL (WINAPI * t_GetFileAttributesExW)(LPCWSTR, GET_FILEEX_INFO_LEVELS, + LPVOID); + +typedef DWORD (WINAPI * t_GetFileAttributesA)(LPCSTR); +typedef DWORD (WINAPI * t_GetFileAttributesW)(LPCWSTR); +typedef BOOL (WINAPI * t_SetFileAttributesA)(LPCSTR, DWORD); +typedef BOOL (WINAPI * t_SetFileAttributesW)(LPCWSTR, DWORD); + +typedef HANDLE (WINAPI * t_CreateFileA) (LPCSTR, DWORD ,DWORD, LPSECURITY_ATTRIBUTES, + DWORD , DWORD, HANDLE); +typedef HANDLE (WINAPI * t_CreateFileW) (LPCWSTR, DWORD ,DWORD, LPSECURITY_ATTRIBUTES, + DWORD , DWORD, HANDLE); + +typedef BOOL (WINAPI * t_CreateDirectoryA) (LPCSTR, LPSECURITY_ATTRIBUTES); +typedef BOOL (WINAPI * t_CreateDirectoryW) (LPCWSTR, LPSECURITY_ATTRIBUTES); + +typedef BOOL (WINAPI * t_SetProcessShutdownParameters)(DWORD, DWORD); +typedef BOOL (WINAPI * t_BackupRead)(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*); +typedef BOOL (WINAPI * t_BackupWrite)(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*); + +typedef int (WINAPI * t_WideCharToMultiByte) (UINT CodePage, DWORD , LPCWSTR, int, + LPSTR, int, LPCSTR, LPBOOL); + +typedef int (WINAPI * t_MultiByteToWideChar) (UINT, DWORD, LPCSTR, int, LPWSTR, int); +typedef HANDLE (WINAPI * t_FindFirstFileA) (LPCSTR, LPWIN32_FIND_DATAA); +typedef HANDLE (WINAPI * t_FindFirstFileW) (LPCWSTR, LPWIN32_FIND_DATAW); + +typedef BOOL (WINAPI * t_FindNextFileA) (HANDLE, LPWIN32_FIND_DATAA); +typedef BOOL (WINAPI * t_FindNextFileW) (HANDLE, LPWIN32_FIND_DATAW); + +typedef BOOL (WINAPI * t_SetCurrentDirectoryA) (LPCSTR); +typedef BOOL (WINAPI * t_SetCurrentDirectoryW) (LPCWSTR); + +typedef DWORD (WINAPI * t_GetCurrentDirectoryA) (DWORD, LPSTR); +typedef DWORD (WINAPI * t_GetCurrentDirectoryW) (DWORD, LPWSTR); + +typedef BOOL (WINAPI * t_GetVolumePathNameW) (LPCWSTR, LPWSTR, DWORD); +typedef BOOL (WINAPI * t_GetVolumeNameForVolumeMountPointW) (LPCWSTR, LPWSTR, DWORD); + +typedef BOOL (WINAPI * t_AttachConsole) (DWORD); + +typedef BOOL (WINAPI *t_CreateProcessA) ( + LPCSTR, + LPSTR, + LPSECURITY_ATTRIBUTES, + LPSECURITY_ATTRIBUTES, + BOOL, + DWORD, + PVOID, + LPCSTR, + LPSTARTUPINFOA, + LPPROCESS_INFORMATION); +typedef BOOL (WINAPI *t_CreateProcessW) ( + LPCWSTR, + LPWSTR, + LPSECURITY_ATTRIBUTES, + LPSECURITY_ATTRIBUTES, + BOOL, + DWORD, + PVOID, + LPCWSTR, + LPSTARTUPINFOW, + LPPROCESS_INFORMATION); + +extern t_CreateProcessA DLL_IMP_EXP p_CreateProcessA; +extern t_CreateProcessW DLL_IMP_EXP p_CreateProcessW; + +extern t_GetFileAttributesA DLL_IMP_EXP p_GetFileAttributesA; +extern t_GetFileAttributesW DLL_IMP_EXP p_GetFileAttributesW; + +extern t_GetFileAttributesExA DLL_IMP_EXP p_GetFileAttributesExA; +extern t_GetFileAttributesExW DLL_IMP_EXP p_GetFileAttributesExW; + +extern t_SetFileAttributesA DLL_IMP_EXP p_SetFileAttributesA; +extern t_SetFileAttributesW DLL_IMP_EXP p_SetFileAttributesW; + +extern t_CreateFileA DLL_IMP_EXP p_CreateFileA; +extern t_CreateFileW DLL_IMP_EXP p_CreateFileW; + +extern t_CreateDirectoryA DLL_IMP_EXP p_CreateDirectoryA; +extern t_CreateDirectoryW DLL_IMP_EXP p_CreateDirectoryW; + +extern t_SetProcessShutdownParameters DLL_IMP_EXP p_SetProcessShutdownParameters; +extern t_BackupRead DLL_IMP_EXP p_BackupRead; +extern t_BackupWrite DLL_IMP_EXP p_BackupWrite; + +extern t_WideCharToMultiByte DLL_IMP_EXP p_WideCharToMultiByte; +extern t_MultiByteToWideChar DLL_IMP_EXP p_MultiByteToWideChar; + +extern t_FindFirstFileA DLL_IMP_EXP p_FindFirstFileA; +extern t_FindFirstFileW DLL_IMP_EXP p_FindFirstFileW; + +extern t_FindNextFileA DLL_IMP_EXP p_FindNextFileA; +extern t_FindNextFileW DLL_IMP_EXP p_FindNextFileW; + +extern t_SetCurrentDirectoryA DLL_IMP_EXP p_SetCurrentDirectoryA; +extern t_SetCurrentDirectoryW DLL_IMP_EXP p_SetCurrentDirectoryW; + +extern t_GetCurrentDirectoryA DLL_IMP_EXP p_GetCurrentDirectoryA; +extern t_GetCurrentDirectoryW DLL_IMP_EXP p_GetCurrentDirectoryW; + +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(); + +/* In SHFolder.dll on older systems, and now Shell32.dll */ +typedef BOOL (WINAPI * t_SHGetFolderPath)(HWND, int, HANDLE, DWORD, LPTSTR); +extern t_SHGetFolderPath DLL_IMP_EXP p_SHGetFolderPath; + +#endif + +#endif /* __WINAPI_H */ diff --git a/bacula/src/win32/wx-console/Makefile b/bacula/src/win32/wx-console/Makefile new file mode 100755 index 0000000000..561d019df4 --- /dev/null +++ b/bacula/src/win32/wx-console/Makefile @@ -0,0 +1,87 @@ +# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# +# Written by Robert Nelson, June 2006 +# + +include ../Makefile.inc + +INCLUDES = \ + -I../../wx-console \ + $(INCLUDE_BACULA) \ + $(INCLUDE_WX) \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_OPENSSL) \ + $(INCLUDE_ICONS) + +DEFINES = \ + -DUSING_DLL \ + -DHAVE_WXCONSOLE \ + -D__WXMSW__ \ + -DWXUSINGDLL \ + -D_STAT_H \ + -D_STAT_DEFINED \ + $(HAVES) + +vpath %.c $(MAINDIR)/src/wx-console +vpath %.cpp $(MAINDIR)/src/wx-console +vpath %.rc $(MAINDIR)/src/wx-console + +########################################################################## + +# Files in $(MAINDIR)/src/wx-console + +CONSOLE_OBJS = \ + $(OBJDIR)/authenticate.o \ + $(OBJDIR)/console_conf.o \ + $(OBJDIR)/console_thread.o \ + $(OBJDIR)/main.o \ + $(OBJDIR)/wxbconfigfileeditor.o \ + $(OBJDIR)/wxbconfigpanel.o \ + $(OBJDIR)/wxbhistorytextctrl.o \ + $(OBJDIR)/wxblistctrl.o \ + $(OBJDIR)/wxbmainframe.o \ + $(OBJDIR)/wxbrestorepanel.o \ + $(OBJDIR)/wxbtableparser.o \ + $(OBJDIR)/wxbtreectrl.o \ + $(OBJDIR)/wxbutils.o \ + $(OBJDIR)/wx-console_private.res + +ALL_OBJS = $(CONSOLE_OBJS) + +CONSOLE_LIBS = \ + $(LIBS_WX) \ + $(LIBS_NETWORK) \ + -lcomctl32 \ + -lole32 \ + -loleaut32 \ + -luuid + +###################################################################### + +# Targets + +.PHONY: all clean + +all: $(BINDIR)/bwx-console.exe + +clean: + $(call clean_obj,$(ALL_OBJS)) + $(call clean_exe,$(BINDIR)/bwx-console.exe) + $(call clean_exe,$(BINDIR)/wx-console.exe) + $(ECHO_CMD)rm -rf $(OBJDIRS) + +# +# Rules +# + +$(BINDIR)/bwx-console.exe: $(CONSOLE_OBJS) $(LIBS_BACULA) + $(call link_winapp,$(CONSOLE_LIBS)) + +$(OBJDIR)/wx-console_private.res: wx-console_private.rc + @echo "Compiling $@" + $(call checkdir,$@) + $(ECHO_CMD)$(WINDRES) $(INCLUDE_ICONS) -I$(MAINDIR)/src/wx-console -O coff $< -o $@ + +include ../Makefile.rules diff --git a/bacula/src/win32/wx-console/bwx-console.manifest b/bacula/src/win32/wx-console/bwx-console.manifest new file mode 100644 index 0000000000..b8e5f55f04 --- /dev/null +++ b/bacula/src/win32/wx-console/bwx-console.manifest @@ -0,0 +1,21 @@ + + + + Bacula bwx-console for Win32 + + + + + + + diff --git a/bacula/src/win32/wx-console/w32api.h b/bacula/src/win32/wx-console/w32api.h new file mode 100644 index 0000000000..d509c18906 --- /dev/null +++ b/bacula/src/win32/wx-console/w32api.h @@ -0,0 +1,11 @@ +#ifndef _W32API_H_ +#define _W32API_H_ +#if __GNUC__ >=3 +#pragma GCC system_header +#endif + +#define __W32API_VERSION 2.4 +#define __W32API_MAJOR_VERSION 2 +#define __W32API_MINOR_VERSION 4 + +#endif /* ndef _W32API_H_ */ diff --git a/bacula/src/win32/wx-console/wx-console.vcproj b/bacula/src/win32/wx-console/wx-console.vcproj new file mode 100644 index 0000000000..bab6aca168 --- /dev/null +++ b/bacula/src/win32/wx-console/wx-console.vcproj @@ -0,0 +1,352 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.39.2