ReactOS  0.4.14-dev-114-gc8cbd56
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()
signed char * PCHAR
Definition: retypes.h:7
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ULONG MyReallocPool__(PCHAR addr, ULONG len, PCHAR *pnewaddr, ULONG newlen)
Definition: mem_tools.h:224
uint16_t * PWCHAR
Definition: typedefs.h:54
#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
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
unsigned short USHORT
Definition: pedump.c:61
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ 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
816 Scan_1:
817  __asm cmp [word ptr esi+ebx],0
818  __asm je EO_Scan
819  __asm add ebx,2
820  __asm jmp Scan_1
821 EO_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_()
signed char * PCHAR
Definition: retypes.h:7
int add
Definition: i386-dis.c:3122
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
Definition: crypt_des.c:251
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx eax jnz xchgl ecx incl TEMP esi
Definition: synth_sse3d.h:103
ULONG MyReallocPool__(PCHAR addr, ULONG len, PCHAR *pnewaddr, ULONG newlen)
Definition: mem_tools.h:224
uint16_t * PWCHAR
Definition: typedefs.h:54
#define cmp(status, error)
Definition: error.c:114
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
#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
static PVOID ptr
Definition: dispmode.c:27
__wchar_t WCHAR
Definition: xmlstorage.h:180
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
Definition: synth_sse3d.h:83
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned short USHORT
Definition: pedump.c:61
const WCHAR * word
Definition: lex.c:78
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
return STATUS_SUCCESS
Definition: btrfs.c:2966
jmp_buf jmp
Definition: mach.c:35

◆ 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()
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
uint16_t * PWCHAR
Definition: typedefs.h:54
#define STRING_BUFFER_ALIGN(sz)
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
return STATUS_SUCCESS
Definition: btrfs.c:2966

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
878 Scan_1:
879  __asm cmp [word ptr esi+ebx],0
880  __asm je EO_Scan
881  __asm add ebx,2
882  __asm jmp Scan_1
883 EO_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()
int add
Definition: i386-dis.c:3122
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
Definition: crypt_des.c:251
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx eax jnz xchgl ecx incl TEMP esi
Definition: synth_sse3d.h:103
uint16_t * PWCHAR
Definition: typedefs.h:54
#define cmp(status, error)
Definition: error.c:114
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
#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
static PVOID ptr
Definition: dispmode.c:27
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
__wchar_t WCHAR
Definition: xmlstorage.h:180
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
Definition: synth_sse3d.h:83
unsigned short USHORT
Definition: pedump.c:61
const WCHAR * word
Definition: lex.c:78
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
return STATUS_SUCCESS
Definition: btrfs.c:2966
jmp_buf jmp
Definition: mach.c:35

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 
122  if((Type == UDF_FILE_TYPE_DIRECTORY) ||
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:6
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define FILE_HIDDEN
Definition: ecma_167.h:438
struct _FILE_ENTRY * PFILE_ENTRY
#define PERM_U_DELETE
Definition: ecma_167.h:554
#define ICB_FLAG_ARCHIVE
Definition: ecma_167.h:483
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define PERM_G_WRITE
Definition: ecma_167.h:546
#define ICB_FLAG_SYSTEM
Definition: ecma_167.h:488
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define UDF_FI_FLAG_LINKED
Related FileEntry has more than one FileIdent. It happends when we use HardLinks.
Definition: udf_rel.h:223
Definition: ecma_167.h:742
#define UDF_FILE_TYPE_DIRECTORY
Definition: ecma_167.h:468
#define PERM_G_DELETE
Definition: ecma_167.h:549
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
Definition: cookie.c:170
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define FILE_DIRECTORY
Definition: ecma_167.h:439
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
Definition: ecma_167.h:513
unsigned char UCHAR
Definition: xmlstorage.h:181
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
#define PERM_O_WRITE
Definition: ecma_167.h:541
#define PERM_U_WRITE
Definition: ecma_167.h:551
unsigned short USHORT
Definition: pedump.c:61
#define UDF_FILE_TYPE_STREAMDIR
Definition: ecma_167.h:477
struct _EXTENDED_FILE_ENTRY * PEXTENDED_FILE_ENTRY
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
unsigned int ULONG
Definition: retypes.h:1
#define TID_FILE_ENTRY
Definition: ecma_167.h:170
#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 PERM_O_DELETE
Definition: ecma_167.h:544

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
154  PUSHORT Flags;
155  PUCHAR Type;
156  PUCHAR FCharact;
157 
158  NTAttr &= UDF_VALID_FILE_ATTRIBUTES;
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) ||
180  (*Type == UDF_FILE_TYPE_STREAMDIR) ||
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_O_CHATTR
Definition: ecma_167.h:543
#define PERM_U_READ
Definition: ecma_167.h:552
Type
Definition: Type.h:6
#define PERM_U_EXEC
Definition: ecma_167.h:550
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define FILE_HIDDEN
Definition: ecma_167.h:438
unsigned char * PUCHAR
Definition: retypes.h:3
struct _FILE_ENTRY * PFILE_ENTRY
#define PERM_U_DELETE
Definition: ecma_167.h:554
#define ICB_FLAG_ARCHIVE
Definition: ecma_167.h:483
#define UDF_FI_FLAG_FI_MODIFIED
FileIdent was modified & should be flushed.
Definition: udf_rel.h:217
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define PERM_O_READ
Definition: ecma_167.h:542
#define PERM_G_WRITE
Definition: ecma_167.h:546
#define ICB_FLAG_SYSTEM
Definition: ecma_167.h:488
#define UDF_FE_FLAG_FE_MODIFIED
Was modified & should be flushed.
Definition: udf_rel.h:323
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define UDF_FILE_TYPE_DIRECTORY
Definition: ecma_167.h:468
#define PERM_G_DELETE
Definition: ecma_167.h:549
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
Definition: cookie.c:170
#define UDF_FILE_TYPE_REGULAR
Definition: ecma_167.h:469
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define FILE_DIRECTORY
Definition: ecma_167.h:439
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
#define PERM_U_CHATTR
Definition: ecma_167.h:553
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
__u8 attr
Definition: mkdosfs.c:359
#define PERM_O_WRITE
Definition: ecma_167.h:541
#define UDF_VALID_FILE_ATTRIBUTES
Definition: udffs.h:64
#define PERM_U_WRITE
Definition: ecma_167.h:551
#define UDF_FILE_TYPE_STREAMDIR
Definition: ecma_167.h:477
struct _EXTENDED_FILE_ENTRY * PEXTENDED_FILE_ENTRY
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
unsigned int * PULONG
Definition: retypes.h:1
#define PERM_G_CHATTR
Definition: ecma_167.h:548
#define TID_FILE_ENTRY
Definition: ecma_167.h:170
unsigned short * PUSHORT
Definition: retypes.h:2
#define PERM_G_READ
Definition: ecma_167.h:547
#define PERM_O_EXEC
Definition: ecma_167.h:540
#define PERM_O_DELETE
Definition: ecma_167.h:544
#define PERM_G_EXEC
Definition: ecma_167.h:545

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 }
#define UDF_FCB_DELETE_ON_CLOSE
Definition: struct.h:309
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
Definition: udf_info.h:1105
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
Definition: dirtree.cpp:1092
uint8 FileCharacteristics
Definition: udf_rel.h:182
#define FILE_DELETED
Definition: ecma_167.h:440
#define BrutePoint()
Definition: env_spec_w32.h:504
#define STATUS_CANNOT_DELETE
Definition: shellext.h:66
#define UDF_FCB_DELETED
Definition: struct.h:314
return STATUS_SUCCESS
Definition: btrfs.c:2966

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 
956  return STATUS_ACCESS_DENIED;
957  if(!FileInfo->ParentFile)
958  return STATUS_ACCESS_DENIED;
959 
961  FileInfo->Dloc->FileEntry) & FILE_ATTRIBUTE_READONLY)
962  return STATUS_ACCESS_DENIED;
963 
964  if(!FileInfo->Fcb)
965  return STATUS_SUCCESS;
966 #ifndef _CONSOLE
967  RC = UDFCheckAccessRights(NULL, NULL, FileInfo->Fcb, NULL, DELETE, 0);
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;*/
983  return STATUS_ACCESS_DENIED;
984 
985 } // end UDFDoesOSAllowFileToBeTargetForRename__()
LONG NTSTATUS
Definition: precomp.h:26
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
Definition: udf_info.h:1105
NTSTATUS UDFCheckAccessRights(PFILE_OBJECT FileObject, PACCESS_STATE AccessState, PtrUDFFCB Fcb, PtrUDFCCB Ccb, ACCESS_MASK DesiredAccess, USHORT ShareAccess)
Definition: secursup.cpp:927
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
Definition: dirtree.cpp:1092
#define UDFIsADirectory(FileInfo)
Definition: udf_info.h:792
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
ULONG UDFAttributesToNT(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry)
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define DELETE
Definition: nt_native.h:57

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__()
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
Definition: udf_info.h:1105
uint32 uint_di
Definition: udf_rel.h:29
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
#define UDFIsADirectory(FileInfo)
Definition: udf_info.h:792
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_CANNOT_DELETE
Definition: shellext.h:66
struct _UDF_FILE_INFO * FileInfo
Definition: udf_rel.h:204
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ 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  }
600  RtlZeroMemory(&Ctx, sizeof(GENERATE_NAME_CONTEXT));
601  RtlGenerate8dot3Name(UdfName, FALSE, &Ctx, DosName);
602 
603 } // UDFDOSNameOsNative()
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
unsigned int uint32
Definition: types.h:32
uint16_t * PWCHAR
Definition: typedefs.h:54
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSYSAPI VOID NTAPI RtlGenerate8dot3Name(_In_ PCUNICODE_STRING Name, _In_ BOOLEAN AllowExtendedCharacters, _Inout_ PGENERATE_NAME_CONTEXT Context, _Inout_ PUNICODE_STRING Name8dot3)
_Out_ PUNICODE_STRING DosName
Definition: rtlfuncs.h:1270
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define UNICODE_PERIOD
Definition: udf_rel.h:423

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 
381 get_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 
402 get_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()
uint16 tagIdent
Definition: ecma_167.h:139
signed char * PCHAR
Definition: retypes.h:7
timestamp accessTime
Definition: ecma_167.h:525
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
OSSTATUS UDFReadFileEntry(IN PVCB Vcb, IN long_ad *Icb, IN OUT PFILE_ENTRY FileEntry, IN OUT uint16 *Ident)
Definition: udf_info.cpp:306
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
timestamp attrTime
Definition: ecma_167.h:527
USHORT MaximumLength
Definition: env_spec_w32.h:370
LONG NTSTATUS
Definition: precomp.h:26
struct _FILE_ENTRY * PFILE_ENTRY
timestamp modificationTime
Definition: ecma_167.h:756
#define UDF_FI_FLAG_KEEP_NAME
Definition: udf_rel.h:226
Definition: ecma_167.h:138
lb_addr extLocation
Definition: ecma_167.h:375
uint16_t * PWCHAR
Definition: typedefs.h:54
timestamp accessTime
Definition: ecma_167.h:755
_SEH2_TRY
Definition: create.c:4250
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
#define TID_EXTENDED_FILE_ENTRY
Definition: ecma_167.h:175
uint64 informationLength
Definition: ecma_167.h:752
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
int64_t LONGLONG
Definition: typedefs.h:66
#define UDF_FI_FLAG_LINKED
Related FileEntry has more than one FileIdent. It happends when we use HardLinks.
Definition: udf_rel.h:223
Definition: ecma_167.h:742
LONGLONG UDFTimeToNT(IN PUDF_TIME_STAMP UdfTime)
timestamp attrTime
Definition: ecma_167.h:758
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
uint64 informationLength
Definition: ecma_167.h:523
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
void __fastcall UDFDOSName(IN PVCB Vcb, IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
Definition: udf_info.cpp:427
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define FILE_DIRECTORY
Definition: ecma_167.h:439
Definition: ecma_167.h:513
#define NtReqFcb
unsigned char UCHAR
Definition: xmlstorage.h:181
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
uint32 lengthAllocDescs
Definition: ecma_167.h:534
timestamp createTime
Definition: ecma_167.h:757
tag descTag
Definition: ecma_167.h:514
_SEH2_END
Definition: create.c:4424
unsigned short USHORT
Definition: pedump.c:61
_Out_ PUNICODE_STRING DosName
Definition: rtlfuncs.h:1270
struct _EXTENDED_FILE_ENTRY * PEXTENDED_FILE_ENTRY
#define UDF_FI_FLAG_DOS
Definition: udf_rel.h:225
ULONG UDFAttributesToNT(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
uint32 extLength
Definition: ecma_167.h:374
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define TID_FILE_ENTRY
Definition: ecma_167.h:170
timestamp modificationTime
Definition: ecma_167.h:526
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
#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
uint16 UDFGetFileLinkCount(IN PUDF_FILE_INFO FileInfo)
Definition: udf_info.cpp:1355
Definition: ps.c:97

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
timestamp accessTime
Definition: ecma_167.h:525
timestamp attrTime
Definition: ecma_167.h:527
struct _FILE_ENTRY * PFILE_ENTRY
timestamp modificationTime
Definition: ecma_167.h:756
timestamp accessTime
Definition: ecma_167.h:755
#define TID_EXTENDED_FILE_ENTRY
Definition: ecma_167.h:175
Definition: ecma_167.h:742
LONGLONG UDFTimeToNT(IN PUDF_TIME_STAMP UdfTime)
timestamp attrTime
Definition: ecma_167.h:758
Definition: ecma_167.h:513
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
timestamp createTime
Definition: ecma_167.h:757
unsigned short USHORT
Definition: pedump.c:61
struct _EXTENDED_FILE_ENTRY * PEXTENDED_FILE_ENTRY
#define TID_FILE_ENTRY
Definition: ecma_167.h:170
timestamp modificationTime
Definition: ecma_167.h:526

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()
#define TRUE
Definition: types.h:120
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
Definition: udf_info.h:1105
uint32 uint_di
Definition: udf_rel.h:29
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
#define UDF_FI_FLAG_LINKED
Related FileEntry has more than one FileIdent. It happends when we use HardLinks.
Definition: udf_rel.h:223
uint8 FI_Flags
Definition: udf_rel.h:199
#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

◆ UDFNormalizeFileName()

VOID UDFNormalizeFileName ( IN PUNICODE_STRING  FName,
IN USHORT  valueCRC 
)

Definition at line 544 of file Sys_spec_lib.cpp.

548 {
549  PWCHAR buffer;
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
uint16_t * PWCHAR
Definition: typedefs.h:54
#define UNICODE_SPACE
Definition: udf_rel.h:424
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
unsigned short USHORT
Definition: pedump.c:61
#define UNICODE_PERIOD
Definition: udf_rel.h:423

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()
timestamp accessTime
Definition: ecma_167.h:525
timestamp attrTime
Definition: ecma_167.h:527
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
Definition: udf_info.h:1105
struct _FILE_ENTRY * PFILE_ENTRY
timestamp modificationTime
Definition: ecma_167.h:756
timestamp accessTime
Definition: ecma_167.h:755
#define TID_EXTENDED_FILE_ENTRY
Definition: ecma_167.h:175
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
Definition: dirtree.cpp:1092
int64 LastAccessTime
Definition: udf_rel.h:211
#define UDF_FE_FLAG_FE_MODIFIED
Was modified & should be flushed.
Definition: udf_rel.h:323
Definition: ecma_167.h:742
int64 CreationTime
Definition: udf_rel.h:209
timestamp attrTime
Definition: ecma_167.h:758
VOID UDFTimeToUDF(IN LONGLONG NtTime, OUT PUDF_TIME_STAMP UdfTime)
Definition: ecma_167.h:513
int64 ChangeTime
Definition: udf_rel.h:212
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
timestamp createTime
Definition: ecma_167.h:757
int64 LastWriteTime
Definition: udf_rel.h:210
unsigned short USHORT
Definition: pedump.c:61
struct _EXTENDED_FILE_ENTRY * PEXTENDED_FILE_ENTRY
#define TID_FILE_ENTRY
Definition: ecma_167.h:170
timestamp modificationTime
Definition: ecma_167.h:526

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()
USHORT Milliseconds
Definition: env_spec_w32.h:717
int64_t LONGLONG
Definition: typedefs.h:66
_In_ PLARGE_INTEGER NtTime
Definition: fatprocs.h:1905
unsigned short USHORT
Definition: pedump.c:61
#define ExLocalTimeToSystemTime(LocTime, SysTime)
Definition: env_spec_w32.h:738
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
static PTIME_FIELDS TimeFields
Definition: time.c:104

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()
USHORT Milliseconds
Definition: env_spec_w32.h:717
#define ExSystemTimeToLocalTime(SysTime, LocTime)
Definition: env_spec_w32.h:729
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
int64_t LONGLONG
Definition: typedefs.h:66
unsigned char UCHAR
Definition: xmlstorage.h:181
_In_ PLARGE_INTEGER NtTime
Definition: fatprocs.h:1905
#define TIMESTAMP_TYPE_LOCAL
Definition: ecma_167.h:53
unsigned short USHORT
Definition: pedump.c:61
static PTIME_FIELDS TimeFields
Definition: time.c:104

Referenced by UDFSetFileXTime().