Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

485 lines
8.6 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. sockeye.h
  5. Abstract:
  6. Header file for the winsock browser util
  7. Author:
  8. Dan Knudson (DanKn) 29-Jul-1996
  9. Revision History:
  10. --*/
  11. #include "windows.h"
  12. #include "winsock2.h"
  13. #include "ws2spi.h"
  14. //
  15. // Symbolic constants
  16. //
  17. #define DS_NONZEROFIELDS 0x00000001
  18. #define DS_ZEROFIELDS 0x00000002
  19. #define DS_BYTEDUMP 0x00000004
  20. #define WT_SOCKET 1
  21. #define PT_DWORD 1
  22. #define PT_FLAGS 2
  23. #define PT_POINTER 3
  24. #define PT_STRING 4
  25. #define PT_ORDINAL 5
  26. #define PT_WSAPROTOCOLINFO 6
  27. #define PT_QOS 7
  28. #define PT_PTRNOEDIT 8
  29. #define FT_DWORD 1
  30. #define FT_FLAGS 2
  31. #define FT_ORD 3
  32. #define FT_SIZE 4
  33. #define FT_OFFSET 5
  34. #define MAX_STRING_PARAM_SIZE 96
  35. #define MAX_USER_BUTTONS 6
  36. #define MAX_USER_BUTTON_TEXT_SIZE 8
  37. #define TABSIZE 4
  38. #define WM_ASYNCREQUESTCOMPLETED WM_USER+0x55
  39. #define WM_NETWORKEVENT WM_USER+0x56
  40. //
  41. //
  42. //
  43. typedef LONG (WSAAPI *PFN0)(void);
  44. typedef LONG (WSAAPI *PFN1)(ULONG_PTR);
  45. typedef LONG (WSAAPI *PFN2)(ULONG_PTR, ULONG_PTR);
  46. typedef LONG (WSAAPI *PFN3)(ULONG_PTR, ULONG_PTR, ULONG_PTR);
  47. typedef LONG (WSAAPI *PFN4)(ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR);
  48. typedef LONG (WSAAPI *PFN5)(ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  49. ULONG_PTR);
  50. typedef LONG (WSAAPI *PFN6)(ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  51. ULONG_PTR, ULONG_PTR);
  52. typedef LONG (WSAAPI *PFN7)(ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  53. ULONG_PTR, ULONG_PTR, ULONG_PTR);
  54. typedef LONG (WSAAPI *PFN8)(ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  55. ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR);
  56. typedef LONG (WSAAPI *PFN9)(ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  57. ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  58. ULONG_PTR);
  59. typedef LONG (WSAAPI *PFN10)(ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  60. ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  61. ULONG_PTR, ULONG_PTR);
  62. typedef LONG (WSAAPI *PFN12)(ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  63. ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR,
  64. ULONG_PTR, ULONG_PTR, ULONG_PTR, ULONG_PTR);
  65. typedef struct _MYSOCKET
  66. {
  67. SOCKET Sock;
  68. BOOL bWSASocket;
  69. DWORD dwAddressFamily;
  70. DWORD dwSocketType;
  71. DWORD dwFlags;
  72. } MYSOCKET, *PMYSOCKET;
  73. typedef struct _LOOKUP
  74. {
  75. DWORD dwVal;
  76. char *lpszVal;
  77. } LOOKUP, *PLOOKUP;
  78. typedef enum
  79. {
  80. ws_accept,
  81. ws_bind,
  82. ws_closesocket,
  83. ws_connect,
  84. ws_gethostbyaddr,
  85. ws_gethostbyname,
  86. ws_gethostname,
  87. ws_getpeername,
  88. ws_getprotobyname,
  89. ws_getprotobynumber,
  90. ws_getservbyname,
  91. ws_getservbyport,
  92. ws_getsockname,
  93. ws_getsockopt,
  94. ws_htonl,
  95. ws_htons,
  96. ws_inet_addr,
  97. ws_inet_ntoa,
  98. ws_ioctlsocket,
  99. ws_listen,
  100. ws_ntohl,
  101. ws_ntohs,
  102. ws_recv,
  103. ws_recvfrom,
  104. ws_select,
  105. ws_send,
  106. ws_sendto,
  107. ws_setsockopt,
  108. ws_shutdown,
  109. ws_socket,
  110. ws_WSAAccept,
  111. ws_WSAAddressToStringA,
  112. ws_WSAAddressToStringW,
  113. ws_WSAAsyncGetHostByAddr,
  114. ws_WSAAsyncGetHostByName,
  115. ws_WSAAsyncGetProtoByName,
  116. ws_WSAAsyncGetProtoByNumber,
  117. ws_WSAAsyncGetServByName,
  118. ws_WSAAsyncGetServByPort,
  119. ws_WSAAsyncSelect,
  120. ws_WSACancelAsyncRequest,
  121. // ws_WSACancelBlockingCall,
  122. ws_WSACleanup,
  123. ws_WSACloseEvent,
  124. ws_WSAConnect,
  125. ws_WSACreateEvent,
  126. ws_WSADuplicateSocketA,
  127. ws_WSADuplicateSocketW,
  128. ws_WSAEnumNameSpaceProvidersA,
  129. ws_WSAEnumNameSpaceProvidersW,
  130. ws_WSAEnumNetworkEvents,
  131. ws_WSAEnumProtocolsA,
  132. ws_WSAEnumProtocolsW,
  133. ws_WSAEventSelect,
  134. ws_WSAGetLastError,
  135. ws_WSAGetOverlappedResult,
  136. ws_WSAGetQOSByName,
  137. ws_WSAGetServiceClassInfoA,
  138. ws_WSAGetServiceClassInfoW,
  139. ws_WSAGetServiceClassNameByClassIdA,
  140. ws_WSAGetServiceClassNameByClassIdW,
  141. ws_WSAHtonl,
  142. ws_WSAHtons,
  143. ws_WSAInstallServiceClassA,
  144. ws_WSAInstallServiceClassW,
  145. ws_WSAIoctl,
  146. // ws_WSAIsBlocking,
  147. ws_WSAJoinLeaf,
  148. ws_WSALookupServiceBeginA,
  149. ws_WSALookupServiceBeginW,
  150. ws_WSALookupServiceEnd,
  151. ws_WSALookupServiceNextA,
  152. ws_WSALookupServiceNextW,
  153. ws_WSANtohl,
  154. ws_WSANtohs,
  155. ws_WSARecv,
  156. ws_WSARecvDisconnect,
  157. ws_WSARecvFrom,
  158. ws_WSARemoveServiceClass,
  159. ws_WSAResetEvent,
  160. ws_WSASend,
  161. ws_WSASendDisconnect,
  162. ws_WSASendTo,
  163. // ws_WSASetBlockingHook,
  164. ws_WSASetEvent,
  165. ws_WSASetLastError,
  166. ws_WSASetServiceA,
  167. ws_WSASetServiceW,
  168. ws_WSASocketA,
  169. ws_WSASocketW,
  170. ws_WSAStartup,
  171. ws_WSAStringToAddressA,
  172. ws_WSAStringToAddressW,
  173. // ws_WSAUnhookBlockingHook,
  174. ws_WSAWaitForMultipleEvents,
  175. ws_WSCEnumProtocols,
  176. ws_WSCGetProviderPath,
  177. ws_EnumProtocolsA,
  178. ws_EnumProtocolsW,
  179. ws_GetAddressByNameA,
  180. ws_GetAddressByNameW,
  181. ws_GetNameByTypeA,
  182. ws_GetNameByTypeW,
  183. ws_GetServiceA,
  184. ws_GetServiceW,
  185. ws_GetTypeByNameA,
  186. ws_GetTypeByNameW,
  187. ws_SetServiceA,
  188. ws_SetServiceW,
  189. // CloseHandl,
  190. // DumpBuffer,
  191. MiscBegin,
  192. DefValues,
  193. WSAProtoInfo,
  194. ws_QOS
  195. } FUNC_INDEX;
  196. typedef struct _MYOVERLAPPED
  197. {
  198. WSAOVERLAPPED WSAOverlapped;
  199. FUNC_INDEX FuncIndex;
  200. DWORD dwFuncSpecific1;
  201. } MYOVERLAPPED, *PMYOVERLAPPED;
  202. typedef struct _FUNC_PARAM
  203. {
  204. char far *szName;
  205. DWORD dwType;
  206. ULONG_PTR dwValue;
  207. union
  208. {
  209. LPVOID pLookup;
  210. char far *buf;
  211. LPVOID ptr;
  212. ULONG_PTR dwDefValue;
  213. } u;
  214. } FUNC_PARAM, *PFUNC_PARAM;
  215. typedef struct _FUNC_PARAM_HEADER
  216. {
  217. DWORD dwNumParams;
  218. FUNC_INDEX FuncIndex;
  219. PFUNC_PARAM aParams;
  220. union
  221. {
  222. PFN0 pfn0;
  223. PFN1 pfn1;
  224. PFN2 pfn2;
  225. PFN3 pfn3;
  226. PFN4 pfn4;
  227. PFN5 pfn5;
  228. PFN6 pfn6;
  229. PFN7 pfn7;
  230. PFN8 pfn8;
  231. PFN9 pfn9;
  232. PFN10 pfn10;
  233. PFN12 pfn12;
  234. } u;
  235. } FUNC_PARAM_HEADER, *PFUNC_PARAM_HEADER;
  236. typedef struct _STRUCT_FIELD
  237. {
  238. char far *szName;
  239. DWORD dwType;
  240. DWORD dwValue;
  241. LPVOID pLookup;
  242. } STRUCT_FIELD, *PSTRUCT_FIELD;
  243. typedef struct _STRUCT_FIELD_HEADER
  244. {
  245. LPVOID pStruct;
  246. char far *szName;
  247. DWORD dwNumFields;
  248. PSTRUCT_FIELD aFields;
  249. } STRUCT_FIELD_HEADER, *PSTRUCT_FIELD_HEADER;
  250. typedef struct _ASYNC_REQUEST_INFO
  251. {
  252. HANDLE hRequest;
  253. char FAR *pszFuncName;
  254. FUNC_INDEX FuncIndex;
  255. struct _ASYNC_REQUEST_INFO *pPrev;
  256. struct _ASYNC_REQUEST_INFO *pNext;
  257. } ASYNC_REQUEST_INFO, *PASYNC_REQUEST_INFO;
  258. //
  259. // Func prototypes
  260. //
  261. INT_PTR
  262. CALLBACK
  263. MainWndProc(
  264. HWND hwnd,
  265. UINT msg,
  266. WPARAM wParam,
  267. LPARAM lParam
  268. );
  269. void
  270. FAR
  271. ShowStr(
  272. LPCSTR format,
  273. ...
  274. );
  275. INT_PTR
  276. CALLBACK
  277. ParamsDlgProc(
  278. HWND hwnd,
  279. UINT msg,
  280. WPARAM wParam,
  281. LPARAM lParam
  282. );
  283. INT_PTR
  284. CALLBACK
  285. AboutDlgProc(
  286. HWND hwnd,
  287. UINT msg,
  288. WPARAM wParam,
  289. LPARAM lParam
  290. );
  291. INT_PTR
  292. CALLBACK
  293. IconDlgProc(
  294. HWND hwnd,
  295. UINT msg,
  296. WPARAM wParam,
  297. LPARAM lParam
  298. );
  299. LONG
  300. DoFunc(
  301. PFUNC_PARAM_HEADER pHeader
  302. );
  303. BOOL
  304. LetUserMungeParams(
  305. PFUNC_PARAM_HEADER pParamsHeader
  306. );
  307. void
  308. ShowLineFuncResult(
  309. LPSTR lpFuncName,
  310. LONG lResult
  311. );
  312. void
  313. FuncDriver(
  314. FUNC_INDEX funcIndex
  315. );
  316. INT_PTR
  317. CALLBACK
  318. UserButtonsDlgProc(
  319. HWND hwnd,
  320. UINT msg,
  321. WPARAM wParam,
  322. LPARAM lParam
  323. );
  324. void
  325. FAR
  326. ShowHostEnt(
  327. struct hostent *phe
  328. );
  329. void
  330. FAR
  331. ShowProtoEnt(
  332. struct protoent *ppe
  333. );
  334. void
  335. FAR
  336. ShowServEnt(
  337. struct servent *pse
  338. );
  339. void
  340. PASCAL
  341. QueueAsyncRequestInfo(
  342. PASYNC_REQUEST_INFO pAsyncReqInfo
  343. );
  344. PASYNC_REQUEST_INFO
  345. PASCAL
  346. DequeueAsyncRequestInfo(
  347. HANDLE hRequest
  348. );
  349. void
  350. PASCAL
  351. ShowBytes(
  352. DWORD dwSize,
  353. LPVOID lp,
  354. DWORD dwNumTabs
  355. );
  356. void
  357. PASCAL
  358. ShowFlags(
  359. DWORD dwValue,
  360. char FAR *pszValueName,
  361. PLOOKUP pLookup
  362. );
  363. void
  364. UpdateResults(
  365. BOOL bBegin
  366. );
  367. LPSTR
  368. PASCAL
  369. GetStringFromOrdinalValue(
  370. DWORD dwValue,
  371. PLOOKUP pLookup
  372. );
  373. VOID
  374. PASCAL
  375. ShowProtoInfo(
  376. LPWSAPROTOCOL_INFOA pInfo,
  377. DWORD dwIndex,
  378. BOOL bAscii
  379. );