Wrong error return value expected in ChangeLog.cpp?

9 views
Skip to first unread message

Mark Rotteveel

unread,
Jul 7, 2025, 4:05:58 PMJul 7
to firebir...@googlegroups.com
I was looking at ChangeLog.cpp, and noticed that in
void ChangeLog::Segment::mapHeader()
it's expecting the wrong error return value (INVALID_HANDLE_VALUE).
According to
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createfilemappinga,
the return value in case of errors is NULL, and never INVALID_HANDLE_VALUE.

The INVALID_HANDLE_VALUE is a possible value of the hFile argument (the
first parameter), specifically:

"""
If hFile is INVALID_HANDLE_VALUE, the calling process must also specify
a size for the file mapping object in the dwMaximumSizeHigh and
dwMaximumSizeLow parameters. In this scenario, CreateFileMapping creates
a file mapping object of a specified size that is backed by the system
paging file instead of by a file in the file system.
"""

I can change this together with the other changes I'm making, but I want
to double check: am I missing something here?

Mark
--
Mark Rotteveel

Vlad Khorsun

unread,
Jul 7, 2025, 4:30:24 PMJul 7
to firebir...@googlegroups.com
07.07.2025 23:05, 'Mark Rotteveel' via firebird-devel:
> I was looking at ChangeLog.cpp, and noticed that in
> void ChangeLog::Segment::mapHeader()
> it's expecting the wrong error return value (INVALID_HANDLE_VALUE). According to https://learn.microsoft.com/en-us/windows/win32/
> api/winbase/nf-winbase-createfilemappinga, the return value in case of errors is NULL, and never INVALID_HANDLE_VALUE.

Good catch!

> The INVALID_HANDLE_VALUE is a possible value of the hFile argument (the first parameter), specifically:
>
> """
> If hFile is INVALID_HANDLE_VALUE, the calling process must also specify a size for the file mapping object in the dwMaximumSizeHigh
> and dwMaximumSizeLow parameters. In this scenario, CreateFileMapping creates a file mapping object of a specified size that is
> backed by the system paging file instead of by a file in the file system.
> """
>
> I can change this together with the other changes I'm making, but I want to double check: am I missing something here?

Lets fix it.

Regards,
Vlad

Mark Rotteveel

unread,
Jul 7, 2025, 4:42:18 PMJul 7
to firebir...@googlegroups.com
On 07/07/2025 22:30, Vlad Khorsun wrote:
> 07.07.2025 23:05, 'Mark Rotteveel' via firebird-devel:
>> I can change this together with the other changes I'm making, but I
>> want to double check: am I missing something here?
>
>   Lets fix it.
Done:
https://github.com/FirebirdSQL/firebird/commit/4c9e5ef1b198cfde0434fc57beef8e4e3c8fb576

Mark
--
Mark Rotteveel
Reply all
Reply to author
Forward
0 new messages