help fixing up SetConsoleCtrlHandler()

Peter Riocreux par+wine_devel at silistix.com
Wed Apr 14 12:13:04 CDT 2004


Having seen a lot of messages like:

-----------------
fixme:console:SetConsoleCtrlHandler (0x41a8af,1) - no error checking or testing yet
-----------------

lately, I thought I would actually see if I could fix it up and remove the FIXME.

It is in dlls/kernel/console.c, and the MSDN reference is at

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setconsolectrlhandler.asp>.

I think it is obvious enough that even I, a Wine newbie could do it,
except for a couple of things that, as a newbie, are not obvious to
me. Please point me at docs if this is covered somewhere - it is hard
getting into a new project ....

1) If I am using SetLastError, it is not obvious to me what error
values I should be using there. I assume there is a generic
couldnt-allocate-on-heap error, but other causes of error are specific
to the function, and I cannot find any documentation. Should I just
use a non-zero error number and put FIXMEs in for any number I had to
invent?

2) Can I assume that Rtl{Enter,Leave}CriticalSection(), HeapFree(),
ERR() and WARN() cannot fail (the latter two are presumably macros).

3) The docs say that it behaves eeeeeeever so slightly differently in
ME/98/95 than in others. In this case it is simply that one of the
arguments may not be NULL. Should I, either in general, or in this
case in particular, detect which Windows version is being used and
behave appropriately, or implement the more flexible approach and
assume that people writing for the more restricted OS will not have
used that case. If I shoudl detect, how does one go about this?

Peter



More information about the wine-devel mailing list