[SHELLBTRFS] Fix build when std::vector.data() is not implemented

This commit is contained in:
Pierre Schweitzer 2019-11-12 22:59:27 +01:00
parent a837184300
commit 1725ddfd8f
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -33,7 +33,11 @@ void mountmgr::create_point(const wstring_view& symlink, const wstring_view& dev
IO_STATUS_BLOCK iosb;
vector<uint8_t> buf(sizeof(MOUNTMGR_CREATE_POINT_INPUT) + ((symlink.length() + device.length()) * sizeof(WCHAR)));
#ifndef __REACTOS__
auto mcpi = reinterpret_cast<MOUNTMGR_CREATE_POINT_INPUT*>(buf.data());
#else
auto mcpi = reinterpret_cast<MOUNTMGR_CREATE_POINT_INPUT*>(&buf[0]);
#endif
mcpi->SymbolicLinkNameOffset = sizeof(MOUNTMGR_CREATE_POINT_INPUT);
mcpi->SymbolicLinkNameLength = (USHORT)(symlink.length() * sizeof(WCHAR));
@ -55,7 +59,11 @@ void mountmgr::delete_points(const wstring_view& symlink, const wstring_view& un
IO_STATUS_BLOCK iosb;
vector<uint8_t> buf(sizeof(MOUNTMGR_MOUNT_POINT) + ((symlink.length() + unique_id.length() + device_name.length()) * sizeof(WCHAR)));
#ifndef __REACTOS__
auto mmp = reinterpret_cast<MOUNTMGR_MOUNT_POINT*>(buf.data());
#else
auto mmp = reinterpret_cast<MOUNTMGR_MOUNT_POINT*>(&buf[0]);
#endif
memset(mmp, 0, sizeof(MOUNTMGR_MOUNT_POINT));
@ -88,7 +96,11 @@ void mountmgr::delete_points(const wstring_view& symlink, const wstring_view& un
}
vector<uint8_t> buf2(sizeof(MOUNTMGR_MOUNT_POINTS));
#ifndef __REACTOS__
auto mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(buf2.data());
#else
auto mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(&buf2[0]);
#endif
Status = NtDeviceIoControlFile(h, nullptr, nullptr, nullptr, &iosb, IOCTL_MOUNTMGR_DELETE_POINTS,
buf.data(), (ULONG)buf.size(), buf2.data(), (ULONG)buf2.size());
@ -110,7 +122,11 @@ vector<mountmgr_point> mountmgr::query_points(const wstring_view& symlink, const
vector<mountmgr_point> v;
vector<uint8_t> buf(sizeof(MOUNTMGR_MOUNT_POINT) + ((symlink.length() + unique_id.length() + device_name.length()) * sizeof(WCHAR)));
#ifndef __REACTOS__
auto mmp = reinterpret_cast<MOUNTMGR_MOUNT_POINT*>(buf.data());
#else
auto mmp = reinterpret_cast<MOUNTMGR_MOUNT_POINT*>(&buf[0]);
#endif
memset(mmp, 0, sizeof(MOUNTMGR_MOUNT_POINT));
@ -143,7 +159,11 @@ vector<mountmgr_point> mountmgr::query_points(const wstring_view& symlink, const
}
vector<uint8_t> buf2(sizeof(MOUNTMGR_MOUNT_POINTS));
#ifndef __REACTOS__
auto mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(buf2.data());
#else
auto mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(&buf2[0]);
#endif
Status = NtDeviceIoControlFile(h, nullptr, nullptr, nullptr, &iosb, IOCTL_MOUNTMGR_QUERY_POINTS,
buf.data(), (ULONG)buf.size(), buf2.data(), (ULONG)buf2.size());
@ -152,7 +172,11 @@ vector<mountmgr_point> mountmgr::query_points(const wstring_view& symlink, const
throw ntstatus_error(Status);
buf2.resize(mmps->Size);
#ifndef __REACTOS__
mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(buf2.data());
#else
mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(&buf2[0]);
#endif
Status = NtDeviceIoControlFile(h, nullptr, nullptr, nullptr, &iosb, IOCTL_MOUNTMGR_QUERY_POINTS,
buf.data(), (ULONG)buf.size(), buf2.data(), (ULONG)buf2.size());