1. How come: crash/no crash?

Hello,

Recently i was working with a program that uses the Win API and a 
point structure.  In my haste, i allocated the point struct
incorrectly as:

ppt=allocate(4) --should be at least (8)

The point struct was then used in a Win API call which loads it:

  retv=winapi_function_call(ppt)

then the result is read into a sequence with peek's.

Strange thing is, under Win XP Pro (sp1 OR sp2) the above code
*NEVER* crashed, while under XP Home it *ALWAYS* crashed.

When i say 'it crashed' i mean a Euphoria machine exception error
is generated and the program halts.  When it doesnt crash the
program works normally exactly as expected with no complains (XP Pro).
In both cases the program has been bound (exe), but in the XP Pro case
the .exw file doesnt crash nor the bound exe file either.

Im asking about this because if you go through the trouble of
troubleshooting the program and it runs fine with no errors, then
you run it under XP Home and it doesnt work, that's nasty.

Any ideas, anyone?



Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » topic index » view message » categorize

2. Re: How come: crash/no crash?

Al Getz wrote:
> 
> Hello,
> 
> Recently i was working with a program that uses the Win API and a 
> point structure.  In my haste, i allocated the point struct
> incorrectly as:
> 
> ppt=allocate(4) --should be at least (8)
> 
> The point struct was then used in a Win API call which loads it:
> 
>   retv=winapi_function_call(ppt)
> 
> then the result is read into a sequence with peek's.
> 
> Strange thing is, under Win XP Pro (sp1 OR sp2) the above code
> *NEVER* crashed, while under XP Home it *ALWAYS* crashed.


Al:
  What probably is happening is when XP Pro runs the program it runs
  the program in memory where there is a spot in memory that is
  has nothing located in it. so it just overwrites those
  extra locations.

  When you use XP Home the program is writing over a protected area
  that is being used by the OS.
 
Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.exw

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

3. Re: How come: crash/no crash?

Bernie Ryan wrote:
> 
> Al Getz wrote:
> > 
> > Hello,
> > 
> > Recently i was working with a program that uses the Win API and a 
> > point structure.  In my haste, i allocated the point struct
> > incorrectly as:
> > 
> > ppt=allocate(4) --should be at least (8)
> > 
> > The point struct was then used in a Win API call which loads it:
> > 
> >   retv=winapi_function_call(ppt)
> > 
> > then the result is read into a sequence with peek's.
> > 
> > Strange thing is, under Win XP Pro (sp1 OR sp2) the above code
> > *NEVER* crashed, while under XP Home it *ALWAYS* crashed.
> 
> 
> Al:
>   What probably is happening is when XP Pro runs the program it runs
>   the program in memory where there is a spot in memory that is
>   has nothing located in it. so it just overwrites those
>   extra locations.
> 
>   When you use XP Home the program is writing over a protected area
>   that is being used by the OS.
>  
> Bernie
> 
> My files in archive:
> w32engin.ew mixedlib.e eu_engin.e win32eru.exw
> 
> Can be downloaded here:
> <a
> href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a>

Hi Bernie,


Yes, that's probably it :)
Win XP Pro probably allocated more memory than Home did so it didnt trigger
an error, but this is BS if you ask me.  I think they should both work
the same or at least XP Pro should have triggered the error too, because
this program was considered "fully tested" before shipping and when someone
ran it on Home it crashed right away...that's just nuts.  I ran this program
many times on my own machine too which told me it was working.
How can we stamp a program "Fully tested" if there's a bug in it that
doesnt show up sometimes?  That's lousy if you ask me.  I understand
it's the fault of Windows and not Euphoria too.
So the mem manager of XP Pro must be different than the mem manager
of XP Home...strange if you ask me.  There are enough reasons not to
like Windows, i didnt need another one (hee hee).


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

4. Re: How come: crash/no crash?

> Yes, that's probably it :)
> Win XP Pro probably allocated more memory than Home did so it didnt trigger
> an error, but this is BS if you ask me.  I think they should both work
> the same or at least XP Pro should have triggered the error too, because
> this program was considered "fully tested" before shipping and when someone
> ran it on Home it crashed right away...

Hi,

I do not think that is it, I have never heard WinXP Pro handling memory
different than XP Home. I would first find someone else who is using WinXP
Home and see if it is the OS or another factor. 

----If you continue to do what you have always done,
you will get what you have always gotten.----

new topic     » goto parent     » topic index » view message » categorize

5. Re: How come: crash/no crash?

Al Getz wrote:
> 
> Yes, that's probably it :)
> Win XP Pro probably allocated more memory than Home did so it didnt trigger
> an error, but this is BS if you ask me.  I think they should both work
> the same or at least XP Pro should have triggered the error too, because
> this program was considered "fully tested" before shipping and when someone
> ran it on Home it crashed right away...that's just nuts.  I ran this program
> many times on my own machine too which told me it was working.
> How can we stamp a program "Fully tested" if there's a bug in it that
> doesnt show up sometimes?  That's lousy if you ask me.  I understand
> it's the fault of Windows and not Euphoria too.
> So the mem manager of XP Pro must be different than the mem manager
> of XP Home...strange if you ask me.  There are enough reasons not to
> like Windows, i didnt need another one (hee hee).
> 

Well, I could argue that your program wasn't 'fully tested' since you didn't
test against safe.e, which presumably would have caught your problem, since
you would have read from memory you didn't allocate.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

6. Re: How come: crash/no crash?

Al:

   If you are running an interpeted program then because it is dynamic
   the operating system is not going catch all errors.

   I will bet if you compile the program that it will act
   the same way on both OS's.
 
Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.exw

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

7. Re: How come: crash/no crash?

On Wed, 28 Dec 2005 12:58:33 -0800, Al Getz <guest at RapidEuphoria.com>
wrote:

>Recently i was working with a program that uses the Win API and a 
>point structure.  In my haste, i allocated the point struct
>incorrectly as:
>
>ppt=allocate(4) --should be at least (8)
>
>Strange thing is, under Win XP Pro (sp1 OR sp2) the above code
>*NEVER* crashed, while under XP Home it *ALWAYS* crashed.

Does machine.e/safe.e catch this?

>Im asking about this because if you go through the trouble of
>troubleshooting the program and it runs fine with no errors, then
>you run it under XP Home and it doesnt work, that's nasty.

True. There is, I feel, a valid argument perhaps that if you have:
with trace
include machine.e

ie trace is on, and machine.e has not already been included, it should
say 'fek it - use safe.e', and ignore any subsequent include machine.e

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

8. Re: How come: crash/no crash?

Al Getz wrote:
> 
> Bernie Ryan wrote:
> > 
> > Al Getz wrote:
> > > 
> > > Hello,
> > > 
> > > Recently i was working with a program that uses the Win API and a 
> > > point structure.  In my haste, i allocated the point struct
> > > incorrectly as:
> > > 
> > > ppt=allocate(4) --should be at least (8)
> > > 
> > > The point struct was then used in a Win API call which loads it:
> > > 
> > >   retv=winapi_function_call(ppt)
> > > 
> > > then the result is read into a sequence with peek's.
> > > 
> > > Strange thing is, under Win XP Pro (sp1 OR sp2) the above code
> > > *NEVER* crashed, while under XP Home it *ALWAYS* crashed.
> > 
> > 
> > Al:
> >   What probably is happening is when XP Pro runs the program it runs
> >   the program in memory where there is a spot in memory that is
> >   has nothing located in it. so it just overwrites those
> >   extra locations.
> > 
> >   When you use XP Home the program is writing over a protected area
> >   that is being used by the OS.
> >  
> > Bernie
> > 
> > My files in archive:
> > w32engin.ew mixedlib.e eu_engin.e win32eru.exw
> > 
> > Can be downloaded here:
> > <a
> > href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a>
> 
> Hi Bernie,
> 
> 
> Yes, that's probably it :)
> Win XP Pro probably allocated more memory than Home did so it didnt trigger
> an error, but this is BS if you ask me.  I think they should both work
> the same or at least XP Pro should have triggered the error too, because
> this program was considered "fully tested" before shipping and when someone
> ran it on Home it crashed right away...that's just nuts.  I ran this program
> many times on my own machine too which told me it was working.
> How can we stamp a program "Fully tested" if there's a bug in it that
> doesnt show up sometimes?  That's lousy if you ask me.  I understand
> it's the fault of Windows and not Euphoria too.
> So the mem manager of XP Pro must be different than the mem manager
> of XP Home...strange if you ask me.  There are enough reasons not to
> like Windows, i didnt need another one (hee hee).
> 
> 
> Al
> 
> 
> My bumper sticker: "I brake for LED's"

It's certainly not fair to blame any OS for programming mistakes.  However, it
may not be a programming mistake at all.  The system that's crashing may have DEP
enabled and that will generate a machine-level exception by just running
Euphoria's own Win32 demo programs.

DEP is Data Execution Prevention.  To check the settings, open the System
control panel, click the Advanced tab, click Performance settings button, click
Data Execution Prevention tab.  If you don't want Euphoria to crash, you should
either have the first radio selected (turn on DEP for essential Windows programs
and services only) or you will need to create an exception for your program if
the second radio is selected (turn on DEP for all programs and services except
those I select).

I recently ran into this issue again and it was nearly impossible to debug.

-- Brian

new topic     » goto parent     » topic index » view message » categorize

9. Re: How come: crash/no crash?

Brian Broker wrote:

