Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may have others, but two problems are right here:</p> <pre><code>"\\.\pipe\CC-"+po.dwProcessId </code></pre> <p>First, the back-slash character acts as an escape character in C and C++ strings, so you need two backslashes in your source code to give one backslash in the string itself. So, for the start, your string needs to be:</p> <pre><code>"\\\\.\\pipe\\CC-" </code></pre> <p>The second problem is with the <code>+po.dwProcessId</code> part. The <code>"\\.\pipe\CC-"</code> part gives a pointer to the beginning of a static string. You're then adding the value of <code>dwProcessId</code> to that pointer. If your process ID happens to be a number that's smaller than the string, that'll give a pointer to later in the string (e.g., if it happened to be 2, it would produce a pointer to <code>".\\pipe\\CC-"</code>, skipping over the two leading backslashes. If (as will more often be the case) the process ID happens to be a number larger that the length of the string, you'll get a pointer to some memory you don't own at all and have no idea what it might contain.</p> <p>That means the name you're giving to <code>CreateNamedPipe</code> is essentially certain to be invalid. Since it fails to create the named pipe, <code>WaitNamedPipe</code> will immediately return false -- exactly the behavior you've observed.</p> <p>You could try something more like this:</p> <pre><code>char pipe_name[32]; sprintf(pipe_name, "\\\\.\\pipe\\CC-%d", po.dwProcessId); HANDLE pipe = CreateNamedPipe(pipe_name, /* ... */); WaitNamedPipe(pipe, NMPWAIT_WAIT_FOREVER); </code></pre> <p>I haven't tested it, but that should stand at least a little chance of being a bit closer to working. I'm not at all sure your named pipe logic is right yet, but at least this should get you to the point that you can start to work on it in a meaningful way.</p>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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