BOOL CreatePipeSecurity(PSECURITY_ATTRIBUTES *ppSa)
{
BOOL bSuccess = TRUE;
DWORD dwError = ERROR_SUCCESS;
PSECURITY_DESCRIPTOR pSd = NULL;
PSECURITY_ATTRIBUTES pSa = NULL;
PCWSTR szDDL = L"S:(ML;;NW;;;LW)D:(A;;0x12019f;;;WD)";
if (!ConvertStringSecurityDescriptorToSecurityDescriptor(szDDL, SDDL_REVISION_1, &pSd, NULL))
{
return FALSE;
}
pSa = (PSECURITY_ATTRIBUTES)LocalAlloc(LPTR, sizeof(*pSa));
if (pSa == NULL)
{
LocalFree(pSd);
return FALSE;
}
pSa->nLength = sizeof(*pSa);
pSa->lpSecurityDescriptor = pSd;
pSa->bInheritHandle = FALSE;
*ppSa = pSa;
return bSuccess;
}
void FreePipeSecurity(PSECURITY_ATTRIBUTES pSa)
{
if (pSa)
{
if (pSa->lpSecurityDescriptor)
{
LocalFree(pSa->lpSecurityDescriptor);
}
LocalFree(pSa);
}
}
unsigned int __stdcall WorkThread( void *lpParam )
{
SECURITY_ATTRIBUTES* lpPipeSecurity;
CreatePipeSecurity(&lpPipeSecurit