TOSFileUnlock

constructor TOSFileUnlock.Create(const Handle: PTHandle; const Path: String;
  const AccessPrevilege: TCreateFileDesiredAccess);
begin
  inherited Create();
  FileHandle := Handle;
  if IsHandleValid(FileHandle^) then
    CloseHandle(FileHandle^);
  self.Path := Path;
  self.AccessPrivilege := AccessPrevilege;
end;

destructor TOSFileUnlock.Destroy;
begin
  FileHandle^ := CreateHandle(Path, AccessPrivilege);
  inherited;
end;