source: trunk/src/wsock32/notify.cpp@ 51

Last change on this file since 51 was 51, checked in by sandervl, 26 years ago

* empty log message *

File size: 1.7 KB
Line 
1/*
2 *
3 * Project Odin Software License can be found in LICENSE.TXT
4 *
5 */
6/*
7 * Winsock code
8 *
9 * Copyright 1998 Vince Vielhaber
10 *
11 */
12
13
14#include <os2win.h>
15//#include <wsock32.h>
16#include "misc.h"
17
18typedef unsigned int u_int;
19typedef u_int SOCKET;
20
21typedef unsigned long TID;
22
23typedef struct AsyncStatus {
24 HWND hwnd; // owner's hwindow
25 u_int msg; // message to send when event occurs
26 ULONG event; // event that may occur
27 SOCKET socket; // the socket
28 int status; // blocking yes/no
29 TID threadID; // Thread ID for async
30 int MsgStat; // has message been sent yet?
31 struct AsyncStatus *Next; // pointer to next AsyncStatus in the list
32 struct AsyncStatus *Prev; // pointer to previous AsyncStatus in the list
33} AsyncStatus;
34
35
36
37/*
38 * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
39 * when constructing the response to WSAAsyncSelect().
40 */
41//#define OS2WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
42#ifdef MAKELONG
43#undef MAKELONG
44#endif
45#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
46#define OS2WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
47
48int Notify(AsyncStatus *as, int event)
49{
50int rc;
51
52#ifdef DEBUG
53 WriteLog("WSOCK32: Open32 Notifying %x, %x, %d\n",
54 (HWND)as->hwnd,as->msg,(int)as->socket);
55#endif
56
57 rc = PostMessageA(as->hwnd,as->msg,as->socket,OS2WSAMAKESELECTREPLY(event,0));
58
59return rc;
60}
61
62// WPARAM is UINT, LPARAM is LONG
63
64int NotifyWSA(HWND hw,u_int msg,UINT wp,LONG lp)
65{
66int rc;
67
68#ifdef DEBUG
69 WriteLog("WSOCK32: Open32 WSA-Notifying %x, %x\n",
70 (HWND)hw,msg);
71#endif
72
73 rc = PostMessageA(hw,msg,(WPARAM)wp,(LPARAM)lp);
74
75return rc;
76
77}
78
79
Note: See TracBrowser for help on using the repository browser.