[ros-kernel] Enhanced error messages

Thomas Weidenmueller info at w3seek.de
Mon Jan 5 18:29:49 CET 2004

Martin Fuchs wrote:

>Hello,
>
>wouldn't you all sometimes wish to see a more descriptive error message
>like "File 'c:\path\to\file.txt" could not be found." instead of just that
>
>We can implement this hidden in the OS without breaking any API.
>What we need is just to extend CreateFile() and FormatMessage().
>If CreateFile() can't find what it was searching for, it calls a new
>function SetLastErrorWithInfo(ERROR_FIND_NOT_FOUND, path)
>instead of only SetLastError(ERROR_FIND_NOT_FOUND).
>The string is stored like the last error code as per-thread info.
>FormatMessage can then look if there is additional information
>and include in the formatted message.
>
>Of course this could no only be used for CreateFile().
>There are many other functions like CreateProcess(), which
>could produce better error messages.
>
>Declaration of the proposed two functions in kernel32:
>
>VOID SetLastErrorWithInfo(DWORD error_code, LPCWSTR info_text);
>DWORD GetLastErrorInfo(LPWSTR info_text, LPDWORD buffer_size);
>
>What do you think?
>
>Regards,
>
>   Martin
>_______________________________________________
>Ros-kernel mailing list
>Ros-kernel at reactos.com
>http://reactos.com/mailman/listinfo/ros-kernel
>
>
>
>
imo there is no need for this since the application can check the return
value and print it's own error message. I haven't seen many applications
that actually print out the message text returned from FormatMessage().

Regards
Thomas