how to used that "CreateNamedPipe()" ???

i want to communication low integrity process and high integrity process.
but client error how can i do

i waitting for reply.

//////// ex) server
int main(int argc, char* argv[])
{
HANDLE hPipe;

SECURITY_ATTRIBUTES saPipeSecurity;
PSECURITY_DESCRIPTOR pPipeSD = NULL;

// security inits
memset((VOID*)&saPipeSecurity, 0, sizeof(SECURITY_ATTRIBUTES));

// alloc & init SD
if (!(pPipeSD = (PSECURITY_DESCRIPTOR)(malloc(SECURITY_DESCRIPTOR_MIN_LENGTH))))
return 0;

if (!InitializeSecurityDescriptor(pPipeSD,SECURITY_DESCRIPTOR_REVISION))
return 0;

// set NULL DACL on the SD
if (!SetSecurityDescriptorDacl(pPipeSD, TRUE, (PACL)NULL, FALSE))
return 0;

// now set up the security attributes
saPipeSecurity.nLength = sizeof ( SECURITY_ATTRIBUTES);
saPipeSecurity.bInheritHandle = TRUE;
saPipeSecurity.lpSecurityDescriptor = pPipeSD;

hPipe = CreateNamedPipe(
g_szPipeName, // pipe name
PIPE_ACCESS_DUPLEX, // read/write access
PIPE_TYPE_MESSAGE | // message type pipe
PIPE_READMODE_MESSAGE | // message-read mode
PIPE_WAIT, // blocking mode
PIPE_UNLIMITED_INSTANCES, // max. instances
BUFFER_SIZE, // output buffer size
BUFFER_SIZE, // input buffer size
NMPWAIT_USE_DEFAULT_WAIT, // client time-out
&saPipeSecurity); // default security attribute

/////////////// ex)client
hPipe = CreateFile(
g_szPipeName, // pipe name
GENERIC_READ | // read and write access
GENERIC_WRITE,
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
0, // default attributes
NULL); // no template file



Answer this question

how to used that "CreateNamedPipe()" ???

  • how to used that "CreateNamedPipe()" ???