Hi!

Help!

I've had my first experience with a program that
works just fine on Win95 and Win98 but won't even
start on WinXP.

The program is very simple, no window created, no
dialog created. Just MessageBox prompts for the
user. Could this be the trouble?

The first thing the program does is to check for
the existence of a file in c:\ if it's there a
MessageBox tells how many floppies will be
required to backup. If the file is not there a
MessageBox says so.

On the 2 WinXP machines I've tried it on, the
program loads and immediately terminates. No
MessageBox at all! Process not listed, no task on
the task bar. Just immediate return.

Could it be a problem with aligning data or code?
If alignment is the problem, what should I align,
align 4, align 8, or what? Any help is welcomed!
I've never had a problem like this before.

Signed,

Confused in XP!

Farrier
Posted on 2001-11-08 02:07:18 by farrier
Hi farrier.

Just had a brief look at your code and the only thing I could find was this:

mov ebx, flop_size
.if (eax > ebx) ;we'll need another floppy

Try to use ecx or edx instead as esi, edi and ebx must be
preserved in callbacks. I am not in any way sure this will work. XP is very picky, 98 is more forgiving if you have bugs in your prog.

KetilO
Posted on 2001-11-08 04:30:05 by KetilO
Remember how I said the program wasn't executing
and wasn't even starting? Well that isn't exactly
true!

At one site the file to be backed up is 1.945 MB
in size and should take 2 floppies to back up.
My program should stop with a MessageBox and tell
the user that 2 disks will be required and to
insert disk #1 then click the OK button. After
disk #1 is filled, another dialog should come up
and ask for disk #2, then disk #2 is filled, then
an ending dialog tells the user that the program
is completed. Each disk label is changed to:
MYDisk1of2 and then MYDisk2of2.

What is happening is: No MessageBox's are being
displayed and it is as if the user is clicking the
OK button on each dialog; but they aren't! We
noticed that the floppy light is coming on and
staying on for about enough time to do the entire
backup. The floppy is left with 0.54 MB of data,
the difference between 1.945 MB and the amount
which would have been written on disk #1,
with a label of MYDisk2of2.

No user interaction is needed! I will try
rewriting the program with just a simple dialog
and again with a simple window to see if that will
help. Apparently there must be a window or at
least a message loop in WinXP, and maybe the same
with NT and 2000? Works fine in 95/98/ME!

Thanks,

farrier
Posted on 2001-11-08 09:09:19 by farrier
MessageBox requires a window handle (or NULL) argument, but you are passing a memory handle (hInstance).

I suspect that Win9x inspects only the low 16 bits of hInstance, which is probably all zeros (NULL). That's why it "works" on Win9x.
Posted on 2001-11-08 15:15:46 by tank
I used my RadASM to quickly create a dialog based
appliction, put all my code in the OK button
handler and almost everything worked. Thanks
KetilO, what an excellent set of tools.

I used the GetDiskFreeSpace API to get the space
available on the floppy being used, GDFS returns
pointers to:
SectorsPerClusters
BytesPerSector
NumberFreeClusters
TotalClusters

When I first wrote this routine I just multiplied
BytesPerCluster by NumberFreeClusters and assumed
1 SectorPerCluster. This has worked until now.
I now have to multiply by BytesPerSector to get the correct number.

Thanks,

farrier
Posted on 2001-11-08 15:25:32 by farrier