Henri Verbeet : secur32: Forward schannel InitializeSecurityContextA to InitializeSecurityContextW.

Alexandre Julliard julliard at winehq.org
Tue Oct 7 08:53:59 CDT 2008


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

Author: Henri Verbeet <hverbeet at gmail.com>
Date:   Mon Oct  6 19:08:47 2008 +0200

secur32: Forward schannel InitializeSecurityContextA to InitializeSecurityContextW.

---

 dlls/secur32/schannel.c |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index 9d64799..402383f 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -28,6 +28,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "winnls.h"
 #include "sspi.h"
 #include "schannel.h"
 #include "secur32_priv.h"
@@ -406,10 +407,10 @@ static SECURITY_STATUS SEC_ENTRY schan_FreeCredentialsHandle(
 }
 
 /***********************************************************************
- *              InitializeSecurityContextA
+ *              InitializeSecurityContextW
  */
-static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA(
- PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName,
+static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
+ PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName,
  ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
  PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
  PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
@@ -417,9 +418,9 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA(
     SECURITY_STATUS ret;
 
     TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
-     debugstr_a(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
+     debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
      Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
-    if(phCredential)
+    if (phCredential)
     {
         FIXME("stub\n");
         ret = SEC_E_UNSUPPORTED_FUNCTION;
@@ -432,28 +433,34 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA(
 }
 
 /***********************************************************************
- *              InitializeSecurityContextW
+ *              InitializeSecurityContextA
  */
-static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
- PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName,
+static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA(
+ PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName,
  ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
- PSecBufferDesc pInput,ULONG Reserved2, PCtxtHandle phNewContext,
+ PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
  PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
 {
     SECURITY_STATUS ret;
+    SEC_WCHAR *target_name = NULL;
 
     TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
-     debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
+     debugstr_a(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
      Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
-    if (phCredential)
-    {
-        FIXME("stub\n");
-        ret = SEC_E_UNSUPPORTED_FUNCTION;
-    }
-    else
+
+    if (pszTargetName)
     {
-        ret = SEC_E_INVALID_HANDLE;
+        INT len = MultiByteToWideChar(CP_ACP, 0, pszTargetName, -1, NULL, 0);
+        target_name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*target_name));
+        MultiByteToWideChar(CP_ACP, 0, pszTargetName, -1, target_name, len);
     }
+
+    ret = schan_InitializeSecurityContextW(phCredential, phContext, target_name,
+            fContextReq, Reserved1, TargetDataRep, pInput, Reserved2,
+            phNewContext, pOutput, pfContextAttr, ptsExpiry);
+
+    HeapFree(GetProcessHeap(), 0, target_name);
+
     return ret;
 }
 




More information about the wine-cvs mailing list