Some code refactoring in ShellExecAsUser() function.