You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
getFileId() error in windows docker container #583
We are using cppcheck in a Windows Docker container (windowsservercore-20H2) and have noticed that the function simplecpp::FileDataCache::getFileId() does not work.
This is because the Windows API function GetFileInformationByHandleEx is not available in the Docker container (Error 50: ERROR_NOT_SUPPORTED). We also tested this on windowsservercore-ltsc2025, but the problem persists there as well.
Because of this problem, cppcheck cannot find files and therefore does not work.
However, it works when using the simpler API function GetFileInformationByHandle (without Ex).
Here is my fix for the problem:
#ifdef DOCKER
// New implementationBY_HANDLE_FILE_INFORMATION fileInfo;
constBOOL ret = GetFileInformationByHandle(hFile, &fileInfo);
if (ret) {
id.fileIdInfo.VolumeSerialNumber = static_cast<std::uint64_t>(fileInfo.dwVolumeSerialNumber);
id.fileIdInfo.FileId.IdentifierHi = static_cast<std::uint64_t>(fileInfo.nFileIndexHigh);
id.fileIdInfo.FileId.IdentifierLo = static_cast<std::uint64_t>(fileInfo.nFileIndexLow);
}
#else// Old implementationconstBOOL ret = GetFileInformationByHandleEx(hFile, FileIdInfo, &id.fileIdInfo, sizeof(id.fileIdInfo));
#endif
The problem can also be reproduced using testrunner.exe.
We cannot use these Docker images in the CI - they are ginormous.
mcr.microsoft.com/windows/servercore ltsc2025 79967dce01f9 2 weeks ago 7.62GB
mcr.microsoft.com/windows/server ltsc2025 aec1b9526eb7 2 weeks ago 17.9GB
I think trying to address the issue using manual testing via exFAT should be sufficient for now. We should file a follow-up ticket to try to automate that test.
I think trying to address the issue using manual testing via exFAT should be sufficient for now. We should file a follow-up ticket to try to automate that test.
@willenbr24 do you have suggestion how I can reproduce?
I identified the issue in the cppcheck project (https://github.com/danmar/cppcheck.git) and was able to reproduce it using the unit tests (testrunner.exe). And there you can see that several tests fail, which work with my workaround.
I just tested your changes from commit 7ac711b using the cppcheck project at commit cppcheck-opensource/cppcheck@a9f88d4, running the tests with testrunner.exe in a Docker container. The test was successful!
Thank you!
Activity
refs cppcheck-opensource#583 - report `CACHE_ERROR` when `simplecpp::…
refs cppcheck-opensource#583 - report `CACHE_ERROR` when `simplecpp::…
danmar commentedon Nov 29, 2025
did you try with ltsc2022 ?
danmar commentedon Nov 29, 2025
I believe I managed to run ltsc2022 in a github action: #592
Please note the "Hello from Windows container" message
firewave commentedon Nov 29, 2025
Thanks. I will take look later today.
danmar commentedon Nov 29, 2025
I fail to reproduce locally. Is there a suggestion what I should do? i.e. this command works fine in my windows docker container:
and the integration tests are successful in my docker container also, as far as I know these tests should test out the inclusions:
The top of the Dockerfile I used to build my docker image says:
danmar commentedon Nov 29, 2025
@willenbr24 do you have suggestion how I can reproduce?
firewave commentedon Nov 29, 2025
We cannot use these Docker images in the CI - they are ginormous.
I think trying to address the issue using manual testing via exFAT should be sufficient for now. We should file a follow-up ticket to try to automate that test.
fixed cppcheck-opensource#583 - fall back to `GetFileInformationByHan…
fixed cppcheck-opensource#583 - fall back to `GetFileInformationByHan…
firewave commentedon Nov 29, 2025
This should be possible using a virtual hard disk. See
https://learn.microsoft.com/en-us/powershell/module/hyper-v/new-vhd
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/gg252579(v=ws.11)
fixed cppcheck-opensource#583 - fall back to `GetFileInformationByHan…
willenbr24 commentedon Dec 1, 2025
I identified the issue in the cppcheck project (https://github.com/danmar/cppcheck.git) and was able to reproduce it using the unit tests (testrunner.exe). And there you can see that several tests fail, which work with my workaround.
To reproduce the problem, you need to compile the cppcheck project inside the container and then run testrunner.exe.
We use the Microsoft Build Tools for compilation. Instructions for installing them in Docker can be found here:
https://learn.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2022
firewave commentedon Dec 1, 2025
Does this mean that the latest trunk still fails for you?
willenbr24 commentedon Dec 1, 2025
No, I haven't tested the latest trunk yet.
willenbr24 commentedon Dec 1, 2025
I just tested your changes from commit 7ac711b using the cppcheck project at commit cppcheck-opensource/cppcheck@a9f88d4, running the tests with testrunner.exe in a Docker container. The test was successful!
Thank you!