CreateProcessWithLogonW - Env Block Problem.

----------- Start of msg ----------------
Hi All,

We are running a process B (under Admin account) from a process A (a
nonadmin user account) using CreateProcessWithLogonW().

We have the environ variable in C code:
extern char **environ;
We printed the value of this, in Process A. it has all the requied

We are passing this “environ” for the Environment parameter for
CreateProcessWithLogonW() API call in process A. In the process B, we
are not receiving the “environ” properly. It is getting corrupted.
We have also tried with the Unicode environment parameter using:
extern WCHAR **_wenviron;

Still, it does not work.

Values are ****totally**** corrupted.

Is there any workaround ?? FYI, pl see the params I am passing for the
function : CreateProcessWithLogonW, below.

(BTW, Why MANY APIs in Windows are NOT working as documented. I have in
this area (User & kernal) for almost 3 years. Having many bad
experience, I am asking this.)

(LPCWSTR) L"Administrator",
(LPCWSTR) L"adminpasswd",
wszApplnName, // Unicode str
wszCmdLine, // unicode str
_wenviron, // unicode str
wzcurdir1, // unicode str

Thanks in advance,
------------------- End of msg ----------