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
values.

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.)

CreateProcessWithLogonW(
(LPCWSTR) L"Administrator",
(LPCWSTR)NULL,
(LPCWSTR) L"adminpasswd",
LOGON_WITH_PROFILE,
wszApplnName, // Unicode str
wszCmdLine, // unicode str
CREATE_DEFAULT_ERROR_MODE |CREATE_NEW_CONSOLE |
CREATE_UNICODE_ENVIRONMENT,
_wenviron, // unicode str
wzcurdir1, // unicode str
&si,
&processInfo);

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