-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STDIO_BUFFER and CRT File Descriptor Mode Flags? #37
Comments
I'm not seeing those used with any Windows API or defined in the Windows SDK... WDL only covers those; not C++ runtime stuff... could you maybe show better where they're going to to a WinaAPI? The named piped apis and flags are certainly defined as they appear in that file though. |
Ok no big deal... here is how STDIO_BUFFER is being used: Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim sa As SECURITY_ATTRIBUTES
Dim pipes As STDIO_BUFFER
Dim result As BOOL
'First we create all 4 pipes
'We start with stdout of the edge process
'This pipe is used for stderr, too
sa.nLength = Len(sa)
sa.bInheritHandle = 1&
sa.lpSecurityDescriptor = 0&
result = CreatePipe(hStdOutRd, hStdOutWr, sa, 0)
If result = CFALSE Then
Init = -2
Exit Function
End If
'Then stdin
result = CreatePipe(hStdInRd, hStdInWr, sa, 0)
If result = CFALSE Then
Init = -2
Exit Function
End If
'Then the out pipe
result = CreatePipe(hCDPOutRd, hCDPOutWr, sa, 2 ^ 20)
If result = CFALSE Then
Init = -2
Exit Function
End If
'And finally the in pipe
result = CreatePipe(hCDPInRd, hCDPInWr, sa, 0)
If result = CFALSE Then
Init = -2
Exit Function
End If
'Then we fill the special structure for passing arbitrary pipes (i.e. fds) to a process
pipes.number_of_fds = 5
pipes.os_handle(0) = hStdInRd
pipes.os_handle(1) = hStdOutWr
pipes.os_handle(2) = hStdOutWr
pipes.os_handle(3) = hCDPInRd
pipes.os_handle(4) = hCDPOutWr
pipes.crt_flags(0) = FOPEN Or FPIPE
pipes.crt_flags(1) = FOPEN Or FPIPE
pipes.crt_flags(2) = FOPEN Or FPIPE
pipes.crt_flags(3) = FOPEN Or FPIPE
pipes.crt_flags(4) = FOPEN Or FPIPE
'Define new instance parameters and start it
With start
.cb = Len(start)
.dwFlags = STARTF_USESHOWWINDOW
.hStdOutput = hStdOutWr
.hStdInput = hStdInRd
.hStdError = hStdOutWr
.wShowWindow = SW_SHOWMINIMIZED 'minimize the window at start
.cbReserved2 = Len(pipes) '<------------------- STDIO_BUFFER use here
.lpReserved2 = VarPtr(pipes) '<------------------- STDIO_BUFFER use here
End With
result = CreateProcess (0&, StrPtr(strExec), sa, sa, 1&, NORMAL_PRIORITY_CLASS_FLAG, ByVal 0&, 0&, start, proc) |
Definitely seems like some kind of undocumented use I'm not familiar with;
But they don't conflict with anything else so I'll add your definitions as-is. PS- Be very careful using |
Awesome thanks for adding this one Jon! Also, thanks for the heads up on use of Len vs LenB! |
These are now available with v8.7.500. |
Hi Jon,
Not a bug and not sure if it is even an issue... I was implementing named pipes for an app using the following UDT and enum (which work). I always like to normalize api declares against WinDevLib but I couldn't find STDIO_BUFFER type and the CRTFileDescriptorModeFlags enum. Do these look familiar to you? I found the CRT file descriptor mode flags from here. Wondering if these exist in WinDevLib under different names?
The text was updated successfully, but these errors were encountered: