
Recently I was trying to build docker images from the main Sitecore repository, and got quite a weird message.
hcsshim::PrepareLayer - failed failed in win32 : Incorrect function. (0x1)
This message is not self-explanatory and it fired up when the actual build for the first image took place, in my case that was SQL server 2017. Some other details: quite fress and new instance of Windows 10 x64 build 1909, using Hyper-V, no docker / images previously been utilized at thtis computer.
After few hours long googling, I came to understanding that was caused by c:\windows\system32\cbfsconnectnetrdr2017.dll referenced by autorun. There is one halpful tool that helps out troubleshoouting such issues - Sysinternals Autoruns. Here is the output generated by Autoruns for my system:

What is that DLL and how did it get to my machine? CBFSConnect is a known library for creating and managing virtual filesystems for cloud storage providers such as such as Box, Dropbox etc., and this DLL is a kernel mode system drive. Sometimes it may be a leftover from a previously installed software, that was not uninstalled fully and properly.
Depending no your system you may see this DLL as either:
- C:\Windows\system32\cbfsconnectnetrdr2017.dll - for newer systems, or
- C:\Windows\System32\drivers\cbfs6.sys
You may check if it is running or no tby running a command-line utility for common minifilter driver management operations command (a command-line utility for common minifilter driver management operations):

Resolution
The easiest I found was to just simply rename this driver. Once restarted, docker build worked well.
Hope this helps someone