ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

atl_main.c
Go to the documentation of this file.
00001 /*
00002  * Implementation of Active Template Library (atl.dll)
00003  *
00004  * Copyright 2004 Aric Stewart for CodeWeavers
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #include <stdarg.h>
00022 #include <stdio.h>
00023 
00024 #define COBJMACROS
00025 
00026 #include "windef.h"
00027 #include "winbase.h"
00028 #include "winerror.h"
00029 #include "wingdi.h"
00030 #include "winuser.h"
00031 #include "wine/debug.h"
00032 #include "objbase.h"
00033 #include "objidl.h"
00034 #include "ole2.h"
00035 #include "atlbase.h"
00036 #include "atliface.h"
00037 #include "atlwin.h"
00038 
00039 #include "wine/unicode.h"
00040 
00041 WINE_DEFAULT_DEBUG_CHANNEL(atl);
00042 
00043 DECLSPEC_HIDDEN HINSTANCE hInst;
00044 
00045 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
00046 {
00047     TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved);
00048 
00049     if (fdwReason == DLL_PROCESS_ATTACH) {
00050         DisableThreadLibraryCalls(hinstDLL);
00051         hInst = hinstDLL;
00052     }
00053     return TRUE;
00054 }
00055 
00056 #define ATLVer1Size FIELD_OFFSET(_ATL_MODULEW, dwAtlBuildVer)
00057 
00058 HRESULT WINAPI AtlModuleInit(_ATL_MODULEW* pM, _ATL_OBJMAP_ENTRYW* p, HINSTANCE h)
00059 {
00060     INT i;
00061     UINT size;
00062 
00063     //FIXME("SEMI-STUB (%p %p %p)\n",pM,p,h);
00064 
00065     size = pM->cbSize;
00066     switch (size)
00067     {
00068     case ATLVer1Size:
00069     case sizeof(_ATL_MODULEW):
00070 #ifdef _WIN64
00071     case sizeof(_ATL_MODULEW) + sizeof(void *):
00072 #endif
00073         break;
00074     default:
00075         WARN("Unknown structure version (size %i)\n",size);
00076         return E_INVALIDARG;
00077     }
00078 
00079     memset(pM,0,pM->cbSize);
00080     pM->cbSize = size;
00081     pM->m_hInst = h;
00082     pM->m_hInstResource = h;
00083     pM->m_hInstTypeLib = h;
00084     pM->m_pObjMap = p;
00085     pM->m_hHeap = GetProcessHeap();
00086 
00087     InitializeCriticalSection(&pM->u.m_csTypeInfoHolder);
00088     InitializeCriticalSection(&pM->m_csWindowCreate);
00089     InitializeCriticalSection(&pM->m_csObjMap);
00090 
00091     /* call mains */
00092     i = 0;
00093     if (pM->m_pObjMap != NULL  && size > ATLVer1Size)
00094     {
00095         while (pM->m_pObjMap[i].pclsid != NULL)
00096         {
00097             TRACE("Initializing object %i %p\n",i,p[i].pfnObjectMain);
00098             if (p[i].pfnObjectMain)
00099                 p[i].pfnObjectMain(TRUE);
00100             i++;
00101         }
00102     }
00103 
00104     return S_OK;
00105 }
00106 
00107 static _ATL_OBJMAP_ENTRYW_V1 *get_objmap_entry( _ATL_MODULEW *mod, unsigned int index )
00108 {
00109     _ATL_OBJMAP_ENTRYW_V1 *ret;
00110 
00111     if (mod->cbSize == ATLVer1Size)
00112         ret = (_ATL_OBJMAP_ENTRYW_V1 *)mod->m_pObjMap + index;
00113     else
00114         ret = (_ATL_OBJMAP_ENTRYW_V1 *)(mod->m_pObjMap + index);
00115 
00116     if (!ret->pclsid) ret = NULL;
00117     return ret;
00118 }
00119 
00120 HRESULT WINAPI AtlModuleLoadTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex,
00121                                     BSTR *pbstrPath, ITypeLib **ppTypeLib)
00122 {
00123     HRESULT hRes;
00124     OLECHAR path[MAX_PATH+8]; /* leave some space for index */
00125 
00126     TRACE("(%p, %s, %p, %p)\n", pM, debugstr_w(lpszIndex), pbstrPath, ppTypeLib);
00127 
00128     if (!pM)
00129         return E_INVALIDARG;
00130 
00131     GetModuleFileNameW(pM->m_hInstTypeLib, path, MAX_PATH);
00132     if (lpszIndex)
00133         lstrcatW(path, lpszIndex);
00134 
00135     hRes = LoadTypeLib(path, ppTypeLib);
00136     if (FAILED(hRes))
00137         return hRes;
00138 
00139     *pbstrPath = SysAllocString(path);
00140 
00141     return S_OK;
00142 }
00143 
00144 HRESULT WINAPI AtlModuleTerm(_ATL_MODULEW* pM)
00145 {
00146     _ATL_TERMFUNC_ELEM *iter = pM->m_pTermFuncs, *tmp;
00147 
00148     TRACE("(%p)\n", pM);
00149 
00150     while(iter) {
00151         iter->pFunc(iter->dw);
00152         tmp = iter;
00153         iter = iter->pNext;
00154         HeapFree(GetProcessHeap(), 0, tmp);
00155     }
00156 
00157     HeapFree(GetProcessHeap(), 0, pM);
00158 
00159     return S_OK;
00160 }
00161 
00162 HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULEW *pM, _ATL_TERMFUNC *pFunc, DWORD_PTR dw)
00163 {
00164     _ATL_TERMFUNC_ELEM *termfunc_elem;
00165 
00166     TRACE("(%p %p %ld)\n", pM, pFunc, dw);
00167 
00168     termfunc_elem = HeapAlloc(GetProcessHeap(), 0, sizeof(_ATL_TERMFUNC_ELEM));
00169     termfunc_elem->pFunc = pFunc;
00170     termfunc_elem->dw = dw;
00171     termfunc_elem->pNext = pM->m_pTermFuncs;
00172 
00173     pM->m_pTermFuncs = termfunc_elem;
00174 
00175     return S_OK;
00176 }
00177 
00178 HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEW *pM, DWORD dwClsContext,
00179                                              DWORD dwFlags)
00180 {
00181     _ATL_OBJMAP_ENTRYW_V1 *obj;
00182     HRESULT hRes = S_OK;
00183     int i=0;
00184 
00185     TRACE("(%p %i %i)\n",pM, dwClsContext, dwFlags);
00186 
00187     if (pM == NULL)
00188         return E_INVALIDARG;
00189 
00190     while ((obj = get_objmap_entry( pM, i++ )))
00191     {
00192         IUnknown* pUnknown;
00193         HRESULT rc;
00194 
00195         TRACE("Registering object %i\n",i);
00196         if (obj->pfnGetClassObject)
00197         {
00198             rc = obj->pfnGetClassObject(obj->pfnCreateInstance, &IID_IUnknown,
00199                                    (LPVOID*)&pUnknown);
00200             if (SUCCEEDED (rc) )
00201             {
00202                 CoRegisterClassObject(obj->pclsid, pUnknown, dwClsContext,
00203                                       dwFlags, &obj->dwRegister);
00204                 if (pUnknown)
00205                     IUnknown_Release(pUnknown);
00206             }
00207         }
00208     }
00209 
00210    return hRes;
00211 }
00212 
00213 HRESULT WINAPI AtlModuleUnregisterServerEx(_ATL_MODULEW* pM, BOOL bUnRegTypeLib, const CLSID* pCLSID)
00214 {
00215     FIXME("(%p, %i, %p) stub\n", pM, bUnRegTypeLib, pCLSID);
00216     return S_OK;
00217 }
00218 
00219 
00220 IUnknown* WINAPI AtlComPtrAssign(IUnknown** pp, IUnknown *p)
00221 {
00222     TRACE("(%p %p)\n", pp, p);
00223 
00224     if (p) IUnknown_AddRef(p);
00225     if (*pp) IUnknown_Release(*pp);
00226     *pp = p;
00227     return p;
00228 }
00229 
00230 IUnknown* WINAPI AtlComQIPtrAssign(IUnknown** pp, IUnknown *p, REFIID riid)
00231 {
00232     IUnknown *new_p = NULL;
00233 
00234     TRACE("(%p %p %s)\n", pp, p, debugstr_guid(riid));
00235 
00236     if (p) IUnknown_QueryInterface(p, riid, (void **)&new_p);
00237     if (*pp) IUnknown_Release(*pp);
00238     *pp = new_p;
00239     return new_p;
00240 }
00241 
00242 
00243 HRESULT WINAPI AtlInternalQueryInterface(void* this, const _ATL_INTMAP_ENTRY* pEntries,  REFIID iid, void** ppvObject)
00244 {
00245     int i = 0;
00246     HRESULT rc = E_NOINTERFACE;
00247     TRACE("(%p, %p, %s, %p)\n",this, pEntries, debugstr_guid(iid), ppvObject);
00248 
00249     if (IsEqualGUID(iid,&IID_IUnknown))
00250     {
00251         TRACE("Returning IUnknown\n");
00252         *ppvObject = ((LPSTR)this+pEntries[0].dw);
00253         IUnknown_AddRef((IUnknown*)*ppvObject);
00254         return S_OK;
00255     }
00256 
00257     while (pEntries[i].pFunc != 0)
00258     {
00259         TRACE("Trying entry %i (%s %i %p)\n",i,debugstr_guid(pEntries[i].piid),
00260               pEntries[i].dw, pEntries[i].pFunc);
00261 
00262         if (!pEntries[i].piid || IsEqualGUID(iid,pEntries[i].piid))
00263         {
00264             TRACE("MATCH\n");
00265             if (pEntries[i].pFunc == (_ATL_CREATORARGFUNC*)1)
00266             {
00267                 TRACE("Offset\n");
00268                 *ppvObject = ((LPSTR)this+pEntries[i].dw);
00269                 IUnknown_AddRef((IUnknown*)*ppvObject);
00270                 return S_OK;
00271             }
00272             else
00273             {
00274                 TRACE("Function\n");
00275                 rc = pEntries[i].pFunc(this, iid, ppvObject, pEntries[i].dw);
00276                 if(rc==S_OK || pEntries[i].piid)
00277                     return rc;
00278             }
00279         }
00280         i++;
00281     }
00282     TRACE("Done returning (0x%x)\n",rc);
00283     return rc;
00284 }
00285 
00286 /***********************************************************************
00287  *           AtlModuleRegisterServer         [ATL.@]
00288  *
00289  */
00290 HRESULT WINAPI AtlModuleRegisterServer(_ATL_MODULEW* pM, BOOL bRegTypeLib, const CLSID* clsid)
00291 {
00292     const _ATL_OBJMAP_ENTRYW_V1 *obj;
00293     int i;
00294     HRESULT hRes;
00295 
00296     TRACE("%p %d %s\n", pM, bRegTypeLib, debugstr_guid(clsid));
00297 
00298     if (pM == NULL)
00299         return E_INVALIDARG;
00300 
00301     for (i = 0; (obj = get_objmap_entry( pM, i )) != NULL; i++) /* register CLSIDs */
00302     {
00303         if (!clsid || IsEqualCLSID(obj->pclsid, clsid))
00304         {
00305             TRACE("Registering clsid %s\n", debugstr_guid(obj->pclsid));
00306             hRes = obj->pfnUpdateRegistry(TRUE); /* register */
00307             if (FAILED(hRes))
00308                 return hRes;
00309         }
00310     }
00311 
00312     if (bRegTypeLib)
00313     {
00314         hRes = AtlModuleRegisterTypeLib(pM, NULL);
00315         if (FAILED(hRes))
00316             return hRes;
00317     }
00318 
00319     return S_OK;
00320 }
00321 
00322 /***********************************************************************
00323  *           AtlAdvise         [ATL.@]
00324  */
00325 HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, LPDWORD pdw)
00326 {
00327     FIXME("%p %p %p %p\n", pUnkCP, pUnk, iid, pdw);
00328     return E_FAIL;
00329 }
00330 
00331 /***********************************************************************
00332  *           AtlUnadvise         [ATL.@]
00333  */
00334 HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw)
00335 {
00336     FIXME("%p %p %d\n", pUnkCP, iid, dw);
00337     return S_OK;
00338 }
00339 
00340 /***********************************************************************
00341  *           AtlFreeMarshalStream         [ATL.@]
00342  */
00343 HRESULT WINAPI AtlFreeMarshalStream(IStream *stm)
00344 {
00345     FIXME("%p\n", stm);
00346     return S_OK;
00347 }
00348 
00349 /***********************************************************************
00350  *           AtlMarshalPtrInProc         [ATL.@]
00351  */
00352 HRESULT WINAPI AtlMarshalPtrInProc(IUnknown *pUnk, const IID *iid, IStream **pstm)
00353 {
00354     FIXME("%p %p %p\n", pUnk, iid, pstm);
00355     return E_FAIL;
00356 }
00357 
00358 /***********************************************************************
00359  *           AtlUnmarshalPtr              [ATL.@]
00360  */
00361 HRESULT WINAPI AtlUnmarshalPtr(IStream *stm, const IID *iid, IUnknown **ppUnk)
00362 {
00363     FIXME("%p %p %p\n", stm, iid, ppUnk);
00364     return E_FAIL;
00365 }
00366 
00367 /***********************************************************************
00368  *           AtlModuleGetClassObject              [ATL.@]
00369  */
00370 HRESULT WINAPI AtlModuleGetClassObject(_ATL_MODULEW *pm, REFCLSID rclsid,
00371                                        REFIID riid, LPVOID *ppv)
00372 {
00373     _ATL_OBJMAP_ENTRYW_V1 *obj;
00374     int i;
00375     HRESULT hres = CLASS_E_CLASSNOTAVAILABLE;
00376 
00377     TRACE("%p %s %s %p\n", pm, debugstr_guid(rclsid), debugstr_guid(riid), ppv);
00378 
00379     if (pm == NULL)
00380         return E_INVALIDARG;
00381 
00382     for (i = 0; (obj = get_objmap_entry( pm, i )) != NULL; i++)
00383     {
00384         if (IsEqualCLSID(obj->pclsid, rclsid))
00385         {
00386             TRACE("found object %i\n", i);
00387             if (obj->pfnGetClassObject)
00388             {
00389                 if (!obj->pCF)
00390                     hres = obj->pfnGetClassObject(obj->pfnCreateInstance,
00391                                                   &IID_IUnknown,
00392                                                   (void **)&obj->pCF);
00393                 if (obj->pCF)
00394                     hres = IUnknown_QueryInterface(obj->pCF, riid, ppv);
00395                 break;
00396             }
00397         }
00398     }
00399 
00400     WARN("no class object found for %s\n", debugstr_guid(rclsid));
00401 
00402     return hres;
00403 }
00404 
00405 /***********************************************************************
00406  *           AtlModuleGetClassObject              [ATL.@]
00407  */
00408 HRESULT WINAPI AtlModuleRegisterTypeLib(_ATL_MODULEW *pm, LPCOLESTR lpszIndex)
00409 {
00410     HRESULT hRes;
00411     BSTR path;
00412     ITypeLib *typelib;
00413 
00414     TRACE("%p %s\n", pm, debugstr_w(lpszIndex));
00415 
00416     if (!pm)
00417         return E_INVALIDARG;
00418 
00419     hRes = AtlModuleLoadTypeLib(pm, lpszIndex, &path, &typelib);
00420 
00421     if (SUCCEEDED(hRes))
00422     {
00423         hRes = RegisterTypeLib(typelib, path, NULL); /* FIXME: pass help directory */
00424         ITypeLib_Release(typelib);
00425         SysFreeString(path);
00426     }
00427 
00428     return hRes;
00429 }
00430 
00431 /***********************************************************************
00432  *           AtlModuleRevokeClassObjects          [ATL.@]
00433  */
00434 HRESULT WINAPI AtlModuleRevokeClassObjects(_ATL_MODULEW *pm)
00435 {
00436     FIXME("%p\n", pm);
00437     return E_FAIL;
00438 }
00439 
00440 /***********************************************************************
00441  *           AtlModuleUnregisterServer           [ATL.@]
00442  */
00443 HRESULT WINAPI AtlModuleUnregisterServer(_ATL_MODULEW *pm, const CLSID *clsid)
00444 {
00445     FIXME("%p %s\n", pm, debugstr_guid(clsid));
00446     return E_FAIL;
00447 }
00448 
00449 /***********************************************************************
00450  *           AtlModuleRegisterWndClassInfoA           [ATL.@]
00451  *
00452  * See AtlModuleRegisterWndClassInfoW.
00453  */
00454 ATOM WINAPI AtlModuleRegisterWndClassInfoA(_ATL_MODULEA *pm, _ATL_WNDCLASSINFOA *wci, WNDPROC *pProc)
00455 {
00456     ATOM atom;
00457 
00458     FIXME("%p %p %p semi-stub\n", pm, wci, pProc);
00459 
00460     atom = wci->m_atom;
00461     if (!atom)
00462     {
00463         WNDCLASSEXA wc;
00464 
00465         TRACE("wci->m_wc.lpszClassName = %s\n", wci->m_wc.lpszClassName);
00466 
00467         if (wci->m_lpszOrigName)
00468             FIXME( "subclassing %s not implemented\n", debugstr_a(wci->m_lpszOrigName));
00469 
00470         if (!wci->m_wc.lpszClassName)
00471         {
00472             snprintf(wci->m_szAutoName, sizeof(wci->m_szAutoName), "ATL%08lx", (UINT_PTR)wci);
00473             TRACE("auto-generated class name %s\n", wci->m_szAutoName);
00474             wci->m_wc.lpszClassName = wci->m_szAutoName;
00475         }
00476 
00477         atom = GetClassInfoExA(pm->m_hInst, wci->m_wc.lpszClassName, &wc);
00478         if (!atom)
00479         {
00480             wci->m_wc.hInstance = pm->m_hInst;
00481             wci->m_wc.hCursor   = LoadCursorA( wci->m_bSystemCursor ? NULL : pm->m_hInst,
00482                                                wci->m_lpszCursorID );
00483             atom = RegisterClassExA(&wci->m_wc);
00484         }
00485         wci->pWndProc = wci->m_wc.lpfnWndProc;
00486         wci->m_atom = atom;
00487     }
00488 
00489     if (wci->m_lpszOrigName) *pProc = wci->pWndProc;
00490 
00491     TRACE("returning 0x%04x\n", atom);
00492     return atom;
00493 }
00494 
00495 /***********************************************************************
00496  *           AtlModuleRegisterWndClassInfoW           [ATL.@]
00497  *
00498  * PARAMS
00499  *  pm   [IO] Information about the module registering the window.
00500  *  wci  [IO] Information about the window being registered.
00501  *  pProc [O] Window procedure of the registered class.
00502  *
00503  * RETURNS
00504  *  Atom representing the registered class.
00505  *
00506  * NOTES
00507  *  Can be called multiple times without error, unlike RegisterClassEx().
00508  *
00509  *  If the class name is NULL, then a class with a name of "ATLxxxxxxxx" is
00510  *  registered, where the 'x's represent a unique value.
00511  *
00512  */
00513 ATOM WINAPI AtlModuleRegisterWndClassInfoW(_ATL_MODULEW *pm, _ATL_WNDCLASSINFOW *wci, WNDPROC *pProc)
00514 {
00515     ATOM atom;
00516 
00517     FIXME("%p %p %p semi-stub\n", pm, wci, pProc);
00518 
00519     atom = wci->m_atom;
00520     if (!atom)
00521     {
00522         WNDCLASSEXW wc;
00523 
00524         TRACE("wci->m_wc.lpszClassName = %s\n", debugstr_w(wci->m_wc.lpszClassName));
00525 
00526         if (wci->m_lpszOrigName)
00527             FIXME( "subclassing %s not implemented\n", debugstr_w(wci->m_lpszOrigName));
00528 
00529         if (!wci->m_wc.lpszClassName)
00530         {
00531             static const WCHAR szFormat[] = {'A','T','L','%','0','8','l','x',0};
00532             snprintfW(wci->m_szAutoName, sizeof(wci->m_szAutoName)/sizeof(WCHAR), szFormat, (UINT_PTR)wci);
00533             TRACE("auto-generated class name %s\n", debugstr_w(wci->m_szAutoName));
00534             wci->m_wc.lpszClassName = wci->m_szAutoName;
00535         }
00536 
00537         atom = GetClassInfoExW(pm->m_hInst, wci->m_wc.lpszClassName, &wc);
00538         if (!atom)
00539         {
00540             wci->m_wc.hInstance = pm->m_hInst;
00541             wci->m_wc.hCursor   = LoadCursorW( wci->m_bSystemCursor ? NULL : pm->m_hInst,
00542                                                wci->m_lpszCursorID );
00543             atom = RegisterClassExW(&wci->m_wc);
00544         }
00545         wci->pWndProc = wci->m_wc.lpfnWndProc;
00546         wci->m_atom = atom;
00547     }
00548 
00549     if (wci->m_lpszOrigName) *pProc = wci->pWndProc;
00550 
00551     TRACE("returning 0x%04x\n", atom);
00552     return atom;
00553 }
00554 
00555 void WINAPI AtlHiMetricToPixel(const SIZEL* lpHiMetric, SIZEL* lpPix)
00556 {
00557     HDC dc = GetDC(NULL);
00558     lpPix->cx = lpHiMetric->cx * GetDeviceCaps( dc, LOGPIXELSX ) / 100;
00559     lpPix->cy = lpHiMetric->cy * GetDeviceCaps( dc, LOGPIXELSY ) / 100;
00560     ReleaseDC( NULL, dc );
00561 }
00562 
00563 void WINAPI AtlPixelToHiMetric(const SIZEL* lpPix, SIZEL* lpHiMetric)
00564 {
00565     HDC dc = GetDC(NULL);
00566     lpHiMetric->cx = 100 * lpPix->cx / GetDeviceCaps( dc, LOGPIXELSX );
00567     lpHiMetric->cy = 100 * lpPix->cy / GetDeviceCaps( dc, LOGPIXELSY );
00568     ReleaseDC( NULL, dc );
00569 }
00570 
00571 /***********************************************************************
00572  *           AtlCreateTargetDC         [ATL.@]
00573  */
00574 HDC WINAPI AtlCreateTargetDC( HDC hdc, DVTARGETDEVICE *dv )
00575 {
00576     static const WCHAR displayW[] = {'d','i','s','p','l','a','y',0};
00577     const WCHAR *driver = NULL, *device = NULL, *port = NULL;
00578     DEVMODEW *devmode = NULL;
00579 
00580     TRACE( "(%p, %p)\n", hdc, dv );
00581 
00582     if (dv)
00583     {
00584         if (dv->tdDriverNameOffset) driver  = (WCHAR *)((char *)dv + dv->tdDriverNameOffset);
00585         if (dv->tdDeviceNameOffset) device  = (WCHAR *)((char *)dv + dv->tdDeviceNameOffset);
00586         if (dv->tdPortNameOffset)   port    = (WCHAR *)((char *)dv + dv->tdPortNameOffset);
00587         if (dv->tdExtDevmodeOffset) devmode = (DEVMODEW *)((char *)dv + dv->tdExtDevmodeOffset);
00588     }
00589     else
00590     {
00591         if (hdc) return hdc;
00592         driver = displayW;
00593     }
00594     return CreateDCW( driver, device, port, devmode );
00595 }
00596 
00597 /***********************************************************************
00598  *           AtlModuleAddCreateWndData          [ATL.@]
00599  */
00600 void WINAPI AtlModuleAddCreateWndData(_ATL_MODULEW *pM, _AtlCreateWndData *pData, void* pvObject)
00601 {
00602     TRACE("(%p, %p, %p)\n", pM, pData, pvObject);
00603 
00604     pData->m_pThis = pvObject;
00605     pData->m_dwThreadID = GetCurrentThreadId();
00606     pData->m_pNext = pM->m_pCreateWndList;
00607     pM->m_pCreateWndList = pData;
00608 }
00609 
00610 /***********************************************************************
00611  *           AtlModuleExtractCreateWndData      [ATL.@]
00612  *
00613  *  NOTE: I failed to find any good description of this function.
00614  *        Tests show that this function extracts one of _AtlCreateWndData
00615  *        records from the current thread from a list
00616  *
00617  */
00618 void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM)
00619 {
00620     _AtlCreateWndData **ppData;
00621 
00622     TRACE("(%p)\n", pM);
00623 
00624     for(ppData = &pM->m_pCreateWndList; *ppData!=NULL; ppData = &(*ppData)->m_pNext)
00625     {
00626         if ((*ppData)->m_dwThreadID == GetCurrentThreadId())
00627         {
00628             _AtlCreateWndData *pData = *ppData;
00629             *ppData = pData->m_pNext;
00630             return pData->m_pThis;
00631         }
00632     }
00633     return NULL;
00634 }
00635 
00636 /* FIXME: should be in a header file */
00637 typedef struct ATL_PROPMAP_ENTRY
00638 {
00639     LPCOLESTR szDesc;
00640     DISPID dispid;
00641     const CLSID* pclsidPropPage;
00642     const IID* piidDispatch;
00643     DWORD dwOffsetData;
00644     DWORD dwSizeData;
00645     VARTYPE vt;
00646 } ATL_PROPMAP_ENTRY;
00647 
00648 /***********************************************************************
00649  *           AtlIPersistStreamInit_Load      [ATL.@]
00650  */
00651 HRESULT WINAPI AtlIPersistStreamInit_Load( LPSTREAM pStm, ATL_PROPMAP_ENTRY *pMap,
00652                                            void *pThis, IUnknown *pUnk)
00653 {
00654     FIXME("(%p, %p, %p, %p)\n", pStm, pMap, pThis, pUnk);
00655 
00656     return S_OK;
00657 }
00658 
00659 HRESULT WINAPI AtlIPersistStreamInit_Save(LPSTREAM pStm, BOOL fClearDirty,
00660                                           ATL_PROPMAP_ENTRY *pMap, void *pThis,
00661                                           IUnknown *pUnk)
00662 {
00663     FIXME("(%p, %d, %p, %p, %p)\n", pStm, fClearDirty, pMap, pThis, pUnk);
00664 
00665     return S_OK;
00666 }

Generated on Sun May 27 2012 04:22:47 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.