[vbox-dev] Simplest possible windows frontend - not working :(

Grigory Petrov eyeofhell at me.com
Sat Sep 19 14:18:35 PDT 2009


Hello.

I'm still tryting to get a guest OS image programmatically :). Now i have tried to create a simplest windows frontend, using vboxheadless sources as example. I have tried the following code (simplified to maximum, no err control etc):

#include "VirtualBox.h"
#include "VirtualBox_i.c"

struct CMyFrameBuffer : public IFramebuffer
// Here goes a simple implementation
    
struct CMyConsoleCallback : public IConsoleCallback
// Here goes a simple implementation

void main( void )
{
  ::CoInitialize( 0 );
  
  IVirtualBox* poVbox = 0;
  HRESULT hRet = ::CoCreateInstance( CLSID_VirtualBox, 0,
    CLSCTX_LOCAL_SERVER, IID_IVirtualBox, (void**)& poVbox );
  ISession* poSession = 0;
  hRet = ::CoCreateInstance( CLSID_Session, 0,
    CLSCTX_INPROC_SERVER, IID_ISession, (void**)& poSession );

  IMachine* poMachine = 0;
  poVbox->FindMachine( ::SysAllocString( L"test" ), & poMachine );
  BSTR oVmId;
  poMachine->get_Id( & oVmId );

  hRet = poVbox->OpenSession( poSession, oVmId );

  IConsole* poConsole = 0;
  poSession->get_Console( & poConsole );
  IDisplay* poDisplay = 0;
  poConsole->get_Display( & poDisplay );
  
  poDisplay->SetFramebuffer( 0, new CMyFrameBuffer() );
  poConsole->RegisterCallback( new CMyConsoleCallback() );
  
  IProgress* poProgress = 0;
  hRet = poConsole->PowerUp( & poProgress );
  
  ::Sleep( INFINITE );
  
  return;
}

Unfortunately, it's not working :(. PowerUp() returns S_OK, but OnStateChange() is called only with MachineState_Starting - no other non-IUnknown function from my IFramebuffer and IConsoleCallback are called :(. Virtualbox log shows following:

00:00:33.515 VirtualBox 3.0.6 r52128 win.x86 (Sep  9 2009 19:09:35) release log
00:00:33.515 Log opened 2009-09-19T21:14:53.531250000Z
00:00:33.515 OS Product: Windows XP Professional
00:00:33.515 OS Release: 5.1.2600
00:00:33.515 OS Service Pack: 3
00:00:33.515 Host RAM: 2039MB RAM, available: 1390MB
00:00:33.515 Executable: c:\me\work\grigory\test\debug\test.exe
00:00:33.515 Process ID: 4092
00:00:33.515 Package type: WINDOWS_32BITS_GENERIC
00:00:56.109 SUP: Loaded VMMR0.r0 (c:\me\work\grigory\test\debug/VMMR0.r0) at 0x89234060 - ModuleInit at 00000000892453d0 and ModuleTerm at 0000000089245440
00:00:56.109 SUP: VMMR0EntryEx located at 0000000089246000, VMMR0EntryFast at 00000000892455a0 and VMMR0EntryInt at 0000000089245590
00:00:56.109 SUP: windbg> .reload /f c:\me\work\grigory\test\debug/VMMR0.r0=0x89234060

Host OS is WinXP SP3. I'm using latest virtualbox, sources and SDK. Compiled using Visual Studio Pro 2005. Virtual machine named 'test' is newly created without anything installed. It starts from virtualbox.exe without any problems.

Can any guru spare a bit of his knowledge and pinpoint what i'm doing wrong? I'm in great need of this guest OS image :(

Best, Grigory




More information about the vbox-dev mailing list