ReactOS 0.4.16-dev-942-g91fadeb
utility.h File Reference

Go to the source code of this file.

Functions

EXTERN_C HRESULT SHELL_GetIDListFromObject (IUnknown *punk, PIDLIST_ABSOLUTE *ppidl)
 
EXTERN_C BOOL SHELL_IsEqualAbsoluteID (PCIDLIST_ABSOLUTE a, PCIDLIST_ABSOLUTE b)
 
EXTERN_C BOOL SHELL_IsVerb (IContextMenu *pcm, UINT_PTR idCmd, LPCWSTR Verb)
 
EXTERN_C VOID SHELL_RemoveVerb (IContextMenu *pcm, UINT idCmdFirst, HMENU hMenu, LPCWSTR Verb)
 
EXTERN_C BOOL _ILIsDesktop (LPCITEMIDLIST pidl)
 

Function Documentation

◆ _ILIsDesktop()

EXTERN_C BOOL _ILIsDesktop ( LPCITEMIDLIST  pidl)
inline

Definition at line 24 of file CBandSite.h.

25{
26 return (pidl == NULL || pidl->mkid.cb == 0);
27}
#define NULL
Definition: types.h:112

◆ SHELL_GetIDListFromObject()

EXTERN_C HRESULT SHELL_GetIDListFromObject ( IUnknown punk,
PIDLIST_ABSOLUTE ppidl 
)

Definition at line 36 of file utility.cpp.

37{
38#if DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA && 0 // FIXME: SHELL32 not ready yet
39 return SHGetIDListFromObject(punk, ppidl);
40#else
41 HRESULT hr;
42 IPersistFolder2 *pf2;
44 {
45 hr = pf2->GetCurFolder(ppidl);
46 pf2->Release();
47 }
48 IPersistIDList *pil;
50 {
51 hr = pil->GetIDList(ppidl);
52 pil->Release();
53 }
54 return hr;
55#endif
56}
HRESULT GetCurFolder([out] PIDLIST_ABSOLUTE *ppidl)
HRESULT GetIDList([out] PIDLIST_ABSOLUTE *ppidl)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT WINAPI SHGetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE *ppidl)
Definition: pidl.c:1638
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)

Referenced by SHDOCVW_GetCurrentLocationFromView().

◆ SHELL_IsEqualAbsoluteID()

EXTERN_C BOOL SHELL_IsEqualAbsoluteID ( PCIDLIST_ABSOLUTE  a,
PCIDLIST_ABSOLUTE  b 
)

Definition at line 70 of file utility.cpp.

71{
73}
#define SHCIDS_CANONICALONLY
Definition: shobjidl.idl:226
static HRESULT SHELL_CompareAbsoluteIDs(LPARAM lParam, PCIDLIST_ABSOLUTE a, PCIDLIST_ABSOLUTE b)
Definition: utility.cpp:58
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

◆ SHELL_IsVerb()

EXTERN_C BOOL SHELL_IsVerb ( IContextMenu pcm,
UINT_PTR  idCmd,
LPCWSTR  Verb 
)

Definition at line 76 of file utility.cpp.

77{
78 HRESULT hr;
79 WCHAR wide[MAX_PATH];
80 if (SUCCEEDED(hr = pcm->GetCommandString(idCmd, GCS_VERBW, NULL, (LPSTR)wide, _countof(wide))))
81 return !lstrcmpiW(wide, Verb);
82
83 CHAR ansi[_countof(wide)], buf[MAX_PATH];
85 {
86 if (SUCCEEDED(hr = pcm->GetCommandString(idCmd, GCS_VERBA, NULL, ansi, _countof(ansi))))
87 return !lstrcmpiA(ansi, buf);
88 }
89 return FALSE;
90}
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4224
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
Definition: string.c:2797
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
HRESULT GetCommandString([in] UINT_PTR idCmd, [in] UINT uType, [out] UINT *pwReserved, [out, size_is(cchMax)] LPSTR pszName, [in] UINT cchMax)
#define _countof(array)
Definition: sndvol32.h:70
static UINT WPARAM LPARAM BOOL ansi
Definition: misc.c:135
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175

Referenced by SHELL_FindVerbPos().

◆ SHELL_RemoveVerb()

EXTERN_C VOID SHELL_RemoveVerb ( IContextMenu pcm,
UINT  idCmdFirst,
HMENU  hMenu,
LPCWSTR  Verb 
)

Definition at line 105 of file utility.cpp.

106{
107 int nPos = SHELL_FindVerbPos(pcm, idCmdFirst, hMenu, Verb);
108 if (nPos < 0)
109 return;
110 int nCount = GetMenuItemCount(hMenu);
111 BOOL bSepBefore = nPos && IsMenuSeparator(hMenu, nPos - 1);
112 BOOL bSepAfter = IsMenuSeparator(hMenu, nPos + 1);
113 if (DeleteMenu(hMenu, nPos, MF_BYPOSITION))
114 {
115 if ((bSepBefore && bSepAfter) || (bSepAfter && nPos == 0))
116 DeleteMenu(hMenu, nPos, MF_BYPOSITION);
117 else if (bSepBefore && nPos + 1 == nCount)
118 DeleteMenu(hMenu, nPos - 1, MF_BYPOSITION);
119 }
120}
static BOOL IsMenuSeparator(HMENU hMenu, UINT Pos)
Definition: utility.cpp:26
static int SHELL_FindVerbPos(IContextMenu *pcm, UINT idCmdFirst, HMENU hMenu, LPCWSTR Verb)
Definition: utility.cpp:93
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_BYPOSITION
Definition: winuser.h:203