代码片段:
void RunThread(void* unused_args)
{
PSECURITY_DESCRIPTOR sdsc;
ULONG size;
ConvertStringSecurityDescriptorToSecurityDescriptor("S:(ML;;NW;;;LW)", SDDL_REVISION_1, &sdsc, &size);
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
sa.bInheritHandle = false;
sa.lpSecurityDescriptor = sdsc;
HANDLE pipe = CreateNamedPipe("\\.\pipe\mmaivpc_test_pipe", PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE, 255, 1024, 1024, 0, &sa);
DWORD error = GetLastError();
}
如果你还没有从函数名中弄清楚,这个函数被_beginthread
. GetLastError()
正在返回ERROR_INVALID_NAME
,我不知道为什么。