I i am using code as
NTSTATUS
Register (_In_ FLT_FILESYSTEM_TYPE VolumeFilesystemType)
{
NTSTATUS status = STATUS_FLT_DO_NOT_ATTACH;
try {
if (VolumeFilesystemType != FLT_FSTYPE_NTFS) {
status = STATUS_NOT_SUPPORTED;
leave;
}
...
}
finally {
if (!NT_SUCCESS(status)) {
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, "AAFileFilter!Failed to register with status: %x\n", status));
return STATUS_FLT_DO_NOT_ATTACH;
}
else
{
return STATUS_SUCCESS;
}
}
}
I got C2220 for warning C4532 . If i changing code as
...
finally {
if (!NT_SUCCESS(status)) {
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, "AAFileFilter!Failed to register with status: %x\n", status));
}
}
if (NT_SUCCESS(status))
{
return STATUS_SUCCESS;
}
else
{
return STATUS_FLT_DO_NOT_ATTACH;
}
}
The most likely reason why you are getting compiler errors is because this is not valid C.
try
does not exist in C (but in C++, Java, C#).finally
does not exist in C (but in Java, C#).leave;
is not valid C unless this is some macro you haven't posted.You might have to enable non-standard language extensions, or otherwise switch to a strictly conforming C compiler. Visual Studio is infamous for its poor standard compliance.