Changeset 44324 in vbox for trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
- Timestamp:
- Jan 21, 2013 3:47:33 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83260
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
r41972 r44324 5 5 6 6 /* 7 * Copyright (C) 2008-201 0Oracle Corporation7 * Copyright (C) 2008-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 122 122 doUsage("get <property> [--verbose]", g_pszProgName, "guestproperty"); 123 123 doUsage("set <property> [<value> [--flags <flags>]]", g_pszProgName, "guestproperty"); 124 doUsage("delete <property>", g_pszProgName, "guestproperty"); 124 125 doUsage("enumerate [--patterns <patterns>]", g_pszProgName, "guestproperty"); 125 126 doUsage("wait <patterns>", g_pszProgName, "guestproperty"); … … 1093 1094 1094 1095 /** 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 */ 1102 static 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 /** 1095 1141 * Enumerates the properties in the guest property store. 1096 1142 * This is accessed through the "VBoxGuestPropSvc" HGCM service. … … 1312 1358 else if (!strcmp(argv[0], "set")) 1313 1359 return setGuestProperty(argc - 1, argv + 1); 1360 else if (!strcmp(argv[0], "delete")) 1361 return deleteGuestProperty(argc - 1, argv + 1); 1314 1362 else if (!strcmp(argv[0], "enumerate")) 1315 1363 return enumGuestProperty(argc - 1, argv + 1);
Note:
See TracChangeset
for help on using the changeset viewer.