ReactOS 0.4.16-dev-297-gc569aee
Sys_spec_lib.cpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STRING_BUFFER_ALIGNMENT   (32)
 
#define STRING_BUFFER_ALIGN(sz)   (((sz)+STRING_BUFFER_ALIGNMENT)&(~((ULONG)(STRING_BUFFER_ALIGNMENT-1))))
 
#define UDF_UNC_STR_TAG   "AppUStr"
 
#define UDF_UNC_STR_TAG   "AppStr"
 

Functions

LONGLONG UDFTimeToNT (IN PUDF_TIME_STAMP UdfTime)
 
VOID UDFTimeToUDF (IN LONGLONG NtTime, OUT PUDF_TIME_STAMP UdfTime)
 
ULONG UDFAttributesToNT (IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry)
 
VOID UDFAttributesToUDF (IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry, IN ULONG NTAttr)
 
NTSTATUS UDFFileDirInfoToNT (IN PVCB Vcb, IN PDIR_INDEX_ITEM FileDirNdx, OUT PFILE_BOTH_DIR_INFORMATION NTFileInfo)
 
VOID UDFSetFileXTime (IN PUDF_FILE_INFO FileInfo, IN LONGLONG *CrtTime, IN LONGLONG *AccTime, IN LONGLONG *AttrTime, IN LONGLONG *ChgTime)
 
VOID UDFGetFileXTime (IN PUDF_FILE_INFO FileInfo, OUT LONGLONG *CrtTime, OUT LONGLONG *AccTime, OUT LONGLONG *AttrTime, OUT LONGLONG *ChgTime)
 
VOID UDFNormalizeFileName (IN PUNICODE_STRING FName, IN USHORT valueCRC)
 
