Home COM GDI+ WebBrowser Data Access

IUnknown Interface

 

IID_IUnknown

{00000000-0000-0000-C000-000000000046}

 

 

The IUnknown interface lets clients get pointers to other interfaces on a given object through the QueryInterface method, and manage the existence of the object through the AddRef and Release methods. All other COM interfaces are inherited, directly or indirectly, from IUnknown. Therefore, the three methods in IUnknown are the first entries in the VTable for every interface.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

 

QueryInterface

 

FUNCTION IUnknown_QueryInterface ( _

  BYVAL pthis AS DWORD PTR _

, BYREF riid AS GUID _

, BYREF ppvObj AS DWORD _

  ) AS LONG


  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[0] USING IUnknown_QueryInterface (pthis, riid, ppvObj) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

 

Inline assembler version

 

FUNCTION IUnknown_QueryInterface ( _
  BYVAL pthis AS DWORD PTR _
, BYREF riid AS GUID _
, BYREF ppvObj AS DWORD _
  ) AS LONG

  ! push ppvObj
  ! mov  eax, riid
  ! push eax
  ! mov  eax, pthis
  ! push eax
  ! mov  eax, dword ptr[eax]
  ! call dword ptr[eax]
  ! mov  FUNCTION, eax


END FUNCTION

 

 

AddRef

 

FUNCTION IUnknown_AddRef ( _

  BYVAL pthis AS DWORD PTR _

  ) AS DWORD
 

  LOCAL DWRESULT AS LONG
  CALL DWORD @@pthis[1] USING IUnknown_AddRef (pthis) TO DWRESULT
  FUNCTION = DWRESULT
 

END FUNCTION

 

 

 

Inline assembler version

 

FUNCTION IUnknown_AddRef ( _

  BYVAL pthis AS DWORD PTR _

  ) AS DWORD
 

  ! mov  eax, pthis
  ! push eax
  ! mov  eax, dword ptr[eax]
  ! call dword ptr[eax+4]
  ! mov  FUNCTION, eax

 

END FUNCTION

 

 

Release

 

FUNCTION IUnknown_Release ( _

  BYVAL pthis AS DWORD PTR _

  ) AS DWORD
 

  LOCAL DWRESULT AS DWORD
  CALL DWORD @@pthis[2] USING IUnknown_Release (pthis) TO DWRESULT
  FUNCTION = DWRESULT
 

END FUNCTION

 

 

 

Inline assembler version

 

FUNCTION IUnknown_Release ( _

  BYVAL pthis AS DWORD PTR _

  ) AS DWORD
 

  ! mov  eax, pthis
  ! push eax
  ! mov  eax, dword ptr[eax]
  ! call dword ptr[eax+8]
  ! mov  FUNCTION, eax

 

END FUNCTION

 

 

Page last updated on Sunday, 30 April 2006 13:57:13 +0200