]> git.sur5r.net Git - bacula/bacula/commitdiff
Change GetComputerName to GetComputerNameEx so that in a cluster we get the name...
authorJames Harper <james.harper@bendigoit.com.au>
Sun, 3 May 2009 01:20:28 +0000 (01:20 +0000)
committerJames Harper <james.harper@bendigoit.com.au>
Sun, 3 May 2009 01:20:28 +0000 (01:20 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8781 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/win32/filed/plugins/api.h
bacula/src/win32/filed/plugins/exchange-fd.c

index f67b453f924a073d3518422e3c78e8c2f3c8c0f1..899c74486779531659edb4c25d566f1a27b3f100 100644 (file)
@@ -29,8 +29,6 @@
  *  Written by James Harper, October 2008
  */
 
-//#include <windows.h>
-
 extern "C" {
 
 #define BACKUP_NODE_TYPE_MACHINE                0x001
@@ -279,4 +277,23 @@ extern HrESERestoreGetEnvironment_t HrESERestoreGetEnvironment;
 extern HrESERestoreSaveEnvironment_t HrESERestoreSaveEnvironment;
 extern HrESERestoreAddDatabase_t HrESERestoreAddDatabase;
 extern HrESERestoreOpenFile_t HrESERestoreOpenFile;
+
+typedef enum _COMPUTER_NAME_FORMAT {
+   ComputerNameNetBIOS,
+   ComputerNameDnsHostname,
+   ComputerNameDnsDomain,
+   ComputerNameDnsFullyQualified,
+   ComputerNamePhysicalNetBIOS,
+   ComputerNamePhysicalDnsHostname,
+   ComputerNamePhysicalDnsDomain,
+   ComputerNamePhysicalDnsFullyQualified,
+   ComputerNameMax
+} COMPUTER_NAME_FORMAT;
+
+BOOL WINAPI GetComputerNameExW(
+   COMPUTER_NAME_FORMAT NameType,
+   LPWSTR lpBuffer,
+   LPDWORD lpnSize
+);
+
 }
index 3d45903b0e62ef5b49708965672b04ddfbaa3fc6..fa97f97194503e7fc8fa25f8cc4c7fd32e59c7c2 100644 (file)
@@ -172,7 +172,10 @@ static bRC newPlugin(bpContext *ctx)
    bfuncs->registerBaculaEvents(ctx, 1, 2, 0);
    size = MAX_COMPUTERNAME_LENGTH + 1;
    context->computer_name = new WCHAR[size];
+   /*
    GetComputerNameW(context->computer_name, &size);
+   */
+   GetComputerNameExW(ComputerNameNetBIOS, context->computer_name, &size);
    context->current_node = NULL;
    context->root_node = NULL;
    return retval;