Changeset 44324 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Jan 21, 2013 3:47:33 PM (12 years ago)
- Location:
- trunk/src/VBox/Additions/common
- Files:
-
- 3 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); -
trunk/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp
r32705 r44324 5 5 6 6 /* 7 * Copyright (C) 2007 Oracle Corporation7 * Copyright (C) 2007-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 98 98 } 99 99 100 VBGLR3DECL(int) VbglR3GuestPropDelete(uint32_t u32ClientId, 101 const char *pszName) 102 { 103 RTPrintf("Called DEL_PROP, client %d, name %s...\n", 104 u32ClientId, pszName); 105 return VINF_SUCCESS; 106 } 107 100 108 struct VBGLR3GUESTPROPENUM 101 109 { -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestProp.cpp
r36638 r44324 5 5 6 6 /* 7 * Copyright (C) 2007 Oracle Corporation7 * Copyright (C) 2007-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 780 780 RTMemFree(pHandle->pchBuf); 781 781 RTMemFree(pHandle); 782 } 783 784 785 /** 786 * Deletes a guest property. 787 * 788 * @returns VBox status code. 789 * @param u32ClientId The client id returned by VbglR3InvsSvcConnect(). 790 * @param pszName The property to delete. Utf8 791 */ 792 VBGLR3DECL(int) VbglR3GuestPropDelete(uint32_t u32ClientId, const char *pszName) 793 { 794 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 795 796 DelProperty Msg; 797 798 Msg.hdr.result = VERR_WRONG_ORDER; 799 Msg.hdr.u32ClientID = u32ClientId; 800 Msg.hdr.u32Function = DEL_PROP; 801 Msg.hdr.cParms = 1; 802 VbglHGCMParmPtrSetString(&Msg.name, pszName); 803 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); 804 if (RT_SUCCESS(rc)) 805 rc = Msg.hdr.result; 806 807 return rc; 782 808 } 783 809
Note:
See TracChangeset
for help on using the changeset viewer.