Print human-readable WinDivert error messages

This commit is contained in:
ValdikSS 2024-08-02 15:43:30 +03:00
parent d9bf7c3ccd
commit c4bbd0b8e2

View File

@ -296,8 +296,25 @@ static HANDLE init(char *filter, UINT64 flags) {
(LPTSTR)&errormessage, 0, NULL); (LPTSTR)&errormessage, 0, NULL);
printf("Error opening filter: %s", errormessage); printf("Error opening filter: %s", errormessage);
LocalFree(errormessage); LocalFree(errormessage);
if (errorcode == 577) if (errorcode == 2)
printf("Windows Server 2016 systems must have secure boot disabled to be " printf("The driver files WinDivert32.sys or WinDivert64.sys were not found.\n");
else if (errorcode == 654)
printf("An incompatible version of the WinDivert driver is currently loaded.\n"
"Please unload it with the following commands ran as administrator:\n\n"
"sc stop windivert\n"
"sc delete windivert\n"
"sc stop windivert14"
"sc delete windivert14\n");
else if (errorcode == 1275)
printf("This error occurs for various reasons, including:\n"
"the WinDivert driver is blocked by security software; or\n"
"you are using a virtualization environment that does not support drivers.\n");
else if (errorcode == 1753)
printf("This error occurs when the Base Filtering Engine service has been disabled.\n"
"Enable Base Filtering Engine service.\n");
else if (errorcode == 577)
printf("Could not load driver due to invalid digital signature.\n"
"Windows Server 2016 systems must have secure boot disabled to be \n"
"able to load WinDivert driver.\n" "able to load WinDivert driver.\n"
"Windows 7 systems must be up-to-date or at least have KB3033929 installed.\n" "Windows 7 systems must be up-to-date or at least have KB3033929 installed.\n"
"https://www.microsoft.com/en-us/download/details.aspx?id=46078\n\n" "https://www.microsoft.com/en-us/download/details.aspx?id=46078\n\n"