儲存庫 vbox 的更動 16548
- 時間撮記:
- 2009-2-6 下午01:45:47 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/cbinding/tstLinuxC.c
r16535 r16548 80 80 } 81 81 82 if (machineCnt) 83 { 84 printf("VM List:\n\n"); 85 86 /* 87 * Iterate through the collection. 88 */ 89 90 for (i = 0; i < machineCnt; ++i) 91 { 92 IMachine *machine = machines[i]; 93 PRBool isAccessible = PR_FALSE; 94 95 printf("\tMachine #%u\n", (unsigned)i); 96 97 if (!machine) 82 if (machineCnt == 0) 83 { 84 printf("\tNo VMs\n"); 85 return; 86 } 87 88 printf("VM List:\n\n"); 89 90 /* 91 * Iterate through the collection. 92 */ 93 94 for (i = 0; i < machineCnt; ++i) 95 { 96 IMachine *machine = machines[i]; 97 PRBool isAccessible = PR_FALSE; 98 99 printf("\tMachine #%u\n", (unsigned)i); 100 101 if (!machine) 102 { 103 printf("\t(skipped, NULL)\n"); 104 continue; 105 } 106 107 machine->vtbl->GetAccessible(machine, &isAccessible); 108 109 if (isAccessible) 110 { 111 PRUnichar *machineNameUtf16; 112 char *machineName; 113 114 machine->vtbl->GetName(machine, &machineNameUtf16); 115 VBoxUtf16ToUtf8(machineNameUtf16,&machineName); 116 printf("\tName: %s\n", machineName); 117 118 VBoxUtf8Free(machineName); 119 VBoxComUnallocMem(machineNameUtf16); 120 } 121 else 122 { 123 printf("\tName: <inaccessible>\n"); 124 } 125 126 127 { 128 nsID *iid = NULL; 129 char *uuidString; 130 131 machine->vtbl->GetId(machine, &iid); 132 uuidString = nsIDToString(iid); 133 printf("\tUUID: %s\n", uuidString); 134 135 free(uuidString); 136 VBoxComUnallocMem(iid); 137 } 138 139 if (isAccessible) 140 { 98 141 { 99 printf("\t(skipped, NULL)\n"); 100 continue; 142 PRUnichar *configFile; 143 char *configFile1 = calloc((size_t)64, (size_t)1); 144 145 machine->vtbl->GetSettingsFilePath(machine, &configFile); 146 VBoxUtf16ToUtf8(configFile, &configFile1); 147 printf("\tConfig file: %s\n", configFile1); 148 149 free(configFile1); 150 VBoxComUnallocMem(configFile); 101 151 } 102 152 103 machine->vtbl->GetAccessible(machine, &isAccessible);104 105 if (isAccessible)106 153 { 107 PRUnichar *machineNameUtf16; 108 char *machineName; 109 110 machine->vtbl->GetName(machine, &machineNameUtf16); 111 VBoxUtf16ToUtf8(machineNameUtf16,&machineName); 112 printf("\tName: %s\n", machineName); 113 114 VBoxUtf8Free(machineName); 115 VBoxComUnallocMem(machineNameUtf16); 154 PRUint32 memorySize; 155 156 machine->vtbl->GetMemorySize(machine, &memorySize); 157 printf("\tMemory size: %uMB\n", memorySize); 116 158 } 117 else 159 118 160 { 119 printf("\tName: <inaccessible>\n"); 161 PRUnichar *typeId; 162 PRUnichar *osNameUtf16; 163 char *osName; 164 IGuestOSType *osType = NULL; 165 166 machine->vtbl->GetOSTypeId(machine, &typeId); 167 virtualBox->vtbl->GetGuestOSType(virtualBox, typeId, &osType); 168 osType->vtbl->GetDescription(osType, &osNameUtf16); 169 VBoxUtf16ToUtf8(osNameUtf16,&osName); 170 printf("\tGuest OS: %s\n\n", osName); 171 172 osType->vtbl->nsisupports.Release((void *)osType); 173 VBoxUtf8Free(osName); 174 VBoxComUnallocMem(osNameUtf16); 175 VBoxComUnallocMem(typeId); 120 176 } 121 122 123 { 124 nsID *iid = NULL; 125 char *uuidString; 126 127 machine->vtbl->GetId(machine, &iid); 128 uuidString = nsIDToString(iid); 129 printf("\tUUID: %s\n", uuidString); 130 131 free(uuidString); 132 VBoxComUnallocMem(iid); 133 } 134 135 if (isAccessible) 136 { 137 { 138 PRUnichar *configFile; 139 char *configFile1 = calloc((size_t)64, (size_t)1); 140 141 machine->vtbl->GetSettingsFilePath(machine, &configFile); 142 VBoxUtf16ToUtf8(configFile, &configFile1); 143 printf("\tConfig file: %s\n", configFile1); 144 145 free(configFile1); 146 VBoxComUnallocMem(configFile); 147 } 148 149 { 150 PRUint32 memorySize; 151 152 machine->vtbl->GetMemorySize(machine, &memorySize); 153 printf("\tMemory size: %uMB\n", memorySize); 154 } 155 156 { 157 PRUnichar *typeId; 158 PRUnichar *osNameUtf16; 159 char *osName; 160 IGuestOSType *osType = NULL; 161 162 machine->vtbl->GetOSTypeId(machine, &typeId); 163 virtualBox->vtbl->GetGuestOSType(virtualBox, typeId, &osType); 164 osType->vtbl->GetDescription(osType, &osNameUtf16); 165 VBoxUtf16ToUtf8(osNameUtf16,&osName); 166 printf("\tGuest OS: %s\n\n", osName); 167 168 osType->vtbl->nsisupports.Release((void *)osType); 169 VBoxUtf8Free(osName); 170 VBoxComUnallocMem(osNameUtf16); 171 VBoxComUnallocMem(typeId); 172 } 173 } 174 } 175 176 /* 177 * Let the user chose a machine to start. 178 */ 179 180 printf("Type Machine# to start (0 - %u) or 'quit' to do nothing: ", 181 (unsigned)(machineCnt - 1)); 182 fflush(stdout); 183 184 if (scanf("%u", &start_id) == 1 && start_id < machineCnt) 185 { 186 IMachine *machine = machines[start_id]; 187 188 if (machine) 189 { 190 nsID *iid = NULL; 191 192 machine->vtbl->GetId(machine, &iid); 193 startVM(virtualBox, session, iid); 194 195 VBoxComUnallocMem(iid); 196 } 197 } 198 199 /* 200 * Don't forget to release the objects in the array. 201 */ 202 203 for (i = 0; i < machineCnt; ++i) 204 { 205 IMachine *machine = machines[i]; 206 207 if (machine) 208 { 209 machine->vtbl->nsisupports.Release((void *)machine); 210 } 211 } 212 } 213 else 214 { 215 printf("\tNo VMs\n"); 177 } 178 } 179 180 /* 181 * Let the user chose a machine to start. 182 */ 183 184 printf("Type Machine# to start (0 - %u) or 'quit' to do nothing: ", 185 (unsigned)(machineCnt - 1)); 186 fflush(stdout); 187 188 if (scanf("%u", &start_id) == 1 && start_id < machineCnt) 189 { 190 IMachine *machine = machines[start_id]; 191 192 if (machine) 193 { 194 nsID *iid = NULL; 195 196 machine->vtbl->GetId(machine, &iid); 197 startVM(virtualBox, session, iid); 198 199 VBoxComUnallocMem(iid); 200 } 201 } 202 203 /* 204 * Don't forget to release the objects in the array. 205 */ 206 207 for (i = 0; i < machineCnt; ++i) 208 { 209 IMachine *machine = machines[i]; 210 211 if (machine) 212 { 213 machine->vtbl->nsisupports.Release((void *)machine); 214 } 216 215 } 217 216 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器