§
    ÷¢±j“  ã                   ó¾   — d Z ddlZddlZddlZddlZej        Z ej        ej        ej        ¦  «        Z		 	 	 	 	 d
d„Z
dd„Zdej        dddfd„Zdd„Zdd„Z	 dd	„ZdS )z0Event Log Utilities - helper for win32evtlog.pydé    NÚApplicationc                 ó  — |€t           j        }t          j        t          j        d|› d| › �¦  «        }t          j        |ddt          j        |¦  «         |€&t           j        t           j	        z  t           j
        z  }t          j        |ddt          j        |¦  «         |dk    rR|€t           j        }t          j        |ddt          j        |¦  «         t          j        |ddt          j        |¦  «         t          j        |¦  «         dS )	a&  Add a source of messages to the event log.

    Allows Python program to register a custom source of messages in the
    registry.  You must also provide the DLL name that has the message table, so the
    full message text appears in the event log.

    Note that the win32evtlog.pyd file has a number of string entries with just "%1"
    built in, so many Python programs can simply use this DLL.  Disadvantages are that
    you do not get language translation, and the full text is stored in the event log,
    blowing the size of the log up.
    Nú+SYSTEM\CurrentControlSet\Services\EventLog\ú\ÚEventMessageFiler   ÚTypesSupportedÚCategoryMessageFileÚCategoryCount)Úwin32evtlogÚ__file__Úwin32apiÚRegCreateKeyÚwin32conÚHKEY_LOCAL_MACHINEÚRegSetValueExÚREG_EXPAND_SZÚEVENTLOG_ERROR_TYPEÚEVENTLOG_WARNING_TYPEÚEVENTLOG_INFORMATION_TYPEÚ	REG_DWORDÚRegCloseKey)ÚappNameÚmsgDLLÚeventLogTypeÚeventLogFlagsÚcategoryDLLÚcategoryCountÚhkeys          úeC:\Users\johnn\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32/lib/win32evtlogutil.pyÚAddSourceToRegistryr       s;  € ð6 €~ÝÔ%ˆåÔ ÝÔ#ØS¸,ÐSÐSÈ'ÐSÐSñô €Dõ ÔØØØ	ÝÔØñô ð ð ÐåÔ+ÝÔ/ñ0åÔ3ñ4ð 	õ
 ÔØØØ	ÝÔØñô ð ð �qÒÐàÐÝ%Ô.ˆKÝÔØØ!ØÝÔ"Øñ	
ô 	
ð 	
õ 	ÔØØØÝÔØñ	
ô 	
ð 	
õ Ô˜ÑÔÐÐÐó    c                 ó¸   — 	 t          j        t          j        d|› d| › �¦  «         dS # t           j        $ r!}|j        t
          j        k    r‚ Y d}~dS d}~ww xY w)z0Removes a source of messages from the event log.r   r   N)r   ÚRegDeleteKeyr   r   ÚerrorÚwinerrorÚERROR_FILE_NOT_FOUND)r   r   Úexcs      r   ÚRemoveSourceFromRegistryr(   ]   s‰   € ðÝÔÝÔ'ØW¸lÐWÐWÈgÐWÐWñ	
ô 	
ð 	
ð 	
ð 	
øõ Œ>ð ð ð ØŒ<�8Ô8Ò8Ð8Øð 9Ð8Ð8Ð8Ð8Ð8øøøøðøøøs   ‚%) ©A¸AÁAc           	      óŒ   — t          j        d| ¦  «        }t          j        |||||||¦  «         t          j        |¦  «         dS )z4Report an event for a previously added event source.N)r   ÚRegisterEventSourceÚReportEventÚDeregisterEventSource)r   ÚeventIDÚeventCategoryÚ	eventTypeÚstringsÚdataÚsidÚhAppLogs           r   r+   r+   k   s[   € õ Ô-¨d°GÑ<Ô<€Gõ ÔØØØØØØØñô ð õ Ô% gÑ.Ô.Ð.Ð.Ð.r!   c                 ó¤  — d                      || j        ¦  «        }t          j        t          j        |¦  «        }	 t          j        |d¦  «        d                              d¦  «        }d}|D ]±}	 t          j        |¦  «        }t          j	        |dt          j
        ¦  «        }	 t          j        t          j        || j        t          | j        ¦  «        }t          j        |¦  «         n# t          j        |¦  «         w xY wn# t          j        $ r Y nw xY w|� nŒ²t          j        |¦  «         n# t          j        |¦  «         w xY w|pdS )a-  Given a tuple from ReadEventLog, and optionally where the event
    record came from, load the message, and process message inserts.

    Note that this function may raise win32api.error.  See also the
    function SafeFormatMessage which will return None if the message can
    not be processed.
    z0SYSTEM\CurrentControlSet\Services\EventLog\{}\{}r   r   ú;NÚ )ÚformatÚ
SourceNamer   Ú
RegOpenKeyr   r   ÚRegQueryValueExÚsplitÚExpandEnvironmentStringsÚLoadLibraryExÚLOAD_LIBRARY_AS_DATAFILEÚFormatMessageWÚFORMAT_MESSAGE_FROM_HMODULEÚEventIDÚlangidÚStringInsertsÚFreeLibraryr$   r   )ÚeventLogRecordÚlogTypeÚkeyNameÚhandleÚdllNamesr1   ÚdllNameÚ	dllHandles           r   ÚFormatMessagerL   †   su  € ð F×LÒLØØÔ!ñô €Gõ Ô ¥Ô!<¸gÑFÔF€Fð%ÝÔ+¨FÐ4FÑGÔGÈÔJ×PÒPÐQTÑUÔUˆàˆØð 	ð 	ˆGðõ #Ô;¸GÑDÔD�å$Ô2Ø˜Q¥Ô Añô �	ð	4Ý#Ô2Ý Ô<Ø!Ø&Ô.ÝØ&Ô4ñô �Dõ Ô(¨Ñ3Ô3Ð3Ð3ø•HÔ(¨Ñ3Ô3Ð3Ð3øøøÐ3øÝ”>ð ð ð Ø�ðøøøàÐØ�ð  õ 	Ô˜VÑ$Ô$Ð$Ð$ø�Ô˜VÑ$Ô$Ð$Ð$øøøØˆ:�2ÐsG   ¼4D5 Á14DÂ&1C,ÃDÃ,DÄDÄD5 ÄDÄD5 ÄDÄD5 Ä5Ec                 óæ   — |€d}	 t          | |¦  «        S # t          j        $ rK | j        €d}nd                     | j        ¦  «        }dt          j        | j        ¦  «        | j        |fz  cY S w xY w)zcAs for FormatMessage, except returns an error message if
    the message can not be processed.
    Nr   r6   z, z|<The description for Event ID ( %d ) in Source ( %r ) could not be found. It contains the following insertion string(s):%r.>)	rL   r   r$   rC   Újoinr%   ÚHRESULT_CODErA   r8   )rE   rF   Údescs      r   ÚSafeFormatMessagerQ   »   s�   € ð €Øˆð
Ý˜^¨WÑ5Ô5Ð5øÝŒ>ð 
ð 
ð 
ØÔ'Ð/ØˆDˆDà—9’9˜^Ô9Ñ:Ô:ˆDð KåÔ% nÔ&<Ñ=Ô=ØÔ)Øðñð	
ð 	
ð 	
ð
øøøs   † –AA0Á/A0c                 ó   — |€t           j        t           j        z  }t          j        ||¦  «        }	 	 t          j        ||d¦  «        }|snt          | fd„|¦  «         Œ-	 t          j        |¦  «         d S # t          j        |¦  «         w xY w)Né   r   c                 ó   —  || fŽ S ©N© )ÚitemÚfeeders     r   ú<lambda>z%FeedEventLogRecords.<locals>.<lambda>ß   s   € ¨F¨F°T°GÐ,<€ r!   )r   ÚEVENTLOG_BACKWARDS_READÚEVENTLOG_SEQUENTIAL_READÚOpenEventLogÚReadEventLogÚmapÚCloseEventLog)rX   ÚmachineNameÚlogNameÚ	readFlagsÚhÚobjectss         r   ÚFeedEventLogRecordsre   Ò   s¯   € ð ÐåÔ/µ+Ô2VÑVð 	õ 	Ô  ¨gÑ6Ô6€Að%ð	GÝ!Ô.¨q°)¸QÑ?Ô?ˆGØð ØÝ FÐ<Ð<Ð<¸gÑFÔFÐFð		Gð õ 	Ô! !Ñ$Ô$Ð$Ð$Ð$ø�Ô! !Ñ$Ô$Ð$Ð$øøøs   ².A7 Á7B)Nr   NNr   )r   rU   )Nr   N)Ú__doc__r   r   r   r%   r$   Ú
MAKELANGIDÚLANG_NEUTRALÚSUBLANG_NEUTRALrB   r    r(   r   r+   rL   rQ   re   rV   r!   r   ú<module>rj      s  ðØ 6Ð 6à €€€Ø €€€Ø Ð Ð Ð Ø €€€àŒ€Ø	ˆÔ	˜XÔ2°HÔ4LÑ	MÔ	M€ð
 ØØØØðNð Nð Nð Nðbð ð ð ð" ØÔ-ØØ	Øð/ð /ð /ð /ð62ð 2ð 2ð 2ðj
ð 
ð 
ð 
ð0 @Dð%ð %ð %ð %ð %ð %r!   