1 | /** @file
|
---|
2 | *
|
---|
3 | * tstAPI - test program for our COM/XPCOM interface
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include <stdio.h>
|
---|
19 | #include <stdlib.h>
|
---|
20 |
|
---|
21 | #include <VBox/com/com.h>
|
---|
22 | #include <VBox/com/string.h>
|
---|
23 | #include <VBox/com/Guid.h>
|
---|
24 | #include <VBox/com/ErrorInfo.h>
|
---|
25 | #include <VBox/com/EventQueue.h>
|
---|
26 |
|
---|
27 | #include <VBox/com/VirtualBox.h>
|
---|
28 |
|
---|
29 | using namespace com;
|
---|
30 |
|
---|
31 | #define LOG_ENABLED
|
---|
32 | #define LOG_GROUP LOG_GROUP_MAIN
|
---|
33 | #define LOG_INSTANCE NULL
|
---|
34 | #include <VBox/log.h>
|
---|
35 |
|
---|
36 | #include <iprt/runtime.h>
|
---|
37 | #include <iprt/stream.h>
|
---|
38 |
|
---|
39 | #define printf RTPrintf
|
---|
40 |
|
---|
41 | // funcs
|
---|
42 | ///////////////////////////////////////////////////////////////////////////////
|
---|
43 |
|
---|
44 | HRESULT readAndChangeMachineSettings (IMachine *machine, IMachine *readonlyMachine = 0)
|
---|
45 | {
|
---|
46 | HRESULT rc = S_OK;
|
---|
47 |
|
---|
48 | Bstr name;
|
---|
49 | printf ("Getting machine name...\n");
|
---|
50 | CHECK_RC_RET (machine->COMGETTER(Name) (name.asOutParam()));
|
---|
51 | printf ("Name: {%ls}\n", name.raw());
|
---|
52 |
|
---|
53 | printf("Getting machine GUID...\n");
|
---|
54 | Guid guid;
|
---|
55 | CHECK_RC (machine->COMGETTER(Id) (guid.asOutParam()));
|
---|
56 | if (SUCCEEDED (rc) && !guid.isEmpty()) {
|
---|
57 | printf ("Guid::toString(): {%s}\n", (const char *) guid.toString());
|
---|
58 | } else {
|
---|
59 | printf ("WARNING: there's no GUID!");
|
---|
60 | }
|
---|
61 |
|
---|
62 | ULONG memorySize;
|
---|
63 | printf ("Getting memory size...\n");
|
---|
64 | CHECK_RC_RET (machine->COMGETTER(MemorySize) (&memorySize));
|
---|
65 | printf ("Memory size: %d\n", memorySize);
|
---|
66 |
|
---|
67 | MachineState_T machineState;
|
---|
68 | printf ("Getting machine state...\n");
|
---|
69 | CHECK_RC_RET (machine->COMGETTER(State) (&machineState));
|
---|
70 | printf ("Machine state: %d\n", machineState);
|
---|
71 |
|
---|
72 | BOOL modified;
|
---|
73 | printf ("Are any settings modified?...\n");
|
---|
74 | CHECK_RC (machine->COMGETTER(SettingsModified) (&modified));
|
---|
75 | if (SUCCEEDED (rc))
|
---|
76 | printf ("%s\n", modified ? "yes" : "no");
|
---|
77 |
|
---|
78 | ULONG memorySizeBig = memorySize * 10;
|
---|
79 | printf("Changing memory size to %d...\n", memorySizeBig);
|
---|
80 | CHECK_RC (machine->COMSETTER(MemorySize) (memorySizeBig));
|
---|
81 |
|
---|
82 | if (SUCCEEDED (rc))
|
---|
83 | {
|
---|
84 | printf ("Are any settings modified now?...\n");
|
---|
85 | CHECK_RC_RET (machine->COMGETTER(SettingsModified) (&modified));
|
---|
86 | printf ("%s\n", modified ? "yes" : "no");
|
---|
87 | ASSERT_RET (modified, 0);
|
---|
88 |
|
---|
89 | ULONG memorySizeGot;
|
---|
90 | printf ("Getting memory size again...\n");
|
---|
91 | CHECK_RC_RET (machine->COMGETTER(MemorySize) (&memorySizeGot));
|
---|
92 | printf ("Memory size: %d\n", memorySizeGot);
|
---|
93 | ASSERT_RET (memorySizeGot == memorySizeBig, 0);
|
---|
94 |
|
---|
95 | if (readonlyMachine)
|
---|
96 | {
|
---|
97 | printf ("Getting memory size of the counterpart readonly machine...\n");
|
---|
98 | ULONG memorySizeRO;
|
---|
99 | readonlyMachine->COMGETTER(MemorySize) (&memorySizeRO);
|
---|
100 | printf ("Memory size: %d\n", memorySizeRO);
|
---|
101 | ASSERT_RET (memorySizeRO != memorySizeGot, 0);
|
---|
102 | }
|
---|
103 |
|
---|
104 | printf ("Discarding recent changes...\n");
|
---|
105 | CHECK_RC_RET (machine->DiscardSettings());
|
---|
106 | printf ("Are any settings modified after discarding?...\n");
|
---|
107 | CHECK_RC_RET (machine->COMGETTER(SettingsModified) (&modified));
|
---|
108 | printf ("%s\n", modified ? "yes" : "no");
|
---|
109 | ASSERT_RET (!modified, 0);
|
---|
110 |
|
---|
111 | printf ("Getting memory size once more...\n");
|
---|
112 | CHECK_RC_RET (machine->COMGETTER(MemorySize) (&memorySizeGot));
|
---|
113 | printf ("Memory size: %d\n", memorySizeGot);
|
---|
114 | ASSERT_RET (memorySizeGot == memorySize, 0);
|
---|
115 |
|
---|
116 | memorySize = memorySize > 128 ? memorySize / 2 : memorySize * 2;
|
---|
117 | printf("Changing memory size to %d...\n", memorySize);
|
---|
118 | CHECK_RC_RET (machine->COMSETTER(MemorySize) (memorySize));
|
---|
119 | }
|
---|
120 |
|
---|
121 | Bstr desc;
|
---|
122 | printf ("Getting description...\n");
|
---|
123 | CHECK_ERROR_RET (machine, COMGETTER(Description) (desc.asOutParam()), rc);
|
---|
124 | printf ("Description is: \"%ls\"\n", desc.raw());
|
---|
125 |
|
---|
126 | desc = L"This is an exemplary description (changed).";
|
---|
127 | printf ("Setting description to \"%ls\"...\n", desc.raw());
|
---|
128 | CHECK_ERROR_RET (machine, COMSETTER(Description) (desc), rc);
|
---|
129 |
|
---|
130 | printf ("Saving machine settings...\n");
|
---|
131 | CHECK_RC (machine->SaveSettings());
|
---|
132 | if (SUCCEEDED (rc))
|
---|
133 | {
|
---|
134 | printf ("Are any settings modified after saving?...\n");
|
---|
135 | CHECK_RC_RET (machine->COMGETTER(SettingsModified) (&modified));
|
---|
136 | printf ("%s\n", modified ? "yes" : "no");
|
---|
137 | ASSERT_RET (!modified, 0);
|
---|
138 |
|
---|
139 | if (readonlyMachine) {
|
---|
140 | printf ("Getting memory size of the counterpart readonly machine...\n");
|
---|
141 | ULONG memorySizeRO;
|
---|
142 | readonlyMachine->COMGETTER(MemorySize) (&memorySizeRO);
|
---|
143 | printf ("Memory size: %d\n", memorySizeRO);
|
---|
144 | ASSERT_RET (memorySizeRO == memorySize, 0);
|
---|
145 | }
|
---|
146 | }
|
---|
147 |
|
---|
148 | Bstr extraDataKey = L"Blafasel";
|
---|
149 | Bstr extraData;
|
---|
150 | printf ("Getting extra data key {%ls}...\n", extraDataKey.raw());
|
---|
151 | CHECK_RC_RET (machine->GetExtraData (extraDataKey, extraData.asOutParam()));
|
---|
152 | if (!extraData.isEmpty()) {
|
---|
153 | printf ("Extra data value: {%ls}\n", extraData.raw());
|
---|
154 | } else {
|
---|
155 | if (extraData.isNull())
|
---|
156 | printf ("No extra data exists\n");
|
---|
157 | else
|
---|
158 | printf ("Extra data is empty\n");
|
---|
159 | }
|
---|
160 |
|
---|
161 | if (extraData.isEmpty())
|
---|
162 | extraData = L"Das ist die Berliner Luft, Luft, Luft...";
|
---|
163 | else
|
---|
164 | extraData.setNull();
|
---|
165 | printf (
|
---|
166 | "Setting extra data key {%ls} to {%ls}...\n",
|
---|
167 | extraDataKey.raw(), extraData.raw()
|
---|
168 | );
|
---|
169 | CHECK_RC (machine->SetExtraData (extraDataKey, extraData));
|
---|
170 |
|
---|
171 | if (SUCCEEDED (rc)) {
|
---|
172 | printf ("Getting extra data key {%ls} again...\n", extraDataKey.raw());
|
---|
173 | CHECK_RC_RET (machine->GetExtraData (extraDataKey, extraData.asOutParam()));
|
---|
174 | if (!extraData.isEmpty()) {
|
---|
175 | printf ("Extra data value: {%ls}\n", extraData.raw());
|
---|
176 | } else {
|
---|
177 | if (extraData.isNull())
|
---|
178 | printf ("No extra data exists\n");
|
---|
179 | else
|
---|
180 | printf ("Extra data is empty\n");
|
---|
181 | }
|
---|
182 | }
|
---|
183 |
|
---|
184 | return rc;
|
---|
185 | }
|
---|
186 |
|
---|
187 | // main
|
---|
188 | ///////////////////////////////////////////////////////////////////////////////
|
---|
189 |
|
---|
190 | int main(int argc, char *argv[])
|
---|
191 | {
|
---|
192 | /*
|
---|
193 | * Initialize the VBox runtime without loading
|
---|
194 | * the support driver.
|
---|
195 | */
|
---|
196 | RTR3Init(false);
|
---|
197 |
|
---|
198 | HRESULT rc;
|
---|
199 |
|
---|
200 | {
|
---|
201 | char homeDir [RTPATH_MAX];
|
---|
202 | GetVBoxUserHomeDirectory (homeDir, sizeof (homeDir));
|
---|
203 | printf ("VirtualBox Home Directory = '%s'\n", homeDir);
|
---|
204 | }
|
---|
205 |
|
---|
206 | printf ("Initializing COM...\n");
|
---|
207 |
|
---|
208 | CHECK_RC_RET (com::Initialize());
|
---|
209 |
|
---|
210 | do
|
---|
211 | {
|
---|
212 | // scopes all the stuff till shutdown
|
---|
213 | ////////////////////////////////////////////////////////////////////////////
|
---|
214 |
|
---|
215 | ComPtr <IVirtualBox> virtualBox;
|
---|
216 | ComPtr <ISession> session;
|
---|
217 |
|
---|
218 | #if 0
|
---|
219 | // Utf8Str test
|
---|
220 | ////////////////////////////////////////////////////////////////////////////
|
---|
221 |
|
---|
222 | Utf8Str nullUtf8Str;
|
---|
223 | printf ("nullUtf8Str='%s'\n", nullUtf8Str.raw());
|
---|
224 |
|
---|
225 | Utf8Str simpleUtf8Str = "simpleUtf8Str";
|
---|
226 | printf ("simpleUtf8Str='%s'\n", simpleUtf8Str.raw());
|
---|
227 |
|
---|
228 | Utf8Str utf8StrFmt = Utf8StrFmt ("[0=%d]%s[1=%d]",
|
---|
229 | 0, "utf8StrFmt", 1);
|
---|
230 | printf ("utf8StrFmt='%s'\n", utf8StrFmt.raw());
|
---|
231 |
|
---|
232 | #endif
|
---|
233 |
|
---|
234 | printf ("Creating VirtualBox object...\n");
|
---|
235 | CHECK_RC (virtualBox.createLocalObject (CLSID_VirtualBox));
|
---|
236 | if (FAILED (rc))
|
---|
237 | {
|
---|
238 | CHECK_ERROR_NOCALL();
|
---|
239 | break;
|
---|
240 | }
|
---|
241 |
|
---|
242 | printf ("Creating Session object...\n");
|
---|
243 | CHECK_RC (session.createInprocObject (CLSID_Session));
|
---|
244 | if (FAILED (rc))
|
---|
245 | {
|
---|
246 | CHECK_ERROR_NOCALL();
|
---|
247 | break;
|
---|
248 | }
|
---|
249 |
|
---|
250 | #if 1
|
---|
251 | // IUnknown identity test
|
---|
252 | ////////////////////////////////////////////////////////////////////////////
|
---|
253 | {
|
---|
254 | {
|
---|
255 | ComPtr <IVirtualBox> virtualBox2;
|
---|
256 |
|
---|
257 | printf ("Creating one more VirtualBox object...\n");
|
---|
258 | CHECK_RC (virtualBox2.createLocalObject (CLSID_VirtualBox));
|
---|
259 | if (FAILED (rc))
|
---|
260 | {
|
---|
261 | CHECK_ERROR_NOCALL();
|
---|
262 | break;
|
---|
263 | }
|
---|
264 |
|
---|
265 | printf ("IVirtualBox(virualBox)=%p IVirtualBox(virualBox2)=%p\n",
|
---|
266 | (IVirtualBox *) virtualBox, (IVirtualBox *) virtualBox2);
|
---|
267 | Assert ((IVirtualBox *) virtualBox == (IVirtualBox *) virtualBox2);
|
---|
268 |
|
---|
269 | ComPtr <IUnknown> unk (virtualBox);
|
---|
270 | ComPtr <IUnknown> unk2;
|
---|
271 | unk2 = virtualBox2;
|
---|
272 |
|
---|
273 | printf ("IUnknown(virualBox)=%p IUnknown(virualBox2)=%p\n",
|
---|
274 | (IUnknown *) unk, (IUnknown *) unk2);
|
---|
275 | Assert ((IUnknown *) unk == (IUnknown *) unk2);
|
---|
276 |
|
---|
277 | ComPtr <IVirtualBox> vb = unk;
|
---|
278 | ComPtr <IVirtualBox> vb2 = unk;
|
---|
279 |
|
---|
280 | printf ("IVirtualBox(IUnknown(virualBox))=%p IVirtualBox(IUnknown(virualBox2))=%p\n",
|
---|
281 | (IVirtualBox *) vb, (IVirtualBox *) vb2);
|
---|
282 | Assert ((IVirtualBox *) vb == (IVirtualBox *) vb2);
|
---|
283 | }
|
---|
284 |
|
---|
285 | {
|
---|
286 | ComPtr <IHost> host;
|
---|
287 | CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
288 | printf (" IHost(host)=%p\n", (IHost *) host);
|
---|
289 | ComPtr <IUnknown> unk = host;
|
---|
290 | printf (" IUnknown(host)=%p\n", (IUnknown *) unk);
|
---|
291 | ComPtr <IHost> host_copy = unk;
|
---|
292 | printf (" IHost(host_copy)=%p\n", (IHost *) host_copy);
|
---|
293 | ComPtr <IUnknown> unk_copy = host_copy;
|
---|
294 | printf (" IUnknown(host_copy)=%p\n", (IUnknown *) unk_copy);
|
---|
295 | Assert ((IUnknown *) unk == (IUnknown *) unk_copy);
|
---|
296 |
|
---|
297 | /* query IUnknown on IUnknown */
|
---|
298 | ComPtr <IUnknown> unk_copy_copy;
|
---|
299 | unk_copy.queryInterfaceTo (unk_copy_copy.asOutParam());
|
---|
300 | printf (" IUnknown(unk_copy)=%p\n", (IUnknown *) unk_copy_copy);
|
---|
301 | Assert ((IUnknown *) unk_copy == (IUnknown *) unk_copy_copy);
|
---|
302 | /* query IUnknown on IUnknown in the opposite direction */
|
---|
303 | unk_copy_copy.queryInterfaceTo (unk_copy.asOutParam());
|
---|
304 | printf (" IUnknown(unk_copy_copy)=%p\n", (IUnknown *) unk_copy);
|
---|
305 | Assert ((IUnknown *) unk_copy == (IUnknown *) unk_copy_copy);
|
---|
306 |
|
---|
307 | /* query IUnknown again after releasing all previous IUnknown instances
|
---|
308 | * but keeping IHost -- it should remain the same (Identity Rule) */
|
---|
309 | IUnknown *oldUnk = unk;
|
---|
310 | unk.setNull();
|
---|
311 | unk_copy.setNull();
|
---|
312 | unk_copy_copy.setNull();
|
---|
313 | unk = host;
|
---|
314 | printf (" IUnknown(host)=%p\n", (IUnknown *) unk);
|
---|
315 | Assert (oldUnk == (IUnknown *) unk);
|
---|
316 | }
|
---|
317 |
|
---|
318 | // printf ("Will be now released (press Enter)...");
|
---|
319 | // getchar();
|
---|
320 | }
|
---|
321 | #endif
|
---|
322 |
|
---|
323 | // create the event queue
|
---|
324 | // (here it is necessary only to process remaining XPCOM/IPC events
|
---|
325 | // after the session is closed)
|
---|
326 | EventQueue eventQ;
|
---|
327 |
|
---|
328 | #if 0
|
---|
329 | // the simplest COM API test
|
---|
330 | ////////////////////////////////////////////////////////////////////////////
|
---|
331 | {
|
---|
332 | Bstr version;
|
---|
333 | CHECK_ERROR_BREAK (virtualBox, COMGETTER(Version) (version.asOutParam()));
|
---|
334 | printf ("VirtualBox version = %ls\n", version.raw());
|
---|
335 | }
|
---|
336 | #endif
|
---|
337 |
|
---|
338 | #if 0
|
---|
339 | // some outdated stuff
|
---|
340 | ////////////////////////////////////////////////////////////////////////////
|
---|
341 |
|
---|
342 | printf("Getting IHost interface...\n");
|
---|
343 | IHost *host;
|
---|
344 | rc = virtualBox->GetHost(&host);
|
---|
345 | if (SUCCEEDED(rc))
|
---|
346 | {
|
---|
347 | IHostDVDDriveCollection *dvdColl;
|
---|
348 | rc = host->GetHostDVDDrives(&dvdColl);
|
---|
349 | if (SUCCEEDED(rc))
|
---|
350 | {
|
---|
351 | IHostDVDDrive *dvdDrive = NULL;
|
---|
352 | dvdColl->GetNextHostDVDDrive(dvdDrive, &dvdDrive);
|
---|
353 | while (dvdDrive)
|
---|
354 | {
|
---|
355 | BSTR driveName;
|
---|
356 | char *driveNameUtf8;
|
---|
357 | dvdDrive->GetDriveName(&driveName);
|
---|
358 | RTStrUcs2ToUtf8(&driveNameUtf8, (PCRTUCS2)driveName);
|
---|
359 | printf("Host DVD drive name: %s\n", driveNameUtf8);
|
---|
360 | RTStrFree(driveNameUtf8);
|
---|
361 | SysFreeString(driveName);
|
---|
362 | IHostDVDDrive *dvdDriveTemp = dvdDrive;
|
---|
363 | dvdColl->GetNextHostDVDDrive(dvdDriveTemp, &dvdDrive);
|
---|
364 | dvdDriveTemp->Release();
|
---|
365 | }
|
---|
366 | dvdColl->Release();
|
---|
367 | } else
|
---|
368 | {
|
---|
369 | printf("Could not get host DVD drive collection\n");
|
---|
370 | }
|
---|
371 |
|
---|
372 | IHostFloppyDriveCollection *floppyColl;
|
---|
373 | rc = host->GetHostFloppyDrives(&floppyColl);
|
---|
374 | if (SUCCEEDED(rc))
|
---|
375 | {
|
---|
376 | IHostFloppyDrive *floppyDrive = NULL;
|
---|
377 | floppyColl->GetNextHostFloppyDrive(floppyDrive, &floppyDrive);
|
---|
378 | while (floppyDrive)
|
---|
379 | {
|
---|
380 | BSTR driveName;
|
---|
381 | char *driveNameUtf8;
|
---|
382 | floppyDrive->GetDriveName(&driveName);
|
---|
383 | RTStrUcs2ToUtf8(&driveNameUtf8, (PCRTUCS2)driveName);
|
---|
384 | printf("Host floppy drive name: %s\n", driveNameUtf8);
|
---|
385 | RTStrFree(driveNameUtf8);
|
---|
386 | SysFreeString(driveName);
|
---|
387 | IHostFloppyDrive *floppyDriveTemp = floppyDrive;
|
---|
388 | floppyColl->GetNextHostFloppyDrive(floppyDriveTemp, &floppyDrive);
|
---|
389 | floppyDriveTemp->Release();
|
---|
390 | }
|
---|
391 | floppyColl->Release();
|
---|
392 | } else
|
---|
393 | {
|
---|
394 | printf("Could not get host floppy drive collection\n");
|
---|
395 | }
|
---|
396 | host->Release();
|
---|
397 | } else
|
---|
398 | {
|
---|
399 | printf("Call failed\n");
|
---|
400 | }
|
---|
401 | printf ("\n");
|
---|
402 | #endif
|
---|
403 |
|
---|
404 | #if 0
|
---|
405 | // IVirtualBoxErrorInfo test
|
---|
406 | ////////////////////////////////////////////////////////////////////////////
|
---|
407 | {
|
---|
408 | // RPC calls
|
---|
409 |
|
---|
410 | // call a method that will definitely fail
|
---|
411 | Guid uuid;
|
---|
412 | ComPtr <IHardDisk> hardDisk;
|
---|
413 | rc = virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
|
---|
414 | printf ("virtualBox->GetHardDisk(null-uuid)=%08X\n", rc);
|
---|
415 |
|
---|
416 | // {
|
---|
417 | // com::ErrorInfo info (virtualBox);
|
---|
418 | // PRINT_ERROR_INFO (info);
|
---|
419 | // }
|
---|
420 |
|
---|
421 | // call a method that will definitely succeed
|
---|
422 | Bstr version;
|
---|
423 | rc = virtualBox->COMGETTER(Version) (version.asOutParam());
|
---|
424 | printf ("virtualBox->COMGETTER(Version)=%08X\n", rc);
|
---|
425 |
|
---|
426 | {
|
---|
427 | com::ErrorInfo info (virtualBox);
|
---|
428 | PRINT_ERROR_INFO (info);
|
---|
429 | }
|
---|
430 |
|
---|
431 | // Local calls
|
---|
432 |
|
---|
433 | // call a method that will definitely fail
|
---|
434 | ComPtr <IMachine> machine;
|
---|
435 | rc = session->COMGETTER(Machine)(machine.asOutParam());
|
---|
436 | printf ("session->COMGETTER(Machine)=%08X\n", rc);
|
---|
437 |
|
---|
438 | // {
|
---|
439 | // com::ErrorInfo info (virtualBox);
|
---|
440 | // PRINT_ERROR_INFO (info);
|
---|
441 | // }
|
---|
442 |
|
---|
443 | // call a method that will definitely succeed
|
---|
444 | SessionState_T state;
|
---|
445 | rc = session->COMGETTER(State) (&state);
|
---|
446 | printf ("session->COMGETTER(State)=%08X\n", rc);
|
---|
447 |
|
---|
448 | {
|
---|
449 | com::ErrorInfo info (virtualBox);
|
---|
450 | PRINT_ERROR_INFO (info);
|
---|
451 | }
|
---|
452 | }
|
---|
453 | #endif
|
---|
454 |
|
---|
455 | #if 0
|
---|
456 | // register the existing hard disk image
|
---|
457 | ///////////////////////////////////////////////////////////////////////////
|
---|
458 | do
|
---|
459 | {
|
---|
460 | ComPtr <IHardDisk> hd;
|
---|
461 | Bstr src = L"E:\\develop\\innotek\\images\\NewHardDisk.vdi";
|
---|
462 | printf ("Opening the existing hard disk '%ls'...\n", src.raw());
|
---|
463 | CHECK_ERROR_BREAK (virtualBox, OpenHardDisk (src, hd.asOutParam()));
|
---|
464 | printf ("Enter to continue...\n");
|
---|
465 | getchar();
|
---|
466 | printf ("Registering the existing hard disk '%ls'...\n", src.raw());
|
---|
467 | CHECK_ERROR_BREAK (virtualBox, RegisterHardDisk (hd));
|
---|
468 | printf ("Enter to continue...\n");
|
---|
469 | getchar();
|
---|
470 | }
|
---|
471 | while (FALSE);
|
---|
472 | printf ("\n");
|
---|
473 | #endif
|
---|
474 |
|
---|
475 | #if 0
|
---|
476 | // find and unregister the existing hard disk image
|
---|
477 | ///////////////////////////////////////////////////////////////////////////
|
---|
478 | do
|
---|
479 | {
|
---|
480 | ComPtr <IVirtualDiskImage> vdi;
|
---|
481 | Bstr src = L"CreatorTest.vdi";
|
---|
482 | printf ("Unregistering the hard disk '%ls'...\n", src.raw());
|
---|
483 | CHECK_ERROR_BREAK (virtualBox, FindVirtualDiskImage (src, vdi.asOutParam()));
|
---|
484 | ComPtr <IHardDisk> hd = vdi;
|
---|
485 | Guid id;
|
---|
486 | CHECK_ERROR_BREAK (hd, COMGETTER(Id) (id.asOutParam()));
|
---|
487 | CHECK_ERROR_BREAK (virtualBox, UnregisterHardDisk (id, hd.asOutParam()));
|
---|
488 | }
|
---|
489 | while (FALSE);
|
---|
490 | printf ("\n");
|
---|
491 | #endif
|
---|
492 |
|
---|
493 | #if 0
|
---|
494 | // clone the registered hard disk
|
---|
495 | ///////////////////////////////////////////////////////////////////////////
|
---|
496 | do
|
---|
497 | {
|
---|
498 | #if defined RT_OS_LINUX
|
---|
499 | Bstr src = L"/mnt/hugaida/common/develop/innotek/images/freedos-linux.vdi";
|
---|
500 | #else
|
---|
501 | Bstr src = L"E:/develop/innotek/images/freedos.vdi";
|
---|
502 | #endif
|
---|
503 | Bstr dst = L"./clone.vdi";
|
---|
504 | RTPrintf ("Cloning '%ls' to '%ls'...\n", src.raw(), dst.raw());
|
---|
505 | ComPtr <IVirtualDiskImage> vdi;
|
---|
506 | CHECK_ERROR_BREAK (virtualBox, FindVirtualDiskImage (src, vdi.asOutParam()));
|
---|
507 | ComPtr <IHardDisk> hd = vdi;
|
---|
508 | ComPtr <IProgress> progress;
|
---|
509 | CHECK_ERROR_BREAK (hd, CloneToImage (dst, vdi.asOutParam(), progress.asOutParam()));
|
---|
510 | RTPrintf ("Waiting for completion...\n");
|
---|
511 | CHECK_ERROR_BREAK (progress, WaitForCompletion (-1));
|
---|
512 | ProgressErrorInfo ei (progress);
|
---|
513 | if (FAILED (ei.getResultCode()))
|
---|
514 | {
|
---|
515 | PRINT_ERROR_INFO (ei);
|
---|
516 | }
|
---|
517 | else
|
---|
518 | {
|
---|
519 | vdi->COMGETTER(FilePath) (dst.asOutParam());
|
---|
520 | RTPrintf ("Actual clone path is '%ls'\n", dst.raw());
|
---|
521 | }
|
---|
522 | }
|
---|
523 | while (FALSE);
|
---|
524 | printf ("\n");
|
---|
525 | #endif
|
---|
526 |
|
---|
527 | #if 0
|
---|
528 | // find a registered hard disk by location
|
---|
529 | ///////////////////////////////////////////////////////////////////////////
|
---|
530 | do
|
---|
531 | {
|
---|
532 | ComPtr <IHardDisk> hd;
|
---|
533 | static const wchar_t *Names[] =
|
---|
534 | {
|
---|
535 | #ifndef RT_OS_LINUX
|
---|
536 | L"E:/Develop/innotek/images/thinker/freedos.vdi",
|
---|
537 | L"E:/Develop/innotek/images/thinker/fReeDoS.vDI",
|
---|
538 | L"E:/Develop/innotek/images/vmdk/haiku.vmdk",
|
---|
539 | #else
|
---|
540 | L"/mnt/host/common/Develop/innotek/images/maggot/freedos.vdi",
|
---|
541 | L"/mnt/host/common/Develop/innotek/images/maggot/fReeDoS.vDI",
|
---|
542 | #endif
|
---|
543 | };
|
---|
544 | for (size_t i = 0; i < ELEMENTS (Names); ++ i)
|
---|
545 | {
|
---|
546 | Bstr src = Names [i];
|
---|
547 | printf ("Searching for hard disk '%ls'...\n", src.raw());
|
---|
548 | rc = virtualBox->FindHardDisk (src, hd.asOutParam());
|
---|
549 | if (SUCCEEDED (rc))
|
---|
550 | {
|
---|
551 | Guid id;
|
---|
552 | Bstr location;
|
---|
553 | CHECK_ERROR_BREAK (hd, COMGETTER(Id) (id.asOutParam()));
|
---|
554 | CHECK_ERROR_BREAK (hd, COMGETTER(Location) (location.asOutParam()));
|
---|
555 | printf ("Found, UUID={%Vuuid}, location='%ls'.\n",
|
---|
556 | id.raw(), location.raw());
|
---|
557 | }
|
---|
558 | else
|
---|
559 | {
|
---|
560 | PRINT_ERROR_INFO (com::ErrorInfo (virtualBox));
|
---|
561 | }
|
---|
562 | }
|
---|
563 | }
|
---|
564 | while (FALSE);
|
---|
565 | printf ("\n");
|
---|
566 | #endif
|
---|
567 |
|
---|
568 | #if 0
|
---|
569 | // access the machine in read-only mode
|
---|
570 | ///////////////////////////////////////////////////////////////////////////
|
---|
571 | do
|
---|
572 | {
|
---|
573 | ComPtr <IMachine> machine;
|
---|
574 | Bstr name = argc > 1 ? argv [1] : "dos";
|
---|
575 | printf ("Getting a machine object named '%ls'...\n", name.raw());
|
---|
576 | CHECK_ERROR_BREAK (virtualBox, FindMachine (name, machine.asOutParam()));
|
---|
577 | printf ("Accessing the machine in read-only mode:\n");
|
---|
578 | readAndChangeMachineSettings (machine);
|
---|
579 | #if 0
|
---|
580 | if (argc != 2)
|
---|
581 | {
|
---|
582 | printf ("Error: a string has to be supplied!\n");
|
---|
583 | }
|
---|
584 | else
|
---|
585 | {
|
---|
586 | Bstr secureLabel = argv[1];
|
---|
587 | machine->COMSETTER(ExtraData)(L"VBoxSDL/SecureLabel", secureLabel);
|
---|
588 | }
|
---|
589 | #endif
|
---|
590 | }
|
---|
591 | while (0);
|
---|
592 | printf ("\n");
|
---|
593 | #endif
|
---|
594 |
|
---|
595 | #if 0
|
---|
596 | // create a new machine (w/o registering it)
|
---|
597 | ///////////////////////////////////////////////////////////////////////////
|
---|
598 | do
|
---|
599 | {
|
---|
600 | ComPtr <IMachine> machine;
|
---|
601 | #if defined (RT_OS_LINUX)
|
---|
602 | Bstr baseDir = L"/tmp/vbox";
|
---|
603 | #else
|
---|
604 | Bstr baseDir = L"C:\\vbox";
|
---|
605 | #endif
|
---|
606 | Bstr name = L"machina";
|
---|
607 |
|
---|
608 | printf ("Creating a new machine object (base dir '%ls', name '%ls')...\n",
|
---|
609 | baseDir.raw(), name.raw());
|
---|
610 | CHECK_ERROR_BREAK (virtualBox, CreateMachine (baseDir, name,
|
---|
611 | machine.asOutParam()));
|
---|
612 |
|
---|
613 | printf ("Getting name...\n");
|
---|
614 | CHECK_ERROR_BREAK (machine, COMGETTER(Name) (name.asOutParam()));
|
---|
615 | printf ("Name: {%ls}\n", name.raw());
|
---|
616 |
|
---|
617 | BOOL modified = FALSE;
|
---|
618 | printf ("Are any settings modified?...\n");
|
---|
619 | CHECK_ERROR_BREAK (machine, COMGETTER(SettingsModified) (&modified));
|
---|
620 | printf ("%s\n", modified ? "yes" : "no");
|
---|
621 |
|
---|
622 | ASSERT_BREAK (modified == TRUE);
|
---|
623 |
|
---|
624 | name = L"Kakaya prekrasnaya virtual'naya mashina!";
|
---|
625 | printf ("Setting new name ({%ls})...\n", name.raw());
|
---|
626 | CHECK_ERROR_BREAK (machine, COMSETTER(Name) (name));
|
---|
627 |
|
---|
628 | printf ("Setting memory size to 111...\n");
|
---|
629 | CHECK_ERROR_BREAK (machine, COMSETTER(MemorySize) (111));
|
---|
630 |
|
---|
631 | Bstr desc = L"This is an exemplary description.";
|
---|
632 | printf ("Setting description to \"%ls\"...\n", desc.raw());
|
---|
633 | CHECK_ERROR_BREAK (machine, COMSETTER(Description) (desc));
|
---|
634 |
|
---|
635 | ComPtr <IGuestOSType> guestOSType;
|
---|
636 | Bstr type = L"os2warp45";
|
---|
637 | CHECK_ERROR_BREAK (virtualBox, GetGuestOSType (type, guestOSType.asOutParam()));
|
---|
638 |
|
---|
639 | printf ("Saving new machine settings...\n");
|
---|
640 | CHECK_ERROR_BREAK (machine, SaveSettings());
|
---|
641 |
|
---|
642 | printf ("Accessing the newly created machine:\n");
|
---|
643 | readAndChangeMachineSettings (machine);
|
---|
644 | }
|
---|
645 | while (FALSE);
|
---|
646 | printf ("\n");
|
---|
647 | #endif
|
---|
648 |
|
---|
649 | #if 0
|
---|
650 | // enumerate host DVD drives
|
---|
651 | ///////////////////////////////////////////////////////////////////////////
|
---|
652 | do
|
---|
653 | {
|
---|
654 | ComPtr <IHost> host;
|
---|
655 | CHECK_RC_BREAK (virtualBox->COMGETTER(Host) (host.asOutParam()));
|
---|
656 |
|
---|
657 | {
|
---|
658 | ComPtr <IHostDVDDriveCollection> coll;
|
---|
659 | CHECK_RC_BREAK (host->COMGETTER(DVDDrives) (coll.asOutParam()));
|
---|
660 | ComPtr <IHostDVDDriveEnumerator> enumerator;
|
---|
661 | CHECK_RC_BREAK (coll->Enumerate (enumerator.asOutParam()));
|
---|
662 | BOOL hasmore;
|
---|
663 | while (SUCCEEDED (enumerator->HasMore (&hasmore)) && hasmore)
|
---|
664 | {
|
---|
665 | ComPtr <IHostDVDDrive> drive;
|
---|
666 | CHECK_RC_BREAK (enumerator->GetNext (drive.asOutParam()));
|
---|
667 | Bstr name;
|
---|
668 | CHECK_RC_BREAK (drive->COMGETTER(Name) (name.asOutParam()));
|
---|
669 | printf ("Host DVD drive: name={%ls}\n", name.raw());
|
---|
670 | }
|
---|
671 | CHECK_RC_BREAK (rc);
|
---|
672 |
|
---|
673 | ComPtr <IHostDVDDrive> drive;
|
---|
674 | CHECK_ERROR (enumerator, GetNext (drive.asOutParam()));
|
---|
675 | CHECK_ERROR (coll, GetItemAt (1000, drive.asOutParam()));
|
---|
676 | CHECK_ERROR (coll, FindByName (Bstr ("R:"), drive.asOutParam()));
|
---|
677 | if (SUCCEEDED (rc))
|
---|
678 | {
|
---|
679 | Bstr name;
|
---|
680 | CHECK_RC_BREAK (drive->COMGETTER(Name) (name.asOutParam()));
|
---|
681 | printf ("Found by name: name={%ls}\n", name.raw());
|
---|
682 | }
|
---|
683 | }
|
---|
684 | }
|
---|
685 | while (FALSE);
|
---|
686 | printf ("\n");
|
---|
687 | #endif
|
---|
688 |
|
---|
689 | #if 0
|
---|
690 | // enumerate hard disks & dvd images
|
---|
691 | ///////////////////////////////////////////////////////////////////////////
|
---|
692 | do
|
---|
693 | {
|
---|
694 | {
|
---|
695 | ComPtr <IHardDiskCollection> coll;
|
---|
696 | CHECK_RC_BREAK (virtualBox->COMGETTER(HardDisks) (coll.asOutParam()));
|
---|
697 | ComPtr <IHardDiskEnumerator> enumerator;
|
---|
698 | CHECK_RC_BREAK (coll->Enumerate (enumerator.asOutParam()));
|
---|
699 | BOOL hasmore;
|
---|
700 | while (SUCCEEDED (enumerator->HasMore (&hasmore)) && hasmore)
|
---|
701 | {
|
---|
702 | ComPtr <IHardDisk> disk;
|
---|
703 | CHECK_RC_BREAK (enumerator->GetNext (disk.asOutParam()));
|
---|
704 | Guid id;
|
---|
705 | CHECK_RC_BREAK (disk->COMGETTER(Id) (id.asOutParam()));
|
---|
706 | Bstr path;
|
---|
707 | CHECK_RC_BREAK (disk->COMGETTER(FilePath) (path.asOutParam()));
|
---|
708 | printf ("Hard Disk: id={%s}, path={%ls}\n",
|
---|
709 | id.toString().raw(), path.raw());
|
---|
710 | Guid mid;
|
---|
711 | CHECK_RC_BREAK (
|
---|
712 | virtualBox->GetHardDiskUsage (id, ResourceUsage_AllUsage,
|
---|
713 | mid.asOutParam())
|
---|
714 | );
|
---|
715 | if (mid.isEmpty())
|
---|
716 | printf (" not used\n");
|
---|
717 | else
|
---|
718 | printf (" used by VM: {%s}\n", mid.toString().raw());
|
---|
719 | }
|
---|
720 | CHECK_RC_BREAK (rc);
|
---|
721 | }
|
---|
722 |
|
---|
723 | {
|
---|
724 | ComPtr <IDVDImageCollection> coll;
|
---|
725 | CHECK_RC_BREAK (virtualBox->COMGETTER(DVDImages) (coll.asOutParam()));
|
---|
726 | ComPtr <IDVDImageEnumerator> enumerator;
|
---|
727 | CHECK_RC_BREAK (coll->Enumerate (enumerator.asOutParam()));
|
---|
728 | BOOL hasmore;
|
---|
729 | while (SUCCEEDED (enumerator->HasMore (&hasmore)) && hasmore)
|
---|
730 | {
|
---|
731 | ComPtr <IDVDImage> image;
|
---|
732 | CHECK_RC_BREAK (enumerator->GetNext (image.asOutParam()));
|
---|
733 | Guid id;
|
---|
734 | CHECK_RC_BREAK (image->COMGETTER(Id) (id.asOutParam()));
|
---|
735 | Bstr path;
|
---|
736 | CHECK_RC_BREAK (image->COMGETTER(FilePath) (path.asOutParam()));
|
---|
737 | printf ("CD/DVD Image: id={%s}, path={%ls}\n",
|
---|
738 | id.toString().raw(), path.raw());
|
---|
739 | Bstr mIDs;
|
---|
740 | CHECK_RC_BREAK (
|
---|
741 | virtualBox->GetDVDImageUsage (id, ResourceUsage_AllUsage,
|
---|
742 | mIDs.asOutParam())
|
---|
743 | );
|
---|
744 | if (mIDs.isNull())
|
---|
745 | printf (" not used\n");
|
---|
746 | else
|
---|
747 | printf (" used by VMs: {%ls}\n", mIDs.raw());
|
---|
748 | }
|
---|
749 | CHECK_RC_BREAK (rc);
|
---|
750 | }
|
---|
751 | }
|
---|
752 | while (FALSE);
|
---|
753 | printf ("\n");
|
---|
754 | #endif
|
---|
755 |
|
---|
756 | #if 0
|
---|
757 | // open a (direct) session
|
---|
758 | ///////////////////////////////////////////////////////////////////////////
|
---|
759 | do
|
---|
760 | {
|
---|
761 | ComPtr <IMachine> machine;
|
---|
762 | Bstr name = argc > 1 ? argv [1] : "dos";
|
---|
763 | printf ("Getting a machine object named '%ls'...\n", name.raw());
|
---|
764 | CHECK_ERROR_BREAK (virtualBox, FindMachine (name, machine.asOutParam()));
|
---|
765 | Guid guid;
|
---|
766 | CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam()));
|
---|
767 | printf ("Opening a session for this machine...\n");
|
---|
768 | CHECK_RC_BREAK (virtualBox->OpenSession (session, guid));
|
---|
769 | #if 1
|
---|
770 | ComPtr <IMachine> sessionMachine;
|
---|
771 | printf ("Getting sessioned machine object...\n");
|
---|
772 | CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam()));
|
---|
773 | printf ("Accessing the machine within the session:\n");
|
---|
774 | readAndChangeMachineSettings (sessionMachine, machine);
|
---|
775 | #if 0
|
---|
776 | printf ("\n");
|
---|
777 | printf ("Enabling the VRDP server (must succeed even if the VM is saved):\n");
|
---|
778 | ComPtr <IVRDPServer> vrdp;
|
---|
779 | CHECK_ERROR_BREAK (sessionMachine, COMGETTER(VRDPServer) (vrdp.asOutParam()));
|
---|
780 | if (FAILED (vrdp->COMSETTER(Enabled) (TRUE)))
|
---|
781 | {
|
---|
782 | PRINT_ERROR_INFO (com::ErrorInfo (vrdp));
|
---|
783 | }
|
---|
784 | else
|
---|
785 | {
|
---|
786 | BOOL enabled = FALSE;
|
---|
787 | CHECK_ERROR_BREAK (vrdp, COMGETTER(Enabled) (&enabled));
|
---|
788 | printf ("VRDP server is %s\n", enabled ? "enabled" : "disabled");
|
---|
789 | }
|
---|
790 | #endif
|
---|
791 | #endif
|
---|
792 | #if 0
|
---|
793 | ComPtr <IConsole> console;
|
---|
794 | printf ("Getting the console object...\n");
|
---|
795 | CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam()));
|
---|
796 | printf ("Discarding the current machine state...\n");
|
---|
797 | ComPtr <IProgress> progress;
|
---|
798 | CHECK_ERROR_BREAK (console, DiscardCurrentState (progress.asOutParam()));
|
---|
799 | printf ("Waiting for completion...\n");
|
---|
800 | CHECK_ERROR_BREAK (progress, WaitForCompletion (-1));
|
---|
801 | ProgressErrorInfo ei (progress);
|
---|
802 | if (FAILED (ei.getResultCode()))
|
---|
803 | {
|
---|
804 | PRINT_ERROR_INFO (ei);
|
---|
805 |
|
---|
806 | ComPtr <IUnknown> initiator;
|
---|
807 | CHECK_ERROR_BREAK (progress, COMGETTER(Initiator) (initiator.asOutParam()));
|
---|
808 |
|
---|
809 | printf ("initiator(unk) = %p\n", (IUnknown *) initiator);
|
---|
810 | printf ("console(unk) = %p\n", (IUnknown *) ComPtr <IUnknown> ((IConsole *) console));
|
---|
811 | printf ("console = %p\n", (IConsole *) console);
|
---|
812 | }
|
---|
813 | #endif
|
---|
814 | printf("Press enter to close session...");
|
---|
815 | getchar();
|
---|
816 | session->Close();
|
---|
817 | }
|
---|
818 | while (FALSE);
|
---|
819 | printf ("\n");
|
---|
820 | #endif
|
---|
821 |
|
---|
822 | #if 0
|
---|
823 | // open a remote session
|
---|
824 | ///////////////////////////////////////////////////////////////////////////
|
---|
825 | do
|
---|
826 | {
|
---|
827 | ComPtr <IMachine> machine;
|
---|
828 | Bstr name = L"dos";
|
---|
829 | printf ("Getting a machine object named '%ls'...\n", name.raw());
|
---|
830 | CHECK_RC_BREAK (virtualBox->FindMachine (name, machine.asOutParam()));
|
---|
831 | Guid guid;
|
---|
832 | CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam()));
|
---|
833 | printf ("Opening a remote session for this machine...\n");
|
---|
834 | ComPtr <IProgress> progress;
|
---|
835 | CHECK_RC_BREAK (virtualBox->OpenRemoteSession (session, guid, Bstr("gui"),
|
---|
836 | NULL, progress.asOutParam()));
|
---|
837 | printf ("Waiting for the session to open...\n");
|
---|
838 | CHECK_RC_BREAK (progress->WaitForCompletion (-1));
|
---|
839 | ComPtr <IMachine> sessionMachine;
|
---|
840 | printf ("Getting sessioned machine object...\n");
|
---|
841 | CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam()));
|
---|
842 | ComPtr <IConsole> console;
|
---|
843 | printf ("Getting console object...\n");
|
---|
844 | CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam()));
|
---|
845 | printf ("Press enter to pause the VM execution in the remote session...");
|
---|
846 | getchar();
|
---|
847 | CHECK_RC (console->Pause());
|
---|
848 | printf ("Press enter to close this session...");
|
---|
849 | getchar();
|
---|
850 | session->Close();
|
---|
851 | }
|
---|
852 | while (FALSE);
|
---|
853 | printf ("\n");
|
---|
854 | #endif
|
---|
855 |
|
---|
856 | #if 0
|
---|
857 | // open an existing remote session
|
---|
858 | ///////////////////////////////////////////////////////////////////////////
|
---|
859 | do
|
---|
860 | {
|
---|
861 | ComPtr <IMachine> machine;
|
---|
862 | Bstr name = "dos";
|
---|
863 | printf ("Getting a machine object named '%ls'...\n", name.raw());
|
---|
864 | CHECK_RC_BREAK (virtualBox->FindMachine (name, machine.asOutParam()));
|
---|
865 | Guid guid;
|
---|
866 | CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam()));
|
---|
867 | printf ("Opening an existing remote session for this machine...\n");
|
---|
868 | CHECK_RC_BREAK (virtualBox->OpenExistingSession (session, guid));
|
---|
869 | ComPtr <IMachine> sessionMachine;
|
---|
870 | printf ("Getting sessioned machine object...\n");
|
---|
871 | CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam()));
|
---|
872 |
|
---|
873 | #if 0
|
---|
874 | Bstr extraDataKey = "VBoxSDL/SecureLabel";
|
---|
875 | Bstr extraData = "Das kommt jetzt noch viel krasser vom total konkreten API!";
|
---|
876 | CHECK_RC (sessionMachine->SetExtraData (extraDataKey, extraData));
|
---|
877 | #endif
|
---|
878 | #if 0
|
---|
879 | ComPtr <IConsole> console;
|
---|
880 | printf ("Getting console object...\n");
|
---|
881 | CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam()));
|
---|
882 | printf ("Press enter to pause the VM execution in the remote session...");
|
---|
883 | getchar();
|
---|
884 | CHECK_RC (console->Pause());
|
---|
885 | printf ("Press enter to close this session...");
|
---|
886 | getchar();
|
---|
887 | #endif
|
---|
888 | session->Close();
|
---|
889 | }
|
---|
890 | while (FALSE);
|
---|
891 | printf ("\n");
|
---|
892 | #endif
|
---|
893 |
|
---|
894 | printf ("Press enter to release Session and VirtualBox instances...");
|
---|
895 | getchar();
|
---|
896 |
|
---|
897 | // end "all-stuff" scope
|
---|
898 | ////////////////////////////////////////////////////////////////////////////
|
---|
899 | }
|
---|
900 | while (0);
|
---|
901 |
|
---|
902 | printf("Press enter to shutdown COM...");
|
---|
903 | getchar();
|
---|
904 |
|
---|
905 | com::Shutdown();
|
---|
906 |
|
---|
907 | printf ("tstAPI FINISHED.\n");
|
---|
908 |
|
---|
909 | return rc;
|
---|
910 | }
|
---|