VirtualBox

source: vbox/trunk/src/VBox/Main/cbinding/tstXPCOMCCall.c@ 23835

Last change on this file since 23835 was 23801, checked in by vboxsync, 15 years ago

Main,VMM,Frontends,++: Teminology. Added a bind address for the (target) teleporter.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.6 KB
Line 
1/* $Revision: 23801 $ */
2/** @file tstXPCOMCGlue.c
3 * Demonstrator program to illustrate use of C bindings of Main API.
4 *
5 * Linux only at the moment due to shared library magic in the Makefile.
6 */
7
8/*
9 * Copyright (C) 2009 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24/*******************************************************************************
25* Header Files *
26*******************************************************************************/
27#include "VBoxXPCOMCGlue.h"
28#include <stdio.h>
29#include <string.h>
30#include <stdlib.h>
31#include <unistd.h>
32#include <signal.h>
33#include <sys/poll.h>
34
35/*******************************************************************************
36* Internal Functions *
37*******************************************************************************/
38static void listVMs(IVirtualBox *virtualBox, ISession *session, nsIEventQueue *queue);
39static void registerCallBack(IVirtualBox *virtualBox, ISession *session, PRUnichar *machineId, nsIEventQueue *queue);
40static void startVM(IVirtualBox *virtualBox, ISession *session, PRUnichar *id, nsIEventQueue *queue);
41
42/*******************************************************************************
43* Global Variables *
44*******************************************************************************/
45/** Set by signal handler. */
46static volatile int g_fStop = 0;
47
48int volatile g_refcount = 0;
49
50/* #define for printing nsID type UUID's */
51
52#define printUUID(iid) \
53{\
54 printf(#iid ": {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",\
55 (unsigned)(iid)->m0,\
56 (unsigned)(iid)->m1,\
57 (unsigned)(iid)->m2,\
58 (unsigned)(iid)->m3[0],\
59 (unsigned)(iid)->m3[1],\
60 (unsigned)(iid)->m3[2],\
61 (unsigned)(iid)->m3[3],\
62 (unsigned)(iid)->m3[4],\
63 (unsigned)(iid)->m3[5],\
64 (unsigned)(iid)->m3[6],\
65 (unsigned)(iid)->m3[7]);\
66}\
67
68/**
69 * Callback functions
70 */
71static const char *GetStateName(PRUint32 machineState)
72{
73 switch (machineState)
74 {
75 case MachineState_Null: return "<null>";
76 case MachineState_PoweredOff: return "PoweredOff";
77 case MachineState_Saved: return "Saved";
78 case MachineState_Aborted: return "Aborted";
79 case MachineState_Running: return "Running";
80 case MachineState_Paused: return "Paused";
81 case MachineState_Stuck: return "Stuck";
82 case MachineState_Starting: return "Starting";
83 case MachineState_Stopping: return "Stopping";
84 case MachineState_Saving: return "Saving";
85 case MachineState_Restoring: return "Restoring";
86 case MachineState_TeleportingFrom: return "TeleportingFrom";
87 case MachineState_Discarding: return "Discarding";
88 case MachineState_SettingUp: return "SettingUp";
89 default: return "no idea";
90 }
91}
92
93static nsresult OnMousePointerShapeChange(
94 IConsoleCallback *pThis,
95 PRBool visible,
96 PRBool alpha,
97 PRUint32 xHot,
98 PRUint32 yHot,
99 PRUint32 width,
100 PRUint32 height,
101 PRUint8 * shape
102) {
103 printf("OnMousePointerShapeChange\n");
104 return 0;
105}
106
107static nsresult OnMouseCapabilityChange(
108 IConsoleCallback *pThis,
109 PRBool supportsAbsolute,
110 PRBool needsHostCursor
111) {
112 printf("OnMouseCapabilityChange\n");
113 return 0;
114}
115
116static nsresult OnKeyboardLedsChange(
117 IConsoleCallback *pThis,
118 PRBool numLock,
119 PRBool capsLock,
120 PRBool scrollLock
121) {
122 printf("OnMouseCapabilityChange\n");
123 return 0;
124}
125
126static nsresult OnStateChange(
127 IConsoleCallback *pThis,
128 PRUint32 state
129) {
130 printf("OnStateChange: %s\n", GetStateName(state));
131 fflush(stdout);
132 if (state == MachineState_PoweredOff)
133 g_fStop = 1;
134 return 0;
135}
136
137static nsresult OnAdditionsStateChange(IConsoleCallback *pThis )
138{
139 printf("OnAdditionsStateChange\n");
140 return 0;
141}
142
143static nsresult OnNetworkAdapterChange(
144 IConsoleCallback *pThis,
145 INetworkAdapter * networkAdapter
146) {
147 printf("OnNetworkAdapterChange\n");
148 return 0;
149}
150
151static nsresult OnSerialPortChange(
152 IConsoleCallback *pThis,
153 ISerialPort * serialPort
154) {
155 printf("OnSerialPortChange\n");
156 return 0;
157}
158
159static nsresult OnParallelPortChange(
160 IConsoleCallback *pThis,
161 IParallelPort * parallelPort
162) {
163 printf("OnParallelPortChange\n");
164 return 0;
165}
166
167static nsresult OnStorageControllerChange(IConsoleCallback *pThis)
168{
169 printf("OnStorageControllerChange\n");
170 return 0;
171}
172
173static nsresult OnMediumChange(IConsoleCallback *pThis,
174 IMediumAttachment *mediumAttachment)
175{
176 printf("OnMediumChange\n");
177 return 0;
178}
179
180static nsresult OnVRDPServerChange(IConsoleCallback *pThis )
181{
182 printf("OnVRDPServerChange\n");
183 return 0;
184}
185
186static nsresult OnUSBControllerChange(IConsoleCallback *pThis )
187{
188 printf("OnUSBControllerChange\n");
189 return 0;
190}
191
192static nsresult OnUSBDeviceStateChange(
193 IConsoleCallback *pThis,
194 IUSBDevice * device,
195 PRBool attached,
196 IVirtualBoxErrorInfo * error
197) {
198 printf("OnUSBDeviceStateChange\n");
199 return 0;
200}
201
202static nsresult OnSharedFolderChange(
203 IConsoleCallback *pThis,
204 PRUint32 scope
205) {
206 printf("OnSharedFolderChange\n");
207 return 0;
208}
209
210static nsresult OnRuntimeError(
211 IConsoleCallback *pThis,
212 PRBool fatal,
213 PRUnichar * id,
214 PRUnichar * message
215) {
216 printf("OnRuntimeError\n");
217 return 0;
218}
219
220static nsresult OnCanShowWindow(
221 IConsoleCallback *pThis,
222 PRBool * canShow
223) {
224 printf("OnCanShowWindow\n");
225 return 0;
226}
227
228static nsresult OnShowWindow(
229 IConsoleCallback *pThis,
230 PRUint64 * winId
231) {
232 printf("OnShowWindow\n");
233 return 0;
234}
235
236
237static nsresult AddRef(nsISupports *pThis)
238{
239 nsresult c;
240
241 c = ++g_refcount;
242 printf("AddRef: %d\n", c);
243 return c;
244}
245
246static nsresult Release(nsISupports *pThis)
247{
248 nsresult c;
249
250 c = --g_refcount;
251 printf("Release: %d\n", c);
252 if (c == 0)
253 {
254 /* delete object */
255 free(pThis->vtbl);
256 free(pThis);
257 }
258 return c;
259}
260
261static nsresult QueryInterface(nsISupports *pThis, const nsID *iid, void **resultp)
262{
263 static const nsID ivirtualboxCallbackUUID = IVIRTUALBOXCALLBACK_IID;
264 static const nsID isupportIID = NS_ISUPPORTS_IID;
265
266 /* match iid */
267 if ( memcmp(iid, &ivirtualboxCallbackUUID, sizeof(nsID)) == 0
268 || memcmp(iid, &isupportIID, sizeof(nsID)) == 0)
269 {
270 ++g_refcount;
271 printf("QueryInterface: %d\n", g_refcount);
272 *resultp = pThis;
273 return NS_OK;
274 }
275
276 /* printf("vboxCallback QueryInterface didn't find a matching interface\n"); */
277 printUUID(iid);
278 printUUID(&ivirtualboxCallbackUUID);
279 return NS_NOINTERFACE;
280}
281
282/**
283 * Signal callback.
284 *
285 * @param iSig The signal number (ignored).
286 */
287static void sigIntHandler(int iSig)
288{
289 printf("sigIntHandler\n");
290 (void)iSig;
291 g_fStop = 1;
292}
293
294/**
295 * Register callback functions for the selected VM.
296 *
297 * @param virtualBox ptr to IVirtualBox object
298 * @param session ptr to ISession object
299 * @param id identifies the machine to start
300 * @param queue handle to the event queue
301 */
302static void registerCallBack(IVirtualBox *virtualBox, ISession *session, PRUnichar *machineId, nsIEventQueue *queue)
303{
304 IConsole *console = NULL;
305 nsresult rc;
306
307 rc = session->vtbl->GetConsole(session, &console);
308 if ((NS_SUCCEEDED(rc)) && console)
309 {
310 IConsoleCallback *consoleCallback = NULL;
311
312 consoleCallback = calloc(1, sizeof(IConsoleCallback));
313 consoleCallback->vtbl = calloc(1, sizeof(struct IConsoleCallback_vtbl));
314
315 if (consoleCallback && consoleCallback->vtbl)
316 {
317 consoleCallback->vtbl->nsisupports.AddRef = &AddRef;
318 consoleCallback->vtbl->nsisupports.Release = &Release;
319 consoleCallback->vtbl->nsisupports.QueryInterface = &QueryInterface;
320 consoleCallback->vtbl->OnMousePointerShapeChange = &OnMousePointerShapeChange;
321 consoleCallback->vtbl->OnMouseCapabilityChange = &OnMouseCapabilityChange;
322 consoleCallback->vtbl->OnKeyboardLedsChange =&OnKeyboardLedsChange;
323 consoleCallback->vtbl->OnStateChange = &OnStateChange;
324 consoleCallback->vtbl->OnAdditionsStateChange = &OnAdditionsStateChange;
325 consoleCallback->vtbl->OnNetworkAdapterChange = &OnNetworkAdapterChange;
326 consoleCallback->vtbl->OnSerialPortChange = &OnSerialPortChange;
327 consoleCallback->vtbl->OnParallelPortChange = &OnParallelPortChange;
328 consoleCallback->vtbl->OnStorageControllerChange = &OnStorageControllerChange;
329 consoleCallback->vtbl->OnMediumChange = &OnMediumChange;
330 consoleCallback->vtbl->OnVRDPServerChange = &OnVRDPServerChange;
331 consoleCallback->vtbl->OnUSBControllerChange = &OnUSBControllerChange;
332 consoleCallback->vtbl->OnUSBDeviceStateChange = &OnUSBDeviceStateChange;
333 consoleCallback->vtbl->OnSharedFolderChange = &OnSharedFolderChange;
334 consoleCallback->vtbl->OnRuntimeError = &OnRuntimeError;
335 consoleCallback->vtbl->OnCanShowWindow = &OnCanShowWindow;
336 consoleCallback->vtbl->OnShowWindow = &OnShowWindow;
337 g_refcount = 1;
338
339 rc = console->vtbl->RegisterCallback(console, consoleCallback);
340 if (NS_SUCCEEDED(rc))
341 {
342 /* crude way to show how it works, but any
343 * great ideas anyone?
344 */
345 PRInt32 fd;
346 int ret;
347
348 printf("Entering event loop, PowerOff the machine to exit or press Ctrl-C to terminate\n");
349 fflush(stdout);
350 signal(SIGINT, sigIntHandler);
351
352 fd = queue->vtbl->GetEventQueueSelectFD(queue);
353 if (fd >= 0)
354 {
355 while (!g_fStop)
356 {
357 struct pollfd pfd;
358
359 pfd.fd = fd;
360 pfd.events = POLLIN | POLLERR | POLLHUP;
361 pfd.revents = 0;
362
363 ret = poll(&pfd, 1, 250);
364
365 if (ret <= 0)
366 continue;
367
368 if (pfd.revents & POLLHUP)
369 g_fStop = 1;
370
371 queue->vtbl->ProcessPendingEvents(queue);
372 }
373 }
374 else
375 {
376 while (!g_fStop)
377 {
378 PLEvent *pEvent = NULL;
379 rc = queue->vtbl->WaitForEvent(queue, &pEvent);
380 /*printf("event: %p rc=%x\n", (void *)pEvent, rc);*/
381 if (NS_SUCCEEDED(rc))
382 queue->vtbl->HandleEvent(queue, pEvent);
383 }
384 }
385 signal(SIGINT, SIG_DFL);
386 }
387 console->vtbl->UnregisterCallback(console, consoleCallback);
388 consoleCallback->vtbl->nsisupports.Release((nsISupports *)consoleCallback);
389 }
390 else
391 {
392 printf("Failed while allocating memory for console Callback.\n");
393 }
394 }
395}
396
397/**
398 * List the registered VMs.
399 *
400 * @param virtualBox ptr to IVirtualBox object
401 * @param session ptr to ISession object
402 * @param queue handle to the event queue
403 */
404static void listVMs(IVirtualBox *virtualBox, ISession *session, nsIEventQueue *queue)
405{
406 nsresult rc;
407 IMachine **machines = NULL;
408 PRUint32 machineCnt = 0;
409 PRUint32 i;
410 unsigned start_id;
411
412 /*
413 * Get the list of all registered VMs.
414 */
415
416 rc = virtualBox->vtbl->GetMachines(virtualBox, &machineCnt, &machines);
417 if (NS_FAILED(rc))
418 {
419 fprintf(stderr, "could not get list of machines, rc=%08x\n",
420 (unsigned)rc);
421 return;
422 }
423
424 if (machineCnt == 0)
425 {
426 printf("\tNo VMs\n");
427 return;
428 }
429
430 printf("VM List:\n\n");
431
432 /*
433 * Iterate through the collection.
434 */
435
436 for (i = 0; i < machineCnt; ++i)
437 {
438 IMachine *machine = machines[i];
439 PRBool isAccessible = PR_FALSE;
440
441 printf("\tMachine #%u\n", (unsigned)i);
442
443 if (!machine)
444 {
445 printf("\t(skipped, NULL)\n");
446 continue;
447 }
448
449 machine->vtbl->GetAccessible(machine, &isAccessible);
450
451 if (isAccessible)
452 {
453 PRUnichar *machineNameUtf16;
454 char *machineName;
455
456 machine->vtbl->GetName(machine, &machineNameUtf16);
457 g_pVBoxFuncs->pfnUtf16ToUtf8(machineNameUtf16,&machineName);
458 printf("\tName: %s\n", machineName);
459
460 g_pVBoxFuncs->pfnUtf8Free(machineName);
461 g_pVBoxFuncs->pfnComUnallocMem(machineNameUtf16);
462 }
463 else
464 {
465 printf("\tName: <inaccessible>\n");
466 }
467
468 {
469 PRUnichar *uuidUtf16 = NULL;
470 char *uuidUtf8 = NULL;
471
472 machine->vtbl->GetId(machine, &uuidUtf16);
473 g_pVBoxFuncs->pfnUtf16ToUtf8(uuidUtf16, &uuidUtf8);
474 printf("\tUUID: %s\n", uuidUtf8);
475
476 g_pVBoxFuncs->pfnUtf8Free(uuidUtf8);
477 g_pVBoxFuncs->pfnUtf16Free(uuidUtf16);
478 }
479
480 if (isAccessible)
481 {
482 {
483 PRUnichar *configFile;
484 char *configFile1 = calloc((size_t)64, (size_t)1);
485
486 machine->vtbl->GetSettingsFilePath(machine, &configFile);
487 g_pVBoxFuncs->pfnUtf16ToUtf8(configFile, &configFile1);
488 printf("\tConfig file: %s\n", configFile1);
489
490 free(configFile1);
491 g_pVBoxFuncs->pfnComUnallocMem(configFile);
492 }
493
494 {
495 PRUint32 memorySize;
496
497 machine->vtbl->GetMemorySize(machine, &memorySize);
498 printf("\tMemory size: %uMB\n", memorySize);
499 }
500
501 {
502 PRUnichar *typeId;
503 PRUnichar *osNameUtf16;
504 char *osName;
505 IGuestOSType *osType = NULL;
506
507 machine->vtbl->GetOSTypeId(machine, &typeId);
508 virtualBox->vtbl->GetGuestOSType(virtualBox, typeId, &osType);
509 osType->vtbl->GetDescription(osType, &osNameUtf16);
510 g_pVBoxFuncs->pfnUtf16ToUtf8(osNameUtf16,&osName);
511 printf("\tGuest OS: %s\n\n", osName);
512
513 osType->vtbl->nsisupports.Release((void *)osType);
514 g_pVBoxFuncs->pfnUtf8Free(osName);
515 g_pVBoxFuncs->pfnComUnallocMem(osNameUtf16);
516 g_pVBoxFuncs->pfnComUnallocMem(typeId);
517 }
518 }
519 }
520
521 /*
522 * Let the user chose a machine to start.
523 */
524
525 printf("Type Machine# to start (0 - %u) or 'quit' to do nothing: ",
526 (unsigned)(machineCnt - 1));
527 fflush(stdout);
528
529 if (scanf("%u", &start_id) == 1 && start_id < machineCnt)
530 {
531 IMachine *machine = machines[start_id];
532
533 if (machine)
534 {
535 PRUnichar *uuidUtf16 = NULL;
536
537 machine->vtbl->GetId(machine, &uuidUtf16);
538 startVM(virtualBox, session, uuidUtf16, queue);
539
540 g_pVBoxFuncs->pfnUtf16Free(uuidUtf16);
541 }
542 }
543
544 /*
545 * Don't forget to release the objects in the array.
546 */
547
548 for (i = 0; i < machineCnt; ++i)
549 {
550 IMachine *machine = machines[i];
551
552 if (machine)
553 {
554 machine->vtbl->nsisupports.Release((nsISupports *)machine);
555 }
556 }
557}
558
559/**
560 * Start a VM.
561 *
562 * @param virtualBox ptr to IVirtualBox object
563 * @param session ptr to ISession object
564 * @param id identifies the machine to start
565 * @param queue handle to the event queue
566 */
567
568static void startVM(IVirtualBox *virtualBox, ISession *session, PRUnichar *id, nsIEventQueue *queue)
569{
570 nsresult rc;
571 IMachine *machine = NULL;
572 IProgress *progress = NULL;
573 PRUnichar *env = NULL;
574 PRUnichar *sessionType;
575
576 rc = virtualBox->vtbl->GetMachine(virtualBox, id, &machine);
577
578 if (NS_FAILED(rc) || !machine)
579 {
580 fprintf(stderr, "Error: Couldn't get the machine handle.\n");
581 return;
582 }
583
584 g_pVBoxFuncs->pfnUtf8ToUtf16("gui", &sessionType);
585
586 rc = virtualBox->vtbl->OpenRemoteSession(
587 virtualBox,
588 session,
589 id,
590 sessionType,
591 env,
592 &progress
593 );
594
595 g_pVBoxFuncs->pfnUtf16Free(sessionType);
596
597 if (NS_FAILED(rc))
598 {
599 fprintf(stderr, "Error: OpenRemoteSession failed.\n");
600 }
601 else
602 {
603 PRBool completed;
604 PRInt32 resultCode;
605
606 printf("Waiting for the remote session to open...\n");
607 progress->vtbl->WaitForCompletion(progress, -1);
608
609 rc = progress->vtbl->GetCompleted(progress, &completed);
610 if (NS_FAILED(rc))
611 {
612 fprintf (stderr, "Error: GetCompleted status failed.\n");
613 }
614
615 progress->vtbl->GetResultCode(progress, &resultCode);
616 if (NS_FAILED(resultCode))
617 {
618 IVirtualBoxErrorInfo *errorInfo;
619 PRUnichar *textUtf16;
620 char *text;
621
622 progress->vtbl->GetErrorInfo(progress, &errorInfo);
623 errorInfo->vtbl->GetText(errorInfo, &textUtf16);
624 g_pVBoxFuncs->pfnUtf16ToUtf8(textUtf16, &text);
625 printf("Error: %s\n", text);
626
627 g_pVBoxFuncs->pfnComUnallocMem(textUtf16);
628 g_pVBoxFuncs->pfnUtf8Free(text);
629 }
630 else
631 {
632 fprintf(stderr, "Remote session has been successfully opened.\n");
633 registerCallBack(virtualBox, session, id, queue);
634 }
635 progress->vtbl->nsisupports.Release((void *)progress);
636 }
637
638 /* It's important to always release resources. */
639 machine->vtbl->nsisupports.Release((void *)machine);
640}
641
642/* Main - Start the ball rolling. */
643
644int main(int argc, char **argv)
645{
646 IVirtualBox *vbox = NULL;
647 ISession *session = NULL;
648 nsIEventQueue *queue = NULL;
649 PRUint32 revision = 0;
650 PRUnichar *versionUtf16 = NULL;
651 PRUnichar *homefolderUtf16 = NULL;
652 nsresult rc; /* Result code of various function (method) calls. */
653
654 printf("Starting Main\n");
655
656 /*
657 * VBoxComInitialize does all the necessary startup action and
658 * provides us with pointers to vbox and session handles.
659 * It should be matched by a call to VBoxComUninitialize(vbox)
660 * when done.
661 */
662
663 if (VBoxCGlueInit() != 0)
664 {
665 fprintf(stderr, "%s: FATAL: VBoxCGlueInit failed: %s\n",
666 argv[0], g_szVBoxErrMsg);
667 return EXIT_FAILURE;
668 }
669
670 g_pVBoxFuncs->pfnComInitialize(IVIRTUALBOX_IID_STR, &vbox,
671 ISESSION_IID_STR, &session);
672 if (vbox == NULL)
673 {
674 fprintf(stderr, "%s: FATAL: could not get vbox handle\n", argv[0]);
675 return EXIT_FAILURE;
676 }
677 if (session == NULL)
678 {
679 fprintf(stderr, "%s: FATAL: could not get session handle\n", argv[0]);
680 return EXIT_FAILURE;
681 }
682 g_pVBoxFuncs->pfnGetEventQueue(&queue);
683 printf("Got the event queue: %p\n", (void *)queue);
684
685 /*
686 * Now ask for revision, version and home folder information of
687 * this vbox. Were not using fancy macros here so it
688 * remains easy to see how we access C++'s vtable.
689 */
690
691 printf("----------------------------------------------------\n");
692
693 /* 1. Revision */
694
695 rc = vbox->vtbl->GetRevision(vbox, &revision);
696 if (NS_SUCCEEDED(rc))
697 {
698 printf("\tRevision: %u\n", revision);
699 }
700 else
701 {
702 fprintf(stderr, "%s: GetRevision() returned %08x\n",
703 argv[0], (unsigned)rc);
704 }
705
706 /* 2. Version */
707
708 rc = vbox->vtbl->GetVersion(vbox, &versionUtf16);
709 if (NS_SUCCEEDED(rc))
710 {
711 char *version = NULL;
712 g_pVBoxFuncs->pfnUtf16ToUtf8(versionUtf16, &version);
713 printf("\tVersion: %s\n", version);
714 g_pVBoxFuncs->pfnUtf8Free(version);
715 g_pVBoxFuncs->pfnComUnallocMem(versionUtf16);
716 }
717 else
718 {
719 fprintf(stderr, "%s: GetVersion() returned %08x\n",
720 argv[0], (unsigned)rc);
721 }
722
723 /* 3. Home Folder */
724
725 rc = vbox->vtbl->GetHomeFolder(vbox, &homefolderUtf16);
726 if (NS_SUCCEEDED(rc))
727 {
728 char *homefolder = NULL;
729 g_pVBoxFuncs->pfnUtf16ToUtf8(homefolderUtf16, &homefolder);
730 printf("\tHomeFolder: %s\n", homefolder);
731 g_pVBoxFuncs->pfnUtf8Free(homefolder);
732 g_pVBoxFuncs->pfnComUnallocMem(homefolderUtf16);
733 }
734 else
735 {
736 fprintf(stderr, "%s: GetHomeFolder() returned %08x\n",
737 argv[0], (unsigned)rc);
738 }
739
740 listVMs(vbox, session, queue);
741 session->vtbl->Close(session);
742
743 printf("----------------------------------------------------\n");
744
745 /*
746 * Do as mom told us: always clean up after yourself.
747 */
748
749 g_pVBoxFuncs->pfnComUninitialize();
750 VBoxCGlueTerm();
751 printf("Finished Main\n");
752
753 return 0;
754}
755/* vim: set ts=4 sw=4 et: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette