The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Snouphruh on January 27, 2006, 06:08:07 AM

Title: Can someone tell me why...
Post by: Snouphruh on January 27, 2006, 06:08:07 AM
Hi, men!

I used MASM to create a small application. Everything was alright while I was running Windows XP.
But it seems to be a problem when I'm trying to run my application on Windows ME.
The application just makes Windows ME halt totally.

I attached source of my application. The code is small. It only creates a window with a button on it.
Please, tell me what is wrong there.

[attachment deleted by admin]
Title: Re: Can someone tell me why...
Post by: Petroizki on January 27, 2006, 06:57:50 AM
You use ebx at WndMainProc, without preserving it.
Title: Re: Can someone tell me why...
Post by: Snouphruh on January 27, 2006, 09:12:25 AM
But it's OK in Windows XP.
Why?
Title: Re: Can someone tell me why...
Post by: Petroizki on January 27, 2006, 09:50:28 AM
The general rule is; that you can use eax, ecx and edx freely, but you must preserve all other registers. It's just a coincidence that it works in Windows XP, it probably doesn't use ebx for anything important when it calls your programs WndProc. But you should always preserve those other registers, even when making program for only to be run in XP. :wink
Title: Re: Can someone tell me why...
Post by: Snouphruh on January 27, 2006, 10:43:36 AM
I add preserving of ebx, esi and edi registers. The application runs successfully.
It's a very interesting thing! I use XP for about 3 years and there is no error I faced to.
But the last day when I tried my application on ME. I was surprised!
Now I know the cause of the error. Ok, I have noted it for further developments.
Thanx, man!

PS: maybe I'll help you too someday like you did me today.