nsOS2VACLegacy.cpp File Reference


Classes

struct  nsID
struct  vftable_nsISupports
 nsISupports vftable. More...
struct  vftable_nsGetServiceByCID_nsCOMPtr_helper
 nsGetServiceByCID::nsCOMPtr_helper vftable. More...
struct  vftable_nsQueryInterface_nsCOMPtr_helper
 nsQueryInterface::nsCOMPtr_helper vftable. More...
struct  obj_nsISupports
 nsISupport object. More...
struct  obj_nsCOMPtr_base
 nsCOMPtr_base object. More...
struct  obj_nsGetServiceByCID_nsCOMPtr_helper
 nsGetServiceByCID_nsCOMPtr_helper object. More...
struct  obj_nsQueryInterface_nsCOMPtr_helper
 nsQueryInterface_nsCOMPtr_helper object. More...

Typedefs

typedef struct nsID nsCID
typedef struct nsID nsIID
typedef PRUint32 nsrefcnt
typedef struct vftable_nsISupports VFTnsISupports
 nsISupports vftable.
typedef struct
vftable_nsGetServiceByCID_nsCOMPtr_helper 
VFTnsGetServiceByCID_nsCOMPtr_helper
 nsGetServiceByCID::nsCOMPtr_helper vftable.
typedef struct
vftable_nsQueryInterface_nsCOMPtr_helper 
VFTnsQueryInterface_nsCOMPtr_helper
 nsQueryInterface::nsCOMPtr_helper vftable.

Functions

void *VFTCALL __dt__13nsCOMPtr_baseFv (void *pvThis, unsigned __dtorFlags)
 nsCOMPtr_base::~nsCOMPtr_base()
void *VFTCALL _dt__13nsCOMPtr_baseFv (void *pvThis, unsigned __dtorFlags)
 workaround for _Optlink bug.
nsresult VFTCALL GSBC_COM__operator_paratheses (void *pvThis, REFNSIID aIID, void **aInstancePtr)
 ----- assembly: ; 92 nsGetServiceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const align 010h
void *VFTCALL GSBC_COM__destructor (void *pvThis, unsigned __dtorFlags, unsigned __vtt)
 Just a destructor.
nsresult VFTCALL QI_COM__operator_paratheses (void *pvThis, REFNSIID aIID, void **aInstancePtr)
 ----- assembly ; 42 nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const align 010h
void VFTCALL assign_assuming_AddRef__13nsCOMPtr_baseFP11nsISupports (void *pvThis, obj_nsISupports *newPtr)
 ----- C++ Code: void assign_assuming_AddRef( nsISupports* newPtr ) { / * |AddRef()|ing the new value (before entering this function) before |Release()|ing the old lets us safely ignore the self-assignment case.
void VFTCALL assign_from_helper__13nsCOMPtr_baseFRC15nsCOMPtr_helperRC4nsID (void *pvThis, void *helper, REFNSIID iid)
 ----- Assembly: ; 77 nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& iid ) align 010h

Variables

const
VFTnsGetServiceByCID_nsCOMPtr_helper 
_vft17nsGetServiceByCID15nsCOMPtr_helper
 VFT for nsGetServiceByCID::nsCOMPtr_helper or something like that.
const
VFTnsQueryInterface_nsCOMPtr_helper 
_vft16nsQueryInterface15nsCOMPtr_helper
 VFT for nsQueryInterface::nsCOMPtr_helper or something like that.


Typedef Documentation

typedef struct nsID nsCID

typedef struct nsID nsIID

typedef PRUint32 nsrefcnt


Function Documentation

void* VFTCALL __dt__13nsCOMPtr_baseFv ( void *  pvThis,
unsigned  __dtorFlags 
)

Remarks:
This guys doing the oji plugin have been very unfortunate to link in this without any similar new operator. The object is thus created in the plugin but freed by xpcom.dll. As the plugin and mozilla have different CRTs this is a good way of asking for trouble. But, they guys've been lucky, the VAC CRT might just handle this ok. However, we cannot perform this delete as we have no VAC CRT around, and hence we will leak this object. ---- assembly: public __dt__13nsCOMPtr_baseFv __dt__13nsCOMPtr_baseFv proc push ebp mov ebp,esp sub esp,08h mov [ebp+08h],eax; this mov [ebp+0ch],edx; __dtorFlags
; 63 if ( mRawPtr ) mov eax,[ebp+08h]; this cmp dword ptr [eax],0h je

; 64 NSCAP_RELEASE(this, mRawPtr); mov ecx,[ebp+08h]; this mov ecx,[ecx] mov ecx,[ecx] mov eax,[ebp+08h]; this mov eax,[eax] add eax,[ecx+01ch] mov ecx,[ebp+08h]; this mov ecx,[ecx] mov ecx,[ecx] call dword ptr [ecx+018h] :

; 65 } test byte ptr [ebp+0ch],01h; __dtorFlags je mov eax,[ebp+08h]; this call __dl__FPv : mov eax,[ebp+08h]; this add esp,08h pop ebp ret __dt__13nsCOMPtr_baseFv endp

void* VFTCALL _dt__13nsCOMPtr_baseFv ( void *  pvThis,
unsigned  __dtorFlags 
)

nsresult VFTCALL GSBC_COM__operator_paratheses ( void *  pvThis,
REFNSIID  aIID,
void **  aInstancePtr 
)

public __cl__17nsGetServiceByCIDCFRC4nsIDPPv __cl__17nsGetServiceByCIDCFRC4nsIDPPv proc push ebp mov ebp,esp sub esp,014h push ebx sub esp,08h mov [ebp+08h],eax; this mov [ebp+0ch],edx; aIID mov [ebp+010h],ecx; aInstancePtr

; 94 nsresult status = NS_ERROR_FAILURE; mov dword ptr [ebp-04h],080004005h; status

