VirtualBox

Ignore:
Timestamp:
Jan 21, 2013 3:47:33 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83260
Message:

VbglR3/VBoxControl: Added "guestproperty delete" + VbglR3GuestPropDelete.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp

    r41972 r44324  
    55
    66/*
    7  * Copyright (C) 2008-2010 Oracle Corporation
     7 * Copyright (C) 2008-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    122122        doUsage("get <property> [--verbose]", g_pszProgName, "guestproperty");
    123123        doUsage("set <property> [<value> [--flags <flags>]]", g_pszProgName, "guestproperty");
     124        doUsage("delete <property>", g_pszProgName, "guestproperty");
    124125        doUsage("enumerate [--patterns <patterns>]", g_pszProgName, "guestproperty");
    125126        doUsage("wait <patterns>", g_pszProgName, "guestproperty");
     
    10931094
    10941095/**
     1096 * Deletes a guest property from the guest property store.
     1097 * This is accessed through the "VBoxGuestPropSvc" HGCM service.
     1098 *
     1099 * @returns Command exit code.
     1100 * @note see the command line API description for parameters
     1101 */
     1102static RTEXITCODE deleteGuestProperty(int argc, char *argv[])
     1103{
     1104    /*
     1105     * Check the syntax.  We can deduce the correct syntax from the number of
     1106     * arguments.
     1107     */
     1108    bool usageOK = true;
     1109    const char *pszName = NULL;
     1110    if (argc < 1)
     1111        usageOK = false;
     1112    if (!usageOK)
     1113    {
     1114        usage(GUEST_PROP);
     1115        return RTEXITCODE_FAILURE;
     1116    }
     1117    /* This is always needed. */
     1118    pszName = argv[0];
     1119
     1120    /*
     1121     * Do the actual setting.
     1122     */
     1123    uint32_t u32ClientId = 0;
     1124    int rc = VbglR3GuestPropConnect(&u32ClientId);
     1125    if (!RT_SUCCESS(rc))
     1126        VBoxControlError("Failed to connect to the guest property service, error %Rrc\n", rc);
     1127    if (RT_SUCCESS(rc))
     1128    {
     1129        rc = VbglR3GuestPropDelete(u32ClientId, pszName);
     1130        if (!RT_SUCCESS(rc))
     1131            VBoxControlError("Failed to delete the property value, error %Rrc\n", rc);
     1132    }
     1133
     1134    if (u32ClientId != 0)
     1135        VbglR3GuestPropDisconnect(u32ClientId);
     1136    return RT_SUCCESS(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
     1137}
     1138
     1139
     1140/**
    10951141 * Enumerates the properties in the guest property store.
    10961142 * This is accessed through the "VBoxGuestPropSvc" HGCM service.
     
    13121358    else if (!strcmp(argv[0], "set"))
    13131359        return setGuestProperty(argc - 1, argv + 1);
     1360    else if (!strcmp(argv[0], "delete"))
     1361        return deleteGuestProperty(argc - 1, argv + 1);
    13141362    else if (!strcmp(argv[0], "enumerate"))
    13151363        return enumGuestProperty(argc - 1, argv + 1);
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