void __fastcall UDFDOSNameOsNative (IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
 
NTSTATUS MyAppendUnicodeStringToString_ (IN PUNICODE_STRING Str1, IN PUNICODE_STRING Str2)
 
NTSTATUS MyAppendUnicodeToString_ (IN PUNICODE_STRING Str1, IN PCWSTR Str2)
 
NTSTATUS MyInitUnicodeString (IN PUNICODE_STRING Str1, IN PCWSTR Str2)
 
NTSTATUS MyCloneUnicodeString (IN PUNICODE_STRING Str1, IN PUNICODE_STRING Str2)
 
BOOLEAN UDFIsDirInfoCached (IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo)
 
NTSTATUS UDFDoesOSAllowFileToBeTargetForRename__ (IN PUDF_FILE_INFO FileInfo)
 
NTSTATUS UDFDoesOSAllowFileToBeUnlinked__ (IN PUDF_FILE_INFO FileInfo)
 
NTSTATUS UDFDoesOSAllowFilePretendDeleted__ (IN PUDF_FILE_INFO FileInfo)
 

Macro Definition Documentation

◆ STRING_BUFFER_ALIGN

#define STRING_BUFFER_ALIGN (   sz)    (((sz)+STRING_BUFFER_ALIGNMENT)&(~((ULONG)(STRING_BUFFER_ALIGNMENT-1))))

Definition at line 739 of file Sys_spec_lib.cpp.

◆ STRING_BUFFER_ALIGNMENT

#define STRING_BUFFER_ALIGNMENT   (32)

Definition at line 738 of file Sys_spec_lib.cpp.

◆ UDF_UNC_STR_TAG [1/2]

#define UDF_UNC_STR_TAG   "AppUStr"

◆ UDF_UNC_STR_TAG [2/2]

#define UDF_UNC_STR_TAG   "AppStr"

Function Documentation

◆ MyAppendUnicodeStringToString_()

NTSTATUS MyAppendUnicodeStringToString_ ( IN PUNICODE_STRING  Str1,
IN PUNICODE_STRING  Str2 
)

Definition at line 742 of file Sys_spec_lib.cpp.

749{
750 PWCHAR tmp;
751 USHORT i;
752
753#ifdef UDF_TRACK_UNICODE_STR
754 #define UDF_UNC_STR_TAG Tag
755#else
756 #define UDF_UNC_STR_TAG "AppUStr"
757#endif
758
759 tmp = Str1->Buffer;
760 i = Str1->Length + Str2->Length + sizeof(WCHAR);
761 ASSERT(Str1->MaximumLength);
762 if(i > Str1->MaximumLength) {
763 if(!MyReallocPool__((PCHAR)tmp, Str1->MaximumLength,
764 (PCHAR*)&tmp, STRING_BUFFER_ALIGN(i)*2) ) {
766 }
767 Str1->MaximumLength = i*2;
768 Str1->Buffer = tmp;
769 }
770 RtlCopyMemory(((PCHAR)tmp)+Str1->Length, Str2->Buffer, Str2->Length);
771
772/* tmp = (PWCHAR)MyAllocatePoolTag__(NonPagedPool, i = Str1->Length + Str2->Length + sizeof(WCHAR), UDF_UNC_STR_TAG);
773 if(!tmp)
774 return STATUS_INSUFFICIENT_RESOURCES;
775 RtlCopyMemory(tmp, Str1->Buffer, Str1->Length);
776 RtlCopyMemory(((PCHAR)tmp)+Str1->Length, Str2->Buffer, Str2->Length);*/
777 tmp[(i / sizeof(WCHAR)) - 1] = 0;
778 Str1->Length = i - sizeof(WCHAR);
779 //MyFreePool__(Str1->Buffer);
780#ifdef UDF_DBG
781 if(Str1->Buffer && (Str1->Length >= 2*sizeof(WCHAR))) {
782 ASSERT((Str1->Buffer[0] != L'\\') || (Str1->Buffer[1] != L'\\'));
783 }
784#endif // UDF_DBG
785 return STATUS_SUCCESS;
786
787#undef UDF_UNC_STR_TAG
788
789} // end MyAppendUnicodeStringToString()
#define STRING_BUFFER_ALIGN(sz)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG MyReallocPool__(PCHAR addr, ULONG len, PCHAR *pnewaddr, ULONG newlen)
Definition: mem_tools.h:230
#define ASSERT(a)
Definition: mode.c:44
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint16_t * PWCHAR
Definition: typedefs.h:56
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ MyAppendUnicodeToString_()

NTSTATUS MyAppendUnicodeToString_ ( IN PUNICODE_STRING  Str1,
IN PCWSTR  Str2 
)

Definition at line 792 of file Sys_spec_lib.cpp.

799{
800 PWCHAR tmp;
801 USHORT i;
802
803#ifdef UDF_TRACK_UNICODE_STR
804 #define UDF_UNC_STR_TAG Tag
805#else
806 #define UDF_UNC_STR_TAG "AppStr"
807#endif
808
809#if defined(_X86_) && defined(_MSC_VER) && !defined(__clang__)
810
811 __asm push ebx
812 __asm push esi
813
814 __asm xor ebx,ebx
815 __asm mov esi,Str2
816Scan_1:
817 __asm cmp [word ptr esi+ebx],0
818 __asm je EO_Scan
819 __asm add ebx,2
820 __asm jmp Scan_1
821EO_Scan:
822 __asm mov i,bx
823
824 __asm pop esi
825 __asm pop ebx
826
827#else // NO X86 optimization, use generic C/C++
828
829 i=0;
830 while(Str2[i]) {
831 i++;
832 }
833 i *= sizeof(WCHAR);
834
835#endif // _X86_
836
837 tmp = Str1->Buffer;
838 ASSERT(Str1->MaximumLength);
839 if((Str1->Length+i+sizeof(WCHAR)) > Str1->MaximumLength) {
840 if(!MyReallocPool__((PCHAR)tmp, Str1->MaximumLength,
841 (PCHAR*)&tmp, STRING_BUFFER_ALIGN(i + Str1->Length + sizeof(WCHAR))*2 ) ) {
843 }
844 Str1->MaximumLength = STRING_BUFFER_ALIGN(i + sizeof(WCHAR))*2;
845 Str1->Buffer = tmp;
846 }
847 RtlCopyMemory(((PCHAR)tmp)+Str1->Length, Str2, i);
848 i+=Str1->Length;
849 tmp[(i / sizeof(WCHAR))] = 0;
850 Str1->Length = i;
851#ifdef UDF_DBG
852/* if(Str1->Buffer && (Str1->Length >= 2*sizeof(WCHAR))) {
853 ASSERT((Str1->Buffer[0] != L'\\') || (Str1->Buffer[1] != L'\\'));
854 }*/
855#endif // UDF_DBG
856 return STATUS_SUCCESS;
857
858#undef UDF_UNC_STR_TAG
859
860} // end MyAppendUnicodeToString_()
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
Definition: crypt_des.c:251
const WCHAR * word
Definition: lex.c:36
static PVOID ptr
Definition: dispmode.c:27
#define cmp(status, error)
Definition: error.c:114
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
Definition: synth_sse3d.h:83
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esi
Definition: synth_sse3d.h:103

◆ MyCloneUnicodeString()

NTSTATUS MyCloneUnicodeString ( IN PUNICODE_STRING  Str1,
IN PUNICODE_STRING  Str2 
)

Definition at line 910 of file Sys_spec_lib.cpp.

914{
915 Str1->MaximumLength = STRING_BUFFER_ALIGN((Str1->Length = Str2->Length) + sizeof(WCHAR));
916 Str1->Buffer = (PWCHAR)MyAllocatePool__(NonPagedPool, Str1->MaximumLength);
917 if(!Str1->Buffer)
919 ASSERT(Str2->Buffer);
920 RtlCopyMemory(Str1->Buffer, Str2->Buffer, Str2->Length);
921 Str1->Buffer[Str1->Length/sizeof(WCHAR)] = 0;
922 return STATUS_SUCCESS;
923
924} // end MyCloneUnicodeString()
#define NonPagedPool
Definition: env_spec_w32.h:307
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149

Referenced by UDFBuildHashEntry(), UDFCommonCreate(), UDFFirstOpenFile(), UDFHardLink(), UDFRename(), and UDFStoreFileId().

◆ MyInitUnicodeString()

NTSTATUS MyInitUnicodeString ( IN PUNICODE_STRING  Str1,
IN PCWSTR  Str2 
)

Definition at line 863 of file Sys_spec_lib.cpp.

867{
868
869 USHORT i;
870
871#if defined(_X86_) && defined(_MSC_VER) && !defined(__clang__)
872
873 __asm push ebx
874 __asm push esi
875
876 __asm xor ebx,ebx
877 __asm mov esi,Str2
878Scan_1:
879 __asm cmp [word ptr esi+ebx],0
880 __asm je EO_Scan
881 __asm add ebx,2
882 __asm jmp Scan_1
883EO_Scan:
884 __asm mov i,bx
885
886 __asm pop esi
887 __asm pop ebx
888
889#else // NO X86 optimization, use generic C/C++
890
891 i=0;
892 while(Str2[i]) {
893 i++;
894 }
895 i *= sizeof(WCHAR);
896
897#endif // _X86_
898
899 Str1->MaximumLength = STRING_BUFFER_ALIGN((Str1->Length = i) + sizeof(WCHAR));
900 Str1->Buffer = (PWCHAR)MyAllocatePool__(NonPagedPool, Str1->MaximumLength);
901 if(!Str1->Buffer)
903 RtlCopyMemory(Str1->Buffer, Str2, i);
904 Str1->Buffer[i/sizeof(WCHAR)] = 0;
905 return STATUS_SUCCESS;
906
907} // end MyInitUnicodeString()

Referenced by UDFBlankMount(), UDFCommonCreate(), UDFCompleteMount(), and UDFFirstOpenFile().

◆ UDFAttributesToNT()

ULONG UDFAttributesToNT ( IN PDIR_INDEX_ITEM  FileDirNdx,
IN tag FileEntry 
)

Definition at line 83 of file Sys_spec_lib.cpp.

87{
88 ASSERT(FileDirNdx);
89 if( (FileDirNdx->FI_Flags & UDF_FI_FLAG_SYS_ATTR) &&
90 !(FileDirNdx->FI_Flags & UDF_FI_FLAG_LINKED))
91 return FileDirNdx->SysAttr;
92
93 ULONG NTAttr = 0;
94 ULONG attr = 0; //permissions
95 USHORT Flags = 0;
96 USHORT Type = 0;
97 UCHAR FCharact = 0;
98
99 if(!FileEntry) {
100 if(!FileDirNdx->FileInfo)
101 return 0;
102 ValidateFileInfo(FileDirNdx->FileInfo);
103 FileEntry = FileDirNdx->FileInfo->Dloc->FileEntry;
104 }
105 if(FileEntry->tagIdent == TID_FILE_ENTRY) {
106 attr = ((PFILE_ENTRY)FileEntry)->permissions;
107 Flags = ((PFILE_ENTRY)FileEntry)->icbTag.flags;
108 Type = ((PFILE_ENTRY)FileEntry)->icbTag.fileType;
109 if(((PFILE_ENTRY)FileEntry)->fileLinkCount > 1)
110 FileDirNdx->FI_Flags |= UDF_FI_FLAG_LINKED;
111 } else {
112 attr = ((PEXTENDED_FILE_ENTRY)FileEntry)->permissions;
113 Flags = ((PEXTENDED_FILE_ENTRY)FileEntry)->icbTag.flags;
114 Type = ((PEXTENDED_FILE_ENTRY)FileEntry)->icbTag.fileType;
115 if(((PEXTENDED_FILE_ENTRY)FileEntry)->fileLinkCount > 1)
116 FileDirNdx->FI_Flags |= UDF_FI_FLAG_LINKED;
117 }
118 FCharact = FileDirNdx->FileCharacteristics;
119
124 (FCharact & FILE_DIRECTORY)) {
125 NTAttr |= FILE_ATTRIBUTE_DIRECTORY;
126#ifdef UDF_DBG
127 } else {
128 //NTAttr |= FILE_ATTRIBUTE_NORMAL;
129#endif
130 }
131 if(FCharact & FILE_HIDDEN) NTAttr |= FILE_ATTRIBUTE_HIDDEN;
132 if( !(attr & PERM_O_WRITE) &&
133 !(attr & PERM_G_WRITE) &&
134 !(attr & PERM_U_WRITE) &&
135 !(attr & PERM_O_DELETE) &&
136 !(attr & PERM_G_DELETE) &&
137 !(attr & PERM_U_DELETE) ) {
138 NTAttr |= FILE_ATTRIBUTE_READONLY;
139 }
140 FileDirNdx->SysAttr = NTAttr;
141 return NTAttr;
142} // end UDFAttributesToNT()
Type
Definition: Type.h:7
#define PERM_U_WRITE
Definition: ecma_167.h:551
#define ICB_FLAG_ARCHIVE
Definition: ecma_167.h:483
#define PERM_O_WRITE
Definition: ecma_167.h:541
#define FILE_DIRECTORY
Definition: ecma_167.h:439
#define PERM_O_DELETE
Definition: ecma_167.h:544
#define PERM_G_DELETE
Definition: ecma_167.h:549
#define FILE_HIDDEN
Definition: ecma_167.h:438
#define UDF_FILE_TYPE_DIRECTORY
Definition: ecma_167.h:468
#define UDF_FILE_TYPE_STREAMDIR
Definition: ecma_167.h:477
#define TID_FILE_ENTRY
Definition: ecma_167.h:170
struct _EXTENDED_FILE_ENTRY * PEXTENDED_FILE_ENTRY
struct _FILE_ENTRY * PFILE_ENTRY
#define ICB_FLAG_SYSTEM
Definition: ecma_167.h:488
#define PERM_U_DELETE
Definition: ecma_167.h:554
#define PERM_G_WRITE
Definition: ecma_167.h:546
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
Definition: ecma_167.h:742
Definition: ecma_167.h:513
Definition: cookie.c:202
uint32_t ULONG
Definition: typedefs.h:59
#define UDF_FI_FLAG_SYS_ATTR
Given entry of file list contains valid file attributes & times in NT-specific format.
Definition: udf_rel.h:219
#define UDF_FI_FLAG_LINKED
Related FileEntry has more than one FileIdent. It happends when we use HardLinks.
Definition: udf_rel.h:223
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by UDFCommonCleanup(), UDFCommonCreate(), UDFDoesOSAllowFileToBeTargetForRename__(), UDFFileDirInfoToNT(), UDFFirstOpenFile(), UDFFlushAFile(), UDFGetBasicInformation(), UDFGetNetworkInformation(), UDFHardLinkFile__(), UDFRename(), UDFRenameMoveFile__(), and UDFSetEOF().