; 95 if ( mServiceManager ) { mov eax,[ebp+08h]; this add eax,08h call __opP13nsDerivedSafeXT17nsIServiceManager___8nsCOMPtrXT17nsIServiceManager_CFv test eax,eax je

; 96 status = mServiceManager->GetService(mCID, aIID, (void**)aInstancePtr); mov eax,[ebp+08h]; this add eax,08h call __rf__8nsCOMPtrXT17nsIServiceManager_CFv mov [ebp-08h],eax; __212 mov eax,[ebp+010h]; aInstancePtr push eax mov ecx,[ebp+0ch]; aIID mov edx,[ebp+08h]; this mov edx,[edx+04h] mov ebx,[ebp-08h]; __212 mov ebx,[ebx] mov eax,[ebp-08h]; __212 add eax,[ebx+024h] sub esp,0ch mov ebx,[ebp-08h]; __212 mov ebx,[ebx] call dword ptr [ebx+020h] add esp,010h mov [ebp-04h],eax; status

; 97 } else { jmp align 010h :

; 95 if ( mServiceManager ) {

; 98 nsCOMPtr<nsIServiceManager> mgr; lea eax,[ebp-0ch]; mgr call __ct__8nsCOMPtrXT17nsIServiceManager_Fv

; 99 NS_GetServiceManager(getter_AddRefs(mgr)); lea edx,[ebp-0ch]; mgr lea eax,[ebp-010h]; __216 call getter_AddRefs__FR8nsCOMPtrXT17nsIServiceManager_ sub esp,04h lea eax,[ebp-010h]; __216 sub esp,04h call __opPP17nsIServiceManager__15nsGetterAddRefsXT17nsIServiceManager_Fv add esp,08h call NS_GetServiceManager mov edx,02h lea eax,[ebp-010h]; __216 call __dt__15nsGetterAddRefsXT17nsIServiceManager_Fv

; 100 if (mgr) lea eax,[ebp-0ch]; mgr call __opP13nsDerivedSafeXT17nsIServiceManager___8nsCOMPtrXT17nsIServiceManager_CFv test eax,eax je

; 101 status = mgr->GetService(mCID, aIID, (void**)aInstancePtr); lea eax,[ebp-0ch]; mgr call __rf__8nsCOMPtrXT17nsIServiceManager_CFv mov [ebp-014h],eax; __217 mov eax,[ebp+010h]; aInstancePtr push eax mov ecx,[ebp+0ch]; aIID mov edx,[ebp+08h]; this mov edx,[edx+04h] mov ebx,[ebp-014h]; __217 mov ebx,[ebx] mov eax,[ebp-014h]; __217 add eax,[ebx+024h] sub esp,0ch mov ebx,[ebp-014h]; __217 mov ebx,[ebx] call dword ptr [ebx+020h] add esp,010h mov [ebp-04h],eax; status :

; 102 } mov edx,02h lea eax,[ebp-0ch]; mgr call __dt__8nsCOMPtrXT17nsIServiceManager_Fv :

; 103 if ( NS_FAILED(status) ) test byte ptr [ebp-01h],080h; status je

; 104 *aInstancePtr = 0; mov eax,[ebp+010h]; aInstancePtr mov dword ptr [eax],0h :

; 106 if ( mErrorPtr ) mov eax,[ebp+08h]; this cmp dword ptr [eax+0ch],0h je

; 107 *mErrorPtr = status; mov eax,[ebp+08h]; this mov eax,[eax+0ch] mov ebx,[ebp-04h]; status mov [eax],ebx :

; 108 return status; mov eax,[ebp-04h]; status add esp,08h pop ebx mov esp,ebp pop ebp ret __cl__17nsGetServiceByCIDCFRC4nsIDPPv endp

----- C++ Code: nsresult nsGetServiceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const { nsresult status = NS_ERROR_FAILURE; if ( mServiceManager ) { status = mServiceManager->GetService(mCID, aIID, (void**)aInstancePtr); } else { nsCOMPtr<nsIServiceManager> mgr; NS_GetServiceManager(getter_AddRefs(mgr)); if (mgr) status = mgr->GetService(mCID, aIID, (void**)aInstancePtr); } if ( NS_FAILED(status) ) aInstancePtr = 0;

if ( mErrorPtr ) mErrorPtr = status; return status; }

void* VFTCALL GSBC_COM__destructor ( void *  pvThis,
unsigned  __dtorFlags,
unsigned  __vtt 
)

----- assembly: ; 59 virtual ~nsGetServiceByCID() {}; align 010h

__dt__17nsGetServiceByCIDFv proc push ebp mov ebp,esp sub esp,08h mov [ebp+08h],eax; this mov [ebp+0ch],edx; __dtorFlags mov [ebp+010h],ecx; __vtt mov eax,[ebp+08h]; this mov dword ptr [eax],offset FLAT:__vft17nsGetServiceByCID15nsCOMPtr_helper mov edx,02h mov eax,[ebp+08h]; this add eax,08h call __dt__8nsCOMPtrXT17nsIServiceManager_Fv test byte ptr [ebp+0ch],01h; __dtorFlags je mov eax,[ebp+08h]; this call __dl__FPv : mov eax,[ebp+08h]; this add esp,08h pop ebp ret __dt__17nsGetServiceByCIDFv endp

nsresult VFTCALL QI_COM__operator_paratheses ( void *  pvThis,
REFNSIID  aIID,
void **  aInstancePtr 
)

public __cl__16nsQueryInterfaceCFRC4nsIDPPv __cl__16nsQueryInterfaceCFRC4nsIDPPv proc push ebp mov ebp,esp sub esp,08h push ebx sub esp,0ch mov [ebp+08h],eax; this mov [ebp+0ch],edx; aIID mov [ebp+010h],ecx; answer

; 45 if ( mRawPtr ) mov eax,[ebp+08h]; this cmp dword ptr [eax+04h],0h je

; 46 { ; 47 status = mRawPtr->QueryInterface(aIID, answer); mov ecx,[ebp+010h]; answer mov edx,[ebp+0ch]; aIID mov ebx,[ebp+08h]; this mov ebx,[ebx+04h] mov ebx,[ebx] mov eax,[ebp+08h]; this mov eax,[eax+04h] add eax,[ebx+0ch] mov ebx,[ebp+08h]; this mov ebx,[ebx+04h] mov ebx,[ebx] call dword ptr [ebx+08h] mov [ebp-04h],eax; status

; 48 ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS ; 49 NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?"); ; 50 endif ; 51 } jmp align 010h :

; 45 if ( mRawPtr )

; 53 status = NS_ERROR_NULL_POINTER; mov dword ptr [ebp-04h],080004003h; status :

; 55 if ( mErrorPtr ) mov eax,[ebp+08h]; this cmp dword ptr [eax+08h],0h je

; 56 *mErrorPtr = status; mov eax,[ebp+08h]; this mov eax,[eax+08h] mov ebx,[ebp-04h]; status mov [eax],ebx :

; 57 return status; mov eax,[ebp-04h]; status add esp,0ch pop ebx mov esp,ebp pop ebp ret __cl__16nsQueryInterfaceCFRC4nsIDPPv endp

----- C++ Code: nsresult nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const { nsresult status; if ( mRawPtr ) { status = mRawPtr->QueryInterface(aIID, answer); ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?"); endif } else status = NS_ERROR_NULL_POINTER;

if ( mErrorPtr ) mErrorPtr = status; return status; }

void VFTCALL assign_assuming_AddRef__13nsCOMPtr_baseFP11nsISupports ( void *  pvThis,
obj_nsISupports newPtr 
)

We must, however, be careful only to |Release()| _after_ doing the assignment, in case the |Release()| leads to our _own_ destruction, which would, in turn, cause an incorrect second |Release()| of our old pointer. Thank <waterson@netscape.com> for discovering this. / nsISupports* oldPtr = mRawPtr; mRawPtr = newPtr; NSCAP_LOG_ASSIGNMENT(this, newPtr); NSCAP_LOG_RELEASE(this, oldPtr); if ( oldPtr ) NSCAP_RELEASE(this, oldPtr); }

void VFTCALL assign_from_helper__13nsCOMPtr_baseFRC15nsCOMPtr_helperRC4nsID ( void *  pvThis,
void *  helper,
REFNSIID  iid 
)

public assign_from_helper__13nsCOMPtr_baseFRC15nsCOMPtr_helperRC4nsID assign_from_helper__13nsCOMPtr_baseFRC15nsCOMPtr_helperRC4nsID proc push ebp mov ebp,esp sub esp,08h push ebx sub esp,0ch mov [ebp+08h],eax; this mov [ebp+0ch],edx; helper mov [ebp+010h],ecx; iid

; 80 if ( NS_FAILED( helper(iid, reinterpret_cast<void**>(&newRawPtr)) ) ) lea ecx,[ebp-04h]; newRawPtr mov edx,[ebp+010h]; iid mov ebx,[ebp+0ch]; helper mov ebx,[ebx] mov eax,[ebp+0ch]; helper add eax,[ebx+0ch] mov ebx,[ebp+0ch]; helper mov ebx,[ebx] call dword ptr [ebx+08h] test eax,080000000h je

; 81 newRawPtr = 0; mov dword ptr [ebp-04h],0h; newRawPtr :

; 82 assign_assuming_AddRef(newRawPtr); mov edx,[ebp-04h]; newRawPtr mov eax,[ebp+08h]; this call assign_assuming_AddRef__13nsCOMPtr_baseFP11nsISupports add esp,0ch pop ebx mov esp,ebp pop ebp ret assign_from_helper__13nsCOMPtr_baseFRC15nsCOMPtr_helperRC4nsID endp

----- C Code: void nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& iid ) { nsISupports* newRawPtr; if ( NS_FAILED( helper(iid, reinterpret_cast<void**>(&newRawPtr)) ) ) newRawPtr = 0; assign_assuming_AddRef(newRawPtr); }


Variable Documentation

Initial value:

{
    VFTFIRST_VAL()
    GSBC_COM__operator_paratheses,                          VFTDELTA_VAL()
    GSBC_COM__destructor,                                   VFTDELTA_VAL()
}
It's just implementing an operator() and the destructor.

Remarks:
We need to skip an underscore to get the name right. ---- assembly: __vft17nsGetServiceByCID15nsCOMPtr_helper dd 0 db 0h,0h,0h,0h dd offset FLAT:__cl__17nsGetServiceByCIDCFRC4nsIDPPv db 0h,0h,0h,0h dd offset FLAT:__dt__17nsGetServiceByCIDFv db 0h,0h,0h,0h

Initial value:

 
{
    VFTFIRST_VAL()
    QI_COM__operator_paratheses,                          VFTDELTA_VAL()
}
No destructor, only an operator().

Remarks:
We need to skip an underscore to get the name right. ----- assembly: __vft16nsQueryInterface15nsCOMPtr_helper dd 0 db 0h,0h,0h,0h dd offset FLAT:__cl__16nsQueryInterfaceCFRC4nsIDPPv db 0h,0h,0h,0h


Generated Mozilla by doxygen 1.5.6