ReactOS  0.4.14-dev-815-ge410a12
CExtractIcon Class Reference
Inheritance diagram for CExtractIcon:
Collaboration diagram for CExtractIcon:

Public Member Functions

 CExtractIcon ()
 
 ~CExtractIcon ()
 
virtual HRESULT STDMETHODCALLTYPE SetDefaultIcon (LPCWSTR pszFile, int iIcon)
 
virtual HRESULT STDMETHODCALLTYPE SetFlags (UINT uFlags)
 
virtual HRESULT STDMETHODCALLTYPE SetKey (HKEY hkey)
 
virtual HRESULT STDMETHODCALLTYPE SetNormalIcon (LPCWSTR pszFile, int iIcon)
 
virtual HRESULT STDMETHODCALLTYPE SetOpenIcon (LPCWSTR pszFile, int iIcon)
 
virtual HRESULT STDMETHODCALLTYPE SetShortcutIcon (LPCWSTR pszFile, int iIcon)
 
virtual HRESULT STDMETHODCALLTYPE GetIconLocation (UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
 
virtual HRESULT STDMETHODCALLTYPE Extract (LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
 
virtual HRESULT STDMETHODCALLTYPE GetIconLocation (UINT uFlags, LPSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
 
virtual HRESULT STDMETHODCALLTYPE Extract (LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
 
virtual HRESULT STDMETHODCALLTYPE GetClassID (CLSID *pClassID)
 
virtual HRESULT STDMETHODCALLTYPE IsDirty ()
 
virtual HRESULT STDMETHODCALLTYPE Load (LPCOLESTR pszFileName, DWORD dwMode)
 
virtual HRESULT STDMETHODCALLTYPE Save (LPCOLESTR pszFileName, BOOL fRemember)
 
virtual HRESULT STDMETHODCALLTYPE SaveCompleted (LPCOLESTR pszFileName)
 
virtual HRESULT STDMETHODCALLTYPE GetCurFile (LPOLESTR *ppszFileName)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from IExtractIconW
HRESULT GetIconLocation ([in] UINT uFlags, [out, size_is(cchMax)] LPWSTR szIconFile, [in] UINT cchMax, [out] INT *piIndex, [out] UINT *pwFlags)
 
- Public Member Functions inherited from IExtractIconA
HRESULT GetIconLocation ([in] UINT uFlags, [out, size_is(cchMax)] LPSTR szIconFile, [in] UINT cchMax, [out] INT *piIndex, [out] UINT *pwFlags)
 

Private Attributes

UINT flags
 
struct IconLocation defaultIcon
 
struct IconLocation normalIcon
 
struct IconLocation openIcon
 
struct IconLocation shortcutIcon
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IExtractIconW
typedef IExtractIconWLPEXTRACTICONW
 
- Public Types inherited from IPersistFile
typedef IPersistFileLPPERSISTFILE
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from IExtractIconA
GIL_DONTCACHE typedef IExtractIconALPEXTRACTICONA
 

Detailed Description

Definition at line 20 of file CExtractIcon.cpp.

Constructor & Destructor Documentation

◆ CExtractIcon()

CExtractIcon::CExtractIcon ( )

Definition at line 88 of file CExtractIcon.cpp.

89 {
90  flags = 0;
91  memset(&defaultIcon, 0, sizeof(defaultIcon));
92  memset(&normalIcon, 0, sizeof(normalIcon));
93  memset(&openIcon, 0, sizeof(openIcon));
94  memset(&shortcutIcon, 0, sizeof(shortcutIcon));
95 }
struct IconLocation defaultIcon
struct IconLocation shortcutIcon
GLbitfield flags
Definition: glext.h:7161
struct IconLocation normalIcon
struct IconLocation openIcon
#define memset(x, y, z)
Definition: compat.h:39

◆ ~CExtractIcon()

CExtractIcon::~CExtractIcon ( )

Definition at line 97 of file CExtractIcon.cpp.

98 {
99  if (defaultIcon.file) CoTaskMemFree(defaultIcon.file);
100  if (normalIcon.file) CoTaskMemFree(normalIcon.file);
101  if (openIcon.file) CoTaskMemFree(openIcon.file);
102  if (shortcutIcon.file) CoTaskMemFree(shortcutIcon.file);
103 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
struct IconLocation defaultIcon
struct IconLocation shortcutIcon
struct IconLocation normalIcon
struct IconLocation openIcon

Member Function Documentation

◆ Extract() [1/2]

HRESULT STDMETHODCALLTYPE CExtractIcon::Extract ( LPCWSTR  pszFile,
UINT  nIconIndex,
HICON phiconLarge,
HICON phiconSmall,
UINT  nIconSize 
)
virtual

Implements IExtractIconW.

Definition at line 210 of file CExtractIcon.cpp.

216 {
217  TRACE("(%p, %s, %u, %p, %p, %u)\n", this, debugstr_w(pszFile), nIconIndex, phiconLarge, phiconSmall, nIconSize);
218 
219  /* Nothing to do, ExtractIconW::GetIconLocation should be enough */
220  return S_FALSE;
221 }
#define debugstr_w
Definition: kernel32.h:32
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by Extract().

◆ Extract() [2/2]

HRESULT STDMETHODCALLTYPE CExtractIcon::Extract ( LPCSTR  pszFile,
UINT  nIconIndex,
HICON phiconLarge,
HICON phiconSmall,
UINT  nIconSize 
)
virtual

Implements IExtractIconA.

Definition at line 250 of file CExtractIcon.cpp.

256 {
257  LPWSTR pszFileW = NULL;
258  HRESULT hr;
259 
260  if (pszFile)
261  {
262  int nLength;
263 
264  nLength = MultiByteToWideChar(CP_ACP, 0, pszFile, -1, NULL, 0);
265  if (nLength == 0)
266  return E_FAIL;
267  pszFileW = (LPWSTR)CoTaskMemAlloc(nLength * sizeof(WCHAR));
268  if (!pszFileW)
269  return E_OUTOFMEMORY;
270  if (!MultiByteToWideChar(CP_ACP, 0, pszFile, nLength, pszFileW, nLength))
271  {
272  CoTaskMemFree(pszFileW);
273  return E_FAIL;
274  }
275  }
276 
277  hr = Extract(pszFileW, nIconIndex, phiconLarge, phiconSmall, nIconSize);
278 
279  if (pszFileW)
280  CoTaskMemFree(pszFileW);
281  return hr;
282 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
virtual HRESULT STDMETHODCALLTYPE Extract(LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
#define CP_ACP
Definition: compat.h:99
_In_ DWORD nLength
Definition: wincon.h:461
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

◆ GetClassID()

HRESULT STDMETHODCALLTYPE CExtractIcon::GetClassID ( CLSID pClassID)
virtual

Implements IPersist.

Definition at line 284 of file CExtractIcon.cpp.

286 {
287  TRACE("(%p, %p)\n", this, pClassID);
288 
289  if (!pClassID)
290  return E_POINTER;
291 
292  *pClassID = GUID_NULL;
293  return S_OK;
294 }
#define TRACE(s)
Definition: solgame.cpp:4
#define GUID_NULL
Definition: ks.h:106
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ GetCurFile()

HRESULT STDMETHODCALLTYPE CExtractIcon::GetCurFile ( LPOLESTR ppszFileName)
virtual

Implements IPersistFile.

Definition at line 329 of file CExtractIcon.cpp.

331 {
332  FIXME("(%p, %p)\n", this, ppszFileName);
334  return E_NOTIMPL;
335 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ GetIconLocation() [1/2]

HRESULT STDMETHODCALLTYPE CExtractIcon::GetIconLocation ( UINT  uFlags,
LPWSTR  szIconFile,
UINT  cchMax,
int piIndex,
UINT pwFlags 
)
virtual

Definition at line 174 of file CExtractIcon.cpp.

180 {
181  const struct IconLocation *icon = NULL;
182  SIZE_T cb;
183 
184  TRACE("(%p, 0x%x, %s, 0x%x, %p, %p)\n", this, uFlags, debugstr_w(szIconFile), cchMax, piIndex, pwFlags);
185 
186  if (!piIndex || !pwFlags)
187  return E_POINTER;
188 
189  if (uFlags & GIL_DEFAULTICON)
190  icon = defaultIcon.file ? &defaultIcon : &normalIcon;
191  else if (uFlags & GIL_FORSHORTCUT)
192  icon = shortcutIcon.file ? &shortcutIcon : &normalIcon;
193  else if (uFlags & GIL_OPENICON)
194  icon = openIcon.file ? &openIcon : &normalIcon;
195  else
196  icon = &normalIcon;
197 
198  if (!icon->file)
199  return E_FAIL;
200 
201  cb = wcslen(icon->file) + 1;
202  if (cchMax < (UINT)cb)
203  return E_FAIL;
204  CopyMemory(szIconFile, icon->file, cb * sizeof(WCHAR));
205  *piIndex = icon->index;
206  *pwFlags = flags;
207  return S_OK;
208 }
struct IconLocation defaultIcon
UINT uFlags
Definition: api.c:59
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
struct IconLocation shortcutIcon
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1640
UINT cchMax
struct IconLocation normalIcon
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
struct IconLocation openIcon
#define E_POINTER
Definition: winerror.h:2365
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by GetIconLocation().

◆ GetIconLocation() [2/2]

HRESULT STDMETHODCALLTYPE CExtractIcon::GetIconLocation ( UINT  uFlags,
LPSTR  szIconFile,
UINT  cchMax,
int piIndex,
UINT pwFlags 
)
virtual

Definition at line 223 of file CExtractIcon.cpp.

229 {
230  LPWSTR szIconFileW = NULL;
231  HRESULT hr;
232 
233  if (cchMax > 0)
234  {
235  szIconFileW = (LPWSTR)CoTaskMemAlloc(cchMax * sizeof(WCHAR));
236  if (!szIconFileW)
237  return E_OUTOFMEMORY;
238  }
239 
240  hr = GetIconLocation(uFlags, szIconFileW, cchMax, piIndex, pwFlags);
241  if (SUCCEEDED(hr) && cchMax > 0)
242  if (0 == WideCharToMultiByte(CP_ACP, 0, szIconFileW, cchMax, szIconFile, cchMax, NULL, NULL))
243  hr = E_FAIL;
244 
245  if (szIconFileW)
246  CoTaskMemFree(szIconFileW);
247  return hr;
248 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
UINT uFlags
Definition: api.c:59
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
virtual HRESULT STDMETHODCALLTYPE GetIconLocation(UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IsDirty()

HRESULT STDMETHODCALLTYPE CExtractIcon::IsDirty ( void  )
virtual

Implements IPersistFile.

Definition at line 296 of file CExtractIcon.cpp.

297 {
298  FIXME("(%p)\n", this);
300  return E_NOTIMPL;
301 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ Load()

HRESULT STDMETHODCALLTYPE CExtractIcon::Load ( LPCOLESTR  pszFileName,
DWORD  dwMode 
)
virtual

Implements IPersistFile.

Definition at line 303 of file CExtractIcon.cpp.

306 {
307  FIXME("(%p, %s, %u)\n", this, debugstr_w(pszFileName), dwMode);
309  return E_NOTIMPL;
310 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ Save()

HRESULT STDMETHODCALLTYPE CExtractIcon::Save ( LPCOLESTR  pszFileName,
BOOL  fRemember 
)
virtual

Implements IPersistFile.

Definition at line 312 of file CExtractIcon.cpp.

315 {
316  FIXME("(%p, %s, %d)\n", this, debugstr_w(pszFileName), fRemember);
318  return E_NOTIMPL;
319 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ SaveCompleted()

HRESULT STDMETHODCALLTYPE CExtractIcon::SaveCompleted ( LPCOLESTR  pszFileName)
virtual

Implements IPersistFile.

Definition at line 321 of file CExtractIcon.cpp.

323 {
324  FIXME("(%p, %s)\n", this, debugstr_w(pszFileName));
326  return E_NOTIMPL;
327 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ SetDefaultIcon()

HRESULT STDMETHODCALLTYPE CExtractIcon::SetDefaultIcon ( LPCWSTR  pszFile,
int  iIcon 
)
virtual

Implements IDefaultExtractIconInit.

Definition at line 105 of file CExtractIcon.cpp.

108 {
109  TRACE("(%p, %s, %d)\n", this, debugstr_w(pszFile), iIcon);
110 
111  DuplicateString(pszFile, &defaultIcon.file);
112  if (!defaultIcon.file)
113  return E_OUTOFMEMORY;
114  defaultIcon.index = iIcon;
115  return S_OK;
116 }
struct IconLocation defaultIcon
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
VOID DuplicateString(LPCWSTR Source, LPWSTR *Destination)
#define S_OK
Definition: intsafe.h:59

◆ SetFlags()

HRESULT STDMETHODCALLTYPE CExtractIcon::SetFlags ( UINT  uFlags)
virtual

Implements IDefaultExtractIconInit.

Definition at line 118 of file CExtractIcon.cpp.

120 {
121  TRACE("(%p, 0x%x)\n", this, uFlags);
122 
123  flags = uFlags;
124  return S_OK;
125 }
UINT uFlags
Definition: api.c:59
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:59

◆ SetKey()

HRESULT STDMETHODCALLTYPE CExtractIcon::SetKey ( HKEY  hkey)
virtual

Implements IDefaultExtractIconInit.

Definition at line 127 of file CExtractIcon.cpp.

129 {
130  FIXME("(%p, %p)\n", this, hkey);
132  return E_NOTIMPL;
133 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:114

◆ SetNormalIcon()

HRESULT STDMETHODCALLTYPE CExtractIcon::SetNormalIcon ( LPCWSTR  pszFile,
int  iIcon 
)
virtual

Implements IDefaultExtractIconInit.

Definition at line 135 of file CExtractIcon.cpp.

138 {
139  TRACE("(%p, %s, %d)\n", this, debugstr_w(pszFile), iIcon);
140 
141  DuplicateString(pszFile, &normalIcon.file);
142  if (!normalIcon.file)
143  return E_OUTOFMEMORY;
144  normalIcon.index = iIcon;
145  return S_OK;
146 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
struct IconLocation normalIcon
VOID DuplicateString(LPCWSTR Source, LPWSTR *Destination)
#define S_OK
Definition: intsafe.h:59

◆ SetOpenIcon()

HRESULT STDMETHODCALLTYPE CExtractIcon::SetOpenIcon ( LPCWSTR  pszFile,
int  iIcon 
)
virtual

Implements IDefaultExtractIconInit.

Definition at line 148 of file CExtractIcon.cpp.

151 {
152  TRACE("(%p, %s, %d)\n", this, debugstr_w(pszFile), iIcon);
153 
154  DuplicateString(pszFile, &openIcon.file);
155  if (!openIcon.file)
156  return E_OUTOFMEMORY;
157  openIcon.index = iIcon;
158  return S_OK;
159 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
VOID DuplicateString(LPCWSTR Source, LPWSTR *Destination)
#define S_OK
Definition: intsafe.h:59
struct IconLocation openIcon

◆ SetShortcutIcon()

HRESULT STDMETHODCALLTYPE CExtractIcon::SetShortcutIcon ( LPCWSTR  pszFile,
int  iIcon 
)
virtual

Implements IDefaultExtractIconInit.

Definition at line 161 of file CExtractIcon.cpp.

164 {
165  TRACE("(%p, %s, %d)\n", this, debugstr_w(pszFile), iIcon);
166 
167  DuplicateString(pszFile, &shortcutIcon.file);
168  if (!shortcutIcon.file)
169  return E_OUTOFMEMORY;
170  shortcutIcon.index = iIcon;
171  return S_OK;
172 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
struct IconLocation shortcutIcon
#define TRACE(s)
Definition: solgame.cpp:4
VOID DuplicateString(LPCWSTR Source, LPWSTR *Destination)
#define S_OK
Definition: intsafe.h:59

Member Data Documentation

◆ defaultIcon

struct IconLocation CExtractIcon::defaultIcon
private

Definition at line 29 of file CExtractIcon.cpp.

Referenced by CExtractIcon(), GetIconLocation(), SetDefaultIcon(), and ~CExtractIcon().

◆ flags

UINT CExtractIcon::flags
private

Definition at line 28 of file CExtractIcon.cpp.

Referenced by GetIconLocation().

◆ normalIcon

struct IconLocation CExtractIcon::normalIcon
private

Definition at line 30 of file CExtractIcon.cpp.

Referenced by CExtractIcon(), GetIconLocation(), SetNormalIcon(), and ~CExtractIcon().

◆ openIcon

struct IconLocation CExtractIcon::openIcon
private

Definition at line 31 of file CExtractIcon.cpp.

Referenced by CExtractIcon(), GetIconLocation(), SetOpenIcon(), and ~CExtractIcon().

◆ shortcutIcon

struct IconLocation CExtractIcon::shortcutIcon
private

Definition at line 32 of file CExtractIcon.cpp.

Referenced by CExtractIcon(), GetIconLocation(), SetShortcutIcon(), and ~CExtractIcon().


The documentation for this class was generated from the following file: