Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-06 Thread Jürgen Hestermann
Am 2014-10-06 um 07:55 schrieb Sven Barth: On 06.10.2014 07:20, Jürgen Hestermann wrote: Am 2014-10-05 um 20:21 schrieb Sven Barth: Please note that GetLastError is Windows-specific. The cross platform function in SysUtils is called GetLastOSError which does return Integer. And why does a

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-06 Thread Jürgen Hestermann
Am 2014-10-05 um 15:08 schrieb Michael Van Canneyt: A typecast will be needed somewhere. Yes, instead of assigning the two values as in Integer_Type := DWord_Type; MOVE could be used: move(DWord_Type,Integer_Type,sizeof(DWord_Type)); This way no range check would trigger and no bit would

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-06 Thread Sven Barth
Am 06.10.2014 17:55 schrieb Jürgen Hestermann juergen.hesterm...@gmx.de: Am 2014-10-06 um 07:55 schrieb Sven Barth: On 06.10.2014 07:20, Jürgen Hestermann wrote: Am 2014-10-05 um 20:21 schrieb Sven Barth: Please note that GetLastError is Windows-specific. The cross platform function

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-05 Thread Michael Van Canneyt
On Sat, 4 Oct 2014, Jürgen Hestermann wrote: In my programs I use this code quite often: SysErrorMessage(GetLastError); A closer look at SysErrorMessage shows that the ERRORCODE will not be used in this routine but only handed over to FormatMessageA which expects a DWORD!

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-05 Thread Jürgen Hestermann
Am 2014-10-05 um 12:10 schrieb Michael Van Canneyt: Not necessarily, because it is a cross-platform function and on other systems the error codes are not necessarily positive values. Unfortunately, this kind of windows-api-creep is found throughout the RTL. The proper procedure is probably to

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-05 Thread leledumbo
But the current situation is wrong for *all* plattforms FormatMessage doesn't exist on non-Windows platform. SysErrorMessage doesn't call FormatMessage on Linux for instance. -- View this message in context:

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-05 Thread Sven Barth
Am 05.10.2014 12:28 schrieb Jürgen Hestermann juergen.hesterm...@gmx.de: Am 2014-10-05 um 12:10 schrieb Michael Van Canneyt: Not necessarily, because it is a cross-platform function and on other systems the error codes are not necessarily positive values. Unfortunately, this kind of

[fpc-pascal] Syserrormessage, parameter data type

2014-10-04 Thread Jürgen Hestermann
In my programs I use this code quite often: SysErrorMessage(GetLastError); But recently my program had a range check error which let me have a look at the definiton of the 2 functions GetLastError and SysErrorMessage. GetLastError is from the WinAPI: