I try to enter COM from the client side using IActiveDesktop as a sample. I instance the interface (eax==S_OK) and use the pointer I get as follows
	 
  mov eax, pIAD
  mov edx, 
  invoke (IActiveDesktop ptr ).IActiveDesktop_GetWallpaper, ADDR pwszWallpaper,\
		cchWallpaper, NULL
I get E_INVALIDARG error. The definitions are: cchWallpaper DWORD 0 pwszWallpaper WORD MAX_PATH DUP (0) Any ideas? vesa
Posted on 2001-06-27 02:30:00 by vesa
I think, you should tell the function the size of the string buffer, so cchWallpaper must be MAX_PATH.
Posted on 2001-06-27 05:51:00 by beaster
beaster, I have tried MAX_PATH, too. I think the first two parameters are for output, not sure. SDK platform doesn't tell anything. vesa
Posted on 2001-06-28 01:20:00 by vesa
According to SHLOBJ.H, IActiveDesktop::GetWallpaper is defined as so:

STDMETHOD (GetWallpaper)(THIS_ LPWSTR pwszWallpaper, UINT cchWallpaper, DWORD dwReserved) PURE;
You didn't include the definition of IActiveDesktop you are using, so I can't check that. ::GetWallpaper is the 2nd method of an interface inherited from IUnknown (3 methods), so it's the 5th dword pointer in the vtable. Putting these together leads to the proper prototype to invoke this method:

  mov ecx, pIAD
  mov edx, 
  push NULL
  push cchWallpaper
  push ADDR pwszWallpaper
  push ecx
  call  ; 5 dwords into the list is 4*4=16 bytes 
OR.... (assuming your interface is correct)

  mov ecx, pIAD
  mov edx, 
  invoke (IActiveDesktop ptr ).IActiveDesktop_GetWallpaper, ecx, ADDR pwszWallpaper, cchWallpaper, NULL
Note how I avoid using eax for the object pointer (it's needed for the ADDR), and how I also place THIS in the parameter list.
Posted on 2001-06-28 22:39:00 by Ernie
Ernie, shame on me. I didn't read your docs close enough! Thanks! beaster, the second parameter is for input, too. vesa This message was edited by vesa, on 6/29/2001 9:23:55 AM
Posted on 2001-06-29 09:01:00 by vesa