static NTSTATUS FspNpGetVolumeList( PWCHAR *PVolumeListBuf, PSIZE_T PVolumeListSize) { NTSTATUS Result; PWCHAR VolumeListBuf; SIZE_T VolumeListSize; *PVolumeListBuf = 0; *PVolumeListSize = 0; for (VolumeListSize = 1024;; VolumeListSize *= 2) { VolumeListBuf = MemAlloc(VolumeListSize); if (0 == VolumeListBuf) return STATUS_INSUFFICIENT_RESOURCES; Result = FspFsctlGetVolumeList(L"" FSP_FSCTL_NET_DEVICE_NAME, VolumeListBuf, &VolumeListSize); if (NT_SUCCESS(Result)) { *PVolumeListBuf = VolumeListBuf; *PVolumeListSize = VolumeListSize; return Result; } MemFree(VolumeListBuf); if (STATUS_BUFFER_TOO_SMALL != Result) return Result; } }
static NTSTATUS FspToolGetVolumeList(PWSTR DeviceName, PWCHAR *PVolumeListBuf, PSIZE_T PVolumeListSize) { NTSTATUS Result; PWCHAR VolumeListBuf; SIZE_T VolumeListSize; *PVolumeListBuf = 0; *PVolumeListSize = 0; for (VolumeListSize = 1024;; VolumeListSize *= 2) { VolumeListBuf = MemAlloc(VolumeListSize); if (0 == VolumeListBuf) return STATUS_INSUFFICIENT_RESOURCES; Result = FspFsctlGetVolumeList(DeviceName, VolumeListBuf, &VolumeListSize); if (NT_SUCCESS(Result)) { *PVolumeListBuf = VolumeListBuf; *PVolumeListSize = VolumeListSize; return Result; } MemFree(VolumeListBuf); if (STATUS_BUFFER_TOO_SMALL != Result) return Result; } }