VirtualBox

Changeset 44322 in vbox


Ignore:
Timestamp:
Jan 21, 2013 2:36:11 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83256
Message:

Fe/VBoxManage: Implemented "guestproperty delete", updated documentation.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/user_VBoxManage.xml

    r44133 r44322  
    695695          <listitem>
    696696            <para><computeroutput>--lptmode&lt;1-N&gt;
    697             &lt;Device&gt;</computeroutput> 
    698             Specifies the Device Name of the parallel port that 
     697            &lt;Device&gt;</computeroutput>
     698            Specifies the Device Name of the parallel port that
    699699            the Parallel Port feature will be using. Use this
    700700            <emphasis>before</emphasis> <computeroutput>--lpt</computeroutput>.
     
    704704          <listitem>
    705705            <para><computeroutput>--lpt&lt;1-N&gt;
    706             &lt;I/O base&gt; &lt;IRQ&gt;</computeroutput> 
     706            &lt;I/O base&gt; &lt;IRQ&gt;</computeroutput>
    707707            Specifies the I/O address of the parallel port and the IRQ
    708708            number that the Parallel Port feature will be using. Use this
    709709            <emphasis>after</emphasis>
    710             <computeroutput>--lptmod</computeroutput>. I/O base address and IRQ are 
     710            <computeroutput>--lptmod</computeroutput>. I/O base address and IRQ are
    711711                        the values that guest sees i.e. the values avalable under guest Device Manager.</para>
    712712          </listitem>
     
    17431743                    image to the given device slot.</para>
    17441744                </listitem>
    1745              
     1745
    17461746                <listitem>
    17471747                  <para>If a UUID is specified, it must be the UUID of a
     
    26442644          above.</para>
    26452645        </listitem>
     2646
     2647        <listitem>
     2648          <para><computeroutput>delete &lt;vm&gt; &lt;property&gt;
     2649          </computeroutput>: Deletes a formerly set guest property.
     2650          </para></listitem>
    26462651      </itemizedlist></para>
    26472652  </sect1>
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp

    r42460 r44322  
    55
    66/*
    7  * Copyright (C) 2006-2010 Oracle Corporation
     7 * Copyright (C) 2006-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6262                       "%s guestproperty %s   set <vmname>|<uuid>\n"
    6363                 "                            <property> [<value> [--flags <flags>]]\n"
     64                 "\n", pcszSep1, pcszSep2);
     65    RTStrmPrintf(pStrm,
     66                       "%s guestproperty %s   delete <vmname>|<uuid>\n"
     67                 "                            <property>\n"
    6468                 "\n", pcszSep1, pcszSep2);
    6569    RTStrmPrintf(pStrm,
     
    159163        a->session->COMGETTER(Machine)(machine.asOutParam());
    160164
    161         if (!pszValue && !pszFlags)
    162             CHECK_ERROR(machine, DeleteGuestProperty(Bstr(pszName).raw()));
    163         else if (!pszFlags)
     165        if (!pszFlags)
    164166            CHECK_ERROR(machine, SetGuestPropertyValue(Bstr(pszName).raw(),
    165167                                                       Bstr(pszValue).raw()));
     
    168170                                                  Bstr(pszValue).raw(),
    169171                                                  Bstr(pszFlags).raw()));
     172
     173        if (SUCCEEDED(rc))
     174            CHECK_ERROR(machine, SaveSettings());
     175
     176        a->session->UnlockMachine();
     177    }
     178    return SUCCEEDED(rc) ? 0 : 1;
     179}
     180
     181static int handleDeleteGuestProperty(HandlerArg *a)
     182{
     183    HRESULT rc = S_OK;
     184
     185    /*
     186     * Check the syntax.  We can deduce the correct syntax from the number of
     187     * arguments.
     188     */
     189    bool usageOK = true;
     190    const char *pszName = NULL;
     191    if (a->argc != 2)
     192        usageOK = false;
     193    if (!usageOK)
     194        return errorSyntax(USAGE_GUESTPROPERTY, "Incorrect parameters");
     195    /* This is always needed. */
     196    pszName = a->argv[1];
     197
     198    ComPtr<IMachine> machine;
     199    CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
     200                                           machine.asOutParam()));
     201    if (machine)
     202    {
     203        /* open a session for the VM - new or existing */
     204        CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Shared), 1);
     205
     206        /* get the mutable session machine */
     207        a->session->COMGETTER(Machine)(machine.asOutParam());
     208
     209        CHECK_ERROR(machine, DeleteGuestProperty(Bstr(pszName).raw()));
    170210
    171211        if (SUCCEEDED(rc))
     
    385425    if (strcmp(a->argv[0], "set") == 0)
    386426        return handleSetGuestProperty(&arg);
     427    if (strcmp(a->argv[0], "delete") == 0)
     428        return handleDeleteGuestProperty(&arg);
    387429    if (strcmp(a->argv[0], "enumerate") == 0)
    388430        return handleEnumGuestProperty(&arg);
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r43908 r44322  
    33<!--
    44
    5     Copyright (C) 2006-2012 Oracle Corporation
     5    Copyright (C) 2006-2013 Oracle Corporation
    66
    77    This file is part of VirtualBox Open Source Edition (OSE), as
     
    62936293    <method name="setGuestPropertyValue">
    62946294      <desc>
    6295         Sets, changes or deletes a value in the machine's guest property
     6295        Sets or changes a value in the machine's guest property
    62966296        store.  The flags field will be left unchanged or created empty for a
    62976297        new property.
     
    63106310      <param name="property" type="wstring" dir="in">
    63116311        <desc>
    6312           The name of the property to set, change or delete.
     6312          The name of the property to set or change.
    63136313        </desc>
    63146314      </param>
    63156315      <param name="value" type="wstring" dir="in">
    63166316        <desc>
    6317           The new value of the property to set, change or delete. If the
     6317          The new value of the property to set or change. If the
    63186318          property does not yet exist and value is non-empty, it will be
    6319           created.  If the value is @c null or empty, the property will be
    6320           deleted if it exists.
     6319          created.
    63216320        </desc>
    63226321      </param>
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