6 #define WIN32_NO_STATUS
8 #define COM_NO_WINDOWS_H
15 #include <shlobj_undoc.h>
16 #include <shlguid_undoc.h>
17 #include <shdeprecated.h>
25 #include <shlwapi_undoc.h>
26 #include <wine/debug.h>
31 #include "addressband.h"
32 #include "addresseditbox.h"
33 #include "bandproxy.h"
35 #include "bandsitemenu.h"
36 #include "brandband.h"
37 #include "internettoolbar.h"
38 #include "commonbrowser.h"
39 #include "globalfoldersettings.h"
40 #include "regtreeoptions.h"
44 Win32DbgPrint(const char *filename
, int line
, const char *lpFormat
, ...)
52 fname
= strrchr(filename
, '\\');
55 fname
= strrchr(filename
, '/');
65 szMsgStart
= szMsg
+ sprintf(szMsg
, "%s:%d: ", fname
, line
);
67 va_start(vl
, lpFormat
);
68 uRet
= (ULONG
) vsprintf(szMsgStart
, lpFormat
, vl
);
71 OutputDebugStringA(szMsg
);
76 #define DbgPrint(fmt, ...) \
77 Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
79 static void DbgDumpMenuInternal(HMENU hmenu
, char* padding
, int padlevel
)
83 padding
[padlevel
] = '.';
84 padding
[padlevel
+ 1] = '.';
85 padding
[padlevel
+ 2] = 0;
87 int count
= GetMenuItemCount(hmenu
);
88 for (int i
= 0; i
< count
; i
++)
90 MENUITEMINFOW mii
= { 0 };
92 mii
.cbSize
= sizeof(mii
);
93 mii
.fMask
= MIIM_STRING
| MIIM_FTYPE
| MIIM_SUBMENU
| MIIM_STATE
| MIIM_ID
;
94 mii
.dwTypeData
= label
;
95 mii
.cch
= _countof(label
);
97 GetMenuItemInfo(hmenu
, i
, TRUE
, &mii
);
99 if (mii
.fType
& MFT_BITMAP
)
100 DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n", padding
, i
, mii
.wID
, mii
.hbmpItem
, mii
.fState
, mii
.hSubMenu
? "TRUE" : "FALSE");
101 else if (mii
.fType
& MFT_SEPARATOR
)
102 DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding
, i
, mii
.wID
);
104 DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding
, i
, mii
.wID
, mii
.dwTypeData
, mii
.fState
, mii
.hSubMenu
? "TRUE" : "FALSE");
107 DbgDumpMenuInternal(mii
.hSubMenu
, padding
, padlevel
+ 2);
111 padding
[padlevel
] = 0;
114 static __inline
void DbgDumpMenu(HMENU hmenu
)
117 DbgDumpMenuInternal(hmenu
, padding
, 0);
121 #define FAILED_UNEXPECTEDLY(hr) (FAILED(hr) && (DbgPrint("Unexpected failure %08x.\n", hr), TRUE))
123 #define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
127 template <class Base
>
128 class CComDebugObject
: public Base
131 CComDebugObject(void * = NULL
)
136 virtual ~CComDebugObject()
138 this->FinalRelease();
139 _pAtlModule
->Unlock();
142 STDMETHOD_(ULONG
, AddRef
)()
144 int rc
= this->InternalAddRef();
145 DbgPrint("RefCount is now %d(++)!\n", rc
);
149 STDMETHOD_(ULONG
, Release
)()
153 newRefCount
= this->InternalRelease();
154 DbgPrint("RefCount is now %d(--)!\n", newRefCount
);
155 if (newRefCount
== 0)
160 STDMETHOD(QueryInterface
)(REFIID iid
, void **ppvObject
)
162 return this->_InternalQueryInterface(iid
, ppvObject
);
165 static HRESULT WINAPI
CreateInstance(CComDebugObject
<Base
> **pp
)
167 CComDebugObject
<Base
> *newInstance
;
170 ATLASSERT(pp
!= NULL
);
174 hResult
= E_OUTOFMEMORY
;
176 ATLTRY(newInstance
= new CComDebugObject
<Base
>())
177 if (newInstance
!= NULL
)
179 newInstance
->SetVoid(NULL
);
180 newInstance
->InternalFinalConstructAddRef();
181 hResult
= newInstance
->_AtlInitialConstruct();
182 if (SUCCEEDED(hResult
))
183 hResult
= newInstance
->FinalConstruct();
184 if (SUCCEEDED(hResult
))
185 hResult
= newInstance
->_AtlFinalConstruct();
186 newInstance
->InternalFinalConstructRelease();
198 WINE_DEFAULT_DEBUG_CHANNEL(browseui
);
200 #endif /* _BROWSEUI_PCH_ */