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

Function Ext2SetParentEntry

Ext4Fsd/ext3/generic.c:2064–2174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2062}
2063
2064NTSTATUS
2065Ext2SetParentEntry (
2066 IN PEXT2_IRP_CONTEXT IrpContext,
2067 IN PEXT2_VCB Vcb,
2068 IN PEXT2_FCB Dcb,
2069 IN ULONG OldParent,
2070 IN ULONG NewParent )
2071{
2072 NTSTATUS Status = STATUS_UNSUCCESSFUL;
2073
2074 PEXT2_DIR_ENTRY2 pSelf = NULL;
2075 PEXT2_DIR_ENTRY2 pParent = NULL;
2076
2077 ULONG dwBytes = 0;
2078
2079 BOOLEAN MainResourceAcquired = FALSE;
2080
2081 ULONG Offset = 0;
2082
2083 if (!IsDirectory(Dcb)) {
2084 return STATUS_NOT_A_DIRECTORY;
2085 }
2086
2087 if (OldParent == NewParent) {
2088 return STATUS_SUCCESS;
2089 }
2090
2091 MainResourceAcquired =
2092 ExAcquireResourceExclusiveLite(&Dcb->MainResource, TRUE);
2093
2094 __try {
2095
2096 Ext2ReferXcb(&Dcb->ReferenceCount);
2097
2098 pSelf = (PEXT2_DIR_ENTRY2)
2099 Ext2AllocatePool(
2100 PagedPool,
2101 EXT2_DIR_REC_LEN(1) + EXT2_DIR_REC_LEN(2),
2102 EXT2_DENTRY_MAGIC
2103 );
2104 if (!pSelf) {
2105 DEBUG(DL_ERR, ( "Ex2SetParentEntry: failed to allocate pSelf.\n"));
2106 Status = STATUS_INSUFFICIENT_RESOURCES;
2107 __leave;
2108 }
2109
2110 dwBytes = 0;
2111
2112 //
2113 // Reading the DCB contents
2114 //
2115
2116 Status = Ext2ReadInode(
2117 IrpContext,
2118 Vcb,
2119 Dcb->Mcb,
2120 (ULONGLONG)Offset,
2121 (PVOID)pSelf,

Callers 1

Ext2SetRenameInfoFunction · 0.85

Calls 4

Ext2AllocatePoolFunction · 0.85
Ext2ReadInodeFunction · 0.85
Ext2WriteInodeFunction · 0.85
Ext2FreePoolFunction · 0.85

Tested by

no test coverage detected