Recent

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

PascalDragon

  • Hero Member
  • *****
  • Posts: 5959
  • Compiler Developer
Re: How to convert all values of ioresult() into text messages?
« Reply #45 on: October 04, 2019, 09:25:51 am »
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.
You need to check MSDN to find out which function might return a NTSTATUS instead of returning the error code through the SetLastError/GetLastError "side channel". None of the general RTL/FCL/LCL functions return a NTSTATUS by themselves.

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?
The PosixToRunError function which is used behind the scenes to convert from those returned by errno to the ones used in InOutRes won't convert that specific error thus provide it as is (at least on Linux). Though one can argue whether this is a useful behavior as that might mask duplicated errors...
« Last Edit: October 04, 2019, 09:31:53 am by PascalDragon »

Hartmut

  • Hero Member
  • *****
  • Posts: 905
Re: How to convert all values of ioresult() into text messages?
« Reply #46 on: October 04, 2019, 04:53:19 pm »
Thanks to 440bx and PascalDragon for your informations about NTSTATUS. Now I understand.

About the Linux System errors.
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. EHWPOISON 133 Memory page has hardware error
Is this an I/O error or not?

I installed "errno" too via package moreutils. I got a list of 133 error codes and messages. The 1st 124 are the same then sysutils.SysErrorMessage() returns on Linux (Ubuntu 18.4) with FPC 3.0.4, except that the errno-messages are partly more detailed.
I think this error codes are Linux-related and have generally nothing to do with IOresult(), except in those cases, where IOresult() passes an OS-error without converting it, as PascalDragon wrote. Which in my opinion is dangerous, because it can lead to duplicate codes that are not unique, which is the worst thing you can do with error codes.

 

TinyPortal © 2005-2018