> It's certainly not fair to blame any OS for programming mistakes.  However,
> it may not be a programming mistake at all.  The system that's crashing may
> have DEP enabled and that will generate a machine-level exception by just
> running
> Euphoria's own Win32 demo programs.
> 
> DEP is Data Execution Prevention.  To check the settings, open the System
> control
> panel, click the Advanced tab, click Performance settings button, click Data
> Execution Prevention tab.  If you don't want Euphoria to crash, you should
> either
> have the first radio selected (turn on DEP for essential Windows programs and
> services only) or you will need to create an exception for your program if the
> second radio is selected (turn on DEP for all programs and services except
> those
> I select).
> 
> I recently ran into this issue again and it was nearly impossible to debug.
> 
> -- Brian

Disabling DEP is not a good idea, your app should run with it on. DEP is
used to prevent viruses from running malicious code from memory locations,
and almost every XP computer with Service Pack 2 installed will have this
enabled by default. You cannot tell every user who wants to run your
app to disable DEP.


----If you continue to do what you have always done,
you will get what you have always gotten.----

new topic     » goto parent     » topic index » view message » categorize

10. Re: How come: crash/no crash?

Sorry Brian,

I just re-read what you wrote :) You did not say to DISABLE DEP, that is what
I get for just quickly reading through. But your app should still work without
having to fiddle with DEP. 


----If you continue to do what you have always done,
you will get what you have always gotten.----

new topic     » goto parent     » topic index » view message » categorize

11. Re: How come: crash/no crash?

C Bouzy wrote:
> 
> Brian Broker wrote:
> 
> > It's certainly not fair to blame any OS for programming mistakes.  However,
> > it may not be a programming mistake at all.  The system that's crashing may
> > have DEP enabled and that will generate a machine-level exception by just
> > running
> > Euphoria's own Win32 demo programs.
> > 
> > DEP is Data Execution Prevention.  To check the settings, open the System
> > control
> > panel, click the Advanced tab, click Performance settings button, click Data
> > Execution Prevention tab.  If you don't want Euphoria to crash, you should
> > either
> > have the first radio selected (turn on DEP for essential Windows programs
> > and
> > services only) or you will need to create an exception for your program if
> > the
> > second radio is selected (turn on DEP for all programs and services except
> > those
> > I select).
> > 
> > I recently ran into this issue again and it was nearly impossible to debug.
> > 
> > -- Brian
> 
> Disabling DEP is not a good idea, your app should run with it on. DEP is
> used to prevent viruses from running malicious code from memory locations,
> and almost every XP computer with Service Pack 2 installed will have this
> enabled by default. You cannot tell every user who wants to run your
> app to disable DEP.
> 
> 
> ----If you continue to do what you have always done,
> you will get what you have always gotten.----

I'm not sure if my last message was submitted or was closed via accidental
keystroke so forgive me if I sound redundant.

I searched the list and found that I mentioned that Windows *software* DEP does
not affect Euphoria Windows programs.  However, my latest job requires that I
develop running on x64 systems running W2k3 Server.  My last dev box must have
had hardware DEP enabled because I had to disable it to get Eu windows programs
working.

If your user has processor-level DEP capabilities, it *might* cause a
machine-level exception if these *strong* settings are enabled.

-- Brian

new topic     » goto parent     » topic index » view message » categorize

12. Re: How come: crash/no crash?

Hello again Bernie, C Bouzy, Matt, and Pete,


Replies to replies in the order in which they appeared on the list...


C Bouzy(1):
Yes, i guess it could be a setting in the OS or the processor.
I'd have to see if the other system has settings for this.

Matt:
That's an interesting idea...so you think that maybe all programs should
be run at least once with safe.e then?  It wouldnt catch the WinAPI call,
but it would at least catch if we try to read the 'non-allocated' part
of the struct.  i guess if we dont try to read that part it still wont
catch it sad  Good idea though.

Bernie(1):
Well, the program was compiled into exe form.  I only ran exw form on my
machine.  The exe crashed on Home but not on Pro.  Fixing the struct
allocate fixed the problem as expected.

Pete:
Safe.e would catch the attempt to read the unallocated part of the 
struct (im pretty sure) but the WinAPI call using the struct wouldnt
get caught.  This means it's possible that the api call would load
mem locations that were not allocated, and safe.e wouldnt know this
was happening...until the time came to read the *part* of that struct
that was not allocated.
I think i agree here that safe.e would have helped uncover a bug because
in this particular instance i was reading *both* values of a point struct,
while only one mem location was actually allocated properly.

Bernie(2):
I checked my options and yes, DEP was enabled for 'essential' win programs
only, so ill have to play with this.  I'll see if it catches the same error
with that enabled for ALL programs.  Thanks for the idea.

C Bouzy(2):
I think what Bernie meant was to turn it *on* for *ALL* programs instead
of just some programs, that way it should catch everything.  I'll bet
the other computer has it on for all programs so that one caught it
while mine didnt...i'll try it.



I'll swing back with the results (with DEP) as soon as possible...


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu