How to answer to an SMB DeviceIOControl request?
13:24 07 Dec 2025

I am implementing an SMB server in c# using https://github.com/TalAloni/SMBLibrary

Now when I try to open the share using Samba client, it tries to negotiate the protocol details. Problem is, the DeviceIOControl function is extremely generic and it's hard to find the specific data format for your actual problem.

Samba client sends:

DeviceIOControl(handle=(null), ctlCode=0x140204(devicetype=14, accessmode=0, function=81),inputLength=28, maxOutputLength=24)
StructSize=0, DialectCount=0, ClientSecMode=0xBE4D, ClientCaps=0x48F4C728, ClientGuid=..., Dialects=[]

this ctlCode is probably called FSCTL_VALIDATE_NEGOTIATE_INFO

What does this data actually mean and how do I answer to it?

The AI gave me this structure for output, but it's bigger than what samba client provided for return, so it breaks.

0      2     StructureSize
2      2     SecurityMode
4      2     Dialect
6      2     Reserved
8      4     Capabilities
12     16    ServerGuid

Where can I find a documentation of this struct, and how do I fill it? The AI calls it SMB2_VALIDATE_NEGOTIATE_INFO_RESPONSE which I just cannot find anywhere.

Thank you very much.

samba smb deviceiocontrol