
    	h                         S r SSKrSSKrSSKrSSKr\R
                  r\R                  " \R                  \R                  5      r	     S	S jr
S
S jrS\R                  SSS4S jrS
S jrSS jr SS jrg)z0Event Log Utilities - helper for win32evtlog.pyd    Nc                    Uc  [         R                  n[        R                  " [        R
                  SU SU  35      n[        R                  " USS[        R                  U5        Uc2  [         R                  [         R                  -  [         R                  -  n[        R                  " USS[        R                  U5        US:  ac  Uc  [         R                  n[        R                  " USS[        R                  U5        [        R                  " USS[        R                  U5        [        R                  " U5        g)	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          lC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\win32/lib/win32evtlogutil.pyAddSourceToRegistryr      s,   6 ~%%  ##
9,r'SD 	 ++//0334 	
 	 q%..K!""	
 		
     c                      [         R                  " [        R                  SU SU  35        g! [         R                   a)  nUR
                  [
        R                  :w  a  e  SnAgSnAff = f)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^    ''=l^2gYW	
 >> <<8888 9s   +. A+A&&A+c           	          [         R                  " SU 5      n[         R                  " UUUUUUU5        [         R                  " U5        g)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   sK     --dG<G  %%g.r    c                    SR                  UU R                  5      n[        R                  " [        R
                  U5      n [        R                  " US5      S   R                  S5      nSnU H  n [        R                  " U5      n[        R                  " US[        R                  5      n [        R                  " [        R                  UU R                  [        U R                  5      n[        R                   " U5        Uc  M    O   [        R$                  " U5        U=(       d    S$ ! [        R                   " U5        f = f! [        R"                   a     N[f = f! [        R$                  " U5        f = f)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dllNamesr0   dllName	dllHandles           r   FormatMessagerK      sJ    FLL!!G   !<!<gFF%++F4FGJPPQTUG #;;GD$22Q A A		4#22 <<!&..&44D ((3 -  0 	V$:2 ((3>> 
 	V$sO   0E& 4<E1A D11EE& E& 1E		EE# E& "E##E& &E>c                    Uc  Sn [        X5      $ ! [        R                   a^    U R                  c  SnOSR	                  U R                  5      nS[
        R                  " U R                  5      U R                  U4-  s $ f = f)z[As for FormatMessage, except returns an error message if
the message can not be processed.
Applicationr5   z, z|<The description for Event ID ( %d ) in Source ( %r ) could not be found. It contains the following insertion string(s):%r.>)	rK   r   r#   rB   joinr$   HRESULT_CODEr@   r7   )rD   rE   descs      r   SafeFormatMessagerQ      s     
^55>> 
''/D99^99:D K%%n&<&<=))	

s   
 A/BBc                 @   Uc!  [         R                  [         R                  -  n[         R                  " X5      n  [         R                  " XCS5      nU(       d  O[        U 4S jU5        M1  [         R                  " U5        g ! [         R                  " U5        f = f)Nr   c                     U" U 46 $ N )itemfeeders     r   <lambda>%FeedEventLogRecords.<locals>.<lambda>   s    FTG,<r    )r
   EVENTLOG_BACKWARDS_READEVENTLOG_SEQUENTIAL_READOpenEventLogReadEventLogmapCloseEventLog)rW   machineNamelogName	readFlagshobjectss         r   FeedEventLogRecordsre      s     //+2V2VV 	 	  6A%!..qQ?GF<gF	  	!!!$!!!$s   2B B)NrM   NNr   )rM   rT   )NrM   N)__doc__r   r   r
   r$   r#   
MAKELANGIDLANG_NEUTRALSUBLANG_NEUTRALrA   r   r'   r   r*   rK   rQ   re   rU   r    r   <module>rj      s    6    			X22H4L4L	M
 Nb" --	/62j
0 @D%r    