- Timestamp:
- Dec 2, 1999, 4:22:05 PM (26 years ago)
- Location:
- trunk/src/wsock32/new
- Files:
-
- 3 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 phallerExp $ */1 /* $Id: relaywin.cpp,v 1.4 1999-12-02 15:22:05 achimha Exp $ */ 2 2 3 3 /* … … 38 38 #include "relaywin.h" 39 39 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 40 47 ODINDEBUGCHANNEL(WSOCK32-RELAYWIN) 41 48 … … 53 60 54 61 // prototype for PostMessageA 55 //BOOL _Stdcall PostMessageA(HWND,UINT,WPARAM,LPARAM);56 62 BOOL __stdcall PostMessageA(HWND,UINT,ULONG,ULONG); 57 63 … … 69 75 *****************************************************************************/ 70 76 71 ULONG RelayAlloc(HWND hwnd, ULONG ulMsg) 77 ULONG RelayAlloc(HWND hwnd, ULONG ulMsg, ULONG ulRequestType, 78 PVOID pvUserData1, PVOID pvUserData2) 72 79 { 73 80 ULONG ulCounter; … … 82 89 arrHwndMsgPair[ulCounter].hwnd = hwnd; 83 90 arrHwndMsgPair[ulCounter].ulMsg = ulMsg; 91 arrHwndMsgPair[ulCounter].ulRequestType = ulRequestType; 92 arrHwndMsgPair[ulCounter].pvUserData1 = pvUserData1; 93 arrHwndMsgPair[ulCounter].pvUserData2 = pvUserData2; 84 94 return ulCounter; // return "id" 85 95 } … … 190 200 // WinDefWindowProc() 191 201 192 //@@@PH: 1999/11/31 PROBLEM193 // hwnd and ulMsg passed in have been converted by our USER32 code194 // here, we ultimatively need to translate it back.195 // under the debugger, things WORK now !:)196 197 202 pHM = RelayQuery(ulMsg); // find registered message 198 203 if (pHM != NULL) // message pair found 199 204 { 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 222 dprintf(("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)); 200 227 PostMessageA(pHM->hwnd, 201 228 pHM->ulMsg, -
trunk/src/wsock32/new/relaywin.h
r1933 r1940 1 /* $Id: relaywin.h,v 1. 2 1999-12-02 07:47:26 phallerExp $ */1 /* $Id: relaywin.h,v 1.3 1999-12-02 15:22:05 achimha Exp $ */ 2 2 3 3 /* … … 36 36 *****************************************************************************/ 37 37 38 /* these are the request types so we can interpret the messages and convert the results */ 39 #define ASYNCREQUEST_SELECT 0 40 #define ASYNCREQUEST_GETHOSTBYNAME 1 41 38 42 typedef struct tagHwndMsgPair 39 43 { 40 44 HWND hwnd; /* target window */ 41 45 ULONG ulMsg; /* the message code to send */ 46 ULONG ulRequestType; /* the type of request that this belongs to */ 47 PVOID pvUserData1; /* request specific data field */ 48 PVOID pvUserData2; /* request specific data field */ 42 49 } HWNDMSGPAIR, *PHWNDMSGPAIR; 43 50 … … 46 53 *****************************************************************************/ 47 54 48 ULONG RelayAlloc (HWND hwnd, ULONG ulMsg); 55 ULONG RelayAlloc(HWND hwnd, ULONG ulMsg, ULONG ulRequestType, 56 PVOID pvUserData1 = 0, PVOID pvUserData2 = 0); 49 57 ULONG RelayFree (ULONG ulID); 50 58 ULONG RelayFreeByHwnd(HWND hwnd); -
trunk/src/wsock32/new/wsock32.cpp
r1934 r1940 1 /* $Id: wsock32.cpp,v 1. 8 1999-12-02 07:58:54 phallerExp $ */1 /* $Id: wsock32.cpp,v 1.9 1999-12-02 15:22:05 achimha Exp $ */ 2 2 3 3 /* … … 63 63 static WSOCKTHREADDATA wstdFallthru; // for emergency only 64 64 65 static HWND hwndRelay; // handle to our relay window 65 66 66 67 /***************************************************************************** … … 1268 1269 int,buflen) 1269 1270 { 1270 return(WSAAsyncGetHostByName(hWnd, 1271 wMsg, 1272 name, 1273 buf, 1274 buflen)); 1271 int rc; 1272 HWND hwndOS2 = Win32ToOS2Handle(hWnd); 1273 ULONG ulNewID; 1274 char *OS2Hostent = (char*)malloc(MAXGETHOSTSTRUCT); 1275 1276 if (hwndRelay == NULL) // already initialized ? 1277 hwndRelay = RelayInitialize(hwndOS2); 1278 1279 // TODO: Is this the original behaviour? 1280 if ((name == NULL) || (buf == NULL)) 1281 { 1282 // remove entry from list 1283 RelayFreeByHwnd(hWnd); 1284 } 1285 else 1286 // add entry to list, we need to store both our temp buffer and the apps buffer 1287 ulNewID = RelayAlloc(hWnd, wMsg, ASYNCREQUEST_GETHOSTBYNAME, buf, OS2Hostent); 1288 1289 // call pmwsock function, will fill our temp buffer 1290 rc = WSAAsyncGetHostByName(hwndRelay, 1291 ulNewID, 1292 name, 1293 OS2Hostent, 1294 buflen); 1295 1296 return rc; 1275 1297 } 1276 1298 … … 1349 1371 ULONG ulNewID; 1350 1372 1351 static HWND hwndRelay; // handle to our relay window1352 1353 1373 if (hwndRelay == NULL) // already initialized ? 1354 1374 hwndRelay = RelayInitialize(hwndOS2); … … 1380 1400 else 1381 1401 // add entry to list 1382 ulNewID = RelayAlloc(hWnd, wMsg );1402 ulNewID = RelayAlloc(hWnd, wMsg, ASYNCREQUEST_SELECT); 1383 1403 1384 1404 rc = WSAAsyncSelect(s,
Note:
See TracChangeset
for help on using the changeset viewer.