<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Michael,</DIV>
<DIV> </DIV>
<DIV>Thanks. This is the info I needed.</DIV>
<DIV> </DIV>
<DIV>I was trying not to modify the main line code. If there is no better way, I guess need to modify the host call to pass the vm info I needed.</DIV>
<DIV> </DIV>
<DIV>By the way, we have added copy/paste of files between guest and host, so a user can do Control-C/Control-V for file copying, etc. To do this, we added CF_HDROP format support to the shared clipboard. We used our own shared folder additions. if you would like to add this support to the main line of code, pls let me know. (we only did it on windows guest and host).</DIV>
<DIV> </DIV>
<DIV>We may add drag-drop support on windows later on</DIV>
<DIV> </DIV>
<DIV>Huihong<BR><BR>--- On <B>Mon, 5/11/09, Michael Thayer <I><Michael.Thayer@Sun.COM></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Michael Thayer <Michael.Thayer@Sun.COM><BR>Subject: Re: [vbox-dev] How to get the current running IMachine instance inside a host service?<BR>To: "Huihong Luo" <huisinro@yahoo.com><BR>Cc: "Josh Wright" <jshwright@gmail.com>, vbox-dev@virtualbox.org<BR>Date: Monday, May 11, 2009, 2:10 AM<BR><BR>
<DIV class=plainMail>Hello Huihong,<BR><BR>Huihong Luo wrote:<BR>> take an example, the VBoxSharedFolders.dll is a service between guest and host. This dll is running inside the same process as the VirtualBox.exe launching the vm. I just need to find out the current vm this shared dll is being used.<BR>>  <BR>> I couldn't find any method to do this simple thing: where am I?<BR>HGCM services have no built-in mechanism for getting information about<BR>the VM they are running in and such-like.  This is because they were<BR>originally designed to work in things like VBoxBFE, which is a<BR>simplified frontend where the normal VirtualBox APIs are not available.<BR>What you can do instead is to use the HGCM "host call" functionality to<BR>pass any needed information into the service when it is started.  To see<BR>examples of this, grep for "HostCall" in src/VBox/Main/ConsoleImpl[2].cpp.<BR><BR>If you need to get information or send
 notifications or whatever while<BR>the service is running, you can also register callbacks ("host service<BR>extensions") with the service.  For an example of this, grep for<BR>"ServiceExtension" in ConsoleImpl2.cpp.<BR><BR>BTW, I haven't forgotten the VbglR3GuestPropWait() issue you mentioned,<BR>but I haven't got round to looking at it yet.  Sorry!<BR><BR>Regards,<BR><BR>Michael<BR>-- <BR>Sun Microsystems GmbH        Michael Thayer<BR>Werkstrasse 24               VirtualBox engineer<BR>71384 Weinstadt, Germany     mailto:<A href="http://us.mc11.mail.yahoo.com/mc/compose?to=michael.thayer@sun.com" ymailto="mailto:michael.thayer@sun.com">michael.thayer@sun.com</A><BR><BR>Sitz der Gesellschaft:<BR>Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten<BR>Amtsgericht Muenchen: HRB 161028<BR>Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Wolf
 Frenkel<BR>Vorsitzender des Aufsichtsrates: Martin Haering<BR></DIV></BLOCKQUOTE></td></tr></table>