Changeset 3223 for trunk/src/lib/nt/ntstat.c
- Timestamp:
- Mar 31, 2018, 4:29:56 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/nt/ntstat.c
r3019 r3223 955 955 int birdStatModTimeOnly(const char *pszPath, BirdTimeSpec_T *pTimeSpec, int fFollowLink) 956 956 { 957 MY_FILE_BASIC_INFORMATION BasicInfo; 958 int rc = birdStatOnlyInternal(pszPath, fFollowLink, &BasicInfo); 959 if (!rc) 960 birdNtTimeToTimeSpec(BasicInfo.LastWriteTime.QuadPart, pTimeSpec); 961 return rc; 962 } 963 964 965 957 /* 958 * Convert the path and call NtQueryFullAttributesFile. 959 * 960 * Note! NtQueryAttributesFile cannot be used as it only returns attributes. 961 */ 962 MY_UNICODE_STRING NtPath; 963 964 birdResolveImports(); 965 if (birdDosToNtPath(pszPath, &NtPath) == 0) 966 { 967 MY_OBJECT_ATTRIBUTES ObjAttr; 968 MY_FILE_NETWORK_OPEN_INFORMATION Info; 969 MY_NTSTATUS rcNt; 970 971 memset(&Info, 0xfe, sizeof(Info)); 972 973 MyInitializeObjectAttributes(&ObjAttr, &NtPath, OBJ_CASE_INSENSITIVE, NULL /*hRoot*/, NULL /*pSecAttr*/); 974 rcNt = g_pfnNtQueryFullAttributesFile(&ObjAttr, &Info); 975 976 birdFreeNtPath(&NtPath); 977 if (MY_NT_SUCCESS(rcNt)) 978 { 979 birdNtTimeToTimeSpec(Info.LastWriteTime.QuadPart, pTimeSpec); 980 981 /* Do the trailing slash check. */ 982 if ( (Info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) 983 || !birdIsPathDirSpec(pszPath)) 984 { 985 MY_FILE_BASIC_INFORMATION BasicInfo; 986 if ( !(Info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) 987 || !fFollowLink) 988 return 0; 989 990 /* Fallback on birdStatOnlyInternal to follow the reparse point. */ 991 if (!birdStatOnlyInternal(pszPath, fFollowLink, &BasicInfo)) 992 { 993 birdNtTimeToTimeSpec(BasicInfo.LastWriteTime.QuadPart, pTimeSpec); 994 return 0; 995 } 996 } 997 else 998 errno = ENOTDIR; 999 } 1000 else 1001 birdSetErrnoFromNt(rcNt); 1002 } 1003 return -1; 1004 } 1005 1006 1007
Note:
See TracChangeset
for help on using the changeset viewer.