ReactOS  0.4.14-dev-55-g2da92ac
Sys_spec_lib.cpp
Go to the documentation of this file.
1 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
3 // All rights reserved
4 // This file was released under the GPLv2 on June 2015.
6 /*************************************************************************
7 *
8 * File: Sys_Spec.cpp
9 *
10 * Module: UDF File System Driver
11 * (both User and Kernel mode execution)
12 *
13 * Description:
14 * Contains system-secific code
15 *
16 *************************************************************************/
17 
18 
19 /*
20  This routine converts UDF timestamp to NT time
21  */
24  IN PUDF_TIME_STAMP UdfTime
25  )
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()
46 
47 
48 /*
49  This routine converts NT time to UDF timestamp
50  */
51 VOID
54  OUT PUDF_TIME_STAMP UdfTime
55  )
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()
79 
80 /*
81  */
82 ULONG
84  IN PDIR_INDEX_ITEM FileDirNdx,
85  IN tag* FileEntry
86  )
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()
143 
144 /*
145  */
146 VOID
148  IN PDIR_INDEX_ITEM FileDirNdx,
149  IN tag* FileEntry,
150  IN ULONG NTAttr
151  )
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()
225 
226 #ifndef _CONSOLE
227 /*
228  This routine fills PFILE_BOTH_DIR_INFORMATION structure (NT)
229  */
230 NTSTATUS
232  IN PVCB Vcb,
233  IN PDIR_INDEX_ITEM FileDirNdx,
235  )
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()
426 
427 #endif //_CONSOLE
428 
429 #ifndef UDF_READ_ONLY_BUILD
430 /*
431  This routine changes xxxTime field(s) in (Ext)FileEntry
432  */
433 VOID
436  IN LONGLONG* CrtTime,
437  IN LONGLONG* AccTime,
438  IN LONGLONG* AttrTime,
439  IN LONGLONG* ChgTime
440  )
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()
495 #endif //UDF_READ_ONLY_BUILD
496 
497 /*
498  This routine gets xxxTime field(s) in (Ext)FileEntry
499  */
500 VOID
503  OUT LONGLONG* CrtTime,
504  OUT LONGLONG* AccTime,
505  OUT LONGLONG* AttrTime,
506  OUT LONGLONG* ChgTime
507  )
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()
542 
543 VOID
545  IN PUNICODE_STRING FName,
546  IN USHORT valueCRC
547  )
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()
576 
577 #ifndef _CONSOLE
578 
579 void
583  IN PUNICODE_STRING UdfName,
584  IN BOOLEAN KeepIntact
585  )
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()
604 
605 #endif //_CONSOLE
606 
607 /*VOID
608 UDFNormalizeFileName(
609  IN PUNICODE_STRING FName,
610  IN USHORT valueCRC
611  )
612 {
613  WCHAR _newName[UDF_NAME_LEN+5];
614  PWCHAR newName = (PWCHAR)(&_newName);
615  PWCHAR udfName = FName->Buffer;
616  LONG udfLen = FName->Length >> 1;
617 
618  LONG index, newIndex = 0, extIndex = 0, newExtIndex = 0, trailIndex = 0;
619  BOOLEAN needsCRC = FALSE, hasExt = FALSE;
620  WCHAR ext[UDF_EXT_SIZE], current;
621 
622  // handle CurrentDir ('.') and ParentDir ('..') cases
623  if((udfLen <= 2) && (udfName[0] == UNICODE_PERIOD)) {
624  if((udfLen != 2) || (udfName[1] == UNICODE_PERIOD))
625  return;
626  }
627 
628  for (index = 0 ; index < udfLen ; index++) {
629  current = udfName[index];
630 
631  // Look for illegal or unprintable characters.
632  if (UDFIsIllegalChar(current) || !UnicodeIsPrint(current)) {
633  needsCRC = TRUE;
634  current = ILLEGAL_CHAR_MARK;
635  // Skip Illegal characters(even spaces),
636  // but not periods.
637  while(index+1 < udfLen &&
638  (UDFIsIllegalChar(udfName[index+1]) ||
639  !UnicodeIsPrint(udfName[index+1])) &&
640  udfName[index+1] != UNICODE_PERIOD)
641  index++;
642  }
643 
644  // Record position of extension, if one is found.
645  if ((current == UNICODE_PERIOD) && ((udfLen - index -1) <= UDF_EXT_SIZE)) {
646  if (udfLen == index + 1) {
647  // A trailing period is NOT an extension.
648  hasExt = FALSE;
649  } else {
650  hasExt = TRUE;
651  extIndex = index;
652  newExtIndex = newIndex;
653  }
654  } else if((current != UNICODE_PERIOD) && (current != UNICODE_SPACE)) {
655  trailIndex = index;
656  }
657 
658 // if (newIndex < MAXLEN) // tshi is always TRUE for WINNT
659  newName[newIndex] = current;
660  newIndex++;
661 
662  // For OS2, 95 & NT, truncate any trailing periods and\or spaces.
663  if (trailIndex != (newIndex - 1)) {
664  newIndex = trailIndex + 1;
665  needsCRC = TRUE;
666  hasExt = FALSE; // Trailing period does not make an extension.
667  }
668  }
669 
670  if (needsCRC) {
671  int localExtIndex = 0;
672  if (hasExt) {
673  int maxFilenameLen;
674  // Translate extension, and store it in ext.
675  for(index = 0; index<UDF_EXT_SIZE && extIndex + index +1 < udfLen; index++ ) {
676  current = udfName[extIndex + index + 1];
677  if (UDFIsIllegalChar(current) //|| !UnicodeIsPrint(current)) {
678  needsCRC = TRUE;
679  // Replace Illegal and non-displayable chars
680  // with underscore.
681  current = ILLEGAL_CHAR_MARK;
682  // Skip any other illegal or non-displayable
683  // characters.
684  while(index + 1 < UDF_EXT_SIZE &&
685  (UDFIsIllegalChar(udfName[extIndex + index + 2]) ||
686  !UnicodeIsPrint(udfName[extIndex + index + 2])) )
687  index++;
688  }
689  ext[localExtIndex++] = current;
690  }
691  // Truncate filename to leave room for extension and CRC.
692  maxFilenameLen = ((UDF_NAME_LEN - 4) - localExtIndex - 1);
693  if (newIndex > maxFilenameLen) {
694  newIndex = maxFilenameLen;
695  } else {
696  newIndex = newExtIndex;
697  }
698  } else if (newIndex > UDF_NAME_LEN - 5) {
699  //If no extension, make sure to leave room for CRC.
700  newIndex = UDF_NAME_LEN - 5;
701  }
702  newName[newIndex++] = UNICODE_CRC_MARK; // Add mark for CRC.
703  //Calculate CRC from original filename from FileIdentifier.
704 // valueCRC = UDFUnicodeCksum(fidName, fidNameLen);
705 // / Convert 16-bits of CRC to hex characters.
706  newName[newIndex++] = hexChar[(valueCRC & 0xf000) >> 12];
707  newName[newIndex++] = hexChar[(valueCRC & 0x0f00) >> 8];
708  newName[newIndex++] = hexChar[(valueCRC & 0x00f0) >> 4];
709  newName[newIndex++] = hexChar[(valueCRC & 0x000f)];
710  // Place a translated extension at end, if found.
711  if (hasExt) {
712  newName[newIndex++] = UNICODE_PERIOD;
713  for (index = 0;index < localExtIndex ;index++ ) {
714  newName[newIndex++] = ext[index];
715  }
716  }
717  }
718 
719  if(FName->Length == (USHORT)newIndex*sizeof(WCHAR)) {
720  RtlCopyMemory(FName->Buffer, newName, newIndex*sizeof(WCHAR));
721  return;
722  }
723  MyFreePool__(FName->Buffer);
724  FName->Buffer = (PWCHAR)MyAllocatePool__(UDF_FILENAME_MT, (newIndex+1)*sizeof(WCHAR));
725  if(FName->Buffer) {
726  FName->Buffer[newIndex] = 0;
727  RtlCopyMemory(FName->Buffer, newName, newIndex*sizeof(WCHAR));
728  }
729  FName->Length = (USHORT)newIndex*sizeof(WCHAR);
730  FName->MaximumLength = (USHORT)(newIndex+1)*sizeof(WCHAR);
731 }*/
732 
733 /*PUDF_FILE_INFO
734 UDFAllocFileInfo(
735  return ExAllocateFromZone(&(UDFGlobalData.FileInfoZoneHeader));
736 )*/
737 
738 #define STRING_BUFFER_ALIGNMENT (32)
739 #define STRING_BUFFER_ALIGN(sz) (((sz)+STRING_BUFFER_ALIGNMENT)&(~((ULONG)(STRING_BUFFER_ALIGNMENT-1))))
740 
741 NTSTATUS
743  IN PUNICODE_STRING Str1,
744  IN PUNICODE_STRING Str2
745 #ifdef UDF_TRACK_UNICODE_STR
746  ,IN PCHAR Tag
747 #endif
748  )
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()
790 
791 NTSTATUS
793  IN PUNICODE_STRING Str1,
794  IN PCWSTR Str2
795 #ifdef UDF_TRACK_UNICODE_STR
796  ,IN PCHAR Tag
797 #endif
798  )
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_()
861 
862 NTSTATUS
864  IN PUNICODE_STRING Str1,
865  IN PCWSTR Str2
866  )
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()
908 
909 NTSTATUS
911  IN PUNICODE_STRING Str1,
912  IN PUNICODE_STRING Str2
913  )
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()
925 
926 /*
927  This routine checks do we needn't read something from disk to
928  obtain Attributes & so on
929  */
930 BOOLEAN
932  IN PVCB Vcb,
933  IN PUDF_FILE_INFO DirInfo
934  )
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()
944 
945 #ifndef UDF_READ_ONLY_BUILD
946 NTSTATUS
949  )
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__()
986 
987 NTSTATUS
990  )
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__()
1017 
1018 NTSTATUS
1021  )
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 }
1040 #endif //UDF_READ_ONLY_BUILD
1041 
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
uint16 tagIdent
Definition: ecma_167.h:139
signed char * PCHAR
Definition: retypes.h:7
int add
Definition: i386-dis.c:3122
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
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
#define PERM_O_CHATTR
Definition: ecma_167.h:543
timestamp attrTime
Definition: ecma_167.h:527
#define PERM_U_READ
Definition: ecma_167.h:552
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
Definition: crypt_des.c:251
Type
Definition: Type.h:6
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define PERM_U_EXEC
Definition: ecma_167.h:550
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
#define __fastcall
Definition: sync.c:41
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
NTSTATUS MyAppendUnicodeToString_(IN PUNICODE_STRING Str1, IN PCWSTR Str2)
#define FILE_HIDDEN
Definition: ecma_167.h:438
unsigned int uint32
Definition: types.h:32
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
ULONG MyReallocPool__(PCHAR addr, ULONG len, PCHAR *pnewaddr, ULONG newlen)
Definition: mem_tools.h:224
#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
struct _FILE_ENTRY * PFILE_ENTRY
NTSTATUS UDFFileDirInfoToNT(IN PVCB Vcb, IN PDIR_INDEX_ITEM FileDirNdx, OUT PFILE_BOTH_DIR_INFORMATION NTFileInfo)
timestamp modificationTime
Definition: ecma_167.h:756
#define UDF_FI_FLAG_KEEP_NAME
Definition: udf_rel.h:226
#define PERM_U_DELETE
Definition: ecma_167.h:554
#define ICB_FLAG_ARCHIVE
Definition: ecma_167.h:483
Definition: ecma_167.h:138
Definition: cdstruc.h:504
GLuint buffer
Definition: glext.h:5915
lb_addr extLocation
Definition: ecma_167.h:375
uint16_t * PWCHAR
Definition: typedefs.h:54
NTSTATUS UDFCheckAccessRights(PFILE_OBJECT FileObject, PACCESS_STATE AccessState, PtrUDFFCB Fcb, PtrUDFCCB Ccb, ACCESS_MASK DesiredAccess, USHORT ShareAccess)
Definition: secursup.cpp:927
#define cmp(status, error)
Definition: error.c:114
#define UDF_FI_FLAG_FI_MODIFIED
FileIdent was modified & should be flushed.
Definition: udf_rel.h:217
#define UNICODE_SPACE
Definition: udf_rel.h:424
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
timestamp accessTime
Definition: ecma_167.h:755
uint32 uint_di
Definition: udf_rel.h:29
_SEH2_TRY
Definition: create.c:4250
#define STRING_BUFFER_ALIGN(sz)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID UDFGetFileXTime(IN PUDF_FILE_INFO FileInfo, OUT LONGLONG *CrtTime, OUT LONGLONG *AccTime, OUT LONGLONG *AttrTime, OUT LONGLONG *ChgTime)
#define TID_EXTENDED_FILE_ENTRY
Definition: ecma_167.h:175
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 PERM_O_READ
Definition: ecma_167.h:542
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
Definition: dirtree.cpp:1092
NTSTATUS UDFDoesOSAllowFileToBeTargetForRename__(IN PUDF_FILE_INFO FileInfo)
#define UDFIsADirectory(FileInfo)
Definition: udf_info.h:792
#define PERM_G_WRITE
Definition: ecma_167.h:546
#define ICB_FLAG_SYSTEM
Definition: ecma_167.h:488
static PVOID ptr
Definition: dispmode.c:27
uint64 informationLength
Definition: ecma_167.h:752
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
uint8 FileCharacteristics
Definition: udf_rel.h:182
smooth NULL
Definition: ftsmooth.c:416
#define FILE_DELETED
Definition: ecma_167.h:440
int64 LastAccessTime
Definition: udf_rel.h:211
#define UDF_FE_FLAG_FE_MODIFIED
Was modified & should be flushed.
Definition: udf_rel.h:323
USHORT Milliseconds
Definition: env_spec_w32.h:717
#define ExSystemTimeToLocalTime(SysTime, LocTime)
Definition: env_spec_w32.h:729
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
NTSTATUS UDFDoesOSAllowFileToBeUnlinked__(IN PUDF_FILE_INFO FileInfo)
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
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
NTSTATUS MyCloneUnicodeString(IN PUNICODE_STRING Str1, IN PUNICODE_STRING Str2)
LONGLONG UDFTimeToNT(IN PUDF_TIME_STAMP UdfTime)
#define UDF_FILE_TYPE_DIRECTORY
Definition: ecma_167.h:468
int64 CreationTime
Definition: udf_rel.h:209
timestamp attrTime
Definition: ecma_167.h:758
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PERM_G_DELETE
Definition: ecma_167.h:549
uint64 informationLength
Definition: ecma_167.h:523
#define Vcb
Definition: cdprocs.h:1425
BOOLEAN UDFIsDirInfoCached(IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo)
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define BrutePoint()
Definition: env_spec_w32.h:504
void __fastcall UDFDOSName(IN PVCB Vcb, IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
Definition: udf_info.cpp:427
VOID UDFSetFileXTime(IN PUDF_FILE_INFO FileInfo, IN LONGLONG *CrtTime, IN LONGLONG *AccTime, IN LONGLONG *AttrTime, IN LONGLONG *ChgTime)
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
VOID UDFTimeToUDF(IN LONGLONG NtTime, OUT PUDF_TIME_STAMP UdfTime)
Definition: cookie.c:170
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
Definition: synth_sse3d.h:83
#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
Definition: ecma_167.h:513
int64 ChangeTime
Definition: udf_rel.h:212
#define NtReqFcb
#define STATUS_CANNOT_DELETE
Definition: shellext.h:66
unsigned char UCHAR
Definition: xmlstorage.h:181
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
#define PERM_U_CHATTR
Definition: ecma_167.h:553
_In_ PLARGE_INTEGER NtTime
Definition: fatprocs.h:1905
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define UDF_FCB_DELETED
Definition: struct.h:314
__u8 attr
Definition: mkdosfs.c:359
static const WCHAR L[]
Definition: oid.c:1250
#define PERM_O_WRITE
Definition: ecma_167.h:541
uint32 lengthAllocDescs
Definition: ecma_167.h:534
#define UDF_VALID_FILE_ATTRIBUTES
Definition: udffs.h:64
GLenum GLsizei len
Definition: glext.h:6722
timestamp createTime
Definition: ecma_167.h:757
VOID UDFNormalizeFileName(IN PUNICODE_STRING FName, IN USHORT valueCRC)
NTSTATUS MyAppendUnicodeStringToString_(IN PUNICODE_STRING Str1, IN PUNICODE_STRING Str2)
int64 LastWriteTime
Definition: udf_rel.h:210
#define TIMESTAMP_TYPE_LOCAL
Definition: ecma_167.h:53
tag descTag
Definition: ecma_167.h:514
VOID UDFAttributesToUDF(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry, IN ULONG NTAttr)
_SEH2_END
Definition: create.c:4424
#define PERM_U_WRITE
Definition: ecma_167.h:551
unsigned short USHORT
Definition: pedump.c:61
#define ExLocalTimeToSystemTime(LocTime, SysTime)
Definition: env_spec_w32.h:738
NTSYSAPI VOID NTAPI RtlGenerate8dot3Name(_In_ PCUNICODE_STRING Name, _In_ BOOLEAN AllowExtendedCharacters, _Inout_ PGENERATE_NAME_CONTEXT Context, _Inout_ PUNICODE_STRING Name8dot3)
struct _UDF_FILE_INFO * FileInfo
Definition: udf_rel.h:204
#define UDF_FILE_TYPE_STREAMDIR
Definition: ecma_167.h:477
_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
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
unsigned int * PULONG
Definition: retypes.h:1
ULONG UDFAttributesToNT(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry)
const WCHAR * word
Definition: lex.c:78
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
#define PERM_G_CHATTR
Definition: ecma_167.h:548
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
uint32 extLength
Definition: ecma_167.h:374
#define UNICODE_PERIOD
Definition: udf_rel.h:423
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
void __fastcall UDFDOSNameOsNative(IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
#define TID_FILE_ENTRY
Definition: ecma_167.h:170
timestamp modificationTime
Definition: ecma_167.h:526
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
static PTIME_FIELDS TimeFields
Definition: time.c:104
uint8 FI_Flags
Definition: udf_rel.h:199
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
NTSTATUS UDFDoesOSAllowFilePretendDeleted__(IN PUDF_FILE_INFO FileInfo)
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 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 DELETE
Definition: nt_native.h:57
#define PERM_O_DELETE
Definition: ecma_167.h:544
NTSTATUS MyInitUnicodeString(IN PUNICODE_STRING Str1, IN PCWSTR Str2)
#define PERM_G_EXEC
Definition: ecma_167.h:545
uint16 UDFGetFileLinkCount(IN PUDF_FILE_INFO FileInfo)
Definition: udf_info.cpp:1355
jmp_buf jmp
Definition: mach.c:35
Definition: ps.c:97