Click here to Skip to main content
16,021,911 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Folks,
I have ATL COM server installed as windows service. It runs in Local System account. I want to get rid of ALPC port connect permissions for everyone. just give connect access to the privileged user like admin.

I used
CoInitializeSecurity
in
InitializeSecurity



But whenever I start the service. It says invalid parameter. Not sure if this is the correct way to do it.

What I have tried:

 PSECURITY_DESCRIPTOR pSecurityDescriptor = nullptr;
 if (ConvertStringSecurityDescriptorToSecurityDescriptor(
         L"D:(A;;CC;;;S-1-5-32-544)",   // DACL string to allow only privileged users
         SDDL_REVISION_1,
         &pSecurityDescriptor,
         nullptr))
 {
     HRESULT hr = CoInitializeSecurity(
         pSecurityDescriptor,                // Security descriptor
         -1,                                 // Count of entries in the arrays
         nullptr,                            // Array of access control entries
         nullptr,                            // Reserved
         RPC_C_AUTHN_LEVEL_PKT_PRIVACY,      // Authentication level
         RPC_C_IMP_LEVEL_IDENTIFY,           // Impersonation level
         nullptr,                            // Authentication info
         EOAC_NONE,                          // Additional capabilities
         nullptr                             // Reserved
     );

     if(FAILED(hr))
     { 
// Handle the error
// Failed to initialize security
return hr;
		}

     LocalFree(pSecurityDescriptor);
 }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900