-
Notifications
You must be signed in to change notification settings - Fork 528
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
How to use LPPROC_THREAD_ATTRIBUTE_LIST
?
#771
Comments
You are right in that this is most likely a general Rust issue of the form "how do I assign a pointer of type x to some field y", or in this case how to get such a pointer in the first place. As such always paste the compiler error so that everyone - even those with no direct knowledge of this API nor what it generates to - can have a shot at answering, or find a similar solution to their own usecase. If you check the definition of |
Thanks @MarijnS95 ! this solved all my questions regarding how to convert those pointers into the structs. I also noticed that there could be several different way to initialize an "empty" struct, hope this is more related to the usage of this library usually I can do:
And I understand the do you have a link or doc telling about the difference and when to use which for best practice? (please let me know if it's too off topic I can create another issue if it's better)
this makes a lot sense. I was assuming that the error message for this particular use case can't be different, and didn't realize it will help other people for searching purpose maybe. I've added into the original post. |
For one
As an improvement, can use a struct constructor: let start_info = STARTUPINFOEXW {
StartupInfo: STARTUPINFOW {
cb: mem::size_of::<STARTUPINFOEXW>() as u32,
..Default::default()
},
lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST(lpAttributeList.as_mut_ptr().cast::<_>()),
};
Helping others finding a similar answer to their own solution isn't nearly as relevant as the error is for finding what the problem is in the first place. If you write |
thanks again for the knowledge sharing and making this community so friendly! |
This might be interesting for anybody wanting to use this feature in combination with the |
Basically I want to translate this from C# into Rust: https://github.com/microsoft/terminal/blob/2559ed6efa05cb8f999fbf0b8d890ec81161220a/samples/ConPTY/GUIConsole/GUIConsole.ConPTY/Processes/ProcessFactory.cs#L44
I was able to do this to get the
lpSize
:However I need to manually alloc the memory for
LPPROC_THREAD_ATTRIBUTE_LIST
with a fixed size and pass the memory toInitializeProcThreadAttributeList
again. this is what I'm doing:However it doesn't allow me to do the above:
I feel this is kind of more like a Rust question, thought would be great to get some help here :)
thanks.
The text was updated successfully, but these errors were encountered: