If I reboot windows while a third-party process has a file locked, will the lock be automatically released?

Yes. Windows gives each program WaitToKillAppTimeout seconds to shutdown (default is 20): https://technet.microsoft.com/en-us/library/cc978624.aspx

After it, it closes all programs. All files are released, file handlers become invalid and Windows shuts down.


First of all, yes, as per the answer provided by @user996142

To elaborate on my comment regarding network processes, the answer is "eventually, yes". Anything accessing your files via the network is actually locking the file indirectly. The host process on your machine (for example, whatever process is behind the SMB sharing) does the actual file locking. If something is accessing this file, and you force a hibernate or suspend, when you resume it will still be locked until the SMB process notices that the client is not connected anymore, and release the lock. I am not sure of the timeframe here, but microsoft seems to like timeout defaults of 2 minutes.