From ebce93b08963a9598f0d1e0c06a6a0b8976ea5e0 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 20 Jul 2006 22:46:18 +0000 Subject: [PATCH] DEVEL15-windows-ifs-cleanup-20060720 * fix up prototypes * remove unused variables * re-organize code for readability * fix type safety issues (cherry picked from commit 22f43b30a094669cc8b52bfb416ef6fb099bb93c) --- src/WINNT/afsd/afsd_service.c | 47 +++++++++++------------------------ src/WINNT/afsd/afsdifs.c | 38 ++++++++++++++-------------- src/WINNT/afsd/cm_ioctl.c | 36 +++++++++++---------------- src/WINNT/afsd/cm_vnodeops.c | 8 +++--- src/WINNT/afsd/smb_iocons.h | 2 +- src/WINNT/afsd/smb_ioctl.c | 6 +---- src/WINNT/afsrdr/afsrdr.c | 2 +- src/WINNT/afsrdr/ifs_rpc.c | 10 +++----- src/WINNT/afsrdr/ifs_rpc.h | 4 +-- src/WINNT/afsrdr/kif.h | 47 ++++++++++++++++++----------------- src/sys/pioctl_nt.c | 13 +++++----- 11 files changed, 90 insertions(+), 123 deletions(-) diff --git a/src/WINNT/afsd/afsd_service.c b/src/WINNT/afsd/afsd_service.c index 1e1daece6..13f8b2f71 100644 --- a/src/WINNT/afsd/afsd_service.c +++ b/src/WINNT/afsd/afsd_service.c @@ -37,10 +37,7 @@ HANDLE hAFSDMainThread = NULL; HANDLE hAFSDWorkerThread[WORKER_THREADS]; #endif -/* for the IFS version, set the event DoTerminate, on which all - worker threads wait. they will exit, and then everything else - can uninitialize. */ -HANDLE WaitToTerminate, DoTerminate; +HANDLE WaitToTerminate; int GlobalStatus; @@ -89,10 +86,8 @@ static void afsd_notifier(char *msgp, char *filep, long line) DebugBreak(); #endif -#ifndef AFSIFS SetEvent(WaitToTerminate); -#else - SetEvent(DoTerminate); +#ifdef AFSIFS WaitForMultipleObjects(WORKER_THREADS, hAFSDWorkerThread, TRUE, INFINITE); for (i = 0; i < WORKER_THREADS; i++) CloseHandle(hAFSDWorkerThread[i]); @@ -201,11 +196,7 @@ afsd_ServiceControlHandler(DWORD ctrlCode) } doneTrace: -#ifndef AFSIFS SetEvent(WaitToTerminate); -#else - SetEvent(DoTerminate); -#endif break; case SERVICE_CONTROL_INTERROGATE: @@ -273,11 +264,7 @@ afsd_ServiceControlHandlerEx( } doneTrace: -#ifndef AFSIFS SetEvent(WaitToTerminate); -#else - SetEvent(DoTerminate); -#endif dwRet = NO_ERROR; break; @@ -388,7 +375,9 @@ afsd_ServiceControlHandlerEx( #define MAX_RETRIES 30 static void MountGlobalDrives(void) { +#ifndef AFSIFS char szAfsPath[_MAX_PATH]; +#endif char szDriveToMapTo[5]; DWORD dwResult; char szKeyName[256]; @@ -454,16 +443,18 @@ static void MountGlobalDrives(void) static void DismountGlobalDrives() { +#ifndef AFSIFS char szAfsPath[_MAX_PATH]; char szDriveToMapTo[5]; - DWORD dwResult; - char szKeyName[256]; - HKEY hKey; - DWORD dwIndex = 0; DWORD dwDriveSize; DWORD dwSubMountSize; char szSubMount[256]; DWORD dwType; +#endif + DWORD dwResult; + char szKeyName[256]; + HKEY hKey; + DWORD dwIndex = 0; sprintf(szKeyName, "%s\\GlobalAutoMapper", AFSREG_CLT_SVC_PARAM_SUBKEY); @@ -471,7 +462,9 @@ static void DismountGlobalDrives() if (dwResult != ERROR_SUCCESS) return; -#ifndef AFSIFS +#ifdef AFSIFS + /* FIXFIX: implement */ +#else while (1) { dwDriveSize = sizeof(szDriveToMapTo); dwSubMountSize = sizeof(szSubMount); @@ -491,8 +484,6 @@ static void DismountGlobalDrives() afsi_log("Disconnect from GlobalAutoMap of %s to %s %s", szDriveToMapTo, szSubMount, dwResult ? "succeeded" : "failed"); } -#else - /* FIXFIX: implement */ #endif RegCloseKey(hKey); @@ -1057,12 +1048,6 @@ afsd_Main(DWORD argc, LPTSTR *argv) if ( GetLastError() == ERROR_ALREADY_EXISTS ) afsi_log("Event Object Already Exists: %s", TEXT("afsd_service_WaitToTerminate")); -#ifdef AFSIFS - DoTerminate = CreateEvent(NULL, TRUE, FALSE, TEXT("afsd_service_DoTerminate")); - if ( GetLastError() == ERROR_ALREADY_EXISTS ) - afsi_log("Event Object Already Exists: %s", TEXT("afsd_service_DoTerminate")); -#endif - #ifndef NOTSERVICE hAdvApi32 = LoadLibrary("advapi32.dll"); if (hAdvApi32 == NULL) @@ -1474,11 +1459,9 @@ main(int argc, char * argv[]) printf("Hit to terminate OpenAFS Client Service\n"); getchar(); -#ifndef AFSIFS SetEvent(WaitToTerminate); -#else - SetEvent(DoTerminate); - dc_release_hooks(); +#ifdef AFSIFS + dc_release_hooks(); #endif } } diff --git a/src/WINNT/afsd/afsdifs.c b/src/WINNT/afsd/afsdifs.c index f6bfdce53..5537325fa 100644 --- a/src/WINNT/afsd/afsdifs.c +++ b/src/WINNT/afsd/afsdifs.c @@ -83,9 +83,6 @@ struct user_map_entry user_map[MAX_AFS_USERS]; CRITICAL_SECTION mapLock, scp_list_lock; -/* an event set by the controlling program to cause worker threads to terminate */ -extern HANDLE DoTerminate; - scp_status_t *scp_list_head = NULL; @@ -404,7 +401,7 @@ ifs_ImpersonateClient(LARGE_INTEGER user_id) /****************************/ /* upcalls */ /****************************/ -uc_namei(WCHAR *name, ULONG *fid) /* performs name<->fid mapping, and enters it into table */ +long uc_namei(WCHAR *name, ULONG *fid) /* performs name<->fid mapping, and enters it into table */ { char *buffer; /* we support semi-infinite path lengths */ long code; @@ -472,7 +469,7 @@ uc_namei(WCHAR *name, ULONG *fid) /* performs name<->fid mapping, and enters it /* this should only be called right after open, so we do not need to stat file. * we only check the server's restrictions. sharing violations are handled in the * kernel. the access mode we grant sticks with the file_object until its death. */ -uc_check_access(ULONG fid, ULONG access, ULONG *granted) +long uc_check_access(ULONG fid, ULONG access, ULONG *granted) { ULONG afs_acc, afs_gr; cm_scache_t *scp; @@ -537,7 +534,7 @@ uc_check_access(ULONG fid, ULONG access, ULONG *granted) return 0; } -uc_create(WCHAR *name, ULONG attribs, LARGE_INTEGER alloc, ULONG access, ULONG *granted, ULONG *fid) +long uc_create(WCHAR *name, ULONG attribs, LARGE_INTEGER alloc, ULONG access, ULONG *granted, ULONG *fid) { char *buffer; /* we support semi-infinite path lengths */ long code; @@ -610,7 +607,7 @@ uc_create(WCHAR *name, ULONG attribs, LARGE_INTEGER alloc, ULONG access, ULONG * /* this does not fill the attribs member completely. additional flags must be added in the kernel, such as read-only. */ -uc_stat(ULONG fid, ULONG *attribs, LARGE_INTEGER *size, LARGE_INTEGER *creation, +long uc_stat(ULONG fid, ULONG *attribs, LARGE_INTEGER *size, LARGE_INTEGER *creation, LARGE_INTEGER *access, LARGE_INTEGER *change, LARGE_INTEGER *written) { cm_scache_t *scp; @@ -640,7 +637,7 @@ uc_stat(ULONG fid, ULONG *attribs, LARGE_INTEGER *size, LARGE_INTEGER *creation, } /* set atime, mtime, etc. */ -uc_setinfo(ULONG fid, ULONG attribs, LARGE_INTEGER creation, LARGE_INTEGER access, +long uc_setinfo(ULONG fid, ULONG attribs, LARGE_INTEGER creation, LARGE_INTEGER access, LARGE_INTEGER change, LARGE_INTEGER written) { return IFSL_GENERIC_FAILURE; @@ -722,7 +719,7 @@ long uc_read(ULONG fid, LARGE_INTEGER offset, ULONG length, ULONG *read, char *d /* FIXFIX: this does not catch all overquota errors, because the file * is not necessarily written to the server when this returns. */ /* write data to a file */ -uc_write(ULONG fid, LARGE_INTEGER offset, ULONG length, ULONG *written, char *data) +long uc_write(ULONG fid, LARGE_INTEGER offset, ULONG length, ULONG *written, char *data) { ULONG code; cm_scache_t *scp; @@ -739,13 +736,14 @@ uc_write(ULONG fid, LARGE_INTEGER offset, ULONG length, ULONG *written, char *da return 0; } -uc_rename(ULONG fid, WCHAR *curr, WCHAR *new_dir, WCHAR *new_name, ULONG *new_fid) +long uc_rename(ULONG fid, WCHAR *curr, WCHAR *new_dir, WCHAR *new_name, ULONG *new_fid) { int code; cm_req_t req; char *curdir, *curfile, *newdir, *newfile; cm_scache_t *dscp1, *dscp2, *scp; char b1[MAX_PATH], b2[MAX_PATH], b3[MAX_PATH]; + wchar_t b3_w[MAX_PATH]; code = !(scp = ifs_FindScp(fid)); if (!code) @@ -778,8 +776,8 @@ uc_rename(ULONG fid, WCHAR *curr, WCHAR *new_dir, WCHAR *new_name, ULONG *new_fi { strcat(b3, "\\"); strcat(b3, b2); - // TODO: Must convert b3 to type WCHAR* - uc_namei(b3, new_fid); + mbstowcs(b3_w, b3, MAX_PATH); + uc_namei(b3_w, new_fid); } else { @@ -904,7 +902,7 @@ long uc_readdir(ULONG fid, LARGE_INTEGER cookie_in, WCHAR *filter, ULONG *count, ULONG code; char buffer[2048]; cm_req_t req; - cm_scache_t *scp, *child_scp; + cm_scache_t *scp; readdir_context_t context; LARGE_INTEGER cookie; @@ -947,7 +945,7 @@ long uc_readdir(ULONG fid, LARGE_INTEGER cookie_in, WCHAR *filter, ULONG *count, return code; } -uc_close(ULONG fid) +long uc_close(ULONG fid) { cm_scache_t *scp; cm_req_t req; @@ -988,7 +986,7 @@ uc_close(ULONG fid) return 0; } -uc_unlink(WCHAR *name) +long uc_unlink(WCHAR *name) { char buffer[2048]; long code; @@ -1020,7 +1018,7 @@ uc_unlink(WCHAR *name) } -int uc_ioctl_write(ULONG length, char *data, ULONG_PTR *key) +long uc_ioctl_write(ULONG length, char *data, ULONG_PTR *key) { smb_ioctl_t *iop; @@ -1035,11 +1033,11 @@ int uc_ioctl_write(ULONG length, char *data, ULONG_PTR *key) return 0; } -int uc_ioctl_read(ULONG_PTR key, ULONG *length, char *data) +long uc_ioctl_read(ULONG_PTR key, ULONG *length, char *data) { smb_ioctl_t *iop; - iop = key; + iop = (smb_ioctl_t *)key; osi_assert(iop); cm_HoldUser(userp); @@ -1130,8 +1128,8 @@ DWORD WINAPI ifs_MainLoop(LPVOID param) while (1) { /* just check if the event is already signalled, do not wait */ - if (WaitForSingleObject(DoTerminate, 0) == WAIT_OBJECT_0) - break; + if (WaitForSingleObject(WaitToTerminate, 0) == WAIT_OBJECT_0) + break; /* read request... */ st = ReadFile(pipe, bufIn, TRANSFER_BUF_SIZE, &lenIn, NULL); diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index f0af81e50..56de204b6 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -216,14 +216,11 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, cm_scache_t **scpp) { long code; +#ifndef AFSIFS cm_scache_t *substRootp; - char * relativePath = ioctlp->inDatap; -#ifdef AFSIFS - char * absRoot[MAX_PATH]; - long length; - wchar_t absRoot_w[MAX_PATH]; - HANDLE rootDir; #endif + char * relativePath = ioctlp->inDatap; + osi_Log1(afsd_logp, "cm_ParseIoctlPath %s", osi_LogSaveString(afsd_logp,relativePath)); /* This is usually the file name, but for StatMountPoint it is the path. */ @@ -237,26 +234,16 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, #ifdef AFSIFS /* we have passed the whole path, including the afs prefix. - when the pioctl call is made, we perform an ioctl to afsrdr - and it returns the correct (full) path. therefore, there is - no drive letter, and the path is absolute. */ + when the pioctl call is made, we perform an ioctl to afsrdr + and it returns the correct (full) path. therefore, there is + no drive letter, and the path is absolute. */ code = cm_NameI(cm_data.rootSCachep, relativePath, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, "", reqp, scpp); if (code) return code; - - /* # of bytes of path */ - code = strlen(ioctlp->inDatap) + 1; - ioctlp->inDatap += code; - - /* This is usually nothing, but for StatMountPoint it is the file name. */ - TranslateExtendedChars(ioctlp->inDatap); - - return 0; -#endif /* AFSIFS */ - +#else /* AFSIFS */ if (relativePath[0] == relativePath[1] && relativePath[1] == '\\' && !_strnicmp(cm_NetbiosName,relativePath+2,strlen(cm_NetbiosName))) @@ -336,6 +323,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, if (code) return code; } +#endif /* AFSIFS */ /* # of bytes of path */ code = (long)strlen(ioctlp->inDatap) + 1; @@ -2001,7 +1989,9 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) afs_uuid_t uuid; int flags; char sessionKey[8]; +#ifndef AFSIFS char *smbname; +#endif int release_userp = 0; char * wdir = NULL; @@ -2048,7 +2038,7 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) uname = tp; tp += strlen(tp) + 1; -#ifndef AFSIFS /* no SMB username, so we cannot log based on this */ +#ifndef AFSIFS /* no SMB username, so we cannot logon based on this */ if (flags & PIOCTL_LOGON) { /* SMB user name with which to associate tokens */ smbname = tp; @@ -2058,7 +2048,7 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) tp += strlen(tp) + 1; } else { osi_Log1(smb_logp,"cm_IoctlSetToken for user [%s]", - osi_LogSaveString(smb_logp,uname)); + osi_LogSaveString(smb_logp, uname)); } #endif @@ -2073,11 +2063,13 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) osi_Log0(smb_logp,"cm_IoctlSetToken - no name specified"); } +#ifndef AFSIFS if (flags & PIOCTL_LOGON) { userp = smb_FindCMUserByName(smbname, ioctlp->fidp->vcp->rname, SMB_FLAG_CREATE|SMB_FLAG_AFSLOGON); release_userp = 1; } +#endif /* AFSIFS */ /* store the token */ lock_ObtainMutex(&userp->mx); diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index 7ee026d8a..ab6837d14 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -664,10 +664,10 @@ long cm_ApplyDir(cm_scache_t *scp, cm_DirFuncp_t funcp, void *parmp, } #ifdef AFSIFS - /* for the IFS version, we bulkstat the dirents because this - routine is used in place of smb_ReceiveCoreSearchDir. our - other option is to modify smb_ReceiveCoreSearchDir itself, - but this seems to be the proper use for cm_ApplyDir. */ + /* for the IFS version, we bulkstat the dirents because this + routine is used in place of smb_ReceiveCoreSearchDir. our + other option is to modify smb_ReceiveCoreSearchDir itself, + but this seems to be the proper use for cm_ApplyDir. */ lock_ObtainMutex(&scp->mx); if ((scp->flags & CM_SCACHEFLAG_BULKSTATTING) == 0 && (scp->bulkStatProgress.QuadPart <= thyper.QuadPart)) diff --git a/src/WINNT/afsd/smb_iocons.h b/src/WINNT/afsd/smb_iocons.h index be34f81d7..a1a66509e 100644 --- a/src/WINNT/afsd/smb_iocons.h +++ b/src/WINNT/afsd/smb_iocons.h @@ -43,7 +43,7 @@ struct sbstruct { #define CM_IOCTLCACHEPARMS 16 typedef struct cm_cacheParms { - long parms[CM_IOCTLCACHEPARMS]; + afs_uint64 parms[CM_IOCTLCACHEPARMS]; } cm_cacheParms_t; /* set cell flags */ diff --git a/src/WINNT/afsd/smb_ioctl.c b/src/WINNT/afsd/smb_ioctl.c index 3961dc0ac..7f3088356 100644 --- a/src/WINNT/afsd/smb_ioctl.c +++ b/src/WINNT/afsd/smb_ioctl.c @@ -138,11 +138,7 @@ smb_IoctlPrepareRead(smb_fid_t *fidp, smb_ioctl_t *ioctlp, cm_user_t *userp) return CM_ERROR_TOOBIG; /* check for no such proc */ - if (fidp->flags & SMB_FID_IOCTL) - procp = smb_ioctlProcsp[opcode]; - else - procp = NULL; - + procp = smb_ioctlProcsp[opcode]; if (procp == NULL) return CM_ERROR_BADOP; diff --git a/src/WINNT/afsrdr/afsrdr.c b/src/WINNT/afsrdr/afsrdr.c index fb6d74c7b..9a382991b 100644 --- a/src/WINNT/afsrdr/afsrdr.c +++ b/src/WINNT/afsrdr/afsrdr.c @@ -298,7 +298,7 @@ NTSTATUS AfsRdrCreate(DEVICE_OBJECT *DeviceObject, IRP *Irp, IO_STACK_LOCATION * } StringCbCatN(str, len, IrpSp->FileObject->FileName.Buffer, IrpSp->FileObject->FileName.Length); - /* request to open heirarchical parent of specified path */ + /* request to open hierarchical parent of specified path */ /* remove last path component */ if (IrpSp->Flags & SL_OPEN_TARGET_DIRECTORY) { diff --git a/src/WINNT/afsrdr/ifs_rpc.c b/src/WINNT/afsrdr/ifs_rpc.c index fad955be7..8c1b2fa1d 100644 --- a/src/WINNT/afsrdr/ifs_rpc.c +++ b/src/WINNT/afsrdr/ifs_rpc.c @@ -241,7 +241,6 @@ rpc_t *rpc_create(int size_hint) { ULONG size; rpc_t *rpc; - ULONG status; size = sizeof(rpc_t) + 2*RPC_BUF_SIZE; rpc = malloc(size); @@ -268,10 +267,8 @@ void rpc_destroy(rpc_t *rpc) rpc_transact(rpc_t *rpc) { - HANDLE hf; - int ret; ULONG header_len; - DWORD err, read = 0; + DWORD read = 0; if (!rpc) return IFSL_GENERIC_FAILURE; @@ -736,7 +733,7 @@ uc_flush(ULONG fid) /* downcall stubs */ #ifndef RPC_KERN -dc_break_callback(ULONG fid) +long dc_break_callback(ULONG fid) { rpc_t *rpc; ULONG status; @@ -757,7 +754,7 @@ dc_break_callback(ULONG fid) return status; } -dc_release_hooks() +long dc_release_hooks(void) { rpc_t *rpc; ULONG status; @@ -1240,7 +1237,6 @@ rpc_parse(rpc_t *rpc) break; case RPC_UNLINK: { - ULONG fid, unlink; rpc_unmarshal_wstr(rpc, name); status = uc_unlink(name); rpc_marshal_long(rpc, status); diff --git a/src/WINNT/afsrdr/ifs_rpc.h b/src/WINNT/afsrdr/ifs_rpc.h index 001eea039..1b28c5666 100644 --- a/src/WINNT/afsrdr/ifs_rpc.h +++ b/src/WINNT/afsrdr/ifs_rpc.h @@ -39,11 +39,11 @@ /* maximum number of users, based on SID, that can access AFS at one time */ -#define MAX_AFS_USERS 20 +#define MAX_AFS_USERS 256 /* maximum number of threads that can make simultaneous calls into afsrdr, because we maintain a credential set for each thread in a single table. */ -#define MAX_CRED_MAPS 32 +#define MAX_CRED_MAPS 64 /* size if outgoing/incoming RPC buffer (for parameters only, not bulk data) */ #define RPC_BUF_SIZE 2048 diff --git a/src/WINNT/afsrdr/kif.h b/src/WINNT/afsrdr/kif.h index 22f92a61a..0af043873 100644 --- a/src/WINNT/afsrdr/kif.h +++ b/src/WINNT/afsrdr/kif.h @@ -30,23 +30,24 @@ /* this is based on BUF_FILEHASH, but we were not getting unique hashes */ -#define FID_HASH_FN(fidp) ((((fidp)->vnode + \ - ((fidp)->unique << 13) + ((fidp)->unique >> (32-13)) + \ - (fidp)->volume + \ - (fidp)->cell))) +#define FID_HASH_FN(fidp) \ + ((((fidp)->vnode + \ + ((fidp)->unique << 13) + ((fidp)->unique >> (32-13)) + \ + (fidp)->volume + \ + (fidp)->cell))) /* dirent information */ struct readdir_data - { - LARGE_INTEGER cookie; - long offset; - LARGE_INTEGER creation, access, write, change, size; - ULONG attribs, name_length; /* chars */ - CCHAR short_name_length; /* chars */ - WCHAR short_name[14]; - WCHAR name[]; - }; +{ + LARGE_INTEGER cookie; + long offset; + LARGE_INTEGER creation, access, write, change, size; + ULONG attribs, name_length; /* chars */ + CCHAR short_name_length; /* chars */ + WCHAR short_name[14]; + WCHAR name[]; +}; typedef struct readdir_data readdir_data_t; @@ -56,35 +57,35 @@ typedef struct readdir_data readdir_data_t; #define IFSL_SUCCESS (IFSL_SUCCESS_BASE + 0) #define IFSL_DOES_NOT_EXIST (IFSL_FAIL_BASE + 1) -#define IFSL_NOT_IMPLEMENTED (IFSL_FAIL_BASE + 2) +#define IFSL_NOT_IMPLEMENTED (IFSL_FAIL_BASE + 2) #define IFSL_END_OF_ENUM (IFSL_SUCCESS_BASE + 3) #define IFSL_CANNOT_MAKE (IFSL_FAIL_BASE + 4) #define IFSL_END_OF_FILE (IFSL_SUCCESS_BASE + 5) #define IFSL_NO_ACCESS (IFSL_FAIL_BASE + 6) -#define IFSL_BUFFER_TOO_SMALL (IFSL_FAIL_BASE + 7) -#define IFSL_SHARING_VIOLATION (IFSL_FAIL_BASE + 8) +#define IFSL_BUFFER_TOO_SMALL (IFSL_FAIL_BASE + 7) +#define IFSL_SHARING_VIOLATION (IFSL_FAIL_BASE + 8) #define IFSL_BAD_INPUT (IFSL_FAIL_BASE + 9) -#define IFSL_GENERIC_FAILURE (IFSL_FAIL_BASE + 10) +#define IFSL_GENERIC_FAILURE (IFSL_FAIL_BASE + 10) #define IFSL_OPEN_CREATED (IFSL_SUCCESS_BASE + 11) #define IFSL_OPEN_EXISTS (IFSL_FAIL_BASE + 12) #define IFSL_OPEN_OPENED (IFSL_SUCCESS_BASE + 13) -#define IFSL_OPEN_OVERWRITTEN (IFSL_SUCCESS_BASE + 14) -#define IFSL_OPEN_SUPERSCEDED (IFSL_SUCCESS_BASE + 15) +#define IFSL_OPEN_OVERWRITTEN (IFSL_SUCCESS_BASE + 14) +#define IFSL_OPEN_SUPERSCEDED (IFSL_SUCCESS_BASE + 15) #define IFSL_BADFILENAME (IFSL_FAIL_BASE + 16) #define IFSL_READONLY (IFSL_FAIL_BASE + 17) #define IFSL_IS_A_DIR (IFSL_FAIL_BASE + 18) -#define IFSL_PATH_DOES_NOT_EXIST (IFSL_FAIL_BASE + 19) +#define IFSL_PATH_DOES_NOT_EXIST (IFSL_FAIL_BASE + 19) #define IFSL_IS_A_FILE (IFSL_FAIL_BASE + 20) #define IFSL_NO_FILE (IFSL_FAIL_BASE + 21) #define IFSL_NOT_EMPTY (IFSL_FAIL_BASE + 22) #define IFSL_RPC_TIMEOUT (IFSL_FAIL_BASE + 23) #define IFSL_OVERQUOTA (IFSL_FAIL_BASE + 24) -#define IFSL_MEMORY (IFSL_FAIL_BASE + 25) -#define IFSL_UNSPEC (IFSL_FAIL_BASE + 26) +#define IFSL_MEMORY (IFSL_FAIL_BASE + 25) +#define IFSL_UNSPEC (IFSL_FAIL_BASE + 26) /* ioctl codes */ -#define IOCTL_AFSRDR_IOCTL CTL_CODE(IOCTL_DISK_BASE, 0x007, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) +#define IOCTL_AFSRDR_IOCTL CTL_CODE(IOCTL_DISK_BASE, 0x007, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) #define IOCTL_AFSRDR_DOWNCALL CTL_CODE(IOCTL_DISK_BASE, 0x008, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) #define IOCTL_AFSRDR_GET_PATH CTL_CODE(IOCTL_DISK_BASE, 0x009, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) diff --git a/src/sys/pioctl_nt.c b/src/sys/pioctl_nt.c index 9388a44b1..5c387041c 100644 --- a/src/sys/pioctl_nt.c +++ b/src/sys/pioctl_nt.c @@ -256,8 +256,11 @@ LoadFuncs( if (error) return 0; return 1; } - +#if defined(_IA64_) || defined(_AMD64_) +#define KERB5DLL "krb5_64.dll" +#else #define KERB5DLL "krb5_32.dll" +#endif static BOOL IsKrb5Available() { @@ -418,7 +421,7 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) } #endif - if (fh == INVALID_HANDLE_VALUE) { + if (fh == INVALID_HANDLE_VALUE) { int gonext = 0; gle = GetLastError(); @@ -763,7 +766,6 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize) if (!pathp) return CM_ERROR_NOSUCHPATH; - //sprintf(tpath, "%c:\\", pathp[0]); rootDir = CreateFile(pathp, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (rootDir == INVALID_HANDLE_VALUE) return CM_ERROR_NOSUCHPATH; @@ -779,10 +781,8 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize) code = WideCharToMultiByte(CP_UTF8, 0/*WC_NO_BEST_FIT_CHARS*/, wpath, length/sizeof(wchar_t), outPathp, outSize/sizeof(wchar_t), NULL, NULL); -// strcpy(outPathp, tpath); return 0; -#endif - +#else if (pathp[0] != 0 && pathp[1] == ':') { /* there's a drive letter there */ firstp = pathp + 2; @@ -884,6 +884,7 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize) *p = '\\'; } return 0; +#endif } long -- 2.39.5