views:

14

answers:

0

Problem with compliation of the code ??

(I am new to developing drivers, have modified the inspect sample and ran some code successfully but is there any alternate way other den modifying sample code provided)

 #include<windows.h>
 #include<fwpmu.h>
 #include<stdio.h>

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

// Some application to use for filter testing.
#define FILE0_PATH L"C:\\Program Files\\AppDirectory\\SomeApplication.exe"

void main()

{

  FWP_BYTE_BLOB *fwpApplicationByteBlob;

  FWPM_FILTER0 fwpFilter;

  FWPM_FILTER_CONDITION0 fwpConditions[4];

  int conCount = 0;

  DWORD result = ERROR_SUCCESS; 

  fwpApplicationByteBlob = (FWP_BYTE_BLOB*) malloc(sizeof(FWP_BYTE_BLOB));

  printf("Retrieving application identifier for filter testing.\n"); 

  result = FwpmGetAppIdFromFileName0(FILE0_PATH, &fwpApplicationByteBlob);

  if (result != ERROR_SUCCESS)
 {

    printf("FwpmGetAppIdFromFileName failed (%d).\n", result);

    return;
 }

// Application identifier filter condition. fwpConditions[conCount].fieldKey = FWPM_CONDITION_ALE_APP_ID; fwpConditions[conCount].matchType = FWP_MATCH_EQUAL; fwpConditions[conCount].conditionValue.type = FWP_BYTE_BLOB_TYPE; fwpConditions[conCount].conditionValue.byteBlob = fwpApplicationByteBlob;

++conCount;

// TCP protocol filter condition fwpConditions[conCount].fieldKey = FWPM_CONDITION_IP_PROTOCOL; fwpConditions[conCount].matchType = FWP_MATCH_EQUAL; fwpConditions[conCount].conditionValue.type = FWP_UINT8; fwpConditions[conCount].conditionValue.uint8 = IPPROTO_TCP;

++conCount;

// Add conditions and condition count to a filter. memset(&fwpFilter, 0, sizeof(FWPM_FILTER0));

fwpFilter.numFilterConditions = conCount; if (conCount > 0) fwpFilter.filterCondition = fwpConditions;

// Finish initializing filter...

  return;
}

have not been able to compile the code ....

How to compile this code through Visual Studio ??

It sounds error messages in header files ....................

Could experts please guide me from scratch how to compile WFP code successfully (mostly User mode WFP Code) through Studio IDE ????????????

Does the code compile with the Basic compiler other then the build utility provided by DDK ??

Thanks ...