ReactOS 0.4.15-dev-8127-g6338913
Sys_spec_lib.h
Go to the documentation of this file.
1
2// 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_lib.h
9*
10* Module: UDF File System Driver (Kernel mode execution only)
11*
12* Description:
13* The main include file for the UDF file system driver.
14*
15* Author: Alter
16*
17*************************************************************************/
18
19#ifndef _UDF_SYS_SPEC_LIB__H_
20#define _UDF_SYS_SPEC_LIB__H_
21
22typedef struct _UDF_PH_CALL_CONTEXT {
26
27#ifdef _BROWSE_UDF_
28
29// convert UDF timestamp to NT time
31// translate UDF file attributes to NT ones
33 IN tag* FileEntry);
34// translate NT file attributes to UDF ones
36 IN tag* FileEntry,
37 IN ULONG NTAttr);
38// translate all file information to NT
40 IN PDIR_INDEX_ITEM FileDirNdx,
42// convert NT time to UDF timestamp
44 OUT PUDF_TIME_STAMP UdfTime);
45// change xxxTime field(s) in (Ext)FileEntry
47 IN LONGLONG* CrtTime,
48 IN LONGLONG* AccTime,
49 IN LONGLONG* AttrTime,
50 IN LONGLONG* ChgTime);
51// get xxxTime field(s) in (Ext)FileEntry
53 OUT LONGLONG* CrtTime,
54 OUT LONGLONG* AccTime,
55 OUT LONGLONG* AttrTime,
56 OUT LONGLONG* ChgTime);
57//
58#define UDFUpdateAccessTime(Vcb, FileInfo) \
59if(Vcb->CompatFlags & UDF_VCB_IC_UPDATE_ACCESS_TIME) { \
60 LONGLONG NtTime; \
61 KeQuerySystemTime((PLARGE_INTEGER)&NtTime); \
62 UDFSetFileXTime(FileInfo, NULL, &NtTime, NULL, NULL); \
63}
64//
65#define UDFUpdateModifyTime(Vcb, FileInfo) \
66if(Vcb->CompatFlags & UDF_VCB_IC_UPDATE_MODIFY_TIME) { \
67 LONGLONG NtTime; \
68 ULONG Attr; \
69 PDIR_INDEX_ITEM DirNdx; \
70 KeQuerySystemTime((PLARGE_INTEGER)&NtTime); \
71 UDFSetFileXTime(FileInfo, NULL, &NtTime, NULL, &NtTime); \
72 DirNdx = UDFDirIndex(UDFGetDirIndexByFileInfo(FileInfo), (FileInfo)->Index); \
73 Attr = UDFAttributesToNT(DirNdx, (FileInfo)->Dloc->FileEntry); \
74 if(!(Attr & FILE_ATTRIBUTE_ARCHIVE)) \
75 UDFAttributesToUDF(DirNdx, (FileInfo)->Dloc->FileEntry, Attr); \
76}
77//
78#define UDFUpdateAttrTime(Vcb, FileInfo) \
79if(Vcb->CompatFlags & UDF_VCB_IC_UPDATE_ATTR_TIME) { \
80 LONGLONG NtTime; \
81 KeQuerySystemTime((PLARGE_INTEGER)&NtTime); \
82 UDFSetFileXTime(FileInfo, NULL, &NtTime, &NtTime, NULL); \
83}
84//
85#define UDFUpdateCreateTime(Vcb, FileInfo) \
86{ \
87 LONGLONG NtTime; \
88 KeQuerySystemTime((PLARGE_INTEGER)&NtTime); \
89 UDFSetFileXTime(FileInfo, &NtTime, &NtTime, &NtTime, &NtTime); \
90}
91
92void
96 IN PUNICODE_STRING UdfName,
97 IN BOOLEAN KeepIntact
98 );
99
101 IN USHORT valueCRC);
102
105#ifdef UDF_TRACK_UNICODE_STR
106 ,IN PCHAR Tag
107#endif
108 );
109
111 IN PCWSTR Str2
112#ifdef UDF_TRACK_UNICODE_STR
113 ,IN PCHAR Tag
114#endif
115 );
116
117#ifdef UDF_TRACK_UNICODE_STR
118 #define MyAppendUnicodeStringToString(s1,s2) MyAppendUnicodeStringToString_(s1,s2,"AppUStr")
119 #define MyAppendUnicodeStringToStringTag(s1,s2,tag) MyAppendUnicodeStringToString_(s1,s2,tag)
120 #define MyAppendUnicodeToString(s1,s2) MyAppendUnicodeToString_(s1,s2,"AppStr")
121 #define MyAppendUnicodeToStringTag(s1,s2,tag) MyAppendUnicodeToString_(s1,s2,tag)
122#else
123 #define MyAppendUnicodeStringToString(s1,s2) MyAppendUnicodeStringToString_(s1,s2)
124 #define MyAppendUnicodeStringToStringTag(s1,s2,tag) MyAppendUnicodeStringToString_(s1,s2)
125 #define MyAppendUnicodeToString(s1,s2) MyAppendUnicodeToString_(s1,s2)
126 #define MyAppendUnicodeToStringTag(s1,s2,tag) MyAppendUnicodeToString_(s1,s2)
127#endif
128
130 IN PCWSTR Str2);
131
133 IN PUNICODE_STRING Str2);
134
135/*ULONG MyCompareUnicodeString(PUNICODE_STRING s1,
136 PUNICODE_STRING s2,
137 BOOLEAN UpCase);*/
138
139/*
140#define UDFAllocFileInfo() \
141 ExAllocateFromZone(&(UDFGlobalData.FileInfoZoneHeader))
142*/
143
144#define UDFIsDataCached(Vcb,Lba,BCount) \
145 ( WCacheIsInitialized__(&((Vcb)->FastCache)) && \
146 (KeGetCurrentIrql() < DISPATCH_LEVEL) && \
147 WCacheIsCached__(&((Vcb)->FastCache),Lba, BCount) )
148
150 IN PUDF_FILE_INFO DirInfo);
151
152#define UDFGetNTFileId(Vcb, fi, fn) (((fi)->Dloc->FELoc.Mapping[0].extLocation - UDFPartStart(Vcb, -2)) + \
153 ((ULONG)(UDFUnicodeCksum((fn)->Buffer, (fn)->Length/sizeof(WCHAR))) << 16) + \
154 ((LONGLONG)Vcb<<32) )
155
156#define UnicodeIsPrint(a) RtlIsValidOemCharacter(&(a))
157
158#define UDFSysGetAllocSize(Vcb, Size) ((Size + Vcb->LBlockSize - 1) & ~((LONGLONG)(Vcb->LBlockSize - 1)))
159
161#define UDFDoesOSAllowFileToBeTargetForHLink__ UDFDoesOSAllowFileToBeTargetForRename__
163#define UDFDoesOSAllowFileToBeMoved__ UDFDoesOSAllowFileToBeUnlinked__
165BOOLEAN UDFRemoveOSReferences__(IN PUDF_FILE_INFO FileInfo);
166
167#define UDFIsFSDevObj(DeviceObject) \
168 (DeviceObject->DeviceExtension && \
169 ( (((PVCB)(DeviceObject->DeviceExtension))->NodeIdentifier.NodeType == \
170 UDF_NODE_TYPE_UDFFS_DEVOBJ) || \
171 (((PVCB)(DeviceObject->DeviceExtension))->NodeIdentifier.NodeType == \
172 UDF_NODE_TYPE_UDFFS_DRVOBJ) \
173 ) \
174 )
175/*
176extern ULONG MajorVersion;
177extern ULONG MinorVersion;
178extern ULONG BuildNumber;
179
180#define WinVer_Is351 (MajorVersion==0x03 && MinorVersion==51)
181#define WinVer_IsNT (MajorVersion==0x04)
182#define WinVer_Is2k (MajorVersion==0x05 && MinorVersion==0x00)
183#define WinVer_IsXP (MajorVersion==0x05 && MinorVersion==0x01)
184#define WinVer_IsdNET (MajorVersion==0x05 && MinorVersion==0x02)
185*/
186#endif //_BROWSE_UDF_
187
188#endif // _UDF_SYS_SPEC_LIB__H_
unsigned char BOOLEAN
BOOLEAN UDFIsDirInfoCached(IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo)
NTSTATUS MyAppendUnicodeStringToString_(IN PUNICODE_STRING Str1, IN PUNICODE_STRING Str2)
VOID UDFSetFileXTime(IN PUDF_FILE_INFO FileInfo, IN LONGLONG *CrtTime, IN LONGLONG *AccTime, IN LONGLONG *AttrTime, IN LONGLONG *ChgTime)
VOID UDFAttributesToUDF(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry, IN ULONG NTAttr)
NTSTATUS MyAppendUnicodeToString_(IN PUNICODE_STRING Str1, IN PCWSTR Str2)
ULONG UDFAttributesToNT(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry)
NTSTATUS MyCloneUnicodeString(IN PUNICODE_STRING Str1, IN PUNICODE_STRING Str2)
NTSTATUS UDFDoesOSAllowFileToBeUnlinked__(IN PUDF_FILE_INFO FileInfo)
LONGLONG UDFTimeToNT(IN PUDF_TIME_STAMP UdfTime)
VOID UDFGetFileXTime(IN PUDF_FILE_INFO FileInfo, OUT LONGLONG *CrtTime, OUT LONGLONG *AccTime, OUT LONGLONG *AttrTime, OUT LONGLONG *ChgTime)
VOID UDFTimeToUDF(IN LONGLONG NtTime, OUT PUDF_TIME_STAMP UdfTime)
NTSTATUS UDFDoesOSAllowFilePretendDeleted__(IN PUDF_FILE_INFO FileInfo)
NTSTATUS UDFDoesOSAllowFileToBeTargetForRename__(IN PUDF_FILE_INFO FileInfo)
NTSTATUS UDFFileDirInfoToNT(IN PVCB Vcb, IN PDIR_INDEX_ITEM FileDirNdx, OUT PFILE_BOTH_DIR_INFORMATION NTFileInfo)
VOID UDFNormalizeFileName(IN PUNICODE_STRING FName, IN USHORT valueCRC)
void __fastcall UDFDOSNameOsNative(IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
struct _UDF_PH_CALL_CONTEXT * PUDF_PH_CALL_CONTEXT
struct _UDF_PH_CALL_CONTEXT UDF_PH_CALL_CONTEXT
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS MyInitUnicodeString(IN PUNICODE_STRING Str1, IN PCWSTR Str2)
_In_ PLARGE_INTEGER NtTime
Definition: fatprocs.h:1914
#define __fastcall
Definition: sync.c:38
unsigned short USHORT
Definition: pedump.c:61
#define Vcb
Definition: cdprocs.h:1415
IO_STATUS_BLOCK IosbToUse
Definition: Sys_spec_lib.h:24
Definition: cdstruc.h:498
Definition: ecma_167.h:138
const uint16_t * PCWSTR
Definition: typedefs.h:57
int64_t LONGLONG
Definition: typedefs.h:68
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Out_ PUNICODE_STRING DosName
Definition: rtlfuncs.h:1269