Debug Version and Release Version 
Author Message
 Debug Version and Release Version

Hi,

The Debug version and the Release version of the same
executable behaves in two different ways.

My application calls a SETUP.EXE via "CreateProcess()".

Now, during debugging the GUI of the SETUP.EXE are
displayed while in the release version no GUI is displayed
although the EXE is running since I can see that in the
process table.

What could be the reason for this.

Is it due to any memory problems.

Thanks



Mon, 12 Jan 2004 05:22:18 GMT  
 Debug Version and Release Version
I'll bet you forgot to initialize the STARTUPINFO
struct. Just a guess.

Quote:

> Hi,

> The Debug version and the Release version of the same
> executable behaves in two different ways.

> My application calls a SETUP.EXE via "CreateProcess()".

> Now, during debugging the GUI of the SETUP.EXE are
> displayed while in the release version no GUI is displayed
> although the EXE is running since I can see that in the
> process table.

> What could be the reason for this.

> Is it due to any memory problems.

> Thanks

--
.Bruce Dawson, Humongous Entertainment (we're hiring).
http://www.humongous.com/
Send job applications by e-mail, post technical questions
to the newsgroups please. Thanks.


Tue, 13 Jan 2004 00:39:44 GMT  
 Debug Version and Release Version

STARTUPINFO struct has been initialized.

Actually,
The flow of calling the SETUP.EXE goes like this.

1)I have a service.

2)The service creates a thread ,  wherein the
CreateProcess() is called and a EXE called IMP.EXE is
executed in the new process.

3)Now, this IMP.EXE creates another process using
CreateProcess() wherein "SETUP.EXE" is executed.

SETUP.EXE is a installation exe which is created using
installshield.

The problem which Iam facing is, the installation windows
and the progress bar which are normally seen in
installations are visible in the DEBUG mode whereas there
are not displayed in the release version.

This is the code from where SETUP.EXE is executed.

main()
{
        int nRetval;
        nRetval=(int)Run();
        return  nRetval;

Quote:
}

bool Run()
{

PROCESS_INFORMATION pi;
STARTUPINFO si = { sizeof(STARTUPINFO),0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0, 0 };

char processname[MAX_PATH];
char processdirectory[MAX_PATH];

processname[0] = processdirectory[0] = '\0';

strcpy(processname, "c:\\extra\\install\\setup.exe");
strcpy(processdirectory, "c:\\extra\\install");

CreateProcess(NULL, processname, NULL, NULL, FALSE,
CREATE_SUSPENDED, NULL, processdirectory, &si, &pi);
ResumeThread(pi.hThread);
WaitForSingleObject(pi.hThread, INFINITE);
return true;

Quote:
}

Please let me know your observations..

Thanks
Ajay

Quote:
>-----Original Message-----
>I'll bet you forgot to initialize the STARTUPINFO
>struct. Just a guess.


>> Hi,

>> The Debug version and the Release version of the same
>> executable behaves in two different ways.

>> My application calls a SETUP.EXE via "CreateProcess()".

>> Now, during debugging the GUI of the SETUP.EXE are
>> displayed while in the release version no GUI is
displayed
>> although the EXE is running since I can see that in the
>> process table.

>> What could be the reason for this.

>> Is it due to any memory problems.

>> Thanks

>--
>..Bruce Dawson, Humongous Entertainment (we're hiring).
>http://www.humongous.com/
>Send job applications by e-mail, post technical questions
>to the newsgroups please. Thanks.

>.



Tue, 13 Jan 2004 02:41:13 GMT  
 Debug Version and Release Version
I'm pretty sure this works, its from an old project and i'm not sure of the
quality of the code thats in it, i had several backup copies laying about.
I'm almost positive i had to turn on interact w/ desktop for the service
before it worked

 STARTUPINFO si;
 PROCESS_INFORMATION pi;
 ZeroMemory(&si, sizeof(STARTUPINFO));
 si.cb = sizeof(STARTUPINFO);
 si.lpReserved = NULL;
 si.lpReserved2 = NULL;
 si.cbReserved2 = 0;
 si.dwFlags = STARTF_USESHOWWINDOW,
 si.wShowWindow = SW_HIDE;

 LPTSTR lpCommand = __TEXT("G:\\proj\\pkzip25.exe -add
G:\\proj\\done\\bc0104_b.zip G:\\proj\\done\\bc0104_b.txt");//
 b = CreateProcess(NULL,
    lpCommand,
    NULL,
    NULL,
    true,
    CREATE_UNICODE_ENVIRONMENT,
    NULL,
    NULL,
    &si,
    &pi);


Quote:

> STARTUPINFO struct has been initialized.

> Actually,
> The flow of calling the SETUP.EXE goes like this.

> 1)I have a service.

> 2)The service creates a thread ,  wherein the
> CreateProcess() is called and a EXE called IMP.EXE is
> executed in the new process.

> 3)Now, this IMP.EXE creates another process using
> CreateProcess() wherein "SETUP.EXE" is executed.

> SETUP.EXE is a installation exe which is created using
> installshield.

> The problem which Iam facing is, the installation windows
> and the progress bar which are normally seen in
> installations are visible in the DEBUG mode whereas there
> are not displayed in the release version.

> This is the code from where SETUP.EXE is executed.

> main()
> {
> int nRetval;
> nRetval=(int)Run();
> return nRetval;
> }

> bool Run()
> {

> PROCESS_INFORMATION pi;
> STARTUPINFO si = { sizeof(STARTUPINFO),0, 0, 0, 0, 0,
>                  0, 0, 0, 0, 0, 0, 0, 0, 0 };

> char processname[MAX_PATH];
> char processdirectory[MAX_PATH];

> processname[0] = processdirectory[0] = '\0';

> strcpy(processname, "c:\\extra\\install\\setup.exe");
> strcpy(processdirectory, "c:\\extra\\install");

> CreateProcess(NULL, processname, NULL, NULL, FALSE,
> CREATE_SUSPENDED, NULL, processdirectory, &si, &pi);
> ResumeThread(pi.hThread);
> WaitForSingleObject(pi.hThread, INFINITE);
> return true;
> }

> Please let me know your observations..

> Thanks
> Ajay

> >-----Original Message-----
> >I'll bet you forgot to initialize the STARTUPINFO
> >struct. Just a guess.


> >> Hi,

> >> The Debug version and the Release version of the same
> >> executable behaves in two different ways.

> >> My application calls a SETUP.EXE via "CreateProcess()".

> >> Now, during debugging the GUI of the SETUP.EXE are
> >> displayed while in the release version no GUI is
> displayed
> >> although the EXE is running since I can see that in the
> >> process table.

> >> What could be the reason for this.

> >> Is it due to any memory problems.

> >> Thanks

> >--
> >..Bruce Dawson, Humongous Entertainment (we're hiring).
> >http://www.humongous.com/
> >Send job applications by e-mail, post technical questions
> >to the newsgroups please. Thanks.

> >.



Tue, 13 Jan 2004 03:20:01 GMT  
 Debug Version and Release Version

I can never resist shoving my oar in about this:

Quote:
>  STARTUPINFO si;
>  ZeroMemory(&si, sizeof(STARTUPINFO));
>  si.cb = sizeof(STARTUPINFO);

It's more robust to change to do
Quote:
>  STARTUPINFO si;
>  ZeroMemory(&si, sizeof si);
>  si.cb = sizeof si;



Tue, 13 Jan 2004 04:00:07 GMT  
 Debug Version and Release Version
I missed one more observation during debugging.

Before the GUI shows up during debugging a DOS command
window comes up.

Is is this related in some way with the "Interact with
Desktop" option for the service.

Thanks
Ajay

Quote:
>-----Original Message-----


>I can never resist shoving my oar in about this:

>>  STARTUPINFO si;
>>  ZeroMemory(&si, sizeof(STARTUPINFO));
>>  si.cb = sizeof(STARTUPINFO);

>It's more robust to change to do

>>  STARTUPINFO si;
>>  ZeroMemory(&si, sizeof si);
>>  si.cb = sizeof si;

>.



Tue, 13 Jan 2004 04:57:10 GMT  
 Debug Version and Release Version
But, when I created a few sample programs outside of the
application, everything worked fine.

ie., I created two new process using CreateProcess() and
executed SETUP.EXE from the new process and everything went
off fine.

But as I said in my previous post, prior to display of the
GUI during debugging and in my sample programs a
DOS command window is displayed.

Is this related to something with respect to the console.

Thanks all, for ur time.

ajay

Quote:
>-----Original Message-----
>I'm pretty sure this works, its from an old project and
i'm not sure of the
>quality of the code thats in it, i had several backup

copies laying about.
Quote:
>I'm almost positive i had to turn on interact w/ desktop
for the service
>before it worked

> STARTUPINFO si;
> PROCESS_INFORMATION pi;
> ZeroMemory(&si, sizeof(STARTUPINFO));
> si.cb = sizeof(STARTUPINFO);
> si.lpReserved = NULL;
> si.lpReserved2 = NULL;
> si.cbReserved2 = 0;
> si.dwFlags = STARTF_USESHOWWINDOW,
> si.wShowWindow = SW_HIDE;

> LPTSTR lpCommand = __TEXT("G:\\proj\\pkzip25.exe -add
>G:\\proj\\done\\bc0104_b.zip

G:\\proj\\done\\bc0104_b.txt");//

- Show quoted text -

Quote:
> b = CreateProcess(NULL,
>    lpCommand,
>    NULL,
>    NULL,
>    true,
>    CREATE_UNICODE_ENVIRONMENT,
>    NULL,
>    NULL,
>    &si,
>    &pi);



>> STARTUPINFO struct has been initialized.

>> Actually,
>> The flow of calling the SETUP.EXE goes like this.

>> 1)I have a service.

>> 2)The service creates a thread ,  wherein the
>> CreateProcess() is called and a EXE called IMP.EXE is
>> executed in the new process.

>> 3)Now, this IMP.EXE creates another process using
>> CreateProcess() wherein "SETUP.EXE" is executed.

>> SETUP.EXE is a installation exe which is created using
>> installshield.

>> The problem which Iam facing is, the installation
windows
>> and the progress bar which are normally seen in
>> installations are visible in the DEBUG mode whereas
there
>> are not displayed in the release version.

>> This is the code from where SETUP.EXE is executed.

>> main()
>> {
>> int nRetval;
>> nRetval=(int)Run();
>> return nRetval;
>> }

>> bool Run()
>> {

>> PROCESS_INFORMATION pi;
>> STARTUPINFO si = { sizeof(STARTUPINFO),0, 0, 0, 0, 0,
>>                  0, 0, 0, 0, 0, 0, 0, 0, 0 };

>> char processname[MAX_PATH];
>> char processdirectory[MAX_PATH];

>> processname[0] = processdirectory[0] = '\0';

>> strcpy(processname, "c:\\extra\\install\\setup.exe");
>> strcpy(processdirectory, "c:\\extra\\install");

>> CreateProcess(NULL, processname, NULL, NULL, FALSE,
>> CREATE_SUSPENDED, NULL, processdirectory, &si, &pi);
>> ResumeThread(pi.hThread);
>> WaitForSingleObject(pi.hThread, INFINITE);
>> return true;
>> }

>> Please let me know your observations..

>> Thanks
>> Ajay

>> >-----Original Message-----
>> >I'll bet you forgot to initialize the STARTUPINFO
>> >struct. Just a guess.


>> >> Hi,

>> >> The Debug version and the Release version of the same
>> >> executable behaves in two different ways.

>> >> My application calls a SETUP.EXE via
"CreateProcess()".

>> >> Now, during debugging the GUI of the SETUP.EXE are
>> >> displayed while in the release version no GUI is
>> displayed
>> >> although the EXE is running since I can see that in
the
>> >> process table.

>> >> What could be the reason for this.

>> >> Is it due to any memory problems.

>> >> Thanks

>> >--
>> >..Bruce Dawson, Humongous Entertainment (we're hiring).
>> >http://www.humongous.com/
>> >Send job applications by e-mail, post technical
questions
>> >to the newsgroups please. Thanks.

>> >.

>.



Tue, 13 Jan 2004 05:08:52 GMT  
 Debug Version and Release Version


Fri, 19 Jun 1992 00:00:00 GMT  
 Debug Version and Release Version

Quote:
> I can never resist shoving my oar in about this:

> >  STARTUPINFO si;
> >  ZeroMemory(&si, sizeof(STARTUPINFO));
> >  si.cb = sizeof(STARTUPINFO);

> It's more robust to change to do

> >  STARTUPINFO si;
> >  ZeroMemory(&si, sizeof si);
> >  si.cb = sizeof si;

Why is the second version more robust?  I would think that the size of the
struct STARTUPINFO
would be less likely to be inadvertently changed than an instance of it...


Tue, 13 Jan 2004 16:18:40 GMT  
 Debug Version and Release Version


Fri, 19 Jun 1992 00:00:00 GMT  
 Debug Version and Release Version
yes, because a service has not desktop that dos window that flashes is not
allowed to come up.  There are a few things that you might be able to do w/
startup options to keep the window from being created


Quote:
> I missed one more observation during debugging.

> Before the GUI shows up during debugging a DOS command
> window comes up.

> Is is this related in some way with the "Interact with
> Desktop" option for the service.



Tue, 13 Jan 2004 21:24:34 GMT  
 Debug Version and Release Version
more robust in what way?

both the struct STARTUPINFO and the the instance of that struct have to be
the exact same size, in no way can they not be equal to themselves.


Quote:


> I can never resist shoving my oar in about this:

> >  STARTUPINFO si;
> >  ZeroMemory(&si, sizeof(STARTUPINFO));
> >  si.cb = sizeof(STARTUPINFO);

> It's more robust to change to do

> >  STARTUPINFO si;
> >  ZeroMemory(&si, sizeof si);
> >  si.cb = sizeof si;



Tue, 13 Jan 2004 21:28:11 GMT  
 Debug Version and Release Version
But even better to change it to this:

STARTUPINFO si = {0};
si.cb = sizeof(si);

or this:

STARTUPINFO si = {sizeof(si)};

More compact, easier to read - and probably more efficient.

If you initialize part of a structure, the compiler initializes the
rest to zero. Guaranteed.

I do agree with your point about specify si in the sizeof call
instead of STARTUPINFO. It is valuable to be able to look
at a line of code in isolation and see clearly that is correct,
instead of saying "It is correct if the object is of the type that
this code assumes it is"

Quote:



> I can never resist shoving my oar in about this:

> >  STARTUPINFO si;
> >  ZeroMemory(&si, sizeof(STARTUPINFO));
> >  si.cb = sizeof(STARTUPINFO);

> It's more robust to change to do

> >  STARTUPINFO si;
> >  ZeroMemory(&si, sizeof si);
> >  si.cb = sizeof si;

--
.Bruce Dawson, Humongous Entertainment (we're hiring).
http://www.humongous.com/
Send job applications by e-mail, post technical questions
to the newsgroups please. Thanks.


Wed, 14 Jan 2004 00:45:39 GMT  
 Debug Version and Release Version


Fri, 19 Jun 1992 00:00:00 GMT  
 Debug Version and Release Version

Quote:

> > >  STARTUPINFO si;
> > >  ZeroMemory(&si, sizeof(STARTUPINFO));
> > >  si.cb = sizeof(STARTUPINFO);

> > It's more robust to change to do

> > >  STARTUPINFO si;
> > >  ZeroMemory(&si, sizeof si);
> > >  si.cb = sizeof si;

> Why is the second version more robust?  I would think that the size of the
> struct STARTUPINFO
> would be less likely to be inadvertently changed than an instance of it...

The reason the code is more robust the second way is that, for example,

 ZeroMemory(&si, sizeof si);

is _always_ correct (unless you're doing something weird). You've got a
structure of some sort, and you want to zero it. The code above will always
do that. Whereas

 ZeroMemory(&si, sizeof(STARTUPINFO));

will only zero si if si is a STARTUPINFO. Most of the time, this is fine,
but (hypothetically), what happens when si gets changed to STARTUPINFOEX?
"My" code will still work without any other changes--the other code will
break.

A similar argument holds for

  si.cb = sizeof si;

Actually, this may be even more important to do. cb is used by Windows as a
sanity check--to make sure that someone didn't just pass it garbage. If the
call is expecting a STARTUPINFO, yet si is (mistakenly or because of a
change) not a STARTUPINFO, "my" code will let Windows detect the error--the
original won't.

But the single most important reason for "my" way is that it's usually
shorter. :)



Wed, 14 Jan 2004 00:31:16 GMT  
 
 [ 19 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Why the Font size is not same between Debug version and Release Version

2. Debug version Ok, Release version Failed

3. Debug version works, Release version does not?!

4. the diffrence of the debug version and release version

5. Debug version works, Release version doesn't

6. Help: Debug-Version works, Release-Version crashes!

7. Difference between Debug version and release version

8. debug version works, release version sometimes fails

9. Debug version Ok, Release version Failed

10. Help: Debug Version vs Release Version

11. Debug version works, Release version doesn't

12. Why the Font size is not same between Debug version and Release Version

 

 
Powered by phpBB® Forum Software