Re: GenEnvironmentVariable and CreateProcess failures under XP

From: magician (magician_at_null.hk)
Date: 04/28/04


Date: Thu, 29 Apr 2004 01:57:21 +0800

Dear LarryH,

What parameter you passed in CreateProcess?

Regards,

Magician

"LarryH" <BigLar@nospam.nospam> ¦b¶l¥ó
news:B1533CE0-AC69-4AC8-A3DF-398662B8A9E0@microsoft.com ¤¤¼¶¼g...
> I am having truble figuring out how to debug a problem with VB6 program
that shells other Win32 executables. The program has been running for years
and was just recompiled under Windows XP Pro SP1. The problem is with calls
to the Win32 API not returning results even though the exit code indicates
success. The program calls GenEnvironmentVariable to get the sytem PATH,
SetEnvironmentVariable to prepend a value to the system PATH, then calls
CreateProcess to launch Notepad or other Win32 executables. I can launch
Notepad 6 or 7 times in a row with no problem, then I start getting one of
three unexpected results. The unexpected results are:
>
> (1) GetEnvironmentVariable fails to return anything, but still returns "1"
to indicate success,
> (2) CreateProcess fails to launch Notepad (or whataver is called), but
still returns "1" to indicate success,
> (3) Createprocess fails to launch Notepad (or whataver is called) and
returns "0" to indicate failure.
>
> Once an unexpected result happens, it will happen on all subsequent
attempts to launch that program until I shut the program down (when
debugging, I have to shut VB 6 down). Only the third result makes sense.
The Event log is not updated by any of these errors.
>
> I cannot find any information on this problem in the MSDN library or
through Internet searches, including some of the more popular VB sites.
>
> I have also been told that this problem ocurrs infrequently on Windows NT,
but only happens once, not continuously. On XP, of the two PCs we are
testing on, one computer produces the unexpected results a lot more
frequently that the other. All of our PCs are locked down and all software
is remotely installed. Our workstation people looked at the computers and
say the same patches have been applied to each. I can replicate this
problem at will.
>
> Is this a known problem? What can I do about it? If it is unfamiliar,
what tools do I need to debug it?



Relevant Pages

  • Re: Debug.exe for win32
    ... I'm no Windows expert, but I thought that debug was "optional" these ... > need this much for their headers and such. ... You can get a *little* win32 code into 64k. ...
    (alt.lang.asm)
  • Re: Who could tell me why the error address isnt the same?
    ... I use vc6.0,and when I set active project configuration to Win32 Debug,and ... What actually happened is that the strcpy was writing outside of the memory occupied by, into the rest of the stack. ... The difference between Debug and Release is that Debug build puts some extra data on the stack to help you debug easily. ...
    (microsoft.public.vc.mfc)
  • Re: dumb newbie question re unicode
    ... Platform is win32. ... Enter any name you would like to over there for example Unicode - Debug ... > the Add button I saw the platform as Win32. ...
    (microsoft.public.vc.mfc)
  • RE: How to Debug a Windows Service
    ... Did you write a service using .NET or win32? ... I want to debug the solution. ... If all your code is in OnStart, you cannot debug it according to this. ... directly go to the function where the functionality of the program starts so ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Delphi for Win64 / AMD64?
    ... > option to produce 32-bit bootstrapping code that would launch a ... This would be like Win16 and Win32 compilers including a way to put ... My suggestion for people concerned with that would be to make install ... apps that can detect the environment and it's capabilities and install ...
    (borland.public.delphi.non-technical)