News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

DISP_E_UNKNOWNINTERFACE

Started by GoneFishing, January 11, 2014, 07:10:48 AM

Previous topic - Next topic

dedndave


jj2007

Quote from: japheth on January 11, 2014, 10:40:17 PMOk, your C++ sample reveals what's wrong in the assembly source - an incorrect "level of indirection".

More precisely, it is the "NameSpace" string that played foul. This works:

        rgDispId        equ <DISPID>
        lcid            equ 800h
        cNames          equ 1
        rgszNames       equ <eax>
        riid            equ <offset IID_NULL>
        mov edx, ppv
        mov ecx, [edx]
        push uc$("NameSpace")        ; create a slot on the stack containing the address of "NameSpace"
        mov eax, esp        ; eax is now pointer to the slot containing the address of the Unicode "NameSpace"
        invoke [ecx].IDispatch.GetIDsOfNames, edx, riid, eax, cNames, lcid, addr rgDispId
        pop edx

GoneFishing

#17
It worked for me , Jochen  :t
QuotergDispId        equ <offset DISPID>

Finally I've found out what was wrong with my code . Here's my fixed and  working 0x0BADC0DE :
Quote
   ; -----------------------------------------------------------------------------------;
   ; invoke IDispatch GetIDsOfNames, riid, rgszNames, cNames, lcid, rgDispId ;
   ; -----------------------------------------------------------------------------------;
      push uc$("NameSpace")  ; Jochen's idea
      mov eax ,esp                  ;
       push offset DISPID       
       push 409h
       push 1
       push eax
       push offset IID_NULL
       mov  edx, ppv           
       mov  ecx, [edx]
       push edx                          ; I tried this but didn't insert "pop edx" after the call
       call dword ptr  [ecx+20]    ; offset of GetIDsOfNames
       pop edx
            .if  eax != S_OK
                 printf("GetIDsOfNames   : FAILED 0x%08X\n ",eax)
                 jmp _exit
            .endif

jj2007

Quote from: vertograd on January 13, 2014, 12:53:13 AM
It worked for me , Jochen  :t

Good ;)
Japheth had the idea, though, I just showed it in more detail.
I wonder if one day I'll understand the superior conceptual logic behind that COM "pointer to a pointer to a pointer" stuff ::)

Yuri

Quote from: jj2007 on January 13, 2014, 04:31:27 AM
I wonder if one day I'll understand the superior conceptual logic behind that COM "pointer to a pointer to a pointer" stuff ::)

In this particular case it's simple, since not a single string but an array of strings (names) is passed to the function. So the pointer points at the first string pointer in the array.

jj2007