MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2LookupFile

Function Ext2LookupFile

Ext4Fsd/create.c:272–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272NTSTATUS
273Ext2LookupFile (
274 IN PEXT2_IRP_CONTEXT IrpContext,
275 IN PEXT2_VCB Vcb,
276 IN PUNICODE_STRING FullName,
277 IN PEXT2_MCB Parent,
278 OUT PEXT2_MCB * Ext2Mcb,
279 IN ULONG Linkdep
280)
281{
282 NTSTATUS Status = STATUS_OBJECT_NAME_NOT_FOUND;
283 UNICODE_STRING FileName;
284 PEXT2_MCB Mcb = NULL;
285 struct dentry *de = NULL;
286
287 USHORT i = 0, End;
288 ULONG Inode;
289
290 BOOLEAN bParent = FALSE;
291 BOOLEAN bDirectory = FALSE;
292 BOOLEAN LockAcquired = FALSE;
293 BOOLEAN bNotFollow = FALSE;
294
295 __try {
296
297 ExAcquireResourceExclusiveLite(&Vcb->McbLock, TRUE);
298 LockAcquired = TRUE;
299
300 bNotFollow = IsFlagOn(Linkdep, EXT2_LOOKUP_NOT_FOLLOW);
301 Linkdep = ClearFlag(Linkdep, EXT2_LOOKUP_FLAG_MASK);
302
303 *Ext2Mcb = NULL;
304
305 DEBUG(DL_RES, ("Ext2LookupFile: %wZ\n", FullName));
306
307 /* check names and parameters */
308 if (FullName->Buffer[0] == L'\\') {
309 Parent = Vcb->McbTree;
310 } else if (Parent) {
311 bParent = TRUE;
312 } else {
313 Parent = Vcb->McbTree;
314 }
315
316 /* make sure the parent is NULL */
317 if (!IsMcbDirectory(Parent)) {
318 Status = STATUS_NOT_A_DIRECTORY;
319 __leave;
320 }
321
322 /* use symlink's target as parent directory */
323 if (IsMcbSymLink(Parent)) {
324 Parent = Parent->Target;
325 ASSERT(!IsMcbSymLink(Parent));
326 if (IsFileDeleted(Parent)) {
327 Status = STATUS_NOT_A_DIRECTORY;
328 __leave;
329 }

Callers 5

Ext2ProcessEntryFunction · 0.85
Ext2SetRenameInfoFunction · 0.85
Ext2SetLinkInfoFunction · 0.85
Ext2FollowLinkFunction · 0.85
Ext2CreateFileFunction · 0.85

Calls 13

Ext2SearchMcbWithoutLockFunction · 0.85
Ext2IsNameValidFunction · 0.85
Ext2ScanDirFunction · 0.85
Ext2AllocateMcbFunction · 0.85
Ext2LoadInodeFunction · 0.85
Ext2FreeMcbFunction · 0.85
Ext2CheckFileAccessFunction · 0.85
Ext2IsSpecialSystemFileFunction · 0.85
Ext2NtTimeFunction · 0.85
Ext2FollowLinkFunction · 0.85
Ext2InsertMcbFunction · 0.85
Ext2LinkTailMcbFunction · 0.85

Tested by

no test coverage detected