From dc72160c65a2f026ae341af69d27302cc5d4255d Mon Sep 17 00:00:00 2001 From: James Harper Date: Sun, 3 May 2009 01:20:28 +0000 Subject: [PATCH] Change GetComputerName to GetComputerNameEx so that in a cluster we get the name of the vserver instead of the local machine. Added prototypes for GetComputerNameEx which appear to be missing. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8781 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/win32/filed/plugins/api.h | 21 ++++++++++++++++++-- bacula/src/win32/filed/plugins/exchange-fd.c | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bacula/src/win32/filed/plugins/api.h b/bacula/src/win32/filed/plugins/api.h index f67b453f92..899c744867 100644 --- a/bacula/src/win32/filed/plugins/api.h +++ b/bacula/src/win32/filed/plugins/api.h @@ -29,8 +29,6 @@ * Written by James Harper, October 2008 */ -//#include - 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 +); + } diff --git a/bacula/src/win32/filed/plugins/exchange-fd.c b/bacula/src/win32/filed/plugins/exchange-fd.c index 3d45903b0e..fa97f97194 100644 --- a/bacula/src/win32/filed/plugins/exchange-fd.c +++ b/bacula/src/win32/filed/plugins/exchange-fd.c @@ -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; -- 2.39.5