[PATCH 22/27] [Kernel32]: ActCtx: implemented QueryActCtxW for

Eric Pouech eric.pouech at wanadoo.fr
Sat Apr 28 07:23:06 CDT 2007


ActivationContextDetailedInformation

A+
---

 dlls/kernel32/actctx.c |   93 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 88 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/actctx.c b/dlls/kernel32/actctx.c
index 088529e..d9fe47f 100644
--- a/dlls/kernel32/actctx.c
+++ b/dlls/kernel32/actctx.c
@@ -1895,9 +1895,92 @@ BOOL WINAPI QueryActCtxW(DWORD dwFlags, 
                          ULONG ulClass, PVOID pvBuff, SIZE_T cbBuff,
                          SIZE_T *pcbLen)
 {
-  FIXME("%08x %p %p %u %p %ld %p\n", dwFlags, hActCtx,
-       pvSubInst, ulClass, pvBuff, cbBuff, pcbLen);
-  /* this makes Adobe Photoshop 7.0 happy */
-  SetLastError( ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
+    struct actctx*      actctx;
+
+    TRACE("%08x %p %p %u %p %ld %p\n", dwFlags, hActCtx,
+          pvSubInst, ulClass, pvBuff, cbBuff, pcbLen);
+
+    switch (dwFlags)
+    {
+    case 0: break;
+    case QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX:
+ 	if (!GetCurrentActCtx(&hActCtx)) return FALSE;
+        break;
+    case QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE:
+        /* FIXME: should look up module as hModule of (HMODULE)hActCtx */
+    case QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS:
+        /* FIXME: should look up module as address of (ULONG)hActCtx */
+        FIXME("Cannot do it on a given module\n");
+        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+        return FALSE;
+    }
+    if (!(actctx = check_actctx(hActCtx)))
+        return FALSE;
+
+    switch (ulClass)
+    {
+    case ActivationContextBasicInformation:
+        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+        return FALSE;
+    case ActivationContextDetailedInformation:
+        {
+            ACTIVATION_CONTEXT_DETAILED_INFORMATION*    acdi = pvBuff;
+            struct assembly*    assembly = NULL;
+            unsigned            len, manifest_len = 0, config_len = 0, app_len = 0;
+            LPWSTR              ptr;
+
+            if (actctx->num_assemblies > 1) assembly = &actctx->assemblies[1];
+
+            if (assembly && assembly->manifest.info)
+                manifest_len = strlenW(assembly->manifest.info) + 1;
+            if (actctx->config.info)   config_len   = strlenW(actctx->config.info) + 1;
+            if (actctx->app.info)      app_len      = strlenW(actctx->app.info) + 1;
+            len = sizeof(*acdi) +
+                (manifest_len + config_len + app_len) * sizeof(WCHAR);
+
+            if (pcbLen) *pcbLen = len;
+
+            if (!pvBuff || cbBuff < len)
+            {
+                SetLastError(ERROR_INSUFFICIENT_BUFFER);
+                return FALSE;
+            }
+            acdi->dwFlags = 0;
+            acdi->ulFormatVersion = assembly ? 1 : 0; /* FIXME */
+            acdi->ulAssemblyCount = actctx->num_assemblies - 1;
+            acdi->ulRootManifestPathType = assembly ? assembly->manifest.type : 0 /* FIXME */;
+            acdi->ulRootManifestPathChars = assembly && assembly->manifest.info ? manifest_len - 1 : 0;
+            acdi->ulRootConfigurationPathType = actctx->config.type;
+            acdi->ulRootConfigurationPathChars = actctx->config.info ? config_len - 1 : 0;
+            acdi->ulAppDirPathType = actctx->app.type;
+            acdi->ulAppDirPathChars = actctx->app.info ? app_len - 1 : 0;
+            ptr = (LPWSTR)(acdi + 1);
+            if (manifest_len)
+            {
+                acdi->lpRootManifestPath = ptr;
+                memcpy(ptr, assembly->manifest.info, manifest_len * sizeof(WCHAR));
+                ptr += manifest_len;
+            }
+            else acdi->lpRootManifestPath = NULL;
+            if (config_len)
+            {
+                acdi->lpRootConfigurationPath = ptr;
+                memcpy(ptr, actctx->config.info, config_len * sizeof(WCHAR));
+                ptr += config_len;
+            }
+            else acdi->lpRootConfigurationPath = NULL;
+            if (app_len)
+            {
+                acdi->lpAppDirPath = ptr;
+                memcpy(ptr, actctx->app.info, app_len * sizeof(WCHAR));
+            }
+            else acdi->lpAppDirPath = NULL;
+        }
+        break;
+    case AssemblyDetailedInformationInActivationContext:
+    case FileInformationInAssemblyOfAssemblyInActivationContext:
+        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+        return FALSE;
+    }
+    return TRUE;
 }




More information about the wine-patches mailing list