ReactOS  0.4.12-dev-90-g2e2e63e
atl.c File Reference
#include "wine/atlbase.h"
#include "wine/atlcom.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
Include dependency graph for atl.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define ATLVer1Size   FIELD_OFFSET(_ATL_MODULEW, dwAtlBuildVer)
 

Typedefs

typedef unsigned char cpp_bool
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (atl)
 
HRESULT WINAPI AtlAdvise (IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD *pdw)
 
HRESULT WINAPI AtlUnadvise (IUnknown *pUnkCP, const IID *iid, DWORD dw)
 
HRESULT WINAPI AtlFreeMarshalStream (IStream *stm)
 
HRESULT WINAPI AtlMarshalPtrInProc (IUnknown *pUnk, const IID *iid, IStream **pstm)
 
HRESULT WINAPI AtlUnmarshalPtr (IStream *stm, const IID *iid, IUnknown **ppUnk)
 
HDC WINAPI AtlCreateTargetDC (HDC hdc, DVTARGETDEVICE *dv)
 
void WINAPI AtlHiMetricToPixel (const SIZEL *lpHiMetric, SIZEL *lpPix)
 
void WINAPI AtlPixelToHiMetric (const SIZEL *lpPix, SIZEL *lpHiMetric)
 
IUnknown *WINAPI AtlComPtrAssign (IUnknown **pp, IUnknown *p)
 
IUnknown *WINAPI AtlComQIPtrAssign (IUnknown **pp, IUnknown *p, REFIID riid)
 
