[RSHELL]
[reactos.git] / include / reactos / undocshell.h
index 2dee756..da8b18b 100644 (file)
@@ -83,7 +83,8 @@ BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
 #define RFF_NOLABEL        0x08
 #define RFF_NOSEPARATEMEM  0x20  /* NT only */
 
-#define DE_SAMEFILE 0x71
+#define DE_SAMEFILE     0x71
+#define DE_DESTSAMETREE 0x7D
 
 /* RunFileFlg notification structure */
 typedef struct
@@ -533,7 +534,7 @@ BOOL WINAPI SHDesktopMessageLoop(HANDLE);
 #include <stdio.h>
 
 #define SMC_EXEC 4
-extern "C" INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc);
+INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc);
 
 static inline ULONG
 Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
@@ -574,13 +575,14 @@ Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
 static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel)
 {
     WCHAR label[128];
+    int i;
+    int count = GetMenuItemCount(hmenu);
 
     padding[padlevel] = '.';
     padding[padlevel + 1] = '.';
     padding[padlevel + 2] = 0;
 
-    int count = GetMenuItemCount(hmenu);
-    for (int i = 0; i < count; i++)
+    for (i = 0; i < count; i++)
     {
         MENUITEMINFOW mii = { 0 };
 
@@ -821,6 +823,29 @@ HRESULT inline ShellObjectCreatorInit(REFIID riid, void ** ppv)
     return S_OK;
 }
 
+template<class T, class T1>
+HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, void ** ppv)
+{
+    CComPtr<T>  obj;
+    HRESULT     hResult;
+
+    if (ppv == NULL)
+        return E_POINTER;
+    *ppv = NULL;
+    ATLTRY(obj = new _CComObject<T>);
+    if (obj.p == NULL)
+        return E_OUTOFMEMORY;
+    hResult = obj->QueryInterface(riid, ppv);
+    if (FAILED(hResult))
+        return hResult;
+
+    hResult = obj->Initialize(initArg1);
+    if (FAILED(hResult))
+        return hResult;
+
+    return S_OK;
+}
+
 template<class T, class T1, class R>
 HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, R ** ppv)
 {
@@ -924,6 +949,32 @@ HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4
 
     return S_OK;
 }
+
+template<class T, class T1, class T2, class T3, class T4, class T5, class R>
+HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, T5 initArg5, REFIID riid, R ** ppv)
+{
+    CComPtr<T>  obj;
+    CComPtr<R>  result;
+    HRESULT     hResult;
+
+    if (ppv == NULL)
+        return E_POINTER;
+    *ppv = NULL;
+    ATLTRY(obj = new _CComObject<T>);
+    if (obj.p == NULL)
+        return E_OUTOFMEMORY;
+    hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(&result));
+    if (FAILED(hResult))
+        return hResult;
+
+    hResult = obj->Initialize(initArg1, initArg2, initArg3, initArg4, initArg5);
+    if (FAILED(hResult))
+        return hResult;
+
+    *ppv = result.Detach();
+
+    return S_OK;
+}
 #endif /* __cplusplus */
 
 #endif /* __WINE_UNDOCSHELL_H */