关于c代码转换为pascal代码的问题(50分)

  • 主题发起人 主题发起人 zzhdi
  • 开始时间 开始时间
Z

zzhdi

Unregistered / Unconfirmed
GUEST, unregistred user!
在MSDN提供的ws2spi.h文件(../vc98/include)中有一段代码:
#define WSPAPI WSAAPI
。。。
int WSPAPI WSPStartup( WORD wVersionRequested, LPWSPDATA lpWSPData,LPWSAPROTOCOL_INFOW lpProtocolInfo,
WSPUPCALLTABLE UpcallTable, LPWSPPROC_TABLE lpProcTable);
//上面这句代码中的WSAPI是什么意思,此函数返回的数据类型是什么?
typedef
int
(WSPAPI * LPWSPSTARTUP)(
WORD wVersionRequested,
LPWSPDATA lpWSPData,
LPWSAPROTOCOL_INFOW lpProtocolInfo,
WSPUPCALLTABLE UpcallTable,
LPWSPPROC_TABLE lpProcTable
);
//上面这句代码的含义是什么?
//这两段代码如何转换为pascal代码?
 
你去下一个最新API的Pascal声明,里面有ws2spi.h的Pascal版:
{******************************************************************************}
{ }
{ Winsock2 Service Provider API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: ws2spi.h, released June 2000. The original Pascal }
{ code is: WS2spi.pas, released December 2000. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI home }
{ page, located at http://delphi-jedi.org or my personal homepage located at }
{ http://members.chello.nl/m.vanbrakel2 }
{ }
{ The contents of this file are used with permission, subject to the Mozilla }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}

unit JwaWS2spi;

{$WEAKPACKAGEUNIT}

{$HPPEMIT ''}
{$HPPEMIT '#include "ws2spi.h"'}
{$HPPEMIT ''}

{$I WINDEFINES.INC}

interface

uses
{$IFDEF STANDALONE}
JwaWinTypes,
{$ELSE}
Windows,
{$ENDIF}
JwaWinSock2;

(*
* Ensure structures are packed consistently.
*)

{$IFNDEF _WIN64}
{$ALIGN ON}
{$ELSE}
{$ALIGN OFF}
{$ENDIF}

const
WSPDESCRIPTION_LEN = 255;
{$EXTERNALSYM WSPDESCRIPTION_LEN}

WSS_OPERATION_IN_PROGRESS = $00000103;
{$EXTERNALSYM WSS_OPERATION_IN_PROGRESS}

type
WSPData = record
wVersion: WORD;
wHighVersion: WORD;
szDescription: array [0..WSPDESCRIPTION_LEN] of WCHAR;
end;
{$EXTERNALSYM WSPData}
LPWSPDATA = ^WSPData;
{$EXTERNALSYM LPWSPDATA}
TWSPData = WSPDATA;
PWSPData = LPWSPDATA;

_WSATHREADID = record
ThreadHandle: HANDLE;
Reserved: DWORD;
end;
{$EXTERNALSYM _WSATHREADID}
WSATHREADID = _WSATHREADID;
{$EXTERNALSYM WSATHREADID}
LPWSATHREADID = ^WSATHREADID;
{$EXTERNALSYM LPWSATHREADID}
TWSAThreadID = WSATHREADID;
PWSAThreadID = LPWSATHREADID;

(*
* Pointer to a blocking callback. A pointer to a blocking callback is
* returned from the WPUQueryBlockingCallback() upcall. Note that this
* function's signature is not identical to an application's blocking
* hook function.
*)

type
LPBLOCKINGCALLBACK = function (dwContext: DWORD): BOOL; stdcall;
{$EXTERNALSYM LPBLOCKINGCALLBACK}
TBlockingCallback = LPBLOCKINGCALLBACK;

(*
* Pointer to a user APC function. This is used as a parameter to the
* WPUQueueUserApc() upcall. Note that this function's signature is not
* identical to an application's completion routine.
*)

LPWSAUSERAPC = procedure (dwContext: DWORD); stdcall;
{$EXTERNALSYM LPWSAUSERAPC}
TWsaUserApc = LPWSAUSERAPC;

(*
* Pointers to the individual entries in a service provider's proc table.
*)

LPWSPACCEPT = function (s: TSocket; addr: PSockAddr; addrlen: PINT;
lpfnCondition: LPCONDITIONPROC; dwCallbackData: DWORD; var Errno: Integer): TSocket; stdcall;
{$EXTERNALSYM LPWSPACCEPT}
TWspAccept = LPWSPACCEPT;

LPWSPADDRESSTOSTRING = function (lpsaAddress: LPSOCKADDR; dwAddressLength: DWORD;
lpProtocolInfo: LPWSAPROTOCOL_INFOW; lpszAddressString: LPWSTR;
var lpdwAddressStringLength: DWORD; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPADDRESSTOSTRING}
TWspAddressToString = LPWSPADDRESSTOSTRING;

LPWSPASYNCSELECT = function (s: TSocket; hWnd: HWND; wMsg: u_int; lEvent: Longint; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPASYNCSELECT}
TWspASyncSelect = LPWSPASYNCSELECT;

LPWSPBIND = function (s: TSocket; var name: sockaddr; namelen: Integer; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPBIND}
TWspBind = LPWSPBIND;

LPWSPCANCELBLOCKINGCALL = function (var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPCANCELBLOCKINGCALL}
TWspCancelBlockingCall = LPWSPCANCELBLOCKINGCALL;

LPWSPCLEANUP = function (var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPCLEANUP}
TWspCleanup = LPWSPCLEANUP;

LPWSPCLOSESOCKET = function (s: TSocket; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPCLOSESOCKET}
TWspCloseSocket = LPWSPCLOSESOCKET;

LPWSPCONNECT = function (s: TSocket; name: PSockAddr; namelen: Integer; lpCallerData: LPWSABUF;
lpCalleeData: LPWSABUF; lpSQOS: LPQOS; lpGQOS: LPQOS; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPCONNECT}
TWspConnect = LPWSPCONNECT;

LPWSPDUPLICATESOCKET = function (s: TSocket; dwProcessId: DWORD; lpProtocolInfo: LPWSAPROTOCOL_INFOW; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPDUPLICATESOCKET}
TWspDuplicateSocket = LPWSPDUPLICATESOCKET;

LPWSPENUMNETWORKEVENTS = function (s: TSocket; hEventObject: WSAEVENT; lpNetworkEvents: LPWSANETWORKEVENTS; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPENUMNETWORKEVENTS}
TWspEnumNetworkEvents = LPWSPENUMNETWORKEVENTS;

LPWSPEVENTSELECT = function (s: TSocket; hEventObject: WSAEVENT; lNetworkEvents: Longint; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPEVENTSELECT}
TWspEventSelect = LPWSPEVENTSELECT;

LPWSPGETOVERLAPPEDRESULT = function (s: TSocket; lpOverlapped: LPWSAOVERLAPPED;
var lpcbTransfer: DWORD; fWait: BOOL; lpdwFlags: DWORD; var lpErrno: Integer): BOOL; stdcall;
{$EXTERNALSYM LPWSPGETOVERLAPPEDRESULT}
TWspGetOverlappedResult = LPWSPGETOVERLAPPEDRESULT;

LPWSPGETPEERNAME = function (s: TSocket; var name: sockaddr; var namelen, lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPGETPEERNAME}
TWspGetPeerName = LPWSPGETPEERNAME;

LPWSPGETSOCKNAME = function (s: TSocket; var name: sockaddr; var namelen, lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPGETSOCKNAME}
TWspGetSockName = LPWSPGETSOCKNAME;

LPWSPGETSOCKOPT = function (s: TSocket; level, optname: Integer; optval: PChar; var optlen, lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPGETSOCKOPT}
TWspGetSockOpt = LPWSPGETSOCKOPT;

LPWSPGETQOSBYNAME = function (s: TSocket; var lpQOSName: WSABUF; lpQOS: LPQOS; lpErrno: Integer): BOOL; stdcall;
{$EXTERNALSYM LPWSPGETQOSBYNAME}
TWspGetQosByName = LPWSPGETQOSBYNAME;

LPWSPIOCTL = function (s: TSocket; dwIoControlCode: DWORD; lpvInBuffer: LPVOID; cbInBuffer: DWORD;
lpvOutBuffer: LPVOID; cbOutBuffer: DWORD; var lpcbBytesReturned: DWORD;
lpOverlapped: LPWSAOVERLAPPED; lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE;
lpThreadId: LPWSATHREADID; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPIOCTL}
TWspIoctl = LPWSPIOCTL;

LPWSPJOINLEAF = function (s: TSocket; name: sockaddr; namelen: Integer; lpCallerData: LPWSABUF;
lpCalleeData: LPWSABUF; lpSQOS, lpGQOS: LPQOS; dwFlags: DWORD; var lpErrno: Integer): TSocket; stdcall;
{$EXTERNALSYM LPWSPJOINLEAF}
TWspJoinLeaf = LPWSPJOINLEAF;

LPWSPLISTEN = function (s: TSocket; backlog: Integer; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPLISTEN}
TWspListen = LPWSPLISTEN;

LPWSPRECV = function (s: TSocket; lpBuffers: LPWSABUF; dwBufferCount: DWORD;
var lpNumberOfBytesRecvd, lpFlags: DWORD; lpOverlapped: LPWSAOVERLAPPED;
lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE; lpThreadId: LPWSATHREADID;
var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPRECV}
TWspRecv = LPWSPRECV;

LPWSPRECVDISCONNECT = function (s: TSocket; lpInboundDisconnectData: LPWSABUF; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPRECVDISCONNECT}
TWspRecvDisconnect = LPWSPRECVDISCONNECT;

LPWSPRECVFROM = function (s: TSocket; lpBuffers: LPWSABUF; dwBufferCount: DWORD;
var lpNumberOfBytesRecvd, lpFlags: DWORD; lpFrom: PSockAddr; lpFromlen: PINT;
lpOverlapped: LPWSAOVERLAPPED; lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE;
lpThreadId: LPWSATHREADID; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPRECVFROM}
TWspRecvFrom = LPWSPRECVFROM;

LPWSPSELECT = function (nfds: Integer; readfds, writefds, exceptfds: PFdSet; timeout: PTimeVal; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPSELECT}
TWspSelect = LPWSPSELECT;

LPWSPSEND = function (s: TSocket; lpBuffers: LPWSABUF; dwBufferCount: DWORD;
var lpNumberOfBytesSent: DWORD; dwFlags: DWORD; lpOverlapped: LPWSAOVERLAPPED;
lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE;
lpThreadId: LPWSATHREADID; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPSEND}
TWspSend = LPWSPSEND;

LPWSPSENDDISCONNECT = function (s: TSocket; lpOutboundDisconnectData: LPWSABUF; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPSENDDISCONNECT}
TWspSendDisconnect = LPWSPSENDDISCONNECT;

LPWSPSENDTO = function (s: TSocket; lpBuffers: LPWSABUF; dwBufferCount: DWORD;
var lpNumberOfBytesSent: DWORD; dwFlags: DWORD; lpTo: PSockAddr; iTolen: Integer;
lpOverlapped: LPWSAOVERLAPPED; lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE;
lpThreadId: LPWSATHREADID; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPSENDTO}
TWspSendTo = LPWSPSENDTO;

LPWSPSETSOCKOPT = function (s: TSocket; level, optname: Integer; optval: PChar; optlen: Integer; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPSETSOCKOPT}
TWspSetSockOpt = LPWSPSETSOCKOPT;

LPWSPSHUTDOWN = function (s: TSocket; how: Integer; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPSHUTDOWN}
TWspShutdown = LPWSPSHUTDOWN;

LPWSPSOCKET = function (af, type_, protocol: Integer; lpProtocolInfo: LPWSAPROTOCOL_INFOW;
g: GROUP; dwFlags: DWORD; var lpErrno: Integer): TSocket; stdcall;
{$EXTERNALSYM LPWSPSOCKET}
TWspSocket = LPWSPSOCKET;

LPWSPSTRINGTOADDRESS = function (AddressString: LPWSTR; AddressFamily: Integer;
lpProtocolInfo: LPWSAPROTOCOL_INFOW; lpAddress: LPSOCKADDR;
var lpAddressLength, lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSPSTRINGTOADDRESS}
TWspStringToAddress = LPWSPSTRINGTOADDRESS;

(*
* A service provider proc table. This structure is returned by value
* from the service provider's WSPStartup() entrypoint.
*)

type
_WSPPROC_TABLE = record
lpWSPAccept: LPWSPACCEPT;
lpWSPAddressToString: LPWSPADDRESSTOSTRING;
lpWSPAsyncSelect: LPWSPASYNCSELECT;
lpWSPBind: LPWSPBIND;
lpWSPCancelBlockingCall: LPWSPCANCELBLOCKINGCALL;
lpWSPCleanup: LPWSPCLEANUP;
lpWSPCloseSocket: LPWSPCLOSESOCKET;
lpWSPConnect: LPWSPCONNECT;
lpWSPDuplicateSocket: LPWSPDUPLICATESOCKET;
lpWSPEnumNetworkEvents: LPWSPENUMNETWORKEVENTS;
lpWSPEventSelect: LPWSPEVENTSELECT;
lpWSPGetOverlappedResult: LPWSPGETOVERLAPPEDRESULT;
lpWSPGetPeerName: LPWSPGETPEERNAME;
lpWSPGetSockName: LPWSPGETSOCKNAME;
lpWSPGetSockOpt: LPWSPGETSOCKOPT;
lpWSPGetQOSByName: LPWSPGETQOSBYNAME;
lpWSPIoctl: LPWSPIOCTL;
lpWSPJoinLeaf: LPWSPJOINLEAF;
lpWSPListen: LPWSPLISTEN;
lpWSPRecv: LPWSPRECV;
lpWSPRecvDisconnect: LPWSPRECVDISCONNECT;
lpWSPRecvFrom: LPWSPRECVFROM;
lpWSPSelect: LPWSPSELECT;
lpWSPSend: LPWSPSEND;
lpWSPSendDisconnect: LPWSPSENDDISCONNECT;
lpWSPSendTo: LPWSPSENDTO;
lpWSPSetSockOpt: LPWSPSETSOCKOPT;
lpWSPShutdown: LPWSPSHUTDOWN;
lpWSPSocket: LPWSPSOCKET;
lpWSPStringToAddress: LPWSPSTRINGTOADDRESS;
end;
{$EXTERNALSYM _WSPPROC_TABLE}
WSPPROC_TABLE = _WSPPROC_TABLE;
{$EXTERNALSYM WSPPROC_TABLE}
LPWSPPROC_TABLE = ^WSPPROC_TABLE;
{$EXTERNALSYM LPWSPPROC_TABLE}
TWspProcTable = WSPPROC_TABLE;
PWspProcTable = LPWSPPROC_TABLE;

(*
* Pointers to the individual entries in the upcall table.
*)

type
LPWPUCLOSEEVENT = function (hEvent: WSAEVENT; var lpErrno: Integer): BOOL; stdcall;
{$EXTERNALSYM LPWPUCLOSEEVENT}
TWpuCloseEvent = LPWPUCLOSEEVENT;

LPWPUCLOSESOCKETHANDLE = function (s: TSocket; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWPUCLOSESOCKETHANDLE}
TWpuCloseSocketHandle = LPWPUCLOSESOCKETHANDLE;

LPWPUCREATEEVENT = function (var lpErrno: Integer): WSAEVENT; stdcall;
{$EXTERNALSYM LPWPUCREATEEVENT}
TWpuCreateEvent = LPWPUCREATEEVENT;

LPWPUCREATESOCKETHANDLE = function (dwCatalogEntryId, dwContext: DWORD;
var lpErrno: Integer): TSocket; stdcall;
{$EXTERNALSYM LPWPUCREATESOCKETHANDLE}
TWpuCreateSocketHandle = LPWPUCREATESOCKETHANDLE;

LPWPUFDISSET = function (s: TSocket; fdset: PFdSet): Integer; stdcall;
{$EXTERNALSYM LPWPUFDISSET}
TWpuFdIsSet = LPWPUFDISSET;

LPWPUGETPROVIDERPATH = function (const lpProviderId: TGUID;
lpszProviderDllPath: PWCHAR; var lpProviderDllPathLen, lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWPUGETPROVIDERPATH}
TWpuGetProviderPath = LPWPUGETPROVIDERPATH;

LPWPUMODIFYIFSHANDLE = function (dwCatalogEntryId: DWORD; ProposedHandle: TSocket;
var lpErrno: Integer): TSocket; stdcall;
{$EXTERNALSYM LPWPUMODIFYIFSHANDLE}
TWpuMoifyIfsHandle = LPWPUMODIFYIFSHANDLE;

LPWPUPOSTMESSAGE = function (hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM LPWPUPOSTMESSAGE}
TWpuPostMessage = LPWPUPOSTMESSAGE;

LPWPUQUERYBLOCKINGCALLBACK = function (dwCatalogEntryId: DWORD; var lplpfnCallback: LPBLOCKINGCALLBACK;
lpdwContext: LPDWORD; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWPUQUERYBLOCKINGCALLBACK}
TWpuQueryBlockingCallback = LPWPUQUERYBLOCKINGCALLBACK;

LPWPUQUERYSOCKETHANDLECONTEXT = function (s: TSocket; lpContext: LPDWORD;
var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWPUQUERYSOCKETHANDLECONTEXT}
TWpuQuerySocketHandleContext = LPWPUQUERYSOCKETHANDLECONTEXT;

LPWPUQUEUEAPC = function (lpThreadId: LPWSATHREADID; lpfnUserApc: LPWSAUSERAPC;
dwContext: DWORD; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWPUQUEUEAPC}
TWpuQueueApc = LPWPUQUEUEAPC;

LPWPURESETEVENT = function (hEvent: WSAEVENT; var lpErrno: Integer): BOOL; stdcall;
{$EXTERNALSYM LPWPURESETEVENT}
TWpuResetEvent = LPWPURESETEVENT;

LPWPUSETEVENT = function (hEvent: WSAEVENT; var lpErrno: Integer): BOOL; stdcall;
{$EXTERNALSYM LPWPUSETEVENT}
TWpuSetEvent = LPWPUSETEVENT;

LPWPUOPENCURRENTTHREAD = function (lpThreadId: LPWSATHREADID; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWPUOPENCURRENTTHREAD}
TWpuOpenCurrentThread = LPWPUOPENCURRENTTHREAD;

LPWPUCLOSETHREAD = function (lpThreadId: LPWSATHREADID; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWPUCLOSETHREAD}
TWpuCloseThread = LPWPUCLOSETHREAD;

// Available only directly from ws2_32.dll

LPWPUCOMPLETEOVERLAPPEDREQUEST = function (s: TSocket; lpOverlapped: LPWSAOVERLAPPED;
dwError: DWORD; cbTransferred: DWORD; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWPUCOMPLETEOVERLAPPEDREQUEST}
TWpuCompleteOverlappedRequest = LPWPUCOMPLETEOVERLAPPEDREQUEST;

(*
* The upcall table. This structure is passed by value to the service
* provider's WSPStartup() entrypoint.
*)

_WSPUPCALLTABLE = record
lpWPUCloseEvent: LPWPUCLOSEEVENT;
lpWPUCloseSocketHandle: LPWPUCLOSESOCKETHANDLE;
lpWPUCreateEvent: LPWPUCREATEEVENT;
lpWPUCreateSocketHandle: LPWPUCREATESOCKETHANDLE;
lpWPUFDIsSet: LPWPUFDISSET;
lpWPUGetProviderPath: LPWPUGETPROVIDERPATH;
lpWPUModifyIFSHandle: LPWPUMODIFYIFSHANDLE;
lpWPUPostMessage: LPWPUPOSTMESSAGE;
lpWPUQueryBlockingCallback: LPWPUQUERYBLOCKINGCALLBACK;
lpWPUQuerySocketHandleContext: LPWPUQUERYSOCKETHANDLECONTEXT;
lpWPUQueueApc: LPWPUQUEUEAPC;
lpWPUResetEvent: LPWPURESETEVENT;
lpWPUSetEvent: LPWPUSETEVENT;
lpWPUOpenCurrentThread: LPWPUOPENCURRENTTHREAD;
lpWPUCloseThread: LPWPUCLOSETHREAD;
end;
{$EXTERNALSYM _WSPUPCALLTABLE}
WSPUPCALLTABLE = _WSPUPCALLTABLE;
{$EXTERNALSYM WSPUPCALLTABLE}
LPWSPUPCALLTABLE = ^WSPUPCALLTABLE;
{$EXTERNALSYM LPWSPUPCALLTABLE}
TWspUpCallTable = WSPUPCALLTABLE;
PWspUpCallTable = LPWSPUPCALLTABLE;

(*
* WinSock 2 SPI socket function prototypes
*)

//function WSPStartup(wVersionRequested: WORD; lpWSPData: LPWSPDATA;
// lpProtocolInfo: LPWSAPROTOCOL_INFOW; UpcallTable: WSPUPCALLTABLE;
// lpProcTable: LPWSPPROC_TABLE): Integer; stdcall;
//{$EXTERNALSYM WSPStartup}

type
LPWSPSTARTUP = function (wVersionRequested: WORD; lpWSPData: LPWSPDATA;
lpProtocolInfo: LPWSAPROTOCOL_INFOW; UpcallTable: WSPUPCALLTABLE;
lpProcTable: LPWSPPROC_TABLE): Integer; stdcall;
{$EXTERNALSYM LPWSPSTARTUP}
TWspStartUp = LPWSPSTARTUP;

(*
* Installation and configuration entrypoints.
*)

function WSCEnumProtocols(lpiProtocols: PINT; lpProtocolBuffer: LPWSAPROTOCOL_INFOW;
var lpdwBufferLength: DWORD; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM WSCEnumProtocols}

type
LPWSCENUMPROTOCOLS = function (lpiProtocols: PINT; lpProtocolBuffer: LPWSAPROTOCOL_INFOW;
var lpdwBufferLength: DWORD; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSCENUMPROTOCOLS}
TWscEnumProtocols = LPWSCENUMPROTOCOLS;

function WSCDeinstallProvider(const lpProviderId: TGUID; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM WSCDeinstallProvider}

type
LPWSCDEINSTALLPROVIDER = function (const lpProviderId: TGUID; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSCDEINSTALLPROVIDER}
TWscDeinstallProvider = LPWSCDEINSTALLPROVIDER;

function WSCInstallProvider(const lpProviderId: TGUID; lpszProviderDllPath: PWCHAR;
lpProtocolInfoList: LPWSAPROTOCOL_INFOW; dwNumberOfEntries: DWORD; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM WSCInstallProvider}

type
LPWSCINSTALLPROVIDER = function (const lpProviderId: TGUID; lpszProviderDllPath: PWCHAR;
lpProtocolInfoList: LPWSAPROTOCOL_INFOW; dwNumberOfEntries: DWORD; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSCINSTALLPROVIDER}
TWscInstallProvider = LPWSCINSTALLPROVIDER;

function WSCGetProviderPath(const lpProviderId: TGUID; lpszProviderDllPath: PWCHAR;
var lpProviderDllPathLen, lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM WSCGetProviderPath}

type
LPWSCGETPROVIDERPATH = function (const lpProviderId: TGUID; lpszProviderDllPath: PWCHAR;
var lpProviderDllPathLen, lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM LPWSCGETPROVIDERPATH}
TWscGetProviderPath = LPWSCGETPROVIDERPATH;

function WSCInstallQOSTemplate(const Guid: TGUID; QosName: LPWSABUF; Qos: LPQOS): Integer; stdcall;
{$EXTERNALSYM WSCInstallQOSTemplate}

type
LPWSCINSTALLQOSTEMPLATE = function (const Guid: TGUID; QosName: LPWSABUF; Qos: LPQOS): Integer; stdcall;
{$EXTERNALSYM LPWSCINSTALLQOSTEMPLATE}
TWscInstallQosTemplate = LPWSCINSTALLQOSTEMPLATE;

function WSCRemoveQOSTemplate(const Guid: TGUID; QosName: LPWSABUF): Integer; stdcall;
{$EXTERNALSYM WSCRemoveQOSTemplate}

type
LPWSCREMOVEQOSTEMPLATE = function (const Guid: TGUID; QosName: LPWSABUF): Integer; stdcall;
{$EXTERNALSYM LPWSCREMOVEQOSTEMPLATE}
TWscRemoveQosTemplate = LPWSCREMOVEQOSTEMPLATE;

(*
* The following upcall function prototypes are only used by WinSock 2 DLL and
* should not be used by any service providers.
*

function WPUCloseEvent(hEvent: WSAEVENT; var lpErrno: Integer): BOOL; stdcall;
{$EXTERNALSYM WPUCloseEvent}

function WPUCloseSocketHandle(s: TSocket; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM WPUCloseSocketHandle}

function WPUCreateEvent(var lpErrno: Integer): WSAEVENT; stdcall;
{$EXTERNALSYM WPUCreateEvent}

function WPUCreateSocketHandle(dwCatalogEntryId, dwContext: DWORD; var lpErrno: Integer): SOCKET; stdcall;
{$EXTERNALSYM WPUCreateSocketHandle}

function WPUFDIsSet(s: TSocket; const fdset: fd_set): Integer; stdcall;
{$EXTERNALSYM WPUFDIsSet}

function WPUGetProviderPath(const lpProviderId: TGUID; lpszProviderDllPath: PWCHAR;
var lpProviderDllPathLen, lpErrno: : Integer): Integer; stdcall;
{$EXTERNALSYM WPUGetProviderPath}

function WPUModifyIFSHandle(dwCatalogEntryId: DWORD; ProposedHandle: SOCKET; var lpErrno: Integer): SOCKET; stdcall;
{$EXTERNALSYM WPUModifyIFSHandle}

function WPUPostMessage(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM WPUPostMessage}

function WPUQueryBlockingCallback(dwCatalogEntryId: DWORD; var lplpfnCallback: LPBLOCKINGCALLBACK;
var lpdwContext: DWORD_PTR; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM WPUQueryBlockingCallback}

function WPUQuerySocketHandleContext(s: SOCKET; var lpContext: DWORD_PTR; lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM WPUQuerySocketHandleContext}

function WPUQueueApc(lpThreadId: LPWSATHREADID; lpfnUserApc: LPWSAUSERAPC;
dwContext: DWORD_PTR; var lpErrno: Integer): Integer; stdcall;
{$EXTERNALSYM WPUQueueApc}

function WPUResetEvent(hEvent: WSAEVENT; var lpErrno: Integer): BOOL; stcall;
{$EXTERNALSYM WPUResetEvent}

function WPUSetEvent(hEvent: WSAEVENT; var lpErrno: Integer): BOOL; stdcall;
{$EXTERNALSYM WPUSetEvent}

function WPUCompleteOverlappedRequest(s: SOCKET; lpOverlapped: LPWSAOVERLAPPED;
dwError, cbTransferred: DWORD; var lpErrno: Integer): Integerl stdcall;
{$EXTERNALSYM WPUCompleteOverlappedRequest}

*)

(*
* Installing and uninstalling name space providers.
*)

function WSCInstallNameSpace(lpszIdentifier, lpszPathName: LPWSTR; dwNameSpace,
dwVersion: DWORD; const lpProviderId: TGUID): Integer; stdcall;
{$EXTERNALSYM WSCInstallNameSpace}

type
LPWSCINSTALLNAMESPACE = function (lpszIdentifier, lpszPathName: LPWSTR;
dwNameSpace, dwVersion: DWORD; const lpProviderId: TGUID): Integer; stdcall;
{$EXTERNALSYM LPWSCINSTALLNAMESPACE}
TWscInstallNamespace = LPWSCINSTALLNAMESPACE;

function WSCUnInstallNameSpace(const lpProviderId: TGUID): Integer; stdcall;
{$EXTERNALSYM WSCUnInstallNameSpace}

type
LPWSCUNINSTALLNAMESPACE = function (const lpProviderId: TGUID): Integer; stdcall;
{$EXTERNALSYM LPWSCUNINSTALLNAMESPACE}
TWscUninstallNamespace = LPWSCUNINSTALLNAMESPACE;

function WSCEnableNSProvider(const lpProviderId: TGUID; fEnable: BOOL): Integer; stdcall;
{$EXTERNALSYM WSCEnableNSProvider}

type
LPWSCENABLENSPROVIDER = function (const lpProviderId: TGUID; fEnable: BOOL): Integer; stdcall;
{$EXTERNALSYM LPWSCENABLENSPROVIDER}
TWscEnableNsProvider = LPWSCENABLENSPROVIDER;

(*
* Pointers to the individual entries in the namespace proc table.
*)

type
LPNSPCLEANUP = function (const lpProviderId: TGUID): Integer; stdcall;
{$EXTERNALSYM LPNSPCLEANUP}
TNspCleanup = LPNSPCLEANUP;

LPNSPLOOKUPSERVICEBEGIN = function (const lpProviderId: TGUID;
lpqsRestrictions: LPWSAQUERYSETW; lpServiceClassInfo: LPWSASERVICECLASSINFOW;
dwControlFlags: DWORD; lphLookup: LPHANDLE): Integer; stdcall;
{$EXTERNALSYM LPNSPLOOKUPSERVICEBEGIN}
TNspLookupServiceBegin = LPNSPLOOKUPSERVICEBEGIN;

LPNSPLOOKUPSERVICENEXT = function (hLookup: HANDLE; dwControlFlags: DWORD;
lpdwBufferLength: LPDWORD; lpqsResults: LPWSAQUERYSETW): Integer; stdcall;
{$EXTERNALSYM LPNSPLOOKUPSERVICENEXT}
TNspLookupServiceNext = LPNSPLOOKUPSERVICENEXT;

LPNSPLOOKUPSERVICEEND = function (hLookup: HANDLE): Integer; stdcall;
{$EXTERNALSYM LPNSPLOOKUPSERVICEEND}
TNspLookupServiceEnd = LPNSPLOOKUPSERVICEEND;

LPNSPSETSERVICE = function (const lpProviderId: TGUID;
lpServiceClassInfo: LPWSASERVICECLASSINFOW; lpqsRegInfo: LPWSAQUERYSETW;
essOperation: WSAESETSERVICEOP; dwControlFlags: DWORD): Integer; stdcall;
{$EXTERNALSYM LPNSPSETSERVICE}
TNspSetService = LPNSPSETSERVICE;

LPNSPINSTALLSERVICECLASS = function (const lpProviderId: TGUID;
lpServiceClassInfo: LPWSASERVICECLASSINFOW): Integer; stdcall;
{$EXTERNALSYM LPNSPINSTALLSERVICECLASS}
TNspInstallServiceClass = LPNSPINSTALLSERVICECLASS;

LPNSPREMOVESERVICECLASS = function (const lpProviderId, lpServiceClassId: TGUID): Integer; stdcall;
{$EXTERNALSYM LPNSPREMOVESERVICECLASS}
TNspRemoveServiceClass = LPNSPREMOVESERVICECLASS;

LPNSPGETSERVICECLASSINFO = function (const lpProviderId: TGUID; lpdwBufSize: LPDWORD;
lpServiceClassInfo: LPWSASERVICECLASSINFOW): Integer; stdcall;
{$EXTERNALSYM LPNSPGETSERVICECLASSINFO}
TNspGetServiceClassInfo = LPNSPGETSERVICECLASSINFO;

(*
* The name space service provider procedure table.
*)

type
_NSP_ROUTINE = record
(* Structure version information: *)
cbSize: DWORD;
dwMajorVersion: DWORD;
dwMinorVersion: DWORD;
(* Procedure-pointer table: *)
NSPCleanup: LPNSPCLEANUP;
NSPLookupServiceBegin: LPNSPLOOKUPSERVICEBEGIN;
NSPLookupServiceNext: LPNSPLOOKUPSERVICENEXT;
NSPLookupServiceEnd: LPNSPLOOKUPSERVICEEND;
NSPSetService: LPNSPSETSERVICE;
NSPInstallServiceClass: LPNSPINSTALLSERVICECLASS;
NSPRemoveServiceClass: LPNSPREMOVESERVICECLASS;
NSPGetServiceClassInfo: LPNSPGETSERVICECLASSINFO;
end;
{$EXTERNALSYM _NSP_ROUTINE}
NSP_ROUTINE = _NSP_ROUTINE;
{$EXTERNALSYM NSP_ROUTINE}
LPNSP_ROUTINE = ^NSP_ROUTINE;
{$EXTERNALSYM LPNSP_ROUTINE}
TNspRoutines = NSP_ROUTINE;
PNspRoutines = LPNSP_ROUTINE;

(*
* Startup procedures.
*)

//function NSPStartup(const lpProviderId: TGUID; lpnspRoutines: LPNSP_ROUTINE): Integer; stdcall;
//{$EXTERNALSYM NSPStartup}

type
LPNSPSTARTUP = function (const lpProviderId: TGUID; lpnspRoutines: LPNSP_ROUTINE): Integer; stdcall;
{$EXTERNALSYM LPNSPSTARTUP}
TNspStartup = LPNSPSTARTUP;

implementation

const
ws2_32 = 'ws2_32.dll';
qosname = 'qosname.dll';

function WSCEnumProtocols; external ws2_32 name 'WSCEnumProtocols';
function WSCDeinstallProvider; external ws2_32 name 'WSCDeinstallProvider';
function WSCInstallProvider; external ws2_32 name 'WSCInstallProvider';
function WSCGetProviderPath; external ws2_32 name 'WSCGetProviderPath';
function WSCInstallQOSTemplate; external qosname name 'WSCInstallQOSTemplate';
function WSCRemoveQOSTemplate; external qosname name 'WSCRemoveQOSTemplate';
function WSCInstallNameSpace; external ws2_32 name 'WSCInstallNameSpace';
function WSCUnInstallNameSpace; external ws2_32 name 'WSCUnInstallNameSpace';
function WSCEnableNSProvider; external ws2_32 name 'WSCEnableNSProvider';

end.
 
接受答案了.
 
后退
顶部