Changeset 21880 for branches/gcc-kmk/src


Ignore:
Timestamp:
Dec 13, 2011, 12:08:07 PM (14 years ago)
Author:
dmik
Message:

Port WS2_32 to GCC/kBuild.

Location:
branches/gcc-kmk/src
Files:
1 added
5 edited

Legend:

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

    r21878 r21880  
    4444include $(PATH_SUB_CURRENT)/ctl3d32/Makefile.kmk
    4545include $(PATH_SUB_CURRENT)/dciman32/Makefile.kmk
     46include $(PATH_SUB_CURRENT)/ws2_32/Makefile.kmk
    4647
    4748include $(FILE_KBUILD_SUB_FOOTER)
  • branches/gcc-kmk/src/ws2_32/dbglocal.cpp

    r5664 r21880  
    1717
    1818USHORT DbgEnabled[DBG_MAXFILES];
    19 char *DbgFileNames[DBG_MAXFILES] =
     19const char *DbgFileNames[DBG_MAXFILES] =
    2020{
    2121"initterm",
  • branches/gcc-kmk/src/ws2_32/initterm.cpp

    r21727 r21880  
    11/* $Id: initterm.cpp,v 1.3 2001-10-13 18:50:52 sandervl Exp $
    22 *
    3  * DLL entry point
     3 * WS2_32 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
     
    4025#include "dbglocal.h"
    4126
    42 extern "C" {
    43  //Win32 resource table (produced by wrc)
    44  extern DWORD _Resource_PEResTab;
    45 }
     27// Win32 resource table (produced by wrc)
     28extern DWORD ws2_32_PEResTab;
     29
    4630static HMODULE dllHandle = 0;
    4731
    48 //******************************************************************************
    49 //******************************************************************************
    5032BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    5133{
    52    switch (fdwReason)
    53    {
    54    case DLL_PROCESS_ATTACH:
    55     return TRUE;
     34    switch (fdwReason)
     35    {
     36    case DLL_PROCESS_ATTACH:
     37        return TRUE;
    5638
    57    case DLL_THREAD_ATTACH:
    58    case DLL_THREAD_DETACH:
    59     return TRUE;
     39    case DLL_THREAD_ATTACH:
     40    case DLL_THREAD_DETACH:
     41        return TRUE;
    6042
    61    case DLL_PROCESS_DETACH:
    62     ctordtorTerm();
    63     return TRUE;
    64    }
    65    return FALSE;
     43    case DLL_PROCESS_DETACH:
     44#ifdef __IBMC__
     45        ctordtorTerm();
     46#endif
     47        return TRUE;
     48    }
     49    return FALSE;
    6650}
    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 SYSTEM _DLL_InitTerm(ULONG hModule, ULONG ulFlag)
     51
     52ULONG SYSTEM DLL_InitWS2_32(ULONG hModule)
    7653{
    77    size_t i;
    78    APIRET rc;
     54    ParseLogStatus();
    7955
    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    /*-------------------------------------------------------------------------*/
     56    CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8557
    86    switch (ulFlag) {
    87       case 0 :
    88          ctordtorInit();
     58    dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&ws2_32_PEResTab);
     59    if(dllHandle == 0)
     60        return -1;
    8961
    90          ParseLogStatus();
     62    return 0;
     63}
    9164
    92          CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
     65void SYSTEM DLL_TermWS2_32(ULONG hModule)
     66{
     67    if (dllHandle)
     68       UnregisterLxDll(dllHandle);
     69}
    9370
    94          dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab);
    95          if(dllHandle == 0)
    96              return 0UL;
     71ULONG SYSTEM DLL_Init(ULONG hModule)
     72{
     73    if (DLL_InitDefault(hModule) == -1)
     74        return -1;
     75    return DLL_InitWS2_32(hModule);
     76}
    9777
    98          break;
    99       case 1 :
    100          if(dllHandle) {
    101              UnregisterLxDll(dllHandle);
    102          }
    103          break;
    104       default  :
    105          return 0UL;
    106    }
    107 
    108    /***********************************************************/
    109    /* A non-zero value must be returned to indicate success.  */
    110    /***********************************************************/
    111    return 1UL;
     78void SYSTEM DLL_Term(ULONG hModule)
     79{
     80    DLL_TermWS2_32(hModule);
     81    DLL_TermDefault(hModule);
    11282}
    113 //******************************************************************************
    114 //******************************************************************************
  • branches/gcc-kmk/src/ws2_32/protocol.cpp

    r8055 r21880  
    2828#include <wchar.h>
    2929
     30#ifdef __EMX__
     31// EMX currently lacks POSIX swprintf, use snwprinf from NTDLL
     32#include <minivcrt.h>
     33#endif
     34
    3035//#include "nspapi.h"
    3136
     
    291296      // recalculate LANA -> iProtocol
    292297      lpBuffer->iProtocol = pBinding->pLANA->encLANA;
    293      
     298
     299#ifdef __EMX__
     300      snwprintf(szBuf,
     301                256, // sizeof szBuf
     302                pBinding->pProtocol->szProtocol,
     303                pBinding->pLANA->lpszGUID,
     304                pBinding->pLANA->LANA);
     305#else
    294306      swprintf((wchar_t*)szBuf,
    295307               256, // sizeof szBuf
     
    297309               pBinding->pLANA->lpszGUID,
    298310               pBinding->pLANA->LANA);
    299      
     311#endif
     312
    300313      lpProtName = szBuf;
    301314    }
  • branches/gcc-kmk/src/ws2_32/ws2_32.def

    r21552 r21880  
    1818         
    1919EXPORTS
    20    accept                      = _accept@12                            @1
    21    bind                        = _bind@12                              @2
    22    closesocket                 = _closesocket@4                        @3
    23    connect                     = _connect@12                           @4
    24    getpeername                 = _getpeername@12                       @5
    25    getsockname                 = _getsockname@12                       @6
    26   getsockopt = _WS2getsockopt@20                   @7
    27    htonl                       = _htonl@4                              @8
    28    htons                       = _htons@4                              @9
    29    ioctlsocket                 = _ioctlsocket@12                       @10
    30    inet_addr                   = _inet_addr@4                          @11
    31    inet_ntoa                   = _inet_ntoa@4                          @12
    32    listen                      = _listen@8                             @13
    33    ntohl                       = _ntohl@4                              @14
    34    ntohs                       = _ntohs@4                              @15
    35    recv                        = _recv@16                              @16
    36    recvfrom                    = _recvfrom@24                          @17
    37    select                      = _select@20                            @18
    38    send                        = _send@16                              @19
    39    sendto                      = _sendto@24                            @20
    40   setsockopt = _WS2setsockopt@20                   @21
    41    shutdown                    = _shutdown@8                           @22
    42    socket                      = _socket@12                            @23
     20   accept                      = "_accept@12"                          @1
     21   bind                        = "_bind@12"                            @2
     22   closesocket                 = "_closesocket@4"                      @3
     23   connect                     = "_connect@12"                         @4
     24   getpeername                 = "_getpeername@12"                     @5
     25   getsockname                 = "_getsockname@12"                     @6
     26  getsockopt = "_WS2getsockopt@20"                 @7
     27   htonl                       = "_htonl@4"                            @8
     28   htons                       = "_htons@4"                            @9
     29   ioctlsocket                 = "_ioctlsocket@12"                     @10
     30   inet_addr                   = "_inet_addr@4"                        @11
     31   inet_ntoa                   = "_inet_ntoa@4"                        @12
     32   listen                      = "_listen@8"                           @13
     33   ntohl                       = "_ntohl@4"                            @14
     34   ntohs                       = "_ntohs@4"                            @15
     35   recv                        = "_recv@16"                            @16
     36   recvfrom                    = "_recvfrom@24"                        @17
     37   select                      = "_select@20"                          @18
     38   send                        = "_send@16"                            @19
     39   sendto                      = "_sendto@24"                          @20
     40  setsockopt = "_WS2setsockopt@20"                 @21
     41   shutdown                    = "_shutdown@8"                         @22
     42   socket                      = "_socket@12"                          @23
    4343
    4444; WSApSetPostRoutine                               @24
    4545; WPUCompleteOverlappedRequest                     @25
    46   WSAAccept = _WSAAccept@20                        @26
    47   WSAAddressToStringA  = _WSAAddressToStringA@20  @27
     46  WSAAccept = "_WSAAccept@20"                      @26
     47  WSAAddressToStringA  = "_WSAAddressToStringA@20" @27
    4848; WSAAddressToStringW                              @28
    4949
    50   WSACloseEvent = _WSACloseEvent@4                 @29
     50  WSACloseEvent = "_WSACloseEvent@4"               @29
    5151; WSAConnect                                       @30
    52   WSACreateEvent = _WSACreateEvent@0               @31
     52  WSACreateEvent = "_WSACreateEvent@0"             @31
    5353; WSADuplicateSocketA                              @32
    5454; WSADuplicateSocketW                              @33
    5555; WSAEnumNameSpaceProvidersA                       @34
    5656; WSAEnumNameSpaceProvidersW                       @35
    57   WSAEnumNetworkEvents = _WSAEnumNetworkEvents@12  @36
    58   WSAEnumProtocolsA = _WSAEnumProtocolsA@12        @37
    59   WSAEnumProtocolsW = _WSAEnumProtocolsW@12        @38
    60   WSAEventSelect    = _WSAEventSelect@12           @39
     57  WSAEnumNetworkEvents = "_WSAEnumNetworkEvents@12"  @36
     58  WSAEnumProtocolsA = "_WSAEnumProtocolsA@12"      @37
     59  WSAEnumProtocolsW = "_WSAEnumProtocolsW@12"      @38
     60  WSAEventSelect    = "_WSAEventSelect@12"         @39
    6161
    6262; WSAGetOverlappedResult                           @40
     
    7070; WSAInstallServiceClassA                          @48
    7171; WSAInstallServiceClassW                          @49
    72   WSAIoctl                    = _WSAIoctl@36       @50
     72  WSAIoctl                    = "_WSAIoctl@36"     @50
    7373
    74   gethostbyaddr               = _gethostbyaddr@12                     @51
    75   gethostbyname               = _gethostbyname@4                      @52
    76   gethostname                 = _gethostname@8                        @57
    77   getprotobyname              = _getprotobyname@4                     @53
    78   getprotobynumber            = _getprotobynumber@4                   @54
    79   getservbyname               = _getservbyname@8                      @55
    80   getservbyport               = _getservbyport@8                      @56
     74  gethostbyaddr               = "_gethostbyaddr@12"                   @51
     75  gethostbyname               = "_gethostbyname@4"                    @52
     76  gethostname                 = "_gethostname@8"                      @57
     77  getprotobyname              = "_getprotobyname@4"                   @53
     78  getprotobynumber            = "_getprotobynumber@4"                 @54
     79  getservbyname               = "_getservbyname@8"                    @55
     80  getservbyport               = "_getservbyport@8"                    @56
    8181
    8282; WSAJoinLeaf                                      @58
    83   WSALookupServiceBeginA      = _WSALookupServiceBeginA@12            @59
    84   WSALookupServiceBeginW      = _WSALookupServiceBeginW@12             @60
     83  WSALookupServiceBeginA      = "_WSALookupServiceBeginA@12"          @59
     84  WSALookupServiceBeginW      = "_WSALookupServiceBeginW@12"           @60
    8585; WSALookupServiceEnd                              @61
    8686; WSALookupServiceNextA                            @62
     
    8989; WSANtohs                                         @65
    9090; WSAProviderConfigChange                          @66
    91   WSARecv            = _WSARecv@28                 @67
     91  WSARecv            = "_WSARecv@28"               @67
    9292; WSARecvDisconnect                                @68
    93   WSARecvFrom        = _WSARecvFrom@36             @69
     93  WSARecvFrom        = "_WSARecvFrom@36"           @69
    9494; WSARemoveServiceClass                            @70
    95   WSAResetEvent      = _ResetEvent@4               @71
    96   WSASend            = _WSASend@28                 @72     
    97   WSASendDisconnect  = _WSASendDisconnect@8        @73
    98   WSASendTo          = _WSASendTo@36               @74
    99   WSASetEvent        = _WSASetEvent@4              @75
     95  WSAResetEvent      = "_ResetEvent@4"             @71
     96  WSASend            = "_WSASend@28"               @72     
     97  WSASendDisconnect  = "_WSASendDisconnect@8"      @73
     98  WSASendTo          = "_WSASendTo@36"             @74
     99  WSASetEvent        = "_WSASetEvent@4"            @75
    100100; WSASetServiceA                                   @76
    101101; WSASetServiceW                                   @77
    102   WSASocketA = _WSASocketA@24                      @78
    103   WSASocketW = _WSASocketW@24                      @79
     102  WSASocketA = "_WSASocketA@24"                    @78
     103  WSASocketW = "_WSASocketW@24"                    @79
    104104; WSAStringToAddressA                              @80
    105105; WSAStringToAddressW                              @81
    106   WSAWaitForMultipleEvents = _WaitForMultipleObjectsEx@20  @82
     106  WSAWaitForMultipleEvents = "_WaitForMultipleObjectsEx@20" @82
    107107; WSCDeinstallProvider                             @83
    108108; WSCEnableNSProvider                              @84
     
    115115; WSCWriteProviderOrder                            @91
    116116
    117   WSAAsyncSelect              = _WSAAsyncSelect@16                    @101
    118   WSAAsyncGetHostByAddr       = _WSAAsyncGetHostByAddr@28             @102
    119   WSAAsyncGetHostByName       = _WSAAsyncGetHostByName@20             @103
    120   WSAAsyncGetProtoByNumber    = _WSAAsyncGetProtoByNumber@20          @104
    121   WSAAsyncGetProtoByName      = _WSAAsyncGetProtoByName@20            @105
    122   WSAAsyncGetServByPort       = _WSAAsyncGetServByPort@24             @106
    123   WSAAsyncGetServByName       = _WSAAsyncGetServByName@24             @107
    124   WSACancelAsyncRequest       = _WSACancelAsyncRequest@4              @108
    125   WSASetBlockingHook          = _WSASetBlockingHook@4                 @109
    126   WSAUnhookBlockingHook       = _WSAUnhookBlockingHook@0              @110
    127   WSAGetLastError             = _WSAGetLastError@0                    @111
    128   WSASetLastError             = _WSASetLastError@4                    @112
    129   WSACancelBlockingCall       = _WSACancelBlockingCall@0              @113
    130   WSAIsBlocking               = _WSAIsBlocking@0                      @114
    131   WSAStartup                  = _WSAStartup@8                         @115
    132   WSACleanup                  = _WSACleanup@0                         @116
    133   __WSAFDIsSet                = ___WSAFDIsSet@8                       @151
     117  WSAAsyncSelect              = "_WSAAsyncSelect@16"                  @101
     118  WSAAsyncGetHostByAddr       = "_WSAAsyncGetHostByAddr@28"           @102
     119  WSAAsyncGetHostByName       = "_WSAAsyncGetHostByName@20"           @103
     120  WSAAsyncGetProtoByNumber    = "_WSAAsyncGetProtoByNumber@20"        @104
     121  WSAAsyncGetProtoByName      = "_WSAAsyncGetProtoByName@20"          @105
     122  WSAAsyncGetServByPort       = "_WSAAsyncGetServByPort@24"           @106
     123  WSAAsyncGetServByName       = "_WSAAsyncGetServByName@24"           @107
     124  WSACancelAsyncRequest       = "_WSACancelAsyncRequest@4"            @108
     125  WSASetBlockingHook          = "_WSASetBlockingHook@4"               @109
     126  WSAUnhookBlockingHook       = "_WSAUnhookBlockingHook@0"            @110
     127  WSAGetLastError             = "_WSAGetLastError@0"                  @111
     128  WSASetLastError             = "_WSASetLastError@4"                  @112
     129  WSACancelBlockingCall       = "_WSACancelBlockingCall@0"            @113
     130  WSAIsBlocking               = "_WSAIsBlocking@0"                    @114
     131  WSAStartup                  = "_WSAStartup@8"                       @115
     132  WSACleanup                  = "_WSACleanup@0"                       @116
     133  __WSAFDIsSet                = "___WSAFDIsSet@8"                     @151
    134134
    135135; WEP                                              @500
Note: See TracChangeset for help on using the changeset viewer.