Click to open or copy the files for the Dt_dll sample.
For documentation of the debug/trace feature, as well as this Dt_dll sample source code, consult Dbgspec.doc in this directory.
WinSock 2 Debug and Trace Facilities
Dbgspec.doc (WinSock 2 Debug and Trace Facilities) describes the functionality, design, and implementation of the default debug/trace DLL (named Dt_dll.dll), which is supplied in source-code form with the WinSock 2 SDK. Developers may find that the default debug/trace DLL supplies all the necessary functionality for their purposes. However, they are also free to modify the code to provide additional debugging functionality, or they may start from scratch and build a new debug/trace DLL. In the latter case, only the interface definition portion of this document may be relevant, and the reader can skip the section describing the default DLL. The default DLL does contain hooks, however, which allow it to be extended for all but the most complex types of debugging and tracing.
Developers of WinSock 2 applications and service providers need to be able to isolate bugs to one of the following:
The WinSock 2 debug/trace layer addresses this problem. It allows all procedure calls across the WinSock 2 API or SPI to be monitored, and to some extent controlled.
Developers can use this mechanism to trace the procedure calls, procedure returns, parameter values, and return values. You can alter parameter values and returns on procedure-call or procedure-return. If desired, you can even prevent or redirect a procedure-call. With access to this level of information and control, it should be easy for you to isolate any problem to the application, WinSock 2 DLL or service provider.
The debug/trace layer is supported only by a specially instrumented version of the WinSock 2 DLL. The SDK license terms do not allow redistribution of this instrumented WinSock 2 DLL in order to prevent inappropriate use of the debug hooks in production systems.
The debug/trace feature of Windows Sockets 2 will only work with the debug version of Ws2_32.dll.
This sample uses the following keywords:
abortandclose; accept; back; bind; callwindowproc; cgetcounter; closehandle; closesocket; connect; cpop; cpush; createevent; createfile; createthread; createwindow; cstack_c; debugdlgproc; defwindowproc; deletecriticalsection; dialogbox; dispatchmessage; dllmain; dteditwndproc; dthandler___wsafdisset; dthandler_accept; dthandler_bind; dthandler_closesocket; dthandler_connect; dthandler_gethostbyaddr; dthandler_gethostbyname; dthandler_gethostname; dthandler_getpeername; dthandler_getprotobyname; dthandler_getprotobynumber; dthandler_getservbyname; dthandler_getservbyport; dthandler_getsockname; dthandler_getsockopt; dthandler_htonl; dthandler_htons; dthandler_inet_addr; dthandler_inet_ntoa; dthandler_ioctlsocket; dthandler_listen; dthandler_nspaddresstostring; dthandler_nspcleanup; dthandler_nspgetaddressbyname; dthandler_nspgetserviceclassinfo; dthandler_nspgetserviceclassnamebyclassid; dthandler_nspinstallserviceclass; dthandler_nsplookupservicebegin; dthandler_nsplookupserviceend; dthandler_nsplookupservicenext; dthandler_nspremoveserviceclass; dthandler_nspsetservice; dthandler_nspstringtoaddress; dthandler_ntohl; dthandler_ntohs; dthandler_recv; dthandler_recvfrom; dthandler_select; dthandler_send; dthandler_sendto; dthandler_setsockopt; dthandler_shutdown; dthandler_socket; dthandler_wpucloseevent; dthandler_wpuclosesockethandle; dthandler_wpucreateevent; dthandler_wpucreatesockethandle; dthandler_wpufdisset; dthandler_wpugetproviderpath; dthandler_wpumodifyifshandle; dthandler_wpupostmessage; dthandler_wpuqueryblockingcallback; dthandler_wpuquerysockethandlecontext; dthandler_wpuqueueapc; dthandler_wpuresetevent; dthandler_wpusetevent; dthandler_wsaaccept; dthandler_wsaaddresstostringa; dthandler_wsaaddresstostringw; dthandler_wsaasyncgethostbyaddr; dthandler_wsaasyncgethostbyname; dthandler_wsaasyncgetprotobyname; dthandler_wsaasyncgetprotobynumber; dthandler_wsaasyncgetservbyname; dthandler_wsaasyncgetservbyport; dthandler_wsaasyncselect; dthandler_wsacancelasyncrequest; dthandler_wsacancelblockingcall; dthandler_wsacleanup; dthandler_wsacloseevent; dthandler_wsaconnect; dthandler_wsacreateevent; dthandler_wsaduplicatesocketa; dthandler_wsaduplicatesocketw; dthandler_wsaenumnamespaceprovidersa; dthandler_wsaenumnamespaceprovidersw; dthandler_wsaenumnetworkevents; dthandler_wsaenumprotocolsa; dthandler_wsaenumprotocolsw; dthandler_wsaeventselect; dthandler_wsagetaddressbynamea; dthandler_wsagetaddressbynamew; dthandler_wsagetlasterror; dthandler_wsagetoverlappedresult; dthandler_wsagetqosbyname; dthandler_wsagetserviceclassinfoa; dthandler_wsagetserviceclassinfow; dthandler_wsagetserviceclassnamebyclassida; dthandler_wsagetserviceclassnamebyclassidw; dthandler_wsahtonl; dthandler_wsahtons; dthandler_wsainstallserviceclassa; dthandler_wsainstallserviceclassw; dthandler_wsaioctl; dthandler_wsaisblocking; dthandler_wsajoinleaf; dthandler_wsalookupservicebegina; dthandler_wsalookupservicebeginw; dthandler_wsalookupserviceend; dthandler_wsalookupservicenexta; dthandler_wsalookupservicenextw; dthandler_wsantohl; dthandler_wsantohs; dthandler_wsarecv; dthandler_wsarecvdisconnect; dthandler_wsarecvfrom; dthandler_wsaremoveserviceclass; dthandler_wsaresetevent; dthandler_wsasend; dthandler_wsasenddisconnect; dthandler_wsasendto; dthandler_wsasetblockinghook; dthandler_wsasetevent; dthandler_wsasetlasterror; dthandler_wsasetservicea; dthandler_wsasetservicew; dthandler_wsasocketa; dthandler_wsasocketw; dthandler_wsastartup; dthandler_wsastringtoaddressa; dthandler_wsastringtoaddressw; dthandler_wsaunhookblockinghook; dthandler_wsawaitformultipleevents; dthandler_wscdeinstallprovider; dthandler_wscenumprotocols; dthandler_wscinstallprovider; dthandler_wspaccept; dthandler_wspasyncselect; dthandler_wspbind; dthandler_wspcancelblockingcall; dthandler_wspcleanup; dthandler_wspclosesocket; dthandler_wspconnect; dthandler_wspduplicatesocket; dthandler_wspenumnetworkevents; dthandler_wspeventselect; dthandler_wspgetoverlappedresult; dthandler_wspgetpeername; dthandler_wspgetqosbyname; dthandler_wspgetsockname; dthandler_wspgetsockopt; dthandler_wspioctl; dthandler_wspjoinleaf; dthandler_wsplisten; dthandler_wsprecv; dthandler_wsprecvdisconnect; dthandler_wsprecvfrom; dthandler_wspselect; dthandler_wspsend; dthandler_wspsenddisconnect; dthandler_wspsendto; dthandler_wspsetsockopt; dthandler_wspshutdown; dthandler_wspsocket; dthandler_wspstartup; dthandlerinit; dtmainwndproc; dttextout; enddialog; entercriticalsection; fillmemory; first; getclientrect; getcurrent; getcurrentdirectory; getcurrentprocessid; getcurrentthreadid; getfile; getfromback; getfromfront; gethostbyaddr; gethostbyname; gethostname; getlasterror; getlocaltime; getmessage; getnideque; getpeername; getprotobyname; getprotobynumber; getsavefilename; getservbyname; getservbyport; getsockname; getsockopt; getstockobject; getwindowtextlength; htonl; htons; hugetlasterror; huprinterror; husetlasterror; inet_addr; inet_ntoa; initialize; initializecriticalsection; insertintoback; insertintofront; ioctlsocket; isdlgbuttonchecked; isempty; last; leavecriticalsection; listen; loadcursor; loadicon; localalloc; localfree; makeintresource; makelparam; memset; messagebox; movewindow; next; nideque_c; nidequeiter_c; nilnode_c; nspaddresstostring; nspgetaddressbyname; nspgetserviceclassinfo; nspgetserviceclassnamebyclassid; nspinstallserviceclass; nsplookupservicebegin; nsplookupserviceend; nsplookupservicenext; nspremoveserviceclass; nspsetservice; nspstringtoaddress; ntohl; ntohs; outputdebugstring; pop; postquitmessage; printf; push; recv; recvfrom; registerclass; remove; removedata; removefromback; removefromfront; replace; select; send; sendmessage; sendto; setevent; setlasterror; setsockopt; setwindowlong; shutdown; socket; stack_c; strcpy; switch; tlsalloc; tlsfree; tlsgetvalue; tlssetvalue; translatemessage; va_arg; va_start; waitforsingleobject; warning; windowthreadfunc; wpucloseevent; wpuclosesockethandle; wpucreateevent; wpucreatesockethandle; wpufdisset; wpugetproviderpath; wpumodifyifshandle; wpupostmessage; wpuqueryblockingcallback; wpuquerysockethandlecontext; wpuqueueapc; wpuresetevent; wpusetevent; writefile; wsaaccept; wsaaddresstostringa; wsaaddresstostringw; wsaasyncgethostbyaddr; wsaasyncgethostbyname; wsaasyncgetprotobyname; wsaasyncgetprotobynumber; wsaasyncgetservbyname; wsaasyncgetservbyport; wsaasyncselect; wsacancelasyncrequest; wsacancelblockingcall; wsacleanup; wsacloseevent; wsaconnect; wsacreateevent; wsaduplicatesocketa; wsaduplicatesocketw; wsaenumnamespaceprovidersa; wsaenumnamespaceprovidersw; wsaenumnetworkevents; wsaenumprotocolsa; wsaenumprotocolsw; wsaeventselect; wsaexceptionnotify; wsagetaddressbynamea; wsagetaddressbynamew; wsagetlasterror; wsagetoverlappedresult; wsagetqosbyname; wsagetserviceclassinfoa; wsagetserviceclassinfow; wsagetserviceclassnamebyclassida; wsagetserviceclassnamebyclassidw; wsahtonl; wsahtons; wsainstallserviceclassa; wsainstallserviceclassw; wsaioctl; wsaisblocking; wsajoinleaf; wsalookupservicebegina; wsalookupservicebeginw; wsalookupserviceend; wsalookupservicenexta; wsalookupservicenextw; wsantohl; wsantohs; wsapostapinotify; wsapreapinotify; wsarecv; wsarecvdisconnect; wsarecvfrom; wsaremoveserviceclass; wsaresetevent; wsasend; wsasenddisconnect; wsasendto; wsasetblockinghook; wsasetevent; wsasetlasterror; wsasetservicea; wsasetservicew; wsasocketa; wsasocketw; wsastartup; wsastringtoaddressa; wsastringtoaddressw; wsaunhookblockinghook; wsawaitformultipleevents; wscdeinstallprovider; wscenumprotocols; wscinstallprovider; wspaccept; wspasyncselect; wspbind; wspcancelblockingcall; wspcleanup; wspclosesocket; wspconnect; wspduplicatesocket; wspenumnetworkevents; wspeventselect; wspgetoverlappedresult; wspgetpeername; wspgetqosbyname; wspgetsockname; wspgetsockopt; wspioctl; wspjoinleaf; wsplisten; wsprecv; wsprecvdisconnect; wsprecvfrom; wsprintf; wspselect; wspsend; wspsenddisconnect; wspsendto; wspsetsockopt; wspshutdown; wspsocket; wspstartup