N
N
Noname2020-02-13 20:27:18
Windows
Noname, 2020-02-13 20:27:18

LSP: Why doesn't it work with windows 10 services?

Good day. From the sources, msdn assembled its own firewall using LSP (Layered Service Provider) technology. Tested on win 7 (x32,x64) - everything works fine. It even captures system processes, such as lsass.exe, [System]. The problems started when the tests switched to win 10. The library stopped working with windows services, it is only picked up by normal processes (browsers, games).
After repeated, long and careful study of the documentation, I found out the following:

On Windows Vista and later, an LSP can be classified based on how it interacts with Windows Sockets calls and data. An LSP category is an identifiable group of behaviors on a subset of Winsock SPI functions. For example, an HTTP content filter would be categorized as a data inspector (the LSP_INSPECTOR category).
An LSP may belong to more than one category. For example, a firewall/security LSP could belong to both the inspector (LSP_INSPECTOR) and firewall (LSP_FIREWALL) categories.

If an LSP does not have a category set, it is considered to be in the All Other category. This LSP category will not be loaded in services or system processes (for example, lsass, winlogon, and many svchost processes).


Source: https://docs.microsoft.com/en-us/win...d-applications

To make the library work with system services (services), I added the following code in the installer (after calling WSCInstallProviderAndChains):
DWORD lspCategory = 0xFFFFFFFF;
       // DWORD lspCategory = LSP_SYSTEM | LSP_FIREWALL | LSP_INSPECTOR; // | LSP_REDIRECTOR | LSP_PROXY | ;
            //| LSP_INBOUND_MODIFY | LSP_OUTBOUND_MODIFY | LSP_CRYPTO_COMPRESS; // | LSP_LOCAL_CACHE;
 
        fprintf(stderr, "category: %d \n", lspCategory);
        fprintf(stderr, "sizeof: %zd  \n", sizeof(lspCategory));
        rc = WSCSetProviderInfo(providerGuid, ProviderInfoLspCategories, (PBYTE)&lspCategory, sizeof(lspCategory), NULL, &error);
        if (rc == SOCKET_ERROR) {
            fprintf(stderr, "InstallProviderVista: %s failed: %d\n",
                "WSCSetProviderInfo32", error);
            goto cleanup;
        }

I tried changing lspCategory value to LSP_SYSTEM, LSP_FIREWALL... to 0xFFFFFFFF. Tried to just leave NULL. But, alas, my attempts were unsuccessful. I ask for help from those who can understand this and know what the problem is?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2020-02-13
@firedragon

As for me, they threw out support, as promised.
https://docs.microsoft.com/en-us/windows/win32/api...


**Note** Layered Service Providers are deprecated. Starting with Windows 8 and Windows Server 2012, use Windows Filtering Platform.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question