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

Function Ext2QueryMountPoint

Ext2Mgr/enumDisk.cpp:4677–4789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4675
4676
4677UCHAR
4678Ext2QueryMountPoint(
4679 CHAR * volume
4680 )
4681{
4682 NT::IO_STATUS_BLOCK iosb;
4683 NT::NTSTATUS status;
4684 ULONG lp, lps;
4685 ULONG i;
4686 HANDLE hMountMgr = 0;
4687
4688 NT::UNICODE_STRING volPoint;
4689 NT::UNICODE_STRING VolumeName;
4690 WCHAR VolumeBuffer[MAX_PATH];
4691
4692 PMOUNTMGR_MOUNT_POINT point = NULL;
4693 PMOUNTMGR_MOUNT_POINTS points = NULL;
4694 UCHAR drvLetter = 0;
4695
4696 memset(VolumeBuffer, 0, MAX_PATH * sizeof(WCHAR));
4697 Ext2AnsiToUnicode(volume, VolumeBuffer, MAX_PATH);
4698
4699 VolumeName.MaximumLength = MAX_PATH;
4700 VolumeName.Length = (USHORT)wcslen(VolumeBuffer) * 2;
4701 VolumeName.Buffer = VolumeBuffer;
4702
4703 status = Ext2Open("\\Device\\MountPointManager", &hMountMgr, EXT2_DESIRED_ACCESS);
4704 if (!NT_SUCCESS(status)) {
4705 goto errorout;
4706 }
4707
4708 lp = VolumeName.Length + sizeof(MOUNTMGR_MOUNT_POINT) + 2;
4709 point = (PMOUNTMGR_MOUNT_POINT)malloc(lp);
4710 if (point == NULL) {
4711 goto errorout;
4712 }
4713
4714 /* initialize MountMgr ioctl input structure */
4715 memset(point, 0, lp);
4716 point->DeviceNameOffset = sizeof(MOUNTMGR_MOUNT_POINT);
4717 point->DeviceNameLength = VolumeName.Length;
4718 RtlMoveMemory((PCHAR) point + point->DeviceNameOffset,
4719 VolumeBuffer, VolumeName.Length);
4720 lps = 1024;
4721
4722Again:
4723
4724 /* allocate ioctl output structure */
4725 points = (PMOUNTMGR_MOUNT_POINTS)malloc(lps);
4726 if (!points) {
4727 goto errorout;
4728 }
4729 RtlZeroMemory(points, lps);
4730
4731 /* could MoungMgr to create volume points for us ? */
4732 status = NT::ZwDeviceIoControlFile(
4733 hMountMgr, NULL, NULL, NULL, &iosb,
4734 IOCTL_MOUNTMGR_QUERY_POINTS,

Callers 6

Ext2QueryCdromDrvLettersFunction · 0.85
Ext2RefreshVolumePointFunction · 0.85
Ext2NotifyVolumePointFunction · 0.85
AddMountPointMethod · 0.85
OnInitDialogMethod · 0.85

Calls 3

Ext2AnsiToUnicodeFunction · 0.85
Ext2OpenFunction · 0.85
Ext2CloseFunction · 0.70

Tested by

no test coverage detected