Quando você chama CreateFile para abra um arquivo, apenas passe em 0
para dwShareMode
.
If this parameter is zero and
CreateFile
succeeds, the file or device cannot be shared and cannot be opened again until the handle to the file or device is closed.