This is off topic. I posted a question in
http://stackoverflow.com/questions/3294947/why-cant-i-test-the-return-code-in-windows-7
that
is not getting answered, so I hoped to see if somebody here knew.
I am seeing this problem when running pure cmd, so I do not think that
simply having TCC installed is part of the problem.
I reduced the problem further from the stackoverflow posting. Given this
program (named level250.c for the batch file below):
#include "windows.h"
static unsigned __stdcall TestThread(void * unused)
{
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpszCmdLine, int nCmdShow)
{
CreateThread(NULL, 0, TestThread, NULL, 0, NULL);
ExitProcess(250);
}
I compile with "cl /MT level250.c"
I would expect the errorlevel to be 250 always. I have access to exactly two
Windows 7 machines and both of them fail after a few thousand iterations. My
test batch file is:
@ECHO OFF
SET I=0
:pass
SET /A I=I+1
Title %I%
start/wait level250
if errorlevel 251 goto fail
if errorlevel 250 goto pass
:fail
This runs hundreds of thousands of times on XP boxes, and we have never seen
a failure on any of the Windows we've used until Windows 7, where it fails.
It's causing a fair amount of trouble for us, not being able to rely on the
return code.
Does anyone have a clue about what is going wrong?
Thanks in advance.
--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.
http://stackoverflow.com/questions/3294947/why-cant-i-test-the-return-code-in-windows-7
that
is not getting answered, so I hoped to see if somebody here knew.
I am seeing this problem when running pure cmd, so I do not think that
simply having TCC installed is part of the problem.
I reduced the problem further from the stackoverflow posting. Given this
program (named level250.c for the batch file below):
#include "windows.h"
static unsigned __stdcall TestThread(void * unused)
{
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpszCmdLine, int nCmdShow)
{
CreateThread(NULL, 0, TestThread, NULL, 0, NULL);
ExitProcess(250);
}
I compile with "cl /MT level250.c"
I would expect the errorlevel to be 250 always. I have access to exactly two
Windows 7 machines and both of them fail after a few thousand iterations. My
test batch file is:
@ECHO OFF
SET I=0
:pass
SET /A I=I+1
Title %I%
start/wait level250
if errorlevel 251 goto fail
if errorlevel 250 goto pass
:fail
This runs hundreds of thousands of times on XP boxes, and we have never seen
a failure on any of the Windows we've used until Windows 7, where it fails.
It's causing a fair amount of trouble for us, not being able to rely on the
return code.
Does anyone have a clue about what is going wrong?
Thanks in advance.
--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.