4 * Copyright 2009 Andrew Hill <ash77@reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 // It is common to use this in ATL constructors. They only store this for later use, so the usage is safe.
28 #pragma warning(disable:4355)
32 #define _ATL_PACKING 8
35 #ifndef _ATL_FREE_THREADED
36 #ifndef _ATL_APARTMENT_THREADED
37 #ifndef _ATL_SINGLE_THREADED
38 #define _ATL_FREE_THREADED
47 #ifdef _ATL_DISABLE_NO_VTABLE
50 #define ATL_NO_VTABLE __declspec(novtable)
53 #define offsetofclass(base, derived) (reinterpret_cast<DWORD_PTR>(static_cast<base *>(reinterpret_cast<derived *>(_ATL_PACKING))) - _ATL_PACKING)
61 __declspec(selectany
) CAtlModule
*_pAtlModule
= NULL
;
62 __declspec(selectany
) CComModule
*_pModule
= NULL
;
63 extern CAtlComModule _AtlComModule
;
65 typedef HRESULT (WINAPI _ATL_CREATORFUNC
)(void *pv
, REFIID riid
, LPVOID
*ppv
);
66 typedef LPCTSTR (WINAPI _ATL_DESCRIPTIONFUNC
)();
67 typedef const struct _ATL_CATMAP_ENTRY
* (_ATL_CATMAPFUNC
)();
69 struct _ATL_OBJMAP_ENTRY30
72 HRESULT (WINAPI
*pfnUpdateRegistry
)(BOOL bRegister
);
73 _ATL_CREATORFUNC
*pfnGetClassObject
;
74 _ATL_CREATORFUNC
*pfnCreateInstance
;
77 _ATL_DESCRIPTIONFUNC
*pfnGetObjectDescription
;
78 _ATL_CATMAPFUNC
*pfnGetCategoryMap
;
79 void (WINAPI
*pfnObjectMain
)(bool bStarting
);
81 HRESULT WINAPI
RevokeClassObject()
85 return CoRevokeClassObject(dwRegister
);
88 HRESULT WINAPI
RegisterClassObject(DWORD dwClsContext
, DWORD dwFlags
)
94 if (pfnGetClassObject
== NULL
)
97 hResult
= pfnGetClassObject(reinterpret_cast<LPVOID
*>(pfnCreateInstance
), IID_IUnknown
, reinterpret_cast<LPVOID
*>(&p
));
98 if (SUCCEEDED(hResult
))
99 hResult
= CoRegisterClassObject(*pclsid
, p
, dwClsContext
, dwFlags
, &dwRegister
);
108 typedef _ATL_OBJMAP_ENTRY30 _ATL_OBJMAP_ENTRY
;
110 typedef void (__stdcall _ATL_TERMFUNC
)(DWORD_PTR dw
);
112 struct _ATL_TERMFUNC_ELEM
114 _ATL_TERMFUNC
*pFunc
;
116 _ATL_TERMFUNC_ELEM
*pNext
;
123 _ATL_TERMFUNC_ELEM
*m_pTermFuncs
;
124 CComCriticalSection m_csStaticDataInitAndTypeInfo
;
126 typedef _ATL_MODULE70 _ATL_MODULE
;
128 typedef HRESULT (WINAPI _ATL_CREATORARGFUNC
)(void *pv
, REFIID riid
, LPVOID
*ppv
, DWORD_PTR dw
);
130 #define _ATL_SIMPLEMAPENTRY ((ATL::_ATL_CREATORARGFUNC *)1)
132 struct _ATL_INTMAP_ENTRY
136 _ATL_CREATORARGFUNC
*pFunc
;
139 struct _AtlCreateWndData
143 _AtlCreateWndData
*m_pNext
;
146 struct _ATL_COM_MODULE70
149 HINSTANCE m_hInstTypeLib
;
150 _ATL_OBJMAP_ENTRY
**m_ppAutoObjMapFirst
;
151 _ATL_OBJMAP_ENTRY
**m_ppAutoObjMapLast
;
152 CComCriticalSection m_csObjMap
;
154 typedef _ATL_COM_MODULE70 _ATL_COM_MODULE
;
156 struct _ATL_WIN_MODULE70
159 CComCriticalSection m_csWindowCreate
;
160 _AtlCreateWndData
*m_pCreateWndList
;
162 CSimpleArray
<ATOM
> m_rgWindowClassAtoms
;
165 typedef _ATL_WIN_MODULE70 _ATL_WIN_MODULE
;
167 struct _ATL_REGMAP_ENTRY
173 HRESULT __stdcall
AtlWinModuleInit(_ATL_WIN_MODULE
*pWinModule
);
174 HRESULT __stdcall
AtlWinModuleTerm(_ATL_WIN_MODULE
*pWinModule
, HINSTANCE hInst
);
175 HRESULT __stdcall
AtlInternalQueryInterface(void *pThis
, const _ATL_INTMAP_ENTRY
*pEntries
, REFIID iid
, void **ppvObject
);
176 void __stdcall
AtlWinModuleAddCreateWndData(_ATL_WIN_MODULE
*pWinModule
, _AtlCreateWndData
*pData
, void *pObject
);
177 void *__stdcall
AtlWinModuleExtractCreateWndData(_ATL_WIN_MODULE
*pWinModule
);
178 HRESULT __stdcall
AtlComModuleGetClassObject(_ATL_COM_MODULE
*pComModule
, REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
);
180 template<class TLock
>
181 class CComCritSecLock
187 CComCritSecLock(TLock
&cs
, bool bInitialLock
= true) : m_cs(cs
)
212 ATLASSERT(!m_bLocked
);
213 hResult
= m_cs
.Lock();
225 ATLASSERT(m_bLocked
);
226 hResult
= m_cs
.Unlock();
235 inline BOOL WINAPI
InlineIsEqualUnknown(REFGUID rguid1
)
238 ((unsigned long *)&rguid1
)[0] == 0 &&
239 ((unsigned long *)&rguid1
)[1] == 0 &&
240 ((unsigned long *)&rguid1
)[2] == 0x000000C0 &&
241 ((unsigned long *)&rguid1
)[3] == 0x46000000);
244 class CComMultiThreadModelNoCS
247 typedef CComFakeCriticalSection AutoCriticalSection
;
248 typedef CComFakeCriticalSection CriticalSection
;
249 typedef CComMultiThreadModelNoCS ThreadModelNoCS
;
250 typedef CComFakeCriticalSection AutoDeleteCriticalSection
;
252 static ULONG WINAPI
Increment(LPLONG p
)
254 return InterlockedIncrement(p
);
257 static ULONG WINAPI
Decrement(LPLONG p
)
259 return InterlockedDecrement(p
);
263 class CComMultiThreadModel
266 typedef CComAutoCriticalSection AutoCriticalSection
;
267 typedef CComCriticalSection CriticalSection
;
268 typedef CComMultiThreadModelNoCS ThreadModelNoCS
;
269 typedef CComAutoDeleteCriticalSection AutoDeleteCriticalSection
;
271 static ULONG WINAPI
Increment(LPLONG p
)
273 return InterlockedIncrement(p
);
276 static ULONG WINAPI
Decrement(LPLONG p
)
278 return InterlockedDecrement(p
);
282 class CComSingleThreadModel
285 typedef CComFakeCriticalSection AutoCriticalSection
;
286 typedef CComFakeCriticalSection CriticalSection
;
287 typedef CComSingleThreadModel ThreadModelNoCS
;
288 typedef CComFakeCriticalSection AutoDeleteCriticalSection
;
290 static ULONG WINAPI
Increment(LPLONG p
)
295 static ULONG WINAPI
Decrement(LPLONG p
)
301 #if defined(_ATL_FREE_THREADED)
303 typedef CComMultiThreadModel CComObjectThreadModel
;
304 typedef CComMultiThreadModel CComGlobalsThreadModel
;
306 #elif defined(_ATL_APARTMENT_THREADED)
308 typedef CComSingleThreadModel CComObjectThreadModel
;
309 typedef CComMultiThreadModel CComGlobalsThreadModel
;
311 #elif defined(_ATL_SINGLE_THREADED)
313 typedef CComSingleThreadModel CComObjectThreadModel
;
314 typedef CComSingleThreadModel CComGlobalsThreadModel
;
317 #error No threading model
320 class CAtlModule
: public _ATL_MODULE
327 ATLASSERT(_pAtlModule
== NULL
);
329 cbSize
= sizeof(_ATL_MODULE
);
333 virtual LONG
GetLockCount()
340 return CComGlobalsThreadModel::Increment(&m_nLockCnt
);
343 virtual LONG
Unlock()
345 return CComGlobalsThreadModel::Decrement(&m_nLockCnt
);
348 virtual HRESULT
AddCommonRGSReplacements(IRegistrarBase
* /*pRegistrar*/) = 0;
350 HRESULT WINAPI
UpdateRegistryFromResource(LPCTSTR lpszRes
, BOOL bRegister
, struct _ATL_REGMAP_ENTRY
*pMapEntries
= NULL
)
352 CRegObject registrar
;
353 WCHAR modulePath
[MAX_PATH
];
357 hResult
= CommonInitRegistrar(registrar
, modulePath
, sizeof(modulePath
) / sizeof(modulePath
[0]), pMapEntries
);
363 /* FIXME: this is a bit of a hack, need to re-evaluate */
364 WCHAR resid
[MAX_PATH
];
365 MultiByteToWideChar(CP_ACP
, 0, lpszRes
, -1, resid
, MAX_PATH
);
368 if (bRegister
!= FALSE
)
369 hResult
= registrar
.ResourceRegisterSz(modulePath
, lpwszRes
, L
"REGISTRY");
371 hResult
= registrar
.ResourceUnregisterSz(modulePath
, lpwszRes
, L
"REGISTRY");
376 HRESULT WINAPI
UpdateRegistryFromResource(UINT nResID
, BOOL bRegister
, struct _ATL_REGMAP_ENTRY
*pMapEntries
= NULL
)
378 CRegObject registrar
;
379 WCHAR modulePath
[MAX_PATH
];
382 hResult
= CommonInitRegistrar(registrar
, modulePath
, sizeof(modulePath
) / sizeof(modulePath
[0]), pMapEntries
);
386 if (bRegister
!= FALSE
)
387 hResult
= registrar
.ResourceRegister(modulePath
, nResID
, L
"REGISTRY");
389 hResult
= registrar
.ResourceUnregister(modulePath
, nResID
, L
"REGISTRY");
395 HRESULT
CommonInitRegistrar(CRegObject
®istrar
, WCHAR
*modulePath
, DWORD modulePathCount
, struct _ATL_REGMAP_ENTRY
*pMapEntries
)
401 hInstance
= _AtlBaseModule
.GetModuleInstance();
402 dwFLen
= GetModuleFileNameW(hInstance
, modulePath
, modulePathCount
);
403 if (dwFLen
== modulePathCount
)
404 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);
405 else if (dwFLen
== 0)
406 return HRESULT_FROM_WIN32(GetLastError());
408 if (pMapEntries
!= NULL
)
410 while (pMapEntries
->szKey
!= NULL
)
412 ATLASSERT(pMapEntries
->szData
!= NULL
);
413 hResult
= registrar
.AddReplacement(pMapEntries
->szKey
, pMapEntries
->szData
);
420 hResult
= AddCommonRGSReplacements(®istrar
);
424 hResult
= registrar
.AddReplacement(L
"Module", modulePath
);
428 hResult
= registrar
.AddReplacement(L
"Module_Raw", modulePath
);
436 __declspec(selectany
) GUID
CAtlModule::m_libid
= {0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} };
439 class CAtlModuleT
: public CAtlModule
443 virtual HRESULT
AddCommonRGSReplacements(IRegistrarBase
*pRegistrar
)
445 return pRegistrar
->AddReplacement(L
"APPID", T::GetAppId());
448 static LPCOLESTR
GetAppId()
454 class CAtlComModule
: public _ATL_COM_MODULE
459 GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
, (LPCWSTR
)this, &m_hInstTypeLib
);
460 m_ppAutoObjMapFirst
= NULL
;
461 m_ppAutoObjMapLast
= NULL
;
462 if (FAILED(m_csObjMap
.Init()))
465 CAtlBaseModule::m_bInitFailed
= true;
468 cbSize
= sizeof(_ATL_COM_MODULE
);
480 ATLASSERT(m_ppAutoObjMapFirst
== NULL
);
481 ATLASSERT(m_ppAutoObjMapLast
== NULL
);
489 class CAtlDllModuleT
: public CAtlModuleT
<T
>
496 HRESULT
DllCanUnloadNow()
500 pThis
= static_cast<T
*>(this);
501 if (pThis
->GetLockCount() == 0)
506 HRESULT
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
510 pThis
= static_cast<T
*>(this);
511 return pThis
->GetClassObject(rclsid
, riid
, ppv
);
514 HRESULT
DllRegisterServer(BOOL bRegTypeLib
= TRUE
)
519 pThis
= static_cast<T
*>(this);
520 hResult
= pThis
->RegisterServer(bRegTypeLib
);
524 HRESULT
DllUnregisterServer(BOOL bUnRegTypeLib
= TRUE
)
529 pThis
= static_cast<T
*>(this);
530 hResult
= pThis
->UnregisterServer(bUnRegTypeLib
);
534 HRESULT
GetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
536 return AtlComModuleGetClassObject(&_AtlComModule
, rclsid
, riid
, ppv
);
540 class CComModule
: public CAtlModuleT
<CComModule
>
543 _ATL_OBJMAP_ENTRY
*m_pObjMap
;
547 ATLASSERT(_pModule
== NULL
);
549 _pModule
->m_pObjMap
= NULL
;
557 HRESULT
Init(_ATL_OBJMAP_ENTRY
*p
, HINSTANCE
/* h */, const GUID
*plibid
)
559 _ATL_OBJMAP_ENTRY
*objectMapEntry
;
564 if (p
!= reinterpret_cast<_ATL_OBJMAP_ENTRY
*>(-1))
570 while (objectMapEntry
->pclsid
!= NULL
)
572 objectMapEntry
->pfnObjectMain(true);
582 _ATL_OBJMAP_ENTRY
*objectMapEntry
;
584 if (m_pObjMap
!= NULL
)
586 objectMapEntry
= m_pObjMap
;
587 while (objectMapEntry
->pclsid
!= NULL
)
589 if (objectMapEntry
->pCF
!= NULL
)
590 objectMapEntry
->pCF
->Release();
591 objectMapEntry
->pCF
= NULL
;
592 objectMapEntry
->pfnObjectMain(false);
598 HRESULT
GetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
600 _ATL_OBJMAP_ENTRY
*objectMapEntry
;
603 ATLASSERT(ppv
!= NULL
);
608 if (m_pObjMap
!= NULL
)
610 objectMapEntry
= m_pObjMap
;
611 while (objectMapEntry
->pclsid
!= NULL
)
613 if (objectMapEntry
->pfnGetClassObject
!= NULL
&& InlineIsEqualGUID(rclsid
, *objectMapEntry
->pclsid
) != FALSE
)
615 if (objectMapEntry
->pCF
== NULL
)
617 CComCritSecLock
<CComCriticalSection
> lock(_AtlComModule
.m_csObjMap
, true);
619 if (objectMapEntry
->pCF
== NULL
)
620 hResult
= objectMapEntry
->pfnGetClassObject(reinterpret_cast<void *>(objectMapEntry
->pfnCreateInstance
), IID_IUnknown
, reinterpret_cast<LPVOID
*>(&objectMapEntry
->pCF
));
622 if (objectMapEntry
->pCF
!= NULL
)
623 hResult
= objectMapEntry
->pCF
->QueryInterface(riid
, ppv
);
629 if (hResult
== S_OK
&& *ppv
== NULL
)
631 // FIXME: call AtlComModuleGetClassObject
632 hResult
= CLASS_E_CLASSNOTAVAILABLE
;
637 HRESULT
RegisterServer(BOOL bRegTypeLib
= FALSE
, const CLSID
*pCLSID
= NULL
)
639 _ATL_OBJMAP_ENTRY
*objectMapEntry
;
643 objectMapEntry
= m_pObjMap
;
644 if (objectMapEntry
!= NULL
)
646 while (objectMapEntry
->pclsid
!= NULL
)
648 if (pCLSID
== NULL
|| IsEqualGUID(*pCLSID
, *objectMapEntry
->pclsid
) != FALSE
)
650 hResult
= objectMapEntry
->pfnUpdateRegistry(TRUE
);
660 HRESULT
UnregisterServer(BOOL bUnRegTypeLib
, const CLSID
*pCLSID
= NULL
)
662 _ATL_OBJMAP_ENTRY
*objectMapEntry
;
666 objectMapEntry
= m_pObjMap
;
667 if (objectMapEntry
!= NULL
)
669 while (objectMapEntry
->pclsid
!= NULL
)
671 if (pCLSID
== NULL
|| IsEqualGUID(*pCLSID
, *objectMapEntry
->pclsid
) != FALSE
)
673 hResult
= objectMapEntry
->pfnUpdateRegistry(FALSE
); //unregister
683 HRESULT
DllCanUnloadNow()
685 if (GetLockCount() == 0)
690 HRESULT
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
692 return GetClassObject(rclsid
, riid
, ppv
);
695 HRESULT
DllRegisterServer(BOOL bRegTypeLib
= TRUE
)
697 return RegisterServer(bRegTypeLib
);
700 HRESULT
DllUnregisterServer(BOOL bUnRegTypeLib
= TRUE
)
702 return UnregisterServer(bUnRegTypeLib
);
707 class CAtlWinModule
: public _ATL_WIN_MODULE
714 hResult
= AtlWinModuleInit(this);
717 CAtlBaseModule::m_bInitFailed
= true;
729 AtlWinModuleTerm(this, _AtlBaseModule
.GetModuleInstance());
732 void AddCreateWndData(_AtlCreateWndData
*pData
, void *pObject
)
734 AtlWinModuleAddCreateWndData(this, pData
, pObject
);
737 void *ExtractCreateWndData()
739 return AtlWinModuleExtractCreateWndData(this);
743 extern CAtlWinModule _AtlWinModule
;
763 CComPtr(const CComPtr
<T
> &lp
)
776 T
*operator = (T
*lp
)
786 T
*operator = (const CComPtr
<T
> &lp
)
823 ATLASSERT(p
== NULL
);
834 ATLASSERT(p
!= NULL
);
840 // TODO: When someone needs it, make the allocator a template, so you can use it for both
841 // CoTask* allocations, and CRT-like allocations (malloc, realloc, free)
851 explicit CComHeapPtr(T
*lp
) :
856 explicit CComHeapPtr(CComHeapPtr
<T
> &lp
)
858 m_Data
= lp
.Detach();
866 T
*operator = (CComHeapPtr
<T
> &lp
)
868 if (lp
.m_Data
!= m_Data
)
873 bool Allocate(size_t nElements
= 1)
875 ATLASSERT(m_Data
== NULL
);
876 m_Data
= static_cast<T
*>(::CoTaskMemAlloc(nElements
* sizeof(T
)));
877 return m_Data
!= NULL
;
880 bool Reallocate(_In_
size_t nElements
)
882 T
* newData
= static_cast<T
*>(::CoTaskMemRealloc(m_Data
, nElements
* sizeof(T
)));
893 ::CoTaskMemFree(m_Data
);
913 ATLASSERT(m_Data
== NULL
);
932 CComBSTR(LPCOLESTR pSrc
)
937 m_str
= ::SysAllocString(pSrc
);
941 ::SysFreeString(m_str
);
946 class CComVariant
: public tagVARIANT
961 return ::VariantClear(this);
965 inline HRESULT __stdcall
AtlAdvise(IUnknown
*pUnkCP
, IUnknown
*pUnk
, const IID
&iid
, LPDWORD pdw
)
967 CComPtr
<IConnectionPointContainer
> container
;
968 CComPtr
<IConnectionPoint
> connectionPoint
;
973 hResult
= pUnkCP
->QueryInterface(IID_IConnectionPointContainer
, (void **)&container
);
976 hResult
= container
->FindConnectionPoint(iid
, &connectionPoint
);
979 return connectionPoint
->Advise(pUnk
, pdw
);
982 inline HRESULT __stdcall
AtlUnadvise(IUnknown
*pUnkCP
, const IID
&iid
, DWORD dw
)
984 CComPtr
<IConnectionPointContainer
> container
;
985 CComPtr
<IConnectionPoint
> connectionPoint
;
990 hResult
= pUnkCP
->QueryInterface(IID_IConnectionPointContainer
, (void **)&container
);
993 hResult
= container
->FindConnectionPoint(iid
, &connectionPoint
);
996 return connectionPoint
->Unadvise(dw
);
999 inline HRESULT __stdcall
AtlInternalQueryInterface(void *pThis
, const _ATL_INTMAP_ENTRY
*pEntries
, REFIID iid
, void **ppvObject
)
1002 IUnknown
*resultInterface
;
1005 ATLASSERT(pThis
!= NULL
&& pEntries
!= NULL
);
1006 if (pThis
== NULL
|| pEntries
== NULL
)
1007 return E_INVALIDARG
;
1008 ATLASSERT(ppvObject
!= NULL
);
1009 if (ppvObject
== NULL
)
1012 if (InlineIsEqualUnknown(iid
))
1014 resultInterface
= reinterpret_cast<IUnknown
*>(reinterpret_cast<char *>(pThis
) + pEntries
[0].dw
);
1015 *ppvObject
= resultInterface
;
1016 resultInterface
->AddRef();
1021 while (pEntries
[i
].pFunc
!= 0)
1023 if (pEntries
[i
].piid
== NULL
|| InlineIsEqualGUID(iid
, *pEntries
[i
].piid
))
1025 if (pEntries
[i
].pFunc
== reinterpret_cast<_ATL_CREATORARGFUNC
*>(1))
1027 ATLASSERT(pEntries
[i
].piid
!= NULL
);
1028 resultInterface
= reinterpret_cast<IUnknown
*>(reinterpret_cast<char *>(pThis
) + pEntries
[i
].dw
);
1029 *ppvObject
= resultInterface
;
1030 resultInterface
->AddRef();
1035 hResult
= pEntries
[i
].pFunc(pThis
, iid
, ppvObject
, 0);
1036 if (hResult
== S_OK
|| (FAILED(hResult
) && pEntries
[i
].piid
!= NULL
))
1044 return E_NOINTERFACE
;
1047 inline HRESULT __stdcall
AtlWinModuleInit(_ATL_WIN_MODULE
*pWinModule
)
1049 if (pWinModule
== NULL
)
1050 return E_INVALIDARG
;
1051 pWinModule
->m_pCreateWndList
= NULL
;
1052 return pWinModule
->m_csWindowCreate
.Init();
1055 inline HRESULT __stdcall
AtlWinModuleTerm(_ATL_WIN_MODULE
*pWinModule
, HINSTANCE hInst
)
1057 if (pWinModule
== NULL
)
1058 return E_INVALIDARG
;
1059 pWinModule
->m_csWindowCreate
.Term();
1063 inline void __stdcall
AtlWinModuleAddCreateWndData(_ATL_WIN_MODULE
*pWinModule
, _AtlCreateWndData
*pData
, void *pObject
)
1065 CComCritSecLock
<CComCriticalSection
> lock(pWinModule
->m_csWindowCreate
, true);
1067 ATLASSERT(pWinModule
!= NULL
);
1068 ATLASSERT(pObject
!= NULL
);
1070 pData
->m_pThis
= pObject
;
1071 pData
->m_dwThreadID
= ::GetCurrentThreadId();
1072 pData
->m_pNext
= pWinModule
->m_pCreateWndList
;
1073 pWinModule
->m_pCreateWndList
= pData
;
1076 inline void *__stdcall
AtlWinModuleExtractCreateWndData(_ATL_WIN_MODULE
*pWinModule
)
1078 CComCritSecLock
<CComCriticalSection
> lock(pWinModule
->m_csWindowCreate
, true);
1080 _AtlCreateWndData
*currentEntry
;
1081 _AtlCreateWndData
**previousLink
;
1084 ATLASSERT(pWinModule
!= NULL
);
1087 threadID
= GetCurrentThreadId();
1088 currentEntry
= pWinModule
->m_pCreateWndList
;
1089 previousLink
= &pWinModule
->m_pCreateWndList
;
1090 while (currentEntry
!= NULL
)
1092 if (currentEntry
->m_dwThreadID
== threadID
)
1094 *previousLink
= currentEntry
->m_pNext
;
1095 result
= currentEntry
->m_pThis
;
1098 previousLink
= ¤tEntry
->m_pNext
;
1099 currentEntry
= currentEntry
->m_pNext
;
1106 #ifndef _ATL_NO_AUTOMATIC_NAMESPACE
1107 using namespace ATL
;
1108 #endif //!_ATL_NO_AUTOMATIC_NAMESPACE