◆ UDFAttributesToUDF()

VOID UDFAttributesToUDF ( IN PDIR_INDEX_ITEM  FileDirNdx,
IN tag FileEntry,
IN ULONG  NTAttr 
)

Definition at line 147 of file Sys_spec_lib.cpp.

152{
153 PULONG attr; //permissions
155 PUCHAR Type;
156 PUCHAR FCharact;
157
159
160 if(!FileEntry) {
161 ASSERT(FileDirNdx);
162 if(!FileDirNdx->FileInfo)
163 return;
164 ValidateFileInfo(FileDirNdx->FileInfo);
165 FileEntry = FileDirNdx->FileInfo->Dloc->FileEntry;
166 FileDirNdx->FileInfo->Dloc->FE_Flags |= UDF_FE_FLAG_FE_MODIFIED;
167 }
168 if(FileEntry->tagIdent == TID_FILE_ENTRY) {
169 attr = &((PFILE_ENTRY)FileEntry)->permissions;
170 Flags = &((PFILE_ENTRY)FileEntry)->icbTag.flags;
171 Type = &((PFILE_ENTRY)FileEntry)->icbTag.fileType;
172 } else {
173 attr = &((PEXTENDED_FILE_ENTRY)FileEntry)->permissions;
174 Flags = &((PEXTENDED_FILE_ENTRY)FileEntry)->icbTag.flags;
175 Type = &((PEXTENDED_FILE_ENTRY)FileEntry)->icbTag.fileType;
176 }
177 FCharact = &(FileDirNdx->FileCharacteristics);
178
179 if((*FCharact & FILE_DIRECTORY) ||
182 *FCharact |= FILE_DIRECTORY;
186 NTAttr |= FILE_ATTRIBUTE_DIRECTORY;
187 NTAttr &= ~FILE_ATTRIBUTE_NORMAL;
188 } else {
189 *FCharact &= ~FILE_DIRECTORY;
192 }
193
194 if(NTAttr & FILE_ATTRIBUTE_SYSTEM) {
196 } else {
197 *Flags &= ~ICB_FLAG_SYSTEM;
198 }
199 if(NTAttr & FILE_ATTRIBUTE_ARCHIVE) {
201 } else {
202 *Flags &= ~ICB_FLAG_ARCHIVE;
203 }
204 if(NTAttr & FILE_ATTRIBUTE_HIDDEN) {
205 *FCharact |= FILE_HIDDEN;
206 } else {
207 *FCharact &= ~FILE_HIDDEN;
208 }
210 if(!(NTAttr & FILE_ATTRIBUTE_READONLY)) {
214 } else {
218 }
219 FileDirNdx->SysAttr = NTAttr;
220 if(FileDirNdx->FileInfo)
221 FileDirNdx->FileInfo->Dloc->FE_Flags |= UDF_FE_FLAG_FE_MODIFIED;
222 FileDirNdx->FI_Flags |= UDF_FI_FLAG_FI_MODIFIED;
223 return;
224} // end UDFAttributesToUDF()
#define PERM_G_EXEC
Definition: ecma_167.h:545
#define PERM_U_EXEC
Definition: ecma_167.h:550
#define PERM_O_CHATTR
Definition: ecma_167.h:543
#define PERM_U_CHATTR
Definition: ecma_167.h:553
#define PERM_G_CHATTR
Definition: ecma_167.h:548
#define PERM_O_READ
Definition: ecma_167.h:542
#define UDF_FILE_TYPE_REGULAR
Definition: ecma_167.h:469
#define PERM_G_READ
Definition: ecma_167.h:547
#define PERM_U_READ
Definition: ecma_167.h:552
#define PERM_O_EXEC
Definition: ecma_167.h:540
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
#define UDF_FE_FLAG_FE_MODIFIED
Was modified & should be flushed.
Definition: udf_rel.h:323
#define UDF_FI_FLAG_FI_MODIFIED
FileIdent was modified & should be flushed.
Definition: udf_rel.h:217
#define UDF_VALID_FILE_ATTRIBUTES
Definition: udffs.h:64

Referenced by UDFCommonCleanup(), UDFCommonCreate(), UDFCreateFile__(), UDFFlushAFile(), UDFHardLinkFile__(), UDFRename(), UDFRenameMoveFile__(), UDFSetBasicInformation(), and UDFSetEOF().

◆ UDFDoesOSAllowFilePretendDeleted__()

NTSTATUS UDFDoesOSAllowFilePretendDeleted__ ( IN PUDF_FILE_INFO  FileInfo)

Definition at line 1019 of file Sys_spec_lib.cpp.

1022{
1024 if(!hDirNdx) return STATUS_CANNOT_DELETE;
1025 PDIR_INDEX_ITEM DirNdx = UDFDirIndex(hDirNdx, FileInfo->Index);
1026 if(!DirNdx) return STATUS_CANNOT_DELETE;
1027 // we can't hide file that is not marked as deleted
1028 if(!(DirNdx->FileCharacteristics & FILE_DELETED)) {
1029 BrutePoint();
1030
1031#ifndef _CONSOLE
1032 if(!(FileInfo->Fcb->FCBFlags & (UDF_FCB_DELETE_ON_CLOSE |
1033 UDF_FCB_DELETED) ))
1034#endif //_CONSOLE
1035
1036 return STATUS_CANNOT_DELETE;
1037 }
1038 return STATUS_SUCCESS;
1039}
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
Definition: dirtree.cpp:1092
#define FILE_DELETED
Definition: ecma_167.h:440
#define BrutePoint()
Definition: env_spec_w32.h:504
#define STATUS_CANNOT_DELETE
Definition: shellext.h:71
#define UDF_FCB_DELETED
Definition: struct.h:314
#define UDF_FCB_DELETE_ON_CLOSE
Definition: struct.h:309
uint8 FileCharacteristics
Definition: udf_rel.h:182
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
Definition: udf_info.h:1105

Referenced by UDFPretendFileDeleted__().

◆ UDFDoesOSAllowFileToBeTargetForRename__()

NTSTATUS UDFDoesOSAllowFileToBeTargetForRename__ ( IN PUDF_FILE_INFO  FileInfo)

Definition at line 947 of file Sys_spec_lib.cpp.

950{
951#ifndef _CONSOLE
952 NTSTATUS RC;
953#endif //_CONSOLE
954
957 if(!FileInfo->ParentFile)
959
961 FileInfo->Dloc->FileEntry) & FILE_ATTRIBUTE_READONLY)
963
964 if(!FileInfo->Fcb)
965 return STATUS_SUCCESS;
966#ifndef _CONSOLE
968 if(!NT_SUCCESS(RC))
969 return RC;
970#endif //_CONSOLE
971 if(!FileInfo->Fcb)
972 return STATUS_SUCCESS;
973// RC = UDFMarkStreamsForDeletion(FileInfo->Fcb->Vcb, FileInfo->Fcb, TRUE); // Delete
974/* RC = UDFSetDispositionInformation(FileInfo->Fcb, NULL,
975 FileInfo->Fcb->Vcb, NULL, TRUE);
976 if(NT_SUCCESS(RC)) {
977 FileInfo->Fcb->FCBFlags |= UDF_FCB_DELETED;
978 if(UDFGetFileLinkCount(FileInfo) <= 1) {
979 FileInfo->Fcb->NTRequiredFCB->NtReqFCBFlags |= UDF_NTREQ_FCB_DELETED;
980 }
981 }
982 return RC;*/
984
985} // end UDFDoesOSAllowFileToBeTargetForRename__()
ULONG UDFAttributesToNT(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry)
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define DELETE
Definition: nt_native.h:57
NTSTATUS UDFCheckAccessRights(PFILE_OBJECT FileObject, PACCESS_STATE AccessState, PtrUDFFCB Fcb, PtrUDFCCB Ccb, ACCESS_MASK DesiredAccess, USHORT ShareAccess)
Definition: secursup.cpp:927
#define UDFIsADirectory(FileInfo)
Definition: udf_info.h:792
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145

Referenced by UDFRenameMoveFile__().

◆ UDFDoesOSAllowFileToBeUnlinked__()

NTSTATUS UDFDoesOSAllowFileToBeUnlinked__ ( IN PUDF_FILE_INFO  FileInfo)

Definition at line 988 of file Sys_spec_lib.cpp.

991{
992 PDIR_INDEX_HDR hCurDirNdx;
993 PDIR_INDEX_ITEM CurDirNdx;
994 uint_di i;
995// IO_STATUS_BLOCK IoStatus;
996
997 ASSERT(FileInfo->Dloc);
998
999 if(!FileInfo->ParentFile)
1000 return STATUS_CANNOT_DELETE;
1001 if(FileInfo->Dloc->SDirInfo)
1002 return STATUS_CANNOT_DELETE;
1004 return STATUS_SUCCESS;
1005
1006// UDFFlushAFile(FileInfo->Fcb, NULL, &IoStatus, 0);
1007 hCurDirNdx = FileInfo->Dloc->DirIndex;
1008 // check if we can delete all files
1009 for(i=2; (CurDirNdx = UDFDirIndex(hCurDirNdx,i)); i++) {
1010 // try to open Stream
1011 if(CurDirNdx->FileInfo)
1012 return STATUS_CANNOT_DELETE;
1013 }
1014// return UDFCheckAccessRights(NULL, NULL, FileInfo->Fcb, NULL, DELETE, 0);
1015 return STATUS_SUCCESS;
1016} // end UDFDoesOSAllowFileToBeUnlinked__()
struct _UDF_FILE_INFO * FileInfo
Definition: udf_rel.h:204
uint32 uint_di
Definition: udf_rel.h:29

