lanahelper-20040305
authorJeffrey Altman <jaltman@mit.edu>
Sat, 6 Mar 2004 08:09:13 +0000 (08:09 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 6 Mar 2004 08:09:13 +0000 (08:09 +0000)
Minor updates.  Fix AFS Root UNC path string; add debugging code (off by default)

src/WINNT/afsd/lanahelper.cpp

index 5a8d368..d1725bc 100644 (file)
 #define NOLOGGING
 #ifndef NOLOGGING
 extern "C" {
-    void afsi_log(...);
+#include<stdio.h>
+#include<stdarg.h>
+
+    void afsi_log(TCHAR *p, ...) {
+        va_list marker;
+        TCHAR buffer[200];
+
+        va_start(marker,p);
+        _vstprintf(buffer,p,marker);
+        va_end(marker);
+        _tcscat(buffer,_T("\n"));
+
+        OutputDebugString(buffer);
+    }
 }
 #endif
 
@@ -439,9 +452,9 @@ extern "C" long lana_GetUncServerNameEx(char *buffer, lana_number_t * pLana, int
        LONG rv;
        int regLana;
        int regGateway, regNoFindLanaByName;
-       char regNbName[MAX_NB_NAME_LENGTH];
-       char nbName[MAX_NB_NAME_LENGTH];
-       char hostname[MAX_COMPUTERNAME_LENGTH+1];
+       TCHAR regNbName[MAX_NB_NAME_LENGTH];
+       TCHAR nbName[MAX_NB_NAME_LENGTH];
+       TCHAR hostname[MAX_COMPUTERNAME_LENGTH+1];
 
        rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE,szAFSConfigKeyName,0,KEY_READ,&hkConfig);
        if(rv == ERROR_SUCCESS) {
@@ -572,8 +585,9 @@ extern "C" void lana_GetUncServerName(TCHAR *name, int type) {
 
 extern "C" void lana_GetAfsNameString(int lanaNumber, BOOL isGateway, TCHAR* name)
 {
-    lana_GetUncServerNameDynamic(lanaNumber, isGateway, name,LANA_NETBIOS_NAME_FULL);
-    _stprintf(name, _T("Your UNC name to reach the root of AFS is \\\\%s\\all"), name);
+    TCHAR netbiosName[32];
+    lana_GetUncServerNameDynamic(lanaNumber, isGateway, netbiosName, LANA_NETBIOS_NAME_FULL);
+    _stprintf(name, _T("Your UNC name to reach the root of AFS is \\\\%s\\all"), netbiosName);
 }
 
 extern "C" void lana_GetNetbiosName(LPTSTR pszName, int type)