VirtualBox

Changeset 56912 in vbox


Ignore:
Timestamp:
Jul 10, 2015 11:07:03 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
101609
Message:

Frontends/VBoxManage: add -relative support for creating raw partition vmdk on Windows host, should help with permission trouble (but the 1:1 mapping of windows partition numbers to what vbox uses isn't verified yet)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r56910 r56912  
    11771177            pszPartitions = argv[i];
    11781178        }
    1179 #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
     1179#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(RT_OS_WINDOWS)
    11801180        else if (strcmp(argv[i], "-relative") == 0)
    11811181        {
     
    12441244            cbSize = DiskLenInfo.Length.QuadPart;
    12451245        }
     1246        if (   fRelative
     1247            && !rawdisk.startsWith("\\\\.\\PhysicalDrive", Utf8Str::CaseInsensitive))
     1248        {
     1249            RTMsgError("The -relative parameter is invalid for raw disk %s", rawdisk.c_str());
     1250            vrc = VERR_INVALID_PARAMETER;
     1251            goto out;
     1252        }
    12461253    }
    12471254    else
     
    12701277#elif defined(RT_OS_LINUX)
    12711278    struct stat DevStat;
    1272     if(!fstat(RTFileToNative(hRawFile), &DevStat))
     1279    if (!fstat(RTFileToNative(hRawFile), &DevStat))
    12731280    {
    12741281        if (S_ISBLK(DevStat.st_mode))
     
    16461653                    pszRawName = psz;
    16471654                    uStartOffset = 0;
     1655#elif defined(RT_OS_WINDOWS)
     1656                    /* Refer to the correct partition and use offset 0. */
     1657                    char *psz;
     1658                    RTStrAPrintf(&psz, "\\\\.\\Harddisk%sPartition%u",
     1659                                 rawdisk.c_str() + 17,
     1660                                 partitions.aPartitions[i].uIndex);
     1661                    if (!psz)
     1662                    {
     1663                        vrc = VERR_NO_STR_MEMORY;
     1664                        RTMsgError("Cannot create reference to individual partition %u, rc=%Rrc",
     1665                                   partitions.aPartitions[i].uIndex, vrc);
     1666                        goto out;
     1667                    }
     1668                    pszRawName = psz;
     1669                    uStartOffset = 0;
    16481670#else
    16491671                    /** @todo not implemented for other hosts. Treat just like
     
    16981720                if (!RawDescriptor.pPartDescs[i].cbData)
    16991721                {
    1700                     if(RawDescriptor.uPartitioningType == MBR)
     1722                    if (RawDescriptor.uPartitioningType == MBR)
    17011723                    {
    17021724                        RTMsgError("MBR/EPT overlaps with data area");
     
    17061728                    else
    17071729                    {
    1708                         if(RawDescriptor.cPartDescs != i+1)
     1730                        if (RawDescriptor.cPartDescs != i+1)
    17091731                        {
    17101732                            RTMsgError("GPT overlaps with data area");
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette