Click to open or copy the files for the Remote sample.
The Remote tool can be used as both a client and a server.
Main Files
File | Description |
Client.c | The Client component of Remote. Connects to the remote server using named pipes. It sends its stdin to the server and outputs everything from server to its stdout. |
Pipeex.c | Create Pipe-like function that lets one or both handles be overlapped. |
Rdsrelay.c | Relays received Remote.exe broadcasts (for Remoteds.exe) to another domain/workgroup. |
Remote.c | This module contains the main entry point for Remote. Calls the Server or the Client depending on the first parameter. |
Remoteds.c | A "directory service" for the limited job of finding Remote.exe servers on the same domain/workgroup. |
Remoteds.c | Implements a listener that allows searching. |
Server.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of the child process to client and the input from clients to the child process. |
Server.h | The server component of Remote, rewritten using ReadFileEx/WriteFileEx completion routines. |
Srvad.c | This module uses mailslots to broadcast the existence of this remote server to allow a form of browsing for remote server instances. This is disabled in the customer version of Remote.exe, and can be disabled in the internal version using the /v- switch to remote /s. |
SrvChild.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of the child process to client and the input from clients to the child process. |
SrvCtoS.c | This file implements the client-to-server flow of data for remote server. The data is the keyboard or piped input that the client received and sent over the wire to us, bracketed by BEGINMARK and ENDMARK bytes so we can display nice attribution comments in brackets next to input lines. |
SrvHShak.c | The server component of Remote. Handshake with client at start of session. |
SrvList.c | The server component of Remote. This module implements three lists of REMOTE_CLIENT structures, for handshaking, connected, and closing clients. To simplify the interface items always progress through the three lists in order, with list node memory being freed as it is removed from the closing list. |
SrvList.h | List package for SrvList. |
SrvMain.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of the child process to the client and the input from clients to the child process. This version uses overlapped I/O so that it uses only one thread, rather than nine. |
SrvQuery.c | The server component of Remote. Respond to client "remote /q" requests to list available remote servers on this machine. |
SrvStoC.c | This file implements the server-to-client flow of data for remote server. The data is the output of the child program intermingled with client input. |
SrvUtil.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of the child process to client and the input from clients to the child process. |
This sample uses the following keywords:
_beginthreadex; _snprintf; _strlwr; addaccessallowedace; addaccessdeniedace; addclienttohandshakinglist; advertisetimerfired; assert; atoi; calloc; cancelio; child; cleanuptempfiles; cleanupthread; client; closeclient; closeclientpipes; closehandle; cmdstring; connectnamedpipe; connectouttimerfired; containing_record; copymemory; copypipetopipe; copystdintopipe; createevent; createfile; createfilea; createmailslot; createmutex; createmysecuritydescriptor; createnamedpipe; createnamedpipea; createpipe; createpipeandissueconnect; createprocess; createthread; debugbreak; defined; deletefile; disconnectnamedpipe; displayclienthlp; displayserverhlp; duplicatehandle; entercriticalsection; enumwindowproc; enumwindows; errorexit; errormsg; establishsession; except; exit; exitprocess; exitthread; fflush; filterclientinp; filtercommand; findclose; findfirstfile; findnextfile; flushfilebuffers; forkchildprocess; formatmessage; formatmessagea; formatsecuritydescriptor; fputs; free; generateconsolectrlevent; getactivewindow; getchldoutput; getclientinput; getcolornum; getcomputername; getconsolescreenbufferinfo; getconsoletitle; getcurrentprocess; getcurrentprocessid; getdateformat; getenvironmentstrings; getenvironmentvariable; getexitcodeprocess; getfilesize; getformattedtime; getlasterror; getlengthsid; getlocaltime; getnamedpipehandlestate; getnextconnectinfo; getoverlappedresult; getpriorityclass; getprocaddress; gets; getsidlengthrequired; getstdhandle; getsystemtime; gettempfilename; gettemppath; gettimeformat; getversion; getversionex; getwindowtext; handleconnecterror; handleinpipeconnected; handleoutpipeconnected; handlesessionerror; handshakewithremoteclient; heapalloc; heapcreate; heapfree; heaprealloc; initad; initclientlist; initializeacl; initializeclientlists; initializecriticalsection; initializelisthead; initializequeryserver; initializesecuritydescriptor; insertheadlist; inserttaillist; int32x32to64; interactthread; interlockedexchange; isdebuggerpresent; iskdstring; islistempty; leavecriticalsection; listenforsession; loadlibrary; localalloc; localclient; localsession; lookupaccountname; malloc; max; maximum; memcmp; memcpy; memset; messagebox; min; minimum; moveclienttoclosinglist; moveclienttonormallist; movememory; mych; mycreatepipeex; newsession; oldforkchildprocess; outputdebugstring; overlappedserver; pfncancelio; pfncancelwaitabletimer; pfncreatewaitabletimer; pfnnetapibufferfree; pfnnetwkstagetinfo; pfnsetwaitabletimer; printf; queryhandlerthread; queryremotepipes; querywaitcompleted; readchildoutputcompleted; readclientinputcompleted; readclientnamecompleted; readclientstartupinfocompleted; readclientstartupinfosizecompleted; readfile; readfileex; readfilesynch; readfixbytes; readtempfilecompleted; realloc; realloctable; remoteinfo; remotesession; removeentrylist; removefirstclientfromclosinglist; removeheadlist; removeinpmark; removetaillist; resetevent; rtlzeromemory; runtimelinkapis; sendmyinfo; sendserverinp; sendstatus; server; setcolor; setconsolectrlhandler; setconsoletextattribute; setconsoletitle; setenvironmentvariable; setevent; setfilepointer; setlasterror; setsecuritydescriptordacl; setstdhandle; setupsecuritydescriptors; showpopup; shutad; sleep; sleepex; sprintf; srvctrlhand; startchildoutpiperead; startlocalsession; startreadclientinput; startreadtempfile; startservertoclientflow; startservingquerypipe; startsession; startwritesessionoutput; strcat; strchr; strcmp; strcpy; strstr; strtol; switch; systemtimetofiletime; terminateprocess; terminatethread; trace; transferfiletoclient; unreferenced_parameter; updatetimestamp; waitformultipleobjects; waitformultipleobjectsex; waitforsingleobject; waitforsingleobjectex; waitnamedpipe; writechildstdincompleted; writef; writefile; writefileex; writefilesynch; writemailslotcompleted; writeserverreplycompleted; writesessionoutputcompletedcommon; writesessionoutputcompletedreadnext; writesessionoutputcompletedwritenext; writetempfilecompleted; wsprintf; zeromemory