[WIN32 DLLS]
[reactos.git] / dll / win32 / ole32 / moniker.c
index 4e56462..f4321bb 100644 (file)
@@ -93,7 +93,7 @@ typedef struct EnumMonikerImpl
 
 
 /* IEnumMoniker Local functions*/
-static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
+static HRESULT EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
     ULONG pos, IEnumMoniker **ppenumMoniker);
 
 static IrotHandle get_irot_handle(void)
@@ -124,30 +124,21 @@ static BOOL start_rpcss(void)
 {
     PROCESS_INFORMATION pi;
     STARTUPINFOW si;
-    static WCHAR cmd[6];
-    static const WCHAR rpcss[] = {'r','p','c','s','s',0};
+    WCHAR cmd[MAX_PATH];
+    static const WCHAR rpcss[] = {'\\','r','p','c','s','s','.','e','x','e',0};
     BOOL rslt;
+    void *redir;
 
     TRACE("\n");
 
-    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
     ZeroMemory(&si, sizeof(STARTUPINFOA));
     si.cb = sizeof(STARTUPINFOA);
+    GetSystemDirectoryW( cmd, MAX_PATH - sizeof(rpcss)/sizeof(WCHAR) );
+    strcatW( cmd, rpcss );
 
-    memcpy(cmd, rpcss, sizeof(rpcss));
-
-    rslt = CreateProcessW(
-                          NULL,           /* executable */
-                          cmd,            /* command line */
-                          NULL,           /* process security attributes */
-                          NULL,           /* primary thread security attributes */
-                          FALSE,          /* inherit handles */
-                          0,              /* creation flags */
-                          NULL,           /* use parent's environment */
-                          NULL,           /* use parent's current directory */
-                          &si,            /* STARTUPINFO pointer */
-                          &pi             /* PROCESS_INFORMATION */
-                          );
+    Wow64DisableWow64FsRedirection( &redir );
+    rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
+    Wow64RevertWow64FsRedirection( redir );
 
     if (rslt)
     {
@@ -316,7 +307,7 @@ RunningObjectTableImpl_QueryInterface(IRunningObjectTable* iface,
 
     if (IsEqualIID(&IID_IUnknown, riid) ||
         IsEqualIID(&IID_IRunningObjectTable, riid))
-        *ppvObject = (IRunningObjectTable*)This;
+        *ppvObject = This;
 
     if ((*ppvObject)==0)
         return E_NOINTERFACE;
@@ -340,9 +331,9 @@ RunningObjectTableImpl_AddRef(IRunningObjectTable* iface)
 }
 
 /***********************************************************************
- *        RunningObjectTable_Initialize
+ *        RunningObjectTable_Destroy
  */
-static HRESULT WINAPI
+static HRESULT
 RunningObjectTableImpl_Destroy(void)
 {
     struct list *cursor, *cursor2;
@@ -414,7 +405,7 @@ RunningObjectTableImpl_Release(IRunningObjectTable* iface)
  * grfFlags       [in] Registration options 
  * punkObject     [in] the object being registered
  * pmkObjectName  [in] the moniker of the object being registered
- * pdwRegister    [in] the value identifying the registration
+ * pdwRegister    [out] the value identifying the registration
  */
 static HRESULT WINAPI
 RunningObjectTableImpl_Register(IRunningObjectTable* iface, DWORD grfFlags,
@@ -1118,7 +1109,13 @@ HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName,
 
     TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(szDisplayName), pchEaten, ppmk);
 
-    if (!(IsValidInterface((LPUNKNOWN) pbc)))
+    if (!pbc || !IsValidInterface((LPUNKNOWN) pbc))
+        return E_INVALIDARG;
+
+    if (!szDisplayName || !*szDisplayName)
+        return E_INVALIDARG;
+
+    if (!pchEaten || !ppmk)
         return E_INVALIDARG;
 
     *pchEaten = 0;
@@ -1291,10 +1288,10 @@ static HRESULT WINAPI EnumMonikerImpl_QueryInterface(IEnumMoniker* iface,REFIID
     *ppvObject = NULL;
 
     if (IsEqualIID(&IID_IUnknown, riid))
-        *ppvObject = (IEnumMoniker*)This;
+        *ppvObject = This;
     else
         if (IsEqualIID(&IID_IEnumMoniker, riid))
-            *ppvObject = (IEnumMoniker*)This;
+            *ppvObject = This;
 
     if ((*ppvObject)==NULL)
         return E_NOINTERFACE;
@@ -1344,7 +1341,7 @@ static ULONG   WINAPI EnumMonikerImpl_Release(IEnumMoniker* iface)
     return ref;
 }
 /***********************************************************************
- *        EnmumMoniker_Next
+ *        EnumMoniker_Next
  */
 static HRESULT   WINAPI EnumMonikerImpl_Next(IEnumMoniker* iface, ULONG celt, IMoniker** rgelt, ULONG * pceltFetched)
 {
@@ -1379,7 +1376,7 @@ static HRESULT   WINAPI EnumMonikerImpl_Next(IEnumMoniker* iface, ULONG celt, IM
 }
 
 /***********************************************************************
- *        EnmumMoniker_Skip
+ *        EnumMoniker_Skip
  */
 static HRESULT   WINAPI EnumMonikerImpl_Skip(IEnumMoniker* iface, ULONG celt)
 {
@@ -1396,7 +1393,7 @@ static HRESULT   WINAPI EnumMonikerImpl_Skip(IEnumMoniker* iface, ULONG celt)
 }
 
 /***********************************************************************
- *        EnmumMoniker_Reset
+ *        EnumMoniker_Reset
  */
 static HRESULT   WINAPI EnumMonikerImpl_Reset(IEnumMoniker* iface)
 {
@@ -1410,7 +1407,7 @@ static HRESULT   WINAPI EnumMonikerImpl_Reset(IEnumMoniker* iface)
 }
 
 /***********************************************************************
- *        EnmumMoniker_Clone
+ *        EnumMoniker_Clone
  */
 static HRESULT   WINAPI EnumMonikerImpl_Clone(IEnumMoniker* iface, IEnumMoniker ** ppenum)
 {
@@ -1463,7 +1460,7 @@ static const IEnumMonikerVtbl VT_EnumMonikerImpl =
  *        Used by EnumRunning to create the structure and EnumClone
  *       to copy the structure
  */
-static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
+static HRESULT EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
                                                  ULONG current_pos,
                                                  IEnumMoniker **ppenumMoniker)
 {