Recent

Author Topic: How to convert all values of ioresult() into text messages?  (Read 8690 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: How to convert all values of ioresult() into text messages?
« Reply #30 on: October 01, 2019, 09:05:19 pm »
About Atari:

They have stolen so much from DOS, but on some points they were eager not to show it.

To make DOS diskettes compatible to Atari TOS you only had to set a special "Atari byte" on the disk and everything was fine. The filesystem was stolen from DOS.

GEM was first implemented in DOS but Atari took it as the default  "Window and Mouse System".

As they wanted to hide the stolen elements, they made some funny things.
They invented an own font table - maybe due to copyright issues with IBM8 as in DOS.

And Atari had only even seconds in their file time - so the time did fit into 16 bit!

I have no proof but I am quite shure that Atari used internal the DOSerrors. They have stolen everything without copyright. But they invented a lot of nice things like the Midi Interface. And made things like a color sreen cheap.

Now back from 1986 to today!
Winni

440bx

  • Hero Member
  • *****
  • Posts: 5302
Re: How to convert all values of ioresult() into text messages?
« Reply #31 on: October 01, 2019, 10:00:16 pm »
The two utilities (32 & 64 bit versions) attached to this post are _not_ about IoResult.  They are the list of possible Windows LastError(s) and documented NTSTATUS return values with their textual meanings.

These are completely trivial utilities but I find them occasionally useful and hopefully someone else will. 

Note: the values of HRESULT, which are format-wise the same as NTSTATUS are _not_ included.  I'll probably either add those to NtStatusToText or create a separate little utility for them.  Point is, don't expect HRESULT to be in the list of NtStatusToText even though their format is the same.

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: How to convert all values of ioresult() into text messages?
« Reply #32 on: October 02, 2019, 01:07:17 am »
About error 217: Yes it is a runtime error.

From the Free Pascal Reference guide

 17.4      ............ If an exception occurs, and there is no exception handler present which handles this exception, then a run-time error 217 will be generated.  When using the SysUtils unit, a default handler is installed which will show the exception object message, and the address where the exception occurred, after which the program will exit with a Halt instruction

btw: copying from the PDF absorbs spaces - still after all these years.

Winni

Thaddy

  • Hero Member
  • *****
  • Posts: 16945
  • Ceterum censeo Trump esse delendam
Re: How to convert all values of ioresult() into text messages?
« Reply #33 on: October 02, 2019, 07:47:25 am »
But they invented a lot of nice things like the Midi Interface. And made things like a color sreen cheap.
No, they did not, Roland did. https://en.wikipedia.org/wiki/MIDI
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5968
  • Compiler Developer
Re: How to convert all values of ioresult() into text messages?
« Reply #34 on: October 02, 2019, 09:10:10 am »
I found a big list of Windows API errors provided by some Delphi fans. It contains a lot of I/O errors and some other errors, but it is much more complete than the fpc doc page. It also contains ioerror 32 that I mentioned.

http://delphi-techie.faithweb.com/rich_text_4.html

Hope it helps!
Those are the errors returned by the Windows function GetLastError (provided in FPC also as GetLastOSError). These are not the error values returned by IOResult.

Thaddy

  • Hero Member
  • *****
  • Posts: 16945
  • Ceterum censeo Trump esse delendam
Re: How to convert all values of ioresult() into text messages?
« Reply #35 on: October 02, 2019, 09:14:37 am »
Yes.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: How to convert all values of ioresult() into text messages?
« Reply #36 on: October 02, 2019, 05:51:38 pm »
@PascalDragon and Thaddy

Try to understand what you have read. I never said that all Windows API errors are I/O errors. I said there are a lot among all and there are are a lot more than fpc uses.

ERROR_WRITE_PROTECT, ERROR_NOT_READY,  ERROR_CRC and ERROR_SHARING_VIOLATION are without doubt ioerrors and missing in fpc.

Goto message24 and read again.

Winni


Hartmut

  • Hero Member
  • *****
  • Posts: 905
Re: How to convert all values of ioresult() into text messages?
« Reply #37 on: October 02, 2019, 06:29:34 pm »
About Atari:
...
I have no proof but I am quite shure that Atari used internal the DOSerrors. They have stolen everything without copyright.
Ok, you convinced me. I will add Atari errors 8 and 9 to my function.

About error 217: Yes it is a runtime error.
In the FPC 3.0.4 sources I found 10 places, where 217 is assigned to variable InOutRes, so function IOresult() will return 217. For me this seems to be a "different" error 217 than the "runtime error 217" you found here. Strange...

Hartmut

  • Hero Member
  • *****
  • Posts: 905
Re: How to convert all values of ioresult() into text messages?
« Reply #38 on: October 02, 2019, 07:12:43 pm »
The two utilities (32 & 64 bit versions) attached to this post are _not_ about IoResult.  They are the list of possible Windows LastError(s) and documented NTSTATUS return values with their textual meanings.
I downloaded both tools, thanks. The errors in "NtStatusToText" I have never seen before. Which FPC function (or variable?) does return them?

The errors in "WindowsGetLastError" are the same as windows.FormatMessage() and sysutils.SysErrorMessage(). It would be nice if you could copy the messages to the clipboard or save them into a file, e.g. then you could search in them or compare them with other lists...

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: How to convert all values of ioresult() into text messages?
« Reply #39 on: October 02, 2019, 07:16:33 pm »
Hi Hartmut!

There is a lot of confusion about the different errors going on. We have

* The "good old" DOS-Errors
* The Win-API-Errors
* The Runtime-Errors
* The I/O-Errors

Beside that we have different errors from different  OSes.

And somehow the intersect all. There is no clear separation.

For the history of Pascal-ioerrors:

Wirth did not have this feature in his Pascal.
The ioerrors were implemented in UCSD Pascal (University California San Diego) by Ken Bowels. It was also know als ApplePascal.

Then Turbo Pascal copied the ioerrors from UCSD. They copied a lot of other stuff from it.

Winni

440bx

  • Hero Member
  • *****
  • Posts: 5302
Re: How to convert all values of ioresult() into text messages?
« Reply #40 on: October 02, 2019, 08:53:33 pm »
I downloaded both tools, thanks. The errors in "NtStatusToText" I have never seen before. Which FPC function (or variable?) does return them?
You're welcome.  As far as what NtStatusToText does, there is no function in either FPC or the Windows API that returns the text associated with an NTSTATUS.  That utility shows the result of a copy/paste of the MSDN page that has the information, reformatted using an AWK script to produce an array (as a global variable) of NTSTATUS/<textual meaning> pairs.  A simple loop through that array loads the listbox which displays them.
 
It would be nice if you could copy the messages to the clipboard or save them into a file, e.g. then you could search in them or compare them with other lists...
I haven't needed to do that but, I can see that could be occasionally useful.  You've just given me a reason to finish a devilish hack that enables a GUI app to behave as if it were a console app.  Specifically, its purpose is to allow redirecting the GUI's output to a file just as it is normally done with a console app.  IOW, it would allow doing this from a command line
Code: ASM  [Select][+][-]
  1. WindowsGetLastError > somefilenameofyourchoice
I'm fairly close to getting it to work but, it's just been a "toy" project so far.  I'll try to spend some time on it and, once I get it working, post an updated version of that utility.  Don't hold your breath though, as I said, it's a "toy project" I started because I wanted to see if it was possible to make an app that could behave as both, a gui app and a console app.
« Last Edit: October 02, 2019, 08:56:05 pm by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5968
  • Compiler Developer
Re: How to convert all values of ioresult() into text messages?
« Reply #41 on: October 03, 2019, 12:02:33 pm »
@PascalDragon and Thaddy

Try to understand what you have read. I never said that all Windows API errors are I/O errors. I said there are a lot among all and there are are a lot more than fpc uses.

ERROR_WRITE_PROTECT, ERROR_NOT_READY,  ERROR_CRC and ERROR_SHARING_VIOLATION are without doubt ioerrors and missing in fpc.

Goto message24 and read again.
No, they're not missing. You can't compare Pascal I/O errors to OS errors as both might use the same value for different meanings. That only a subset of OS errors is mapped to I/O errors is by design. You need to know what class of errors you're dealing with and then use a suitable function to convert it to a string (e.g. SysErrorMessage for those returned by GetLastOSError).

Hartmut

  • Hero Member
  • *****
  • Posts: 905
Re: How to convert all values of ioresult() into text messages?
« Reply #42 on: October 03, 2019, 03:22:04 pm »
I downloaded both tools, thanks. The errors in "NtStatusToText" I have never seen before. Which FPC function (or variable?) does return them?
You're welcome.  As far as what NtStatusToText does, there is no function in either FPC or the Windows API that returns the text associated with an NTSTATUS.
There we seem to have misunderstood. I wanted to know which FPC function (or variable) does return those error numbers, not those error messages.

It would be nice if you could copy the messages to the clipboard or save them into a file, e.g. then you could search in them or compare them with other lists...
I'm fairly close to getting it to work but, it's just been a "toy" project so far.  I'll try to spend some time on it and, once I get it working, post an updated version of that utility.  Don't hold your breath...
No problem, I'll be patient. Thanks for trying!

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: How to convert all values of ioresult() into text messages?
« Reply #43 on: October 03, 2019, 06:09:26 pm »
Hi!

About the Linux System errors.

I thought the command errno -l was the "magic word". But nothing happend.
Then I realized that they moved it into the package moreutils which is not installed by default (Suse Tumbleweed 5.3.1.1).

After the installation errno -l gives you more than 100 error numbers and messages. They are attached as textfile.

I think the discussion continues:
Code: Text  [Select][+][-]
  1.  
  2. EHWPOISON 133 Memory page has hardware error

Is this an I/O error or not?

Winni

440bx

  • Hero Member
  • *****
  • Posts: 5302
Re: How to convert all values of ioresult() into text messages?
« Reply #44 on: October 03, 2019, 07:54:53 pm »
I wanted to know which FPC function (or variable) does return those error numbers, not those error messages.
No FPC function returns those error numbers.  Those errors numbers are returned by lower level Windows APIs, many found in  NTDLL. 
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018