ReactOS 0.4.15-dev-7842-g558ab78
filobsup.c File Reference
#include "cdprocs.h"
Include dependency graph for filobsup.c:

Go to the source code of this file.

Macros

#define BugCheckFileId   (CDFS_BUG_CHECK_FILOBSUP)
 
#define TYPE_OF_OPEN_MASK   (0x00000007)
 

Functions

 _When_ (TypeOfOpen==UnopenedFileObject, _At_(Fcb, _In_opt_))
 
 _When_ (return==UnopenedFileObject, _At_(*Fcb, _Post_null_)) _When_(return !
 
 _At_ (Fcb, _Outptr_)
 
TYPE_OF_OPEN CdFastDecodeFileObject (_In_ PFILE_OBJECT FileObject, _Out_ PFCB *Fcb)
 

Macro Definition Documentation

◆ BugCheckFileId

#define BugCheckFileId   (CDFS_BUG_CHECK_FILOBSUP)

Definition at line 22 of file filobsup.c.

◆ TYPE_OF_OPEN_MASK

#define TYPE_OF_OPEN_MASK   (0x00000007)

Definition at line 28 of file filobsup.c.

Function Documentation

◆ _At_()

_At_ ( Fcb  ,
_Outptr_   
)

Definition at line 128 of file filobsup.c.

160{
162
163 PAGED_CODE();
164
165 UNREFERENCED_PARAMETER( IrpContext );
166
167 //
168 // If this is an unopened file object then return NULL for the
169 // Fcb/Ccb. Don't trust any other values in the file object.
170 //
171
174
176
177 *Fcb = NULL;
178 *Ccb = NULL;
179
180 } else {
181
182 //
183 // The Fcb is pointed to by the FsContext field. The Ccb is in
184 // FsContext2 (after clearing the low three bits). The low three
185 // bits are the file object type.
186 //
187
188 *Fcb = FileObject->FsContext;
189 *Ccb = FileObject->FsContext2;
190
191#ifdef _MSC_VER
192#pragma warning( suppress: 4213 )
193#endif
194 ClearFlag( (*(PULONG_PTR)Ccb), TYPE_OF_OPEN_MASK ); /* ReactOS Change: GCC "invalid lvalue in assignment" */
195 }
196
197 //
198 // Now return the type of open.
199 //
200
201 return TypeOfOpen;
202}
#define PAGED_CODE()
#define TYPE_OF_OPEN_MASK
Definition: filobsup.c:28
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:589
@ UnopenedFileObject
Definition: cdprocs.h:573
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
enum _TYPE_OF_OPEN TYPE_OF_OPEN
#define NULL
Definition: types.h:112
#define ClearFlag(_F, _SF)
Definition: ext2fs.h:191
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550

◆ _When_() [1/2]

_When_ ( return  = UnopenedFileObject,
_At_ *,  _Post_null_ 
)

◆ _When_() [2/2]

_When_ ( TypeOfOpen  = UnopenedFileObject,
_At_(Fcb, _In_opt_  
)

Definition at line 37 of file filobsup.c.

72{
73 PAGED_CODE();
74
75 UNREFERENCED_PARAMETER( IrpContext );
76
77 //
78 // We only have values 0 to 7 available so make sure we didn't
79 // inadvertantly add a new type.
80 //
81
82 NT_ASSERTMSG( "FileObject types exceed available bits\n", BeyondValidType <= 8 );
83
84 //
85 // Setting a file object to type UnopenedFileObject means just
86 // clearing all of the context fields. All the other input
87 //
88
90
91 FileObject->FsContext =
92 FileObject->FsContext2 = NULL;
93
94 return;
95 }
96
97 //
98 // Check that the 3 low-order bits of the Ccb are clear.
99 //
100
101 NT_ASSERTMSG( "Ccb is not quad-aligned\n", !FlagOn( ((ULONG_PTR) Ccb), TYPE_OF_OPEN_MASK ));
102
103 //
104 // We will or the type of open into the low order bits of FsContext2
105 // along with the Ccb value.
106 // The Fcb is stored into the FsContext field.
107 //
108
109 FileObject->FsContext = Fcb;
110 FileObject->FsContext2 = Ccb;
111
112#ifdef _MSC_VER
113#pragma warning( suppress: 4213 )
114#endif
115 SetFlag( (*(PULONG_PTR)&FileObject->FsContext2), TypeOfOpen ); /* ReactOS Change: GCC "invalid lvalue in assignment" */
116
117 //
118 // Set the Vpb field in the file object.
119 //
120
121 FileObject->Vpb = Fcb->Vcb->Vpb;
122
123 return;
124}
@ BeyondValidType
Definition: cdprocs.h:578
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PVCB Vcb
Definition: cdstruc.h:933
PVPB Vpb
Definition: cdstruc.h:511
#define NT_ASSERTMSG
Definition: rtlfuncs.h:3311

◆ CdFastDecodeFileObject()

TYPE_OF_OPEN CdFastDecodeFileObject ( _In_ PFILE_OBJECT  FileObject,
_Out_ PFCB Fcb 
)

Definition at line 206 of file filobsup.c.

232{
233 PAGED_CODE();
234
236
237 //
238 // The Fcb is in the FsContext field. The type of open is in the low
239 // bits of the Ccb.
240 //
241
242 *Fcb = FileObject->FsContext;
243
244 return (TYPE_OF_OPEN)
246}
#define ASSERT_FILE_OBJECT(FO)
Definition: cddata.h:252

Referenced by _Function_class_(), CdFastLock(), CdFastUnlockAll(), CdFastUnlockAllByKey(), and CdFastUnlockSingle().