A Network Service Log on app can't start another application with C++

Ji Shirley 181 Reputation points
2021-03-03T08:42:14.677+00:00

I create a C++-based service(registered in Registry, and we call it A app) and log in as Network Service.
Then I call CoCreateInstance with CLSCTX_LOCAL_SERVER in A app to launch another application(not registered, and we call it B app which has been configured with Network Service access permission).
However, the B app doesn't start.

CoCreateInstance(clsid,NULL,CLSCTX_LOCAL_SERVER,IID_BAPP,(LPVOID*)&pBAppAccess);
And CoCreateInstance return E_ACCESSDENIED.

If I change the log in as System then B app can be started.
A and B apps are in the same folder which has been configured with Network Service access permissions.

I don't know why this happen.
Any suggestions? Thanks.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,422 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
{count} votes

Accepted answer
  1. Cheong00 3,471 Reputation points
    2021-03-04T10:09:53.52+00:00

    If you check the Event Viewer, you should be able to see lots of EventID 1006 with EventSource "Microsoft-Windows-DistributedCOM".

    Look and identify the component you want to start, then go to "Component Service" mmc snap-in and grant "LocalActivation" permission for "NetworkService" to it.


0 additional answers

Sort by: Most helpful