
     ig                    Z   d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ ddlmZ dd	lmZmZ ej        d
k    rZd dlZd dlZd dlmZ dZdZ ej        dd          Zej        gej        _        ej        ej        _        ddZ G d de          Zn G d de          ZdgZ dS )    )annotationsN)suppress)EACCES)Path)cast   )BaseFileLock)ensure_directory_existsraise_on_not_writable_filewin32)wintypesi   l    kernel32T)use_last_errorpathstrreturnboolc                    t                               |           }|t          k    r%t          j                    }|dk    rdS |dk    rdS dS t          |t          z            S )a  
        Check if a path is a reparse point (symlink, junction, etc.) on Windows.

        :param path: Path to check

        :returns: True if path is a reparse point, False otherwise

        :raises OSError: If GetFileAttributesW fails for reasons other than file-not-found

           F   )	_kernel32GetFileAttributesWINVALID_FILE_ATTRIBUTESctypesget_last_errorr   FILE_ATTRIBUTE_REPARSE_POINT)r   attrserrs      [/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/filelock/_windows.py_is_reparse_pointr       sf     ,,T22+++'))Caxxuaxxu5E88999    c                  "    e Zd ZdZddZddZdS )WindowsFileLocka~  
        Uses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.

        Lock file cleanup: Windows attempts to delete the lock file after release, but deletion is
        not guaranteed in multi-threaded scenarios where another thread holds an open handle. The lock
        file may persist on disk, which does not affect lock correctness.
        r   Nonec                d   t          | j                   t          | j                   t          | j                  rd| j         }t	          |          t
          j        t
          j        z  }	 t          j        | j        || 	                                          }	 t          j        |t          j        d           || j        _        d S # t          $ r0}t          j        |           |j        t"          k    r Y d }~d S d }~ww xY w# t          $ r}|j        t"          k    r Y d }~d S d }~ww xY w)Nz1Lock file is a reparse point (symlink/junction): r   )r   	lock_filer
   r    OSErrorosO_RDWRO_CREATopen
_open_modemsvcrtlockingLK_NBLCK_contextlock_file_fdcloseerrnor   )selfmsgflagsfd	exceptions        r   _acquirezWindowsFileLock._acquire;   sO   &t~666#DN333 !00 #Z$.ZZcll" 	* 4WT^UDOO4E4EFF
4N2v::: 24DM...    HRLLL &00 100000    ?f,, -,,,,,s0   0-D	  C 
D%DD	
D/D**D/c                `   t          d| j        j                  }d | j        _        t          j        |t          j        d           t          j        |           t          t                    5  t          | j                                                   d d d            d S # 1 swxY w Y   d S )Nintr   )r   r0   r1   r-   r.   LK_UNLCKr(   r2   r   r'   r   r&   unlink)r4   r7   s     r   _releasezWindowsFileLock._releaseX   s    eT]788B)-DM&N2v222HRLLL'"" . .T^$$++---. . . . . . . . . . . . . . . . . .s   /'B##B'*B'Nr   r$   __name__
__module____qualname____doc__r9   r>    r!   r   r#   r#   2   sF        	 		4 	4 	4 	4:	. 	. 	. 	. 	. 	.r!   r#   c                  "    e Zd ZdZddZddZdS )r#   zWUses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.r   r$   c                    t           NNotImplementedErrorr4   s    r   r9   zWindowsFileLock._acquiref       %%r!   c                    t           rH   rI   rK   s    r   r>   zWindowsFileLock._releasei   rL   r!   Nr?   r@   rE   r!   r   r#   r#   c   sB        ee	& 	& 	& 	&	& 	& 	& 	& 	& 	&r!   )r   r   r   r   )!
__future__r   r(   sys
contextlibr   r3   r   pathlibr   typingr   _apir	   _utilr
   r   platformr   r-   r   r   r   WinDLLr   LPCWSTRr   argtypesDWORDrestyper    r#   __all__rE   r!   r   <module>r\      s   " " " " " " 				 



                               F F F F F F F F<7MMMMMM $. ( j>>>I-5-=,>I )+3>I (: : : :.-. -. -. -. -., -. -. -. -.b& & & & &, & & & r!   