Leaked source code of windows server 2003
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.

564 lines
9.3 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. getpeername(
  18. IN SOCKET s,
  19. OUT struct sockaddr FAR * name,
  20. IN OUT int FAR * namelen
  21. )
  22. {
  23. return SOCKET_ERROR;
  24. }
  25. static
  26. WINSOCK_API_LINKAGE
  27. int
  28. WSAAPI
  29. WSAAddressToStringA(
  30. IN LPSOCKADDR lpsaAddress,
  31. IN DWORD dwAddressLength,
  32. IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
  33. IN OUT LPSTR lpszAddressString,
  34. IN OUT LPDWORD lpdwAddressStringLength
  35. )
  36. {
  37. return SOCKET_ERROR;
  38. }
  39. static
  40. int
  41. WSAAPI
  42. WSAAddressToStringW(
  43. IN LPSOCKADDR lpsaAddress,
  44. IN DWORD dwAddressLength,
  45. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  46. IN OUT LPWSTR lpszAddressString,
  47. IN OUT LPDWORD lpdwAddressStringLength
  48. )
  49. {
  50. return SOCKET_ERROR;
  51. }
  52. static
  53. int
  54. WSAAPI
  55. WSACleanup(
  56. void
  57. )
  58. {
  59. return SOCKET_ERROR;
  60. }
  61. static
  62. WINSOCK_API_LINKAGE
  63. int
  64. WSAAPI
  65. WSAEnumProtocolsW(
  66. IN LPINT lpiProtocols,
  67. OUT LPWSAPROTOCOL_INFOW lpProtocolBuffer,
  68. IN OUT LPDWORD lpdwBufferLength
  69. )
  70. {
  71. return SOCKET_ERROR;
  72. }
  73. static
  74. int
  75. WSAEventSelect(
  76. SOCKET s,
  77. WSAEVENT hEventObject,
  78. long lNetworkEvents
  79. )
  80. {
  81. return SOCKET_ERROR;
  82. }
  83. static
  84. int
  85. WSAAPI
  86. WSAGetLastError(
  87. void
  88. )
  89. {
  90. return ERROR_MOD_NOT_FOUND;
  91. }
  92. static
  93. WINSOCK_API_LINKAGE
  94. int
  95. WSAAPI
  96. WSAIoctl(
  97. IN SOCKET s,
  98. IN DWORD dwIoControlCode,
  99. IN LPVOID lpvInBuffer,
  100. IN DWORD cbInBuffer,
  101. OUT LPVOID lpvOutBuffer,
  102. IN DWORD cbOutBuffer,
  103. OUT LPDWORD lpcbBytesReturned,
  104. IN LPWSAOVERLAPPED lpOverlapped,
  105. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  106. )
  107. {
  108. return SOCKET_ERROR;
  109. }
  110. static
  111. int
  112. WSAAPI
  113. WSALookupServiceBeginW(
  114. IN LPWSAQUERYSETW lpqsRestrictions,
  115. IN DWORD dwControlFlags,
  116. OUT LPHANDLE lphLookup
  117. )
  118. {
  119. return SOCKET_ERROR;
  120. }
  121. static
  122. int
  123. WSAAPI
  124. WSALookupServiceNextW(
  125. IN HANDLE hLookup,
  126. IN DWORD dwControlFlags,
  127. IN OUT LPDWORD lpdwBufferLength,
  128. OUT LPWSAQUERYSETW lpqsResults
  129. )
  130. {
  131. return SOCKET_ERROR;
  132. }
  133. static
  134. int
  135. WSAAPI
  136. WSALookupServiceEnd(
  137. IN HANDLE hLookup
  138. )
  139. {
  140. return SOCKET_ERROR;
  141. }
  142. static
  143. WINSOCK_API_LINKAGE
  144. int
  145. WSAAPI
  146. WSASend(
  147. IN SOCKET s,
  148. IN LPWSABUF lpBuffers,
  149. IN DWORD dwBufferCount,
  150. OUT LPDWORD lpNumberOfBytesSent,
  151. IN DWORD dwFlags,
  152. IN LPWSAOVERLAPPED lpOverlapped,
  153. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  154. )
  155. {
  156. return SOCKET_ERROR;
  157. }
  158. static
  159. WINSOCK_API_LINKAGE
  160. SOCKET
  161. WSAAPI
  162. WSASocketW(
  163. IN int af,
  164. IN int type,
  165. IN int protocol,
  166. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  167. IN GROUP g,
  168. IN DWORD dwFlags
  169. )
  170. {
  171. return INVALID_SOCKET;
  172. }
  173. static
  174. int
  175. WSAAPI
  176. WSAStartup(
  177. IN WORD wVersionRequested,
  178. OUT LPWSADATA lpWSAData
  179. )
  180. {
  181. return WSAEFAULT;
  182. }
  183. static
  184. int
  185. WSAAPI
  186. WSAStringToAddressW(
  187. IN LPWSTR AddressString,
  188. IN INT AddressFamily,
  189. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  190. OUT LPSOCKADDR lpAddress,
  191. IN OUT LPINT lpAddressLength
  192. )
  193. {
  194. return SOCKET_ERROR;
  195. }
  196. static
  197. int
  198. WSPAPI
  199. WSCDeinstallProvider(
  200. IN LPGUID lpProviderId,
  201. OUT LPINT lpErrno
  202. )
  203. {
  204. *lpErrno = WSAEFAULT;
  205. return SOCKET_ERROR;
  206. }
  207. static
  208. int
  209. WSPAPI
  210. WSCDeinstallProvider32(
  211. IN LPGUID lpProviderId,
  212. OUT LPINT lpErrno
  213. )
  214. {
  215. *lpErrno = WSAEFAULT;
  216. return SOCKET_ERROR;
  217. }
  218. static
  219. int
  220. WSPAPI
  221. WSCEnumProtocols(
  222. IN LPINT lpiProtocols,
  223. OUT LPWSAPROTOCOL_INFOW lpProtocolBuffer,
  224. IN OUT LPDWORD lpdwBufferLength,
  225. OUT LPINT lpErrno
  226. )
  227. {
  228. *lpErrno = WSAEFAULT;
  229. return SOCKET_ERROR;
  230. }
  231. static
  232. INT
  233. WSPAPI
  234. WSCInstallNameSpace (
  235. IN LPWSTR lpszIdentifier,
  236. IN LPWSTR lpszPathName,
  237. IN DWORD dwNameSpace,
  238. IN DWORD dwVersion,
  239. IN LPGUID lpProviderId
  240. )
  241. {
  242. return SOCKET_ERROR;
  243. }
  244. static
  245. INT
  246. WSPAPI
  247. WSCInstallNameSpace32 (
  248. IN LPWSTR lpszIdentifier,
  249. IN LPWSTR lpszPathName,
  250. IN DWORD dwNameSpace,
  251. IN DWORD dwVersion,
  252. IN LPGUID lpProviderId
  253. )
  254. {
  255. return SOCKET_ERROR;
  256. }
  257. static
  258. int
  259. WSPAPI
  260. WSCInstallProvider(
  261. IN LPGUID lpProviderId,
  262. IN const WCHAR FAR * lpszProviderDllPath,
  263. IN const LPWSAPROTOCOL_INFOW lpProtocolInfoList,
  264. IN DWORD dwNumberOfEntries,
  265. OUT LPINT lpErrno
  266. )
  267. {
  268. *lpErrno = WSAEFAULT;
  269. return SOCKET_ERROR;
  270. }
  271. static
  272. int
  273. WSPAPI
  274. WSCInstallProvider64_32(
  275. IN LPGUID lpProviderId,
  276. IN const WCHAR FAR * lpszProviderDllPath,
  277. IN const LPWSAPROTOCOL_INFOW lpProtocolInfoList,
  278. IN DWORD dwNumberOfEntries,
  279. OUT LPINT lpErrno
  280. )
  281. {
  282. *lpErrno = WSAEFAULT;
  283. return SOCKET_ERROR;
  284. }
  285. static
  286. INT
  287. WSPAPI
  288. WSCUnInstallNameSpace (
  289. IN LPGUID lpProviderId
  290. )
  291. {
  292. return SOCKET_ERROR;
  293. }
  294. static
  295. INT
  296. WSPAPI
  297. WSCUnInstallNameSpace32 (
  298. IN LPGUID lpProviderId
  299. )
  300. {
  301. return SOCKET_ERROR;
  302. }
  303. static
  304. int
  305. WSAAPI
  306. bind(
  307. IN SOCKET s,
  308. IN const struct sockaddr FAR * name,
  309. IN int namelen
  310. )
  311. {
  312. return SOCKET_ERROR;
  313. }
  314. static
  315. int
  316. WSAAPI
  317. connect(
  318. IN SOCKET s,
  319. IN const struct sockaddr FAR * name,
  320. IN int namelen
  321. )
  322. {
  323. return SOCKET_ERROR;
  324. }
  325. static
  326. int
  327. WSAAPI
  328. closesocket(
  329. IN SOCKET s
  330. )
  331. {
  332. return SOCKET_ERROR;
  333. }
  334. static
  335. struct hostent FAR *
  336. WSAAPI
  337. gethostbyname(
  338. IN const char FAR * name
  339. )
  340. {
  341. return NULL;
  342. }
  343. static
  344. int
  345. WSAAPI
  346. getsockname(
  347. IN SOCKET s,
  348. OUT struct sockaddr FAR * name,
  349. OUT int FAR * namelen
  350. )
  351. {
  352. return SOCKET_ERROR;
  353. }
  354. static
  355. int
  356. WSAAPI
  357. getsockopt(
  358. IN SOCKET s,
  359. IN int level,
  360. IN int optname,
  361. OUT char FAR * optval,
  362. IN OUT int FAR * optlen
  363. )
  364. {
  365. return SOCKET_ERROR;
  366. }
  367. static
  368. WINSOCK_API_LINKAGE
  369. u_long
  370. WSAAPI
  371. htonl(
  372. IN u_long hostlong
  373. )
  374. {
  375. return SWAP_LONG( hostlong );
  376. }
  377. static
  378. WINSOCK_API_LINKAGE
  379. u_short
  380. WSAAPI
  381. htons(
  382. IN u_short hostshort
  383. )
  384. {
  385. return WS_SWAP_SHORT( hostshort );
  386. }
  387. static
  388. unsigned long
  389. WSAAPI
  390. inet_addr(
  391. IN const char FAR * cp
  392. )
  393. {
  394. return INADDR_NONE;
  395. }
  396. static
  397. char FAR *
  398. WSAAPI
  399. inet_ntoa(
  400. IN struct in_addr in
  401. )
  402. {
  403. return NULL;
  404. }
  405. static
  406. u_long
  407. WSAAPI
  408. ntohl(
  409. IN u_long netlong
  410. )
  411. {
  412. return SWAP_LONG( netlong );
  413. }
  414. static
  415. WINSOCK_API_LINKAGE
  416. u_short
  417. WSAAPI
  418. ntohs(
  419. IN u_short netshort
  420. )
  421. {
  422. return WS_SWAP_SHORT( netshort );
  423. }
  424. static
  425. WINSOCK_API_LINKAGE
  426. int
  427. WSAAPI
  428. recv(
  429. IN SOCKET s,
  430. OUT char FAR * buf,
  431. IN int len,
  432. IN int flags
  433. )
  434. {
  435. return SOCKET_ERROR;
  436. }
  437. static
  438. WINSOCK_API_LINKAGE
  439. int
  440. WSAAPI
  441. select(
  442. IN int nfds,
  443. IN OUT fd_set FAR * readfds,
  444. IN OUT fd_set FAR * writefds,
  445. IN OUT fd_set FAR *exceptfds,
  446. IN const struct timeval FAR * timeout
  447. )
  448. {
  449. return SOCKET_ERROR;
  450. }
  451. static
  452. SOCKET
  453. WSAAPI
  454. socket(
  455. IN int af,
  456. IN int type,
  457. IN int protocol
  458. )
  459. {
  460. return INVALID_SOCKET;
  461. }
  462. //
  463. // !! WARNING !! The entries below must be in order by ORDINAL
  464. //
  465. DEFINE_ORDINAL_ENTRIES(ws2_32)
  466. {
  467. DLOENTRY( 2, bind)
  468. DLOENTRY( 3, closesocket)
  469. DLOENTRY( 4, connect)
  470. DLOENTRY( 5, getpeername)
  471. DLOENTRY( 6, getsockname)
  472. DLOENTRY( 7, getsockopt)
  473. DLOENTRY( 8, htonl)
  474. DLOENTRY( 9, htons)
  475. DLOENTRY( 11, inet_addr)
  476. DLOENTRY( 12, inet_ntoa)
  477. DLOENTRY( 14, ntohl)
  478. DLOENTRY( 15, ntohs)
  479. DLOENTRY( 16, recv)
  480. DLOENTRY( 18, select)
  481. DLOENTRY( 23, socket)
  482. DLOENTRY( 52, gethostbyname)
  483. DLOENTRY(111, WSAGetLastError)
  484. DLOENTRY(115, WSAStartup)
  485. DLOENTRY(116, WSACleanup)
  486. };
  487. DEFINE_ORDINAL_MAP(ws2_32);
  488. //
  489. // !! WARNING !! The entries below must be in alphabetical order, and are CASE SENSITIVE (eg lower case comes last!)
  490. //
  491. DEFINE_PROCNAME_ENTRIES(ws2_32)
  492. {
  493. DLPENTRY(WSAAddressToStringA)
  494. DLPENTRY(WSAAddressToStringW)
  495. DLPENTRY(WSAEnumProtocolsW)
  496. DLPENTRY(WSAEventSelect)
  497. DLPENTRY(WSAIoctl)
  498. DLPENTRY(WSALookupServiceBeginW)
  499. DLPENTRY(WSALookupServiceEnd)
  500. DLPENTRY(WSALookupServiceNextW)
  501. DLPENTRY(WSASend)
  502. DLPENTRY(WSASocketW)
  503. DLPENTRY(WSAStartup)
  504. DLPENTRY(WSAStringToAddressW)
  505. DLPENTRY(WSCDeinstallProvider)
  506. DLPENTRY(WSCDeinstallProvider32)
  507. DLPENTRY(WSCEnumProtocols)
  508. DLPENTRY(WSCInstallNameSpace)
  509. DLPENTRY(WSCInstallNameSpace32)
  510. DLPENTRY(WSCInstallProvider)
  511. DLPENTRY(WSCInstallProvider64_32)
  512. DLPENTRY(WSCUnInstallNameSpace)
  513. DLPENTRY(WSCUnInstallNameSpace32)
  514. };
  515. DEFINE_PROCNAME_MAP(ws2_32)