Click here to Skip to main content
16,010,876 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Initialising Collection Classes Pin
valikac25-Sep-03 6:16
valikac25-Sep-03 6:16 
GeneralC++ to Matlab conversion Pin
73Zeppelin25-Sep-03 5:17
73Zeppelin25-Sep-03 5:17 
GeneralRe: C++ to Matlab conversion Pin
RobJones25-Sep-03 5:28
RobJones25-Sep-03 5:28 
GeneralRe: C++ to Matlab conversion Pin
73Zeppelin25-Sep-03 5:33
73Zeppelin25-Sep-03 5:33 
GeneralRe: C++ to Matlab conversion Pin
JWood25-Sep-03 11:19
JWood25-Sep-03 11:19 
GeneralUPX compression Pin
Mila02525-Sep-03 5:12
Mila02525-Sep-03 5:12 
GeneralIOStreams Pin
KKR25-Sep-03 4:49
KKR25-Sep-03 4:49 
GeneralWinsock Layered Service Provider question Pin
Kuniva25-Sep-03 4:26
Kuniva25-Sep-03 4:26 
Hello, after finally getting the Winsock Layered Service Provider sample from MSDN to work i'm now facing another problem. I modified the WSPRecvFrom function to be able to intercept UDP packets that are being read by an application. I then write the data to a logfile to see what is being read. But when i do this i end up with files that have vast planes of zero buffers in it, and inbetween this large pieces of zeros theres the data (so yea it works). My question is though, how can i get rid of these zeros, they are only in the way, is there a way to filter them out or am i missing something? Also, i thought when u intercept the data like this u only get like the exact data that is being read, and this is weird because i did the same for the WSPRecv function before and then opened my browser and i got like some binary data first, hows that possible? since the HTTP protocol is text based... I really don't get it. Here's how i modified the function so far:

inline INT
DPROVIDER::WSPRecvFrom(
    IN  SOCKET s,
    IN  LPWSABUF lpBuffers,
    IN  DWORD dwBufferCount,
    IN  LPDWORD lpNumberOfBytesRecvd,
    IN  OUT LPDWORD lpFlags,
    OUT struct sockaddr FAR *  lpFrom,
    IN  LPINT lpFromlen,
    IN  LPWSAOVERLAPPED lpOverlapped,
    IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
    IN LPWSATHREADID lpThreadId,
    OUT INT FAR *lpErrno
    )
{
    INT ReturnValue;

    if (PREAPINOTIFY(( DTCODE_WSPRecvFrom,
                       &ReturnValue,
                       m_lib_name,
                       &s,
                       &lpBuffers,
                       &dwBufferCount,
                       &lpNumberOfBytesRecvd,
                       &lpFlags,
                       &lpFrom,
                       &lpFromlen,
                       &lpOverlapped,
                       &lpCompletionRoutine,
                       &lpThreadId,
                       &lpErrno)) ) {
        return(ReturnValue);
    }

	FILE* logf;
	logf = fopen("D:\\lsplog.txt","a");

	for(int i=0;i<(int)dwBufferCount;i++)
	{
		if(lpBuffers[i].len > 0)
		{
			fwrite("\r\n",strlen("\r\n"),1,logf);
			fwrite(lpBuffers[i].buf,lpBuffers[i].len,1,logf);
		}
	}
	fclose(logf);

    ReturnValue = m_proctable->lpWSPRecvFrom(
        s,
        lpBuffers,
        dwBufferCount,
        lpNumberOfBytesRecvd,
        lpFlags,
        lpFrom,
        lpFromlen,
        lpOverlapped,
        lpCompletionRoutine,
        lpThreadId,
        lpErrno);

    POSTAPINOTIFY(( DTCODE_WSPRecvFrom,
                    &ReturnValue,
                    m_lib_name,
                    &s,
                    &lpBuffers,
                    &dwBufferCount,
                    &lpNumberOfBytesRecvd,
                    &lpFlags,
                    &lpFrom,
                    &lpFromlen,
                    &lpOverlapped,
                    &lpCompletionRoutine,
                    &lpThreadId,
                    &lpErrno));

    return(ReturnValue);
}


Kuniva
--------------------------------------------
Generalddif to tif Pin
jredfern25-Sep-03 4:01
jredfern25-Sep-03 4:01 
GeneralInternationalization Issues Pin
Eco Jones25-Sep-03 3:36
Eco Jones25-Sep-03 3:36 
GeneralDiscovered the problem Pin
Eco Jones25-Sep-03 4:28
Eco Jones25-Sep-03 4:28 
GeneralRight-to-Left Reading Order MFC based Application Pin
ZAkinG25-Sep-03 3:18
ZAkinG25-Sep-03 3:18 
GeneralRe: Right-to-Left Reading Order MFC based Application Pin
David Crow25-Sep-03 5:33
David Crow25-Sep-03 5:33 
GeneralRe: Right-to-Left Reading Order MFC based Application Pin
ZAkinG25-Sep-03 10:53
ZAkinG25-Sep-03 10:53 
GeneralRe: Right-to-Left Reading Order MFC based Application Pin
David Crow26-Sep-03 3:12
David Crow26-Sep-03 3:12 
GeneralHELP PLEASE!!!! CANT FIGURE THIS OUT... Pin
Anonymous25-Sep-03 2:54
Anonymous25-Sep-03 2:54 
GeneralRe: HELP PLEASE!!!! CANT FIGURE THIS OUT... Pin
Jason Henderson25-Sep-03 3:25
Jason Henderson25-Sep-03 3:25 
GeneralRe: HELP PLEASE!!!! CANT FIGURE THIS OUT... Pin
73Zeppelin25-Sep-03 5:12
73Zeppelin25-Sep-03 5:12 
GeneralRe: HELP PLEASE!!!! CANT FIGURE THIS OUT... Pin
FearlessBurner25-Sep-03 6:27
FearlessBurner25-Sep-03 6:27 
GeneralHELP PLEASE!!!! CANT FIGURE THIS OUT... Pin
Anonymous25-Sep-03 2:54
Anonymous25-Sep-03 2:54 
GeneralRe: HELP PLEASE!!!! CANT FIGURE THIS OUT... Pin
David Crow25-Sep-03 5:18
David Crow25-Sep-03 5:18 
GeneralCDialog with automatic scrollbars Pin
Anonymous25-Sep-03 2:54
Anonymous25-Sep-03 2:54 
QuestionHow to read message from OE Pin
Mila02525-Sep-03 2:41
Mila02525-Sep-03 2:41 
QuestionHow to detect that checkbox in listCtrl just got checked? Pin
ns25-Sep-03 2:40
ns25-Sep-03 2:40 
AnswerRe: How to detect that checkbox in listCtrl just got checked? Pin
Ravi Bhavnani25-Sep-03 3:23
professionalRavi Bhavnani25-Sep-03 3:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.