◆ UDFDOSNameOsNative()

void __fastcall UDFDOSNameOsNative ( IN OUT PUNICODE_STRING  DosName,
IN PUNICODE_STRING  UdfName,
IN BOOLEAN  KeepIntact 
)

Definition at line 581 of file Sys_spec_lib.cpp.

586{
587 PWCHAR dosName = DosName->Buffer;
588 PWCHAR udfName = UdfName->Buffer;
589 uint32 udfLen = UdfName->Length / sizeof(WCHAR);
591
592 if(KeepIntact &&
593 (udfLen <= 2) && (udfName[0] == UNICODE_PERIOD)) {
594 if((udfLen != 2) || (udfName[1] == UNICODE_PERIOD)) {
595 RtlCopyMemory(dosName, udfName, UdfName->Length);
596 DosName->Length = UdfName->Length;
597 return;
598 }
599 }
601 RtlGenerate8dot3Name(UdfName, FALSE, &Ctx, DosName);
602
603} // UDFDOSNameOsNative()
NTSYSAPI VOID NTAPI RtlGenerate8dot3Name(_In_ PCUNICODE_STRING Name, _In_ BOOLEAN AllowExtendedCharacters, _Inout_ PGENERATE_NAME_CONTEXT Context, _Inout_ PUNICODE_STRING Name8dot3)
unsigned int uint32
Definition: types.h:32
#define FALSE
Definition: types.h:117
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define UNICODE_PERIOD
Definition: udf_rel.h:423
_Out_ PUNICODE_STRING DosName
Definition: rtlfuncs.h:1286

Referenced by UDFDOSName().

◆ UDFFileDirInfoToNT()

NTSTATUS UDFFileDirInfoToNT ( IN PVCB  Vcb,
IN PDIR_INDEX_ITEM  FileDirNdx,
OUT PFILE_BOTH_DIR_INFORMATION  NTFileInfo 
)

Definition at line 231 of file Sys_spec_lib.cpp.

236{
237 PFILE_ENTRY FileEntry;
238 UNICODE_STRING UdfName;
240 PEXTENDED_FILE_ENTRY ExFileEntry;
241 USHORT Ident;
242 BOOLEAN ReadSizes = FALSE;
245
246 UDFPrint(("@=%#x, FileDirNdx %x\n", &Vcb, FileDirNdx));
247
248 ASSERT((ULONG_PTR)NTFileInfo > 0x1000);
249 RtlZeroMemory(NTFileInfo, sizeof(FILE_BOTH_DIR_INFORMATION));
250
251 DosName.Buffer = (PWCHAR)&(NTFileInfo->ShortName);
252 DosName.MaximumLength = sizeof(NTFileInfo->ShortName); // 12*sizeof(WCHAR)
253
254 _SEH2_TRY {
255 UDFPrint((" DirInfoToNT: %*.*S\n", FileDirNdx->FName.Length/sizeof(WCHAR), FileDirNdx->FName.Length/sizeof(WCHAR), FileDirNdx->FName));
257 UDFPrint((" DirInfoToNT: exception when printing file name\n"));
258 } _SEH2_END;
259
260 if(FileDirNdx->FileInfo) {
261 UDFPrint((" FileInfo\n"));
262 // validate FileInfo
263 ValidateFileInfo(FileDirNdx->FileInfo);
264 if(UDFGetFileLinkCount(FileDirNdx->FileInfo) > 1)
265 FileDirNdx->FI_Flags |= UDF_FI_FLAG_LINKED;
266 FileEntry = (PFILE_ENTRY)(FileDirNdx->FileInfo->Dloc->FileEntry);
267 // read required sizes from Fcb (if any) if file is not linked
268 // otherwise we should read them from FileEntry
269 if(FileDirNdx->FileInfo->Fcb) {
270 UDFPrint((" Fcb\n"));
271 NtReqFcb = FileDirNdx->FileInfo->Fcb->NTRequiredFCB;
272 NTFileInfo->CreationTime.QuadPart = NtReqFcb->CreationTime.QuadPart;
273 NTFileInfo->LastWriteTime.QuadPart = NtReqFcb->LastWriteTime.QuadPart;
274 NTFileInfo->LastAccessTime.QuadPart = NtReqFcb->LastAccessTime.QuadPart;
275 NTFileInfo->ChangeTime.QuadPart = NtReqFcb->ChangeTime.QuadPart;
276// NTFileInfo->AllocationSize.QuadPart = NtReqFcb->CommonFCBHeader.AllocationSize.QuadPart;
277 NTFileInfo->AllocationSize.QuadPart = FileDirNdx->AllocationSize;
278/* FileDirNdx->FileSize =
279 NTFileInfo->EndOfFile.QuadPart = NtReqFcb->CommonFCBHeader.FileSize.QuadPart;*/
280 NTFileInfo->EndOfFile.QuadPart = FileDirNdx->FileSize;
281 if(FileDirNdx->FI_Flags & UDF_FI_FLAG_SYS_ATTR) {
282 UDFPrint((" SYS_ATTR\n"));
283 NTFileInfo->FileAttributes = FileDirNdx->SysAttr;
284 goto get_name_only;
285 }
286 FileDirNdx->CreationTime = NTFileInfo->CreationTime.QuadPart;
287 FileDirNdx->LastWriteTime = NTFileInfo->LastWriteTime.QuadPart;
288 FileDirNdx->LastAccessTime = NTFileInfo->LastAccessTime.QuadPart;
289 FileDirNdx->ChangeTime = NTFileInfo->ChangeTime.QuadPart;
290 goto get_attr_only;
291 }
292 ASSERT(FileEntry);
293 } else if(!(FileDirNdx->FI_Flags & UDF_FI_FLAG_SYS_ATTR) ||
294 (FileDirNdx->FI_Flags & UDF_FI_FLAG_LINKED)) {
295 LONG_AD feloc;
296
297 UDFPrint((" !SYS_ATTR\n"));
298 FileEntry = (PFILE_ENTRY)MyAllocatePool__(NonPagedPool, Vcb->LBlockSize);
299 if(!FileEntry) return STATUS_INSUFFICIENT_RESOURCES;
300
301 feloc.extLength = Vcb->LBlockSize;
302 feloc.extLocation = FileDirNdx->FileEntryLoc;
303
304 if(!NT_SUCCESS(status = UDFReadFileEntry(Vcb, &feloc, FileEntry, &Ident))) {
305 UDFPrint((" !UDFReadFileEntry\n"));
306 MyFreePool__(FileEntry);
307 FileEntry = NULL;
308 goto get_name_only;
309 }
310 ReadSizes = TRUE;
311 } else {
312 UDFPrint((" FileDirNdx\n"));
313 NTFileInfo->CreationTime.QuadPart = FileDirNdx->CreationTime;
314 NTFileInfo->LastWriteTime.QuadPart = FileDirNdx->LastWriteTime;
315 NTFileInfo->LastAccessTime.QuadPart = FileDirNdx->LastAccessTime;
316 NTFileInfo->ChangeTime.QuadPart = FileDirNdx->ChangeTime;
317 NTFileInfo->FileAttributes = FileDirNdx->SysAttr;
318 NTFileInfo->AllocationSize.QuadPart = FileDirNdx->AllocationSize;
319 NTFileInfo->EndOfFile.QuadPart = FileDirNdx->FileSize;
320 NTFileInfo->EaSize = 0;
321 FileEntry = NULL;
322 goto get_name_only;
323 }
324
325 if(Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK)
326 goto get_name_only;
327
328 UDFPrint((" direct\n"));
329 if(FileEntry->descTag.tagIdent == TID_FILE_ENTRY) {
330 UDFPrint((" TID_FILE_ENTRY\n"));
331 if(ReadSizes) {
332 UDFPrint((" ReadSizes\n"));
333 // Times
334 FileDirNdx->CreationTime = NTFileInfo->CreationTime.QuadPart =
335 FileDirNdx->LastWriteTime = NTFileInfo->LastWriteTime.QuadPart = UDFTimeToNT(&(FileEntry->modificationTime));
336 FileDirNdx->LastAccessTime = NTFileInfo->LastAccessTime.QuadPart = UDFTimeToNT(&(FileEntry->accessTime));
337 FileDirNdx->ChangeTime = NTFileInfo->ChangeTime.QuadPart = UDFTimeToNT(&(FileEntry->attrTime));
338 // FileSize
339 FileDirNdx->FileSize =
340 NTFileInfo->EndOfFile.QuadPart =
341 FileEntry->informationLength;
342 UDFPrint((" informationLength=%I64x, lengthAllocDescs=%I64x\n",
343 FileEntry->informationLength,
344 FileEntry->lengthAllocDescs
345 ));
346 // AllocSize
347 FileDirNdx->AllocationSize =
348 NTFileInfo->AllocationSize.QuadPart =
349 (FileEntry->informationLength + Vcb->LBlockSize - 1) & ~((LONGLONG)(Vcb->LBlockSize) - 1);
350 }
351// NTFileInfo->EaSize = 0;//FileEntry->lengthExtendedAttr;
352 } else if(FileEntry->descTag.tagIdent == TID_EXTENDED_FILE_ENTRY) {
353 ExFileEntry = (PEXTENDED_FILE_ENTRY)FileEntry;
354 UDFPrint((" PEXTENDED_FILE_ENTRY\n"));
355 if(ReadSizes) {
356 UDFPrint((" ReadSizes\n"));
357 // Times
358 FileDirNdx->CreationTime = NTFileInfo->CreationTime.QuadPart = UDFTimeToNT(&(ExFileEntry->createTime));
359 FileDirNdx->LastWriteTime = NTFileInfo->LastWriteTime.QuadPart = UDFTimeToNT(&(ExFileEntry->modificationTime));
360 FileDirNdx->LastAccessTime = NTFileInfo->LastAccessTime.QuadPart = UDFTimeToNT(&(ExFileEntry->accessTime));
361 FileDirNdx->ChangeTime = NTFileInfo->ChangeTime.QuadPart = UDFTimeToNT(&(ExFileEntry->attrTime));
362 // FileSize
363 FileDirNdx->FileSize =
364 NTFileInfo->EndOfFile.QuadPart =
365 ExFileEntry->informationLength;
366 UDFPrint((" informationLength=%I64x, lengthAllocDescs=%I64x\n",
367 FileEntry->informationLength,
368 FileEntry->lengthAllocDescs
369 ));
370 // AllocSize
371 FileDirNdx->AllocationSize =
372 NTFileInfo->AllocationSize.QuadPart =
373 (ExFileEntry->informationLength + Vcb->LBlockSize - 1) & ~((LONGLONG)(Vcb->LBlockSize) - 1);
374 }
375// NTFileInfo->EaSize = 0;//ExFileEntry->lengthExtendedAttr;
376 } else {
377 UDFPrint((" ???\n"));
378 goto get_name_only;
379 }
380
381get_attr_only:
382
383 UDFPrint((" get_attr"));
384 // do some substitutions
385 if(!FileDirNdx->CreationTime) {
386 FileDirNdx->CreationTime = NTFileInfo->CreationTime.QuadPart = Vcb->VolCreationTime;
387 }
388 if(!FileDirNdx->LastAccessTime) {
389 FileDirNdx->LastAccessTime = NTFileInfo->LastAccessTime.QuadPart = FileDirNdx->CreationTime;
390 }
391 if(!FileDirNdx->LastWriteTime) {
392 FileDirNdx->LastWriteTime = NTFileInfo->LastWriteTime.QuadPart = FileDirNdx->CreationTime;
393 }
394 if(!FileDirNdx->ChangeTime) {
395 FileDirNdx->ChangeTime = NTFileInfo->ChangeTime.QuadPart = FileDirNdx->CreationTime;
396 }
397
398 FileDirNdx->SysAttr =
399 NTFileInfo->FileAttributes = UDFAttributesToNT(FileDirNdx, (tag*)FileEntry);
400 FileDirNdx->FI_Flags |= UDF_FI_FLAG_SYS_ATTR;
401
402get_name_only:
403 // get filename in standard Unicode format
404 UdfName = FileDirNdx->FName;
405 NTFileInfo->FileNameLength = UdfName.Length;
406 RtlCopyMemory((PCHAR)&(NTFileInfo->FileName), (PCHAR)(UdfName.Buffer), UdfName.MaximumLength);
407 if(!(FileDirNdx->FI_Flags & UDF_FI_FLAG_DOS)) {
408 UDFPrint((" !UDF_FI_FLAG_DOS"));
409 UDFDOSName(Vcb, &DosName, &UdfName,
410 (FileDirNdx->FI_Flags & UDF_FI_FLAG_KEEP_NAME) ? TRUE : FALSE);
411 NTFileInfo->ShortNameLength = (UCHAR)DosName.Length;
412 }
413 // report zero EOF & AllocSize for Dirs
414 if(FileDirNdx->FileCharacteristics & FILE_DIRECTORY) {
415 UDFPrint((" FILE_DIRECTORY"));
416 NTFileInfo->AllocationSize.QuadPart =
417 NTFileInfo->EndOfFile.QuadPart = 0;
418 }
419 UDFPrint((" AllocationSize=%I64x, NTFileInfo->EndOfFile=%I64x", NTFileInfo->AllocationSize.QuadPart, NTFileInfo->EndOfFile.QuadPart));
420 // free tmp buffer (if any)
421 UDFPrint(("\n"));
422 if(FileEntry && !FileDirNdx->FileInfo)
423 MyFreePool__(FileEntry);
424 return STATUS_SUCCESS;
425} // end UDFFileDirInfoToNT()
unsigned char BOOLEAN
LONGLONG UDFTimeToNT(IN PUDF_TIME_STAMP UdfTime)
#define TRUE
Definition: types.h:120
#define TID_EXTENDED_FILE_ENTRY
Definition: ecma_167.h:175
#define NtReqFcb
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define Vcb
Definition: cdprocs.h:1415
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
uint64 informationLength
Definition: ecma_167.h:752
timestamp modificationTime
Definition: ecma_167.h:756
timestamp createTime
Definition: ecma_167.h:757
timestamp accessTime
Definition: ecma_167.h:755
timestamp attrTime
Definition: ecma_167.h:758
tag descTag
Definition: ecma_167.h:514
uint32 lengthAllocDescs
Definition: ecma_167.h:534
timestamp modificationTime
Definition: ecma_167.h:526
timestamp accessTime
Definition: ecma_167.h:525
uint64 informationLength
Definition: ecma_167.h:523
timestamp attrTime
Definition: ecma_167.h:527
USHORT MaximumLength
Definition: env_spec_w32.h:370
lb_addr extLocation
Definition: ecma_167.h:375
uint32 extLength
Definition: ecma_167.h:374
Definition: ps.c:97
Definition: ecma_167.h:138
uint16 tagIdent
Definition: ecma_167.h:139
int64_t LONGLONG
Definition: typedefs.h:68
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
uint16 UDFGetFileLinkCount(IN PUDF_FILE_INFO FileInfo)
Definition: udf_info.cpp:1355
void __fastcall UDFDOSName(IN PVCB Vcb, IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
Definition: udf_info.cpp:427
OSSTATUS UDFReadFileEntry(IN PVCB Vcb, IN long_ad *Icb, IN OUT PFILE_ENTRY FileEntry, IN OUT uint16 *Ident)
Definition: udf_info.cpp:306
#define UDF_FI_FLAG_DOS
Definition: udf_rel.h:225
#define UDF_FI_FLAG_KEEP_NAME
Definition: udf_rel.h:226
#define UDFPrint(Args)
Definition: udffs.h:223

Referenced by UDFGetFileStreamInformation(), and UDFQueryDirectory().

◆ UDFGetFileXTime()

VOID UDFGetFileXTime ( IN PUDF_FILE_INFO  FileInfo,
OUT LONGLONG CrtTime,
OUT LONGLONG AccTime,
OUT LONGLONG AttrTime,
OUT LONGLONG ChgTime 
)

Definition at line 501 of file Sys_spec_lib.cpp.

508{
509 USHORT Ident;
510
512
513 Ident = FileInfo->Dloc->FileEntry->tagIdent;
514
515 if(Ident == TID_FILE_ENTRY) {
516 PFILE_ENTRY fe = (PFILE_ENTRY)(FileInfo->Dloc->FileEntry);
517
518 if(AccTime) *AccTime = UDFTimeToNT(&(fe->accessTime));
519 if(AttrTime) *AttrTime = UDFTimeToNT(&(fe->attrTime));
520 if(ChgTime) *ChgTime = UDFTimeToNT(&(fe->modificationTime));
521 if(CrtTime) {
522 (*CrtTime) = *ChgTime;
523 }
524
525 } else if(Ident == TID_EXTENDED_FILE_ENTRY) {
526 PEXTENDED_FILE_ENTRY fe = (PEXTENDED_FILE_ENTRY)(FileInfo->Dloc->FileEntry);
527
528 if(AccTime) *AccTime = UDFTimeToNT(&(fe->accessTime));
529 if(AttrTime) *AttrTime = UDFTimeToNT(&(fe->attrTime));
530 if(ChgTime) *ChgTime = UDFTimeToNT(&(fe->modificationTime));
531 if(CrtTime) *CrtTime = UDFTimeToNT(&(fe->createTime));
532
533 }
534 if(CrtTime) {
535 if(!(*CrtTime))
537 if(AccTime && !(*AccTime)) (*AccTime) = *CrtTime;
538 if(AttrTime && !(*AttrTime)) (*AttrTime) = *CrtTime;
539 if(AccTime && !(*AccTime)) (*AccTime) = *CrtTime;
540 }
541} // end UDFGetFileXTime()
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570

Referenced by UDFCompleteMount(), and UDFFirstOpenFile().

◆ UDFIsDirInfoCached()

BOOLEAN UDFIsDirInfoCached ( IN PVCB  Vcb,
IN PUDF_FILE_INFO  DirInfo 
)

Definition at line 931 of file Sys_spec_lib.cpp.

935{
936 PDIR_INDEX_HDR hDirNdx = DirInfo->Dloc->DirIndex;
937 PDIR_INDEX_ITEM DirNdx;
938 for(uint_di i=2; (DirNdx = UDFDirIndex(hDirNdx,i)); i++) {
939 if(!(DirNdx->FI_Flags & UDF_FI_FLAG_SYS_ATTR) ||
940 (DirNdx->FI_Flags & UDF_FI_FLAG_LINKED)) return FALSE;
941 }
942 return TRUE;
943} // end UDFIsDirInfoCached()
uint8 FI_Flags
Definition: udf_rel.h:199

◆ UDFNormalizeFileName()

VOID UDFNormalizeFileName ( IN PUNICODE_STRING  FName,
IN USHORT  valueCRC 
)

Definition at line 544 of file Sys_spec_lib.cpp.

548{
550 USHORT len;
551
552 len = FName->Length/sizeof(WCHAR);
553 buffer = FName->Buffer;
554
555 // check for '', '.' & '..'
556 if(!len) return;
557 if(!buffer[len-1]) {
558 FName->Length-=sizeof(WCHAR);
559 len--;
560 }
561 if(!len) return;
562 if(buffer[0] == UNICODE_PERIOD) {
563 if(len == 1) return;
564 if((buffer[1] == UNICODE_PERIOD) && (len == 2)) return;
565 }
566
567 // check for trailing '.'
568 for(len--;len;len--) {
569 if( ((buffer[len] == UNICODE_PERIOD) || (buffer[len] == UNICODE_SPACE)) ) {
570 FName->Length-=sizeof(WCHAR);
571 buffer[len] = 0;
572 } else
573 break;
574 }
575} // end UDFNormalizeFileName()
GLuint buffer
Definition: glext.h:5915
GLenum GLsizei len
Definition: glext.h:6722
#define UNICODE_SPACE
Definition: udf_rel.h:424

Referenced by UDFIndexDirectory().

◆ UDFSetFileXTime()

VOID UDFSetFileXTime ( IN PUDF_FILE_INFO  FileInfo,
IN LONGLONG CrtTime,
IN LONGLONG AccTime,
IN LONGLONG AttrTime,
IN LONGLONG ChgTime 
)

Definition at line 434 of file Sys_spec_lib.cpp.

441{
442 USHORT Ident;
443 PDIR_INDEX_ITEM DirNdx;
444
446
447 FileInfo->Dloc->FE_Flags |= UDF_FE_FLAG_FE_MODIFIED;
449 Ident = FileInfo->Dloc->FileEntry->tagIdent;
450
451 if(Ident == TID_FILE_ENTRY) {
452 PFILE_ENTRY fe = (PFILE_ENTRY)(FileInfo->Dloc->FileEntry);
453
454 if(AccTime) {
455 if(DirNdx && *AccTime) DirNdx->LastAccessTime = *AccTime;
456 UDFTimeToUDF(*AccTime, &(fe->accessTime));
457 }
458 if(AttrTime) {
459 if(DirNdx && *AttrTime) DirNdx->ChangeTime = *AttrTime;
460 UDFTimeToUDF(*AttrTime, &(fe->attrTime));
461 }
462 if(ChgTime) {
463 if(DirNdx && *ChgTime) DirNdx->CreationTime =
464 DirNdx->LastWriteTime = *ChgTime;
465 UDFTimeToUDF(*ChgTime, &(fe->modificationTime));
466 } else
467 if(CrtTime) {
468 if(DirNdx && *CrtTime) DirNdx->CreationTime =
469 DirNdx->LastWriteTime = *CrtTime;
470 UDFTimeToUDF(*CrtTime, &(fe->modificationTime));
471 }
472
473 } else if(Ident == TID_EXTENDED_FILE_ENTRY) {
474 PEXTENDED_FILE_ENTRY fe = (PEXTENDED_FILE_ENTRY)(FileInfo->Dloc->FileEntry);
475
476 if(AccTime) {
477 if(DirNdx && *AccTime) DirNdx->LastAccessTime = *AccTime;
478 UDFTimeToUDF(*AccTime, &(fe->accessTime));
479 }
480 if(AttrTime) {
481 if(DirNdx && *AttrTime) DirNdx->ChangeTime = *AttrTime;
482 UDFTimeToUDF(*AttrTime, &(fe->attrTime));
483 }
484 if(ChgTime) {
485 if(DirNdx && *ChgTime) DirNdx->LastWriteTime = *ChgTime;
486 UDFTimeToUDF(*ChgTime, &(fe->modificationTime));
487 }
488 if(CrtTime) {
489 if(DirNdx && *CrtTime) DirNdx->CreationTime = *CrtTime;
490 UDFTimeToUDF(*CrtTime, &(fe->createTime));
491 }
492
493 }
494} // end UDFSetFileXTime()
VOID UDFTimeToUDF(IN LONGLONG NtTime, OUT PUDF_TIME_STAMP UdfTime)
int64 CreationTime
Definition: udf_rel.h:209
int64 LastAccessTime
Definition: udf_rel.h:211
int64 LastWriteTime
Definition: udf_rel.h:210
int64 ChangeTime
Definition: udf_rel.h:212

Referenced by UDFCommonCleanup(), UDFFlushAFile(), and UDFSetBasicInformation().

◆ UDFTimeToNT()

LONGLONG UDFTimeToNT ( IN PUDF_TIME_STAMP  UdfTime)

Definition at line 23 of file Sys_spec_lib.cpp.

26{
29
30 TimeFields.Milliseconds = (USHORT)(UdfTime->centiseconds * 10 + UdfTime->hundredsOfMicroseconds / 100);
31 TimeFields.Second = (USHORT)(UdfTime->second);
32 TimeFields.Minute = (USHORT)(UdfTime->minute);
33 TimeFields.Hour = (USHORT)(UdfTime->hour);
34 TimeFields.Day = (USHORT)(UdfTime->day);
35 TimeFields.Month = (USHORT)(UdfTime->month);
36 TimeFields.Year = (USHORT)((UdfTime->year < 1601) ? 1601 : UdfTime->year);
37
39 NtTime = 0;
40 } else {
42 }
43
44 return NtTime;
45} // end UDFTimeToNT()
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
#define ExLocalTimeToSystemTime(LocTime, SysTime)
Definition: env_spec_w32.h:738
_In_ PLARGE_INTEGER NtTime
Definition: fatprocs.h:1915
static PTIME_FIELDS TimeFields
Definition: time.c:104
USHORT Milliseconds
Definition: env_spec_w32.h:717

Referenced by UDFFileDirInfoToNT(), UDFGetFileXTime(), and UDFLoadPVolDesc().

◆ UDFTimeToUDF()

VOID UDFTimeToUDF ( IN LONGLONG  NtTime,
OUT PUDF_TIME_STAMP  UdfTime 
)

Definition at line 52 of file Sys_spec_lib.cpp.

56{
57 if(!NtTime) return;
58 LONGLONG LocalTime;
59
61
64
65 LocalTime /= 10; // microseconds
66 UdfTime->microseconds = (UCHAR)(NtTime % 100);
67 LocalTime /= 100; // hundreds of microseconds
68 UdfTime->hundredsOfMicroseconds = (UCHAR)(NtTime % 100);
69 LocalTime /= 100; // centiseconds
70 UdfTime->centiseconds = (UCHAR)(TimeFields.Milliseconds / 10);
71 UdfTime->second = (UCHAR)(TimeFields.Second);
72 UdfTime->minute = (UCHAR)(TimeFields.Minute);
73 UdfTime->hour = (UCHAR)(TimeFields.Hour);
74 UdfTime->day = (UCHAR)(TimeFields.Day);
75 UdfTime->month = (UCHAR)(TimeFields.Month);
76 UdfTime->year = (USHORT)(TimeFields.Year);
77 UdfTime->typeAndTimezone = (TIMESTAMP_TYPE_LOCAL << 14);
78} // end UDFTimeToUDF()
#define TIMESTAMP_TYPE_LOCAL
Definition: ecma_167.h:53
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
#define ExSystemTimeToLocalTime(SysTime, LocTime)
Definition: env_spec_w32.h:729

Referenced by UDFSetFileXTime().