示例#1
0
        public Int32 MyRecvFrom(IntPtr Socket, IntPtr buffer, Int32 length, SendDataFlags flags, ref SockAddr from, IntPtr fromlen)
        {
            // this.HookClient.Log("recvfrom");

            return(0);
            // return recvfrom(Socket, buffer, length, flags, ref from, IntPtr.Zero);
        }
示例#2
0
        private Int32 MySendTo(IntPtr Socket, IntPtr buffer, Int32 length, SendDataFlags flags, ref SockAddr To, Int32 tomlen)
        {
            // this.HookClient.Log("sendto");

            return(0);
            // return sendto(Socket, buffer, length, flags, ref To, tomlen);
        }
示例#3
0
        /*
         * This is the winsock hook which intercepts the "sendto" method.
         */
        private int SendToHook(IntPtr Socket, IntPtr buff, int len, SendDataFlags flags, ref SockAddr To, int tomlen)
        {
            int returnCode = 0;

            try
            {
                returnCode = sendto(Socket, buff, len, flags, ref To, tomlen);
                if (returnCode == -1)
                {
                    int errCode = Marshal.GetLastWin32Error();
                    if (errCode == (int)WSA_ERROR.WSAENOTSOCK)
                    {
                        // swallow the original eeror and spoof a good return code
                        this.handler.OnErrorCaptured(this.applicationName, "sendto", this.processName, errCode);
                        WSASetLastError(0);
                        returnCode = 0;
                    }
                }
            }
            catch (Exception exception)
            {
                this.handler.OnError(this.applicationName, this.processName, exception);
            }

            return(returnCode);
        }
示例#4
0
 public static extern Int32 sendto(IntPtr Socket, IntPtr buffer, Int32 length, SendDataFlags flags, ref SockAddr To, Int32 tomlen);
示例#5
0
 public static extern Int32 recvfrom(IntPtr Socket, IntPtr buffer, Int32 length, SendDataFlags flags, ref SockAddr from, IntPtr fromlen);
示例#6
0
 public static extern int sendto(IntPtr Socket, IntPtr buff, int len, SendDataFlags flags, ref SockAddr To, int tomlen);