o
    �õ±j£  ã                   @   s   d Z ddlZG dd„ dƒZdS )aÉ  
0x00000000	D-Word	ID: ASCII-"regf" = 0x66676572
0x00000004	D-Word	????
0x00000008	D-Word	???? Always the same value as at 0x00000004
0x0000000C	Q-Word	last modify date in WinNT date-format
0x00000014	D-Word	1
0x00000018	D-Word	3
0x0000001C	D-Word	0
0x00000020	D-Word	1
0x00000024	D-Word	Offset of 1st key record
0x00000028	D-Word	Size of the data-blocks (Filesize-4kb)
0x0000002C	D-Word	1
0x000001FC	D-Word	Sum of all D-Words from 0x00000000 to 0x000001FB
é    Nc                   @   sD   e Zd Zdd„ Zdd„ Zdd„ Zedd„ ƒZed	d
„ ƒZdd„ Z	dS )ÚNTRegistryHeadrc                 C   sd   d| _ d | _d | _d | _d | _d | _d | _d | _d | _d | _	d | _
d | _d | _d | _d | _d | _d S )Ns   regf)ÚmagicÚprimary_sequence_numberÚsecondary_sequence_numberÚlast_modifiedÚversion_majorÚversion_minorÚ	file_typeÚfile_formatÚoffsetÚsizeÚclustering_factorÚ	file_nameÚreservedÚchecksumÚ	boot_typeÚboot_recover)Úself© r   úŽ/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/aiowinreg/filestruct/header.pyÚ__init__   s    
zNTRegistryHeadr.__init__c                 C   s   |   t |¡¡ d S ©N)Úparse_header_bufferÚioÚBytesIO)r   Údatar   r   r   Úparse_header_bytes'   s   z"NTRegistryHeadr.parse_header_bytesc                 C   sv  |  d¡| _tj|  d¡ddd�| _tj|  d¡ddd�| _|  d¡| _tj|  d¡ddd�| _tj|  d¡ddd�| _tj|  d¡ddd�| _	tj|  d¡ddd�| _
tj|  d¡ddd�| _tj|  d¡ddd�| _tj|  d¡ddd�| _z|  d¡ d¡ dd	¡| _W n   d | _Y |  d
¡| _tj|  d¡ddd�| _tj|  d¡ddd�| _tj|  d¡ddd�| _d S )Né   ÚlittleF)Úsignedé   é@   z	utf-16-leú Ú iø  )Úreadr   ÚintÚ
from_bytesr   r   r   r   r   r	   r
   r   r   r   ÚdecodeÚreplacer   r   r   r   r   )r   Úreaderr   r   r   r   *   s&   z#NTRegistryHeadr.parse_header_bufferc                 Ã   sJ   �t ƒ }|  d¡I d H }t|tƒr|\}}|d ur|‚n|}| |¡ |S )Ni   )r   r$   Ú
isinstanceÚtupler   )r)   ÚhdrÚresr   Úerrr   r   r   Úaread?   s   €
ÿ
zNTRegistryHeadr.areadc                 C   s   t ƒ }| | ¡ |S r   )r   r   )r)   r,   r   r   r   r$   L   s   
zNTRegistryHeadr.readc                 C   s*   d}| j D ]}|d|| j | f 7 }q|S )Nz== NT Registry header ==
z	%s: %s 
)Ú__dict__)r   ÚtÚkr   r   r   Ú__str__R   s   
zNTRegistryHeadr.__str__N)
Ú__name__Ú
__module__Ú__qualname__r   r   r   Ústaticmethodr/   r$   r3   r   r   r   r   r      s    

r   )Ú__doc__r   r   r   r   r   r   Ú<module>   s   