]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/winapi.c
19July06
[bacula/bacula] / bacula / src / lib / winapi.c
index 45d382ad9e83dfba696dae3db78ee47f910d46f8..58a20fd715891fb254510b92160a9e4b0176fc05 100644 (file)
@@ -6,7 +6,7 @@
  *     Kern Sibbald MMIII
  */
 /*
-   Copyright (C) 2003-2005 Kern Sibbald
+   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
 
  */
 
+#ifdef __APCUPSD__
+#include "apc.h"
+#else
 #include "bacula.h"
+#endif
 
 #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
 
 #include "winapi.h"
 
+int win32_client = 1;
+
 #ifdef WIN32_VSS
 #include "vss.h"   
 #endif
@@ -48,6 +54,8 @@ 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;
@@ -78,6 +86,9 @@ 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;
+
 #ifdef WIN32_VSS
 void 
 VSSCleanup()
@@ -98,6 +109,11 @@ InitWinAPIWrapper()
       p_CreateFileW = (t_CreateFileW)
           GetProcAddress(hLib, "CreateFileW");      
 
+      p_CreateDirectoryA = (t_CreateDirectoryA)
+          GetProcAddress(hLib, "CreateDirectoryA");
+      p_CreateDirectoryW = (t_CreateDirectoryW)
+          GetProcAddress(hLib, "CreateDirectoryW");      
+
       /* attribute calls */
       p_GetFileAttributesA = (t_GetFileAttributesA)
           GetProcAddress(hLib, "GetFileAttributesA");
@@ -143,6 +159,14 @@ InitWinAPIWrapper()
           GetProcAddress(hLib, "GetCurrentDirectoryA");
       p_GetCurrentDirectoryW = (t_GetCurrentDirectoryW)
           GetProcAddress(hLib, "GetCurrentDirectoryW");      
+
+      /* 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);
    }
    
@@ -206,6 +230,9 @@ InitWinAPIWrapper()
       p_wunlink = NULL;
       p_wmkdir = NULL;
       p_wopen = NULL;
+
+      p_GetVolumePathNameW = NULL;
+      p_GetVolumeNameForVolumeMountPointW = NULL;
    }   
 
    /* decide which vss class to initialize */
@@ -221,6 +248,12 @@ InitWinAPIWrapper()
          break;
    }
 #endif /* WIN32_VSS */
+   atexit(Win32ConvCleanupCache);
 }
 
+#else
+
+/* Not Windows */
+int win32_client = 0;
+
 #endif