I have interesting problem with win2000 vs win 98. I have programmed my own program which works with accessing files, writing, reading etc.. I m using there procedure which react on error return value like as 0xffffh

so.. there is

cmp eax,0ffffffffh
jne it_is_okay
invoke MessageBox, NULL, addr first_name, addr second_name, MB_OK
invoke ExitProcess, 0

stupid but going well
when im working under win 98 all is right, but when i run my program under w2k shit happens.
I have many shit calls in my program, but only used on this functions

CreateFile, SetFilePointer, ReadFile

Is any rules how to use this functions right in w2k .. ???
Is any differents betwen win 9x and 2000 ???

Thank you for help
Posted on 2002-01-11 15:28:58 by Marty
I think it must be the "shit" part that's screwing your program. Ha! ha! ha! just joking. :grin:

I'll guess the problems lies within the return value of the called function:

I suggest you individualize the error handling...


if CreateFile fails, it returns INVALID_HANDLE_VALUE which is -1 or FFFFFFFFh
if ReadFile fails, it returns 0 or 00000000h. These two values are different
and you are using the same error checking for both function which is cmp eax, 0FFFFFFFFh

As for the difference between win98 and win2k when calling functions: On my own opinion, it's the same.

I hope I'm answering your question? :)

"It must be the shit part, its gotta be." :grin:
Posted on 2002-01-11 16:15:49 by stryker
First, use the error constants when you can (like INVALID_HANDLE_VALUE
instead of 0FFFFFFFFh). Second, make individual checks... mams IF/ENDIF
is good for this, as you don't end up having a zillion of labels.
Also, use the CTEXT macro, so you can do something like this:

invoke MessageBox, NULL, CTEXT("Error with CreateFile"), CTEXT("dumb error"), MB_OK or MB_ICONERROR
Posted on 2002-01-12 03:28:25 by f0dder
As for errors... NT based windows versions include the concept of
"security". If you're not logged in as administrator, there are some
limits imposed on your actions. In normal windows applications, this
is felt most severely on registry access - there's stuff you can't do,
and you ought to always fill out the REGSAM values properly (and
use the Reg*Ex functions). File access shouldn't fail for "mysterious
reasons" unless you're trying to access files you don't have permissions
to - and then it isn't really "mysterious reasons" after all :).
Posted on 2002-01-12 03:30:38 by f0dder