Changeset 21896 for branches/gcc-kmk/src


Ignore:
Timestamp:
Dec 15, 2011, 3:37:23 PM (14 years ago)
Author:
dmik
Message:

Port RICHED32, RSAENH, SCHANNEL, SECUR32 to GCC/kBuild.

Location:
branches/gcc-kmk/src
Files:
4 added
13 edited
4 moved

Legend:

Unmodified
Added
Removed
  • branches/gcc-kmk/src/Makefile.kmk

    r21895 r21896  
    6262include $(PATH_SUB_CURRENT)/quartz/Makefile.kmk
    6363include $(PATH_SUB_CURRENT)/rasapi32/Makefile.kmk
     64include $(PATH_SUB_CURRENT)/riched32/Makefile.kmk
     65include $(PATH_SUB_CURRENT)/rsaenh/Makefile.kmk
     66include $(PATH_SUB_CURRENT)/secur32/Makefile.kmk
     67include $(PATH_SUB_CURRENT)/schannel/Makefile.kmk
    6468
    6569include $(FILE_KBUILD_SUB_FOOTER)
  • branches/gcc-kmk/src/riched32/charlist.c

    r21308 r21896  
    3434
    3535#ifdef __WIN32OS2__ /* no useful trace in this file! */
     36#undef TRACE
    3637#define TRACE(a) do {} while (0)
    3738#endif
  • branches/gcc-kmk/src/riched32/initterm.cpp

    r21842 r21896  
    1 /* $Id: initriched32.cpp,v 1.5 2003-01-07 13:21:55 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.6 2001-09-05 13:37:19 bird Exp $ */
    22/*
    3  * DLL entry point
     3 * RICHED32 DLL entry point
    44 *
    55 * Copyright 1998 Sander van Leeuwen
    66 * Copyright 1998 Peter Fitzsimmons
    77 *
    8  *
    98 * Project Odin Software License can be found in LICENSE.TXT
    10  *
    119 */
    1210
    13 /*-------------------------------------------------------------*/
    14 /* INITERM.C -- Source for a custom dynamic link library       */
    15 /*              initialization and termination (_DLL_InitTerm) */
    16 /*              function.                                      */
    17 /*                                                             */
    18 /* When called to perform initialization, this sample function */
    19 /* gets storage for an array of integers, and initializes its  */
    20 /* elements with random integers.  At termination time, it     */
    21 /* frees the array.  Substitute your own special processing.   */
    22 /*-------------------------------------------------------------*/
    23 
    24 
    25 /* Include files */
    2611#define  INCL_DOSMODULEMGR
    2712#define  INCL_DOSPROCESS
     
    3722#include <initdll.h>
    3823
    39 extern "C" {
    40  //Win32 resource table (produced by wrc)
     24// Win32 resource table (produced by wrc)
    4125extern DWORD riched32_PEResTab;
    4226
     27static HMODULE dllHandle = 0;
     28
    4329BOOL WINAPI RICHED32_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
    44 }
    45 static HMODULE dllHandle = 0;
    46 //******************************************************************************
    47 //******************************************************************************
     30
    4831static BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    4932{
    50    BOOL ret;
     33    BOOL ret;
    5134
    52    switch (fdwReason)
    53    {
    54    case DLL_PROCESS_ATTACH:
    55        return RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
     35    switch (fdwReason)
     36    {
     37    case DLL_PROCESS_ATTACH:
     38        return RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
    5639
    57    case DLL_THREAD_ATTACH:
    58    case DLL_THREAD_DETACH:
    59        return RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
     40    case DLL_THREAD_ATTACH:
     41    case DLL_THREAD_DETACH:
     42        return RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
    6043
    61    case DLL_PROCESS_DETACH:
    62        ret = RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
    63        return ret;
    64    }
    65    return FALSE;
     44    case DLL_PROCESS_DETACH:
     45        ret = RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
     46        return ret;
     47    }
     48    return FALSE;
    6649}
    67 /****************************************************************************/
    68 /* _DLL_InitTerm is the function that gets called by the operating system   */
    69 /* loader when it loads and frees this DLL for each process that accesses   */
    70 /* this DLL.  However, it only gets called the first time the DLL is loaded */
    71 /* and the last time it is freed for a particular process.  The system      */
    72 /* linkage convention MUST be used because the operating system loader is   */
    73 /* calling this function.                                                   */
    74 /****************************************************************************/
    75 ULONG APIENTRY inittermRiched32(ULONG hModule, ULONG ulFlag)
     50
     51ULONG SYSTEM DLL_InitRichEd32(ULONG hModule)
    7652{
    77    size_t i;
    78    APIRET rc;
     53    CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    7954
    80    /*-------------------------------------------------------------------------*/
    81    /* If ulFlag is zero then the DLL is being loaded so initialization should */
    82    /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
    83    /* termination should be performed.                                        */
    84    /*-------------------------------------------------------------------------*/
     55    dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&riched32_PEResTab);
     56    if (dllHandle == 0)
     57        return -1;
    8558
    86    switch (ulFlag) {
    87       case 0 :
    88          CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    89          dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&riched32_PEResTab);
    90          if(dllHandle == 0)
    91              return 0UL;
     59    return 0;
     60}
    9261
    93          break;
     62void SYSTEM DLL_TermRichEd32(ULONG hModule)
     63{
     64    if (dllHandle)
     65       UnregisterLxDll(dllHandle);
     66}
    9467
    95       case 1 :
    96          if(dllHandle) {
    97              UnregisterLxDll(dllHandle);
    98          }
    99          break;
    100       default  :
    101          return 0UL;
    102    }
     68ULONG SYSTEM DLL_Init(ULONG hModule)
     69{
     70    if (DLL_InitDefault(hModule) == -1)
     71        return -1;
     72    return DLL_InitRichEd32(hModule);
     73}
    10374
    104    /***********************************************************/
    105    /* A non-zero value must be returned to indicate success.  */
    106    /***********************************************************/
    107    return 1UL;
     75void SYSTEM DLL_Term(ULONG hModule)
     76{
     77    DLL_TermRichEd32(hModule);
     78    DLL_TermDefault(hModule);
    10879}
    109 //******************************************************************************
    110 //******************************************************************************
  • branches/gcc-kmk/src/riched32/reader.c

    r21308 r21896  
    8282
    8383#ifdef __WIN32OS2__ /* no useful trace in this file! */
     84#undef TRACE
    8485#define TRACE(a) do {} while (0)
    8586#endif
  • branches/gcc-kmk/src/riched32/riched32.def

    r4809 r21896  
    99
    1010EXPORTS
    11     DllGetVersion = _RICHED32_DllGetVersion@4         @2
     11    DllGetVersion = "_RICHED32_DllGetVersion@4"       @2
  • branches/gcc-kmk/src/riched32/textwriter.c

    r21308 r21896  
    4747
    4848#ifdef __WIN32OS2__ /* no useful trace in this file! */
     49#undef TRACE
    4950#define TRACE(a) do {} while (0)
    5051#endif
  • branches/gcc-kmk/src/rsaenh/initterm.cpp

    r21842 r21896  
    1 /* $Id: initgdi32.cpp,v 1.16 2004/01/11 11:42:17 sandervl Exp $
     1/* $Id: initterm.cpp,v 1.17 2001/09/05 10:26:30 bird Exp $
    22 *
    3  * DLL entry point
     3 * RSAENH DLL entry point
    44 *
    55 * Copyright 1998 Sander van Leeuwen
    66 * Copyright 1998 Peter Fitzsimmons
    77 *
    8  *
    98 * Project Odin Software License can be found in LICENSE.TXT
    10  *
    119 */
    1210
    13 /*-------------------------------------------------------------*/
    14 /* INITERM.C -- Source for a custom dynamic link library       */
    15 /*              initialization and termination (_DLL_InitTerm) */
    16 /*              function.                                      */
    17 /*                                                             */
    18 /* When called to perform initialization, this sample function */
    19 /* gets storage for an array of integers, and initializes its  */
    20 /* elements with random integers.  At termination time, it     */
    21 /* frees the array.  Substitute your own special processing.   */
    22 /*-------------------------------------------------------------*/
    23 
    24 
    25 /* Include files */
    2611#define  INCL_DOSMODULEMGR
    2712#define  INCL_DOSPROCESS
     
    3823#include <initdll.h>
    3924
    40 extern "C" {
    41  //Win32 resource table (produced by wrc)
    42     //extern DWORD rsaenh_PEResTab;
    43     BOOL WINAPI RsaenhDllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved);
    44 }
     25//#define DBG_LOCALLOG    DBG_initterm
     26//#include "dbglocal.h"
     27
     28// Win32 resource table (produced by wrc)
     29//extern DWORD rsaenh_PEResTab;
    4530
    4631static HMODULE dllHandle = 0;
    4732
     33BOOL WINAPI RsaenhDllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved);
     34
    4835static BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    4936{
    50    BOOL ret;
     37    BOOL ret;
    5138
    52    switch (fdwReason)
    53    {
    54    case DLL_PROCESS_ATTACH:
    55        return RsaenhDllMain(hinstDLL, fdwReason, fImpLoad);
     39    switch (fdwReason)
     40    {
     41    case DLL_PROCESS_ATTACH:
     42        return RsaenhDllMain(hinstDLL, fdwReason, fImpLoad);
    5643
    57    case DLL_THREAD_ATTACH:
    58    case DLL_THREAD_DETACH:
    59        return RsaenhDllMain(hinstDLL, fdwReason, fImpLoad);
     44    case DLL_THREAD_ATTACH:
     45    case DLL_THREAD_DETACH:
     46        return RsaenhDllMain(hinstDLL, fdwReason, fImpLoad);
    6047
    61    case DLL_PROCESS_DETACH:
    62        ret = RsaenhDllMain(hinstDLL, fdwReason, fImpLoad);
    63        return ret;
    64    }
    65    return FALSE;
     48    case DLL_PROCESS_DETACH:
     49        ret = RsaenhDllMain(hinstDLL, fdwReason, fImpLoad);
     50        return ret;
     51    }
     52    return FALSE;
    6653}
    6754
    68 /****************************************************************************/
    69 /* _DLL_InitTerm is the function that gets called by the operating system   */
    70 /* loader when it loads and frees this DLL for each process that accesses   */
    71 /* this DLL.  However, it only gets called the first time the DLL is loaded */
    72 /* and the last time it is freed for a particular process.  The system      */
    73 /* linkage convention MUST be used because the operating system loader is   */
    74 /* calling this function.                                                   */
    75 /****************************************************************************/
    76 ULONG APIENTRY inittermRsaenh(ULONG hModule, ULONG ulFlag)
     55ULONG SYSTEM DLL_InitRsaEnh(ULONG hModule)
    7756{
    78    size_t i;
    79    APIRET rc;
     57    if (!InitializeKernel32())
     58        return 0;
    8059
    81    /*-------------------------------------------------------------------------*/
    82    /* If ulFlag is zero then the DLL is being loaded so initialization should */
    83    /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
    84    /* termination should be performed.                                        */
    85    /*-------------------------------------------------------------------------*/
     60    //CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8661
    87    switch (ulFlag) {
    88       case 0 :
     62    dllHandle = RegisterLxDll(hModule, OdinLibMain, NULL);
     63    if (dllHandle == 0)
     64        return -1;
    8965
    90          if (!InitializeKernel32())
    91              return 0;
     66    dprintf(("Rsaenh init %s %s (%x)", __DATE__, __TIME__, DLL_InitRsaEnh));
    9267
    93          //CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    94          dllHandle = RegisterLxDll(hModule, OdinLibMain, NULL);
    95          if(dllHandle == 0)
    96              return 0UL;
     68    return 0;
     69}
    9770
    98          dprintf(("Rsaenh init %s %s (%x)", __DATE__, __TIME__, inittermRsaenh));
     71void SYSTEM DLL_TermRsaEnh(ULONG hModule)
     72{
     73    if (dllHandle)
     74       UnregisterLxDll(dllHandle);
     75}
    9976
    100          break;
    101       case 1 :
    102          if(dllHandle) {
    103              UnregisterLxDll(dllHandle);
    104          }
    105          break;
    106       default  :
    107          return 0UL;
    108    }
     77ULONG SYSTEM DLL_Init(ULONG hModule)
     78{
     79    if (DLL_InitDefault(hModule) == -1)
     80        return -1;
     81    return DLL_InitRsaEnh(hModule);
     82}
    10983
    110    /***********************************************************/
    111    /* A non-zero value must be returned to indicate success.  */
    112    /***********************************************************/
    113    return 1UL;
     84void SYSTEM DLL_Term(ULONG hModule)
     85{
     86    DLL_TermRsaEnh(hModule);
     87    DLL_TermDefault(hModule);
    11488}
    115 //******************************************************************************
    116 //******************************************************************************
  • branches/gcc-kmk/src/rsaenh/rsaenh.c

    r21494 r21896  
    929929                        RegSetValueExA(hKey, szValueName, 0, REG_BINARY,
    930930                                       blobOut.pbData, blobOut.cbData);
    931                         LocalFree(blobOut.pbData);
     931                        LocalFree((HLOCAL)blobOut.pbData);
    932932                    }
    933933                }
     
    11711171                    ret = RSAENH_CPImportKey(hKeyContainer, blobOut.pbData, blobOut.cbData, 0, 0,
    11721172                                             phCryptKey);
    1173                     LocalFree(blobOut.pbData);
     1173                    LocalFree((HLOCAL)blobOut.pbData);
    11741174                }
    11751175            }
  • branches/gcc-kmk/src/rsaenh/rsaenh.def

    r21494 r21896  
    55EXPORTS
    66
    7 CPAcquireContext = _RSAENH_CPAcquireContext@16 @1
    8 CPCreateHash = _RSAENH_CPCreateHash@20 @2
    9 CPDecrypt = _RSAENH_CPDecrypt@28 @3
    10 CPDeriveKey = _RSAENH_CPDeriveKey@20 @4
    11 CPDestroyHash = _RSAENH_CPDestroyHash@8 @5
    12 CPDestroyKey = _RSAENH_CPDestroyKey@8 @6
    13 CPDuplicateHash = _RSAENH_CPDuplicateHash@20 @7
    14 CPDuplicateKey = _RSAENH_CPDuplicateKey@20 @8
    15 CPEncrypt = _RSAENH_CPEncrypt@32 @9
    16 CPExportKey = _RSAENH_CPExportKey@28 @10
    17 CPGenKey = _RSAENH_CPGenKey@16 @11
    18 CPGenRandom = _RSAENH_CPGenRandom@12 @12
    19 CPGetHashParam = _RSAENH_CPGetHashParam@24 @13
    20 CPGetKeyParam = _RSAENH_CPGetKeyParam@24 @14
    21 CPGetProvParam = _RSAENH_CPGetProvParam@20 @15
    22 CPGetUserKey = _RSAENH_CPGetUserKey@12 @16
    23 CPHashData = _RSAENH_CPHashData@20 @17
    24 CPHashSessionKey = _RSAENH_CPHashSessionKey@16 @18
    25 CPImportKey = _RSAENH_CPImportKey@24 @19
    26 CPReleaseContext = _RSAENH_CPReleaseContext@8 @20
    27 CPSetHashParam = _RSAENH_CPSetHashParam@20 @21
    28 CPSetKeyParam = _RSAENH_CPSetKeyParam@20 @22
    29 CPSetProvParam = _RSAENH_CPSetProvParam@16 @23
    30 CPSignHash = _RSAENH_CPSignHash@28 @24
    31 CPVerifySignature = _RSAENH_CPVerifySignature@28 @25
    32 DllRegisterServer = _DllRegisterServer@0 @26
    33 DllUnregisterServer = _DllUnregisterServer@0 @27
     7CPAcquireContext = "_RSAENH_CPAcquireContext@16" @1
     8CPCreateHash = "_RSAENH_CPCreateHash@20" @2
     9CPDecrypt = "_RSAENH_CPDecrypt@28" @3
     10CPDeriveKey = "_RSAENH_CPDeriveKey@20" @4
     11CPDestroyHash = "_RSAENH_CPDestroyHash@8" @5
     12CPDestroyKey = "_RSAENH_CPDestroyKey@8" @6
     13CPDuplicateHash = "_RSAENH_CPDuplicateHash@20" @7
     14CPDuplicateKey = "_RSAENH_CPDuplicateKey@20" @8
     15CPEncrypt = "_RSAENH_CPEncrypt@32" @9
     16CPExportKey = "_RSAENH_CPExportKey@28" @10
     17CPGenKey = "_RSAENH_CPGenKey@16" @11
     18CPGenRandom = "_RSAENH_CPGenRandom@12" @12
     19CPGetHashParam = "_RSAENH_CPGetHashParam@24" @13
     20CPGetKeyParam = "_RSAENH_CPGetKeyParam@24" @14
     21CPGetProvParam = "_RSAENH_CPGetProvParam@20" @15
     22CPGetUserKey = "_RSAENH_CPGetUserKey@12" @16
     23CPHashData = "_RSAENH_CPHashData@20" @17
     24CPHashSessionKey = "_RSAENH_CPHashSessionKey@16" @18
     25CPImportKey = "_RSAENH_CPImportKey@24" @19
     26CPReleaseContext = "_RSAENH_CPReleaseContext@8" @20
     27CPSetHashParam = "_RSAENH_CPSetHashParam@20" @21
     28CPSetKeyParam = "_RSAENH_CPSetKeyParam@20" @22
     29CPSetProvParam = "_RSAENH_CPSetProvParam@16" @23
     30CPSignHash = "_RSAENH_CPSignHash@28" @24
     31CPVerifySignature = "_RSAENH_CPVerifySignature@28" @25
     32DllRegisterServer = "_DllRegisterServer@0" @26
     33DllUnregisterServer = "_DllUnregisterServer@0" @27
    3434
    3535IMPORTS
    3636
    37 _MD4Final@4 = ADVAPI32.503
    38 _MD5Final@4 = ADVAPI32.506
    39 _MD4Update@12 = ADVAPI32.505
    40 _MD5Update@12 = ADVAPI32.508
    41 _A_SHAInit@4 = ADVAPI32.501
    42 _A_SHAFinal@8 = ADVAPI32.500
    43 _A_SHAUpdate@12 = ADVAPI32.502
    44 _MD4Init@4 = ADVAPI32.504
    45 _MD5Init@4 = ADVAPI32.507
     37"_MD4Final@4" = ADVAPI32.503
     38"_MD5Final@4" = ADVAPI32.506
     39"_MD4Update@12" = ADVAPI32.505
     40"_MD5Update@12" = ADVAPI32.508
     41"_A_SHAInit@4" = ADVAPI32.501
     42"_A_SHAFinal@8" = ADVAPI32.500
     43"_A_SHAUpdate@12" = ADVAPI32.502
     44"_MD4Init@4" = ADVAPI32.504
     45"_MD5Init@4" = ADVAPI32.507
    4646_wsnprintfA = USER32.2100
    47 _SystemFunction036@8 = ADVAPI32.402
     47"_SystemFunction036@8" = ADVAPI32.402
  • branches/gcc-kmk/src/schannel/initterm.cpp

    r21842 r21896  
    1 /* $Id: initgdi32.cpp,v 1.16 2004/01/11 11:42:17 sandervl Exp $
     1/* $Id: initterm.cpp,v 1.17 2001/09/05 10:26:30 bird Exp $
    22 *
    3  * DLL entry point
     3 * SCHANNEL DLL entry point
    44 *
    55 * Copyright 1998 Sander van Leeuwen
    66 * Copyright 1998 Peter Fitzsimmons
    77 *
    8  *
    98 * Project Odin Software License can be found in LICENSE.TXT
    10  *
    119 */
    1210
    13 /*-------------------------------------------------------------*/
    14 /* INITERM.C -- Source for a custom dynamic link library       */
    15 /*              initialization and termination (_DLL_InitTerm) */
    16 /*              function.                                      */
    17 /*                                                             */
    18 /* When called to perform initialization, this sample function */
    19 /* gets storage for an array of integers, and initializes its  */
    20 /* elements with random integers.  At termination time, it     */
    21 /* frees the array.  Substitute your own special processing.   */
    22 /*-------------------------------------------------------------*/
    23 
    24 
    25 /* Include files */
    2611#define  INCL_DOSMODULEMGR
    2712#define  INCL_DOSPROCESS
     
    3823#include <initdll.h>
    3924
    40 extern "C" {
    41  //Win32 resource table (produced by wrc)
    42     //extern DWORD rsaenh_PEResTab;
    43     BOOL WINAPI SChannelDllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved);
    44 }
     25//#define DBG_LOCALLOG    DBG_initterm
     26//#include "dbglocal.h"
     27
     28// Win32 resource table (produced by wrc)
     29//extern DWORD rsaenh_PEResTab;
    4530
    4631static HMODULE dllHandle = 0;
    4732
     33BOOL WINAPI SChannelDllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved);
     34
    4835static BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    4936{
    50    BOOL ret;
     37    BOOL ret;
    5138
    52    switch (fdwReason)
    53    {
    54    case DLL_PROCESS_ATTACH:
    55        return SChannelDllMain(hinstDLL, fdwReason, fImpLoad);
     39    switch (fdwReason)
     40    {
     41    case DLL_PROCESS_ATTACH:
     42        return SChannelDllMain(hinstDLL, fdwReason, fImpLoad);
    5643
    57    case DLL_THREAD_ATTACH:
    58    case DLL_THREAD_DETACH:
    59        return SChannelDllMain(hinstDLL, fdwReason, fImpLoad);
     44    case DLL_THREAD_ATTACH:
     45    case DLL_THREAD_DETACH:
     46        return SChannelDllMain(hinstDLL, fdwReason, fImpLoad);
    6047
    61    case DLL_PROCESS_DETACH:
    62        ret = SChannelDllMain(hinstDLL, fdwReason, fImpLoad);
    63        return ret;
    64    }
    65    return FALSE;
     48    case DLL_PROCESS_DETACH:
     49        ret = SChannelDllMain(hinstDLL, fdwReason, fImpLoad);
     50        return ret;
     51    }
     52    return FALSE;
    6653}
    6754
    68 /****************************************************************************/
    69 /* _DLL_InitTerm is the function that gets called by the operating system   */
    70 /* loader when it loads and frees this DLL for each process that accesses   */
    71 /* this DLL.  However, it only gets called the first time the DLL is loaded */
    72 /* and the last time it is freed for a particular process.  The system      */
    73 /* linkage convention MUST be used because the operating system loader is   */
    74 /* calling this function.                                                   */
    75 /****************************************************************************/
    76 ULONG APIENTRY inittermSChannel(ULONG hModule, ULONG ulFlag)
     55ULONG SYSTEM DLL_InitSChannel(ULONG hModule)
    7756{
    78    size_t i;
    79    APIRET rc;
     57    if (!InitializeKernel32())
     58        return 0;
    8059
    81    /*-------------------------------------------------------------------------*/
    82    /* If ulFlag is zero then the DLL is being loaded so initialization should */
    83    /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
    84    /* termination should be performed.                                        */
    85    /*-------------------------------------------------------------------------*/
     60    //CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8661
    87    switch (ulFlag) {
    88       case 0 :
     62    dllHandle = RegisterLxDll(hModule, OdinLibMain, NULL);
     63    if (dllHandle == 0)
     64        return -1;
    8965
    90          if (!InitializeKernel32())
    91              return 0;
     66    dprintf(("schannel init %s %s (%x)", __DATE__, __TIME__, DLL_InitSChannel));
    9267
    93          //CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    94          dllHandle = RegisterLxDll(hModule, OdinLibMain, NULL);
    95          if(dllHandle == 0)
    96              return 0UL;
     68    return 0;
     69}
    9770
    98          dprintf(("Secur32 init %s %s (%x)", __DATE__, __TIME__, inittermSChannel));
     71void SYSTEM DLL_TermSChannel(ULONG hModule)
     72{
     73    if (dllHandle)
     74       UnregisterLxDll(dllHandle);
     75}
    9976
    100          break;
    101       case 1 :
    102          if(dllHandle) {
    103              UnregisterLxDll(dllHandle);
    104          }
    105          break;
    106       default  :
    107          return 0UL;
    108    }
     77ULONG SYSTEM DLL_Init(ULONG hModule)
     78{
     79    if (DLL_InitDefault(hModule) == -1)
     80        return -1;
     81    return DLL_InitSChannel(hModule);
     82}
    10983
    110    /***********************************************************/
    111    /* A non-zero value must be returned to indicate success.  */
    112    /***********************************************************/
    113    return 1UL;
     84void SYSTEM DLL_Term(ULONG hModule)
     85{
     86    DLL_TermSChannel(hModule);
     87    DLL_TermDefault(hModule);
    11488}
    115 //******************************************************************************
    116 //******************************************************************************
  • branches/gcc-kmk/src/schannel/schannel.def

    r21373 r21896  
    88;ApplyControlToken = _CollectSslPerformanceData @6
    99;MakeSignature = _OpenSslPerformanceData @19
    10 SpLsaModeInitialize = _SpLsaModeInitialize@16 @26
    11 SpUserModeInitialize = _SpUserModeInitialize@16 @27
     10SpLsaModeInitialize = "_SpLsaModeInitialize@16" @26
     11SpUserModeInitialize = "_SpUserModeInitialize@16" @27
    1212;SpUserModeInitialize = _SslCrackCertificate @28
    1313;SpUserModeInitialize = _SslEmptyCacheA @29
     
    2020
    2121;forwarders from secur32
    22 AcceptSecurityContext = _AcceptSecurityContext@36
    23 AcquireCredentialsHandleA = _AcquireCredentialsHandleA@36
    24 AcquireCredentialsHandleW = _AcquireCredentialsHandleW@36
    25 ApplyControlToken = _ApplyControlToken@8
    26 DeleteSecurityContext = _DeleteSecurityContext@4
    27 EnumerateSecurityPackagesA = _EnumerateSecurityPackagesA@8
    28 EnumerateSecurityPackagesW = _EnumerateSecurityPackagesW@8
    29 FreeContextBuffer = _FreeContextBuffer@4
    30 FreeCredentialsHandle = _FreeCredentialsHandle@4
    31 ImpersonateSecurityContext = _ImpersonateSecurityContext@4
    32 InitSecurityInterfaceA = _InitSecurityInterfaceA@0
    33 InitSecurityInterfaceW = _InitSecurityInterfaceW@0
    34 InitializeSecurityContextA = _InitializeSecurityContextA@48
    35 InitializeSecurityContextW = _InitializeSecurityContextW@48
    36 MakeSignature = _MakeSignature@16
    37 CompleteAuthToken = _CompleteAuthToken@8
    38 QueryContextAttributesA = _QueryContextAttributesA@12
    39 QueryContextAttributesW = _QueryContextAttributesW@12
    40 QuerySecurityPackageInfoA = _QuerySecurityPackageInfoA@8
    41 QuerySecurityPackageInfoW = _QuerySecurityPackageInfoW@8
    42 RevertSecurityContext = _RevertSecurityContext@4
    43 SealMessage = _SealMessage@16
    44 UnsealMessage = _UnsealMessage@16
    45 VerifySignature = _VerifySignature@16
     22AcceptSecurityContext = "_AcceptSecurityContext@36" @1000
     23AcquireCredentialsHandleA = "_AcquireCredentialsHandleA@36" @1001
     24AcquireCredentialsHandleW = "_AcquireCredentialsHandleW@36" @1002
     25ApplyControlToken = "_ApplyControlToken@8" @1003
     26DeleteSecurityContext = "_DeleteSecurityContext@4" @1004
     27EnumerateSecurityPackagesA = "_EnumerateSecurityPackagesA@8" @1005
     28EnumerateSecurityPackagesW = "_EnumerateSecurityPackagesW@8" @1006
     29FreeContextBuffer = "_FreeContextBuffer@4" @1007
     30FreeCredentialsHandle = "_FreeCredentialsHandle@4" @1008
     31ImpersonateSecurityContext = "_ImpersonateSecurityContext@4" @1009
     32InitSecurityInterfaceA = "_InitSecurityInterfaceA@0" @1010
     33InitSecurityInterfaceW = "_InitSecurityInterfaceW@0" @1011
     34InitializeSecurityContextA = "_InitializeSecurityContextA@48" @1012
     35InitializeSecurityContextW = "_InitializeSecurityContextW@48" @1013
     36MakeSignature = "_MakeSignature@16" @1014
     37CompleteAuthToken = "_CompleteAuthToken@8" @1015
     38QueryContextAttributesA = "_QueryContextAttributesA@12" @1016
     39QueryContextAttributesW = "_QueryContextAttributesW@12" @1017
     40QuerySecurityPackageInfoA = "_QuerySecurityPackageInfoA@8" @1018
     41QuerySecurityPackageInfoW = "_QuerySecurityPackageInfoW@8" @1019
     42RevertSecurityContext = "_RevertSecurityContext@4" @1020
     43SealMessage = "_SealMessage@16" @1021
     44UnsealMessage = "_UnsealMessage@16" @1022
     45VerifySignature = "_VerifySignature@16" @1023
  • branches/gcc-kmk/src/secur32/initterm.cpp

    r21842 r21896  
    1 /* $Id: initgdi32.cpp,v 1.16 2004/01/11 11:42:17 sandervl Exp $
     1/* $Id: initterm.cpp,v 1.17 2001/09/05 10:26:30 bird Exp $
    22 *
    3  * DLL entry point
     3 * SECUR32 DLL entry point
    44 *
    55 * Copyright 1998 Sander van Leeuwen
    66 * Copyright 1998 Peter Fitzsimmons
    77 *
    8  *
    98 * Project Odin Software License can be found in LICENSE.TXT
    10  *
    119 */
    1210
    13 /*-------------------------------------------------------------*/
    14 /* INITERM.C -- Source for a custom dynamic link library       */
    15 /*              initialization and termination (_DLL_InitTerm) */
    16 /*              function.                                      */
    17 /*                                                             */
    18 /* When called to perform initialization, this sample function */
    19 /* gets storage for an array of integers, and initializes its  */
    20 /* elements with random integers.  At termination time, it     */
    21 /* frees the array.  Substitute your own special processing.   */
    22 /*-------------------------------------------------------------*/
    23 
    24 
    25 /* Include files */
    2611#define  INCL_DOSMODULEMGR
    2712#define  INCL_DOSPROCESS
     
    3823#include <initdll.h>
    3924
    40 extern "C" {
    41  //Win32 resource table (produced by wrc)
    42     //extern DWORD rsaenh_PEResTab;
    43     BOOL WINAPI Secur32DllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved);
    44 }
     25//#define DBG_LOCALLOG    DBG_initterm
     26//#include "dbglocal.h"
     27
     28// Win32 resource table (produced by wrc)
     29//extern DWORD secur32_PEResTab;
    4530
    4631static HMODULE dllHandle = 0;
    4732
     33BOOL WINAPI Secur32DllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved);
     34
    4835static BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    4936{
    50    BOOL ret;
     37    BOOL ret;
    5138
    52    switch (fdwReason)
    53    {
    54    case DLL_PROCESS_ATTACH:
    55        return Secur32DllMain(hinstDLL, fdwReason, fImpLoad);
     39    switch (fdwReason)
     40    {
     41    case DLL_PROCESS_ATTACH:
     42        return Secur32DllMain(hinstDLL, fdwReason, fImpLoad);
    5643
    57    case DLL_THREAD_ATTACH:
    58    case DLL_THREAD_DETACH:
    59        return Secur32DllMain(hinstDLL, fdwReason, fImpLoad);
     44    case DLL_THREAD_ATTACH:
     45    case DLL_THREAD_DETACH:
     46        return Secur32DllMain(hinstDLL, fdwReason, fImpLoad);
    6047
    61    case DLL_PROCESS_DETACH:
    62        ret = Secur32DllMain(hinstDLL, fdwReason, fImpLoad);
    63        return ret;
    64    }
    65    return FALSE;
     48    case DLL_PROCESS_DETACH:
     49        ret = Secur32DllMain(hinstDLL, fdwReason, fImpLoad);
     50        return ret;
     51    }
     52    return FALSE;
    6653}
    6754
    68 /****************************************************************************/
    69 /* _DLL_InitTerm is the function that gets called by the operating system   */
    70 /* loader when it loads and frees this DLL for each process that accesses   */
    71 /* this DLL.  However, it only gets called the first time the DLL is loaded */
    72 /* and the last time it is freed for a particular process.  The system      */
    73 /* linkage convention MUST be used because the operating system loader is   */
    74 /* calling this function.                                                   */
    75 /****************************************************************************/
    76 ULONG APIENTRY inittermSecur32(ULONG hModule, ULONG ulFlag)
     55ULONG SYSTEM DLL_InitSecur32(ULONG hModule)
    7756{
    78    size_t i;
    79    APIRET rc;
     57    if (!InitializeKernel32())
     58        return 0;
    8059
    81    /*-------------------------------------------------------------------------*/
    82    /* If ulFlag is zero then the DLL is being loaded so initialization should */
    83    /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
    84    /* termination should be performed.                                        */
    85    /*-------------------------------------------------------------------------*/
     60    //CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8661
    87    switch (ulFlag) {
    88       case 0 :
     62    dllHandle = RegisterLxDll(hModule, OdinLibMain, NULL);
     63    if (dllHandle == 0)
     64        return -1;
    8965
    90          if (!InitializeKernel32())
    91              return 0;
     66    dprintf(("Secur32 init %s %s (%x)", __DATE__, __TIME__, DLL_InitSecur32));
    9267
    93          //CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    94          dllHandle = RegisterLxDll(hModule, OdinLibMain, NULL);
    95          if(dllHandle == 0)
    96              return 0UL;
     68    return 0;
     69}
    9770
    98          dprintf(("Secur32 init %s %s (%x)", __DATE__, __TIME__, inittermSecur32));
     71void SYSTEM DLL_TermSecur32(ULONG hModule)
     72{
     73    if (dllHandle)
     74       UnregisterLxDll(dllHandle);
     75}
    9976
    100          break;
    101       case 1 :
    102          if(dllHandle) {
    103              UnregisterLxDll(dllHandle);
    104          }
    105          break;
    106       default  :
    107          return 0UL;
    108    }
     77ULONG SYSTEM DLL_Init(ULONG hModule)
     78{
     79    if (DLL_InitDefault(hModule) == -1)
     80        return -1;
     81    return DLL_InitSecur32(hModule);
     82}
    10983
    110    /***********************************************************/
    111    /* A non-zero value must be returned to indicate success.  */
    112    /***********************************************************/
    113    return 1UL;
     84void SYSTEM DLL_Term(ULONG hModule)
     85{
     86    DLL_TermSecur32(hModule);
     87    DLL_TermDefault(hModule);
    11488}
    115 //******************************************************************************
    116 //******************************************************************************
  • branches/gcc-kmk/src/secur32/secur32.c

    r21364 r21896  
    1717 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
    1818 */
     19
    1920#include <assert.h>
    2021#include <stdarg.h>
     22#include <memory.h>
    2123
    2224#include "ntstatus.h"
     
    6163 *  Prototypes
    6264 */
     65
     66ULONG WIN32API LsaNtStatusToWinError(NTSTATUS Status);
    6367
    6468/* Tries to load moduleName as a provider.  If successful, enumerates what
  • branches/gcc-kmk/src/secur32/secur32.def

    r21364 r21896  
    55EXPORTS
    66
    7 AcceptSecurityContext = _AcceptSecurityContext@36 @1
    8 AcquireCredentialsHandleA = _AcquireCredentialsHandleA@36 @2
    9 AcquireCredentialsHandleW = _AcquireCredentialsHandleW@36 @3
    10 AddCredentialsA = _AddCredentialsA@32 @4
    11 AddCredentialsW = _AddCredentialsW@32 @5
     7AcceptSecurityContext = "_AcceptSecurityContext@36" @1
     8AcquireCredentialsHandleA = "_AcquireCredentialsHandleA@36" @2
     9AcquireCredentialsHandleW = "_AcquireCredentialsHandleW@36" @3
     10AddCredentialsA = "_AddCredentialsA@32" @4
     11AddCredentialsW = "_AddCredentialsW@32" @5
    1212;AddCredentialsW = _AddSecurityPackageA @6
    1313;AddCredentialsW = _AddSecurityPackageW @7
    14 ApplyControlToken = _ApplyControlToken@8 @8
    15 CompleteAuthToken = _CompleteAuthToken@8 @9
    16 DecryptMessage = _DecryptMessage@16 @10
    17 DeleteSecurityContext = _DeleteSecurityContext@4 @11
     14ApplyControlToken = "_ApplyControlToken@8" @8
     15CompleteAuthToken = "_CompleteAuthToken@8" @9
     16DecryptMessage = "_DecryptMessage@16" @10
     17DeleteSecurityContext = "_DeleteSecurityContext@4" @11
    1818;DeleteSecurityContext = _DeleteSecurityPackageA @12
    1919;DeleteSecurityContext = _DeleteSecurityPackageW @13
    20 EncryptMessage = _EncryptMessage@16 @14
    21 EnumerateSecurityPackagesA = _EnumerateSecurityPackagesA@8 @15
    22 EnumerateSecurityPackagesW = _EnumerateSecurityPackagesW@8 @16
    23 ExportSecurityContext = _ExportSecurityContext@16 @17
    24 FreeContextBuffer = _FreeContextBuffer@4 @18
    25 FreeCredentialsHandle = _FreeCredentialsHandle@4 @19
    26 GetComputerObjectNameA = _GetComputerObjectNameA@12 @20
    27 GetComputerObjectNameW = _GetComputerObjectNameW@12 @21
     20EncryptMessage = "_EncryptMessage@16" @14
     21EnumerateSecurityPackagesA = "_EnumerateSecurityPackagesA@8" @15
     22EnumerateSecurityPackagesW = "_EnumerateSecurityPackagesW@8" @16
     23ExportSecurityContext = "_ExportSecurityContext@16" @17
     24FreeContextBuffer = "_FreeContextBuffer@4" @18
     25FreeCredentialsHandle = "_FreeCredentialsHandle@4" @19
     26GetComputerObjectNameA = "_GetComputerObjectNameA@12" @20
     27GetComputerObjectNameW = "_GetComputerObjectNameW@12" @21
    2828;GetComputerObjectNameW = _GetSecurityUserInfo @22
    29 GetUserNameExA = _GetUserNameExA@12 @23
    30 GetUserNameExW = _GetUserNameExW@12 @24
    31 ImpersonateSecurityContext = _ImpersonateSecurityContext@4 @25
    32 ImportSecurityContextA = _ImportSecurityContextA@16 @26
    33 ImportSecurityContextW = _ImportSecurityContextW@16 @27
    34 InitSecurityInterfaceA = _InitSecurityInterfaceA@0 @28
    35 InitSecurityInterfaceW = _InitSecurityInterfaceW@0 @29
    36 InitializeSecurityContextA = _InitializeSecurityContextA@48 @30
    37 InitializeSecurityContextW = _InitializeSecurityContextW@48 @31
    38 LsaCallAuthenticationPackage = _LsaCallAuthenticationPackage@28 @32
    39 LsaConnectUntrusted = _LsaConnectUntrusted@4 @33
    40 LsaDeregisterLogonProcess = _LsaDeregisterLogonProcess@4 @34
    41 LsaEnumerateLogonSessions = _LsaEnumerateLogonSessions@8 @35
    42 LsaFreeReturnBuffer = _LsaFreeReturnBuffer@4 @36
    43 LsaGetLogonSessionData = _LsaGetLogonSessionData@8 @37
    44 LsaLogonUser = _LsaLogonUser@56 @38
    45 LsaLookupAuthenticationPackage = _LsaLookupAuthenticationPackage@12 @39
    46 LsaRegisterLogonProcess = _LsaRegisterLogonProcess@12 @40
     29GetUserNameExA = "_GetUserNameExA@12" @23
     30GetUserNameExW = "_GetUserNameExW@12" @24
     31ImpersonateSecurityContext = "_ImpersonateSecurityContext@4" @25
     32ImportSecurityContextA = "_ImportSecurityContextA@16" @26
     33ImportSecurityContextW = "_ImportSecurityContextW@16" @27
     34InitSecurityInterfaceA = "_InitSecurityInterfaceA@0" @28
     35InitSecurityInterfaceW = "_InitSecurityInterfaceW@0" @29
     36InitializeSecurityContextA = "_InitializeSecurityContextA@48" @30
     37InitializeSecurityContextW = "_InitializeSecurityContextW@48" @31
     38LsaCallAuthenticationPackage = "_LsaCallAuthenticationPackage@28" @32
     39LsaConnectUntrusted = "_LsaConnectUntrusted@4" @33
     40LsaDeregisterLogonProcess = "_LsaDeregisterLogonProcess@4" @34
     41LsaEnumerateLogonSessions = "_LsaEnumerateLogonSessions@8" @35
     42LsaFreeReturnBuffer = "_LsaFreeReturnBuffer@4" @36
     43LsaGetLogonSessionData = "_LsaGetLogonSessionData@8" @37
     44LsaLogonUser = "_LsaLogonUser@56" @38
     45LsaLookupAuthenticationPackage = "_LsaLookupAuthenticationPackage@12" @39
     46LsaRegisterLogonProcess = "_LsaRegisterLogonProcess@12" @40
    4747;LsaRegisterLogonProcess = _LsaRegisterPolicyChangeNotification @41
    4848;LsaRegisterLogonProcess = _LsaUnregisterPolicyChangeNotification @42
    49 MakeSignature = _MakeSignature@16 @43
    50 QueryContextAttributesA = _QueryContextAttributesA@12 @44
    51 QueryContextAttributesW = _QueryContextAttributesW@12 @45
    52 QueryCredentialsAttributesA = _QueryCredentialsAttributesA@12 @46
    53 QueryCredentialsAttributesW = _QueryCredentialsAttributesW@12 @47
    54 QuerySecurityContextToken = _QuerySecurityContextToken@8 @48
    55 QuerySecurityPackageInfoA = _QuerySecurityPackageInfoA@8 @49
    56 QuerySecurityPackageInfoW = _QuerySecurityPackageInfoW@8 @50
    57 RevertSecurityContext = _RevertSecurityContext@4 @51
     49MakeSignature = "_MakeSignature@16" @43
     50QueryContextAttributesA = "_QueryContextAttributesA@12" @44
     51QueryContextAttributesW = "_QueryContextAttributesW@12" @45
     52QueryCredentialsAttributesA = "_QueryCredentialsAttributesA@12" @46
     53QueryCredentialsAttributesW = "_QueryCredentialsAttributesW@12" @47
     54QuerySecurityContextToken = "_QuerySecurityContextToken@8" @48
     55QuerySecurityPackageInfoA = "_QuerySecurityPackageInfoA@8" @49
     56QuerySecurityPackageInfoW = "_QuerySecurityPackageInfoW@8" @50
     57RevertSecurityContext = "_RevertSecurityContext@4" @51
    5858;RevertSecurityContext = _SaslAcceptSecurityContext @52
    5959;RevertSecurityContext = _SaslEnumerateProfilesA @53
     
    6565;RevertSecurityContext = _SaslInitializeSecurityContextA @59
    6666;RevertSecurityContext = _SaslInitializeSecurityContextW @60
    67 SealMessage = _EncryptMessage@16 @61
     67SealMessage = "_EncryptMessage@16" @61
    6868;SealMessage = _SecCacheSspiPackages @62
    6969;SealMessage = _SecGetLocaleSpecificEncryptionRules @63
     
    7171;SealMessage = _SecpTranslateName @65
    7272;SealMessage = _SecpTranslateNameEx @66
    73 TranslateNameA = _TranslateNameA@20 @67
    74 TranslateNameW = _TranslateNameW@20 @68
    75 UnsealMessage = _DecryptMessage@16 @69
    76 VerifySignature = _VerifySignature@16 @70
     73TranslateNameA = "_TranslateNameA@20" @67
     74TranslateNameW = "_TranslateNameW@20" @68
     75UnsealMessage = "_DecryptMessage@16" @69
     76VerifySignature = "_VerifySignature@16" @70
    7777
    7878IMPORTS
    7979
    8080CredFree = ADVAPI32.509
    81 _CredReadW@16 = ADVAPI32.510
    82 LsaNtStatusToWinError = ADVAPI32.223
    83 _NetWkstaUserGetInfo@12 = NETAPI32.202
     81"_CredReadW@16" = ADVAPI32.510
     82"_NetWkstaUserGetInfo@12" = NETAPI32.202
    8483
  • branches/gcc-kmk/src/secur32/secur32_priv.h

    r21364 r21896  
    2525#include "wine/list.h"
    2626
     27#ifndef __EMX__
    2728typedef ULONG pid_t;
     29#endif
    2830
    2931typedef struct _SecureProvider
  • branches/gcc-kmk/src/secur32/thunks.c

    r21364 r21896  
    1818 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
    1919 */
     20
    2021#include <stdarg.h>
     22#include <memory.h>
     23
    2124#include "windef.h"
    2225#include "winbase.h"
  • branches/gcc-kmk/src/secur32/util.c

    r21364 r21896  
    1818 * This file contains various helper functions needed for NTLM and maybe others
    1919 */
     20
    2021#include <stdarg.h>
    2122#include <stdio.h>
     23#include <memory.h>
     24
    2225#include "windef.h"
    2326#include "winbase.h"
Note: See TracChangeset for help on using the changeset viewer.