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.

435 lines
6.7 KiB

  1. #include "netpch.h"
  2. #pragma hdrstop
  3. #define WINSOCK_API_LINKAGE
  4. #include <ws2spi.h>
  5. #define SWAP_LONG(l) \
  6. ( ( ((l) >> 24) & 0x000000FFL ) | \
  7. ( ((l) >> 8) & 0x0000FF00L ) | \
  8. ( ((l) << 8) & 0x00FF0000L ) | \
  9. ( ((l) << 24) & 0xFF000000L ) )
  10. #define WS_SWAP_SHORT(s) \
  11. ( ( ((s) >> 8) & 0x00FF ) | \
  12. ( ((s) << 8) & 0xFF00 ) )
  13. static
  14. WINSOCK_API_LINKAGE
  15. int
  16. WSAAPI
  17. WSAAddressToStringA(
  18. IN LPSOCKADDR lpsaAddress,
  19. IN DWORD dwAddressLength,
  20. IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
  21. IN OUT LPSTR lpszAddressString,
  22. IN OUT LPDWORD lpdwAddressStringLength
  23. )
  24. {
  25. return SOCKET_ERROR;
  26. }
  27. static
  28. int
  29. WSAAPI
  30. WSAAddressToStringW(
  31. IN LPSOCKADDR lpsaAddress,
  32. IN DWORD dwAddressLength,
  33. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  34. IN OUT LPWSTR lpszAddressString,
  35. IN OUT LPDWORD lpdwAddressStringLength
  36. )
  37. {
  38. return SOCKET_ERROR;
  39. }
  40. static
  41. int
  42. WSAAPI
  43. WSACleanup(
  44. void
  45. )
  46. {
  47. return SOCKET_ERROR;
  48. }
  49. static
  50. int
  51. WSAAPI
  52. WSAGetLastError(
  53. void
  54. )
  55. {
  56. return ERROR_MOD_NOT_FOUND;
  57. }
  58. static
  59. int
  60. WSAAPI
  61. WSAStartup(
  62. IN WORD wVersionRequested,
  63. OUT LPWSADATA lpWSAData
  64. )
  65. {
  66. return WSAEFAULT;
  67. }
  68. static
  69. int
  70. WSAAPI
  71. WSALookupServiceBeginW(
  72. IN LPWSAQUERYSETW lpqsRestrictions,
  73. IN DWORD dwControlFlags,
  74. OUT LPHANDLE lphLookup
  75. )
  76. {
  77. return SOCKET_ERROR;
  78. }
  79. static
  80. int
  81. WSAAPI
  82. WSALookupServiceNextW(
  83. IN HANDLE hLookup,
  84. IN DWORD dwControlFlags,
  85. IN OUT LPDWORD lpdwBufferLength,
  86. OUT LPWSAQUERYSETW lpqsResults
  87. )
  88. {
  89. return SOCKET_ERROR;
  90. }
  91. static
  92. int
  93. WSAAPI
  94. WSALookupServiceEnd(
  95. IN HANDLE hLookup
  96. )
  97. {
  98. return SOCKET_ERROR;
  99. }
  100. static
  101. int
  102. WSAAPI
  103. WSAStringToAddressW(
  104. IN LPWSTR AddressString,
  105. IN INT AddressFamily,
  106. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  107. OUT LPSOCKADDR lpAddress,
  108. IN OUT LPINT lpAddressLength
  109. )
  110. {
  111. return SOCKET_ERROR;
  112. }
  113. static
  114. int
  115. WSPAPI
  116. WSCDeinstallProvider(
  117. IN LPGUID lpProviderId,
  118. OUT LPINT lpErrno
  119. )
  120. {
  121. *lpErrno = WSAEFAULT;
  122. return SOCKET_ERROR;
  123. }
  124. static
  125. int
  126. WSPAPI
  127. WSCDeinstallProvider32(
  128. IN LPGUID lpProviderId,
  129. OUT LPINT lpErrno
  130. )
  131. {
  132. *lpErrno = WSAEFAULT;
  133. return SOCKET_ERROR;
  134. }
  135. static
  136. int
  137. WSPAPI
  138. WSCEnumProtocols(
  139. IN LPINT lpiProtocols,
  140. OUT LPWSAPROTOCOL_INFOW lpProtocolBuffer,
  141. IN OUT LPDWORD lpdwBufferLength,
  142. OUT LPINT lpErrno
  143. )
  144. {
  145. *lpErrno = WSAEFAULT;
  146. return SOCKET_ERROR;
  147. }
  148. static
  149. INT
  150. WSPAPI
  151. WSCInstallNameSpace (
  152. IN LPWSTR lpszIdentifier,
  153. IN LPWSTR lpszPathName,
  154. IN DWORD dwNameSpace,
  155. IN DWORD dwVersion,
  156. IN LPGUID lpProviderId
  157. )
  158. {
  159. return SOCKET_ERROR;
  160. }
  161. static
  162. INT
  163. WSPAPI
  164. WSCInstallNameSpace32 (
  165. IN LPWSTR lpszIdentifier,
  166. IN LPWSTR lpszPathName,
  167. IN DWORD dwNameSpace,
  168. IN DWORD dwVersion,
  169. IN LPGUID lpProviderId
  170. )
  171. {
  172. return SOCKET_ERROR;
  173. }
  174. static
  175. int
  176. WSPAPI
  177. WSCInstallProvider(
  178. IN LPGUID lpProviderId,
  179. IN const WCHAR FAR * lpszProviderDllPath,
  180. IN const LPWSAPROTOCOL_INFOW lpProtocolInfoList,
  181. IN DWORD dwNumberOfEntries,
  182. OUT LPINT lpErrno
  183. )
  184. {
  185. *lpErrno = WSAEFAULT;
  186. return SOCKET_ERROR;
  187. }
  188. static
  189. int
  190. WSPAPI
  191. WSCInstallProvider64_32(
  192. IN LPGUID lpProviderId,
  193. IN const WCHAR FAR * lpszProviderDllPath,
  194. IN const LPWSAPROTOCOL_INFOW lpProtocolInfoList,
  195. IN DWORD dwNumberOfEntries,
  196. OUT LPINT lpErrno
  197. )
  198. {
  199. *lpErrno = WSAEFAULT;
  200. return SOCKET_ERROR;
  201. }
  202. static
  203. INT
  204. WSPAPI
  205. WSCUnInstallNameSpace (
  206. IN LPGUID lpProviderId
  207. )
  208. {
  209. return SOCKET_ERROR;
  210. }
  211. static
  212. INT
  213. WSPAPI
  214. WSCUnInstallNameSpace32 (
  215. IN LPGUID lpProviderId
  216. )
  217. {
  218. return SOCKET_ERROR;
  219. }
  220. static
  221. int
  222. WSAAPI
  223. bind(
  224. IN SOCKET s,
  225. IN const struct sockaddr FAR * name,
  226. IN int namelen
  227. )
  228. {
  229. return SOCKET_ERROR;
  230. }
  231. static
  232. int
  233. WSAAPI
  234. connect(
  235. IN SOCKET s,
  236. IN const struct sockaddr FAR * name,
  237. IN int namelen
  238. )
  239. {
  240. return SOCKET_ERROR;
  241. }
  242. static
  243. int
  244. WSAAPI
  245. closesocket(
  246. IN SOCKET s
  247. )
  248. {
  249. return SOCKET_ERROR;
  250. }
  251. static
  252. struct hostent FAR *
  253. WSAAPI
  254. gethostbyname(
  255. IN const char FAR * name
  256. )
  257. {
  258. return NULL;
  259. }
  260. static
  261. int
  262. WSAAPI
  263. getsockname(
  264. IN SOCKET s,
  265. OUT struct sockaddr FAR * name,
  266. OUT int FAR * namelen
  267. )
  268. {
  269. return SOCKET_ERROR;
  270. }
  271. static
  272. int
  273. WSAAPI
  274. getsockopt(
  275. IN SOCKET s,
  276. IN int level,
  277. IN int optname,
  278. OUT char FAR * optval,
  279. IN OUT int FAR * optlen
  280. )
  281. {
  282. return SOCKET_ERROR;
  283. }
  284. static
  285. WINSOCK_API_LINKAGE
  286. u_long
  287. WSAAPI
  288. htonl(
  289. IN u_long hostlong
  290. )
  291. {
  292. return SWAP_LONG( hostlong );
  293. }
  294. static
  295. WINSOCK_API_LINKAGE
  296. u_short
  297. WSAAPI
  298. htons(
  299. IN u_short hostshort
  300. )
  301. {
  302. return WS_SWAP_SHORT( hostshort );
  303. }
  304. static
  305. unsigned long
  306. WSAAPI
  307. inet_addr(
  308. IN const char FAR * cp
  309. )
  310. {
  311. return INADDR_NONE;
  312. }
  313. static
  314. char FAR *
  315. WSAAPI
  316. inet_ntoa(
  317. IN struct in_addr in
  318. )
  319. {
  320. return NULL;
  321. }
  322. static
  323. u_long
  324. WSAAPI
  325. ntohl(
  326. IN u_long netlong
  327. )
  328. {
  329. return SWAP_LONG( netlong );
  330. }
  331. WINSOCK_API_LINKAGE
  332. u_short
  333. WSAAPI
  334. ntohs(
  335. IN u_short netshort
  336. )
  337. {
  338. return WS_SWAP_SHORT( netshort );
  339. }
  340. static
  341. SOCKET
  342. WSAAPI
  343. socket(
  344. IN int af,
  345. IN int type,
  346. IN int protocol
  347. )
  348. {
  349. return INVALID_SOCKET;
  350. }
  351. //
  352. // !! WARNING !! The entries below must be in order by ORDINAL
  353. //
  354. DEFINE_ORDINAL_ENTRIES(ws2_32)
  355. {
  356. DLOENTRY( 2, bind)
  357. DLOENTRY( 3, closesocket)
  358. DLOENTRY( 4, connect)
  359. DLOENTRY( 6, getsockname)
  360. DLOENTRY( 7, getsockopt)
  361. DLOENTRY( 8, htonl)
  362. DLOENTRY( 9, htons)
  363. DLOENTRY( 11, inet_addr)
  364. DLOENTRY( 12, inet_ntoa)
  365. DLOENTRY( 14, ntohl)
  366. DLOENTRY( 15, ntohs)
  367. DLOENTRY( 23, socket)
  368. DLOENTRY( 52, gethostbyname)
  369. DLOENTRY(111, WSAGetLastError)
  370. DLOENTRY(115, WSAStartup)
  371. DLOENTRY(116, WSACleanup)
  372. };
  373. DEFINE_ORDINAL_MAP(ws2_32);
  374. //
  375. // !! WARNING !! The entries below must be in alphabetical order, and are CASE SENSITIVE (eg lower case comes last!)
  376. //
  377. DEFINE_PROCNAME_ENTRIES(ws2_32)
  378. {
  379. DLPENTRY(WSAAddressToStringA)
  380. DLPENTRY(WSAAddressToStringW)
  381. DLPENTRY(WSALookupServiceBeginW)
  382. DLPENTRY(WSALookupServiceEnd)
  383. DLPENTRY(WSALookupServiceNextW)
  384. DLPENTRY(WSAStringToAddressW)
  385. DLPENTRY(WSCDeinstallProvider)
  386. DLPENTRY(WSCDeinstallProvider32)
  387. DLPENTRY(WSCEnumProtocols)
  388. DLPENTRY(WSCInstallNameSpace)
  389. DLPENTRY(WSCInstallNameSpace32)
  390. DLPENTRY(WSCInstallProvider)
  391. DLPENTRY(WSCInstallProvider64_32)
  392. DLPENTRY(WSCUnInstallNameSpace)
  393. DLPENTRY(WSCUnInstallNameSpace32)
  394. };
  395. DEFINE_PROCNAME_MAP(ws2_32)