Correction: values with bit 29 set are reserved
for app error codes.
On 2008.10.12., at 17:09, Szakáts Viktor wrote:
Hi Przemek,
I'm referring to hb_WinToDosError(). Maybe it's
wrong, but it's accepting an ULONG, when called,
a value received from GetLastError() is passed
to it (casted to USHORT, which instantly causes
loss of significant digits), and hb_WinToDosError()
then returns an int, which is later stored in an
USHORT. MSDN documentation of GetLastError() says
that it returns a 32-bit value, of which the highest
bit is reserved for app errors, the rest may be
used by the OS. There is no mention of using only
the lower two bytes, so even it doesn't return any
such values in practice, our current usage seems
to make unsafe assumptions on the value.
Similar problems exist for DOS, non-WIN32_IO
code paths.
[ See line 239-240 in source/rtl/fserror.c for
the Win part. ]
I've run into a problem, where hb_fsError() (and
its two friends) are returning no error after
a failed hb_fsRename() operation, but that may
be unrelated.
Brgds,
Viktor
On 2008.10.12., at 12:48, Przemyslaw Czerpak wrote:
On Sun, 12 Oct 2008, Szak�ts Viktor wrote:
Hi Viktor,
OS error codes are currently stored as USHORT.
Windows uses DWORD, there is a function which
maps Windows error code to Harbour one.
To be precise: to DOS error. Anyhow such translation
cannot be well done in other systems. Windows uses
DOS error codes so here in practice there is no translation
(only ERROR_ALREADY_EXISTS is translated)
but in some *nixes it's necessary and we have a problem
because ure error code is not enough to make valid translation.
It's necessary to introduce additional information with action
which will be used in translation. This is the second parameter
(uiOperation) in hb_fsSetIOError(). But I have never time to
implement it.
Digits are most probably lost here.
Windows uses DOS error codes counted from 0 and significant
are only 2 low bytes. AFAIR upper bytes are usd in some subsystems
as bitfields.
Shouldn't we change our error code types to ULONG?
For FS errors it should not make any difference.
Much more important is implementing uiOperation.
best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour