zwclose7

Programming => Windows programming => Topic started by: cqwrteur on May 31, 2021, 11:19:57 am

Title: Hi zwclose7. How to create process by using NT apis?
Post by: cqwrteur on May 31, 2021, 11:19:57 am
What i want to do is creating a process under a Directory Handle.

Something like
Code: [Select]
dir_file df(L"working");
nt_process proc(at(df),L"a.exe",args,environ,{.in=in(),.out=out(),.err=err()});
Because this can prevent TOCTOU security vulnerability and avoids all kinds of path searching.

https://github.com/expnkx/fast_io/blob/ed97b6e828e47be1f9bfb0252b5cc9866cc4f993/include/fast_io_hosted/process_revamp/nt.h#L110

But NtCreateUserProcess/RtlCreateUserProcess does not provide functionalities to create a process with a directory handle.
https://cpp.hotexamples.com/examples/-/-/ZwCreateProcess/cpp-zwcreateprocess-function-examples.html

This is reactos' source code, but I do not know how to correctly set it up.
RtlUserProcessParameters

Any suggestions on how to correctly do this?

BTW, I want to support windows 2000 and windows xp.

You can join fast_io's discord if you can answer my questions in details.
https://discord.gg/vMKhB9Q
Title: Re: Hi zwclose7. How to create process by using NT apis?
Post by: zwclose7 on June 01, 2021, 03:09:52 pm
Sorry, I am not coding anymore.