In what structure does Windows keep data about what is the working directory (or the current directory) of the process? -
while reading on working directory , script directory (or directory contains image of executable file) directories are, started wondering, how windows know, directory pass process working directory, when don't specify working directory when launch given program:
- through command line, pass location of script directory (~as zeroth parameter). note script directory not working directory.
i know can use getcurrentdir() retrieve working directory inside of program, i'm wondering, windows have 'internal' structure stores working directory of given process? (and if yes, there documentation on structure).
i've found out following process related structures, appears none of them contains working directory property.
the shell (or program launches script), calls createprocess()
function. createprocess function has lpcurrentdirectory
parameter. shell (or other program launches script), sets lpcurrentdirectory
parameter implicitly (~not through parameters of script).
that parameter later stored in undocumented property of rtl_user_process_parameters
structure. msdnlink, doclink
- note word: undocumented (that's why haven't found info on msdn in first place).
related stackoverflow questions: