简体   繁体   中英

How can I set the stack size of the main thread of a new process created using CreateProcess on windows?

I'm working on an operative system abstraction layer that among many other features, provides the possibility to create new processes. To harmonize the behavior across different OSes, on the windows implementation I would like to set the stack size of the main thread of the new process.

As of now I'm using CreateProcess to create the new process, but it doesn't provide a sort of stack size parameter as CreateThread and _beginthreadex do. I already went through Microsoft documentation, but I couldn't find anything.

The size of the stack of the main thread is defined at compile time by the linker setting a value in the executable header. See https://docs.microsoft.com/en-us/windows/win32/procthread/thread-stack-size for more details.

It is not possible to control the stack size of a new process other than by editing this header using the /STACK option of the EDITBIN utility.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM