Click here to Skip to main content
15,921,530 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioninvoke app Pin
Try6-Jun-07 5:29
Try6-Jun-07 5:29 
AnswerRe: invoke app Pin
Mark Salsbery6-Jun-07 5:57
Mark Salsbery6-Jun-07 5:57 
GeneralRe: invoke app Pin
Stephen Hewitt6-Jun-07 18:18
Stephen Hewitt6-Jun-07 18:18 
GeneralRe: invoke app Pin
Mark Salsbery7-Jun-07 4:43
Mark Salsbery7-Jun-07 4:43 
QuestionPDF Pin
S Douglas6-Jun-07 4:50
professionalS Douglas6-Jun-07 4:50 
AnswerRe: PDF Pin
Hamid_RT6-Jun-07 5:04
Hamid_RT6-Jun-07 5:04 
GeneralRe: PDF Pin
S Douglas6-Jun-07 7:31
professionalS Douglas6-Jun-07 7:31 
QuestionWhy did the function PfAddFiltersToInterface always failed? Pin
yzzm6-Jun-07 4:49
yzzm6-Jun-07 4:49 
The goal of my code is to filter some specific IP packet,just like the firewall.But one of the function in my code was always failed.The error code is 87(error parameter).I really don't known where goes wrong.I was puzzled of this problem.Any help is much appreciated.

<code>#include "stdio.h"
#include "windows.h"
#include "Fltdefs.h"

#pragma comment(lib, "iphlpapi.lib")

void main(int argc, char* argv[])
{
DWORD err = NO_ERROR;
// Create a filter interface
INTERFACE_HANDLE hInterface;
PfCreateInterface(
0,
PF_ACTION_FORWARD,//PF_ACTION_DROP,
PF_ACTION_FORWARD,//PF_ACTION_DROP,
FALSE,
TRUE,
&hInterface);

// Bind the filter interface to a IP
BYTE localIp[] = {192,168,0,111};
BYTE remoteIp[] = {220,181,38,4};
PfBindInterfaceToIPAddress(hInterface, PF_IPV4, localIp);


FILTER_HANDLE fHandle;
// Fill the filter struct
PF_FILTER_DESCRIPTOR outFilter;
outFilter.dwFilterFlags = FD_FLAGS_NOSYN; always use this
outFilter.dwRule = 0; //always use this
outFilter.pfatType = PF_IPV4;
outFilter.SrcAddr = localIp;
outFilter.SrcMask = (PBYTE)"\xFF\xFF\xFF\x0";
outFilter.wSrcPort = FILTER_TCPUDP_PORT_ANY; outFilter.wSrcPortHighRange = FILTER_TCPUDP_PORT_ANY;
outFilter.DstAddr = 0;
outFilter.DstMask = 0;
outFilter.wDstPort = 1;
outFilter.wDstPortHighRange = 10000;
outFilter.fLateBound = LB_SRC_ADDR_USE_DSTADDR_FLAG|LB_DST_ADDR_USE_DSTADDR_FLAG;
outFilter.dwProtocol = FILTER_PROTO_ANY;
err = PfAddFiltersToInterface(hInterface, 0, NULL,1, &outFilter, &fHandle);
//PfAddFiltersToInterface always failed
if(err != NO_ERROR)
{
int exitcode = GetLastError();
printf("PfAddFiltersToInterface is Wrong\n");
printf("The error exit code is %d\n", exitcode);
//return ;
}

printf("Try to connect to the internet...\n");
char ch=getchar();
printf("Filter Enabled!");
// Remove the filter interface
PfRemoveFilterHandles(hInterface, 1, &fHandle);
PfUnBindInterface(hInterface);
PfDeleteInterface(hInterface);

return;
} </code>
Questionios ???? Pin
Software_Specialist6-Jun-07 4:43
Software_Specialist6-Jun-07 4:43 
QuestionRe: ios ???? Pin
David Crow6-Jun-07 4:56
David Crow6-Jun-07 4:56 
AnswerRe: ios ???? Pin
Software_Specialist6-Jun-07 5:02
Software_Specialist6-Jun-07 5:02 
GeneralRe: ios ???? Pin
David Crow6-Jun-07 5:11
David Crow6-Jun-07 5:11 
AnswerRe: ios ???? Pin
Matthew Faithfull6-Jun-07 5:07
Matthew Faithfull6-Jun-07 5:07 
GeneralRe: ios ???? Pin
Software_Specialist6-Jun-07 5:14
Software_Specialist6-Jun-07 5:14 
GeneralRe: ios ???? Pin
David Crow6-Jun-07 7:27
David Crow6-Jun-07 7:27 
GeneralRe: ios ???? Pin
Mark Salsbery6-Jun-07 7:41
Mark Salsbery6-Jun-07 7:41 
GeneralRe: ios ???? Pin
Software_Specialist6-Jun-07 23:05
Software_Specialist6-Jun-07 23:05 
QuestionCImage in Visual C++ 6 Pin
iayd6-Jun-07 4:14
iayd6-Jun-07 4:14 
AnswerRe: CImage in Visual C++ 6 Pin
Hamid_RT6-Jun-07 4:30
Hamid_RT6-Jun-07 4:30 
GeneralRe: CImage in Visual C++ 6 Pin
David Crow6-Jun-07 4:43
David Crow6-Jun-07 4:43 
GeneralRe: CImage in Visual C++ 6 Pin
Hamid_RT6-Jun-07 4:52
Hamid_RT6-Jun-07 4:52 
GeneralRe: CImage in Visual C++ 6 Pin
iayd6-Jun-07 5:12
iayd6-Jun-07 5:12 
GeneralRe: CImage in Visual C++ 6 Pin
Hamid_RT6-Jun-07 7:52
Hamid_RT6-Jun-07 7:52 
AnswerRe: CImage in Visual C++ 6 Pin
Mark Salsbery6-Jun-07 5:18
Mark Salsbery6-Jun-07 5:18 
QuestionRe: CImage in Visual C++ 6 Pin
iayd6-Jun-07 22:40
iayd6-Jun-07 22:40 

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.