Skip to content

Conversation

@pziezio
Copy link

@pziezio pziezio commented Aug 19, 2025

Hi all,
there is a bug in the SHM driver (ntp-4.2.8p18) that makes it impossible to run on Windows x64 platform.

In refclock_smh.c, line 185:
shmid = CreateFileMapping ((HANDLE)0xffffffff, psec, PAGE_READWRITE,

(HANDLE)0xffffffff is not equal to (-1) on x64 platform.

According to MSDN (https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createfilemappinga#parameters),
it should pass INVALID_HANDLE_VALUE (-1) as a first parameter for this specific use case.

I'm using this driver to provide time from the GPS receiver. For the moment I'm using custom build with this bug corrected and everything works correctly.

@hart-NTP
Copy link
Collaborator

Thanks for catching this. refclock_shm.c is not built on Windows by default, and I'm not aware of programs which provide the shared memory for it to use. Is the GPS tool you're using open source?

@hart-NTP
Copy link
Collaborator

I've opened a bug report in our primary bug tracker

https://bugs.ntp.org/show_bug.cgi?id=4007

@pziezio if you don't already have a bugs.ntp.org account, I suggest setting one up so you can add yourself as a watcher to that bug report. Thanks again for your report.

@pziezio
Copy link
Author

pziezio commented Nov 22, 2025

I've already reported this over 2 years ago:
https://bugs.ntp.org/show_bug.cgi?id=3867

But no one replied, hence the report here.

@pziezio
Copy link
Author

pziezio commented Nov 22, 2025

Thanks for catching this. refclock_shm.c is not built on Windows by default, and I'm not aware of programs which provide the shared memory for it to use. Is the GPS tool you're using open source?

No, unfortunately this is custom software and is not released to the public.

@hart-NTP
Copy link
Collaborator

I've resolved 4007 as a duplicate of 3867. I apologize for the lack of attention to your report in 2023. We should get this fixed in 4.2.8p19, along with some minor cleanup to avoid the need to use FormatMessage() in refclock_shm.c and to include the driver in Windows ntpd by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants