- Timestamp:
- Jun 27, 2008 9:26:27 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 32460
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/VBoxInfoSvc.h
r9882 r10003 38 38 SET_CFGM_NODE = 1, 39 39 /** 40 * Get the value attached to a n extra data key in the machine XML file.40 * Get the value attached to a configuration property key 41 41 * The parameter format matches that of GET_CONFIG_KEY. 42 42 */ 43 43 GET_CONFIG_KEY_HOST = 2, 44 44 /** 45 * Set the value attached to a n extra data key in the machine XML file.45 * Set the value attached to a configuration property key 46 46 * The parameter format matches that of SET_CONFIG_KEY. 47 47 */ 48 SET_CONFIG_KEY_HOST = 3 48 SET_CONFIG_KEY_HOST = 3, 49 /** 50 * Remove the value attached to a configuration property key 51 * The parameter format matches that of DEL_CONFIG_KEY. 52 */ 53 DEL_CONFIG_KEY_HOST = 4 49 54 }; 50 55 … … 55 60 enum eGuestFn 56 61 { 57 /** Get the value attached to a n extra data key in the machine XML file*/62 /** Get the value attached to a configuration property key */ 58 63 GET_CONFIG_KEY = 1, 59 /** Set the value attached to an extra data key in the machine XML file */ 60 SET_CONFIG_KEY = 2 64 /** Set the value attached to a configuration property key */ 65 SET_CONFIG_KEY = 2, 66 /** Remove the value attached to a configuration property key */ 67 DEL_CONFIG_KEY = 3 61 68 }; 62 69 … … 125 132 HGCMFunctionParameter value; 126 133 } SetConfigKey; 134 135 /** The guest is requesting to remove a configuration key */ 136 typedef struct _DelConfigKey 137 { 138 VBoxGuestHGCMCallInfo hdr; 139 140 /** 141 * The key to change up. This must fit to a number of criteria, namely 142 * - Only ASCII characters with no spaces 143 * - Less than or equal to VBOX_SHARED_INFO_KEY_MAX_LEN bytes in length 144 * - Zero terminated 145 */ 146 HGCMFunctionParameter key; 147 } DelConfigKey; 127 148 #pragma pack () 128 149 -
trunk/src/VBox/HostServices/SharedInfoServices/service.cpp
r9995 r10003 23 23 /** 24 24 * An HGCM service for passing requests which do not need any persistant state 25 * to handle. We currently only support two types of request - set guest 26 * configuration key (SET_CONFIG_KEY and SET_CONFIG_KEY_HOST) and get 27 * configuration key (GET_CONFIG_KEY and GET_CONFIG_KEY_HOST). These may be 28 * used to read and to write configuration information which is available to 25 * to handle. We currently only support three types of request - set guest 26 * property (SET_CONFIG_KEY and SET_CONFIG_KEY_HOST), get guest property 27 * (GET_CONFIG_KEY and GET_CONFIG_KEY_HOST) and remove guest property 28 * (DEL_CONFIG_KEY and DEL_CONFIG_KEY_HOST). These may be used to read, to 29 * write and to remove configuration information which is available to 29 30 * both guest and host. This configuration information is stored in a CFGM 30 31 * node using the CFGM APIs. It is the responsibility of whoever creates the … … 157 158 int getKey(uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 158 159 int setKey(uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 160 int delKey(uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 159 161 void call (VBOXHGCMCALLHANDLE callHandle, uint32_t u32ClientID, 160 162 void *pvClient, uint32_t eFunction, uint32_t cParms, … … 336 338 337 339 /** 340 * Remove a value in the guest registry by key, checking the validity 341 * of the arguments passed. 342 * 343 * @returns iprt status value 344 * @param cParms the number of HGCM parameters supplied 345 * @param paParms the array of HGCM parameters 346 * @thread HGCM 347 */ 348 int Service::delKey(uint32_t cParms, VBOXHGCMSVCPARM paParms[]) 349 { 350 int rc = VINF_SUCCESS; 351 char *pszKey, *pszValue; 352 uint32_t cbKey, cbValue; 353 354 LogFlowThisFunc(("\n")); 355 if ( (cParms != 1) /* Hardcoded value as the next lines depend on it. */ 356 || (paParms[0].type != VBOX_HGCM_SVC_PARM_PTR) /* key */ 357 ) 358 rc = VERR_INVALID_PARAMETER; 359 if (RT_SUCCESS(rc)) 360 rc = VBoxHGCMParmPtrGet(&paParms[0], (void **) &pszKey, &cbKey); 361 if (RT_SUCCESS(rc)) 362 rc = validateKey(pszKey, cbKey); 363 if (RT_SUCCESS(rc)) 364 CFGMR3RemoveValue(mpNode, pszKey); 365 LogFlowThisFunc(("rc = %Rrc\n", rc)); 366 return rc; 367 } 368 369 370 /** 338 371 * Handle an HGCM service call. 339 372 * @copydoc VBOXHGCMSVCFNTABLE::pfnCall … … 367 400 if (RT_SUCCESS(rc)) 368 401 rc = setKey(cParms, paParms); 402 break; 403 404 /* The guest wishes to remove a configuration value */ 405 case DEL_CONFIG_KEY: 406 LogFlowFunc(("DEL_CONFIG_KEY\n")); 407 if (RT_SUCCESS(rc)) 408 rc = delKey(cParms, paParms); 369 409 break; 370 410 … … 430 470 if (RT_SUCCESS(rc)) 431 471 rc = setKey(cParms, paParms); 472 break; 473 474 /* The host wishes to remove a configuration value */ 475 case DEL_CONFIG_KEY_HOST: 476 LogFlowFunc(("DEL_CONFIG_KEY_HOST\n")); 477 if (RT_SUCCESS(rc)) 478 rc = delKey(cParms, paParms); 432 479 break; 433 480
Note:
See TracChangeset
for help on using the changeset viewer.