]> git.sur5r.net Git - bacula/bacula/commitdiff
Merge in all the low-risk changes from the Windows branch.
authorRobert Nelson <robertn@the-nelsons.org>
Fri, 30 Jun 2006 04:06:34 +0000 (04:06 +0000)
committerRobert Nelson <robertn@the-nelsons.org>
Fri, 30 Jun 2006 04:06:34 +0000 (04:06 +0000)
Add all the new files from the Windows branch.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3094 91ce42f0-d328-0410-95d8-f526ca767f89

112 files changed:
bacula/src/baconfig.h
bacula/src/bacula.h
bacula/src/bc_types.h
bacula/src/cats/Makefile.in
bacula/src/cats/bdb.c
bacula/src/cats/bdb_create.c
bacula/src/cats/bdb_find.c
bacula/src/cats/bdb_get.c
bacula/src/cats/make_mysql_tables.in
bacula/src/cats/protos.h
bacula/src/cats/sql_create.c
bacula/src/cats/sql_get.c
bacula/src/cats/sql_list.c
bacula/src/cats/sql_update.c
bacula/src/console/console.c
bacula/src/console/console_conf.c
bacula/src/dird/backup.c
bacula/src/dird/bsr.c
bacula/src/dird/catreq.c
bacula/src/dird/dird.c
bacula/src/dird/dird_conf.c
bacula/src/dird/dird_conf.h
bacula/src/dird/expand.c
bacula/src/dird/fd_cmds.c
bacula/src/dird/inc_conf.c
bacula/src/dird/job.c
bacula/src/dird/run_conf.c
bacula/src/dird/scheduler.c
bacula/src/dird/sql_cmds.c
bacula/src/dird/ua_cmds.c
bacula/src/dird/ua_output.c
bacula/src/dird/ua_prune.c
bacula/src/dird/ua_query.c
bacula/src/dird/ua_restore.c
bacula/src/dird/ua_run.c
bacula/src/dird/ua_update.c
bacula/src/filed/estimate.c
bacula/src/filed/filed.c
bacula/src/filed/filed_conf.c
bacula/src/filed/job.c
bacula/src/filed/status.c
bacula/src/findlib/attribs.c
bacula/src/findlib/bfile.c
bacula/src/findlib/bfile.h
bacula/src/findlib/drivetype.c [new file with mode: 0644]
bacula/src/findlib/enable_priv.c
bacula/src/findlib/find.c
bacula/src/findlib/makepath.c
bacula/src/findlib/match.c
bacula/src/lib/base64.c
bacula/src/lib/berrno.c
bacula/src/lib/bnet.c
bacula/src/lib/bpipe.c
bacula/src/lib/bshm.c
bacula/src/lib/bsys.c
bacula/src/lib/btime.c
bacula/src/lib/daemon.c
bacula/src/lib/enh_fnmatch.c [new file with mode: 0644]
bacula/src/lib/enh_fnmatch.h [new file with mode: 0644]
bacula/src/lib/events.c
bacula/src/lib/lex.c
bacula/src/lib/md5.c
bacula/src/lib/message.c
bacula/src/lib/parse_conf.c
bacula/src/lib/protos.h
bacula/src/lib/res.c
bacula/src/lib/runscript.c
bacula/src/lib/sha1.c
bacula/src/stored/bextract.c
bacula/src/stored/bls.c
bacula/src/stored/bscan.c
bacula/src/stored/btape.c
bacula/src/stored/dev.c
bacula/src/stored/dev.h
bacula/src/stored/dircmd.c
bacula/src/stored/fd_cmds.c
bacula/src/stored/spool.c
bacula/src/stored/stored_conf.c
bacula/src/stored/stored_conf.h
bacula/src/tools/bwild.c
bacula/src/tools/drivetype.c [new file with mode: 0644]
bacula/src/tools/fstype.c
bacula/src/tools/testfind.c
bacula/src/tools/testls.c
bacula/src/win32/ClientConfig.ini [new file with mode: 0644]
bacula/src/win32/Makefile.inc.cross [new file with mode: 0644]
bacula/src/win32/Makefile.inc.native [new file with mode: 0644]
bacula/src/win32/Makefile.rules [new file with mode: 0644]
bacula/src/win32/Makefile.template [new file with mode: 0644]
bacula/src/win32/bacula.sln
bacula/src/win32/compat/Makefile [new file with mode: 0644]
bacula/src/win32/compat/compat.cpp
bacula/src/win32/compat/compat.h
bacula/src/win32/compat/compat.vcproj [new file with mode: 0644]
bacula/src/win32/compat/getopt.c
bacula/src/win32/compat/sys/mtio.h [new file with mode: 0644]
bacula/src/win32/compat/winapi.c [new file with mode: 0644]
bacula/src/win32/console/console.vcproj
bacula/src/win32/filed/Makefile [new file with mode: 0644]
bacula/src/win32/filed/baculafd.vcproj [new file with mode: 0644]
bacula/src/win32/filed/vss.cpp [new file with mode: 0644]
bacula/src/win32/filed/vss.h [new file with mode: 0644]
bacula/src/win32/filed/vss_W2K3.cpp [new file with mode: 0644]
bacula/src/win32/filed/vss_XP.cpp [new file with mode: 0644]
bacula/src/win32/filed/vss_generic.cpp [new file with mode: 0644]
bacula/src/win32/filed/winmain.cpp [new file with mode: 0644]
bacula/src/win32/filed/winservice.cpp [new file with mode: 0644]
bacula/src/win32/mingw-utils.patch
bacula/src/win32/winapi.h [new file with mode: 0644]
bacula/src/win32/wx-console/wx-console.vcproj
bacula/src/wx-console/console_conf.c
bacula/src/wx-console/console_thread.cpp

index 16e9cfe424eb677f6dc2e2329adc3809ca5601b3..f052b13cdead87fc852e32849673cfcfc8584b17 100644 (file)
@@ -65,7 +65,7 @@
 /* Allow printing of NULL pointers */
 #define NPRT(x) (x)?(x):_("*None*")
  
-#ifdef WIN32
+#if defined(HAVE_WIN32)
 #undef ENABLE_NLS
 #endif
 
  * or saved */
 #define FT_DIRBEGIN  18               /* Directory at beginning (not saved) */
 #define FT_INVALIDFS 19               /* File system not allowed for */
+#define FT_INVALIDDT 20               /* Drive type not allowed for */
 
 /* Definitions for upper part of type word (see above). */
 #define AR_DATA_STREAM (1<<16)        /* Data stream id present */
@@ -562,13 +563,9 @@ extern "C" int getdomainname(char *name, int len);
 extern "C" int mknod ( const char *path, int mode, dev_t device );
 #endif
 
-#ifdef HAVE_CYGWIN
-/* They don't really have it */
-#undef HAVE_GETDOMAINNAME
-#endif
 
 /* Define Winsock functions if we aren't on Windows */
-#if (!defined HAVE_WIN32) || (defined HAVE_CYGWIN)
+#if !defined HAVE_WIN32
 #define WSA_Init() 0 /* 0 = success */
 #define WSACleanup() 0 /* 0 = success */
 #endif
index daedd83bd3048d30d1d3c3c633d2d57567b5e46f..f677f2458a5cd44c0002499046633a18872a1878 100644 (file)
@@ -26,8 +26,8 @@
 #define _LANGUAGE_C_PLUS_PLUS 1
 #endif
 
-#ifdef WIN32
-#ifdef HAVE_MINGW
+#if defined(HAVE_WIN32)
+#if defined(HAVE_MINGW)
 #include "mingwconfig.h"
 #include "winhost.h"
 #define _STAT_H       /* don't pull in MinGW stat.h */
index 75950bd32ded714331572a9c6ffc83eb34275855..81595edb9e7a02484dd91bd05cd358f55e403b28 100644 (file)
@@ -173,10 +173,6 @@ typedef float             float32_t;
 /* Unix time (time_t) widened to 64 bits */
 #define utime_t int64_t
 
-#ifdef HAVE_CYGWIN
-#define int_least16_t int32_t
-#endif
-
 #ifndef HAVE_SOCKLEN_T
 #define socklen_t int
 #endif
index 44ec71b3602821ab44f55ae0130b2f277d79409e..0a3495610e09d908ebc7a9207c59a8fe4054a80d 100644 (file)
@@ -81,6 +81,9 @@ realclean: clean
        $(RMF) create_sqlite_database      update_sqlite_tables     make_sqlite_tables
        $(RMF) grant_sqlite_privileges     drop_sqlite_tables       drop_sqlite_database
 
+       $(RMF) create_sqlite3_database     update_sqlite3_tables     make_sqlite3_tables
+       $(RMF) grant_sqlite3_privileges    drop_sqlite3_tables      drop_sqlite3_database
+
        $(RMF) mysql sqlite postgresql
        $(RMF) make_catalog_backup delete_catalog_backup
 
index a0836efc9f7c35b1f9017d83864a338642653c55..43cc175e2bc81d4c8ac44c05ad5fd15e04471538 100644 (file)
@@ -296,7 +296,7 @@ int bdb_open_jobs_file(B_DB *mdb)
 
    if (!mdb->jobfd) {
       dbf = make_filename(mdb, DB_JOBS_FILENAME);
-      mdb->jobfd = fopen(dbf, "r+");
+      mdb->jobfd = fopen(dbf, "r+b");
       if (!mdb->jobfd) {
          Mmsg2(&mdb->errmsg, "Error opening DB Jobs file %s: ERR=%s\n",
             dbf, strerror(errno));
@@ -318,7 +318,7 @@ int bdb_open_jobmedia_file(B_DB *mdb)
 
    if (!mdb->jobmediafd) {
       dbf = make_filename(mdb, DB_JOBMEDIA_FILENAME);
-      mdb->jobmediafd = fopen(dbf, "r+");
+      mdb->jobmediafd = fopen(dbf, "r+b");
       if (!mdb->jobmediafd) {
          Mmsg2(&mdb->errmsg, "Error opening DB JobMedia file %s: ERR=%s\n",
             dbf, strerror(errno));
@@ -341,7 +341,7 @@ int bdb_open_pools_file(B_DB *mdb)
 
    if (!mdb->poolfd) {
       dbf = make_filename(mdb, DB_POOLS_FILENAME);
-      mdb->poolfd = fopen(dbf, "r+");
+      mdb->poolfd = fopen(dbf, "r+b");
       if (!mdb->poolfd) {
          Mmsg2(&mdb->errmsg, "Error opening DB Pools file %s: ERR=%s\n",
             dbf, strerror(errno));
@@ -364,7 +364,7 @@ int bdb_open_client_file(B_DB *mdb)
 
    if (!mdb->clientfd) {
       dbf = make_filename(mdb, DB_CLIENT_FILENAME);
-      mdb->clientfd = fopen(dbf, "r+");
+      mdb->clientfd = fopen(dbf, "r+b");
       if (!mdb->clientfd) {
          Mmsg2(&mdb->errmsg, "Error opening DB Clients file %s: ERR=%s\n",
             dbf, strerror(errno));
@@ -386,7 +386,7 @@ int bdb_open_fileset_file(B_DB *mdb)
 
    if (!mdb->filesetfd) {
       dbf = make_filename(mdb, DB_CLIENT_FILENAME);
-      mdb->filesetfd = fopen(dbf, "r+");
+      mdb->filesetfd = fopen(dbf, "r+b");
       if (!mdb->filesetfd) {
          Mmsg2(&mdb->errmsg, "Error opening DB FileSet file %s: ERR=%s\n",
             dbf, strerror(errno));
@@ -410,7 +410,7 @@ int bdb_open_media_file(B_DB *mdb)
 
    if (!mdb->mediafd) {
       dbf = make_filename(mdb, DB_MEDIA_FILENAME);
-      mdb->mediafd = fopen(dbf, "r+");
+      mdb->mediafd = fopen(dbf, "r+b");
       if (!mdb->mediafd) {
          Mmsg2(&mdb->errmsg, "Error opening DB Media file %s: ERR=%s\n",
             dbf, strerror(errno));
index 3228d42e08e11e0d487ec2d87370ceeea1a5af8f..07d7b9a711d609d81cf799d5b66727c218f77618 100644 (file)
@@ -23,8 +23,8 @@
 
    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.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+   file LICENSE for additional details.
 
  */
 
@@ -71,7 +71,7 @@ int db_create_file_item(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
  * Returns: 0 on failure
  *          1 on success
  */
-int db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
+bool db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 {
    int len;
 
index 6c5bd3b11740c812634b5c42e3389dbcda53a19c..f63a5354dc04f96f154b77ea1b8826b737ada460 100644 (file)
@@ -16,6 +16,7 @@
  *
  *    Version $Id$
  */
+
 /*
    Copyright (C) 2001-2006 Kern Sibbald
 
@@ -171,7 +172,7 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
    return stat;
 }
 
-int
+bool
 db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr)
 { return 0; }
 
index 8fd20b0fa3898753ac50a06b9d6b43a0abfbcb60..3a1e7d8174a7ab58ec691e33438493b975e990bc 100644 (file)
@@ -15,6 +15,7 @@
  *
  *    Version $Id$
  */
+
 /*
    Copyright (C) 2001-2006 Kern Sibbald
 
@@ -26,7 +27,7 @@
    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.
+   file LICENSE for additional details.
 
  */
 
@@ -59,7 +60,7 @@
  *          1 on success
  */
 
-int db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
+bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 {
    JOB_DBR ojr;
    faddr_t rec_addr;
index 541e2d8863116e52c5eb0b66ce3e95a6142b0363..d0f7f3108d52d3502852c35a3bf4dc11542ca92f 100644 (file)
@@ -92,21 +92,21 @@ CREATE TABLE Job (
    Name TINYBLOB NOT NULL,
    Type BINARY(1) NOT NULL,
    Level BINARY(1) NOT NULL,
-   ClientId INTEGER NOT NULL REFERENCES Client,
+   ClientId INTEGER NOT NULL DEFAULT 0 REFERENCES Client,
    JobStatus BINARY(1) NOT NULL,
    SchedTime DATETIME NOT NULL,
-   StartTime DATETIME NOT NULL,
-   EndTime DATETIME NOT NULL,
-   RealEndTime DATETIME NOT NULL,
+   StartTime DATETIME NOT NULL DEFAULT 0,
+   EndTime DATETIME NOT NULL DEFAULT 0,
+   RealEndTime DATETIME NOT NULL DEFAULT 0,
    JobTDate BIGINT UNSIGNED NOT NULL,
    VolSessionId INTEGER UNSIGNED NOT NULL DEFAULT 0,
    VolSessionTime INTEGER UNSIGNED NOT NULL DEFAULT 0,
    JobFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   JobBytes BIGINT UNSIGNED NOT NULL,
+   JobBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
    JobErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,
    JobMissingFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   PoolId INTEGER UNSIGNED NOT NULL REFERENCES Pool,
-   FileSetId INTEGER UNSIGNED NOT NULL REFERENCES FileSet,
+   PoolId INTEGER UNSIGNED NOT NULL DEFAULT 0 REFERENCES Pool,
+   FileSetId INTEGER UNSIGNED NOT NULL DEFAULT 0 REFERENCES FileSet,
    PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,
    PurgedFiles TINYINT NOT NULL DEFAULT 0,
    HasBase TINYINT NOT NULL DEFAULT 0,
@@ -157,9 +157,9 @@ CREATE TABLE Media (
    MediaType TINYBLOB NOT NULL,
    MediaTypeId INTEGER UNSIGNED NOT NULL REFERENCES MediaType,
    LabelType TINYINT NOT NULL DEFAULT 0,
-   FirstWritten DATETIME NOT NULL,
-   LastWritten DATETIME NOT NULL,
-   LabelDate DATETIME NOT NULL,
+   FirstWritten DATETIME NOT NULL DEFAULT 0,
+   LastWritten DATETIME NOT NULL DEFAULT 0,
+   LabelDate DATETIME NOT NULL DEFAULT 0,
    VolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,
    VolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
    VolBlocks INTEGER UNSIGNED NOT NULL DEFAULT 0,
@@ -188,7 +188,7 @@ CREATE TABLE Media (
    EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,
    LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,
    RecycleCount INTEGER UNSIGNED DEFAULT 0,
-   InitialWrite DATETIME NOT NULL,
+   InitialWrite DATETIME NOT NULL DEFAULT 0,
    ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
    RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
    PRIMARY KEY(MediaId),
index fd3aa6d8183c8fc837d9a76f5e115778a28765f9..dcc84f7cb8fdbff493db16091a346193a18091c4 100644 (file)
@@ -93,7 +93,7 @@ void db_list_job_totals(JCR *jcr, B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit,
 void db_list_files_for_job(JCR *jcr, B_DB *db, uint32_t jobid, DB_LIST_HANDLER sendit, void *ctx);
 void db_list_media_records(JCR *jcr, B_DB *mdb, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
 void db_list_jobmedia_records(JCR *jcr, B_DB *mdb, JobId_t JobId, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
-int  db_list_sql_query(JCR *jcr, B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx, int verbose, e_list_type type);
+int  db_list_sql_query(JCR *jcr, B_DB *mdb, const char *query, DB_LIST_HANDLER *sendit, void *ctx, int verbose, e_list_type type);
 void db_list_client_records(JCR *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
 
 /* update.c */
index f42f2cd3d31fc99c09badf422cd8800af053787c..7b1cc909d7852e0a8407165890cdb04f5543adb4 100644 (file)
@@ -71,8 +71,8 @@ db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
    stime = jr->SchedTime;
    ASSERT(stime != 0);
 
-   localtime_r(&stime, &tm);
-   strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm);
+   (void)localtime_r(&stime, &tm);
+   strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
    JobTDate = (utime_t)stime;
 
    /* Must create it */
@@ -443,8 +443,8 @@ db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
          if (mr->LabelDate == 0) {
             mr->LabelDate = time(NULL);
          }
-         localtime_r(&mr->LabelDate, &tm);
-         strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm);
+         (void)localtime_r(&mr->LabelDate, &tm);
+         strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
          Mmsg(mdb->cmd, "UPDATE Media SET LabelDate='%s' "
               "WHERE MediaId=%d", dt, mr->MediaId);
          stat = UPDATE_DB(jcr, mdb, mdb->cmd);
@@ -615,8 +615,8 @@ bool db_create_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
    if (fsr->CreateTime == 0 && fsr->cCreateTime[0] == 0) {
       fsr->CreateTime = time(NULL);
    }
-   localtime_r(&fsr->CreateTime, &tm);
-   strftime(fsr->cCreateTime, sizeof(fsr->cCreateTime), "%Y-%m-%d %T", &tm);
+   (void)localtime_r(&fsr->CreateTime, &tm);
+   strftime(fsr->cCreateTime, sizeof(fsr->cCreateTime), "%Y-%m-%d %H:%M:%S", &tm);
 
    /* Must create it */
       Mmsg(mdb->cmd, "INSERT INTO FileSet (FileSet,MD5,CreateTime) "
index 4068dfbaec4d3447e64de421878812562b9c8aba..0fcc2dabd52d59a51d10612f1d59d0bdb6b6d335 100644 (file)
@@ -407,6 +407,8 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS
          if (stat > 0) {
             *VolParams = Vols = (VOL_PARAMS *)malloc(stat * sizeof(VOL_PARAMS));
             SId = (DBId_t *)malloc(stat * sizeof(DBId_t));
+         } else {
+            SId = NULL;
          }
          for (i=0; i < stat; i++) {
             if ((row = sql_fetch_row(mdb)) == NULL) {
index ff71728cc332a181b4e5518197f91141a3b87966..cbc94137386012ea20ea91f52e793fb436f43d76 100644 (file)
@@ -45,7 +45,7 @@ extern int QueryDB(const char *file, int line, JCR *jcr, B_DB *db, char *select_
 /*
  * Submit general SQL query
  */
-int db_list_sql_query(JCR *jcr, B_DB *mdb, char *query, DB_LIST_HANDLER *sendit,
+int db_list_sql_query(JCR *jcr, B_DB *mdb, const char *query, DB_LIST_HANDLER *sendit,
                       void *ctx, int verbose, e_list_type type)
 {
    db_lock(mdb);
index 736d94fb31ef44277bf438fe74ef1e8143cdeeba..b276c671bded9b29efa0a94b8eecf128f3af48a8 100644 (file)
@@ -96,7 +96,7 @@ db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
    char ed1[50], ed2[50], ed3[50], ed4[50];
 
    stime = jr->StartTime;
-   localtime_r(&stime, &tm);
+   (void)localtime_r(&stime, &tm);
    strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
    JobTDate = (btime_t)stime;
 
@@ -157,14 +157,14 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
    }
 
    ttime = jr->EndTime;
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
 
    if (jr->RealEndTime == 0) {
       jr->RealEndTime = jr->EndTime;
    }
    ttime = jr->RealEndTime;
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(rdt, sizeof(rdt), "%Y-%m-%d %H:%M:%S", &tm);
 
    JobTDate = ttime;
@@ -178,7 +178,7 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
       (char)(jr->JobStatus), dt, ClientId, edit_uint64(jr->JobBytes, ed1),
       jr->JobFiles, jr->JobErrors, jr->VolSessionId, jr->VolSessionTime,
       PoolId, FileSetId, edit_uint64(JobTDate, ed2), 
-      rdt, 
+      rdt,
       PriorJobId,
       edit_int64(jr->JobId, ed3));
 
@@ -312,7 +312,7 @@ db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
    if (mr->set_first_written) {
       Dmsg1(400, "Set FirstWritten Vol=%s\n", mr->VolumeName);
       ttime = mr->FirstWritten;
-      localtime_r(&ttime, &tm);
+      (void)localtime_r(&ttime, &tm);
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
       Mmsg(mdb->cmd, "UPDATE Media SET FirstWritten='%s'"
            " WHERE VolumeName='%s'", dt, mr->VolumeName);
@@ -326,7 +326,7 @@ db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
       if (ttime == 0) {
          ttime = time(NULL);
       }
-      localtime_r(&ttime, &tm);
+      (void)localtime_r(&ttime, &tm);
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
       Mmsg(mdb->cmd, "UPDATE Media SET LabelDate='%s' "
            "WHERE VolumeName='%s'", dt, mr->VolumeName);
@@ -335,7 +335,7 @@ db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
 
    if (mr->LastWritten != 0) {
       ttime = mr->LastWritten;
-      localtime_r(&ttime, &tm);
+      (void)localtime_r(&ttime, &tm);
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
       Mmsg(mdb->cmd, "UPDATE Media Set LastWritten='%s' "
            "WHERE VolumeName='%s'", dt, mr->VolumeName);
index 38a12f89ca08fe287160f4abe3d334c56761e4e6..b4392f2b06748d9e843bf4c5feec80e2739a632b 100644 (file)
 
 /* Exported variables */
 
-#ifdef HAVE_CYGWIN
-int rl_catch_signals;
-#else
 extern int rl_catch_signals;
-#endif
 #ifdef HAVE_MINGW
 /* Remove when we have real lib in src/lib */
 int enable_vss;
@@ -383,9 +379,9 @@ int main(int argc, char *argv[])
       init_signals(terminate_console);
    }
 
+
 #if !defined(HAVE_WIN32)
    /* Override Bacula default signals */
-// signal(SIGCHLD, SIG_IGN);
    signal(SIGQUIT, SIG_IGN);
    signal(SIGTSTP, got_sigstop);
    signal(SIGCONT, got_sigcontinue);
@@ -533,7 +529,7 @@ try_again:
       FILE *fd;
       pm_strcpy(&UA_sock->msg, env);
       pm_strcat(&UA_sock->msg, "/.bconsolerc");
-      fd = fopen(UA_sock->msg, "r");
+      fd = fopen(UA_sock->msg, "rb");
       if (fd) {
          read_and_process_input(fd, UA_sock);
          fclose(fd);
@@ -780,7 +776,7 @@ static int inputcmd(FILE *input, BSOCK *UA_sock)
       sendit(_("First argument to input command must be a filename.\n"));
       return 1;
    }
-   fd = fopen(argk[1], "r");
+   fd = fopen(argk[1], "rb");
    if (!fd) {
       senditf(_("Cannot open file %s for input. ERR=%s\n"),
          argk[1], strerror(errno));
@@ -809,7 +805,7 @@ static int outputcmd(FILE *input, BSOCK *UA_sock)
 static int do_outputcmd(FILE *input, BSOCK *UA_sock)
 {
    FILE *fd;
-   const char *mode = "a+";
+   const char *mode = "a+b";
 
    if (argc > 3) {
       sendit(_("Too many arguments on output/tee command.\n"));
@@ -855,7 +851,7 @@ static int timecmd(FILE *input, BSOCK *UA_sock)
    char sdt[50];
    time_t ttime = time(NULL);
    struct tm tm;
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(sdt, sizeof(sdt), "%d-%b-%Y %H:%M:%S", &tm);
    sendit("\n");
    return 1;
index 8112adfac3c082293ec11a1c6882adad735a12d3..0336a957cbcee88210594fbb74969bffbcc365b2 100644 (file)
@@ -54,15 +54,14 @@ RES **res_head = sres_head;
  * then move it to allocated memory when the resource
  * scan is complete.
  */
-#if defined(HAVE_WIN32) && !defined(HAVE_CYGWIN)  && !defined(HAVE_MINGW)
+#if defined(_MSC_VER)
 extern "C" { // work around visual compiler mangling variables
     URES res_all;
-    int  res_all_size = sizeof(res_all);
 }
 #else
 URES res_all;
-int  res_all_size = sizeof(res_all);
 #endif
+int  res_all_size = sizeof(res_all);
 
 /* Definition of records permitted within each
  * resource with the routine to process the record
index fe7cbc292c15b8364b1c8d55c5e9eb80b4bf452d..ef845c72336edcf1a0705471d09a80d29062f9f0 100644 (file)
@@ -499,7 +499,7 @@ void update_bootstrap_file(JCR *jcr)
          fd = bpipe ? bpipe->wfd : NULL;
       } else {
          /* ***FIXME*** handle BASE */
-         fd = fopen(fname, jcr->JobLevel==L_FULL?"w+":"a+");
+         fd = fopen(fname, jcr->JobLevel==L_FULL?"w+b":"a+b");
       }
       if (fd) {
          VolCount = db_get_job_volume_parameters(jcr, jcr->db, jcr->JobId,
index 2b2e77526e362bdc9e5be97118da1d7ab64b9203..ae4317c452fac02771976d7dc3cad667c2796f41 100644 (file)
@@ -227,7 +227,7 @@ uint32_t write_bsr_file(UAContext *ua, RESTORE_CTX &rx)
    JobId_t JobId;
 
    make_unique_restore_filename(ua, &fname);
-   fd = fopen(fname, "w+");
+   fd = fopen(fname, "w+b");
    if (!fd) {
       berrno be;
       bsendmsg(ua, _("Unable to create bootstrap file %s. ERR=%s\n"),
index 02514e8d498e435eca1f8e31edb7ee05410aa41e..f40b39a41a150e7afc95f045ef3986b97a1fe67b 100644 (file)
@@ -415,7 +415,7 @@ void catalog_update(JCR *jcr, BSOCK *bs)
          Jmsg(jcr, M_WARNING, 0, _("Got %s but not same File as attributes\n"), stream_to_ascii(Stream));
       } else {
          /* Update digest in catalog */
-         char digestbuf[CRYPTO_DIGEST_MAX_SIZE];
+         char digestbuf[BASE64_SIZE(CRYPTO_DIGEST_MAX_SIZE)];
          int len = 0;
          int type = CRYPTO_DIGEST_NONE;
 
index a5f65266e83498457140763b06a95d71b2f48aaf..26af749a6afb015e6e6de8d30a3a6eb6e89fb6dc 100644 (file)
@@ -60,8 +60,14 @@ extern int r_first, r_last;           /* first and last resources */
 extern RES_TABLE resources[];
 extern RES **res_head;
 extern RES_ITEM job_items[];
-extern URES res_all;
 
+#if defined(_MSC_VER)
+extern "C" { // work around visual compiler mangling variables
+    extern URES res_all;
+}
+#else
+extern URES res_all;
+#endif
 
 #define CONFIG_FILE "./bacula-dir.conf" /* default configuration file */
 
@@ -250,6 +256,8 @@ int main (int argc, char *argv[])
    }
 
    terminate_dird(0);
+
+   return 0;
 }
 
 /* Cleanup and then exit */
index 9eedba0e6f9113abf8437228dfb1b221d5ab2bd8..e7ba378dd404625dec84e46d943eb374e1d70bb1 100644 (file)
@@ -72,7 +72,13 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass);
  * then move it to allocated memory when the resource
  * scan is complete.
  */
+#if defined(_MSC_VER)
+extern "C" { // work around visual compiler mangling variables
+    URES res_all;
+}
+#else
 URES res_all;
+#endif
 int  res_all_size = sizeof(res_all);
 
 
index f6a80fea9739d8a0fc68147d94d19b381ac949a8..56efa2fb2dcc605acdf998a5d0527b1963ed4840 100644 (file)
@@ -77,13 +77,13 @@ struct s_jt {
 
 /* Definition of the contents of each Resource */
 /* Needed for forward references */
-struct SCHED;
-struct CLIENT;
-struct FILESET;
-struct POOL;
-struct RUN;
-struct DEVICE;
-struct RUNSCRIPT;
+class SCHED;
+class CLIENT;
+class FILESET;
+class POOL;
+class RUN;
+class DEVICE;
+class RUNSCRIPT;
 
 /*
  *   Director Resource
index f7d9167b7bd5cf94c207739e6be7fa30dd75f26f..3a414342150bec5b044d69aeaa125023705f45c3 100644 (file)
@@ -37,7 +37,7 @@ static int date_item(JCR *jcr, int code,
 {
    struct tm tm;
    time_t now = time(NULL);
-   localtime_r(&now, &tm);
+   (void)localtime_r(&now, &tm);
    int val = 0;
    char buf[10];
 
index febd1873d82c44b4dfb6ccd09ae672327e9046f5..3d884f4663b81140e4628e5a65915eb7dcd27f0e 100644 (file)
@@ -341,7 +341,7 @@ static bool send_fileset(JCR *jcr)
                break;
             case '<':
                p++;                      /* skip over < */
-               if ((ffd = fopen(p, "r")) == NULL) {
+               if ((ffd = fopen(p, "rb")) == NULL) {
                   berrno be;
                   Jmsg(jcr, M_FATAL, 0, _("Cannot open included file: %s. ERR=%s\n"),
                      p, be.strerror());
@@ -435,7 +435,7 @@ bool send_bootstrap_file(JCR *jcr, BSOCK *sock)
    if (!jcr->RestoreBootstrap) {
       return true;
    }
-   bs = fopen(jcr->RestoreBootstrap, "r");
+   bs = fopen(jcr->RestoreBootstrap, "rb");
    if (!bs) {
       berrno be;
       Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
index dff8eae194fd225dfb09cbc4795fcf649fac98a7..3b5e0d8d52d6dda23eb358734b78e47c75a3c381 100644 (file)
@@ -51,7 +51,13 @@ static void setup_current_opts(void);
  * then move it to allocated memory when the resource
  * scan is complete.
  */
+#if defined(_MSC_VER)
+extern "C" { // work around visual compiler mangling variables
+    extern URES res_all;
+}
+#else
 extern URES res_all;
+#endif
 extern int  res_all_size;
 
 /* We build the current new Include and Exclude items here */
@@ -246,7 +252,7 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
     */
    } else {
       for (i=0; FS_options[i].name; i++) {
-         if (strcasecmp(lc->str, FS_options[i].name) == 0 && FS_options[i].keyword == keyword) {
+         if (FS_options[i].keyword == keyword && strcasecmp(lc->str, FS_options[i].name) == 0) {
             /* NOTE! maximum 2 letters here or increase option[3] */
             option[0] = FS_options[i].option[0];
             option[1] = FS_options[i].option[1];
index 09499daa3e011840862c36110b1d2dd264af1cbb..984f932041df1e7dda2ff5a823e36afc2d0c9a8b 100644 (file)
@@ -771,7 +771,7 @@ void create_unique_job_name(JCR *jcr, const char *base_name)
    V(mutex);                          /* allow creation of jobs */
    jcr->start_time = now;
    /* Form Unique JobName */
-   localtime_r(&now, &tm);
+   (void)localtime_r(&now, &tm);
    /* Use only characters that are permitted in Windows filenames */
    strftime(dt, sizeof(dt), "%Y-%m-%d_%H.%M.%S", &tm);
    bstrncpy(name, base_name, sizeof(name));
index 44337d50fb5777815ceec3c2fca9fe234ce148c5..b7eb4896d06ce16be75bf567f0c31d71ae612806 100644 (file)
 #include "bacula.h"
 #include "dird.h"
 
+#if defined(_MSC_VER)
+extern "C" { // work around visual compiler mangling variables
+   extern URES res_all;
+}
+#else
 extern URES res_all;
+#endif
 extern struct s_jl joblevels[];
 
 /* Forward referenced subroutines */
index 498bef71f7f20c817ccbfd2b897a972b557aadc7..ada34c437ab1410386f8100c14bb5c534f4c3d1f 100644 (file)
@@ -259,7 +259,7 @@ static void find_runs()
 
    /* compute values for time now */
    now = time(NULL);
-   localtime_r(&now, &tm);
+   (void)localtime_r(&now, &tm);
    hour = tm.tm_hour;
    minute = tm.tm_min;
    mday = tm.tm_mday - 1;
@@ -274,7 +274,7 @@ static void find_runs()
     * sleeping.
     */
    next_hour = now + 3600;
-   localtime_r(&next_hour, &tm);
+   (void)localtime_r(&next_hour, &tm);
    nh_hour = tm.tm_hour;
    nh_mday = tm.tm_mday - 1;
    nh_wday = tm.tm_wday;
@@ -336,7 +336,7 @@ static void find_runs()
          Dmsg3(dbglvl, "run@%p: run_now=%d run_nh=%d\n", run, run_now, run_nh);
 
          /* find time (time_t) job is to be run */
-         localtime_r(&now, &tm);      /* reset tm structure */
+         (void)localtime_r(&now, &tm);      /* reset tm structure */
          tm.tm_min = run->minute;     /* set run minute */
          tm.tm_sec = 0;               /* zero secs */
          if (run_now) {
index a5291a751c5b09e8c9bd523f70ea59b735182ac6..de34bead738c92cba0346982a3376731f1368b2d 100644 (file)
@@ -69,14 +69,13 @@ const char *drop_deltabs[] = {
 /* List of SQL commands to create temp table and indicies  */
 const char *create_deltabs[] = {
    "CREATE TEMPORARY TABLE DelCandidates ("
-#ifdef HAVE_MYSQL
+#if defined(HAVE_MYSQL)
       "JobId INTEGER UNSIGNED NOT NULL, "
       "PurgedFiles TINYINT, "
       "FileSetId INTEGER UNSIGNED, "
       "JobFiles INTEGER UNSIGNED, "
       "JobStatus BINARY(1))",
-#else
-#ifdef HAVE_POSTGRESQL
+#elif defined(HAVE_POSTGRESQL)
       "JobId INTEGER NOT NULL, "
       "PurgedFiles SMALLINT, "
       "FileSetId INTEGER, "
@@ -88,7 +87,6 @@ const char *create_deltabs[] = {
       "FileSetId INTEGER UNSIGNED, "
       "JobFiles INTEGER UNSIGNED, "
       "JobStatus CHAR)",
-#endif
 #endif
    "CREATE INDEX DelInx1 ON DelCandidates (JobId)",
    NULL};
@@ -194,7 +192,7 @@ const char *uar_file =
    "AND Job.JobId=File.JobId "
    "AND Path.PathId=File.PathId AND Filename.FilenameId=File.FilenameId "
    "AND Filename.Name='%s' ORDER BY StartTime DESC LIMIT 20";
- #endif
+#endif
 
 
 /*
index 9b19f765c7aa17fbf0cecf6b1c16999dddc87f3f..7e71408bb4f3ccf0d4cdb6f91c601033d8d60b7a 100644 (file)
@@ -1084,7 +1084,7 @@ static int time_cmd(UAContext *ua, const char *cmd)
    char sdt[50];
    time_t ttime = time(NULL);
    struct tm tm;
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(sdt, sizeof(sdt), "%d-%b-%Y %H:%M:%S", &tm);
    bsendmsg(ua, "%s\n", sdt);
    return 1;
index d53d41ad1103cc30984b121180f39b73002e7428..a738dfe326aab085c81c65efc16304ee70ef9d28 100644 (file)
@@ -537,7 +537,7 @@ RUN *find_next_run(RUN *run, JOB *job, time_t &runtime, int ndays)
          future = now + (day * 60 * 60 * 24);
 
          /* Break down the time into components */
-         localtime_r(&future, &tm);
+         (void)localtime_r(&future, &tm);
          mday = tm.tm_mday - 1;
          wday = tm.tm_wday;
          month = tm.tm_mon;
@@ -571,7 +571,7 @@ RUN *find_next_run(RUN *run, JOB *job, time_t &runtime, int ndays)
             Dmsg1(000, "%s", buf);
 #endif
             /* find time (time_t) job is to be run */
-            localtime_r(&future, &runtm);
+            (void)localtime_r(&future, &runtm);
             for (i= 0; i < 24; i++) {
                if (bit_is_set(i, run->hour)) {
                   runtm.tm_hour = i;
index e6d65dd51225cc011e7216ae57787e5e5dd5d00b..bfbaf8f748dfeb52b2bc82d59628a69769733b02 100644 (file)
 #define MAX_DEL_LIST_LEN 2000000
 
 /* Imported variables */
-extern char *select_job;
-extern char *drop_deltabs[];
-extern char *create_deltabs[];
-extern char *insert_delcand;
-extern char *select_backup_del;
-extern char *select_verify_del;
-extern char *select_restore_del;
-extern char *select_admin_del;
-extern char *cnt_File;
-extern char *del_File;
-extern char *upd_Purged;
-extern char *cnt_DelCand;
-extern char *del_Job;
-extern char *del_MAC;
-extern char *del_JobMedia;
-extern char *cnt_JobMedia;
-extern char *sel_JobMedia;
+extern const char *select_job;
+extern const char *drop_deltabs[];
+extern const char *create_deltabs[];
+extern const char *insert_delcand;
+extern const char *select_backup_del;
+extern const char *select_verify_del;
+extern const char *select_restore_del;
+extern const char *select_admin_del;
+extern const char *cnt_File;
+extern const char *del_File;
+extern const char *upd_Purged;
+extern const char *cnt_DelCand;
+extern const char *del_Job;
+extern const char *del_MAC;
+extern const char *del_JobMedia;
+extern const char *cnt_JobMedia;
+extern const char *sel_JobMedia;
 
 
 /* In memory list of JobIds */
index ba8cd815343298edf1fa2cf161791c2825931d96..6e1a3c2b845a6ad51123bb4a422a444525d1ac7a 100644 (file)
@@ -55,7 +55,7 @@ int querycmd(UAContext *ua, const char *cmd)
    if (!open_db(ua)) {
       goto bail_out;
    }
-   if ((fd=fopen(query_file, "r")) == NULL) {
+   if ((fd=fopen(query_file, "rb")) == NULL) {
       bsendmsg(ua, _("Could not open %s: ERR=%s\n"), query_file,
          strerror(errno));
       goto bail_out;
index a625da14c9d40e076111b73fff87e5afe53958a7..78889be8ff40952ff00380dd3b4ce9a558c379a3 100644 (file)
 extern void print_bsr(UAContext *ua, RBSR *bsr);
 
 /* Imported variables */
-extern char *uar_list_jobs,      *uar_file,        *uar_sel_files;
-extern char *uar_del_temp,       *uar_del_temp1,   *uar_create_temp;
-extern char *uar_create_temp1,   *uar_last_full,   *uar_full;
-extern char *uar_inc,            *uar_list_temp,   *uar_sel_jobid_temp;
-extern char *uar_sel_all_temp1,  *uar_sel_fileset, *uar_mediatype;
-extern char *uar_jobid_fileindex, *uar_dif,        *uar_sel_all_temp;
-extern char *uar_count_files,     *uar_jobids_fileindex;
-extern char *uar_jobid_fileindex_from_dir;
-extern char *uar_jobid_fileindex_from_table;
+extern const char *uar_list_jobs,      *uar_file,        *uar_sel_files;
+extern const char *uar_del_temp,       *uar_del_temp1,   *uar_create_temp;
+extern const char *uar_create_temp1,   *uar_last_full,   *uar_full;
+extern const char *uar_inc,            *uar_list_temp,   *uar_sel_jobid_temp;
+extern const char *uar_sel_all_temp1,  *uar_sel_fileset, *uar_mediatype;
+extern const char *uar_jobid_fileindex, *uar_dif,        *uar_sel_all_temp;
+extern const char *uar_count_files,     *uar_jobids_fileindex;
+extern const char *uar_jobid_fileindex_from_dir;
+extern const char *uar_jobid_fileindex_from_table;
 
 
 
@@ -276,7 +276,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
    char date[MAX_TIME_LENGTH];
    bool have_date = false;
    JobId_t JobId;
-   JOB_DBR jr;
+   JOB_DBR jr = { (JobId_t)-1 };
    bool done = false;
    int i, j;
    const char *list[] = {
@@ -678,7 +678,7 @@ static void insert_one_file_or_dir(UAContext *ua, RESTORE_CTX *rx, char *date, b
    switch (*p) {
    case '<':
       p++;
-      if ((ffd = fopen(p, "r")) == NULL) {
+      if ((ffd = fopen(p, "rb")) == NULL) {
          berrno be;
          bsendmsg(ua, _("Cannot open file %s: ERR=%s\n"),
             p, be.strerror());
index 52315f69762ffa505d858c3c85fe6c5b8b3da9c5..5aa292d101d5291b914b6982b457188d666cee37 100644 (file)
@@ -866,7 +866,7 @@ try_again:
          }
          if (ua->cmd[0] != 0) {
             jcr->RestoreBootstrap = bstrdup(ua->cmd);
-            fd = fopen(jcr->RestoreBootstrap, "r");
+            fd = fopen(jcr->RestoreBootstrap, "rb");
             if (!fd) {
                bsendmsg(ua, _("Warning cannot open %s: ERR=%s\n"),
                   jcr->RestoreBootstrap, strerror(errno));
index ccf7db8916af20a9364df3dcd63fee241eb50c03..75a1a3489d59c3ed52930c9eb6626ac689431f81 100644 (file)
@@ -26,7 +26,7 @@
 #include "dird.h"
 
 /* External variables */
-extern char *list_pool;               /* in sql_cmds.c */
+extern const char *list_pool;               /* in sql_cmds.c */
 
 /* Imported functions */
 void update_slots(UAContext *ua);
index 1651f2d457669f934e030344205219d596a117b0..ccf2e660f37a856a010e2d7a094a52a603f38d6a 100644 (file)
@@ -67,6 +67,7 @@ static int tally_file(FF_PKT *ff_pkt, void *ijcr, bool top_level)
    case FT_NORECURSE:
    case FT_NOFSCHG:
    case FT_INVALIDFS:
+   case FT_INVALIDDT:
    case FT_DIREND:
    case FT_SPEC:
    case FT_RAW:
index ae021bbf2c456c147e877db962fcec564c22e97d..5145735a1cab7b41c4428a31f52d59b018b55302 100644 (file)
@@ -74,7 +74,7 @@ static void usage()
  *  Main Bacula Unix Client Program
  *
  */
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 #define main BaculaMain
 #endif
 
index e20709827dd6c89f7f4aa22c5a4b1721775641d1..f06d921efff60ca9917f8a56736f44ed86195998 100644 (file)
@@ -57,15 +57,14 @@ RES **res_head = sres_head;
  * then move it to allocated memory when the resource
  * scan is complete.
  */
-#if defined(HAVE_WIN32) && !defined(HAVE_CYGWIN)
+#if defined(_MSC_VER)
 extern "C" { // work around visual compiler mangling variables
     URES res_all;
-    int  res_all_size = sizeof(res_all);
 }
 #else
 URES res_all;
-int  res_all_size = sizeof(res_all);
 #endif
+int  res_all_size = sizeof(res_all);
 
 /* Definition of records permitted within each
  * resource with the routine to process the record
index 1e6835c780f8a1733f3f7695e5287be53c418da8..96365bff361bd1841a0ce3cf2fa0c96494c59f51 100644 (file)
@@ -338,9 +338,7 @@ static int cancel_cmd(JCR *jcr)
          if (cjcr->store_bsock) {
             cjcr->store_bsock->timed_out = 1;
             cjcr->store_bsock->terminated = 1;
-#if !defined(HAVE_CYGWIN)
             pthread_kill(cjcr->my_thread_id, TIMEOUT_SIGNAL);
-#endif
          }
          set_jcr_job_status(cjcr, JS_Canceled);
          free_jcr(cjcr);
@@ -400,7 +398,7 @@ static int job_cmd(JCR *jcr)
 {
    BSOCK *dir = jcr->dir_bsock;
    POOLMEM *sd_auth_key;
-   
+
    sd_auth_key = get_memory(dir->msglen);
    if (sscanf(dir->msg, jobcmd,  &jcr->JobId, jcr->Job,
               &jcr->VolSessionId, &jcr->VolSessionTime,
@@ -604,7 +602,7 @@ static void add_file_to_fileset(JCR *jcr, const char *fname, findFILESET *filese
    case '<':
       Dmsg0(100, "Doing < include on client.\n");
       p++;                      /* skip over < */
-      if ((ffd = fopen(p, "r")) == NULL) {
+      if ((ffd = fopen(p, "rb")) == NULL) {
          berrno be;
          Jmsg(jcr, M_FATAL, 0, _("Cannot open FileSet input file: %s. ERR=%s\n"),
             p, be.strerror());
@@ -1011,7 +1009,7 @@ static int bootstrap_cmd(JCR *jcr)
       jcr->Job);
    Dmsg1(400, "bootstrap=%s\n", fname);
    jcr->RestoreBootstrap = fname;
-   bs = fopen(fname, "a+");           /* create file */
+   bs = fopen(fname, "a+b");           /* create file */
    if (!bs) {
       berrno be;
       Jmsg(jcr, M_FATAL, 0, _("Could not create bootstrap file %s: ERR=%s\n"),
@@ -1695,7 +1693,7 @@ static int send_bootstrap_file(JCR *jcr)
    if (!jcr->RestoreBootstrap) {
       return 1;
    }
-   bs = fopen(jcr->RestoreBootstrap, "r");
+   bs = fopen(jcr->RestoreBootstrap, "rb");
    if (!bs) {
       berrno be;
       Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
index e96060aead2221e86c8fd980e5ddb566c815811b..2c90d7a0a9d1d810891d77ee204e9bbdc185e9f1 100755 (executable)
@@ -40,7 +40,7 @@ static char qstatus[] = ".status %s\n";
 static char OKqstatus[]   = "2000 OK .status\n";
 static char DotStatusJob[] = "JobId=%d JobStatus=%c JobErrors=%d\n";
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 static int privs = 0;
 #endif
 #ifdef WIN32_VSS
@@ -71,7 +71,7 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a
    len = Mmsg(msg, _("Daemon started %s, %d Job%s run since started.\n"),
         dt, num_jobs_run, num_jobs_run == 1 ? "" : "s");
    sendit(msg, len, arg);
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
    if (debug_level > 0) {
       if (!privs) {
          privs = enable_backup_privileges(NULL, 1);
@@ -402,7 +402,7 @@ static const char *level_to_str(int level)
 }
 
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 #include <windows.h>
 
 int bacstat = 0;
@@ -493,4 +493,4 @@ done:
    return buf;
 }
 
-#endif /* HAVE_CYGWIN */
+#endif /* HAVE_WIN32 */
index 3988eae7aa79418b545fab231ace632290e99f0c..fdf0c67322c1bc3bd3a47524e6e2e4d7ccf2ec0e 100755 (executable)
@@ -26,7 +26,7 @@
 #include "bacula.h"
 #include "find.h"
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 
 #include "../lib/winapi.h"
 
@@ -36,7 +36,7 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd);
 void unix_name_to_win32(POOLMEM **win32_name, char *name);
 void win_error(JCR *jcr, char *prefix, POOLMEM *ofile);
 HANDLE bget_handle(BFILE *bfd);
-#endif
+#endif /* HAVE_WIN32 */
 
 /* For old systems that don't have lchown() use chown() */
 #ifndef HAVE_LCHOWN
@@ -219,6 +219,7 @@ void encode_stat(char *buf, FF_PKT *ff_pkt, int data_stream)
   #endif
 #endif
 
+
 /* Decode a stat packet from base64 characters */
 int decode_stat(char *buf, struct stat *statp, int32_t *LinkFI)
 {
@@ -362,7 +363,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    bool ok = true;
    off_t fsize;
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
    if (attr->stream == STREAM_UNIX_ATTRIBUTES_EX &&
        set_win32_attributes(jcr, attr, ofd)) {
        if (is_bopen(ofd)) {
@@ -467,7 +468,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
 /*                                                             */
 /*=============================================================*/
 
-#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
+#if !defined(HAVE_WIN32)
 
 /*
  * It is possible to piggyback additional data e.g. ACLs on
@@ -507,7 +508,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
 /*                                                             */
 /*=============================================================*/
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 
 int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
 {
@@ -726,4 +727,4 @@ void unix_name_to_win32(POOLMEM **win32_name, char *name)
    conv_unix_to_win32_path(name, *win32_name, dwSize);
 }
 
-#endif  /* HAVE_CYGWIN */
+#endif  /* HAVE_WIN32 */
index 21ea1705bd6bf02329c1c217590e162f4bd65347..8f930ed5d2c9f187aa4e46d78f9c160edd3794b5 100644 (file)
@@ -253,7 +253,7 @@ bool processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, ssize_t dwSize)
  * ===============================================================
  */
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 
 void unix_name_to_win32(POOLMEM **win32_name, char *name);
 extern "C" HANDLE get_osfhandle(int fd);
index 46b58cc1c7b444d75edd1ab74c9d380c75ba3eb5..69cce6fb68540aa8a50149d5d3647d681d27677a 100644 (file)
@@ -64,7 +64,7 @@ typedef struct _PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT {
  *
  *  =======================================================
  */
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 
 #include <windows.h>
 #include "../lib/winapi.h"
@@ -79,7 +79,7 @@ enum {
 
 /* Basic Win32 low level I/O file packet */
 struct BFILE {
-   int use_backup_api;                /* set if using BackupRead/Write */
+   bool use_backup_api;               /* set if using BackupRead/Write */
    int mode;                          /* set if file is open */
    HANDLE fh;                         /* Win32 file handle */
    int fid;                           /* fd if doing Unix style */
diff --git a/bacula/src/findlib/drivetype.c b/bacula/src/findlib/drivetype.c
new file mode 100644 (file)
index 0000000..a12fef3
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ *  Implement routines to determine drive type (Windows specific).
+ *
+ *   Written by Robert Nelson, June 2006
+ *
+ *   Version $Id$
+ */
+
+/*
+   Copyright (C) 2006 Kern Sibbald
+
+   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.
+
+ */
+
+#ifndef TEST_PROGRAM
+
+#include "bacula.h"
+#include "find.h"
+
+#else /* Set up for testing a stand alone program */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define SUPPORTEDOSES \
+   "HAVE_WIN32\n"
+#define false              0
+#define true               1
+#define bstrncpy           strncpy
+#define Dmsg0(n,s)         fprintf(stderr, s)
+#define Dmsg1(n,s,a1)      fprintf(stderr, s, a1)
+#define Dmsg2(n,s,a1,a2)   fprintf(stderr, s, a1, a2)
+#endif
+
+/*
+ * These functions should be implemented for each OS
+ *
+ *       bool drivetype(const char *fname, char *dt, int dtlen);
+ */
+
+#if defined (HAVE_WIN32)
+/* Windows */
+
+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;
+   }
+}
+/* Windows */
+
+#else    /* No recognised OS */
+
+bool drivetype(const char *fname, char *dt, int dtlen)
+{
+   Dmsg0(10, "!!! drivetype() not implemented for this OS. !!!\n");
+#ifdef TEST_PROGRAM
+   Dmsg1(10, "Please define one of the following when compiling:\n\n%s\n",
+         SUPPORTEDOSES);
+   exit(EXIT_FAILURE);
+#endif
+
+   return false;
+}
+#endif
+
+#ifdef TEST_PROGRAM
+int main(int argc, char **argv)
+{
+   char *p;
+   char dt[1000];
+   int status = 0;
+
+   if (argc < 2) {
+      p = (argc < 1) ? "drivetype" : argv[0];
+      printf("usage:\t%s path ...\n"
+            "\t%s prints the drive type and pathname of the paths.\n",
+            p, p);
+      return EXIT_FAILURE;
+   }
+   while (*++argv) {
+      if (!drivetype(*argv, dt, sizeof(dt))) {
+         status = EXIT_FAILURE;
+      } else {
+         printf("%s\t%s\n", dt, *argv);
+      }
+   }
+   return status;
+}
+#endif
index 8fd78fbd9c7eeaad307e60e594cb3c3c150e2b5b..34539eb8ebd57312c72fc525b4f830abc27ea3bf 100755 (executable)
@@ -37,7 +37,7 @@
 /*                                                             */
 /*=============================================================*/
 
-#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
+#if !defined(HAVE_WIN32)
 
 int enable_backup_privileges(JCR *jcr, int ignore_errors)
  { return 0; }
@@ -53,7 +53,7 @@ int enable_backup_privileges(JCR *jcr, int ignore_errors)
 /*                                                             */
 /*=============================================================*/
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 
 void win_error(JCR *jcr, char *prefix, DWORD lerror);
 
@@ -155,4 +155,4 @@ int enable_backup_privileges(JCR *jcr, int ignore_errors)
     return stat;
 }
 
-#endif  /* HAVE_CYGWIN */
+#endif  /* HAVE_WIN32 */
index 1565234489e523ad37da81eaf9dc8d83ef5ca535..8fde075a359c32585844774bcac12319d3a9628f 100644 (file)
@@ -97,7 +97,7 @@ get_win32_driveletters(FF_PKT *ff, char* szDrives)
 {
    /* szDrives must be at least 27 bytes long */
 
-#ifndef WIN32
+#if !defined(HAVE_WIN32)
    return 0;
 #endif
 
@@ -209,9 +209,9 @@ static bool accept_file(FF_PKT *ff)
                if (ff->flags & FO_EXCLUDE) {
                   Dmsg2(100, "Exclude wilddir: %s file=%s\n", (char *)fo->wilddir.get(k),
                      ff->fname);
-                  return false;       /* reject file */
+                  return false;       /* reject dir */
                }
-               return true;           /* accept file */
+               return true;           /* accept dir */
             }
          }
       } else {
@@ -325,6 +325,7 @@ static int our_callback(FF_PKT *ff, void *hpkt, bool top_level)
    case FT_NORECURSE:
    case FT_NOFSCHG:
    case FT_INVALIDFS:
+   case FT_INVALIDDT:
    case FT_NOOPEN:
 //    return ff->callback(ff, hpkt, top_level);
 
index 11eb9f804e1689105db6b1a4b85e1348c2cc71df..70e7feaf4c75d78c4ade637c41c60254b21a2e2a 100644 (file)
@@ -136,7 +136,7 @@ make_dir(JCR *jcr, const char *dir, const char *dirpath, mode_t mode, int *creat
 int
 isAbsolute(const char *path)
 {
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
     return path[1] == ':' || *path == '/' || *path == '\\';     /* drivespec:/blah is absolute */
 #else
     return *path == '/';
@@ -213,12 +213,6 @@ make_path(
         re_protect = 0;
       }
 
-#if defined(HAVE_CYGWIN)
-      /* Because of silly Win32 security, we allow everything */
-      tmp_mode = S_IRWXUGO;
-      re_protect = 0;
-
-#endif
 #if defined(HAVE_WIN32)
       // chdir can fail if permissions are sufficiently restricted since I don't think
       // backup/restore security rights affect ChangeWorkingDirectory
index a5d9d8f7136b1890652a0871d0a164e22d564a70..4c239840a953d1ad2b36e79f6496a62ff6a5f36f 100644 (file)
@@ -39,7 +39,7 @@
 #endif
 
 /* Fold case in fnmatch() on Win32 */
-#ifdef WIN32
+#ifdef HAVE_WIN32
 static const int fnmode = FNM_CASEFOLD;
 #else
 static const int fnmode = 0;
@@ -213,7 +213,7 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, const char *fname)
          break;
       }
    }
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
    /* Convert any \'s into /'s */
    for (p=inc->fname; *p; p++) {
       if (*p == '\\') {
@@ -247,7 +247,7 @@ void add_fname_to_exclude_list(FF_PKT *ff, const char *fname)
 
    Dmsg1(20, "Add name to exclude: %s\n", fname);
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
    if (strchr(fname, '/') || strchr(fname, '\\')) {
 #else
    if (strchr(fname, '/')) {
@@ -263,7 +263,7 @@ 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_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
    /* Convert any \'s into /'s */
    for (char *p=exc->fname; *p; p++) {
       if (*p == '\\') {
index d81b00cd187a4c498f6a494078767bde565fa670..19e83ce49d7820517cc72b0c0290f316d5e7ba06 100644 (file)
@@ -157,7 +157,7 @@ bin_to_base64(char *buf, char *bin, int len)
       }
       save = reg;
       reg >>= (rem - 6);
-      buf[j++] = base64_digits[reg & (uint32_t)0x3F];
+      buf[j++] = base64_digits[reg & 0x3F];
       reg = save;
       rem -= 6;
    }
index 03b4eb381afcd111a63612e427bbe9222153526b..76641fd49b7ba645f3e30cde43e974e0353edc90 100644 (file)
@@ -36,12 +36,13 @@ extern int execvp_errors[];
 
 const char *berrno::strerror()
 {
-   int stat = 0;
 #ifdef HAVE_WIN32
    if (berrno_ & b_errno_win32) {
       return (const char *)buf_;
    }
 #else
+   int stat = 0;
+
    if (berrno_ & b_errno_exit) {
       stat = (berrno_ & ~b_errno_exit);       /* remove bit */
       if (stat == 0) {
index eb58d956b418d48ec679437c2b60e6971d1ead23..7ebaecd9403796c43ac6e53cde276685ab4d56d1 100644 (file)
@@ -1003,7 +1003,7 @@ bool bnet_set_buffer_size(BSOCK * bs, uint32_t size, int rw)
  * Returns previous socket flag
  */
 int bnet_set_nonblocking (BSOCK *bsock) {
-#ifndef WIN32
+#ifndef HAVE_WIN32
    int oflags;
 
    /* Get current flags */
@@ -1038,7 +1038,7 @@ int bnet_set_nonblocking (BSOCK *bsock) {
  */
 int bnet_set_blocking (BSOCK *bsock) 
 {
-#ifndef WIN32
+#ifndef HAVE_WIN32
    int oflags;
    /* Get current flags */
    if ((oflags = fcntl(bsock->fd, F_GETFL, 0)) < 0) {
@@ -1071,7 +1071,7 @@ int bnet_set_blocking (BSOCK *bsock)
  */
 void bnet_restore_blocking (BSOCK *bsock, int flags) 
 {
-#ifndef WIN32
+#ifndef HAVE_WIN32
    if ((fcntl(bsock->fd, F_SETFL, flags)) < 0) {
       berrno be;
       Jmsg1(bsock->jcr, M_ABORT, 0, _("fcntl F_SETFL error. ERR=%s\n"), be.strerror());
index a28f3650b395b43aa1058c91d913e5694d369cda..12a5d8b925397c591c0a329e84314ff79d0165ee 100644 (file)
@@ -32,7 +32,7 @@ int execvp_errors[] = {
         E2BIG,
         ENAMETOOLONG,
         ENOMEM,
-#ifndef WIN32
+#ifndef HAVE_WIN32
         ETXTBSY,
 #endif
         ENOENT
@@ -232,7 +232,7 @@ int close_bpipe(BPIPE *bpipe)
          }
          Dmsg1(800, "child status=%d\n", stat & ~b_errno_exit);
       } else if (WIFSIGNALED(chldstatus)) {  /* process died */
-#ifndef WIN32
+#ifndef HAVE_WIN32
          stat = WTERMSIG(chldstatus);
 #else
 #warning "WTERMSIG undefined in Win32 !!!"
index 41f62cf4d8373b0b886e9e61c004e82dd11aa36b..7849266e3994f11744c53a45a3adce6dd9f8de57 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "bacula.h"
 
-#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
+#if !defined(HAVE_WIN32)
 
 #ifdef NEED_SHARED_MEMORY
 #define SHM_KEY 0x0BACB01            /* key for shared memory */
@@ -145,6 +145,6 @@ void shm_destroy(BSHM *shm)
 #endif
 }
 
-#endif /* ! HAVE_CYGWIN */
+#endif /* ! HAVE_WIN32 */
 
 #endif
index 7ccfa0f9b3544838f99978b5120e04fb9b01222a..26a9b72cae212edfec376179203d659d79ff9db9 100644 (file)
@@ -417,7 +417,7 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num)
 }
 #endif
 
-#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
+#if !defined(HAVE_WIN32)
 static int del_pid_file_ok = FALSE;
 #endif
 
@@ -426,7 +426,7 @@ static int del_pid_file_ok = FALSE;
  */
 void create_pid_file(char *dir, const char *progname, int port)
 {
-#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
+#if !defined(HAVE_WIN32)
    int pidfd, len;
    int oldpid;
    char  pidbuf[20];
@@ -469,7 +469,7 @@ void create_pid_file(char *dir, const char *progname, int port)
  */
 int delete_pid_file(char *dir, const char *progname, int port)
 {
-#if !defined(HAVE_CYGWIN)  && !defined(HAVE_WIN32)
+#if !defined(HAVE_WIN32)
    POOLMEM *fname = get_pool_memory(PM_FNAME);
 
    if (!del_pid_file_ok) {
index 943a8860883b67356e7c00545a855fa840af7c73..79fc7578f96af9ccc57b86e865a97ffab1fb1aab 100644 (file)
@@ -48,7 +48,7 @@ char *bstrftime(char *dt, int maxlen, utime_t tim)
    struct tm tm;
 
    /* ***FIXME**** the format and localtime_r() should be user configurable */
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(dt, maxlen, "%d-%b-%Y %H:%M", &tm);
    return dt;
 }
@@ -60,7 +60,7 @@ char *bstrftimes(char *dt, int maxlen, utime_t tim)
    struct tm tm;
 
    /* ***FIXME**** the format and localtime_r() should be user configurable */
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(dt, maxlen, "%d-%b-%Y %H:%M:%S", &tm);
    return dt;
 }
@@ -73,7 +73,7 @@ char *bstrftime_ny(char *dt, int maxlen, utime_t tim)
    struct tm tm;
 
    /* ***FIXME**** the format and localtime_r() should be user configurable */
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(dt, maxlen, "%d-%b %H:%M", &tm);
    return dt;
 }
@@ -86,7 +86,7 @@ char *bstrftime_nc(char *dt, int maxlen, utime_t tim)
    struct tm tm;
 
    /* ***FIXME**** the format and localtime_r() should be user configurable */
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    /* NOTE! since the compiler complains about %y, I use %y and cut the century */
    strftime(dt, maxlen, "%d-%b-%Y %H:%M", &tm);
    strcpy(dt+7, dt+9);
@@ -99,7 +99,7 @@ char *bstrutime(char *dt, int maxlen, utime_t tim)
 {
    time_t ttime = (time_t)tim;
    struct tm tm;
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(dt, maxlen, "%Y-%m-%d %H:%M:%S", &tm);
    return dt;
 }
@@ -197,12 +197,12 @@ int tm_woy(time_t stime)
    time_t time4;
    struct tm tm;
    memset(&tm, 0, sizeof(struct tm));
-   localtime_r(&stime, &tm);
+   (void)localtime_r(&stime, &tm);
    tm_yday = tm.tm_yday;
    tm.tm_mon = 0;
    tm.tm_mday = 4;
    time4 = mktime(&tm);
-   localtime_r(&time4, &tm);
+   (void)localtime_r(&time4, &tm);
    fty = 1 - tm.tm_wday;
    if (fty <= 0) {
       fty += 7;
@@ -221,7 +221,7 @@ void get_current_time(struct date_time *dt)
    time_t now;
 
    now = time(NULL);
-   gmtime_r(&now, &tm);
+   (void)gmtime_r(&now, &tm);
    Dmsg6(200, "m=%d d=%d y=%d h=%d m=%d s=%d\n", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900,
       tm.tm_hour, tm.tm_min, tm.tm_sec);
    tm_encode(dt, &tm);
index 871a25e169c1ec4dd6d3adc7227c3795e3ea6031..540c5f711e9cb99fbb4b8d64bd522598ea786e54 100644 (file)
@@ -34,7 +34,7 @@ extern int debug_level;
 void
 daemon_start()
 {
-#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
+#if !defined(HAVE_WIN32)
    int i;
    pid_t cpid;
    mode_t oldmask;
@@ -101,6 +101,6 @@ daemon_start()
       }
    }
 
-#endif /* HAVE_CYGWIN */
+#endif /* HAVE_WIN32 */
    Dmsg0(900, "Exit daemon_start\n");
 }
diff --git a/bacula/src/lib/enh_fnmatch.c b/bacula/src/lib/enh_fnmatch.c
new file mode 100644 (file)
index 0000000..090f68e
--- /dev/null
@@ -0,0 +1,285 @@
+/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
+
+   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, 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.  */
+
+/* Modified version of fnmatch.c - Robert Nelson */
+
+#include "bacula.h"
+#include "enh_fnmatch.h"
+
+# ifndef errno
+extern int errno;
+# endif
+
+int
+enh_fnmatch_sub(const char *pattern, const char *string, int patternlen, int flags)
+{
+  register const char *p = pattern, *n = string;
+  register char c;
+
+/* Note that this evaluates C many times.  */
+# define FOLD(c) ((flags & FNM_CASEFOLD) && B_ISUPPER (c) ? tolower (c) : (c))
+
+  while ((p - pattern) < patternlen)
+    {
+      c = *p++;
+      c = FOLD (c);
+
+      switch (c)
+        {
+        case '?':
+          if (*n == '\0')
+            return 0;
+          else if ((flags & FNM_FILE_NAME) && *n == '/')
+            return 0;
+          else if ((flags & FNM_PERIOD) && *n == '.' &&
+                   (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
+            return 0;
+          break;
+
+        case '\\':
+          if (!(flags & FNM_NOESCAPE))
+            {
+              if ((p - pattern) >= patternlen)
+                /* Trailing \ loses.  */
+                return 0;
+
+              c = *p++;
+              c = FOLD(c);
+            }
+          if (FOLD (*n) != c)
+            return 0;
+          break;
+
+        case '*':
+          if ((flags & FNM_PERIOD) && *n == '.' &&
+              (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
+            return FNM_NOMATCH;
+
+          if ((p - pattern) >= patternlen)
+              return patternlen;
+
+          for (c = *p++; ((p - pattern) <= patternlen) && (c == '?' || c == '*'); c = *p++)
+            {
+              if ((flags & FNM_FILE_NAME) && *n == '/')
+                /* A slash does not match a wildcard under FNM_FILE_NAME.  */
+                return 0;
+              else if (c == '?')
+                {
+                  /* A ? needs to match one character.  */
+                  if (*n == '\0')
+                    /* There isn't another character; no match.  */
+                    return 0;
+                  else
+                    /* One character of the string is consumed in matching
+                       this ? wildcard, so *??? won't match if there are
+                       less than three characters.  */
+                    ++n;
+                }
+            }
+
+          if ((p - pattern) >= patternlen)
+              return patternlen;
+
+          {
+            char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
+            c1 = FOLD (c1);
+            for (--p; *n != '\0'; ++n)
+              {
+                if (c == '[' || c == '{' || FOLD((unsigned char)*n) == c1)
+                  {
+                    int len;
+
+                    len = enh_fnmatch_sub(p, n, (int)(patternlen - (p - pattern)), flags & ~FNM_PERIOD);
+
+                    if (len > 0 && n[len] == '\0')
+                      return (int)(n - string + len);
+                  }
+                else
+                  {
+                    if ((flags & FNM_FILE_NAME) && *n == '/')
+                      return 0;    /* A slash does not match a wildcard under FNM_FILE_NAME.  */
+                  }
+
+              }
+            return 0;
+          }
+
+        case '{':
+          {
+            const char *pstart = p;
+
+            while ((p - pattern) < patternlen)
+              {
+                c = *p++;
+
+                if (!(flags & FNM_NOESCAPE) && c == '\\')
+                  {
+                    if ((p - pattern) >= patternlen)
+                      return 0;
+
+                    ++p;
+                    continue;
+                  }
+              
+                if (c == ',' || c == '}')
+                  {
+                    int matchlen;
+                  
+                    matchlen = enh_fnmatch_sub(pstart, n, (int)(p - pstart - 1), flags & ~FNM_PERIOD);
+
+                    if (matchlen > 0)
+                      {
+                        n += matchlen - 1;
+                        while (c != '}')
+                          {
+                            if (!(flags & FNM_NOESCAPE) && c == '\\')
+                              {
+                                if ((p - pattern) >= patternlen)
+                                  return 0;
+
+                                ++p;
+                              }
+
+                            if ((p - pattern) >= patternlen)
+                              return 0;
+
+                            c = *p++;
+                          }
+                        break;
+                      }
+
+                    if (c == '}')
+                      return 0;
+
+                    pstart = p;
+                  }
+              }
+            break;
+          }
+
+        case '[':
+          {
+            /* Nonzero if the sense of the character class is inverted.  */
+            register int nnot;
+
+            if (*n == '\0')
+              return 0;
+
+            if ((flags & FNM_PERIOD) && *n == '.' &&
+                (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
+              return 0;
+
+            nnot = (*p == '!' || *p == '^');
+            if (nnot)
+              ++p;
+
+            if ((p - pattern) >= patternlen)
+              /* [ (unterminated) loses.  */
+              return 0;
+
+            c = *p++;
+
+            for (;;)
+              {
+                register char cstart, cend;
+
+                cstart = cend = FOLD (c);
+
+                if ((p - pattern) >= patternlen)
+                  /* [ (unterminated) loses.  */
+                  return 0;
+
+                c = *p++;
+                c = FOLD (c);
+
+                if ((flags & FNM_FILE_NAME) && c == '/')
+                  /* [/] can never match.  */
+                  return 0;
+
+                if (c == '-' && *p != ']')
+                  {
+                    if ((p - pattern) >= patternlen)
+                      return 0;
+
+                    cend = *p++;
+
+                    cend = FOLD (cend);
+
+                    if ((p - pattern) >= patternlen)
+                      return 0;
+
+                    c = *p++;
+                  }
+
+                if (FOLD (*n) >= cstart && FOLD (*n) <= cend)
+                  goto matched;
+
+                if (c == ']')
+                  break;
+              }
+            if (!nnot)
+              return 0;
+            break;
+
+          matched:;
+            /* Skip the rest of the [...] that already matched.  */
+            while (c != ']')
+              {
+                if ((p - pattern) >= patternlen)
+                  return 0;
+
+                c = *p++;
+              }
+            if (nnot)
+              return 0;
+          }
+          break;
+
+        default:
+          if (c != FOLD (*n))
+            return 0;
+          break;
+        }
+
+      ++n;
+    }
+
+    return (int)(n - string);
+
+# undef FOLD
+}
+
+/* Match STRING against the filename pattern PATTERN, returning number of characters
+   in STRING that were matched if all of PATTERN matches, nonzero if not.  */
+int
+enh_fnmatch(const char *pattern, const char *string, int flags)
+{
+  int matchlen;
+
+  matchlen = enh_fnmatch_sub(pattern, string, (int)strlen(pattern), flags);
+
+  if (matchlen == 0)
+    return FNM_NOMATCH;
+
+  if (string[matchlen] == '\0')
+    return 0;
+
+  if ((flags & FNM_LEADING_DIR) && string[matchlen] == '/')
+    /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz".  */
+    return 0;
+
+  return FNM_NOMATCH;
+}
diff --git a/bacula/src/lib/enh_fnmatch.h b/bacula/src/lib/enh_fnmatch.h
new file mode 100644 (file)
index 0000000..0a53016
--- /dev/null
@@ -0,0 +1,51 @@
+/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+
+NOTE: The canonical source of this file is maintained with the GNU C Library.
+Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+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, 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. */
+
+/* Modified version of fnmatch.h - Robert Nelson */
+
+#ifndef _ENH_FNMATCH_H
+
+#define _ENH_FNMATCH_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
+#undef __P
+#define __P(protos)    protos
+#else /* Not C++ or ANSI C.  */
+#undef __P
+#define __P(protos)    ()
+/* We can get away without defining `const' here only because in this file
+   it is used only inside the prototype for `fnmatch', which is elided in
+   non-ANSI C where `const' is problematical.  */
+#endif /* C++ or ANSI C.  */
+
+
+/* Match STRING against the filename pattern PATTERN,
+   returning zero if it matches, FNM_NOMATCH if not.  */
+extern int enh_fnmatch __P ((const char *__pattern, const char *__string,
+                        int __flags));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* fnmatch.h */
index 861c8c8b785d61814460d39a2cb063ec8166ecf6..782778e12ad8809240ecefa350e5cb485c007aed 100644 (file)
@@ -138,7 +138,7 @@ bailout:
 
 #endif /* IMPLEMENTED */
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 
 #include <windows.h>
 
@@ -172,4 +172,4 @@ void FillEventsBox(HWND hwnd, int idlist)
     return;
 }
 
-#endif /* HAVE_CYGWIN */
+#endif /* HAVE_WIN32 */
index 11b9af015639f7bda9f64e1c82df3dda8feb6baa..13b2cb9ab2a4ab1c0da93132631bf0a204797d7f 100644 (file)
@@ -155,7 +155,7 @@ LEX *lex_open_file(LEX *lf, const char *filename, LEX_ERROR_HANDLER *scan_error)
    char *fname = bstrdup(filename);
 
 
-   if ((fd = fopen(fname, "r")) == NULL) {
+   if ((fd = fopen(fname, "rb")) == NULL) {
       return NULL;
    }
    Dmsg1(400, "Open config file: %s\n", fname);
index 0725dc5eaa8b37483d7213857f00eaaadd57e026..d5b5bf7e4ef06d9a0b39842e49ceb1b24d8f1575 100644 (file)
@@ -298,7 +298,7 @@ int main(int argc, char *argv[])
       exit(1);
    }
 
-   fd = fopen(argv[0], "r");
+   fd = fopen(argv[0], "rb");
    if (!fd) {
       printf("Could not open %s: ERR=%s\n", argv[0], strerror(errno));
       exit(1);
index a394f0dac5bf92629488144553af50abb9057a12..1c4b685d9a96b3530cabec342bf24c366960ea7c 100755 (executable)
 #include "bacula.h"
 #include "jcr.h"
 
-#if !defined(HAVE_CONSOLE)
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if !defined(HAVE_CONSOLE) && defined(HAVE_WIN32)
 #include <windows.h>
 #endif
-#endif
 
 #define FULL_LOCATION 1               /* set for file:line in Debug messages */
 
@@ -52,19 +50,15 @@ FILE *con_fd = NULL;                  /* Console file descriptor */
 brwlock_t con_lock;                   /* Console lock structure */
 
 
-#ifdef HAVE_POSTGRESQL
+#if defined(HAVE_POSTGRESQL)
 char catalog_db[] = "PostgreSQL";
-#else
-#ifdef HAVE_MYSQL
+#elif defined(HAVE_MYSQL)
 char catalog_db[] = "MySQL";
-#else
-#ifdef HAVE_SQLITE
+#elif defined(HAVE_SQLITE)
 char catalog_db[] = "SQLite";
 #else
 char catalog_db[] = "Internal";
 #endif
-#endif
-#endif
 
 const char *host_os = HOST_OS;
 const char *distname = DISTNAME;
@@ -117,7 +111,7 @@ void my_name_is(int argc, char *argv[], const char *name)
          l++;
       } else {
          l = argv[0];
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
          /* On Windows allow c: junk */
          if (l[1] == ':') {
             l += 2;
@@ -162,7 +156,9 @@ void
 init_msg(JCR *jcr, MSGS *msg)
 {
    DEST *d, *dnew, *temp_chain = NULL;
+#ifndef HAVE_WIN32
    int i;
+#endif
 
    if (jcr == NULL && msg == NULL) {
       init_last_jobs_list();
@@ -193,7 +189,7 @@ init_msg(JCR *jcr, MSGS *msg)
    if (msg == NULL) {
       daemon_msgs = (MSGS *)malloc(sizeof(MSGS));
       memset(daemon_msgs, 0, sizeof(MSGS));
-#ifndef WIN32
+#ifndef HAVE_WIN32
       for (i=1; i<=M_MAX; i++) {
          add_msg_dest(daemon_msgs, MD_STDOUT, i, NULL, NULL);
       }
@@ -258,7 +254,7 @@ void init_console_msg(const char *wd)
       console_msg_pending = 1;
    }
    close(fd);
-   con_fd = fopen(con_fname, "a+");
+   con_fd = fopen(con_fname, "a+b");
    if (!con_fd) {
       berrno be;
       Emsg2(M_ERROR, 0, _("Could not open console message file %s: ERR=%s\n"),
@@ -606,7 +602,7 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg)
              case MD_CONSOLE:
                 Dmsg1(850, "CONSOLE for following msg: %s", msg);
                 if (!con_fd) {
-                   con_fd = fopen(con_fname, "a+");
+                   con_fd = fopen(con_fname, "a+b");
                    Dmsg0(850, "Console file not open.\n");
                 }
                 if (con_fd) {
@@ -630,7 +626,7 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg)
                 }
                 break;
              case MD_SYSLOG:
-                Dmsg1(850, "SYSLOG for collowing msg: %s\n", msg);
+                Dmsg1(850, "SYSLOG for following msg: %s\n", msg);
                 /*
                  * We really should do an openlog() here.
                  */
@@ -661,7 +657,7 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg)
                 if (!d->fd) {
                    POOLMEM *name = get_pool_memory(PM_MESSAGE);
                    make_unique_mail_filename(jcr, name, d);
-                   d->fd = fopen(name, "w+");
+                   d->fd = fopen(name, "w+b");
                    if (!d->fd) {
                       berrno be;
                       d->fd = stdout;
@@ -683,7 +679,7 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg)
              case MD_FILE:
                 Dmsg1(850, "FILE for following msg: %s", msg);
                 if (!d->fd) {
-                   d->fd = fopen(d->where, "w+");
+                   d->fd = fopen(d->where, "w+b");
                    if (!d->fd) {
                       berrno be;
                       d->fd = stdout;
@@ -699,7 +695,7 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg)
              case MD_APPEND:
                 Dmsg1(850, "APPEND for following msg: %s", msg);
                 if (!d->fd) {
-                   d->fd = fopen(d->where, "a");
+                   d->fd = fopen(d->where, "ab");
                    if (!d->fd) {
                       berrno be;
                       d->fd = stdout;
@@ -789,7 +785,7 @@ d_msg(const char *file, int line, int level, const char *fmt,...)
           if (!trace_fd) {
              char fn[200];
              bsnprintf(fn, sizeof(fn), "%s/bacula.trace", working_directory ? working_directory : ".");
-             trace_fd = fopen(fn, "a+");
+             trace_fd = fopen(fn, "a+b");
           }
           if (trace_fd) {
              fputs(buf, trace_fd);
@@ -885,7 +881,7 @@ t_msg(const char *file, int line, int level, const char *fmt,...)
     if (level <= debug_level) {
        if (!trace_fd) {
           bsnprintf(buf, sizeof(buf), "%s/bacula.trace", working_directory);
-          trace_fd = fopen(buf, "a+");
+          trace_fd = fopen(buf, "a+b");
        }
 
 #ifdef FULL_LOCATION
index 8e53477325662afbb9055fbbd7320c3f33b3973a..f95b60948510ce01f15eebad25186c7de04a7a89 100755 (executable)
@@ -61,15 +61,14 @@ extern int r_last;
 extern RES_TABLE resources[];
 extern RES **res_head;
 
-#ifdef HAVE_WIN32
+#if defined(_MSC_VER)
 // work around visual studio name manling preventing external linkage since res_all
 // is declared as a different type when instantiated.
 extern "C" CURES res_all;
-extern "C" int res_all_size;
 #else
 extern  CURES res_all;
-extern int res_all_size;
 #endif
+extern int res_all_size;
 
 extern brwlock_t res_lock;            /* resource lock */
 
index 118989c0dec60418f5ee391e827030fc1cb72a4f..9198e74b97563aee36745f6cacd80fdc97eb6783 100644 (file)
@@ -76,7 +76,7 @@ BSOCK *    bnet_connect          (JCR *jcr, int retry_interval,
 void       bnet_close            (BSOCK *bsock);
 BSOCK *    init_bsock            (JCR *jcr, int sockfd, const char *who, const char *ip,
                                   int port, struct sockaddr *client_addr);
-#ifdef WIN32
+#ifdef HAVE_WIN32
 #ifndef socklen_t
 #define socklen_t int
 #endif
index 9c6e360100e924e4c047eb1af7addc49aec28edc..c35fb68ee5c7d4dd8ecbb59c44060f22354bba68 100644 (file)
@@ -34,17 +34,6 @@ extern int r_last;
 extern RES_TABLE resources[];
 extern RES **res_head;
 
-#ifdef HAVE_WIN32
-// work around visual studio name manling preventing external linkage since res_all
-// is declared as a different type when instantiated.
-extern "C" CURES res_all;
-extern "C" int res_all_size;
-#else
-extern  CURES res_all;
-extern int res_all_size;
-#endif
-
-
 brwlock_t res_lock;                   /* resource lock */
 static int res_locked = 0;            /* set when resource chains locked -- for debug */
 
index 8b9b92c6ae18b7695511bc45974b7e66727cde2e..c73cc1012c47d04351d88171b28752ba8718ecc5 100644 (file)
@@ -25,8 +25,6 @@
 #include "bacula.h"
 #include "jcr.h"
 
-#define USE_RUNSCRIPT
-
 #include "runscript.h"
 
 RUNSCRIPT *new_runscript()
index 136d8a7f17b429568398b63b125abbf4b0b772fe..063fad0e9436f5c18fc843dbc28668ed11045595 100644 (file)
@@ -490,7 +490,7 @@ int main(int argc, char *argv[])
       printf("Must have filename\n");
       exit(1);
    }
-   fd = fopen(argv[1], "r");
+   fd = fopen(argv[1], "rb");
    if (!fd) {
       printf("Could not open %s: ERR=%s\n", argv[1], strerror(errno));
       exit(1);
index 4d1cf2051d1c2fb84264cb29ae5ab6621346de63..1856539ac306cfe3cc4c55f8cdc4645e7e9b62f0 100644 (file)
@@ -26,7 +26,7 @@
 #include "stored.h"
 #include "findlib/find.h"
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 int win32_client = 1;
 #else
 int win32_client = 0;
@@ -122,7 +122,7 @@ int main (int argc, char *argv[])
          break;
 
       case 'e':                    /* exclude list */
-         if ((fd = fopen(optarg, "r")) == NULL) {
+         if ((fd = fopen(optarg, "rb")) == NULL) {
             berrno be;
             Pmsg2(0, _("Could not open exclude file: %s, ERR=%s\n"),
                optarg, be.strerror());
@@ -137,7 +137,7 @@ int main (int argc, char *argv[])
          break;
 
       case 'i':                    /* include list */
-         if ((fd = fopen(optarg, "r")) == NULL) {
+         if ((fd = fopen(optarg, "rb")) == NULL) {
             berrno be;
             Pmsg2(0, _("Could not open include file: %s, ERR=%s\n"),
                optarg, be.strerror());
index 933af258c2772320d437c252cc1924beff89bd2f..40d348ccaebf74a79b03a8ceb5fe1b7a6c1fc01b 100644 (file)
@@ -124,7 +124,7 @@ int main (int argc, char *argv[])
          break;
 
       case 'e':                    /* exclude list */
-         if ((fd = fopen(optarg, "r")) == NULL) {
+         if ((fd = fopen(optarg, "rb")) == NULL) {
             Pmsg2(0, _("Could not open exclude file: %s, ERR=%s\n"),
                optarg, strerror(errno));
             exit(1);
@@ -138,7 +138,7 @@ int main (int argc, char *argv[])
          break;
 
       case 'i':                    /* include list */
-         if ((fd = fopen(optarg, "r")) == NULL) {
+         if ((fd = fopen(optarg, "rb")) == NULL) {
             Pmsg2(0, _("Could not open include file: %s, ERR=%s\n"),
                optarg, strerror(errno));
             exit(1);
index d88a10991a5f37662e2bfa0c7ad3d7f004144caa..6d979c96f5ee62805b991f8cb4c9fe981db55ebf 100644 (file)
@@ -52,7 +52,7 @@ static int update_digest_record(B_DB *db, char *digest, DEV_RECORD *rec, int typ
 
 
 /* Global variables */
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 int win32_client = 1;
 #else
 int win32_client = 0;
index fd9338b9ad2f2a03f896855c48675f1b8acae367..4575531848e001703c9ce6c8337b846e0bb8581c 100644 (file)
@@ -1881,8 +1881,8 @@ static void fillcmd()
     */
    jcr->dcr->VolFirstIndex = 0;
    time(&jcr->run_time);              /* start counting time for rates */
-   localtime_r(&jcr->run_time, &tm);
-   strftime(buf1, sizeof(buf1), "%T", &tm);
+   (void)localtime_r(&jcr->run_time, &tm);
+   strftime(buf1, sizeof(buf1), "%H:%M:%S", &tm);
    if (simple) {
       Pmsg1(-1, _("%s Begin writing Bacula records to tape ...\n"), buf1);
    } else {
@@ -1935,8 +1935,8 @@ static void fillcmd()
           */
          if ((block->BlockNumber % 32000) == 0) {
             now = time(NULL);
-            localtime_r(&now, &tm);
-            strftime(buf1, sizeof(buf1), "%T", &tm);
+            (void)localtime_r(&now, &tm);
+            strftime(buf1, sizeof(buf1), "%H:%M:%S", &tm);
             Pmsg1(-1, _("%s Flush block, write EOF\n"), buf1);
             flush_block(block, 0);
             dev->weof(1);
@@ -2012,8 +2012,8 @@ static void fillcmd()
    }
 
    now = time(NULL);
-   localtime_r(&now, &tm);
-   strftime(buf1, sizeof(buf1), "%T", &tm);
+   (void)localtime_r(&now, &tm);
+   strftime(buf1, sizeof(buf1), "%H:%M:%S", &tm);
    if (simple) {
       Pmsg3(-1, _("\n\n%s Done filling tape at %d:%d. Now beginning re-read of tape ...\n"),
          buf1, jcr->dcr->dev->file, jcr->dcr->dev->block_num);
index 99be022c9117b809724326953e4bff6005ec02ad..6373a8e39fe6d1f1eee84dce4916cc2bf04aeecc 100644 (file)
@@ -12,7 +12,7 @@
  *        to carry out operations without worrying about who
  *        set what lock (i.e. race conditions).
  *
- *     Note, this is the device dependent code, and my have
+ *     Note, this is the device dependent code, and may have
  *           to be modified for each system, but is meant to
  *           be as "generic" as possible.
  *
@@ -103,7 +103,7 @@ init_dev(JCR *jcr, DEVRES *device)
    DCR *dcr = NULL;
    DEVICE *dev;
 
-   
+
    /* If no device type specified, try to guess */
    if (!device->dev_type) {
       /* Check that device is available */
index 4ca8fb6da7d3f797298538bf6c97084d5b0130dd..e52f19e0c0b1c1448330636097b65862c5b537c8 100644 (file)
@@ -181,7 +181,7 @@ typedef struct s_steal_lock {
    int        dev_prev_blocked;       /* previous blocked state */
 } bsteal_lock_t;
 
-struct DEVRES;                        /* Device resource defined in stored_conf.h */
+class DEVRES;                        /* Device resource defined in stored_conf.h */
 
 class DCR; /* forward reference */
 /*
index b00f425233924a7698e49553996d4fbb3ed1f09a..c2a429378e441711a949fcb1e329a6cde61cee35 100644 (file)
@@ -873,7 +873,7 @@ static bool changer_cmd(JCR *jcr)
       if (dcr) {
          dev = dcr->dev;
          P(dev->mutex);               /* Use P to avoid indefinite block */
-         if (!dev->device->changer_res) {     
+         if (!dev->device->changer_res) {
             bnet_fsend(dir, _("3995 Device %s is not an autochanger.\n"), 
                dev->print_name());
          /* Under certain "safe" conditions, we can steal the lock */
index 41df7eae30ba53f1c4d59041ab228dbe606c18e6..af5198173187293e8067d0beafffecddfd5fd366 100644 (file)
@@ -324,7 +324,7 @@ bool get_bootstrap_file(JCR *jcr, BSOCK *sock)
       jcr->Job);
    Dmsg1(400, "bootstrap=%s\n", fname);
    jcr->RestoreBootstrap = fname;
-   bs = fopen(fname, "a+");           /* create file */
+   bs = fopen(fname, "a+b");           /* create file */
    if (!bs) {
       Jmsg(jcr, M_FATAL, 0, _("Could not create bootstrap file %s: ERR=%s\n"),
          jcr->RestoreBootstrap, strerror(errno));
index 9cf930447b916eabdd81a7e5cd91efec16eb8e53..e57326ccc119848ba77ad4432a2ed6d97970e9e6 100644 (file)
@@ -579,7 +579,7 @@ bool open_attr_spool_file(JCR *jcr, BSOCK *bs)
    POOLMEM *name  = get_pool_memory(PM_MESSAGE);
 
    make_unique_spool_filename(jcr, &name, bs->fd);
-   bs->spool_fd = fopen(name, "w+");
+   bs->spool_fd = fopen(name, "w+b");
    if (!bs->spool_fd) {
       berrno be;
       Jmsg(jcr, M_FATAL, 0, _("fopen attr spool file %s failed: ERR=%s\n"), name,
index 51b7dd76b7e9fe57a3862a707921f5547ebfa187..cb9766cd6f443f930f4fff6a944849f265d1a567 100644 (file)
@@ -39,7 +39,13 @@ static void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass);
 
 /* We build the current resource here statically,
  * then move it to dynamic memory */
+#if defined(_MSC_VER)
+extern "C" { // work around visual compiler mangling variables
+    URES res_all;
+}
+#else
 URES res_all;
+#endif
 int res_all_size = sizeof(res_all);
 
 /* Definition of records permitted within each
index e1db10d0bc37a05e97f14f85f9e19f0a460cda82..77a759eb06caa48b82c5dc57c9067e01a5a6d548 100644 (file)
@@ -85,7 +85,7 @@ public:
 
    TLS_CONTEXT *tls_ctx;              /* Shared TLS Context */
 };
-typedef struct s_res_store STORES;
+typedef class s_res_store STORES;
 
 class AUTOCHANGER {
 public:
index 65b6a2d647198508a6af3105bb77262ef9e36f37..a7b09770463be16199cc949b57dd125a4a8aec38 100644 (file)
@@ -19,7 +19,6 @@
 #include "bacula.h"
 #include "lib/fnmatch.h"
 
-
 static void usage()
 {
    fprintf(stderr,
diff --git a/bacula/src/tools/drivetype.c b/bacula/src/tools/drivetype.c
new file mode 100644 (file)
index 0000000..b778ade
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Program for determining drive type
+ *
+ *   Written by Robert Nelson, June 2006
+ *
+ *   Version $Id$
+ *
+ */
+/*
+   Copyright (C) 2006 Kern Sibbald
+
+   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 
+   file LICENSE for additional details.
+
+ */
+
+#include "bacula.h"
+#include "findlib/find.h"
+
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) 
+   { return 1; }
+
+static void usage()
+{
+   fprintf(stderr, _(
+"\n"
+"Usage: drivetype [-v] path ...\n"
+"\n"
+"       Print the drive type a given file/directory is on.\n"
+"       The following options are supported:\n"
+"\n"
+"       -v     print both path and file system type.\n"
+"       -?     print this message.\n"
+"\n"));
+
+   exit(1);
+}
+
+
+int
+main (int argc, char *const *argv)
+{
+   char dt[100];
+   int verbose = 0;
+   int status = 0;
+   int ch, i;
+
+   setlocale(LC_ALL, "");
+   bindtextdomain("bacula", LOCALEDIR);
+   textdomain("bacula");
+
+   while ((ch = getopt(argc, argv, "v?")) != -1) {
+      switch (ch) {
+         case 'v':
+            verbose = 1;
+            break;
+         case '?':
+         default:
+            usage();
+
+      }
+   }
+   argc -= optind;
+   argv += optind;
+
+   if (argc < 1) {
+      usage();
+   }
+
+   OSDependentInit();
+   for (i = 0; i < argc; --argc, ++argv) {
+      if (drivetype(*argv, dt, sizeof(dt))) {
+         if (verbose) {
+            printf("%s: %s\n", *argv, dt);
+         } else {
+            puts(dt);
+         }
+      } else {
+         fprintf(stderr, _("%s: unknown\n"), *argv);
+         status = 1;
+      }
+   }
+
+   exit(status);
+}
index e671257908a0ac1efdfc7e3973bbcd5ca855333c..796588d9a6f590d78bd191623fb1e1b33933acb4 100644 (file)
@@ -32,7 +32,7 @@ static void usage()
 {
    fprintf(stderr, _(
 "\n"
-"Usage: fstype [-d debug_level] path ...\n"
+"Usage: fstype [-v] path ...\n"
 "\n"
 "       Print the file system type a given file/directory is on.\n"
 "       The following options are supported:\n"
index 851c3a879463c1e2f2591c64ca0cab16b11ffbca..fe4c21a2e626489d31bfa17bad4c3d326c3f607d 100644 (file)
@@ -20,7 +20,7 @@
 #include "findlib/find.h"
 
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 int win32_client = 1;
 #else
 int win32_client = 0;
index e48df2e6ccfc321d289b50975d540300a374ab89..78ff15d3ecdef49109f7d8cd12117b48e86108c8 100755 (executable)
@@ -19,7 +19,7 @@
 #include "bacula.h"
 #include "findlib/find.h"
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
 int win32_client = 1;
 #else
 int win32_client = 0;
@@ -125,7 +125,7 @@ main (int argc, char *const *argv)
       }
    }
    if (inc) {
-      fd = fopen(inc, "r");
+      fd = fopen(inc, "rb");
       if (!fd) {
          printf(_("Could not open include file: %s\n"), inc);
          exit(1);
@@ -138,7 +138,7 @@ main (int argc, char *const *argv)
    }
 
    if (exc) {
-      fd = fopen(exc, "r");
+      fd = fopen(exc, "rb");
       if (!fd) {
          printf(_("Could not open exclude file: %s\n"), exc);
          exit(1);
diff --git a/bacula/src/win32/ClientConfig.ini b/bacula/src/win32/ClientConfig.ini
new file mode 100644 (file)
index 0000000..c536d2e
--- /dev/null
@@ -0,0 +1,157 @@
+[Settings]
+NumFields=20
+
+[Field 1]
+Type="GroupBox"
+Text="Client"
+Left=0
+Top=0
+Right=300
+Bottom=52
+
+[Field 2]
+Type="Label"
+Text="Name"
+Left=6
+Top=10
+Right=40
+Bottom=18
+
+[Field 3]
+Type="Text"
+Left=40
+Top=8
+Right=128
+Bottom=20
+
+[Field 4]
+Type="Label"
+Text="(eg. hostname-fd)"
+Left=136
+Top=10
+Right=288
+Bottom=18
+
+[Field 5]
+Type="Label"
+Text="Port"
+Left=6
+Top=24
+Right=40
+Bottom=32
+
+[Field 6]
+Type="Text"
+Flags=ONLY_NUMBERS
+Left=40
+Top=22
+Right=68
+Bottom=34
+
+[Field 7]
+Type="Label"
+Text="Max Jobs"
+Left=6
+Top=38
+Right=40
+Bottom=46
+
+[Field 8]
+Type="Text"
+Flags=ONLY_NUMBERS
+Left=40
+Top=36
+Right=56
+Bottom=48
+
+[Field 9]
+Type="GroupBox"
+Text="Director"
+Left=0
+Top=54
+Right=300
+Bottom=92
+
+[Field 10]
+Type="Label"
+Text="Name"
+Left=6
+Top=64
+Right=40
+Bottom=72
+
+[Field 11]
+Type="Text"
+Left=40
+Top=62
+Right=128
+Bottom=74
+
+[Field 12]
+Type="Label"
+Text="(eg. servername-dir)"
+Left=136
+Top=64
+Right=288
+Bottom=72
+
+[Field 13]
+Type="Label"
+Text="Password"
+Left=6
+Top=78
+Right=40
+Bottom=86
+
+[Field 14]
+Type="Text"
+Left=40
+Top=76
+Right=288
+Bottom=88
+
+[Field 15]
+Type="GroupBox"
+Text="Monitor"
+Left=0
+Top=94
+Right=300
+Bottom=132
+
+[Field 16]
+Type="Label"
+Text="Name"
+Left=6
+Top=104
+Right=40
+Bottom=112
+
+[Field 17]
+Type="Text"
+Left=40
+Top=102
+Right=128
+Bottom=114
+
+[Field 18]
+Type="Label"
+Text="(eg. servername-mon)"
+Left=136
+Top=104
+Right=288
+Bottom=112
+
+[Field 19]
+Type="Label"
+Text="Password"
+Left=6
+Top=118
+Right=36
+Bottom=126
+
+[Field 20]
+Type="Text"
+Left=40
+Top=116
+Right=288
+Bottom=128
diff --git a/bacula/src/win32/Makefile.inc.cross b/bacula/src/win32/Makefile.inc.cross
new file mode 100644 (file)
index 0000000..0e9896f
--- /dev/null
@@ -0,0 +1,72 @@
+#
+# Makefile for win32 bacula executables
+# Using MinGW cross-compiler on GNU/Linux
+#
+#  Written by Robert Nelson, June 2006
+#
+
+# Global Configuration
+
+ECHO_CMD = @
+
+TOPDIR = /home/robert/src/bacula-w32
+DEPKGS = $(TOPDIR)/depkgs-test
+
+MINGW_BIN = $(TOPDIR)/cross-tools/mingw32/bin
+MINGW_INCLUDE = $(TOPDIR)/cross-tools/mingw32/mingw32/include
+
+CC = $(MINGW_BIN)/mingw32-g++ $(DEFINES) $(INCLUDES)
+CXX = $(MINGW_BIN)/mingw32-g++ $(DEFINES) $(INCLUDES)
+AR = $(MINGW_BIN)/mingw32-ar
+RANLIB = $(MINGW_BIN)/mingw32-ranlib
+WINDRES = $(MINGW_BIN)/mingw32-windres
+OBJCPY = $(MINGW_BIN)/mingw32-objcopy
+
+CFLAGS = -Wall -mno-cygwin -m32 -mwin32 -mthreads -O3 -fno-strict-aliasing
+LDFLAGS = -Wall -mno-cygwin -Wl,--disable-auto-import
+
+INCLUDE_DDK = -I$(MINGW_INCLUDE)/ddk
+INCLUDE_BACULA = -I../.. -I../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
+
+LIBS_PTHREADS = \
+       $(DEPKGS)/lib/libpthreadGCE.a
+
+LIBS_ZLIB = \
+       $(DEPKGS)/lib/libz.a
+
+LIBS_SQL = \
+       $(DEPKGS)/lib/libmysql.a
+
+LIBS_SSL = \
+       $(DEPKGS)/lib/libssl.dll.a
+
+LIBS_CRYPTO = \
+       $(DEPKGS)/lib/libcrypto.dll.a
+
+LIBS_WX = \
+       $(DEPKGS)/lib/wx_dll/libwxmsw26_core.a \
+       $(DEPKGS)/lib/wx_dll/libwxbase26.a
+
+LIBS_BACULA = \
+       $(LIBDIR)/libbacula.a
+
+HAVES = \
+       -DHAVE_WIN32 \
+       -DHAVE_MINGW \
+       -DHAVE_ZLIB_H \
+       -DHAVE_LIBZ \
+       -DHAVE_MYSQL \
+       -DHAVE_CRYPTO \
+       -DHAVE_OPENSSL \
+       -DHAVE_TLS
+
+BINDIR = ../release
+LIBDIR = ../release
+OBJDIR = .
diff --git a/bacula/src/win32/Makefile.inc.native b/bacula/src/win32/Makefile.inc.native
new file mode 100644 (file)
index 0000000..5ddc40c
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Makefile for win32 bacula executables
+# Using MinGW cross-compiler on GNU/Linux
+#
+#  Written by Robert Nelson, June 2006
+#
+
+# Global Configuration
+
+ECHO_CMD = @
+
+TOPDIR = /c/src/bacula-1.38.9
+DEPKGS = $(TOPDIR)/depkgs-mingw
+
+MINGW_BIN = /mingw/bin
+MINGW_INCLUDE = /mingw/include
+
+CC = $(MINGW_BIN)/g++ $(DEFINES) $(INCLUDES)
+CXX = $(MINGW_BIN)/g++ $(DEFINES) $(INCLUDES)
+AR = $(MINGW_BIN)/ar
+RANLIB = $(MINGW_BIN)/ranlib
+WINDRES = $(MINGW_BIN)/windres
+OBJCPY = $(MINGW_BIN)/objcopy
+
+#CFLAGS = -ffunction-sections -fdata-sections -O3 -fno-strict-aliasing
+#LDFLAGS = -Wl,--gc-sections -Wl,--disable-auto-import
+
+CFLAGS = -Wall -mno-cygwin -m32 -mwin32 -mthreads -O3 -fno-strict-aliasing
+LDFLAGS = -Wall -mno-cygwin -Wl,--disable-auto-import
+
+INCLUDE_DDK = -I$(MINGW_INCLUDE)/ddk
+INCLUDE_BACULA = -I../.. -I../compat
+INCLUDE_PTHREADS = -I$(DEPKGS)/pthreads
+INCLUDE_ZLIB = -I$(DEPKGS)/zlib
+INCLUDE_VSS = -I"$(subst C:,/c,$(subst \,/,$(VSSSDK_DIR)))"
+INCLUDE_ICONS = -I../libwin32
+INCLUDE_OPENSSL = -I$(DEPKGS)/openssl/outinc
+INCLUDE_WX = -I$(DEPKGS)/wx/lib/gcc_lib/msw -I$(DEPKGS)/wx/include
+INCLUDE_MYSQL = -I$(DEPKGS)/mysql/include
+
+LIBS_PTHREADS = \
+       $(DEPKGS)/pthreads/libpthreadGCE.a
+
+LIBS_ZLIB = \
+       $(DEPKGS)/zlib/libz.a
+
+LIBS_SQL = \
+       $(DEPKGS)/mysql/lib/opt/libmysql.lib
+
+LIBS_SSL = \
+       $(DEPKGS)/openssl/out/libssl.a
+
+LIBS_CRYPTO = \
+       $(DEPKGS)/openssl/out/libcrypto.a
+
+LIBS_WX = \
+       $(DEPKGS)/wx/lib/gcc_lib/libwxmsw26_core.a \
+       $(DEPKGS)/wx/lib/gcc_lib/libwxbase26.a
+
+LIBS_BACULA = \
+       $(LIBDIR)/libbacula.a
+
+HAVES = \
+       -DHAVE_WIN32 \
+       -DHAVE_MINGW \
+       -DHAVE_ZLIB_H \
+       -DHAVE_LIBZ \
+       -DHAVE_MYSQL \
+       -DHAVE_CRYPTO \
+       -DHAVE_OPENSSL \
+       -DHAVE_TLS
+
+BINDIR = ../release
+LIBDIR = ../release
+OBJDIR = .
diff --git a/bacula/src/win32/Makefile.rules b/bacula/src/win32/Makefile.rules
new file mode 100644 (file)
index 0000000..62ee60c
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# 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)))
+endef
+
+define clean_exe
+       $(ECHO_CMD)rm -f $(1) $(addsuffix .dbg,$(basename $(1)))
+endef
+
+define checkdir
+       @if [ ! -e $(dir $(1)) ]; then mkdir $(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 $@
+       $(makedbg)
+endef
+
+define link_winapp
+       @echo "Linking $@"
+       $(call checkdir,$@)
+       $(ECHO_CMD)$(CXX) $(CFLAGS) $(LDFLAGS) -mwindows $^ $(1) -o $@
+       $(makedbg)
+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) -O coff $< -o $@
+
+$(OBJDIR)/%.d: %.c
+       $(makedep)
+
+$(OBJDIR)/%.d: %.cpp
+       $(makedep)
+
+ifneq ($(MAKECMDGOALS),clean)
+include $(patsubst %.o,%.d,$(filter-out %.res,$(ALL_OBJS)))
+endif
diff --git a/bacula/src/win32/Makefile.template b/bacula/src/win32/Makefile.template
new file mode 100644 (file)
index 0000000..978221d
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Makefile for win32 bacula executables
+# Using MinGW cross-compiler on GNU/Linux
+#
+#  Written by Robert Nelson, June 2006
+#
+
+include ../Makefile.inc
+
+INCLUDES = \
+       $(INCLUDE_DDK) \
+       $(INCLUDE_PTHREADS) \
+       $(INCLUDE_BACULA) \
+       $(INCLUDE_ZLIB) \
+       $(INCLUDE_VSS) \
+       $(INCLUDE_ICONS) \
+       $(INCLUDE_OPENSSL)
+
+DEFINES = \
+       -DUSING_DLL \
+       $(HAVES)
+
+# Replace MODULE with the directory in the main Bacula tree containing the source
+VPATH = ../../MODULE
+
+##########################################################################
+
+MODULE1_OBJS = \
+       $(OBJDIR)/object1.o \
+       $(OBJDIR)/object2.o \
+       $(OBJDIR)/objectN.o
+
+MODULE1_LIBS = \
+       $(LIBS_PTHREADS) \
+       -lwsock32
+
+MODULE2_OBJS = \
+       $(OBJDIR)/object3.o \
+       $(OBJDIR)/object4.o \
+       $(OBJDIR)/objectN.o
+
+MODULE2_LIBS = \
+       $(LIBS_PTHREADS) \
+       -lwsock32
+
+ALL_OBJS = \
+       OBJS_MODULE1 \
+       OBJS_MODULE2
+
+######################################################################
+
+# Targets
+
+.PHONY: all clean
+
+all:   $(BINDIR)/MODULE1.exe $(BINDIR)/MODULE2.exe
+
+clean:
+       @echo "Cleaning `pwd`"
+       $(call clean_obj,$(ALL_OBJS))
+       $(call clean_exe,$(BINDIR)/MODULE1.exe)
+       $(call clean_exe,$(BINDIR)/MODULE2.exe)
+
+#
+# Rules
+#
+
+$(BINDIR)/MODULE1.exe: $(SDOBJS) $(MODULE1_OBJS) $(LIBS_BACULA)
+       $(call link_winapp,$(MODULE1_LIBS))
+
+$(BINDIR)/MODULE2.exe: $(SDOBJS) $(MODULE2_OBJS) $(LIBS_BACULA)
+       $(call link_conapp,$(MODULE1_LIBS))
+
+include ../Makefile.rules
index 4300ccb5135b03d4b4ae5a36ae12c87fbe70d723..fd9e8a33d2492c19ad9defb1714a50acec0af728 100644 (file)
 ï»¿
 Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
+# Visual Studio 2005
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wx-console", "wx-console\wx-console.vcproj", "{9BA8E10D-0D82-4B25-8543-DE34641FBC10}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baculafd", "baculafd\baculafd.vcproj", "{6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}"
+       ProjectSection(ProjectDependencies) = postProject
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "console", "console\console.vcproj", "{A0F65E06-9F18-40AC-81F6-A080852F1104}"
+       ProjectSection(ProjectDependencies) = postProject
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fstype", "tools\fstype\fstype.vcproj", "{AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbac", "libbac\libbac.vcproj", "{374BF775-AF68-4A88-814A-48F692DFFE5A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfind", "libfind\libfind.vcproj", "{05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drivetype", "tools\drivetype\drivetype.vcproj", "{E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compat", "compat\compat.vcproj", "{05CF01A0-3C11-443B-B14B-D806C79212F1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testfind", "tools\testfind\testfind.vcproj", "{558838F9-D792-4F56-AAB2-99C03687C5FF}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testls", "tools\testls\testls.vcproj", "{28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baculafd", "filed\baculafd.vcproj", "{6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{825DFFD0-4747-43CA-8326-529655E31935}"
+       ProjectSection(SolutionItems) = preProject
+               ClientConfig.ini = ClientConfig.ini
+               ..\..\autoconf\bacula-macros\db.m4 = ..\..\autoconf\bacula-macros\db.m4
+               ..\..\autoconf\bacula-macros\largefiles.m4 = ..\..\autoconf\bacula-macros\largefiles.m4
+               ..\..\autoconf\bacula-macros\os.m4 = ..\..\autoconf\bacula-macros\os.m4
+               winbacula.nsi.in = winbacula.nsi.in
+       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
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {BAB13141-20F9-4B2D-8C0A-021804ADD077} = {BAB13141-20F9-4B2D-8C0A-021804ADD077}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       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}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       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}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bextract", "stored\bextract\bextract.vcproj", "{6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bls", "stored\bls\bls.vcproj", "{F8AF7D74-2918-422B-A7B6-4D98566B7160}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bscan", "stored\bscan\bscan.vcproj", "{56EADEDB-FBED-4758-8B54-7B0B47ABDABF}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {BAB13141-20F9-4B2D-8C0A-021804ADD077} = {BAB13141-20F9-4B2D-8C0A-021804ADD077}
+               {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       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}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "storelib", "stored\storelib\storelib.vcproj", "{CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcats", "cats\cats.vcproj", "{BAB13141-20F9-4B2D-8C0A-021804ADD077}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mt", "tapetools\mt\mt\mt.vcproj", "{8F29646A-559A-484C-9C73-B3FCE80EDD9C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "postest", "stored\postest\postest.vcproj", "{208D3989-794B-47A2-9D04-D7AEE1524078}"
+       ProjectSection(ProjectDependencies) = postProject
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}
+               {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {374BF775-AF68-4A88-814A-48F692DFFE5A}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {05CF01A0-3C11-443B-B14B-D806C79212F1}
+       EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sleep", "scripts\sleep.vcproj", "{0F56AEB0-14DA-4A80-8962-1F85A17339D0}"
+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
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,16 +162,117 @@ Global
                {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Debug|Win32.Build.0 = Debug|Win32
                {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Release|Win32.ActiveCfg = Release|Win32
                {9BA8E10D-0D82-4B25-8543-DE34641FBC10}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
-               {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
                {A0F65E06-9F18-40AC-81F6-A080852F1104}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {AAF33ADD-A4F9-4BCA-B7F9-0C35C843CC7E}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {374BF775-AF68-4A88-814A-48F692DFFE5A}.Release|Win32.Build.0 = Release|Win32
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}.Debug|Win32.ActiveCfg = Debug|Win32
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}.Debug|Win32.Build.0 = Debug|Win32
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}.Release|Win32.ActiveCfg = Release|Win32
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {E5BC5B2E-976D-4DED-AA07-5DD52BF2163F}.Release|Win32.Build.0 = Release|Win32
+               {05CF01A0-3C11-443B-B14B-D806C79212F1}.Debug|Win32.ActiveCfg = Debug|Win32
+               {05CF01A0-3C11-443B-B14B-D806C79212F1}.Debug|Win32.Build.0 = Debug|Win32
+               {05CF01A0-3C11-443B-B14B-D806C79212F1}.Release|Win32.ActiveCfg = Release|Win32
+               {05CF01A0-3C11-443B-B14B-D806C79212F1}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {558838F9-D792-4F56-AAB2-99C03687C5FF}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {28FB58CE-AB8C-4C60-83DA-BC1BFCC59BFF}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {D03415F7-654E-42F4-B0E9-CB8FBE3F22FA}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {F5F063F8-11A1-475A-82E2-19759BB40B25}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {614CE916-0972-4126-9392-CD9FC0ADD7DE}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {6A7AA493-E46C-4994-B8D6-AA6C9C19C9BA}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {F8AF7D74-2918-422B-A7B6-4D98566B7160}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {56EADEDB-FBED-4758-8B54-7B0B47ABDABF}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {496415E0-AF44-4AD8-8C99-91B837DDF469}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D}.Release|Win32.Build.0 = Release|Win32
+               {BAB13141-20F9-4B2D-8C0A-021804ADD077}.Debug|Win32.ActiveCfg = Debug|Win32
+               {BAB13141-20F9-4B2D-8C0A-021804ADD077}.Debug|Win32.Build.0 = Debug|Win32
+               {BAB13141-20F9-4B2D-8C0A-021804ADD077}.Release|Win32.ActiveCfg = Release|Win32
+               {BAB13141-20F9-4B2D-8C0A-021804ADD077}.Release|Win32.Build.0 = Release|Win32
+               {8F29646A-559A-484C-9C73-B3FCE80EDD9C}.Debug|Win32.ActiveCfg = Debug|Win32
+               {8F29646A-559A-484C-9C73-B3FCE80EDD9C}.Debug|Win32.Build.0 = Debug|Win32
+               {8F29646A-559A-484C-9C73-B3FCE80EDD9C}.Release|Win32.ActiveCfg = Release|Win32
+               {8F29646A-559A-484C-9C73-B3FCE80EDD9C}.Release|Win32.Build.0 = Release|Win32
+               {208D3989-794B-47A2-9D04-D7AEE1524078}.Debug|Win32.ActiveCfg = Debug|Win32
+               {208D3989-794B-47A2-9D04-D7AEE1524078}.Debug|Win32.Build.0 = Debug|Win32
+               {208D3989-794B-47A2-9D04-D7AEE1524078}.Release|Win32.ActiveCfg = Release|Win32
+               {208D3989-794B-47A2-9D04-D7AEE1524078}.Release|Win32.Build.0 = Release|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|Win32.ActiveCfg = Release|Win32
+               {0F56AEB0-14DA-4A80-8962-1F85A17339D0}.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}
+               {05567F02-5DD8-4EB6-9C8E-C236C1D9AB1F} = {0377E151-3352-487B-A5CF-24BCDC9EC43F}
+               {05CF01A0-3C11-443B-B14B-D806C79212F1} = {0377E151-3352-487B-A5CF-24BCDC9EC43F}
+               {CAD30B43-D93B-47D5-9161-6A3E9BADCC1D} = {0377E151-3352-487B-A5CF-24BCDC9EC43F}
+               {BAB13141-20F9-4B2D-8C0A-021804ADD077} = {0377E151-3352-487B-A5CF-24BCDC9EC43F}
+               {374BF775-AF68-4A88-814A-48F692DFFE5A} = {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}
+               {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}
+               {8F29646A-559A-484C-9C73-B3FCE80EDD9C} = {37F903FE-3474-4C93-AD5B-987CB6A92E62}
+               {0F56AEB0-14DA-4A80-8962-1F85A17339D0} = {37F903FE-3474-4C93-AD5B-987CB6A92E62}
+               {614CE916-0972-4126-9392-CD9FC0ADD7DE} = {37F903FE-3474-4C93-AD5B-987CB6A92E62}
+       EndGlobalSection
 EndGlobal
diff --git a/bacula/src/win32/compat/Makefile b/bacula/src/win32/compat/Makefile
new file mode 100644 (file)
index 0000000..9b5f5d3
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Makefile for win32 bacula executables
+# Using MinGW cross-compiler on GNU/Linux
+#  
+#  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
+
+######################################################################
+
+# 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
index a9f46a1173aa145577a0a10e18660e1fc20e576a..50451a37feac70f4e8cde4dad8105072cc72bf3b 100644 (file)
 // Created On      : Sat Jan 31 15:55:00 2004
 // $Id$
 
-#ifdef __APCUPSD__
-
-#include "apc.h"
-#include "compat.h"
-#include "winapi.h"
-
-#else
-
 #include "bacula.h"
 #include "compat.h"
 #include "jcr.h"
 #include "../../lib/winapi.h"
 #include "vss.h"
 
-#endif
 
 #define b_errno_win32 (1<<29)
 
@@ -459,16 +450,16 @@ srandom(unsigned int seed)
 void
 cvt_utime_to_ftime(const time_t  &time, FILETIME &wintime)
 {
-    uint64_t mstime = time;
-    mstime *= WIN32_FILETIME_SCALE;
-    mstime += WIN32_FILETIME_ADJUST;
+   uint64_t mstime = time;
+   mstime *= WIN32_FILETIME_SCALE;
+   mstime += WIN32_FILETIME_ADJUST;
 
-    #ifdef HAVE_MINGW
-    wintime.dwLowDateTime = (DWORD)(mstime & 0xffffffffUL);
-    #else
-    wintime.dwLowDateTime = (DWORD)(mstime & 0xffffffffI64);
-    #endif
-    wintime.dwHighDateTime = (DWORD) ((mstime>>32)& 0xffffffffUL);
+#if defined(_MSC_VER)
+   wintime.dwLowDateTime = (DWORD)(mstime & 0xffffffffI64);
+#else
+   wintime.dwLowDateTime = (DWORD)(mstime & 0xffffffffUL);
+#endif
+   wintime.dwHighDateTime = (DWORD) ((mstime>>32)& 0xffffffffUL);
 }
 
 time_t
@@ -617,7 +608,7 @@ stat2(const char *file, struct stat *sb)
        attr = p_GetFileAttributesA(tmpbuf);
     }
 
-    if (attr == -1) {
+    if (attr == (DWORD)-1) {
         const char *err = errorString();
         d_msg(__FILE__, __LINE__, 99,
               "GetFileAttributes(%s): %s\n", tmpbuf, err);
index fe0c44f74056ab969f0ad19a81d356ed0296912b..5ac44ad0e3f55c58c83aaaccc26e932ec38f8305 100644 (file)
@@ -177,10 +177,18 @@ struct timezone {
 int strcasecmp(const char*, const char *);
 int gettimeofday(struct timeval *, struct timezone *);
 
+#ifndef EETXTBUSY
+#define EETXTBUSY 26
+#endif
+
 #ifndef ETIMEDOUT
 #define ETIMEDOUT 55
 #endif
 
+#ifndef ENOMEDIUM
+#define ENOMEDIUM 123
+#endif
+
 #ifndef HAVE_WXCONSOLE
 struct stat
 {
diff --git a/bacula/src/win32/compat/compat.vcproj b/bacula/src/win32/compat/compat.vcproj
new file mode 100644 (file)
index 0000000..c36ee0b
--- /dev/null
@@ -0,0 +1,296 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="compat"
+       ProjectGUID="{05CF01A0-3C11-443B-B14B-D806C79212F1}"
+       RootNamespace="compat"
+       Keyword="Win32Proj"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="4"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../compat;../..;&quot;../../../../depkgs-win32/pthreads&quot;;&quot;$(VSSSDK_DIR)&quot;"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_WIN32;WIN32_VSS;_USE_32BIT_TIME_T;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_DEPRECATE"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="false"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLibrarianTool"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="4"
+                       UseOfATL="1"
+                       CharacterSet="2"
+                       WholeProgramOptimization="0"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               AdditionalIncludeDirectories="../compat;../..;&quot;../../../../depkgs-win32/pthreads&quot;;&quot;$(VSSSDK_DIR)&quot;"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_WIN32;WIN32_VSS;_USE_32BIT_TIME_T;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_DEPRECATE"
+                               RuntimeLibrary="2"
+                               EnableFunctionLevelLinking="true"
+                               UsePrecompiledHeader="0"
+                               GenerateXMLDocumentationFiles="false"
+                               BrowseInformation="1"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="false"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLibrarianTool"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+                       >
+                       <File
+                               RelativePath=".\compat.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\getopt.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\print.cpp"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
+                       >
+                       <File
+                               RelativePath=".\alloca.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\compat.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\dirent.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\file.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\file.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\getopt.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\grp.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\ioctl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\mswinver.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\mtio.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\netdb.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\pwd.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sched.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\socket.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\socket.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\stat.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\stat.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\stdint.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\strings.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\syslog.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\time.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\time.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\unistd.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\vss.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\wait.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sys\wait.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\winconfig.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\winhost.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\winsock.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+                       >
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
index f5f676ad5100910dc0a709528f882ef61117ba86..3ca810cc06ec058474c22d5399cc23c7352e255e 100644 (file)
@@ -27,7 +27,7 @@
 #endif
 
 #include <string.h> //for strncmp
-#if defined (WIN32)
+#if defined (HAVE_WIN32)
 #include <malloc.h>
 #endif
 
@@ -41,7 +41,7 @@
 #if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__))))
 #include <alloca.h>
 #else
-#if !defined (_AIX) && !defined (WIN32)
+#if !defined (_AIX) && !defined (HAVE_WIN32)
 char *alloca ();
 #endif
 #endif /* alloca.h */
diff --git a/bacula/src/win32/compat/sys/mtio.h b/bacula/src/win32/compat/sys/mtio.h
new file mode 100644 (file)
index 0000000..51fa550
--- /dev/null
@@ -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 <hennus@cybercomm.nl>.  */
+
+#ifndef _SYS_MTIO_H
+#define _SYS_MTIO_H    1
+
+/* Get necessary definitions from system and kernel headers.  */
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+
+/* 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/winapi.c b/bacula/src/win32/compat/winapi.c
new file mode 100644 (file)
index 0000000..f08cf62
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * 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
+ */
+/*
+   Copyright (C) 2003-2006 Kern Sibbald
+
+   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 "bacula.h"
+
+// init with win9x, but maybe set to NT in InitWinAPI
+DWORD g_platform_id = VER_PLATFORM_WIN32_WINDOWS;
+DWORD g_MinorVersion = 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_CreateDirectoryA   p_CreateDirectoryA;
+t_CreateDirectoryW   p_CreateDirectoryW;
+
+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_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;
+
+void 
+InitWinAPIWrapper() 
+{
+   OSVERSIONINFO osversioninfo = { sizeof(OSVERSIONINFO) };
+
+   // Get the current OS version
+   if (!GetVersionEx(&osversioninfo)) {
+      g_platform_id = 0;
+      g_MinorVersion = 0;
+   } else {
+      g_platform_id = osversioninfo.dwPlatformId;
+      g_MinorVersion = osversioninfo.dwMinorVersion;
+   }
+
+   HMODULE hLib = LoadLibraryA("KERNEL32.DLL");
+   if (hLib) {
+      /* create file calls */
+      p_CreateFileA = (t_CreateFileA)
+          GetProcAddress(hLib, "CreateFileA");
+      p_CreateDirectoryA = (t_CreateDirectoryA)
+          GetProcAddress(hLib, "CreateDirectoryA");
+
+      /* 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 statically linkage doesn't work on Win 9x */
+         p_GetVolumePathNameW = (t_GetVolumePathNameW)
+             GetProcAddress(hLib, "GetVolumePathNameW");
+         p_GetVolumeNameForVolumeMountPointW = (t_GetVolumeNameForVolumeMountPointW)
+             GetProcAddress(hLib, "GetVolumeNameForVolumeMountPointW");
+      }
+
+      FreeLibrary(hLib);
+   }
+   
+   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");
+
+         FreeLibrary(hLib);
+      }
+
+      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");
+         FreeLibrary(hLib);
+      }
+   }
+
+   atexit(Win32ConvCleanupCache);
+}
index dc5fe36f02834ab02c91868b0242b1dcfc0b9f25..e9ffdcb4863e3adb0027bc6dcb0cb0e1a5bec14d 100644 (file)
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
-       ProjectType="Visual C++"\r
-       Version="8.00"\r
-       Name="console"\r
-       ProjectGUID="{A0F65E06-9F18-40AC-81F6-A080852F1104}"\r
-       Keyword="MFCProj"\r
-       SignManifests="true"\r
-       >\r
-       <Platforms>\r
-               <Platform\r
-                       Name="Win32"\r
-               />\r
-       </Platforms>\r
-       <ToolFiles>\r
-       </ToolFiles>\r
-       <Configurations>\r
-               <Configuration\r
-                       Name="Debug|Win32"\r
-                       OutputDirectory=".\Debug"\r
-                       IntermediateDirectory=".\Debug"\r
-                       ConfigurationType="1"\r
-                       InheritedPropertySheets="UpgradeFromVC60.vsprops"\r
-                       UseOfMFC="2"\r
-                       ATLMinimizesCRunTimeLibraryUsage="false"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               TypeLibraryName=".\Debug/console.tlb"\r
-                               HeaderFileName=""\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
-                               AdditionalIncludeDirectories="../compat;../..;../../../../depkgs-win32/pthreads,../../../../depkgs-win32/gettext/include"\r
-                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;HAVE_WIN32"\r
-                               MinimalRebuild="true"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="3"\r
-                               PrecompiledHeaderFile=".\Debug/console.pch"\r
-                               AssemblerListingLocation=".\Debug/"\r
-                               ObjectFile=".\Debug/"\r
-                               ProgramDataBaseFileName=".\Debug/"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="true"\r
-                               DebugInformationFormat="4"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
-                               Culture="1033"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               AdditionalDependencies="wsock32.lib pthreadVCE.lib intl.lib"\r
-                               OutputFile="Debug/bconsole.exe"\r
-                               LinkIncremental="0"\r
-                               SuppressStartupBanner="true"\r
-                               AdditionalLibraryDirectories="../../../../depkgs-win32/pthreads;,../../../../depkgs-win32/gettext/lib"\r
-                               GenerateDebugInformation="true"\r
-                               SubSystem="1"\r
-                               TargetMachine="1"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                               SuppressStartupBanner="true"\r
-                               OutputFile=".\Debug/console.bsc"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-               <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory=".\Release"\r
-                       IntermediateDirectory=".\Release"\r
-                       ConfigurationType="1"\r
-                       InheritedPropertySheets="UpgradeFromVC60.vsprops"\r
-                       UseOfMFC="2"\r
-                       ATLMinimizesCRunTimeLibraryUsage="false"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               TypeLibraryName=".\Release/console.tlb"\r
-                               HeaderFileName=""\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="4"\r
-                               AdditionalIncludeDirectories="../compat,../..,../../../../depkgs-win32/pthreads;../../../../depkgs-win32/gettext/include"\r
-                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;HAVE_WIN32"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="2"\r
-                               PrecompiledHeaderFile=".\Release/console.pch"\r
-                               AssemblerListingLocation=".\Release/"\r
-                               ObjectFile=".\Release/"\r
-                               ProgramDataBaseFileName=".\Release/"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="true"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
-                               Culture="1033"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               AdditionalDependencies="wsock32.lib pthreadVCE.lib intl.lib"\r
-                               OutputFile="Release/bconsole.exe"\r
-                               LinkIncremental="0"\r
-                               SuppressStartupBanner="true"\r
-                               AdditionalLibraryDirectories="../../../../depkgs-win32/pthreads;../../../../depkgs-win32/gettext/lib"\r
-                               SubSystem="1"\r
-                               TargetMachine="1"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                               SuppressStartupBanner="true"\r
-                               OutputFile=".\Release/console.bsc"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-       </Configurations>\r
-       <References>\r
-       </References>\r
-       <Files>\r
-               <Filter\r
-                       Name="Source Files"\r
-                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
-                       >\r
-                       <File\r
-                               RelativePath="..\lib\address_conf.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\alist.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="authenticate.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\base64.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\berrno.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\bnet.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\bsys.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\btime.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\btimers.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\compat.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="console.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="console_conf.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\cram-md5.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\crc32.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\dlist.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\edit.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\getopt.c"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\hmac.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\idcache.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\jcr.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\lex.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\md5.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\mem_pool.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\message.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\parse_conf.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\print.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\queue.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\res.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\rwlock.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\scan.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\serial.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\sha1.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\smartall.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="StdAfx.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                               UsePrecompiledHeader="1"\r
-                                               PrecompiledHeaderThrough="stdafx.h"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                               UsePrecompiledHeader="1"\r
-                                               PrecompiledHeaderThrough="stdafx.h"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\tls.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\util.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\watchdog.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               AdditionalIncludeDirectories=""\r
-                                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;_MBCS;HAVE_WIN32;_AFXDLL;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\winapi.cpp"\r
-                               >\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Header Files"\r
-                       Filter="h;hpp;hxx;hm;inl"\r
-                       >\r
-                       <File\r
-                               RelativePath="..\compat\alloca.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\compat.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\dirent.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\getopt.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\grp.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\mswinver.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\netdb.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\pwd.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\sched.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="StdAfx.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\stdint.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\strings.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\syslog.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\unistd.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\winconfig.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\winhost.h"\r
-                               >\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Resource Files"\r
-                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
-                       >\r
-               </Filter>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="console"
+       ProjectGUID="{A0F65E06-9F18-40AC-81F6-A080852F1104}"
+       RootNamespace="console"
+       Keyword="MFCProj"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory=".\Debug"
+                       ConfigurationType="1"
+                       InheritedPropertySheets="..\..\..\..\..\..\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\UpgradeFromVC60.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               TypeLibraryName=".\Debug/console.tlb"
+                               HeaderFileName=""
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../compat;../..;../../../../depkgs-win32/pthreads,../../../../depkgs-win32/gettext/include"
+                               PreprocessorDefinitions="_DEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;HAVE_WIN32;_USE_32BIT_TIME_T;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_DEPRECATE"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               PrecompiledHeaderFile=".\Debug/console.pch"
+                               AssemblerListingLocation=".\Debug/"
+                               ObjectFile=".\Debug/"
+                               ProgramDataBaseFileName=".\Debug/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="wsock32.lib pthreadVCEd.lib atlsd.lib"
+                               OutputFile="$(OutDir)\bconsole.exe"
+                               LinkIncremental="0"
+                               SuppressStartupBanner="true"
+                               AdditionalLibraryDirectories="../../../../depkgs-win32/pthreads/debug;../../../../depkgs-win32/gettext/lib"
+                               GenerateDebugInformation="true"
+                               SubSystem="1"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                               SuppressStartupBanner="true"
+                               OutputFile=".\Debug/console.bsc"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory=".\Release"
+                       ConfigurationType="1"
+                       InheritedPropertySheets="..\..\..\..\..\..\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\UpgradeFromVC60.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               TypeLibraryName=".\Release/console.tlb"
+                               HeaderFileName=""
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="4"
+                               AdditionalIncludeDirectories="../compat,../..,../../../../depkgs-win32/pthreads;../../../../depkgs-win32/gettext/include"
+                               PreprocessorDefinitions="NDEBUG;HAVE_CONSOLE;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;HAVE_WIN32;_USE_32BIT_TIME_T;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_DEPRECATE"
+                               StringPooling="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="2"
+                               PrecompiledHeaderFile=".\Release/console.pch"
+                               AssemblerListingLocation=".\Release/"
+                               ObjectFile=".\Release/"
+                               ProgramDataBaseFileName=".\Release/"
+                               BrowseInformation="1"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="wsock32.lib pthreadVCE.lib atls.lib"
+                               OutputFile="$(OutDir)\bconsole.exe"
+                               LinkIncremental="0"
+                               SuppressStartupBanner="true"
+                               AdditionalLibraryDirectories="&quot;../../../../depkgs-win32/pthreads/release&quot;;&quot;../../../../depkgs-win32/gettext/lib&quot;"
+                               GenerateDebugInformation="true"
+                               SubSystem="1"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                               SuppressStartupBanner="true"
+                               OutputFile=".\Release/console.bsc"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+                       >
+                       <File
+                               RelativePath="..\..\console\authenticate.c"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\console\console.c"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                               XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                               XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\console\console_conf.c"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                               XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                               XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl"
+                       >
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+                       >
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/bacula/src/win32/filed/Makefile b/bacula/src/win32/filed/Makefile
new file mode 100644 (file)
index 0000000..5993565
--- /dev/null
@@ -0,0 +1,86 @@
+#
+# Makefile for win32 bacula executables
+# Using MinGW cross-compiler on GNU/Linux
+#
+#  Written by Robert Nelson, June 2006
+#
+
+include ../Makefile.inc
+
+INCLUDES = \
+       -I. \
+       $(INCLUDE_PTHREADS) \
+       $(INCLUDE_BACULA) \
+       $(INCLUDE_ZLIB) \
+       $(INCLUDE_VSS) \
+       $(INCLUDE_OPENSSL) \
+       $(INCLUDE_ICONS)
+
+DEFINES = \
+       -DUSING_DLL \
+       -DWIN32_VSS \
+       $(HAVES)
+
+VPATH = ../../filed ../libwin32
+
+##########################################################################
+
+FILED_OBJS = \
+       $(OBJDIR)/authenticate.o \
+       $(OBJDIR)/backup.o \
+       $(OBJDIR)/estimate.o \
+       $(OBJDIR)/filed.o \
+       $(OBJDIR)/filed_conf.o \
+       $(OBJDIR)/heartbeat.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)/winabout.o \
+       $(OBJDIR)/winevents.o \
+       $(OBJDIR)/winservice.o \
+       $(OBJDIR)/winstat.o \
+       $(OBJDIR)/wintray.o \
+       $(OBJDIR)/winmain.o \
+       $(OBJDIR)/winres.res
+
+ALL_OBJS = $(FILED_OBJS)
+
+FILED_LIBS = \
+       $(LIBS_PTHREADS) \
+       $(LIBS_ZLIB) \
+       -lole32 \
+       -loleaut32 \
+       -lwsock32 \
+       -luuid
+
+######################################################################
+
+# Targets
+
+.PHONY: all clean
+
+all: $(BINDIR)/bacula-fd.exe
+
+clean:
+       @echo "Cleaning `pwd`"
+       $(call clean_obj,$(ALL_OBJS))
+       $(call clean_exe,$(BINDIR)/bacula-fd.exe)
+
+#
+# Rules
+#
+
+$(BINDIR)/bacula-fd.exe: $(FILED_OBJS) $(LIBS_BACULA)
+       $(call link_winapp,$(FILED_LIBS))
+
+$(OBJDIR)/winres.res: ../libwin32/winres.rc
+       @echo "Compiling $@"
+       $(call checkdir,$@)
+       $(ECHO_CMD)$(WINDRES) $(INCLUDE_ICONS) -O coff $< -o $@
+
+include ../Makefile.rules
diff --git a/bacula/src/win32/filed/baculafd.vcproj b/bacula/src/win32/filed/baculafd.vcproj
new file mode 100644 (file)
index 0000000..5c6c820
--- /dev/null
@@ -0,0 +1,602 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="baculafd"
+       ProjectGUID="{6A435DBB-4D3D-4DAE-8CB3-E0AF169A240B}"
+       RootNamespace="baculafd"
+       Keyword="MFCProj"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+               <ToolFile
+                       RelativePath="..\bacula.rules"
+               />
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory=".\Release"
+                       ConfigurationType="1"
+                       InheritedPropertySheets="..\..\..\..\..\..\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\UpgradeFromVC60.vsprops"
+                       UseOfMFC="0"
+                       UseOfATL="1"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="Generated Config Files"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               TypeLibraryName=".\Release/baculafd.tlb"
+                               HeaderFileName=""
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="3"
+                               InlineFunctionExpansion="2"
+                               EnableIntrinsicFunctions="true"
+                               AdditionalIncludeDirectories="../compat;../..;&quot;../../../../depkgs-win32/pthreads&quot;;&quot;../../../../depkgs-win32/zlib&quot;;&quot;../../../../depkgs-win32/gettext/include&quot;"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;HAVE_WIN32;_USE_32BIT_TIME_T;WIN32_VSS;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_DEPRECATE"
+                               StringPooling="true"
+                               RuntimeLibrary="2"
+                               EnableFunctionLevelLinking="true"
+                               PrecompiledHeaderFile=".\Release/baculafd.pch"
+                               AssemblerListingLocation=".\Release/"
+                               ObjectFile=".\Release/"
+                               ProgramDataBaseFileName=".\Release/"
+                               BrowseInformation="1"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"
+                               AdditionalIncludeDirectories=""
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="pthreadVCE.lib zlib.lib wsock32.lib atls.lib"
+                               OutputFile="$(OutDir)\bacula-fd.exe"
+                               LinkIncremental="0"
+                               SuppressStartupBanner="true"
+                               AdditionalLibraryDirectories="&quot;..\..\..\..\depkgs-win32\pthreads\release&quot;;&quot;..\..\..\..\depkgs-win32\zlib\release&quot;;&quot;..\..\..\..\depkgs-win32\gettext\lib&quot;;&quot;%VSSSDK_DIR%\lib\win2003\obj\i386&quot;"
+                               IgnoreDefaultLibraryNames=""
+                               DelayLoadDLLs="$(NOINHERIT)"
+                               GenerateDebugInformation="true"
+                               SubSystem="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                               SuppressStartupBanner="true"
+                               OutputFile=".\Release/baculafd.bsc"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory=".\Debug"
+                       ConfigurationType="1"
+                       InheritedPropertySheets="..\..\..\..\..\..\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\UpgradeFromVC60.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="Generated Config Files"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               TypeLibraryName=".\Debug/baculafd.tlb"
+                               HeaderFileName=""
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../compat,../..,../../../../depkgs-win32/pthreads,../../../../depkgs-win32/zlib,../../../../depkgs-win32/gettext/include"
+                               PreprocessorDefinitions="_DEBUG;_WINMAIN_;PTW32_BUILD;WIN32;_CONSOLE;HAVE_WIN32;_USE_32BIT_TIME_T;WIN32_VSS;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_DEPRECATE"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               PrecompiledHeaderFile=".\Debug/baculafd.pch"
+                               AssemblerListingLocation=".\Debug/"
+                               ObjectFile=".\Debug/"
+                               ProgramDataBaseFileName=".\Debug/"
+                               BrowseInformation="1"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="pthreadVCEd.lib zlibd.lib wsock32.lib atlsd.lib"
+                               OutputFile="$(OutDir)\bacula-fd.exe"
+                               LinkIncremental="0"
+                               SuppressStartupBanner="true"
+                               AdditionalLibraryDirectories="&quot;../../../../depkgs-win32/pthreads/debug&quot;;&quot;../../../../depkgs-win32/zlib/debug&quot;;&quot;../../../../depkgs-win32/gettext/lib&quot;;&quot;%VSSSDK_DIR%\lib\win2003\obj\i386&quot;"
+                               IgnoreDefaultLibraryNames=""
+                               GenerateDebugInformation="true"
+                               SubSystem="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                               SuppressStartupBanner="true"
+                               OutputFile=".\Debug/baculafd.bsc"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+                       >
+                       <File
+                               RelativePath="..\..\filed\acl.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\authenticate.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\backup.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\estimate.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\filed.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\filed_conf.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\heartbeat.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\job.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\pythonfd.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\restore.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\status.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\verify.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\verify_vol.c"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath=".\vss.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\vss_W2K3.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\vss_XP.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\winabout.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\winevents.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\winmain.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\winservice.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\winstat.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\wintray.cpp"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl"
+                       >
+                       <File
+                               RelativePath="..\..\filed\acl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\filed.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\filed_conf.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\filed\protos.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\resource.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\vss.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\compat\winconfig.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+                       >
+                       <File
+                               RelativePath="..\libwin32\bacula.bmp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\bacula.ico"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\error.ico"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\idle.ico"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\running.ico"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\saving.ico"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\warn.ico"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\libwin32\winres.rc"
+                               >
+                       </File>
+               </Filter>
+               <File
+                       RelativePath="..\..\filed\bacula-fd.conf.in"
+                       >
+               </File>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/bacula/src/win32/filed/vss.cpp b/bacula/src/win32/filed/vss.cpp
new file mode 100644 (file)
index 0000000..b3d1fa7
--- /dev/null
@@ -0,0 +1,215 @@
+
+// vss.cpp -- Interface to Volume Shadow Copies (VSS)
+//
+// Copyright transferred from MATRIX-Computer GmbH to
+//   Kern Sibbald by express permission.
+//
+//  Copyright (C) 2005-2006 Kern Sibbald
+//
+//  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.
+//
+//  
+// 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 <objbase.h>
+
+#include "vss.h"
+
+VSSClient *g_pVSSClient;
+
+void 
+VSSCleanup()
+{
+   if (g_pVSSClient)
+      delete (g_pVSSClient);
+}
+
+void
+VSSInit()
+{
+   /* decide which vss class to initialize */
+   switch (g_MinorVersion) {
+      case 1: 
+         g_pVSSClient = new VSSClientXP();
+         atexit(VSSCleanup);
+         break;
+      case 2: 
+         g_pVSSClient = new VSSClient2003();
+         atexit(VSSCleanup);
+         break;
+   }
+}
+
+BOOL
+VSSPathConvert(const char *szFilePath, char *szShadowPath, int nBuflen)
+{
+   return g_pVSSClient->GetShadowPath(szFilePath, szShadowPath, nBuflen);
+}
+
+BOOL
+VSSPathConvertW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen)
+{
+   return g_pVSSClient->GetShadowPathW(szFilePath, szShadowPath, nBuflen);
+}
+
+// Constructor
+VSSClient::VSSClient()
+{
+    m_bCoInitializeCalled = false;
+    m_bCoInitializeSecurityCalled = false;
+    m_dwContext = 0; // VSS_CTX_BACKUP;
+    m_bDuringRestore = false;
+    m_bBackupIsInitialized = false;
+    m_pVssObject = NULL;
+    m_pAlistWriterState = New (alist(10, not_owned_by_alist));
+    m_pAlistWriterInfoText = New (alist(10, owned_by_alist));
+    m_uidCurrentSnapshotSet = GUID_NULL;
+    memset(m_wszUniqueVolumeName, 0, sizeof(m_wszUniqueVolumeName));
+    memset(m_szShadowCopyName, 0, sizeof(m_szShadowCopyName));
+}
+
+// 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 (alist*) m_pAlistWriterState;
+   delete (alist*) m_pAlistWriterInfoText;
+
+   // Call CoUninitialize if the CoInitialize was performed successfully
+   if (m_bCoInitializeCalled)
+      CoUninitialize();
+}
+
+BOOL VSSClient::InitializeForBackup()
+{
+    //return Initialize (VSS_CTX_BACKUP);
+   return Initialize(0);
+}
+
+
+
+
+BOOL VSSClient::GetShadowPath(const char *szFilePath, char *szShadowPath, int nBuflen)
+{
+   if (!m_bBackupIsInitialized)
+      return FALSE;
+
+   /* check for valid pathname */
+   BOOL bIsValidName;
+   
+   bIsValidName = strlen(szFilePath) > 3;
+   if (bIsValidName)
+      bIsValidName &= isalpha (szFilePath[0]) &&
+                      szFilePath[1]==':' && 
+                      szFilePath[2] == '\\';
+
+   if (bIsValidName) {
+      int nDriveIndex = toupper(szFilePath[0])-'A';
+      if (m_szShadowCopyName[nDriveIndex][0] != 0) {
+
+         if (WideCharToMultiByte(CP_UTF8,0,m_szShadowCopyName[nDriveIndex],-1,szShadowPath,nBuflen-1,NULL,NULL)) {
+            nBuflen -= (int)strlen(szShadowPath);
+            strncat(szShadowPath, szFilePath+2, nBuflen);
+            return TRUE;
+         }
+      }
+   }
+   
+   strncpy(szShadowPath,  szFilePath, nBuflen);
+   errno = EINVAL;
+   return FALSE;   
+}
+
+BOOL VSSClient::GetShadowPathW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen)
+{
+   if (!m_bBackupIsInitialized)
+      return FALSE;
+
+   /* check for valid pathname */
+   BOOL bIsValidName;
+   
+   bIsValidName = wcslen(szFilePath) > 3;
+   if (bIsValidName)
+      bIsValidName &= iswalpha (szFilePath[0]) &&
+                      szFilePath[1]==':' && 
+                      szFilePath[2] == '\\';
+
+   if (bIsValidName) {
+      int nDriveIndex = towupper(szFilePath[0])-'A';
+      if (m_szShadowCopyName[nDriveIndex][0] != 0) {
+         wcsncpy(szShadowPath, m_szShadowCopyName[nDriveIndex], nBuflen);
+         nBuflen -= (int)wcslen(m_szShadowCopyName[nDriveIndex]);
+         wcsncat(szShadowPath, szFilePath+2, nBuflen);
+         return TRUE;
+      }
+   }
+   
+   wcsncpy(szShadowPath,  szFilePath, nBuflen);
+   errno = EINVAL;
+   return FALSE;   
+}
+
+
+const size_t VSSClient::GetWriterCount()
+{
+   alist* pV = (alist*) m_pAlistWriterInfoText;
+   return pV->size();
+}
+
+const char* VSSClient::GetWriterInfo(int nIndex)
+{
+   alist* pV = (alist*) m_pAlistWriterInfoText;
+   return (char*) pV->get(nIndex);
+}
+
+
+const int VSSClient::GetWriterState(int nIndex)
+{
+   alist* pV = (alist*) m_pAlistWriterState;   
+   return (int) pV->get(nIndex);
+}
+
+void VSSClient::AppendWriterInfo(int nState, const char* pszInfo)
+{
+   alist* pT = (alist*) m_pAlistWriterInfoText;
+   alist* pS = (alist*) m_pAlistWriterState;
+
+   pT->push (bstrdup(pszInfo));
+   pS->push ((void*) nState);   
+}
+
+void VSSClient::DestroyWriterInfo()
+{
+   alist* pT = (alist*) m_pAlistWriterInfoText;
+   alist* pS = (alist*) m_pAlistWriterState;
+
+   while (!pT->empty())
+      free (pT->pop());
+
+   while (!pS->empty())
+      pS->pop();      
+}
+
+#endif
diff --git a/bacula/src/win32/filed/vss.h b/bacula/src/win32/filed/vss.h
new file mode 100644 (file)
index 0000000..d8a8a0b
--- /dev/null
@@ -0,0 +1,120 @@
+/*                               -*- Mode: C -*-
+ * vss.h --
+ */
+//
+// Copyright transferred from MATRIX-Computer GmbH to
+//   Kern Sibbald by express permission.
+//
+//  Copyright (C) 2005-2006 Kern Sibbald
+//
+//  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.
+//
+
+/*
+ *
+ * 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
+
+// some forward declarations
+struct IVssAsync;
+
+class VSSClient
+{
+public:
+    VSSClient();
+    virtual ~VSSClient();
+
+    // Backup Process
+    BOOL InitializeForBackup();
+    virtual BOOL CreateSnapshots(char* szDriveLetters) = 0;
+    virtual BOOL CloseBackup() = 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; };
+         
+private:
+    virtual BOOL Initialize(DWORD dwContext, BOOL bDuringRestore = FALSE) = 0;
+    virtual BOOL WaitAndCheckForAsyncOperation(IVssAsync*  pAsync) = 0;
+    virtual void QuerySnapshotSet(GUID snapshotSetID) = 0;
+
+protected:
+    HMODULE                         m_hLib;
+
+    BOOL                            m_bCoInitializeCalled;
+    BOOL                            m_bCoInitializeSecurityCalled;
+    DWORD                           m_dwContext;
+
+    IUnknown*                       m_pVssObject;
+    GUID                            m_uidCurrentSnapshotSet;
+    // TRUE if we are during restore
+    BOOL                            m_bDuringRestore;
+    BOOL                            m_bBackupIsInitialized;
+
+    // drive A will be stored on position 0,Z on pos. 25
+    wchar_t                           m_wszUniqueVolumeName[26][MAX_PATH]; // approx. 7 KB
+    wchar_t                           m_szShadowCopyName[26][MAX_PATH]; // approx. 7 KB
+    
+    void*                           m_pAlistWriterState;
+    void*                           m_pAlistWriterInfoText;
+};
+
+class VSSClientXP:public VSSClient
+{
+public:
+   VSSClientXP();
+   virtual ~VSSClientXP();
+   virtual BOOL CreateSnapshots(char* szDriveLetters);
+   virtual BOOL CloseBackup();
+   virtual const char* GetDriverName() { return "VSS WinXP"; };
+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(char* szDriveLetters);
+   virtual BOOL CloseBackup();   
+   virtual const char* GetDriverName() { return "VSS Win 2003"; };
+private:
+   virtual BOOL Initialize(DWORD dwContext, BOOL bDuringRestore);
+   virtual BOOL WaitAndCheckForAsyncOperation(IVssAsync*  pAsync);
+   virtual void QuerySnapshotSet(GUID snapshotSetID);
+   BOOL CheckWriterStatus();
+};
+
+extern VSSClient *g_pVSSClient;
+
+#endif /* WIN32_VSS */
+
+#endif /* __VSS_H_ */
diff --git a/bacula/src/win32/filed/vss_W2K3.cpp b/bacula/src/win32/filed/vss_W2K3.cpp
new file mode 100644 (file)
index 0000000..68914d0
--- /dev/null
@@ -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 (file)
index 0000000..2087129
--- /dev/null
@@ -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 (file)
index 0000000..a61830a
--- /dev/null
@@ -0,0 +1,633 @@
+//                              -*- Mode: C++ -*-
+// vss.cpp -- Interface to Volume Shadow Copies (VSS)
+//
+// Copyright transferred from MATRIX-Computer GmbH to
+//   Kern Sibbald by express permission.
+//
+//  Copyright (C) 2005-2006 Kern Sibbald
+//
+//  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.
+//
+//
+// Author          : Thorsten Engel
+// Created On      : Fri May 06 21:44:00 2005
+
+
+#ifdef WIN32_VSS
+
+#include <bacula.h>
+
+#undef setlocale
+
+// STL includes
+#include <vector>
+#include <algorithm>
+#include <string>
+#include <sstream>
+#include <fstream>
+using namespace std;
+
+#include "ms_atl.h"
+#include <objbase.h>
+
+#if !defined(ENABLE_NLS)
+#define setlocale(p, d)
+#endif
+
+#ifdef HAVE_STRSAFE_H
+// Used for safe string manipulation
+#include <strsafe.h>
+#endif
+
+BOOL VSSPathConvert(const char *szFilePath, char *szShadowPath, int nBuflen);
+BOOL VSSPathConvertW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen);
+
+#ifdef HAVE_MINGW
+class IXMLDOMDocument;
+#endif
+
+#ifdef B_VSS_XP
+   #pragma message("compile VSS for Windows XP")   
+   #define VSSClientGeneric VSSClientXP
+   
+   #include "inc/WinXP/vss.h"
+   #include "inc/WinXP/vswriter.h"
+   #include "inc/WinXP/vsbackup.h"
+   
+   /* In VSSAPI.DLL */
+   typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **);
+   typedef void (APIENTRY* t_VssFreeSnapshotProperties)(IN VSS_SNAPSHOT_PROP*);
+   
+   static t_CreateVssBackupComponents p_CreateVssBackupComponents = NULL;
+   static t_VssFreeSnapshotProperties p_VssFreeSnapshotProperties = NULL;
+
+   #define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z"
+#endif
+
+#ifdef B_VSS_W2K3
+   #pragma message("compile VSS for Windows 2003")
+   #define VSSClientGeneric VSSClient2003
+   
+   #include "inc/Win2003/vss.h"
+   #include "inc/Win2003/vswriter.h"
+   #include "inc/Win2003/vsbackup.h"
+   
+   /* In VSSAPI.DLL */
+   typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **);
+   typedef void (APIENTRY* t_VssFreeSnapshotProperties)(IN VSS_SNAPSHOT_PROP*);
+   
+   static t_CreateVssBackupComponents p_CreateVssBackupComponents = NULL;
+   static t_VssFreeSnapshotProperties p_VssFreeSnapshotProperties = NULL;
+
+   #define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z"
+#endif
+
+#include "vss.h"
+
+/*  
+ *
+ * some helper functions 
+ *
+ *
+ */
+
+// Append a backslash to the current string 
+inline 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
+inline wstring GetUniqueVolumeNameForPath(wstring path)
+{
+    if (path.length() <= 0) {
+       return L"";
+    }
+
+    // Add the backslash termination, if needed
+    path = AppendBackslash(path);
+
+    // Get the root path of the volume
+    wchar_t volumeRootPath[MAX_PATH];
+    wchar_t volumeName[MAX_PATH];
+    wchar_t volumeUniqueName[MAX_PATH];
+
+    if (!p_GetVolumePathNameW || !p_GetVolumePathNameW((LPCWSTR)path.c_str(), volumeRootPath, MAX_PATH))
+      return L"";
+    
+    // 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))
+       return L"";
+    
+    // Get the unique volume name    
+    if (!p_GetVolumeNameForVolumeMountPointW(volumeName, volumeUniqueName, MAX_PATH))
+       return L"";
+    
+    return volumeUniqueName;
+}
+
+
+// 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()
+{
+   m_hLib = LoadLibraryA("VSSAPI.DLL");
+   if (m_hLib) {      
+      p_CreateVssBackupComponents = (t_CreateVssBackupComponents)
+         GetProcAddress(m_hLib, VSSVBACK_ENTRY);
+                                 
+      p_VssFreeSnapshotProperties = (t_VssFreeSnapshotProperties)
+          GetProcAddress(m_hLib, "VssFreeSnapshotProperties");      
+   } 
+}
+
+
+
+// Destructor
+VSSClientGeneric::~VSSClientGeneric()
+{
+   if (m_hLib)
+      FreeLibrary(m_hLib);
+}
+
+// Initialize the COM infrastructure and the internal pointers
+BOOL VSSClientGeneric::Initialize(DWORD dwContext, BOOL bDuringRestore)
+{
+   if (!(p_CreateVssBackupComponents && p_VssFreeSnapshotProperties)) {
+      errno = ENOSYS;
+      return FALSE;
+   }
+
+   HRESULT hr;
+   // Initialize COM 
+   if (!m_bCoInitializeCalled)  {
+      if (FAILED(CoInitialize(NULL))) {
+         errno = b_errno_win32;
+         return FALSE;
+      }
+      m_bCoInitializeCalled = true;
+   }
+
+   // Initialize COM security
+   if (!m_bCoInitializeSecurityCalled) {
+      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)) {         
+         errno = b_errno_win32;
+         return FALSE;
+      }
+      m_bCoInitializeSecurityCalled = true;      
+   }
+   
+   // Release the IVssBackupComponents interface 
+   if (m_pVssObject) {
+      m_pVssObject->Release();
+      m_pVssObject = NULL;
+   }
+
+   // Create the internal backup components object
+   hr = p_CreateVssBackupComponents((IVssBackupComponents**) &m_pVssObject);
+   if (FAILED(hr)) {      
+      errno = b_errno_win32;
+      return FALSE;
+   }
+
+#ifdef B_VSS_W2K3
+   if (dwContext != VSS_CTX_BACKUP) {
+      hr = ((IVssBackupComponents*) m_pVssObject)->SetContext(dwContext);
+      if (FAILED(hr)) {
+         errno = b_errno_win32;
+         return FALSE;
+      }
+   }
+#endif
+
+   if (!bDuringRestore) {
+       // 1. InitializeForBackup
+       hr = ((IVssBackupComponents*) m_pVssObject)->InitializeForBackup();
+       if (FAILED(hr)) {
+           errno = b_errno_win32; 
+           return FALSE;
+       }
+       // 2. SetBackupState
+       hr = ((IVssBackupComponents*) m_pVssObject)->SetBackupState(true, true, VSS_BT_FULL, false);
+       if (FAILED(hr)) {
+           errno = b_errno_win32;
+           return FALSE;
+       }
+       
+       CComPtr<IVssAsync>  pAsync1;       
+       // 3. GatherWriterMetaData
+       hr = ((IVssBackupComponents*) m_pVssObject)->GatherWriterMetadata(&pAsync1.p);
+       if (FAILED(hr)) {
+           errno = b_errno_win32;
+           return FALSE;
+       }
+        // Waits for the async operation to finish and checks the result
+       WaitAndCheckForAsyncOperation(pAsync1.p);
+   }
+
+
+   // 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 = 600; // 10 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;
+
+   
+#ifdef DEBUG
+   // Check if the async operation succeeded...
+   if(hrReturned != VSS_S_ASYNC_FINISHED) {   
+      wchar_t *pwszBuffer = NULL;
+      DWORD dwRet = ::FormatMessageW(
+                        FORMAT_MESSAGE_ALLOCATE_BUFFER 
+                        | FORMAT_MESSAGE_FROM_SYSTEM 
+                        | FORMAT_MESSAGE_IGNORE_INSERTS,
+                        NULL, hrReturned, 
+                        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
+                        (LPWSTR)&pwszBuffer, 0, NULL);
+
+      if (dwRet != 0) {         
+         LocalFree(pwszBuffer);         
+      }      
+      errno = b_errno_win32;
+   }
+#endif
+
+   return FALSE;
+}
+
+BOOL VSSClientGeneric::CreateSnapshots(char* szDriveLetters)
+{
+   /* 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) {
+      errno = ENOSYS;
+      return FALSE;  
+   }
+
+   m_uidCurrentSnapshotSet = GUID_NULL;
+
+   IVssBackupComponents *pVss = (IVssBackupComponents*)m_pVssObject;
+
+   /* startSnapshotSet */
+
+   pVss->StartSnapshotSet(&m_uidCurrentSnapshotSet);
+
+   /* AddToSnapshotSet */
+
+   wchar_t szDrive[3];
+   szDrive[1] = ':';
+   szDrive[2] = 0;
+
+   wstring volume;
+
+   CComPtr<IVssAsync>  pAsync1;
+   CComPtr<IVssAsync>  pAsync2;   
+   VSS_ID pid;
+
+   for (size_t i=0; i < strlen (szDriveLetters); i++) {
+      szDrive[0] = szDriveLetters[i];
+      volume = GetUniqueVolumeNameForPath(szDrive);
+      // store uniquevolumname
+      if (SUCCEEDED(pVss->AddToSnapshotSet((LPWSTR)volume.c_str(), GUID_NULL, &pid)))
+         wcsncpy (m_wszUniqueVolumeName[szDriveLetters[i]-'A'], (LPWSTR) volume.c_str(), MAX_PATH);
+      else
+      {            
+         szDriveLetters[i] = tolower (szDriveLetters[i]);               
+      }
+   }
+
+   /* PrepareForBackup */
+   if (FAILED(pVss->PrepareForBackup(&pAsync1.p))) {      
+      return FALSE;   
+   }
+   
+   // Waits for the async operation to finish and checks the result
+   WaitAndCheckForAsyncOperation(pAsync1.p);
+
+   /* get latest info about writer status */
+   if (!CheckWriterStatus()) {
+      return FALSE;
+   }
+
+   /* DoSnapShotSet */   
+   if (FAILED(pVss->DoSnapshotSet(&pAsync2.p))) {      
+      return FALSE;   
+   }
+
+   // Waits for the async operation to finish and checks the result
+   WaitAndCheckForAsyncOperation(pAsync2.p); 
+   
+   /* query snapshot info */   
+   QuerySnapshotSet(m_uidCurrentSnapshotSet);
+
+   SetVSSPathConvert(VSSPathConvert, VSSPathConvertW);
+
+   m_bBackupIsInitialized = true;
+
+   return TRUE;
+}
+
+BOOL VSSClientGeneric::CloseBackup()
+{
+   BOOL bRet = FALSE;
+   if (!m_pVssObject)
+      errno = ENOSYS;
+   else {
+      IVssBackupComponents* pVss = (IVssBackupComponents*) m_pVssObject;
+      CComPtr<IVssAsync>  pAsync;
+
+      SetVSSPathConvert(NULL, NULL);
+
+      m_bBackupIsInitialized = false;
+
+      if (SUCCEEDED(pVss->BackupComplete(&pAsync.p))) {
+         // Waits for the async operation to finish and checks the result
+         WaitAndCheckForAsyncOperation(pAsync.p);
+         bRet = TRUE;     
+      } else {
+         errno = b_errno_win32;
+         pVss->AbortBackup();
+      }
+
+      /* get latest info about writer status */
+      CheckWriterStatus();
+
+      if (m_uidCurrentSnapshotSet != GUID_NULL) {
+         VSS_ID idNonDeletedSnapshotID = GUID_NULL;
+         LONG lSnapshots;
+
+         pVss->DeleteSnapshots(
+            m_uidCurrentSnapshotSet, 
+            VSS_OBJECT_SNAPSHOT_SET,
+            FALSE,
+            &lSnapshots,
+            &idNonDeletedSnapshotID);
+
+         m_uidCurrentSnapshotSet = GUID_NULL;
+      }
+
+      pVss->Release();
+      m_pVssObject = NULL;
+   }
+
+   // Call CoUninitialize if the CoInitialize was performed sucesfully
+   if (m_bCoInitializeCalled) {
+      CoUninitialize();
+      m_bCoInitializeCalled = false;
+   }
+
+   return bRet;
+}
+
+// Query all the shadow copies in the given set
+void VSSClientGeneric::QuerySnapshotSet(GUID snapshotSetID)
+{   
+   if (!(p_CreateVssBackupComponents && p_VssFreeSnapshotProperties)) {
+      errno = ENOSYS;
+      return;
+   }
+
+   memset (m_szShadowCopyName,0,sizeof (m_szShadowCopyName));
+   
+   if (snapshotSetID == GUID_NULL || m_pVssObject == NULL) {
+      errno = ENOSYS;
+      return;
+   }
+
+   IVssBackupComponents* pVss = (IVssBackupComponents*) m_pVssObject;
+               
+   // Get list all shadow copies. 
+   CComPtr<IVssEnumObject> pIEnumSnapshots;
+   HRESULT hr = pVss->Query( GUID_NULL, 
+         VSS_OBJECT_NONE, 
+         VSS_OBJECT_SNAPSHOT, 
+         (IVssEnumObject**)(&pIEnumSnapshots) );    
+
+   // If there are no shadow copies, just return
+   if (FAILED(hr)) {
+      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;
+
+      // Print the shadow copy (if not filtered out)
+      if (Snap.m_SnapshotSetId == snapshotSetID)  {
+         for (char ch='A'-'A';ch<='Z'-'A';ch++) {
+            if (wcscmp(Snap.m_pwszOriginalVolumeName, m_wszUniqueVolumeName[ch]) == 0) {       
+               wcsncpy (m_szShadowCopyName[ch],Snap.m_pwszSnapshotDeviceObject, MAX_PATH-1);               
+               break;
+            }
+         }
+      }
+      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* pVss = (IVssBackupComponents*) m_pVssObject;
+    DestroyWriterInfo();
+
+    // Gather writer status to detect potential errors
+    CComPtr<IVssAsync>  pAsync;
+    
+    HRESULT hr = pVss->GatherWriterStatus(&pAsync.p);
+    if (FAILED(hr)) {
+       errno = b_errno_win32;
+       return FALSE;
+    } 
+
+    // Waits for the async operation to finish and checks the result
+    WaitAndCheckForAsyncOperation(pAsync.p);
+      
+    unsigned cWriters = 0;
+
+    hr = pVss->GetWriterStatusCount(&cWriters);
+    if (FAILED(hr)) {
+       errno = b_errno_win32;
+       return FALSE;
+    }
+
+    int nState;
+    
+    // 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 = pVss->GetWriterStatus(iWriter,
+                             &idInstance,
+                             &idWriter,
+                             &bstrWriterName,
+                             &eWriterStatus,
+                             &hrWriterFailure);
+        if (FAILED(hr)) {
+            /* unknown */            
+            nState = 0;
+        }
+        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:
+    #ifdef B_VSS_W2K3
+            case VSS_WS_FAILED_AT_BACKUPSHUTDOWN:
+    #endif
+                /* failed */                
+                nState = -1;
+                break;
+
+            default:
+                /* ok */
+                nState = 1;
+            }
+        }
+        /* store text info */
+        char str[1000];
+        char szBuf[200];        
+        strcpy(str, "\"");
+        wchar_2_UTF8(szBuf, bstrWriterName.p, sizeof(szBuf));
+        strcat(str, szBuf);
+        strcat(str, "\", State: 0x");
+        itoa(eWriterStatus, szBuf, sizeof(szBuf));
+        strcat(str, szBuf);
+        strcat(str, " (");
+        wchar_2_UTF8(szBuf, GetStringFromWriterStatus(eWriterStatus), sizeof(szBuf));
+        strcat(str, szBuf);
+        strcat(str, ")");
+
+        AppendWriterInfo(nState, (const char *)str);     
+    }
+
+    hr = pVss->FreeWriterStatus();
+
+    if (FAILED(hr)) {
+        errno = b_errno_win32;
+        return FALSE;
+    } 
+
+    errno = 0;
+    return TRUE;
+}
+
+#endif /* WIN32_VSS */
diff --git a/bacula/src/win32/filed/winmain.cpp b/bacula/src/win32/filed/winmain.cpp
new file mode 100644 (file)
index 0000000..36bc4b7
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+   Copyright (C) 2000-2006 Kern Sibbald
+
+   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.
+
+   This file is patterned after the VNC Win32 code by ATT
+  
+*/
+
+#include <unistd.h>
+#include <ctype.h>
+
+#include "bacula.h"
+#include "winbacula.h"
+#include "wintray.h"
+#include "winservice.h"
+#include <signal.h>
+#include <pthread.h>
+
+extern int BaculaMain(int argc, char *argv[]);
+extern void terminate_filed(int sig);
+extern DWORD g_error;
+extern BOOL ReportStatus(DWORD state, DWORD exitcode, DWORD waithint);
+extern void d_msg(const char *, int, int, const char *, ...);
+extern void VSSInit();
+
+/* Globals */
+HINSTANCE       hAppInstance;
+const char      *szAppName = "Bacula";
+DWORD           mainthreadId;
+bool            silent = false;
+
+/* Imported variables */
+extern DWORD    g_servicethread;
+extern DWORD    g_platform_id;
+
+#define MAX_COMMAND_ARGS 100
+static char *command_args[MAX_COMMAND_ARGS] = {"bacula-fd", NULL};
+static int num_command_args = 1;
+static pid_t main_pid;
+static pthread_t main_tid;
+
+/*
+ * WinMain parses the command line and either calls the main App
+ * routine or, under NT, the main service routine.
+ */
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
+                   PSTR CmdLine, int iCmdShow)
+{
+   char *szCmdLine = CmdLine;
+   char *wordPtr, *tempPtr;
+   int i, quote;
+
+   /* Save the application instance and main thread id */
+   hAppInstance = hInstance;
+   mainthreadId = GetCurrentThreadId();
+
+   main_pid = getpid();
+   main_tid = pthread_self();
+
+   /*
+    * 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 = szCmdLine;
+   while (*wordPtr && *wordPtr != ' ')
+      wordPtr++;
+   if (wordPtr > szCmdLine)      /* backup to char before space */
+      wordPtr--;
+   /* if first character is not a quote and last is, junk it */
+   if (*szCmdLine != '"' && *wordPtr == '"') {
+      szCmdLine = wordPtr + 1;
+   }
+// MessageBox(NULL, szCmdLine, "Cmdline", MB_OK);
+
+   /* Build Unix style argc *argv[] */      
+
+   /* Don't NULL command_args[0] !!! */
+   for (i=1;i<MAX_COMMAND_ARGS;i++)
+      command_args[i] = NULL;
+
+   wordPtr = szCmdLine;
+   quote = 0;
+   while  (*wordPtr && (*wordPtr == ' ' || *wordPtr == '\t'))
+      wordPtr++;
+   if (*wordPtr == '\"') {
+      quote = 1;
+      wordPtr++;
+   } else if (*wordPtr == '/') {
+      /* Skip Windows options */
+      while (*wordPtr && (*wordPtr != ' ' && *wordPtr != '\t'))
+         wordPtr++;
+      while  (*wordPtr && (*wordPtr == ' ' || *wordPtr == '\t'))
+         wordPtr++;
+   }
+   if (*wordPtr) {
+      while (*wordPtr && num_command_args < MAX_COMMAND_ARGS) {
+         tempPtr = wordPtr;
+         if (quote) {
+            while (*tempPtr && *tempPtr != '\"')
+            tempPtr++;
+            quote = 0;
+         } else {
+            while (*tempPtr && *tempPtr != ' ')
+            tempPtr++;
+         }
+         if (*tempPtr)
+            *(tempPtr++) = '\0';
+         command_args[num_command_args++] = wordPtr;
+         wordPtr = tempPtr;
+         while (*wordPtr && (*wordPtr == ' ' || *wordPtr == '\t'))
+            wordPtr++;
+         if (*wordPtr == '\"') {
+            quote = 1;
+            wordPtr++;
+         }
+      }
+   }
+
+   /*
+    * Now process Windows command line options
+    *   as defined by ATT
+    *
+    * Make the command-line lowercase and parse it
+    */
+   for (i = 0; i < (int)strlen(szCmdLine); i++) {
+      szCmdLine[i] = tolower(szCmdLine[i]);
+   }
+
+   bool argfound = false;
+   for (i = 0; i < (int)strlen(szCmdLine); i++) {
+      if (szCmdLine[i] <= ' ') {
+         continue;
+      }
+
+      if (szCmdLine[i] == '-') {
+         while (szCmdLine[i] && szCmdLine[i] != ' ') {
+            i++;
+         }
+         continue;
+      }
+
+      argfound = true;
+
+      /* Now check for command-line arguments */
+
+      /* /silent install quietly -- no prompts */
+      if (strncmp(&szCmdLine[i], "/silent", strlen("/silent")) == 0) {
+         silent = true;
+         i += strlen("/silent");
+      }
+
+      /* /service start service */
+      if (strncmp(&szCmdLine[i], BaculaRunService, strlen(BaculaRunService)) == 0) {
+         /* Run Bacula as a service */
+         return bacService::BaculaServiceMain();
+      }
+      /* /run  (this is the default if no command line arguments) */
+      if (strncmp(&szCmdLine[i], BaculaRunAsUserApp, strlen(BaculaRunAsUserApp)) == 0) {
+         /* Bacula is being run as a user-level program */
+         return BaculaAppMain();
+      }
+      /* /install */
+      if (strncmp(&szCmdLine[i], BaculaInstallService, strlen(BaculaInstallService)) == 0) {
+         /* Install Bacula as a service */
+         bacService::InstallService();
+         i += strlen(BaculaInstallService);
+         continue;
+      }
+      /* /remove */
+      if (strncmp(&szCmdLine[i], BaculaRemoveService, strlen(BaculaRemoveService)) == 0) {
+         /* Remove the Bacula service */
+         bacService::RemoveService();
+         i += strlen(BaculaRemoveService);
+         continue;
+      }
+
+      /* /about */
+      if (strncmp(&szCmdLine[i], BaculaShowAbout, strlen(BaculaShowAbout)) == 0) {
+         /* Show Bacula's about box */
+         bacService::ShowAboutBox();
+         i += strlen(BaculaShowAbout);
+         continue;
+      }
+
+      /* /status */
+      if (strncmp(&szCmdLine[i], BaculaShowStatus, strlen(BaculaShowStatus)) == 0) {
+         /* Show Bacula's status box */                             
+         bacService::ShowStatus();
+         i += strlen(BaculaShowStatus);
+         continue;
+      }
+
+      /* /kill */
+      if (strncmp(&szCmdLine[i], BaculaKillRunningCopy, strlen(BaculaKillRunningCopy)) == 0) {
+         /* Kill running copy of Bacula */
+         bacService::KillRunningCopy();
+         i += strlen(BaculaKillRunningCopy);
+         continue;
+      }
+
+      /* /help */
+      if (strncmp(&szCmdLine[i], BaculaShowHelp, strlen(BaculaShowHelp)) == 0) {
+         MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK|MB_ICONINFORMATION);
+         i += strlen(BaculaShowHelp);
+         continue;
+      }
+      
+      MessageBox(NULL, szCmdLine, _("Bad Command Line Options"), MB_OK);
+
+      /* Show the usage dialog */
+      MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK | MB_ICONINFORMATION);
+      break;
+   }
+
+   /* If no arguments were given then just run */
+   if (!argfound) {
+      BaculaAppMain();
+   }
+   return 0;
+}
+
+
+/*
+ * Called as a thread from BaculaAppMain()
+ * Here we handle the Windows messages
+ */
+//DWORD WINAPI Main_Msg_Loop(LPVOID lpwThreadParam)
+void *Main_Msg_Loop(LPVOID lpwThreadParam) 
+{
+   DWORD old_servicethread = g_servicethread;
+
+
+   pthread_detach(pthread_self());
+
+   /* Since we are the only thread with a message loop
+    * mark ourselves as the service thread so that
+    * we can receive all the window events.
+    */
+   g_servicethread = GetCurrentThreadId();
+
+   /* Create tray icon & menu if we're running as an app */
+   bacMenu *menu = new bacMenu();
+   if (menu == NULL) {
+//    log_error_message("Could not create sys tray menu");
+      PostQuitMessage(0);
+   }
+
+
+   /* Now enter the Windows message handling loop until told to quit! */
+   MSG msg;
+   while (GetMessage(&msg, NULL, 0,0) ) {
+      TranslateMessage(&msg);
+      DispatchMessage(&msg);
+   }
+
+   if (menu != NULL) {
+      delete menu;
+   }
+
+   if (old_servicethread != 0) { /* started as NT service */
+      /* Mark that we're no longer running */
+      g_servicethread = 0;
+
+      /* Tell the service manager that we've stopped. */
+      ReportStatus(SERVICE_STOPPED, g_error, 0);
+   }  
+   /* Tell main program to go away */
+   terminate_filed(0);
+
+   /* Should not get here */
+   pthread_kill(main_tid, SIGTERM);   /* ask main thread to terminate */
+   sleep(1);
+   kill(main_pid, SIGTERM);           /* ask main thread to terminate */
+   _exit(0);
+}
+
+/*
+ * This is the main routine for Bacula when running as an application
+ * (under Windows 95 or Windows NT)
+ * Under NT, Bacula can also run as a service.  The BaculaServerMain routine,
+ * defined in the bacService header, is used instead when running as a service.
+ */
+int BaculaAppMain()
+{
+ /* DWORD dwThreadID; */
+   pthread_t tid;
+
+   InitWinAPIWrapper();
+   VSSInit();
+
+   WSA_Init();
+
+   /* Set this process to be the last application to be shut down. */
+   if (p_SetProcessShutdownParameters) {
+      p_SetProcessShutdownParameters(0x100, 0);
+   }
+
+   HWND hservwnd = FindWindow(MENU_CLASS_NAME, NULL);
+   if (hservwnd != NULL) {
+      /* We don't allow multiple instances! */
+      MessageBox(NULL, _("Another instance of Bacula is already running"), szAppName, MB_OK);
+      _exit(0);
+   }
+
+
+   /* Create a thread to handle the Windows messages */
+// (void)CreateThread(NULL, 0, Main_Msg_Loop, NULL, 0, &dwThreadID);
+   pthread_create(&tid, NULL,  Main_Msg_Loop, (void *)0);
+
+   /* Call the "real" Bacula */
+   BaculaMain(num_command_args, command_args);
+   PostQuitMessage(0);
+   WSACleanup();
+   _exit(0);
+}
diff --git a/bacula/src/win32/filed/winservice.cpp b/bacula/src/win32/filed/winservice.cpp
new file mode 100644 (file)
index 0000000..c4c3ac5
--- /dev/null
@@ -0,0 +1,763 @@
+//  Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
+//
+//  This file was part of the VNC system.
+//
+//  The VNC system 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.
+//
+// If the source code for the VNC system is not available from the place 
+// whence you received this file, check http://www.uk.research.att.com/vnc or contact
+// the authors on vnc@uk.research.att.com for information on obtaining it.
+//
+// This file has been adapted to the Win32 version of Bacula
+// by Kern E. Sibbald.  Many thanks to ATT and James Weatherall,
+// the original author, for providing an excellent template.
+//
+// Copyright (C) 2000-2006 Kern E. Sibbald
+//
+
+
+// winService
+
+// Implementation of service-oriented functionality of Bacula
+// I.e. command line options that contact a running version of
+// Bacula and ask it to do something (show about, show status,
+// show events, ...)
+
+
+#include "bacula.h"
+#include "winbacula.h"
+#include "winservice.h"
+#include "wintray.h"
+
+void set_service_description(SC_HANDLE hSCManager, SC_HANDLE hService,
+                             LPSTR lpDesc);
+
+// OS-SPECIFIC ROUTINES
+
+// Create an instance of the bacService class to cause the static fields to be
+// initialised properly
+
+bacService init;
+
+extern bool    silent;
+
+bacService::bacService()
+{
+   OSVERSIONINFO osversioninfo;
+   osversioninfo.dwOSVersionInfoSize = sizeof(osversioninfo);
+
+   // Get the current OS version
+   if (!GetVersionEx(&osversioninfo)) {
+      g_platform_id = 0;
+   } else {
+      g_platform_id = osversioninfo.dwPlatformId;
+   }
+}
+
+
+// IsWin95 - returns a BOOL indicating whether the current OS is Win95
+BOOL
+bacService::IsWin95()
+{
+   return (g_platform_id == VER_PLATFORM_WIN32_WINDOWS);
+}
+
+// IsWinNT - returns a bool indicating whether the current OS is WinNT
+BOOL
+bacService::IsWinNT()
+{
+   return (g_platform_id == VER_PLATFORM_WIN32_NT);
+}
+
+// Internal routine to find the  Bacula menu class window and
+// post a message to it!
+
+BOOL
+PostToBacula(UINT message, WPARAM wParam, LPARAM lParam)
+{
+  // Locate the hidden Bacula menu window
+  HWND hservwnd = FindWindow(MENU_CLASS_NAME, NULL);
+  if (hservwnd == NULL) {
+     return FALSE;
+  }
+
+  // Post the message to Bacula
+  PostMessage(hservwnd, message, wParam, lParam);
+  return TRUE;
+}
+
+
+// Static routine to show the Properties dialog for a currently-running
+// copy of Bacula, (usually a servicified version.)
+
+BOOL
+bacService::ShowProperties()
+{
+   return TRUE;
+}
+
+// Static routine to show the Default Properties dialog for a currently-running
+// copy of Bacula, (usually a servicified version.)
+
+BOOL
+bacService::ShowDefaultProperties()
+{
+   return TRUE;
+}
+
+// Static routine to show the About dialog for a currently-running
+// copy of Bacula, (usually a servicified version.)
+
+BOOL
+bacService::ShowAboutBox()
+{
+  // Post to the Bacula menu window
+  if (!PostToBacula(MENU_ABOUTBOX_SHOW, 0, 0)) {
+     MessageBox(NULL, _("No existing instance of Bacula could be contacted"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+     return FALSE;
+  }
+  return TRUE;
+}
+
+// Static routine to show the Status dialog for a currently-running
+// copy of Bacula, (usually a servicified version.)
+
+BOOL
+bacService::ShowStatus()
+{
+  // Post to the Bacula menu window
+  if (!PostToBacula(MENU_STATUS_SHOW, 0, 0)) {
+     MessageBox(NULL, _("No existing instance of Bacula could be contacted"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+     return FALSE;
+  }
+  return TRUE;
+}
+
+// SERVICE-MODE ROUTINES
+
+// Service-mode defines:
+
+// Executable name
+#define BAC_APPNAME            "baculafd"
+
+// Internal service name
+#define BAC_SERVICENAME        "Baculafd"
+
+// Displayed service name
+#define BAC_SERVICEDISPLAYNAME "Bacula File Server"
+
+// List other required serves 
+#define BAC_DEPENDENCIES __TEXT("tcpip\0afd\0") 
+
+
+// Internal service state
+SERVICE_STATUS          g_srvstatus;       // current status of the service
+SERVICE_STATUS_HANDLE   g_hstatus;
+DWORD                   g_error = 0;
+DWORD                   g_servicethread = 0;
+char*                   g_errortext[256];
+
+
+// Forward defines of internal service functions
+void WINAPI ServiceMain(DWORD argc, char **argv);
+DWORD WINAPI ServiceWorkThread(LPVOID lpwThreadParam);
+void ServiceStop();
+void WINAPI ServiceCtrl(DWORD ctrlcode);
+bool WINAPI CtrlHandler (DWORD ctrltype);
+BOOL ReportStatus(DWORD state, DWORD exitcode, DWORD waithint);
+
+// ROUTINE TO QUERY WHETHER THIS PROCESS IS RUNNING AS A SERVICE OR NOT
+
+BOOL    g_servicemode = FALSE;
+
+BOOL
+bacService::RunningAsService()
+{
+   return g_servicemode;
+}
+
+BOOL
+bacService::KillRunningCopy()
+{
+  while (PostToBacula(WM_CLOSE, 0, 0))
+      {  }
+  return TRUE;
+}
+
+// SERVICE MAIN ROUTINE
+int
+bacService::BaculaServiceMain()
+{
+   // Mark that we are a service
+   g_servicemode = TRUE;
+
+   // How to run as a service depends upon the OS being used
+   switch (g_platform_id) {
+
+   // Windows 95/98/Me
+   case VER_PLATFORM_WIN32_WINDOWS:
+      {
+      // Obtain a handle to the kernel library
+      HINSTANCE kerneldll = LoadLibrary("KERNEL32.DLL");
+      if (kerneldll == NULL) {
+         MessageBox(NULL, _("KERNEL32.DLL not found: Bacula service not started"), 
+             "Bacula Service", MB_OK);
+         break;
+      }
+
+      // And find the 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"),
+            "Bacula Service", MB_OK);
+         log_error_message(_("Registry service not found")); 
+         break;
+      }
+      
+      // Register this process with the OS as a service!
+      RegisterService(0, 1);
+
+      // Run the main program as a service
+      BaculaAppMain();
+
+      // Then remove the service from the system service table
+      RegisterService(0, 0);
+
+      // Free the kernel library
+      FreeLibrary(kerneldll);
+      break;
+      }
+
+
+   // Windows NT, Win2K, WinXP 
+   case VER_PLATFORM_WIN32_NT:
+      {
+      // Create a service entry table
+      SERVICE_TABLE_ENTRY dispatchTable[] = {
+         {BAC_SERVICENAME, (LPSERVICE_MAIN_FUNCTION)ServiceMain},
+         {NULL, NULL}
+      };
+
+      // Call the service control dispatcher with our entry table
+      if (!StartServiceCtrlDispatcher(dispatchTable)) {
+         log_error_message(_("StartServiceCtrlDispatcher failed."));
+      }
+      break;
+      } /* end case */
+   } /* end switch */
+   return 0;
+}
+
+// SERVICE MAIN ROUTINE - NT ONLY !!!
+// NT/Win2K/WinXP ONLY !!!
+void WINAPI ServiceMain(DWORD argc, char **argv)
+{
+    DWORD dwThreadID;
+
+    // Register the service control handler
+    g_hstatus = RegisterServiceCtrlHandler(BAC_SERVICENAME, ServiceCtrl);
+
+    if (g_hstatus == 0) {
+       log_error_message(_("RegisterServiceCtlHandler failed")); 
+       MessageBox(NULL, _("Contact Register Service Handler failure"),
+          "Bacula service", MB_OK);
+       return;
+    }
+
+     // Set up some standard service state values
+    g_srvstatus.dwServiceType = SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS;
+    g_srvstatus.dwServiceSpecificExitCode = 0;
+
+        // Give this status to the SCM
+    if (!ReportStatus(
+            SERVICE_START_PENDING,          // Service state
+            NO_ERROR,                       // Exit code type
+            45000)) {                       // Hint as to how long Bacula should have hung before you assume error
+
+        ReportStatus(SERVICE_STOPPED, g_error,  0);
+        log_error_message(_("ReportStatus STOPPED failed 1")); 
+        return;
+    }
+
+        // Now start the service for real
+    (void)CreateThread(NULL, 0, ServiceWorkThread, NULL, 0, &dwThreadID);
+    return;
+}
+
+// SERVICE START ROUTINE - thread that calls BaculaAppMain
+//   NT ONLY !!!!
+DWORD WINAPI ServiceWorkThread(LPVOID lpwThreadParam)
+{
+
+    // Save the current thread identifier
+    g_servicethread = GetCurrentThreadId();
+
+    // report the status to the service control manager.
+    //
+    if (!ReportStatus(
+          SERVICE_RUNNING,       // service state
+          NO_ERROR,              // exit code
+          0)) {                  // wait hint
+       MessageBox(NULL, _("Report Service failure"), "Bacula Service", MB_OK);
+       log_error_message("ReportStatus RUNNING failed"); 
+       return 0;
+    }
+
+    /* Call Bacula main code */
+    BaculaAppMain();
+
+    /* Mark that we're no longer running */
+    g_servicethread = 0;
+
+    /* Tell the service manager that we've stopped */
+    ReportStatus(SERVICE_STOPPED, g_error, 0);
+    return 0;
+}
+
+
+// SERVICE STOP ROUTINE - post a quit message to the relevant thread
+void ServiceStop()
+{
+   // Post a quit message to the main service thread
+   if (g_servicethread != 0) {
+      PostThreadMessage(g_servicethread, WM_QUIT, 0, 0);
+   }
+}
+
+// SERVICE INSTALL ROUTINE
+int
+bacService::InstallService()
+{
+   const int pathlength = 2048;
+   char path[pathlength];
+   char servicecmd[pathlength];
+   int len;
+
+   // Get the filename of this executable
+   if (GetModuleFileName(NULL, path, pathlength-(strlen(BaculaRunService)+2)) == 0) {
+      MessageBox(NULL, _("Unable to install Bacula service"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+      return 0;
+   }
+
+   // Append the service-start flag to the end of the path:
+   if ((int)strlen(path) + 20 + (int)strlen(BaculaRunService) < pathlength) {
+      sprintf(servicecmd, "\"%s\" %s -c \"%s\"", path, BaculaRunService, path);
+      len = strlen(servicecmd) - 1;
+      for ( ; len > 0; len--) {
+         if (servicecmd[len] == '\\') {
+            servicecmd[len] = 0;
+            break;
+         }
+         servicecmd[len] = 0;
+      }
+      strcat(servicecmd, "\\bacula-fd.conf");
+
+   } else {
+      log_error_message(_("Service command length too long")); 
+      MessageBox(NULL, _("Service command length too long. Service not registered."),
+          szAppName, MB_ICONEXCLAMATION | MB_OK);
+      return 0;
+   }
+
+   // How to add the Bacula service depends upon the OS
+   switch (g_platform_id) {
+
+   // Windows 95/98/Me
+   case VER_PLATFORM_WIN32_WINDOWS:
+      // Locate the RunService registry entry
+      HKEY runservices;
+      if (RegCreateKey(HKEY_LOCAL_MACHINE, 
+              "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices",
+              &runservices) != ERROR_SUCCESS) {
+         log_error_message(_("Cannot write System Registry")); 
+         MessageBox(NULL, _("The System Registry could not be updated - the Bacula service was not installed"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+         break;
+      }
+
+      // Attempt to add a Bacula key
+      if (RegSetValueEx(runservices, szAppName, 0, REG_SZ, (unsigned char *)servicecmd, strlen(servicecmd)+1) != ERROR_SUCCESS) {
+         RegCloseKey(runservices);
+         log_error_message(_("Cannot add Bacula key to System Registry")); 
+         MessageBox(NULL, _("The Bacula service could not be installed"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+         break;
+      }
+
+      RegCloseKey(runservices);
+
+      // We have successfully installed the service!
+      if (!silent) {
+         MessageBox(NULL,
+              _("The Bacula File service 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. "),
+              szAppName,
+              MB_ICONINFORMATION | MB_OK);
+      }
+      break;
+
+   // Windows NT, Win2K, WinXP
+   case VER_PLATFORM_WIN32_NT:
+      SC_HANDLE   hservice;
+      SC_HANDLE   hsrvmanager;
+
+      // Open the default, local Service Control Manager database
+      hsrvmanager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+      if (hsrvmanager == NULL) {
+         log_error_message("OpenSCManager failed"); 
+         MessageBox(NULL,
+            _("The Service Control Manager could not be contacted - the Bacula service was not installed"),
+            szAppName, MB_ICONEXCLAMATION | MB_OK);
+         break;
+      }
+
+      // Create an entry for the Bacula service
+      hservice = CreateService(
+              hsrvmanager,                    // SCManager database
+              BAC_SERVICENAME,                // name of service
+              BAC_SERVICEDISPLAYNAME,         // name to display
+              SERVICE_ALL_ACCESS,             // desired access
+              SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,
+                                                                      // service type
+              SERVICE_AUTO_START,             // start type
+              SERVICE_ERROR_NORMAL,           // error control type
+              servicecmd,                     // service's binary
+              NULL,                           // no load ordering group
+              NULL,                           // no tag identifier
+              BAC_DEPENDENCIES,               // dependencies
+              NULL,                           // LocalSystem account
+              NULL);                          // no password
+      if (hservice == NULL) {
+         CloseServiceHandle(hsrvmanager);
+         log_error_message("CreateService failed"); 
+         MessageBox(NULL,
+             _("The Bacula service could not be installed"),
+              szAppName, MB_ICONEXCLAMATION | MB_OK);
+         break;
+      }
+
+      set_service_description(hsrvmanager,hservice, 
+_("Provides file backup and restore services. Bacula -- the network backup solution."));
+
+      CloseServiceHandle(hsrvmanager);
+      CloseServiceHandle(hservice);
+
+      // Everything went fine
+      if (!silent) {
+         MessageBox(NULL,
+              _("The Bacula File service was successfully installed.\n"
+              "The service may be started from the Control Panel and will\n"
+              "automatically be run the next time this machine is rebooted."),
+              szAppName,
+              MB_ICONINFORMATION | MB_OK);
+      }
+      break;
+   default:
+      log_error_message("Unknown Windows System version"); 
+      MessageBox(NULL, 
+                 _("Unknown Windows operating system.\n"     
+                 "Cannot install Bacula service.\n"),
+                 szAppName, MB_ICONEXCLAMATION | MB_OK);
+       break;     
+   };
+
+   return 0;
+}
+
+
+// SERVICE REMOVE ROUTINE
+int
+bacService::RemoveService()
+{
+   // How to remove the Bacula service depends upon the OS
+   switch (g_platform_id) {
+
+   // Windows 95/98/Me
+   case VER_PLATFORM_WIN32_WINDOWS:
+      // Locate the RunService registry entry
+      HKEY runservices;
+      if (RegOpenKey(HKEY_LOCAL_MACHINE, 
+              "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices",
+              &runservices) != ERROR_SUCCESS) {
+         MessageBox(NULL, 
+            _("Could not find registry entry.\nService probably not registerd - the Bacula service was not removed"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+      } else {
+         // Attempt to delete the Bacula key
+         if (RegDeleteValue(runservices, szAppName) != ERROR_SUCCESS) {
+            RegCloseKey(runservices);
+            MessageBox(NULL, _("Could not delete Registry key.\nThe Bacula service could not be removed"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+         }
+
+         RegCloseKey(runservices);
+         break;
+      }
+
+      // Try to kill any running copy of Bacula
+      if (!KillRunningCopy()) {
+         MessageBox(NULL,
+             _("Bacula could not be contacted, probably not running"),
+             szAppName, MB_ICONEXCLAMATION | MB_OK);
+         break;
+      }
+
+      // We have successfully removed the service!
+      if (!silent) {
+         MessageBox(NULL, _("The Bacula service has been removed"), szAppName, MB_ICONINFORMATION | MB_OK);
+      }
+      break;
+
+   // Windows NT, Win2K, WinXP
+   case VER_PLATFORM_WIN32_NT:
+      SC_HANDLE   hservice;
+      SC_HANDLE   hsrvmanager;
+
+      // Open the SCM
+      hsrvmanager = OpenSCManager(
+         NULL,                   // machine (NULL == local)
+         NULL,                   // database (NULL == default)
+         SC_MANAGER_ALL_ACCESS   // access required
+         );
+      if (hsrvmanager) {
+         hservice = OpenService(hsrvmanager, BAC_SERVICENAME, SERVICE_ALL_ACCESS);
+         if (hservice != NULL) {
+            SERVICE_STATUS status;
+
+            // Try to stop the Bacula service
+            if (ControlService(hservice, SERVICE_CONTROL_STOP, &status)) {
+               while(QueryServiceStatus(hservice, &status)) {
+                  if (status.dwCurrentState == SERVICE_STOP_PENDING) {
+                     Sleep(1000);
+                  } else {
+                     break;
+                  }
+               }
+
+               if (status.dwCurrentState != SERVICE_STOPPED) {
+                  MessageBox(NULL, _("The Bacula service could not be stopped"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+               }
+            }
+
+            // Now remove the service from the SCM
+            if (DeleteService(hservice)) {
+               if (!silent) {
+                  MessageBox(NULL, _("The Bacula service has been removed"), szAppName, MB_ICONINFORMATION | MB_OK);
+               }
+            } else {
+               MessageBox(NULL, _("The Bacula service could not be removed"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+            }
+
+            CloseServiceHandle(hservice);
+         } else {
+            MessageBox(NULL, _("The Bacula service could not be found"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+         }
+
+         CloseServiceHandle(hsrvmanager);
+      } else {
+         MessageBox(NULL, _("The SCM could not be contacted - the Bacula service was not removed"), szAppName, MB_ICONEXCLAMATION | MB_OK);
+      }
+      break;
+   }
+   return 0;
+}
+
+// USEFUL SERVICE SUPPORT ROUTINES
+
+// Service control routine
+void WINAPI ServiceCtrl(DWORD ctrlcode)
+{
+    // What control code have we been sent?
+    switch(ctrlcode) {
+    case SERVICE_CONTROL_STOP:
+        // STOP : The service must stop
+        g_srvstatus.dwCurrentState = SERVICE_STOP_PENDING;
+        ServiceStop();
+        break;
+
+    case SERVICE_CONTROL_INTERROGATE:
+        // QUERY : Service control manager just wants to know our state
+        break;
+
+     default:
+        // Control code not recognised
+        break;
+    }
+
+    // Tell the control manager what we're up to.
+    ReportStatus(g_srvstatus.dwCurrentState, NO_ERROR, 0);
+}
+
+// Service manager status reporting
+BOOL ReportStatus(DWORD state,
+                  DWORD exitcode,
+                  DWORD waithint)
+{
+    static DWORD checkpoint = 1;
+    BOOL result = TRUE;
+
+    // If we're in the start state then we don't want the control manager
+    // sending us control messages because they'll confuse us.
+    if (state == SERVICE_START_PENDING) {
+       g_srvstatus.dwControlsAccepted = 0;
+    } else {
+       g_srvstatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
+    }
+
+    // Save the new status we've been given
+    g_srvstatus.dwCurrentState = state;
+    g_srvstatus.dwWin32ExitCode = exitcode;
+    g_srvstatus.dwWaitHint = waithint;
+
+    // Update the checkpoint variable to let the SCM know that we
+    // haven't died if requests take a long time
+    if ((state == SERVICE_RUNNING) || (state == SERVICE_STOPPED)) {
+       g_srvstatus.dwCheckPoint = 0;
+    } else {
+       g_srvstatus.dwCheckPoint = checkpoint++;
+    }
+
+    // Tell the SCM our new status
+    if (!(result = SetServiceStatus(g_hstatus, &g_srvstatus))) {
+       log_error_message(_("SetServiceStatus failed"));
+    }
+
+    return result;
+}
+
+// Error reporting
+void LogErrorMsg(char *message, char *fname, int lineno)
+{
+   char        msgbuff[256];
+   HANDLE      heventsrc;
+   char *      strings[32];
+   LPTSTR      msg;
+
+   // Get the error code
+   g_error = GetLastError();
+   FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
+                 FORMAT_MESSAGE_FROM_SYSTEM,
+                 NULL,
+                 g_error,
+                 0,
+                 (LPTSTR)&msg,
+                 0,
+                 NULL);
+
+   // Use event logging to log the error
+   heventsrc = RegisterEventSource(NULL, BAC_SERVICENAME);
+
+   sprintf(msgbuff, _("\n\n%s error: %ld at %s:%d"), 
+      BAC_SERVICENAME, g_error, fname, lineno);
+   strings[0] = msgbuff;
+   strings[1] = message;
+   strings[2] = msg;
+
+   if (heventsrc != NULL) {
+      MessageBeep(MB_OK);
+
+      ReportEvent(
+              heventsrc,              // handle of event source
+              EVENTLOG_ERROR_TYPE,    // event type
+              0,                      // event category
+              0,                      // event ID
+              NULL,                   // current user's SID
+              3,                      // strings in 'strings'
+              0,                      // no bytes of raw data
+              (const char **)strings, // array of error strings
+              NULL);                  // no raw data
+
+      DeregisterEventSource(heventsrc);
+   }
+   LocalFree(msg);
+}
+typedef BOOL  (WINAPI * WinAPI)(SC_HANDLE, DWORD, LPVOID);
+
+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); 
+}
index 542eb355f14df029a07bc18c67042265081d1ef8..fc0d6494023020762cf4d5c4e47f0775f61e9849 100644 (file)
@@ -1,62 +1,3 @@
-? Makefile
-? Makefile.in
-? a2dll.diff
-? aclocal.m4
-? autom4te.cache
-? conf.patch
-? config.h
-? config.h.in
-? config.log
-? config.status
-? configure
-? make.patch
-? makepatch
-? mingw-utils-0.3-src.tar.gz
-? sep
-? stamp-h1
-? utils-bugs.patch
-? utils-configure.patch
-? utils-missing.patch
-? utils.diff
-? utils.patch
-? utils.patch1
-? utils.patch2
-? utils.patch3
-? utils.patch4
-? dos2unix/.deps
-? dos2unix/Makefile
-? dos2unix/Makefile.in
-? dos2unix/dos2unix
-? dos2unix/dos2unix.html
-? drmingw/.deps
-? drmingw/Makefile
-? drmingw/Makefile.in
-? pexports/.deps
-? pexports/Makefile
-? pexports/Makefile.in
-? pexports/hlex.c
-? pexports/hparse.c
-? pexports/pexports
-? redir/.deps
-? redir/Makefile
-? redir/Makefile.in
-? reimp/.deps
-? reimp/Makefile
-? reimp/Makefile.in
-? reimp/reimp
-? res2coff/.deps
-? res2coff/Makefile
-? res2coff/Makefile.in
-? res2coff/wintypes.h
-? scripts/Makefile
-? scripts/Makefile.in
-? scripts/a2dll
-? scripts/dsw2mak
-? unix2dos/.deps
-? unix2dos/Makefile
-? unix2dos/Makefile.in
-? unix2dos/unix2dos
-? unix2dos/unix2dos.html
 Index: Makefile.am
 ===================================================================
 RCS file: /cvsroot/mingw/utils/Makefile.am,v
@@ -317,6 +258,37 @@ diff -u -r1.2 pexports.h
  rva_to_ptr(DWORD rva);
  
  void
+Index: reimp/ar.c
+===================================================================
+RCS file: /cvsroot/mingw/utils/reimp/ar.c,v
+retrieving revision 1.1
+diff -u -u -r1.1 ar.c
+--- reimp/ar.c 10 Apr 2002 13:39:07 -0000      1.1
++++ reimp/ar.c 29 Jun 2006 22:51:57 -0000
+@@ -21,6 +21,7 @@
+           if (fread (long_names, size, 1, f) != 1)
+             error (0, "unexpected end-of-file\n");
+         }
++      return 1;
+     }
+   else
+     return 0;
+Index: reimp/reimp.h
+===================================================================
+RCS file: /cvsroot/mingw/utils/reimp/reimp.h,v
+retrieving revision 1.1
+diff -u -u -r1.1 reimp.h
+--- reimp/reimp.h      10 Apr 2002 13:39:07 -0000      1.1
++++ reimp/reimp.h      29 Jun 2006 22:51:57 -0000
+@@ -3,7 +3,7 @@
+ /* we need integers of specific sizes */
+ #ifndef uint32
+-#define uint32 unsigned long
++#define uint32 unsigned int
+ #endif
+ #ifndef uint16
 Index: scripts/a2dll.in
 ===================================================================
 RCS file: /cvsroot/mingw/utils/scripts/a2dll.in,v
diff --git a/bacula/src/win32/winapi.h b/bacula/src/win32/winapi.h
new file mode 100644 (file)
index 0000000..fb79e55
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * 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
+ */
+/*
+   Copyright (C) 2003-2006 Kern Sibbald
+
+   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.
+
+ */
+
+#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 <native.h>
+ * #endif
+ */
+#include <windef.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(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;
+
+/* 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);
+  
+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;
+
+void InitWinAPIWrapper();
+#endif
+
+#endif /* __WINAPI_H */
index 47c4c886cab407974b40d51552444478636990a2..2ba0a5fa6cd13f94e80b422250e50d46ede8ff71 100644 (file)
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
-       ProjectType="Visual C++"\r
-       Version="8.00"\r
-       Name="wx-console"\r
-       ProjectGUID="{9BA8E10D-0D82-4B25-8543-DE34641FBC10}"\r
-       Keyword="Win32Proj"\r
-       SignManifests="true"\r
-       >\r
-       <Platforms>\r
-               <Platform\r
-                       Name="Win32"\r
-               />\r
-       </Platforms>\r
-       <ToolFiles>\r
-       </ToolFiles>\r
-       <Configurations>\r
-               <Configuration\r
-                       Name="Debug|Win32"\r
-                       OutputDirectory="Debug"\r
-                       IntermediateDirectory="Debug"\r
-                       ConfigurationType="1"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
-                               AdditionalIncludeDirectories="../..;../compat;../../../../depkgs-win32/wx/include;../../../../depkgs-win32/pthreads;../../../../depkgs-win32/zlib;../../../../depkgs-win32/wx/lib/vc_lib/mswud,../../../../depkgs-win32/gettext/include"\r
-                               PreprocessorDefinitions="UNICODE;WIN32;_DEBUG;_WINDOWS;__WXMSW__;_CONSOLE;_MBCS;HAVE_WIN32;HAVE_WXCONSOLE"\r
-                               MinimalRebuild="true"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="3"\r
-                               UsePrecompiledHeader="0"\r
-                               WarningLevel="3"\r
-                               Detect64BitPortabilityProblems="true"\r
-                               DebugInformationFormat="4"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               AdditionalDependencies="wxbase26ud.lib wxbase26ud_net.lib wxbase26ud_odbc.lib wxbase26ud_xml.lib wxexpatd.lib wxjpegd.lib wxmsw26ud_adv.lib wxmsw26ud_core.lib wxmsw26ud_dbgrid.lib wxmsw26ud_gl.lib wxmsw26ud_html.lib wxmsw26ud_media.lib wxmsw26ud_qa.lib wxmsw26ud_xrc.lib wxpngd.lib wxregexud.lib wxtiffd.lib wxzlibd.lib pthreadVCE.lib zlib.lib wsock32.lib comctl32.lib rpcrt4.lib gdi32.lib user32.lib ole32.lib ComDlg32.Lib shell32.lib AdvAPI32.Lib intl.lib"\r
-                               LinkIncremental="0"\r
-                               AdditionalLibraryDirectories="../../../../depkgs-win32/wx/lib/vc_lib;../../../../depkgs-win32/pthreads;../../../../depkgs-win32/zlib;../../../../depkgs-win32/gettext/lib"\r
-                               GenerateDebugInformation="true"\r
-                               SubSystem="2"\r
-                               TargetMachine="1"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-               <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory="Release"\r
-                       IntermediateDirectory="Release"\r
-                       ConfigurationType="1"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               AdditionalIncludeDirectories="../..;../compat;../../../../depkgs-win32/wx/include;../../../../depkgs-win32/pthreads;../../../../depkgs-win32/zlib;../../../../depkgs-win32/wx/lib/vc_lib/mswu,../../../../depkgs-win32/gettext/include"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;UNICODE;__WXMSW__;_CONSOLE;_MBCS;HAVE_WIN32;HAVE_WXCONSOLE"\r
-                               RuntimeLibrary="2"\r
-                               UsePrecompiledHeader="0"\r
-                               WarningLevel="3"\r
-                               Detect64BitPortabilityProblems="true"\r
-                               DebugInformationFormat="3"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               AdditionalDependencies="wxbase26u.lib wxbase26u_net.lib wxbase26u_odbc.lib wxbase26u_xml.lib wxexpat.lib wxjpeg.lib wxmsw26u_adv.lib wxmsw26u_core.lib wxmsw26u_dbgrid.lib wxmsw26u_gl.lib wxmsw26u_html.lib wxmsw26u_media.lib wxmsw26u_qa.lib wxmsw26u_xrc.lib wxpng.lib wxregexu.lib wxtiff.lib wxzlib.lib pthreadVCE.lib zlib.lib wsock32.lib comctl32.lib rpcrt4.lib gdi32.lib user32.lib ole32.lib ComDlg32.Lib shell32.lib AdvAPI32.Lib intl.lib"\r
-                               LinkIncremental="0"\r
-                               AdditionalLibraryDirectories="../../../../depkgs-win32/wx/lib/vc_lib;../../../../depkgs-win32/pthreads;../../../../depkgs-win32/zlib;../../../../depkgs-win32/gettext/lib"\r
-                               GenerateDebugInformation="true"\r
-                               SubSystem="2"\r
-                               OptimizeReferences="2"\r
-                               EnableCOMDATFolding="2"\r
-                               TargetMachine="1"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-       </Configurations>\r
-       <References>\r
-       </References>\r
-       <Files>\r
-               <Filter\r
-                       Name="Header Files"\r
-                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
-                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
-                       >\r
-                       <File\r
-                               RelativePath="..\compat\compat.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\console_conf.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\console_thread.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\csprint.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath=".\w32api.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wx-console_private.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbconfigfileeditor.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbconfigpanel.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbhistorytextctrl.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxblistctrl.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbmainframe.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbrestorepanel.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbtableparser.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbtreectrl.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbutils.h"\r
-                               >\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Resource Files"\r
-                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
-                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
-                       >\r
-               </Filter>\r
-               <Filter\r
-                       Name="Source Files"\r
-                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
-                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
-                       >\r
-                       <File\r
-                               RelativePath="..\lib\address_conf.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\alist.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\alloc.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\attr.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath=".\authenticate.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\base64.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\berrno.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\bget_msg.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\bnet.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\bnet_pkt.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\bnet_server.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\bshm.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\bsys.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\btime.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\btimers.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\compat.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath=".\console_conf.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\console_thread.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\cram-md5.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\crc32.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\daemon.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\dlist.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\edit.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\fnmatch.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\hmac.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\htable.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\idcache.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\jcr.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\lex.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\main.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\md5.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\mem_pool.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\message.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\parse_conf.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\compat\print.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\queue.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\res.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\rwlock.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\scan.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\semlock.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\serial.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\sha1.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\signal.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\smartall.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\tls.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\tree.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\util.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\var.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\watchdog.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\winapi.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\lib\workq.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wx-console_private.rc"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbconfigfileeditor.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbconfigpanel.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbhistorytextctrl.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxblistctrl.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbmainframe.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbrestorepanel.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbtableparser.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbtreectrl.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\..\wx-console\wxbutils.cpp"\r
-                               >\r
-                       </File>\r
-               </Filter>\r
-               <File\r
-                       RelativePath=".\debug\BuildLog.htm"\r
-                       >\r
-               </File>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="wx-console"
+       ProjectGUID="{9BA8E10D-0D82-4B25-8543-DE34641FBC10}"
+       RootNamespace="wx-console"
+       Keyword="Win32Proj"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="Debug"
+                       ConfigurationType="1"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../..;../compat;&quot;../../../../depkgs-win32/wx/include/msvc&quot;;&quot;../../../../depkgs-win32/wx/include&quot;;&quot;../../../../depkgs-win32/pthreads&quot;;&quot;../../../../depkgs-win32/zlib&quot;;&quot;../../../../depkgs-win32/gettext/include&quot;"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;wxUSE_GUI;__WXDEBUG__;_CONSOLE;HAVE_WIN32;HAVE_WXCONSOLE;_USE_32BIT_TIME_T;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_DEPRECATE"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="false"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="pthreadVCEd.lib zlibd.lib wsock32.lib comctl32.lib rpcrt4.lib atlsd.lib"
+                               LinkIncremental="0"
+                               AdditionalLibraryDirectories="&quot;../../../../depkgs-win32/wx/lib/vc_lib&quot;;&quot;../../../../depkgs-win32/pthreads/debug&quot;;&quot;../../../../depkgs-win32/zlib/debug&quot;;&quot;../../../../depkgs-win32/gettext/lib&quot;"
+                               GenerateDebugInformation="true"
+                               SubSystem="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="Release"
+                       ConfigurationType="1"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               AdditionalIncludeDirectories="../..;../compat;&quot;../../../../depkgs-win32/wx/include/msvc&quot;;&quot;../../../../depkgs-win32/wx/include&quot;;&quot;../../../../depkgs-win32/pthreads&quot;;&quot;../../../../depkgs-win32/zlib&quot;;&quot;../../../../depkgs-win32/gettext/include&quot;"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;wxUSE_GUI;_CONSOLE;HAVE_WIN32;HAVE_WXCONSOLE;_USE_32BIT_TIME_T;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_DEPRECATE"
+                               RuntimeLibrary="2"
+                               UsePrecompiledHeader="0"
+                               BrowseInformation="1"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="false"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="pthreadVCE.lib zlib.lib wsock32.lib comctl32.lib rpcrt4.lib atls.lib"
+                               LinkIncremental="0"
+                               AdditionalLibraryDirectories="&quot;../../../../depkgs-win32/wx/lib/vc_lib&quot;;&quot;../../../../depkgs-win32/pthreads/release&quot;;&quot;../../../../depkgs-win32/zlib/release&quot;;&quot;../../../../depkgs-win32/gettext/lib&quot;"
+                               IgnoreDefaultLibraryNames=""
+                               GenerateDebugInformation="true"
+                               SubSystem="2"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
+                       >
+                       <File
+                               RelativePath="..\..\wx-console\console_conf.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\console_thread.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\csprint.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\w32api.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wx-console_private.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbconfigfileeditor.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbconfigpanel.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbhistorytextctrl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxblistctrl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbmainframe.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbrestorepanel.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbtableparser.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbtreectrl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbutils.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+                       >
+               </Filter>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+                       >
+                       <File
+                               RelativePath="..\..\wx-console\authenticate.c"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\console_conf.c"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               CompileAs="2"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\console_thread.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\main.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wx-console_private.rc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbconfigfileeditor.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbconfigpanel.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbhistorytextctrl.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxblistctrl.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbmainframe.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbrestorepanel.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbtableparser.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbtreectrl.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\wx-console\wxbutils.cpp"
+                               >
+                       </File>
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
index fad7061772ceb6732641efba56e06a11dd3c2b3e..7be2c3ec021cdd69f4682c01c6038a576b3eca04 100644 (file)
@@ -59,15 +59,14 @@ RES **res_head = sres_head;
  * then move it to allocated memory when the resource
  * scan is complete.
  */
-#if defined(HAVE_WIN32) && !defined(HAVE_CYGWIN)  && !defined(HAVE_MINGW)
+#if defined(_MSC_VER)
 extern "C" { // work around visual compiler mangling variables
     URES res_all;
-    int  res_all_size = sizeof(res_all);
 }
 #else
 URES res_all;
-int  res_all_size = sizeof(res_all);
 #endif
+int  res_all_size = sizeof(res_all);
 
 /* Definition of records permitted within each
  * resource with the routine to process the record
index 87d0de57a9d0089a7392eee662ac15a75e5f2b57..dc4b2ccaadd9595e773b8152258ea859f9c3857f 100644 (file)
@@ -58,7 +58,7 @@ int numdir = 0;
  */
 static int tls_pem_callback(char *buf, int size, const void *userdata)
 {
-#ifdef HAVE_TLS
+#if defined(HAVE_TLS) && !defined(HAVE_WIN32)
    const char *prompt = (const char *) userdata;
    char *passwd;
 
@@ -206,7 +206,7 @@ wxString console_thread::LoadConfig(wxString configfile) {
    MSGS* msgs = (MSGS *)malloc(sizeof(MSGS));
    memset(msgs, 0, sizeof(MSGS));
    for (int i=1; i<=M_MAX; i++) {
-#ifndef WIN32
+#ifndef HAVE_WIN32
       add_msg_dest(msgs, MD_STDOUT, i, NULL, NULL);
 #endif
 //    add_msg_dest(msgs, MD_SYSLOG, i, NULL, NULL);
@@ -274,9 +274,9 @@ void* console_thread::Entry() {
       csprint(NULL, CS_END);
       csprint(NULL, CS_DISCONNECTED);
       csprint(NULL, CS_TERMINATED);
-      #ifdef HAVE_WIN32
-         Exit();
-      #endif
+#ifdef HAVE_WIN32
+      Exit();
+#endif
       return NULL;
    }
    
@@ -285,9 +285,9 @@ void* console_thread::Entry() {
       csprint(NULL, CS_END);
       csprint(NULL, CS_DISCONNECTED);
       csprint(NULL, CS_TERMINATED);
-      #ifdef HAVE_WIN32
-         Exit();
-      #endif
+#ifdef HAVE_WIN32
+      Exit();
+#endif
       return NULL;
    }
    
@@ -311,9 +311,9 @@ void* console_thread::Entry() {
       csprint(NULL, CS_END);
       csprint(NULL, CS_DISCONNECTED);
       csprint(NULL, CS_TERMINATED);
-      #ifdef HAVE_WIN32
-         Exit();
-      #endif
+#ifdef HAVE_WIN32
+      Exit();
+#endif
       return NULL;
    } else if (count == 1) {
       directorchoosen = 1;
@@ -404,9 +404,9 @@ void* console_thread::Entry() {
       csprint(NULL, CS_END);
       csprint(NULL, CS_DISCONNECTED);
       csprint(NULL, CS_TERMINATED);
-      #ifdef HAVE_WIN32
-         Exit();
-      #endif
+#ifdef HAVE_WIN32
+      Exit();
+#endif
       return NULL;
    }
 
@@ -419,9 +419,9 @@ void* console_thread::Entry() {
       csprint(NULL, CS_END);
       csprint(NULL, CS_DISCONNECTED);
       csprint(NULL, CS_TERMINATED);
-      #ifdef HAVE_WIN32
-         Exit();
-      #endif
+#ifdef HAVE_WIN32
+      Exit();
+#endif
       return NULL;
    }
    
@@ -493,9 +493,9 @@ void* console_thread::Entry() {
 
    csprint(NULL, CS_TERMINATED);
 
-   #ifdef HAVE_WIN32
-      Exit();
-   #endif
+#ifdef HAVE_WIN32
+   Exit();
+#endif
    
    return NULL;
 }