@Override
	public void onLockFile(String path, long byteOffset, long length, DokanFileInfo arg3)
			throws DokanOperationException {
		try {
			FileHandle handle;
			synchronized (handles)
			{
				handle = handles.get(arg3.handle);
			}
			if (handle == null)
				throw new DokanOperationException(net.decasdev.dokan.WinError.ERROR_INVALID_HANDLE);
			path = mapWinToUnixPath(path);
			if (!handle.getFilePath().equals(path))
				throw new DokanOperationException(net.decasdev.dokan.WinError.ERROR_ACCESS_DENIED);
			fileSystem.lockFile(handle, byteOffset, length);

		} catch (AccessDeniedException e) {
			throw new DokanOperationException(net.decasdev.dokan.WinError.ERROR_ACCESS_DENIED);
		} catch (PathNotFoundException e) {
			throw new DokanOperationException(net.decasdev.dokan.WinError.ERROR_PATH_NOT_FOUND);
		} catch (NotAFileException e) {
			throw new DokanOperationException(net.decasdev.dokan.WinError.ERROR_DIRECTORY);
		} catch (UnsupportedFeatureException e) {
			throw new DokanOperationException(net.decasdev.dokan.WinError.ERROR_NOT_SUPPORTED);
		} catch (AlreadyLockedException e){
			throw new DokanOperationException(net.decasdev.dokan.WinError.ERROR_LOCK_VIOLATION);
		} catch (Exception e)
		{
			e.printStackTrace();
		}
	}