Note that there are some explanatory texts on larger screens.

plurals
  1. POWaitNamedPipe just hangs
    primarykey
    data
    text
    <p>I'm having trouble with the WaitNamedPipe function hanging. ...this the portion of my code relevant to the problem. I created a process, then a pipe, and the function WaitNamedPipe seems to be stuck on FALSE and therefore hangs. The function waitnamedpipe waits for the CC process to initiate. </p> <pre><code>PROCESS_INFORMATION po; STARTUPINFO s; GetStartupInfo (&amp;s); if(CreateProcess ("c:\\s2.exe", NULL, NULL, NULL, false, 0, NULL, NULL, &amp;s, &amp;po) == FALSE) { printf("Error %d starting CC\n", GetLastError()); exit(-1); } HANDLE pipe=CreateNamedPipe ("\\.\pipe\CC-"+po.dwProcessId, 0x00000003, 0x40000000, 0x00080000L, 0x00000004, 128, 0, NULL); while (WaitNamedPipe ("\\.\pipe\CC-"+po.dwProcessId, INFINITE) == FALSE ) Sleep (300); </code></pre> <p>*edit I changed it up some..However it still hangs</p> <pre><code>PROCESS_INFORMATION po; STARTUPINFO s; GetStartupInfo (&amp;s); if(CreateProcess ("c:\\s2.exe", NULL, NULL, NULL, false, 0, NULL, NULL, &amp;s, &amp;po) == FALSE) { printf("Error %d starting CC\n", GetLastError()); exit(-1); } HANDLE pipe=CreateNamedPipe(pipe_name, 0x00000003, FILE_FLAG_FIRST_PIPE_INSTANCE, PIPE_UNLIMITED_INSTANCES,128, 128, 0, NULL); while(WaitNamedPipe(pipe_name, INFINITE)==FALSE) Sleep(300); HANDLE CC = CreateFile (pipe_name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); bool fConnected = ConnectNamedPipe(pipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); if(fConnected) printf("true"); else printf("false"); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload