2020-02-20

How-To: Fix Incorrect Function When Sharing via Windows SMB

Problem Summary

Trying to create an SMB file share on Windows ( from at least Vista onwards) results in an error message due to a missing firewall rule, even if the Windows Firewall is disabled(?!), managed (as with TinyWall) or replaced with another firewall application altogether.  

Windows Incorrect Function Error
An error occurred while trying to share FOLDER. Incorrect function.   The shared resource was not created at this time.  


Solution  

Recreate the required missing firewall rule FPS-SMB-In-TCP, which seems to be the only one necessary. 

Add REG_SZ FPS-SMB-In-TCP to 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules 

with the value of:

v2.30|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Private|LPort=445|RA4=LocalSubnet|RA6=LocalSubnet|App=System|Name=@FirewallAPI.dll,-28511|Desc=@FirewallAPI.dll,-28514|EmbedCtxt=@FirewallAPI.dll,-28502|

Or save the following to incorrect_function_fix.reg and merge it to the registry:

Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules]

"FPS-SMB-In-TCP"="v2.30|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Private|LPort=445|RA4=LocalSubnet|RA6=LocalSubnet|App=System|Name=@FirewallAPI.dll,-28511|Desc=@FirewallAPI.dll,-28514|EmbedCtxt=@FirewallAPI.dll,-28502|"

Proper Rules in Windows Firewall



Reference

This was one of the few useful posts when trying to find a resolution to this issue, though it erroneously identifies the Echo Request as the culprit: Fix: Cannot Share Folder