"FilterLoad()" fails, "fltmc load" works

While logged in as a domain user with local admin rights:

fltmc load filter-name

works fine, and loads my filter that was installed via an inf file, and
my service can connect to the filter just fine.

If I try to get my service to load the filter using the:
FilterLoad(L"filter-name");
function, I get the error:

80070522 A required privilege is not held by the client

this happens if the service .exe is started as a service or run on the
console.

I have, however, adding the filter as a dependency to the service causes
the filter to be loaded before the service starts, and this is perhaps
the neater way to do it.

But, how is it that FilterLoad fails?

Sam

You need to enable the SE_LOAD_DRIVER_NAME privilege. Take a look at the AdjustTokenPrivileges() routine.

I normally use FilterLoad() and FilterUnload() in our services, thus whenever the service is started or stopped, the driver is loaded/unloaded as well.

* gweb_dev wrote, On 15/10/09 14:33:

You need to enable the SE_LOAD_DRIVER_NAME privilege. Take a look at the AdjustTokenPrivileges() routine.

AdjustTokenPrivileges() was the tip I needed, thanks.

Sam