[Win32utils-devel] Unraveling a FAR*

Berger, Daniel Daniel.Berger at qwest.com
Tue Jun 10 10:55:40 EDT 2008


Hi all,

Just looking over fole_s_connect() in win32ole.c and I noticed this bit:

hr = CLSIDFromProgID(pBuf, &clsid);
...
hr = GetActiveObject(&clsid, 0, &pUnknown);
...
hr = pUnknown->lpVtbl->QueryInterface(
   pUnknown,
   &IID_IDispatch,
   (void **)&pDispatch
);

Using win32-api, that would be something like:

IID_IUnknown = [0,0,0,192,0,0,0,0,0,0,70].pack('ISSCCCCCCCC')

clsid   = 0.chr * 16
unknown = 0.chr * IID_IUnknown.size

hr = CLSIDFromProgID(multi_to_wide(server), clsid)
...
GetActiveObject(clsid, nil, unknown)
...
???

And here is where I'm stuck. How do I unravel a pointer to a struct and
then call a function on it? What is the equivalent of
pUnknown->lpVtbl->QueryInterface() ?

BTW, the prototype for GetActiveObject is:

HRESULT GetActiveObject(  
  REFCLSID  rclsid,       
  void FAR*  pvReserved,  
  IUnknown FAR* FAR*  ppunk  
);

Thanks,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.


More information about the win32utils-devel mailing list