Zhangrong Huang : secur32: Allow loading external schannel.dll.

Alexandre Julliard julliard at winehq.org
Thu Jul 3 06:35:48 CDT 2008


Module: wine
Branch: master
Commit: d42a601b52a17280ae2bf5501e857861f5458119
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d42a601b52a17280ae2bf5501e857861f5458119

Author: Zhangrong Huang <hzhrong at gmail.com>
Date:   Wed Jul  2 23:18:49 2008 +0800

secur32: Allow loading external schannel.dll.

---

 dlls/secur32/schannel.c     |    3 ++-
 dlls/secur32/secur32.c      |   25 +++++++++++++++++++------
 dlls/secur32/secur32_priv.h |    3 ++-
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index 742cdb3..43b0f26 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -358,11 +358,12 @@ static const SecurityFunctionTableW schanTableW = {
 
 static const WCHAR schannelComment[] = { 'S','c','h','a','n','n','e','l',' ',
  'S','e','c','u','r','i','t','y',' ','P','a','c','k','a','g','e',0 };
+static const WCHAR schannelDllName[] = { 's','c','h','a','n','n','e','l','.','d','l','l',0 };
 
 void SECUR32_initSchannelSP(void)
 {
     SecureProvider *provider = SECUR32_addProvider(&schanTableA, &schanTableW,
-     NULL);
+     schannelDllName);
 
     if (provider)
     {
diff --git a/dlls/secur32/secur32.c b/dlls/secur32/secur32.c
index 5eb4bcd..b9c4748 100644
--- a/dlls/secur32/secur32.c
+++ b/dlls/secur32/secur32.c
@@ -419,10 +419,10 @@ SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA,
 
     if (fnTableA || fnTableW)
     {
-        ret->moduleName = NULL;
+        ret->moduleName = moduleName ? SECUR32_strdupW(moduleName) : NULL;
         _makeFnTableA(&ret->fnTableA, fnTableA, fnTableW);
         _makeFnTableW(&ret->fnTableW, fnTableA, fnTableW);
-        ret->loaded = TRUE;
+        ret->loaded = moduleName ? FALSE : TRUE;
     }
     else
     {
@@ -505,9 +505,19 @@ static void _tryLoadProvider(PWSTR moduleName)
             if (pInitSecurityInterfaceW)
                 fnTableW = pInitSecurityInterfaceW();
             if (fnTableW && fnTableW->EnumerateSecurityPackagesW)
-                ret = fnTableW->EnumerateSecurityPackagesW(&toAdd, &infoW);
+            {
+                if (fnTableW != &securityFunctionTableW)
+                    ret = fnTableW->EnumerateSecurityPackagesW(&toAdd, &infoW);
+                else
+                    TRACE("%s has built-in providers, skip adding\n", debugstr_w(moduleName));
+            }
             else if (fnTableA && fnTableA->EnumerateSecurityPackagesA)
-                ret = fnTableA->EnumerateSecurityPackagesA(&toAdd, &infoA);
+            {
+                if (fnTableA != &securityFunctionTableA)
+                    ret = fnTableA->EnumerateSecurityPackagesA(&toAdd, &infoA);
+                else
+                    TRACE("%s has built-in providers, skip adding\n", debugstr_w(moduleName));
+            }
             if (ret == SEC_E_OK && toAdd > 0 && (infoW || infoA))
             {
                 SecureProvider *provider = SECUR32_addProvider(NULL, NULL,
@@ -624,8 +634,11 @@ SecurePackage *SECUR32_findPackageW(PCWSTR packageName)
                     fnTableA = pInitSecurityInterfaceA();
                 if (pInitSecurityInterfaceW)
                     fnTableW = pInitSecurityInterfaceW();
-                _makeFnTableA(&ret->provider->fnTableA, fnTableA, fnTableW);
-                _makeFnTableW(&ret->provider->fnTableW, fnTableA, fnTableW);
+                /* dont't update built-in SecurityFunctionTable */
+                if (fnTableA != &securityFunctionTableA)
+                    _makeFnTableA(&ret->provider->fnTableA, fnTableA, fnTableW);
+                if (fnTableW != &securityFunctionTableW)
+                    _makeFnTableW(&ret->provider->fnTableW, fnTableA, fnTableW);
                 ret->provider->loaded = TRUE;
             }
             else
diff --git a/dlls/secur32/secur32_priv.h b/dlls/secur32/secur32_priv.h
index 8d5756d..6f9c1e7 100644
--- a/dlls/secur32/secur32_priv.h
+++ b/dlls/secur32/secur32_priv.h
@@ -89,7 +89,8 @@ typedef enum _sign_direction {
 } SignDirection;
 
 /* Allocates space for and initializes a new provider.  If fnTableA or fnTableW
- * is non-NULL, assumes the provider is built-in (and is thus already loaded.)
+ * is non-NULL, assumes the provider is built-in, and if moduleName is non-NULL,
+ * means must load the LSA/user mode functions tables from external SSP/AP module.
  * Otherwise moduleName must not be NULL.
  * Returns a pointer to the stored provider entry, for use adding packages.
  */




More information about the wine-cvs mailing list