HRESULT WINAPI AtlInternalQueryInterface (void *this, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
HRESULT WINAPI AtlIPersistStreamInit_Load (LPSTREAM pStm, ATL_PROPMAP_ENTRY *pMap, void *pThis, IUnknown *pUnk)
 
HRESULT WINAPI AtlIPersistStreamInit_Save (LPSTREAM pStm, BOOL fClearDirty, ATL_PROPMAP_ENTRY *pMap, void *pThis, IUnknown *pUnk)
 
HRESULT WINAPI AtlIPersistPropertyBag_Load (LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog, ATL_PROPMAP_ENTRY *pMap, void *pThis, IUnknown *pUnk)
 
HRESULT WINAPI AtlIPersistPropertyBag_Save (LPPROPERTYBAG pPropBag, BOOL fClearDirty, BOOL fSaveAll, ATL_PROPMAP_ENTRY *pMap, void *pThis, IUnknown *pUnk)
 
HRESULT WINAPI AtlModuleAddTermFunc (_ATL_MODULE *pM, _ATL_TERMFUNC *pFunc, DWORD_PTR dw)
 
HRESULT WINAPI AtlLoadTypeLib (HINSTANCE inst, LPCOLESTR lpszIndex, BSTR *pbstrPath, ITypeLib **ppTypeLib)
 
HRESULT WINAPI AtlRegisterTypeLib (HINSTANCE inst, const WCHAR *index)
 
HRESULT WINAPI AtlRegisterClassCategoriesHelper (REFCLSID clsid, const struct _ATL_CATMAP_ENTRY *catmap, BOOL reg)
 
BOOL WINAPI AtlWaitWithMessageLoop (HANDLE handle)
 
static HRESULT get_default_source (ITypeLib *typelib, const CLSID *clsid, IID *iid)
 
HRESULT WINAPI AtlGetObjectSourceInterface (IUnknown *unk, GUID *libid, IID *iid, unsigned short *major, unsigned short *minor)
 
HRESULT WINAPI AtlSetPerUserRegistration (cpp_bool bEnable)
 
HRESULT WINAPI AtlGetPerUserRegistration (cpp_bool *pbEnabled)
 
DWORD WINAPI AtlGetVersion (void *pReserved)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 

Variables

HINSTANCE atl_instance
 
static ICatRegistercatreg
 

Macro Definition Documentation

◆ ATLVer1Size

#define ATLVer1Size   FIELD_OFFSET(_ATL_MODULEW, dwAtlBuildVer)

Definition at line 35 of file atl.c.

Referenced by AtlModuleAddTermFunc().

◆ COBJMACROS

#define COBJMACROS

Definition at line 20 of file atl.c.

Typedef Documentation

◆ cpp_bool

typedef unsigned char cpp_bool

Definition at line 39 of file atl.c.

Function Documentation

◆ AtlAdvise()

HRESULT WINAPI AtlAdvise ( IUnknown pUnkCP,
IUnknown pUnk,
const IID iid,
DWORD pdw 
)

Definition at line 46 of file atl.c.

Referenced by CAddressEditBox::Init(), CExplorerBand::InitializeExplorerBand(), CBrandBand::SetSite(), CInternetToolbar::SetSite(), and test_cp().

47 {
50  HRESULT hres;
51 
52  TRACE("%p %p %p %p\n", pUnkCP, pUnk, iid, pdw);
53 
54  if(!pUnkCP)
55  return E_INVALIDARG;
56 
57  hres = IUnknown_QueryInterface(pUnkCP, &IID_IConnectionPointContainer, (void**)&container);
58  if(FAILED(hres))
59  return hres;
60 
61  hres = IConnectionPointContainer_FindConnectionPoint(container, iid, &cp);
62  IConnectionPointContainer_Release(container);
63  if(FAILED(hres))
64  return hres;
65 
66  hres = IConnectionPoint_Advise(cp, pUnk, pdw);
67  IConnectionPoint_Release(cp);
68  return hres;
69 }
const GUID IID_IConnectionPointContainer
struct container container
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
POINT cp
Definition: magnifier.c:60

◆ AtlComPtrAssign()

IUnknown* WINAPI AtlComPtrAssign ( IUnknown **  pp,
IUnknown p 
)

Definition at line 177 of file atl.c.

178 {
179  TRACE("(%p %p)\n", pp, p);
180 
181  if (p) IUnknown_AddRef(p);
182  if (*pp) IUnknown_Release(*pp);
183  *pp = p;
184  return p;
185 }
#define TRACE(s)
Definition: solgame.cpp:4
GLfloat GLfloat p
Definition: glext.h:8902

◆ AtlComQIPtrAssign()

IUnknown* WINAPI AtlComQIPtrAssign ( IUnknown **  pp,
IUnknown p,
REFIID  riid 
)

Definition at line 190 of file atl.c.

191 {
192  IUnknown *new_p = NULL;
193 
194  TRACE("(%p %p %s)\n", pp, p, debugstr_guid(riid));
195 
196  if (p) IUnknown_QueryInterface(p, riid, (void **)&new_p);
197  if (*pp) IUnknown_Release(*pp);
198  *pp = new_p;
199  return new_p;
200 }
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

◆ AtlCreateTargetDC()

HDC WINAPI AtlCreateTargetDC ( HDC  hdc,
DVTARGETDEVICE dv 
)

Definition at line 129 of file atl.c.

130 {
131  static const WCHAR displayW[] = {'d','i','s','p','l','a','y',0};
132  const WCHAR *driver = NULL, *device = NULL, *port = NULL;
133  DEVMODEW *devmode = NULL;
134 
135  TRACE( "(%p, %p)\n", hdc, dv );
136 
137  if (dv)
138  {
139  if (dv->tdDriverNameOffset) driver = (WCHAR *)((char *)dv + dv->tdDriverNameOffset);
140  if (dv->tdDeviceNameOffset) device = (WCHAR *)((char *)dv + dv->tdDeviceNameOffset);
141  if (dv->tdPortNameOffset) port = (WCHAR *)((char *)dv + dv->tdPortNameOffset);
142  if (dv->tdExtDevmodeOffset) devmode = (DEVMODEW *)((char *)dv + dv->tdExtDevmodeOffset);
143  }
144  else
145  {
146  if (hdc) return hdc;
147  driver = displayW;
148  }
149  return CreateDCW( driver, device, port, devmode );
150 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: devices.h:37
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR displayW[]
Definition: icm.c:30
DEVMODEW devmode
struct @1598::@1599 driver
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)
USHORT port
Definition: uri.c:227

◆ AtlFreeMarshalStream()

HRESULT WINAPI AtlFreeMarshalStream ( IStream stm)

Definition at line 102 of file atl.c.

103 {
104  FIXME("%p\n", stm);
105  return S_OK;
106 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ AtlGetObjectSourceInterface()

HRESULT WINAPI AtlGetObjectSourceInterface ( IUnknown unk,
GUID libid,
IID iid,
unsigned short major,
unsigned short minor 
)

Definition at line 889 of file atl.c.

Referenced by test_source_iface().

890 {
893  ITypeLib *typelib;
894  IPersist *persist;
895  IDispatch *disp;
896  HRESULT hres;
897 
898  TRACE("(%p %p %p %p %p)\n", unk, libid, iid, major, minor);
899 
900  hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp);
901  if(FAILED(hres))
902  return hres;
903 
904  hres = IDispatch_GetTypeInfo(disp, 0, 0, &typeinfo);
905  IDispatch_Release(disp);
906  if(FAILED(hres))
907  return hres;
908 
909  hres = ITypeInfo_GetContainingTypeLib(typeinfo, &typelib, 0);
910  ITypeInfo_Release(typeinfo);
911  if(SUCCEEDED(hres)) {
912  TLIBATTR *attr;
913 
914  hres = ITypeLib_GetLibAttr(typelib, &attr);
915  if(SUCCEEDED(hres)) {
916  *libid = attr->guid;
917  *major = attr->wMajorVerNum;
918  *minor = attr->wMinorVerNum;
919  ITypeLib_ReleaseTLibAttr(typelib, attr);
920  }else {
921  ITypeLib_Release(typelib);
922  }
923  }
924  if(FAILED(hres))
925  return hres;
926 
927  hres = IUnknown_QueryInterface(unk, &IID_IProvideClassInfo2, (void**)&classinfo);
928  if(SUCCEEDED(hres)) {
929  hres = IProvideClassInfo2_GetGUID(classinfo, GUIDKIND_DEFAULT_SOURCE_DISP_IID, iid);
930  IProvideClassInfo2_Release(classinfo);
931  ITypeLib_Release(typelib);
932  return hres;
933  }
934 
935  hres = IUnknown_QueryInterface(unk, &IID_IPersist, (void**)&persist);
936  if(SUCCEEDED(hres)) {
937  CLSID clsid;
938 
939  hres = IPersist_GetClassID(persist, &clsid);
940  if(SUCCEEDED(hres))
941  hres = get_default_source(typelib, &clsid, iid);
942  IPersist_Release(persist);
943  }
944 
945  return hres;
946 }
disp
Definition: i386-dis.c:3181
const GUID IID_IPersist
Definition: proxy.cpp:14
static ITypeLib * typelib
Definition: apps.c:105
classinfo
Definition: clsfactory.c:43
const GUID IID_IProvideClassInfo2
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IDispatch
REFCLSID clsid
Definition: msctf.c:84
__u8 attr
Definition: mkdosfs.c:359
static ITypeInfo * typeinfo[last_tid]
Definition: apps.c:106
#define major(rdev)
Definition: propsheet.cpp:879
#define minor(rdev)
Definition: propsheet.cpp:880
static HRESULT get_default_source(ITypeLib *typelib, const CLSID *clsid, IID *iid)
Definition: atl.c:837
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ AtlGetPerUserRegistration()

HRESULT WINAPI AtlGetPerUserRegistration ( cpp_bool pbEnabled)

Definition at line 962 of file atl.c.

Referenced by test_regcat().

963 {
964  FIXME("stub: returning false\n");
965  *pbEnabled = 0;
966  return S_OK;
967 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ AtlGetVersion()

DWORD WINAPI AtlGetVersion ( void pReserved)

Definition at line 974 of file atl.c.

975 {
976  TRACE("version %04x (%p)\n", _ATL_VER, pReserved);
977  return _ATL_VER;
978 }
#define _ATL_VER
Definition: atlbase.h:36
#define TRACE(s)
Definition: solgame.cpp:4

◆ AtlHiMetricToPixel()

void WINAPI AtlHiMetricToPixel ( const SIZEL lpHiMetric,
SIZEL lpPix 
)

Definition at line 155 of file atl.c.

156 {
157  HDC dc = GetDC(NULL);
158  lpPix->cx = lpHiMetric->cx * GetDeviceCaps( dc, LOGPIXELSX ) / 100;
159  lpPix->cy = lpHiMetric->cy * GetDeviceCaps( dc, LOGPIXELSY ) / 100;
160  ReleaseDC( NULL, dc );
161 }
#define HDC
Definition: msvc.h:22
#define LOGPIXELSX
Definition: wingdi.h:716
HDC WINAPI GetDC(_In_opt_ HWND)
HDC dc
Definition: cylfrac.c:34
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:324
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:717
LONG cy
Definition: windef.h:325

◆ AtlInternalQueryInterface()

HRESULT WINAPI AtlInternalQueryInterface ( void this,
const _ATL_INTMAP_ENTRY pEntries,
REFIID  iid,
void **  ppvObject 
)

Definition at line 205 of file atl.c.

206 {
207  int i = 0;
208  HRESULT rc = E_NOINTERFACE;
209  TRACE("(%p, %p, %s, %p)\n",this, pEntries, debugstr_guid(iid), ppvObject);
210 
211  if (IsEqualGUID(iid,&IID_IUnknown))
212  {
213  TRACE("Returning IUnknown\n");
214  *ppvObject = ((LPSTR)this+pEntries[0].dw);
215  IUnknown_AddRef((IUnknown*)*ppvObject);
216  return S_OK;
217  }
218 
219  while (pEntries[i].pFunc != 0)
220  {
221  TRACE("Trying entry %i (%s %i %p)\n",i,debugstr_guid(pEntries[i].piid),
222  pEntries[i].dw, pEntries[i].pFunc);
223 
224  if (!pEntries[i].piid || IsEqualGUID(iid,pEntries[i].piid))
225  {
226  TRACE("MATCH\n");
227  if (pEntries[i].pFunc == (_ATL_CREATORARGFUNC*)1)
228  {
229  TRACE("Offset\n");
230  *ppvObject = ((LPSTR)this+pEntries[i].dw);
231  IUnknown_AddRef((IUnknown*)*ppvObject);
232  return S_OK;
233  }
234  else
235  {
236  TRACE("Function\n");
237  rc = pEntries[i].pFunc(this, iid, ppvObject, pEntries[i].dw);
238  if(rc==S_OK || pEntries[i].piid)
239  return rc;
240  }
241  }
242  i++;
243  }
244  TRACE("Done returning (0x%x)\n",rc);
245  return rc;
246 }
#define E_NOINTERFACE
Definition: winerror.h:2364
_ATL_CREATORARGFUNC * pFunc
Definition: atlbase.h:238
char * LPSTR
Definition: xmlstorage.h:182
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024

◆ AtlIPersistPropertyBag_Load()

HRESULT WINAPI AtlIPersistPropertyBag_Load ( LPPROPERTYBAG  pPropBag,
LPERRORLOG  pErrorLog,
ATL_PROPMAP_ENTRY pMap,
void pThis,
IUnknown pUnk 
)

Definition at line 274 of file atl.c.

277 {
278  FIXME("(%p, %p, %p, %p, %p)\n", pPropBag, pErrorLog, pMap, pThis, pUnk);
279 
280  return S_OK;
281 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ AtlIPersistPropertyBag_Save()

HRESULT WINAPI AtlIPersistPropertyBag_Save ( LPPROPERTYBAG  pPropBag,
BOOL  fClearDirty,
BOOL  fSaveAll,
ATL_PROPMAP_ENTRY pMap,
void pThis,
IUnknown pUnk 
)

Definition at line 286 of file atl.c.

289 {
290  FIXME("(%p, %d, %d, %p, %p, %p)\n", pPropBag, fClearDirty, fSaveAll, pMap, pThis, pUnk);
291 
292  return S_OK;
293 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ AtlIPersistStreamInit_Load()

HRESULT WINAPI AtlIPersistStreamInit_Load ( LPSTREAM  pStm,
ATL_PROPMAP_ENTRY pMap,
void pThis,
IUnknown pUnk 
)

Definition at line 251 of file atl.c.

253 {
254  FIXME("(%p, %p, %p, %p)\n", pStm, pMap, pThis, pUnk);
255 
256  return S_OK;
257 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ AtlIPersistStreamInit_Save()

HRESULT WINAPI AtlIPersistStreamInit_Save ( LPSTREAM  pStm,
BOOL  fClearDirty,
ATL_PROPMAP_ENTRY pMap,
void pThis,
IUnknown pUnk 
)

Definition at line 262 of file atl.c.

265 {
266  FIXME("(%p, %d, %p, %p, %p)\n", pStm, fClearDirty, pMap, pThis, pUnk);
267 
268  return S_OK;
269 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ AtlLoadTypeLib()

HRESULT WINAPI AtlLoadTypeLib ( HINSTANCE  inst,
LPCOLESTR  lpszIndex,
BSTR pbstrPath,
ITypeLib **  ppTypeLib 
)

Definition at line 342 of file atl.c.

Referenced by AtlModuleLoadTypeLib(), AtlRegisterTypeLib(), and test_typelib().

344 {
345  size_t path_len, index_len;
346  ITypeLib *typelib = NULL;
347  WCHAR *path;
348  HRESULT hres;
349 
350  static const WCHAR tlb_extW[] = {'.','t','l','b',0};
351 
352  TRACE("(%p %s %p %p)\n", inst, debugstr_w(lpszIndex), pbstrPath, ppTypeLib);
353 
354  index_len = lpszIndex ? strlenW(lpszIndex) : 0;
355  path = heap_alloc((MAX_PATH+index_len)*sizeof(WCHAR) + sizeof(tlb_extW));
356  if(!path)
357  return E_OUTOFMEMORY;
358 
359  path_len = GetModuleFileNameW(inst, path, MAX_PATH);
360  if(!path_len) {
361  heap_free(path);
363  }
364 
365  if(index_len)
366  memcpy(path+path_len, lpszIndex, (index_len+1)*sizeof(WCHAR));
367 
368  hres = LoadTypeLib(path, &typelib);
369  if(FAILED(hres)) {
370  WCHAR *ptr;
371 
372  for(ptr = path+path_len-1; ptr > path && *ptr != '\\' && *ptr != '.'; ptr--);
373  if(*ptr != '.')
374  ptr = path+path_len;
375  memcpy(ptr, tlb_extW, sizeof(tlb_extW));
376  hres = LoadTypeLib(path, &typelib);
377  }
378 
379  if(SUCCEEDED(hres)) {
380  *pbstrPath = SysAllocString(path);
381  if(!*pbstrPath) {
382  ITypeLib_Release(typelib);
383  hres = E_OUTOFMEMORY;
384  }
385  }
386 
387  heap_free(path);
388  if(FAILED(hres))
389  return hres;
390 
391  *ppTypeLib = typelib;
392  return S_OK;
393 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLsizei const GLchar ** path
Definition: glext.h:7234
static ITypeLib * typelib
Definition: apps.c:105
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HRESULT WINAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib **pptLib)
Definition: typelib.c:461
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
static DWORD path_len
Definition: batch.c:31
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ AtlMarshalPtrInProc()

HRESULT WINAPI AtlMarshalPtrInProc ( IUnknown pUnk,
const IID iid,
IStream **  pstm 
)

Definition at line 111 of file atl.c.

112 {
113  FIXME("%p %p %p\n", pUnk, iid, pstm);
114  return E_FAIL;
115 }
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110

◆ AtlModuleAddTermFunc()

HRESULT WINAPI AtlModuleAddTermFunc ( _ATL_MODULE pM,
_ATL_TERMFUNC *  pFunc,
DWORD_PTR  dw 
)

Definition at line 298 of file atl.c.

Referenced by test_term().

299 {
300  _ATL_TERMFUNC_ELEM *termfunc_elem;
301 
302  TRACE("version %04x (%p %p %ld)\n", _ATL_VER, pM, pFunc, dw);
303 
304  if (_ATL_VER > _ATL_VER_30 || pM->cbSize > ATLVer1Size) {
305  termfunc_elem = HeapAlloc(GetProcessHeap(), 0, sizeof(_ATL_TERMFUNC_ELEM));
306  termfunc_elem->pFunc = pFunc;
307  termfunc_elem->dw = dw;
308  termfunc_elem->pNext = pM->m_pTermFuncs;
309 
310  pM->m_pTermFuncs = termfunc_elem;
311  }
312 
313  return S_OK;
314 }
#define ATLVer1Size
Definition: atl.c:35
#define _ATL_VER_30
Definition: atlbase.h:28
_ATL_TERMFUNC_ELEM * m_pTermFuncs
Definition: atlbase.h:194
_ATL_TERMFUNC * pFunc
Definition: atlbase.h:117
UINT cbSize
Definition: atlbase.h:192
#define _ATL_VER
Definition: atlbase.h:36
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct _ATL_TERMFUNC_ELEM_TAG * pNext
Definition: atlbase.h:119
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
#define S_OK
Definition: intsafe.h:59

◆ AtlPixelToHiMetric()

void WINAPI AtlPixelToHiMetric ( const SIZEL lpPix,
SIZEL lpHiMetric 
)

Definition at line 166 of file atl.c.

Referenced by IOCS_OnSize().

167 {
168  HDC dc = GetDC(NULL);
169  lpHiMetric->cx = 100 * lpPix->cx / GetDeviceCaps( dc, LOGPIXELSX );
170  lpHiMetric->cy = 100 * lpPix->cy / GetDeviceCaps( dc, LOGPIXELSY );
171  ReleaseDC( NULL, dc );
172 }
#define HDC
Definition: msvc.h:22
#define LOGPIXELSX
Definition: wingdi.h:716
HDC WINAPI GetDC(_In_opt_ HWND)
HDC dc
Definition: cylfrac.c:34
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:324
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:717
LONG cy
Definition: windef.h:325

◆ AtlRegisterClassCategoriesHelper()

HRESULT WINAPI AtlRegisterClassCategoriesHelper ( REFCLSID  clsid,
const struct _ATL_CATMAP_ENTRY catmap,
BOOL  reg 
)

Definition at line 748 of file atl.c.

Referenced by AtlComModuleRegisterServer(), AtlModuleRegisterServer(), AtlRegisterTypeLib(), and test_regcat().

749 {
750  const struct _ATL_CATMAP_ENTRY *iter;
751  HRESULT hres;
752 
753  TRACE("(%s %p %x)\n", debugstr_guid(clsid), catmap, reg);
754 
755  if(!catmap)
756  return S_OK;
757 
758  if(!catreg) {
759  ICatRegister *new_catreg;
760 
761  hres = CoCreateInstance(&CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER,
762  &IID_ICatRegister, (void**)&new_catreg);
763  if(FAILED(hres))
764  return hres;
765 
766  if(InterlockedCompareExchangePointer((void**)&catreg, new_catreg, NULL))
767  ICatRegister_Release(new_catreg);
768  }
769 
770  for(iter = catmap; iter->iType != _ATL_CATMAP_ENTRY_END; iter++) {
771  CATID catid = *iter->pcatid; /* For stupid lack of const in ICatRegister declaration. */
772 
773  if(iter->iType == _ATL_CATMAP_ENTRY_IMPLEMENTED) {
774  if(reg)
775  hres = ICatRegister_RegisterClassImplCategories(catreg, clsid, 1, &catid);
776  else
777  hres = ICatRegister_UnRegisterClassImplCategories(catreg, clsid, 1, &catid);
778  }else {
779  if(reg)
780  hres = ICatRegister_RegisterClassReqCategories(catreg, clsid, 1, &catid);
781  else
782  hres = ICatRegister_UnRegisterClassReqCategories(catreg, clsid, 1, &catid);
783  }
784  if(FAILED(hres))
785  return hres;
786  }
787 
788  if(!reg) {
789  WCHAR reg_path[256] = {'C','L','S','I','D','\\'}, *ptr = reg_path+6;
790 
791  static const WCHAR implemented_catW[] =
792  {'I','m','p','l','e','m','e','n','t','e','d',' ','C','a','t','e','g','o','r','i','e','s',0};
793  static const WCHAR required_catW[] =
794  {'R','e','q','u','i','r','e','d',' ','C','a','t','e','g','o','r','i','e','s',0};
795 
796  ptr += StringFromGUID2(clsid, ptr, 64)-1;
797  *ptr++ = '\\';
798 
799  memcpy(ptr, implemented_catW, sizeof(implemented_catW));
800  RegDeleteKeyW(HKEY_CLASSES_ROOT, reg_path);
801 
802  memcpy(ptr, required_catW, sizeof(required_catW));
803  RegDeleteKeyW(HKEY_CLASSES_ROOT, reg_path);
804  }
805 
806  return S_OK;
807 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1240
const CATID * pcatid
Definition: atlbase.h:250
static ICatRegister * catreg
Definition: atl.c:41
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
GUID catid
Definition: msctf.idl:608
#define debugstr_guid
Definition: kernel32.h:35
int iType
Definition: atlbase.h:249
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2346
REFCLSID clsid
Definition: msctf.c:84
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3237
#define S_OK
Definition: intsafe.h:59
#define _ATL_CATMAP_ENTRY_IMPLEMENTED
Definition: atlbase.h:254
static int reg
Definition: i386-dis.c:1275
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define _ATL_CATMAP_ENTRY_END
Definition: atlbase.h:253
Definition: atlbase.h:247

◆ AtlRegisterTypeLib()

HRESULT WINAPI AtlRegisterTypeLib ( HINSTANCE  inst,
const WCHAR index 
)

Definition at line 400 of file atl.c.

Referenced by AtlComModuleRegisterServer(), AtlModuleRegisterServer(), and AtlModuleRegisterTypeLib().

401 {
402  ITypeLib *typelib;
403  BSTR path;
404  HRESULT hres;
405 
406  TRACE("(%p %s)\n", inst, debugstr_w(index));
407 
408  hres = AtlLoadTypeLib(inst, index, &path, &typelib);
409  if(FAILED(hres))
410  return hres;
411 
412  hres = RegisterTypeLib(typelib, path, NULL); /* FIXME: pass help directory */
413  ITypeLib_Release(typelib);
414  SysFreeString(path);
415  return hres;
416 }
GLsizei const GLchar ** path
Definition: glext.h:7234
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275
static ITypeLib * typelib
Definition: apps.c:105
OLECHAR * BSTR
Definition: compat.h:1927
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
HRESULT WINAPI RegisterTypeLib(ITypeLib *ptlib, OLECHAR *szFullPath, OLECHAR *szHelpDir)
Definition: typelib.c:649
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI AtlLoadTypeLib(HINSTANCE inst, LPCOLESTR lpszIndex, BSTR *pbstrPath, ITypeLib **ppTypeLib)
Definition: atl.c:342

◆ AtlSetPerUserRegistration()

HRESULT WINAPI AtlSetPerUserRegistration ( cpp_bool  bEnable)

Definition at line 953 of file atl.c.

954 {
955  FIXME("stub: bEnable: %d\n", bEnable);
956  return E_NOTIMPL;
957 }
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ BOOL bEnable
Definition: winddi.h:3426
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ AtlUnadvise()

HRESULT WINAPI AtlUnadvise ( IUnknown pUnkCP,
const IID iid,
DWORD  dw 
)

Definition at line 74 of file atl.c.

Referenced by CExplorerBand::DestroyExplorerBand(), CAddressEditBox::SetOwner(), CBrandBand::SetSite(), CInternetToolbar::SetSite(), and test_cp().

75 {
78  HRESULT hres;
79 
80  TRACE("%p %p %d\n", pUnkCP, iid, dw);
81 
82  if(!pUnkCP)
83  return E_INVALIDARG;
84 
85  hres = IUnknown_QueryInterface(pUnkCP, &IID_IConnectionPointContainer, (void**)&container);
86  if(FAILED(hres))
87  return hres;
88 
89  hres = IConnectionPointContainer_FindConnectionPoint(container, iid, &cp);
90  IConnectionPointContainer_Release(container);
91  if(FAILED(hres))
92  return hres;
93 
94  hres = IConnectionPoint_Unadvise(cp, dw);
95  IConnectionPoint_Release(cp);
96  return hres;
97 }
const GUID IID_IConnectionPointContainer
struct container container
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
POINT cp
Definition: magnifier.c:60

◆ AtlUnmarshalPtr()

HRESULT WINAPI AtlUnmarshalPtr ( IStream stm,
const IID iid,
IUnknown **  ppUnk 
)

Definition at line 120 of file atl.c.

121 {
122  FIXME("%p %p %p\n", stm, iid, ppUnk);
123  return E_FAIL;
124 }
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110

◆ AtlWaitWithMessageLoop()

BOOL WINAPI AtlWaitWithMessageLoop ( HANDLE  handle)

Definition at line 812 of file atl.c.

813 {
814  MSG msg;
815  DWORD res;
816 
817  TRACE("(%p)\n", handle);
818 
819  while(1) {
821  switch(res) {
822  case WAIT_OBJECT_0:
823  return TRUE;
824  case WAIT_OBJECT_0+1:
825  if(GetMessageW(&msg, NULL, 0, 0) < 0)
826  return FALSE;
827 
828  TranslateMessage(&msg);
829  DispatchMessageW(&msg);
830  break;
831  default:
832  return FALSE;
833  }
834  }
835 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define WAIT_OBJECT_0
Definition: winbase.h:387
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define QS_ALLINPUT
Definition: winuser.h:874
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define msg(x)
Definition: auth_time.c:54
GLuint res
Definition: glext.h:9613
#define INFINITE
Definition: serial.h:102

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 980 of file atl.c.

981 {
982  TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
983 
984  switch(fdwReason) {
985  case DLL_PROCESS_ATTACH:
986  atl_instance = hinstDLL;
987  DisableThreadLibraryCalls(hinstDLL);
988  break;
989  case DLL_PROCESS_DETACH:
990  if (lpvReserved) break;
991  if(catreg)
992  ICatRegister_Release(catreg);
993  }
994 
995  return TRUE;
996 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
static ICatRegister * catreg
Definition: atl.c:41
#define DLL_PROCESS_DETACH
Definition: compat.h:119
#define TRACE(s)
Definition: solgame.cpp:4
HINSTANCE atl_instance
Definition: atl.c:37

◆ get_default_source()

static HRESULT get_default_source ( ITypeLib typelib,
const CLSID clsid,
IID iid 
)
static

Definition at line 837 of file atl.c.

Referenced by AtlGetObjectSourceInterface().

838 {
839  ITypeInfo *typeinfo, *src_typeinfo = NULL;
840  TYPEATTR *attr;
841  int type_flags;
842  unsigned i;
843  HRESULT hres;
844 
845  hres = ITypeLib_GetTypeInfoOfGuid(typelib, clsid, &typeinfo);
846  if(FAILED(hres))
847  return hres;
848 
849  hres = ITypeInfo_GetTypeAttr(typeinfo, &attr);
850  if(FAILED(hres)) {
851  ITypeInfo_Release(typeinfo);
852  return hres;
853  }
854 
855  for(i=0; i < attr->cImplTypes; i++) {
856  hres = ITypeInfo_GetImplTypeFlags(typeinfo, i, &type_flags);
857  if(SUCCEEDED(hres) && type_flags == (IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT)) {
858  HREFTYPE ref;
859 
860  hres = ITypeInfo_GetRefTypeOfImplType(typeinfo, i, &ref);
861  if(SUCCEEDED(hres))
862  hres = ITypeInfo_GetRefTypeInfo(typeinfo, ref, &src_typeinfo);
863  break;
864  }
865  }
866 
867  ITypeInfo_ReleaseTypeAttr(typeinfo, attr);
868  ITypeInfo_Release(typeinfo);
869  if(FAILED(hres))
870  return hres;
871 
872  if(!src_typeinfo) {
873  *iid = IID_NULL;
874  return S_OK;
875  }
876 
877  hres = ITypeInfo_GetTypeAttr(src_typeinfo, &attr);
878  if(SUCCEEDED(hres)) {
879  *iid = attr->guid;
880  ITypeInfo_ReleaseTypeAttr(src_typeinfo, attr);
881  }
882  ITypeInfo_Release(src_typeinfo);
883  return hres;
884 }
GLenum GLclampf GLint i
Definition: glfuncs.h:14
GLenum GLint ref
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
__u8 attr
Definition: mkdosfs.c:359
static ITypeInfo * typeinfo[last_tid]
Definition: apps.c:106
#define IID_NULL
Definition: guiddef.h:93
#define S_OK
Definition: intsafe.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( atl  )

Variable Documentation

◆ atl_instance

HINSTANCE atl_instance

Definition at line 37 of file atl.c.

◆ catreg

ICatRegister* catreg
static

Definition at line 41 of file atl.c.

Referenced by ATL::AtlRegisterClassCategoriesHelper().