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   