Ignore:
Timestamp:
Dec 2, 1999, 4:22:05 PM (26 years ago)
Author:
achimha
Message:

async wsock fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wsock32/new/relaywin.cpp

    r1933 r1940  
    1 /* $Id: relaywin.cpp,v 1.3 1999-12-02 07:47:26 phaller Exp $ */
     1/* $Id: relaywin.cpp,v 1.4 1999-12-02 15:22:05 achimha Exp $ */
    22
    33/*
     
    3838#include "relaywin.h"
    3939
     40#include <pmwsock.h>
     41#include <os2sel.h>
     42#include <wprocess.h>
     43#include <heapstring.h>
     44#include <win32wnd.h>
     45#include "wsock32.h"
     46
    4047ODINDEBUGCHANNEL(WSOCK32-RELAYWIN)
    4148
     
    5360
    5461// prototype for PostMessageA
    55 //BOOL _Stdcall PostMessageA(HWND,UINT,WPARAM,LPARAM);
    5662BOOL __stdcall PostMessageA(HWND,UINT,ULONG,ULONG);
    5763
     
    6975 *****************************************************************************/
    7076
    71 ULONG RelayAlloc(HWND hwnd, ULONG ulMsg)
     77ULONG RelayAlloc(HWND hwnd, ULONG ulMsg, ULONG ulRequestType,
     78                 PVOID pvUserData1, PVOID pvUserData2)
    7279{
    7380  ULONG ulCounter;
     
    8289      arrHwndMsgPair[ulCounter].hwnd  = hwnd;
    8390      arrHwndMsgPair[ulCounter].ulMsg = ulMsg;
     91      arrHwndMsgPair[ulCounter].ulRequestType = ulRequestType;
     92      arrHwndMsgPair[ulCounter].pvUserData1 = pvUserData1;
     93      arrHwndMsgPair[ulCounter].pvUserData2 = pvUserData2;
    8494      return ulCounter; // return "id"
    8595    }
     
    190200  //   WinDefWindowProc()
    191201 
    192   //@@@PH: 1999/11/31 PROBLEM
    193   // hwnd and ulMsg passed in have been converted by our USER32 code
    194   // here, we ultimatively need to translate it back.
    195   // under the debugger, things WORK now !:)
    196  
    197202  pHM = RelayQuery(ulMsg);                          // find registered message
    198203  if (pHM != NULL)                                  // message pair found
    199204  {
     205    /* check request type for special handling */
     206    if (pHM->ulRequestType == ASYNCREQUEST_GETHOSTBYNAME)
     207    {
     208      dprintf(("WSOCK32:RelayWindowProc, Converting hostent for WSAAyncGetHostByName\n"));
     209      /* we need to convert the hostent structure here */
     210      Whostent *WinHostent = (Whostent*)pHM->pvUserData1;
     211      hostent *OS2Hostent = (hostent*)pHM->pvUserData2;
     212      WinHostent->h_name = OS2Hostent->h_name;
     213      WinHostent->h_aliases = OS2Hostent->h_aliases;
     214      WinHostent->h_addrtype = (short)OS2Hostent->h_addrtype;
     215      WinHostent->h_length = (short)OS2Hostent->h_length;
     216      WinHostent->h_addr_list = OS2Hostent->h_addr_list;
     217      /* free our temporary OS2 hostent buffer */
     218//TODO: how can we free this? we will end up with a memory leak :(
     219// this memory block not only contains the hostent structure but also the strings it points to
     220//      free(pHM->pvUserData2);
     221
     222dprintf(("Size of Window hostent: %d, OS/2 hostent: %d, mp1: %d, mp2 %d\n", sizeof(Whostent), sizeof(hostent), mp1, mp2));
     223
     224    }
     225
     226    dprintf(("WSOCK32:RelayWinProc, Posting %d to %d\n", pHM->ulMsg, pHM->hwnd));
    200227    PostMessageA(pHM->hwnd,
    201228                 pHM->ulMsg,
Note: See TracChangeset for help on using the changeset viewer.