[SHELLBTRFS] Fix build when std::vector.data() is not implemented
authorPierre Schweitzer <pierre@reactos.org>
Tue, 12 Nov 2019 21:59:27 +0000 (22:59 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Tue, 12 Nov 2019 21:59:27 +0000 (22:59 +0100)
dll/shellext/shellbtrfs/mountmgr_local.cpp

index 2f02984..ee7901e 100644 (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)));
     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());
     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));
 
     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)));
     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());
     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));
 
 
     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));
     }
 
     vector<uint8_t> buf2(sizeof(MOUNTMGR_MOUNT_POINTS));
+#ifndef __REACTOS__
     auto mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(buf2.data());
     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());
 
     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)));
     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());
     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));
 
 
     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));
     }
 
     vector<uint8_t> buf2(sizeof(MOUNTMGR_MOUNT_POINTS));
+#ifndef __REACTOS__
     auto mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(buf2.data());
     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());
 
     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);
         throw ntstatus_error(Status);
 
     buf2.resize(mmps->Size);
+#ifndef __REACTOS__
     mmps = reinterpret_cast<MOUNTMGR_MOUNT_POINTS*>(buf2.data());
     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());
 
     Status = NtDeviceIoControlFile(h, nullptr, nullptr, nullptr, &iosb, IOCTL_MOUNTMGR_QUERY_POINTS,
                                    buf.data(), (ULONG)buf.size(), buf2.data(), (ULONG)buf2.size());