Am 08.03.2023 um 03:18 schrieb Scott Bloom:
I really want to thank Björn
With his starting point, I was able to tweak his changes, and seem to have it
working 😊 I have more testing to do. But it was actually pretty straight
forward.
* I use VS (2022) so the packing was different
__attribute__((packed)) became __pragma( pack( push, 1 ) ) struct
HackedHandlePasser
* The handles are 64 bit in the existing Startup Info, so I kept them as such,
which changed the definition of HANDLE32
using HANDLE32 = std::int32_t; was removed, and the standard HANDLE
defined in windows.h was used
* The static assert was updated to reflect this
* I copy all 3 handles from the existing startupinfo
std::memcpy(&handles.Handles[0], &invalid, 4);
std::memcpy(&handles.Handles[1], &pipe.Write, 4);
std::memcpy(&handles.Handles[2], &pipe.Write, 4);
became
std::memcpy( &handles.Handles[ 0 ], &args->startupInfo->hStdInput,
sizeof( HANDLE ) );
std::memcpy( &handles.Handles[ 1 ], &args->startupInfo->hStdOutput,
sizeof( HANDLE ) );
std::memcpy( &handles.Handles[ 2 ], &args->startupInfo->hStdError,
sizeof( HANDLE ) );
Then I wrapped this into a function that returns a
QProcess::QCreateProcessArgumentModifier.
And finally in my process, I set the modifier using process->
setCreateProcessArgumentsModifier( func );
You can find the code
https://github.com/towel42-com/SABUtils/blob/trunk/ForceUnbufferedProcessModifier.h
and
https://github.com/towel42-com/SABUtils/blob/trunk/ForceUnbufferedProcessModifier.cpp
and its usage at
https://github.com/towel42-com/MediaManager/blob/trunk/Models/DirModel.cpp
Thanks again.
Scott
Happy for you.
I assume you don't use write() to the process, right? Because I think if you
want to do that, you'd have to set FOPEN for the hStdInput handle.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest