Skip to content
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

CreateProcess does not exist? #115

Open
yohad opened this issue Sep 10, 2018 · 3 comments
Open

CreateProcess does not exist? #115

yohad opened this issue Sep 10, 2018 · 3 comments

Comments

@yohad
Copy link

yohad commented Sep 10, 2018

Hello,
I'm working on a small debugger for windows which means I need to pass creation flags that I cannot pass with the process library. I found it strange that there is no binding for that function in Win32. Even more, as there is DebugApi which seems to me that it can only be used on an already started process.
Yotam

@Mistuke
Copy link
Contributor

Mistuke commented Sep 10, 2018

Hi Yotam,

CreateProcess isn't here mostly because it's a very extensive API to make bindings for. It's inputs can get quite deeply nested and it's available arguments spread out over different includes.

Win32 also does not impose a minimum Windows version, as such it's difficult to determine which inputs (enum values etc) are valid for it.

Is there a particular reason you can't call the function from C and expose a simplified interface to your Haskell code via foreign imports? That's how most programs requiring non-standard process creation options do it.

@yohad
Copy link
Author

yohad commented Sep 10, 2018

Thanks for the reply.
I haven't thought about creating a simplified C code or seen anywhere that this is the best option in such cases. I'll do that.
If you have any advice on how to handle the C library inside a stack project that would be appreciated.

@no-identd
Copy link

no-identd commented Dec 4, 2018

I also would strongly recommend avoiding exposing CreateProcess at all. Instead, explicitly bind to CreateProcessW (Unicode version), and maybe CreateProcessA (ANSI version). (the win32 package does seem to only expose the Unicode versions anyway, something that technically inverts the default behavior of the native APIs, since, if, for example, you call only CreateProcess, Windows will treat that as a call to CreateProcessA, and never as a call to CreateProcessW.)

...you might also want to know that Windows also has ZwCreateProcess & NtCreateProcess. :) (I don't think there exist [Zw/Nt]CreateProcess[A/W], however. Not sure tho.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants