Changeset 1908 for trunk/src


Ignore:
Timestamp:
Dec 1, 1999, 2:13:57 AM (26 years ago)
Author:
phaller
Message:

Fix: relay window implemented

Location:
trunk/src/wsock32/new
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wsock32/new/makefile

    r1882 r1908  
    1 # $Id: makefile,v 1.4 1999-11-29 22:31:50 phaller Exp $
     1# $Id: makefile,v 1.5 1999-12-01 01:10:54 phaller Exp $
    22
    33#
     
    2121TARGET = wsock32
    2222
    23 OBJS =  wsock32.obj initterm.obj unknown.obj
     23OBJS =  wsock32.obj initterm.obj unknown.obj relaywin.obj
    2424
    2525all: $(TARGET).dll $(TARGET).lib
     
    4343unknown.obj: unknown.cpp
    4444initterm.obj: initterm.cpp
     45relaywin.obj: relaywin.cpp
    4546
    4647
  • trunk/src/wsock32/new/wsock32.cpp

    r1881 r1908  
    1 /* $Id: wsock32.cpp,v 1.5 1999-11-29 22:23:07 phaller Exp $ */
     1/* $Id: wsock32.cpp,v 1.6 1999-12-01 01:10:55 phaller Exp $ */
    22
    33/*
     
    4646
    4747#include "wsock32.h"
     48#include "relaywin.h"
    4849
    4950
     
    590591              int *,fromlen)
    591592{
    592  
     593
    593594  return(recvfrom(s,
    594595                buf,
     
    795796  xx = gethostbyaddr((char *)addr,len,type);
    796797  //PH: we assume PMWSOCK sets WSASetLastError correctly!
    797  
     798
    798799  if(xx == NULL)
    799800     return (WHOSTENT *)NULL;
     
    834835  xx = gethostbyname((char *)name);
    835836  //PH: we assume PMWSOCK sets WSASetLastError correctly!
    836  
     837
    837838  if(xx == NULL)
    838839    return (WHOSTENT *)NULL;
     
    13411342              long,lEvent)
    13421343{
    1343   int rc;
    1344   int iError;
    1345   HWND hwndOS2;
    1346  
     1344  int   rc;
     1345  int   iError;
     1346  HWND  hwndOS2 = Win32ToOS2Handle(hWnd);
     1347  ULONG ulNewID;
     1348
     1349  static HWND hwndRelay; // handle to our relay window
     1350
     1351  if (hwndRelay == NULL) // already initialized ?
     1352    hwndRelay = RelayInitialize(hwndOS2);
     1353
    13471354  /* @@@PH: our source window doesn't seem to have an anchor block.
    13481355            Docs suggest we've missed to call WinInitialize on the
    13491356            caller thread.
    1350            
     1357
    13511358            Cause however is the Open32 handle is (of course!) invalid
    13521359            in plain PM Window Manager! -> use DAPWSOCK
    1353            
     1360
    13541361            Unfortunately, DAPWSOCK calls WinQueryAnchorBlock(hOpen32), too.
    13551362            So, we're stuck until I resolve hWnd to it's valid PM
    13561363            counterpart.
     1364
     1365            new problem: we've ultimately got to use PostMessageA instead
     1366            anything else. => create invisible msg relay window:
     1367            - hMsg = registerMessage(hWnd, wMsg)
     1368            - call WSAAsyncSelect with object window handle
     1369            - overwrite hWnd relay for "same handles"
    13571370   */
    1358  
    1359   hwndOS2 = Win32ToOS2Handle(hWnd);
    1360  
     1371
     1372  // add event to list or remove any list entry in case of WSAAsyncSelect(hwnd,0,0)
     1373  if ( (wMsg == 0) && (lEvent == 0) )
     1374  {
     1375    // remove entry from list
     1376    RelayFreeByHwnd(hWnd);
     1377  }
     1378  else
     1379    // add entry to list
     1380    ulNewID = RelayAlloc(hWnd, wMsg);
     1381
    13611382  rc = WSAAsyncSelect(s,
    1362                       hwndOS2,
    1363                       wMsg,
     1383                      hwndRelay,
     1384                      ulNewID,
    13641385                      lEvent);
    13651386
Note: See TracChangeset for help on using the changeset viewer.