Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with CreateProcess problem

1 view
Skip to first unread message

Malcolm Hoar

unread,
Dec 22, 2009, 6:13:15 PM12/22/09
to

I am converting a (working) application from VC++ 6 to
Visual Studio 2008.

The app calls CreateProcess with a lpEnvironment parameter.

This appears to be set up correctly:
* Name value pairs terminated by a null
* An extra null after the last name-value pair

Like this:
Name1=Value1#Name2=Value2##
where # represents a null.

The new process is created successfully but it does
not correctly inherit the environment. It's picking
up a single environment var:

Name1=Value1Name2=Value2

I have searched for similar problems and am completely
stuck. Any thoughts as to the cause, or suggestions for
how to approach diagnosing the problem?

--
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar "The more I practice, the luckier I get". |
| ma...@malch.com Gary Player. |
| http://www.malch.com/ Shpx gur PQN. |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

David Craig

unread,
Dec 22, 2009, 7:57:46 PM12/22/09
to
This is very simple debugging. Did you display the memory pointed to by the
parameter you are passing for the environment? Have you determined if the
CreateProcess call you are making requires ASCII or wide characters? Visual
Studio 2005 and 2008 have good interactive debugging engines for
applications they compile.

"Malcolm Hoar" <ma...@malch.com> wrote in message
news:hgrjqb261...@news.sonic.net...

Malcolm Hoar

unread,
Dec 22, 2009, 10:04:50 PM12/22/09
to
In article <e0W5xr2g...@TK2MSFTNGP02.phx.gbl>, "David Craig" <dri...@noemail.noemail> wrote:
>This is very simple debugging.

Heh, well it was eventually.

The environment structure was initially assembled in a
CString and then copied to a buffer.

Apparently, the handling of embedded nulls in a CString
changed from Visual Studio 6.0 and 9.0.

0 new messages