#include "smb.h"
#include "cmd.h"
#include <fs_utils.h>
-
+#include <WINNT\afsreg.h>
long fs_ExtractDriveLetter(char *inPathp, char *outPathp)
{
/* there's a drive letter there */
firstp = pathp+2;
pathHasDrive = 1;
- }
- else {
+ } else {
firstp = pathp;
pathHasDrive = 0;
}
return 0;
}
- GetCurrentDirectory(sizeof(origPath), origPath);
+ GetCurrentDirectoryA(sizeof(origPath), origPath);
doSwitch = 0;
if (pathHasDrive && (*pathp & ~0x20) != (origPath[0] & ~0x20)) {
newPath[0] = *pathp;
newPath[1] = ':';
newPath[2] = 0;
- if (!SetCurrentDirectory(newPath)) {
+ if (!SetCurrentDirectoryA(newPath)) {
code = GetLastError();
return code;
}
}
/* now get the absolute path to the current wdir in this drive */
- GetCurrentDirectory(sizeof(tpath), tpath);
+ GetCurrentDirectoryA(sizeof(tpath), tpath);
strcpy(outPathp, tpath+2); /* skip drive letter */
/* if there is a non-null name after the drive, append it */
if (*firstp != 0) {
/* finally, if necessary, switch back to our home drive letter */
if (doSwitch) {
- SetCurrentDirectory(origPath);
+ SetCurrentDirectoryA(origPath);
}
return 0;
}
-#ifdef COMMENT
-struct hostent *hostutil_GetHostByName(char *namep)
-{
- struct hostent *thp;
-
- thp = gethostbyname(namep);
- return thp;
-}
-
-/* get hostname or addr, given addr in network byte order */
-char *hostutil_GetNameByINet(afs_uint32 addr)
-{
- static char hostNameBuffer[256];
- struct hostent *thp;
-
- thp = gethostbyaddr((char *) &addr, sizeof(afs_uint32), AF_INET);
- if (thp)
- strcpy(hostNameBuffer, thp->h_name);
- else {
- sprintf(hostNameBuffer, "%d.%d.%d.%d",
- addr & 0xff,
- (addr >> 8) & 0xff,
- (addr >> 16) & 0xff,
- (addr >> 24) & 0xff);
- }
-
- /* return static buffer */
- return hostNameBuffer;
-}
-#endif
-
/* is this a digit or a digit-like thing? */
-static int ismeta(ac, abase)
-register int abase;
-register int ac; {
+static int ismeta(int abase, int ac) {
/* if (ac == '-' || ac == 'x' || ac == 'X') return 1; */
if (ac >= '0' && ac <= '7') return 1;
if (abase <= 8) return 0;
}
/* given that this is a digit or a digit-like thing, compute its value */
-static int getmeta(ac)
-register int ac; {
+static int getmeta(int ac) {
if (ac >= '0' && ac <= '9') return ac - '0';
if (ac >= 'a' && ac <= 'f') return ac - 'a' + 10;
if (ac >= 'A' && ac <= 'F') return ac - 'A' + 10;
return 0;
}
-long util_GetInt32 (as, aval)
-register char *as;
-long *aval;
-{
- register long total;
- register int tc;
- int base;
- int negative;
-
- total = 0; /* initialize things */
- negative = 0;
-
- /* skip over leading spaces */
- while (tc = *as) {
- if (tc != ' ' && tc != '\t') break;
- }
-
- /* compute sign */
- if (*as == '-') {
- negative = 1;
- as++; /* skip over character */
- }
-
- /* compute the base */
- if (*as == '0') {
- as++;
- if (*as == 'x' || *as == 'X') {
- base = 16;
- as++;
- }
- else base = 8;
- }
- else base = 10;
-
- /* compute the # itself */
- while(tc = *as) {
- if (!ismeta(tc, base)) return -1;
- total *= base;
- total += getmeta(tc);
- as++;
- }
-
- if (negative) *aval = -total;
- else *aval = total;
- return 0;
-}
-
char *cm_mount_root="afs";
char *cm_slash_mount_root="/afs";
char *cm_back_slash_mount_root="\\afs";
-#define AFSCONFIGKEYNAME TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters")
void fs_utils_InitMountRoot()
{
char *pmount=mountRoot;
DWORD len=sizeof(mountRoot)-1;
printf("int mountroot \n");
- if ((RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSCONFIGKEYNAME,0, KEY_QUERY_VALUE, &parmKey)!= ERROR_SUCCESS)
- || (RegQueryValueEx(parmKey, "Mountroot", NULL, NULL,(LPBYTE)(mountRoot), &len)!= ERROR_SUCCESS)
+ if ((RegOpenKeyExA(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, 0,
+ (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey)!= ERROR_SUCCESS)
+ || (RegQueryValueExA(parmKey, "Mountroot", NULL, NULL,(LPBYTE)(mountRoot), &len)!= ERROR_SUCCESS)
|| (len==sizeof(mountRoot)-1)
)
strcpy(mountRoot, "\\afs");
strcpy(cm_back_slash_mount_root+1,pmount);
cm_back_slash_mount_root[0]='\\';
}
-