Changeset 12812 in vbox for trunk/src/VBox/Additions/common/VBoxControl
- Timestamp:
- Sep 29, 2008 4:27:32 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 37166
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
r12719 r12812 1044 1044 static int enumGuestProperty(int argc, char *argv[]) 1045 1045 { 1046 /* 1047 * Check the syntax. We can deduce the correct syntax from the number of 1048 * arguments. 1049 */ 1050 const char *paszPatterns = NULL; 1051 if ((argc > 1) && (0 == strcmp(argv[0], "-patterns"))) 1052 paszPatterns = argv[1]; 1046 /* 1047 * Check the syntax. We can deduce the correct syntax from the number of 1048 * arguments. 1049 */ 1050 char const * const *papszPatterns = NULL; 1051 size_t cPatterns = 0; 1052 if ( argc > 1 1053 && !strcmp(argv[0], "-patterns")) 1054 { 1055 papszPatterns = (char const * const *)&argv[1]; 1056 cPatterns = argc - 1; 1057 } 1053 1058 else if (argc != 0) 1054 1059 { … … 1057 1062 } 1058 1063 1059 /*1060 * Do the actual enumeration.1061 */1064 /* 1065 * Do the actual enumeration. 1066 */ 1062 1067 uint32_t u32ClientId = 0; 1063 PVBGLR3GUESTPROPENUM pHandle = NULL; 1064 RTMemAutoPtr<VBGLR3GUESTPROPENUM, VbglR3GuestPropEnumFree> Handle; 1065 char *pszName = NULL, *pszValue = NULL, *pszFlags = NULL; 1066 uint64_t u64Timestamp = 0; 1067 int rc = VINF_SUCCESS; 1068 rc = VbglR3GuestPropConnect(&u32ClientId); 1069 if (!RT_SUCCESS(rc)) 1070 VBoxControlError("Failed to connect to the guest property service! Error: %Rrc\n", rc); 1068 int rc = VbglR3GuestPropConnect(&u32ClientId); 1071 1069 if (RT_SUCCESS(rc)) 1072 1070 { 1073 char **ppaszPatterns = argc > 1 ? argv + 1 : NULL; 1074 int cPatterns = argc > 1 ? argc - 1 : 0; 1075 rc = VbglR3GuestPropEnum(u32ClientId, ppaszPatterns, cPatterns, &pHandle, 1071 PVBGLR3GUESTPROPENUM pHandle; 1072 const char *pszName, *pszValue, *pszFlags; 1073 uint64_t u64Timestamp; 1074 1075 rc = VbglR3GuestPropEnum(u32ClientId, papszPatterns, cPatterns, &pHandle, 1076 1076 &pszName, &pszValue, &u64Timestamp, &pszFlags); 1077 1077 if (RT_SUCCESS(rc)) 1078 1078 { 1079 Handle = pHandle; 1079 while (RT_SUCCESS(rc) && !pszName) 1080 { 1081 RTPrintf("Name: %s, value: %s, timestamp: %lld, flags: %s\n", 1082 pszName, pszValue, u64Timestamp, pszFlags); 1083 1084 rc = VbglR3GuestPropEnumNext(pHandle, &pszName, &pszValue, &u64Timestamp, &pszFlags); 1085 if (RT_FAILURE(rc)) 1086 VBoxControlError("Error while enumerating guest properties: %Rrc\n", rc); 1087 } 1088 1089 VbglR3GuestPropEnumFree(pHandle); 1080 1090 } 1081 1091 else if (VERR_NOT_FOUND == rc) … … 1083 1093 else 1084 1094 VBoxControlError("Failed to enumerate the guest properties! Error: %Rrc\n", rc); 1085 }1086 while (RT_SUCCESS(rc) && (pszName != NULL))1087 {1088 RTPrintf("Name: %s, value: %s, timestamp: %lld, flags: %s\n",1089 pszName, pszValue, u64Timestamp, pszFlags);1090 rc = VbglR3GuestPropEnumNext(Handle.get(), &pszName, &pszValue, &u64Timestamp, &pszFlags);1091 if (!RT_SUCCESS(rc))1092 VBoxControlError("Error while enumerating guest properties: %Rrc\n", rc);1093 }1094 1095 if (u32ClientId != 0)1096 1095 VbglR3GuestPropDisconnect(u32ClientId); 1096 } 1097 else 1098 VBoxControlError("Failed to connect to the guest property service! Error: %Rrc\n", rc); 1097 1099 return RT_SUCCESS(rc) ? 0 : 1; 1098 1100 }
Note:
See TracChangeset
for help on using the changeset viewer.