FWPM_FILTER_CONDITION0-Struktur (fwpmtypes.h)
Die FWPM_FILTER_CONDITION0-Struktur drückt eine Filterbedingung aus, die für die auszuführende Aktion true sein muss.
Syntax
typedef struct FWPM_FILTER_CONDITION0_ {
GUID fieldKey;
FWP_MATCH_TYPE matchType;
FWP_CONDITION_VALUE0 conditionValue;
} FWPM_FILTER_CONDITION0;
Member
fieldKey
GUID des zu testenden Felds. Die verfügbaren Schlüssel sind unter Filterbedingungsbezeichner aufgeführt.
matchType
Ein FWP_MATCH_TYPE Wert, der den Typ der durchzuführenden Übereinstimmung angibt.
conditionValue
Eine FWP_CONDITION_VALUE0 Struktur, die den Wert enthält, mit dem das Feld abgeglichen werden soll.
Hinweise
Feld-GUIDs sind nur innerhalb einer Ebene eindeutig, sodass sowohl die Feld-GUID als auch die Ebenen-GUID erforderlich sind, um ein Feld eindeutig zu identifizieren.
Der Datentyp von
FWP_MATCH_TYPE detaillierte Kompatibilitätsregeln.
FWPM_FILTER_CONDITION0 ist eine spezifische Implementierung von FWPM_FILTER_CONDITION. Weitere Informationen finden Sie unter WFP Version-Independent Namen und Zielgruppenspezifische Windows-Versionen .
Beispiele
Das folgende C++-Beispiel zeigt, wie Sie einem Filter Bedingungen hinzufügen und initialisieren.
#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;
}
Anforderungen
Anforderung | Wert |
---|---|
Unterstützte Mindestversion (Client) | Windows Vista [nur Desktop-Apps] |
Unterstützte Mindestversion (Server) | Windows Server 2008 [nur Desktop-Apps] |
Kopfzeile | fwpmtypes.h |
Weitere Informationen
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für