Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenstdunk.cpp
Go to the documentation of this file.
00001 /* 00002 ReactOS Kernel-Mode COM 00003 IUnknown implementations 00004 00005 LICENSE 00006 Please see COPYING in the top-level directory for license information. 00007 00008 AUTHORS 00009 Andrew Greenwood 00010 */ 00011 00012 #include <stdunk.h> 00013 00014 CUnknown::CUnknown(PUNKNOWN outer_unknown) 00015 { 00016 m_ref_count = 0; 00017 00018 if ( outer_unknown ) 00019 m_outer_unknown = outer_unknown; 00020 else 00021 m_outer_unknown = PUNKNOWN(dynamic_cast<PNONDELEGATINGUNKNOWN>(this)); 00022 } 00023 00024 CUnknown::~CUnknown() 00025 { 00026 } 00027 00028 STDMETHODIMP_(ULONG) 00029 CUnknown::NonDelegatingAddRef() 00030 { 00031 InterlockedIncrement(&m_ref_count); 00032 return m_ref_count; 00033 } 00034 00035 STDMETHODIMP_(ULONG) 00036 CUnknown::NonDelegatingRelease() 00037 { 00038 if ( InterlockedDecrement(&m_ref_count) == 0 ) 00039 { 00040 m_ref_count ++; 00041 delete this; 00042 return 0; 00043 } 00044 00045 return m_ref_count; 00046 } 00047 00048 STDMETHODIMP_(NTSTATUS) 00049 CUnknown::NonDelegatingQueryInterface( 00050 IN REFIID iid, 00051 PVOID* ppVoid) 00052 { 00053 /* FIXME */ 00054 #if 0 00055 if ( IsEqualGUID(iid, IID_IUnknown) ) /* TODO: Aligned? */ 00056 *ppVoid = PVOID(PUNKNOWN(this)); 00057 else 00058 *ppVoid = NULL; 00059 #endif 00060 00061 if ( *ppVoid ) 00062 { 00063 PUNKNOWN(*ppVoid)->AddRef(); 00064 return STATUS_SUCCESS; 00065 } 00066 00067 return STATUS_INVALID_PARAMETER; 00068 } Generated on Thu May 24 2012 04:29:11 for ReactOS by
1.7.6.1
|