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

Function Ext2CreateVolume

Ext4Fsd/create.c:1841–1950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1839}
1840
1841NTSTATUS
1842Ext2CreateVolume(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb)
1843{
1844 PIO_STACK_LOCATION IrpSp;
1845 PIRP Irp;
1846 PEXT2_CCB Ccb;
1847
1848 NTSTATUS Status;
1849
1850 ACCESS_MASK DesiredAccess;
1851 ULONG ShareAccess;
1852
1853 ULONG Options;
1854 BOOLEAN DirectoryFile;
1855 BOOLEAN OpenTargetDirectory;
1856
1857 ULONG CreateDisposition;
1858
1859 Irp = IrpContext->Irp;
1860 IrpSp = IoGetCurrentIrpStackLocation(Irp);
1861
1862 Options = IrpSp->Parameters.Create.Options;
1863
1864 DirectoryFile = IsFlagOn(Options, FILE_DIRECTORY_FILE);
1865 OpenTargetDirectory = IsFlagOn(IrpSp->Flags, SL_OPEN_TARGET_DIRECTORY);
1866
1867 CreateDisposition = (Options >> 24) & 0x000000ff;
1868
1869 DesiredAccess = IrpSp->Parameters.Create.SecurityContext->DesiredAccess;
1870 ShareAccess = IrpSp->Parameters.Create.ShareAccess;
1871
1872 if (DirectoryFile) {
1873 return STATUS_NOT_A_DIRECTORY;
1874 }
1875
1876 if (OpenTargetDirectory) {
1877 DbgBreak();
1878 return STATUS_INVALID_PARAMETER;
1879 }
1880
1881 if ( (CreateDisposition != FILE_OPEN) &&
1882 (CreateDisposition != FILE_OPEN_IF) ) {
1883 return STATUS_ACCESS_DENIED;
1884 }
1885
1886 if ( !FlagOn(ShareAccess, FILE_SHARE_READ) &&
1887 Vcb->OpenVolumeCount != 0 ) {
1888 return STATUS_SHARING_VIOLATION;
1889 }
1890
1891 Ccb = Ext2AllocateCcb(0, NULL);
1892 if (Ccb == NULL) {
1893 Status = STATUS_INSUFFICIENT_RESOURCES;
1894 goto errorout;
1895 }
1896
1897 Status = STATUS_SUCCESS;
1898

Callers 1

Ext2CreateFunction · 0.85

Calls 3

Ext2AllocateCcbFunction · 0.85
Ext2FlushFilesFunction · 0.85
Ext2FlushVolumeFunction · 0.70

Tested by

no test coverage detected