Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_winreg.cpython-311.opt-2.pyc
�

�Ke�X���ddlZddlZddlZddlZddlmZddlZddlmZm	Z	ej
ddg���ddlT	ejej�
d��d	zZn#eef$rdZYnwxYwej��dd
�Ze��dkrdnd
Zedkrdnd
Zdej��fzZdezZdezZddefddefddefddefdgd�efdgd�efddefd d!d"zefd#d$d%zefd&d'efg
ZGd(�d)ej ��Z!Gd*�d+e!��Z"ej#ed,��Gd-�d.e!����Z$ej#ed/��Gd0�d1e!����Z%e&d2krese'd3d4��ej(��dSdS)5�N)�
import_helper)�machine�
win32_edition�winreg�win)�required_on)�*z--remote���AMD64TF)�r
z Python Test Key [%d] - Delete Mez	SOFTWARE\zSOFTWARE\Classes\z	Int Value�-zQword Valuel�w�*M	z
String ValzA string value�StringExpandzThe path is %path%zMulti-string)�Lots�of�string�valuesz	Multi-nul)�rrrzRaw Datasbinarydataz
Big String�xi�?z
Big Binary�xi@uJapanese 日本u	日本語c�H�eZdZd�Zd�Zdefd�Zdefd�Zd
d�Z	d
d�Z
d�Zd	S)�BaseWinregTestsc�F�|�tt��dS�N)�delete_tree�HKEY_CURRENT_USER�
test_key_name��selfs �:/usr/local/apps/python3/lib/python3.11/test/test_winreg.py�setUpzBaseWinregTests.setUp6s!��	
���*�M�:�:�:�:�:�c��	t||dt��}n#t$rYdSwxYw		t|d��}n#t$rYnwxYw|�||���9t|��t
||��dS�Nr)�OpenKey�KEY_ALL_ACCESS�OSError�EnumKeyr�CloseKey�	DeleteKey)r�root�subkey�hkey�	subsubkeys     r rzBaseWinregTests.delete_tree;s���	��4���N�;�;�D�D���	�	�	��F�F�	����	.�
�#�D�!�,�,�	�	���
�
�
���
����
���T�9�-�-�-�
	.�	������$������s��
(�(�>�
A�
A�sub_keyc�x�t|ttd��||t��}|�|jdk��|||��}t
D]\}}}t
||d||���t|��\}	}
}|�|	dd��|�|
dd��t|��\}	}
}|�|	dd��|�|
tt
��d��t|��}t|��	t|��|�d��n#t$rYnwxYwt|��}
|���	t|
��|�d��dS#t$rYdSwxYw)N�
Default valuerr
z"Not the correct number of sub keysz Not the correct number of valueszAIt appears the CloseKey() function does not close the actual key!zBIt appears the key.Close() function does not close the actual key!)�SetValuer�REG_SZ�
assertTrue�handle�	test_data�
SetValueEx�QueryInfoKey�assertEqual�len�intr)�failr'�Close)r�root_key�	subkeystr�	CreateKey�keyr/�
value_name�
value_data�
value_type�nkeys�nvalues�	since_mod�int_sub_key�int_keys              r �_write_test_dataz BaseWinregTests._write_test_dataKs��	��=�&�/�B�B�B��i��-�0�0������
�a��(�(�(��)�C��+�+��3<�	G�	G�.�J�
�J��w�
�A�z�:�F�F�F�F�%1��$5�$5�!��w�	������#G�H�H�H�����!�%G�H�H�H�$0��$9�$9�!��w�	������#G�H�H�H�����#�i�.�.�;�	=�	=�	=�
�'�l�l�������	���%�%�%��I�I�2�
3�
3�
3�
3���	�	�	��D�	�����c�(�(���	�	����	���!�!�!��I�I�7�
8�
8�
8�
8�
8���	�	�	��D�D�	���s$�,$E�
E�E�$F+�+
F9�8F9c�X�t|t��}|�|dd��||t��}|||��5}d}		t||��}n#t$rYn(wxYw|�|t
vdd��|dz}�F|�|t
t
��d��t
D]G\}	}
}t||	��\}}
|�||
d��|�|
|d���H	ddd��n#1swxYwY|���t|d��}|�||d	��	t|d��|�
d
��n#t$rYnwxYw|���dS)Nr1z+Registry didn't give back the correct valuerr
Tz&Didn't read back the correct test dataz'Didn't read the correct number of itemsz!Could not directly read the valuezRead subkey value wrongz2Was able to get a second key when I only have one!)�
QueryValuerr9�	EnumValuer'r6r:�QueryValueExr=r(r<)rr>r?r%�valrAr/�index�datarBrCrD�read_val�read_typs              r �_read_test_datazBaseWinregTests._read_test_datatsh����=�1�1������o�F�	H�	H�	H��g�h�
�.�.��
�W�S�)�
$�
$�	F���E�
"��$�W�e�4�4�D�D�������E������ � ���!2�D�!I�K�K�K���	��
"�
���U�C�	�N�N�F�
H�
H�
H�7@�
F�
F�2�
�J�
�%1�'�:�%F�%F�"��(�� � ��:�!D�F�F�F�� � ��:�!D�F�F�F�F�	
F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F����	F�	F�	F�	F�(	�
�
�����3��?�?������9�.G�H�H�H�	��C��O�O�O��I�I�J�K�K�K�K���	�	�	��D�	����	�	�	�����sI�
D�A �D� 
A-�*D�,A-�-BD�D� D� %F�
F�Fc��t|tdt��}t||dt��}tD]\}}}t	||���t|��\}}	}
|�|dd��|�|	dd��|���t||��	t||��|�	d��n#t$rYnwxYw|���t|t��	t|t��}|�	d��dS#t$rYdSwxYw)Nrzsubkey not empty before deletez Deleting the key twice succeededzCould open the non-existent key)r%rr&r6�DeleteValuer8r9r=r*r<r')rr>r?rAr/rBrCrDrErFrGs           r �_delete_test_dataz!BaseWinregTests._delete_test_data�sm���h�
�q�.�A�A���#�y�!�^�<�<��3<�	-�	-�.�J�
�J����,�,�,�,�$0��$9�$9�!��w�	������#C�D�D�D�����!�%E�F�F�F��
�
�����#�y�!�!�!�	��c�9�%�%�%��I�I�8�9�9�9�9���	�	�	��D�	�����	�	�����(�M�*�*�*�	��(�M�2�2�C��I�I�7�8�8�8�8�8���	�	�	��D�D�	���s$�8%C�
C+�*C+�*E�
E�Ec��|�||��|�||��|�||��dSr)rJrTrW)rr>r?s   r �	_test_allzBaseWinregTests._test_all�sJ�����h�	�2�2�2����X�y�1�1�1����x��3�3�3�3�3r"c�@�t||dt���5}|�|jdk��ddd��n#1swxYwYt	||dt���5}|�|jdk��ddd��dS#1swxYwYdS)Nr)rAr/�reserved�access)�CreateKeyExr&r4r5�	OpenKeyEx)rrAr/�ckey�okeys     r �_test_named_argsz BaseWinregTests._test_named_args�s'��
�S�'�A� .�0�0�0�	.�37��O�O�D�K�1�,�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.��3��!�,�.�.�.�	.�15��O�O�D�K�1�,�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s#�A�A�A�'B�B�BN)r/)�__name__�
__module__�__qualname__r!rr@rJr%rTrWrYra�r"r rr4s�������;�;�;�
 � � � 4=�#,�(�(�(�(�R3<�W�&�&�&�&�P����<4�4�4�4�
.�.�.�.�.r"rc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Ze
jedkd��d
���Zd�Zd�Zd�Zd�Zd�ZdS)�LocalWinregTestsc�p�|�t��|�td��dS)Nu
日本-subkey)rYrrs r �test_registry_worksz$LocalWinregTests.test_registry_works�s0�����(�)�)�)����(�/�:�:�:�:�:r"c��d�}|�t|���d�}|�t|���|�t��dS)Nc�0�t||dt��Sr$)r]r&�rAr/s  r �<lambda>zILocalWinregTests.test_registry_works_extended_functions.<locals>.<lambda>�s��;�s�G�Q��#O�#O�r")r@c�0�t||dt��Sr$)r^�KEY_READrls  r rmzILocalWinregTests.test_registry_works_extended_functions.<locals>.<lambda>�s��9�S�'�1�h�#G�#G�r")r%)rJrrTrW)r�cke�okes   r �&test_registry_works_extended_functionsz7LocalWinregTests.test_registry_works_extended_functions�sd��P�O�����/�3��?�?�?�G�G�����.���<�<�<����0�1�1�1�1�1r"c�z�|�tt��ttt��dSr)rarrr*rs r �test_named_argumentsz%LocalWinregTests.test_named_arguments�s2�����/��?�?�?�	�#�]�3�3�3�3�3r"c���tdt��}|�|jd��|���|�|jd��dSr$)�ConnectRegistry�HKEY_LOCAL_MACHINE�assertNotEqualr5r=r9�r�hs  r �,test_connect_registry_to_local_machine_worksz=LocalWinregTests.test_connect_registry_to_local_machine_works�sU���D�"4�5�5�����A�H�a�(�(�(�	���	�	�	������1�%�%�%�%�%r"c�B�d�}|�t|��dS)Nc�,�tdt��S)N�abcdefghijkl)rvrrer"r rmzCLocalWinregTests.test_nonexistent_remote_registry.<locals>.<lambda>�s��/�.�:K�L�L�r")�assertRaisesr')r�connects  r � test_nonexistent_remote_registryz1LocalWinregTests.test_nonexistent_remote_registry�s&��L�L�����'�7�+�+�+�+�+r"c���td��}|�t|��t��|�|tjddz��dS)Nz
%windir%\test�windirz\test)�ExpandEnvironmentStringsr9�type�str�os�environ)r�rs  r �testExpandEnvironmentStringsz-LocalWinregTests.testExpandEnvironmentStrings�sT��$�%5�6�6������a���#�&�&�&�����B�J�x�0�8�;�<�<�<�<�<r"c���	tdt��5}|�|jd��t�#1swxYwYdS#t$r|�|jd��YdSwxYwr$)rvrwrxr5r'r9rys  r �test_context_managerz%LocalWinregTests.test_context_manager�s���	*� ��'9�:�:�
�a��#�#�A�H�a�0�0�0��
�
�
�
�
����
�
�
�
�
�
���	*�	*�	*����Q�X�q�)�)�)�)�)�)�	*���s)�A�#:�>�A�>�A�%A0�/A0c���
�d�
G�
fd�dtj��}|��}|���	ttt
dz��5}t
d��D]M}t|��\}}}t
|��D](}t||��}	t||	d���)�N	ddd��n#1swxYwYd�
|�
��ttt
dz��ttt
��dS#d�
|�
��ttt
dz��ttt
��wxYw)NFc���eZdZ�fd�ZdS)�>LocalWinregTests.test_changing_value.<locals>.VeryActiveThreadc���ttt��5}d}d}�s"|rdn|}|}t|dt|����"ddd��dS#1swxYwYdS)NT��xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr�changing_value)r@rrr2r3)rrA�	use_short�long_string�s�dones     �r �runzBLocalWinregTests.test_changing_value.<locals>.VeryActiveThread.runs�����0�-�@�@�C�C� $�I�"*�K�"�C�#,�=�C�C�+��(1�M�	� ��&6���B�B�B�#�C�C�C�C�C�C�C�C�C�C�C�C�C����C�C�C�C�C�Cs�)A�A�AN)rbrcrdr�)r�s�r �VeryActiveThreadr�s5�������
C�
C�
C�
C�
C�
C�
Cr"r�z\changing_valuei�rT)�	threading�Thread�startr@rr�ranger8rMrL�joinr*)rr��threadrA�_�num_subkeys�
num_values�t�i�namer�s          @r �test_changing_valuez$LocalWinregTests.test_changing_value�s������	C�	C�	C�	C�	C�	C�	C�y�/�	C�	C�	C�"�!�#�#��������	8��,�(�);�;�=�=�
1�@C��t���1�1�A�1=�c�1B�1B�.�K��Q�"�:�.�.�1�1��(��a�0�0��"�3��Q��0�0�0�0�1�1�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1����
1�
1�
1�
1��D��K�K�M�M�M��'��7I�)I�J�J�J��'��7�7�7�7�7���D��K�K�M�M�M��'��7I�)I�J�J�J��'��7�7�7�7���s1�D�AC�9D�C	�	D�C	�
D�AE.c	��d}	ttt��5}t||td��t|��\}}}t
|d��ddd��n#1swxYwYttd�t|f����ttt��dS#ttd�t|f����ttt��wxYw)N�xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrr�\)	r@rrr2r3r8r(r*r�)rr�rAr�r�r�s      r �
test_long_keyzLocalWinregTests.test_long_keys����	8��,�m�<�<�
 ����d�F�C�0�0�0�-9�#�->�->�*��Z����Q����
 �
 �
 �
 �
 �
 �
 �
 �
 �
 �
 ����
 �
 �
 �
 �

�'����M�4�3H�)I�)I�J�J�J��'��7�7�7�7�7��
�'����M�4�3H�)I�)I�J�J�J��'��7�7�7�7���s/�B;�;A%�B;�%A)�)B;�,A)�-B;�;ADc���	ttd��nG#t$r:}|jtjtjfvr|�d���d}~wwxYwttd��dS)NrzMaccess denied to registry key (are you running in a non-interactive session?)r)rM�HKEY_PERFORMANCE_DATAr'�errno�EPERM�EACCES�skipTestrN)r�es  r �test_dynamic_keyz!LocalWinregTests.test_dynamic_key(s���	��+�Q�/�/�/�/���	�	�	��w�5�;���5�5�5��
�
�P�Q�Q�Q������		����
	�*�B�/�/�/�/�/s��
A�5A�A)�rzRequires Windows XPc��	ttt��5}|�|jd��ddd��n#1swxYwYttt��}|�|jd��|�t��5t|��ddd��n#1swxYwY|�t��5t|��ddd��n#1swxYwY|�t��5t|��ddd��n#1swxYwY|�t��5ttt��ddd��n#1swxYwYttt��dS#ttt��wxYwr$)
r@rrrxr5r%r�NotImplementedError�DisableReflectionKey�EnableReflectionKey�QueryReflectionKey�DeleteKeyExr*)r�ckrAs   r �test_reflection_unsupportedz,LocalWinregTests.test_reflection_unsupported6s���	8��,�m�<�<�
2���#�#�B�I�q�1�1�1�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2����
2�
2�
2�
2��+�]�;�;�C�����
�A�.�.�.��"�"�#6�7�7�
*�
*�$�S�)�)�)�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*����
*�
*�
*�
*��"�"�#6�7�7�
)�
)�#�C�(�(�(�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)����
)�
)�
)�
)��"�"�#6�7�7�
(�
(�"�3�'�'�'�
(�
(�
(�
(�
(�
(�
(�
(�
(�
(�
(����
(�
(�
(�
(��"�"�#6�7�7�
>�
>��-�}�=�=�=�
>�
>�
>�
>�
>�
>�
>�
>�
>�
>�
>����
>�
>�
>�
>�
�'��7�7�7�7�7��I�'��7�7�7�7���s��F/�A�F/�A�F/�A�AF/�B:�.F/�:B>�>F/�B>�F/�C;�/F/�;C?�?F/�C?�F/� D<�0F/�<E�F/�E�F/�!F�<F/�F�F/�F�F/�/Gc�D�	ttt��5}|�|jd��t|ddtd��ddd��n#1swxYwYttt��dS#ttt��wxYw)Nr�	test_name�)r@rrrxr5r7�	REG_DWORDr*�rr�s  r �test_setvalueex_value_rangez,LocalWinregTests.test_setvalueex_value_rangeJs���
	8��,�m�<�<�
I���#�#�B�I�q�1�1�1��2�{�D�)�Z�H�H�H�
I�
I�
I�
I�
I�
I�
I�
I�
I�
I�
I����
I�
I�
I�
I�
�'��7�7�7�7�7��I�'��7�7�7�7���s.�B�4A�B�A � B�#A �$B�Bc	�*�	ttt��5}|�t��5t|ddtd��t|ddtd��ddd��n#1swxYwY|�tt|d��|�tt|d��ddd��n#1swxYwYttt��dS#ttt��wxYw)N�test_name_dword����test_name_qword)r@rrr�
OverflowErrorr7r��	REG_QWORD�FileNotFoundErrorrNr*r�s  r �"test_setvalueex_negative_one_checkz3LocalWinregTests.test_setvalueex_negative_one_checkVs���		8��,�m�<�<�
Z���&�&�}�5�5�K�K��r�#4�d�I�r�J�J�J��r�#4�d�I�r�J�J�J�K�K�K�K�K�K�K�K�K�K�K����K�K�K�K��!�!�"3�\�2�GX�Y�Y�Y��!�!�"3�\�2�GX�Y�Y�Y�
Z�
Z�
Z�
Z�
Z�
Z�
Z�
Z�
Z�
Z�
Z����
Z�
Z�
Z�
Z�
�'��7�7�7�7�7��I�'��7�7�7�7���sR�C6�C�1A4�(C�4A8	�8C�;A8	�<AC�C6�C�C6�C�C6�6Dc���	ttt��5}|�|jd��d}t|ddt|��t|d��\}}|�|t��|�||��ddd��n#1swxYwYttt��dS#ttt��wxYw)Nrr�r�)
r@rrrxr5r7r�rNr9r*�rr��test_val�ret_val�ret_types     r �test_queryvalueex_return_valuez/LocalWinregTests.test_queryvalueex_return_valuegs
��
		8��,�m�<�<�
4���#�#�B�I�q�1�1�1�%���2�{�D�)�X�F�F�F�$0��[�$A�$A�!���� � ��9�5�5�5�� � ��(�3�3�3�

4�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4����
4�
4�
4�
4�
�'��7�7�7�7�7��I�'��7�7�7�7����/�C	�A:B"�C	�"B&�&C	�)B&�*C	�	C%c���	ttt��5}|�|jd��d}t|ddt|��t|d��\}}|�|t��|�||��ddd��n#1swxYwYttt��dS#ttt��wxYw)Nrr�)
r@rrrxr5r7�
REG_BINARYrNr9r*r�s     r �#test_setvalueex_crash_with_none_argz4LocalWinregTests.test_setvalueex_crash_with_none_argws
��		8��,�m�<�<�
4���#�#�B�I�q�1�1�1����2�{�A�z�8�D�D�D�$0��[�$A�$A�!���� � ��:�6�6�6�� � ��(�3�3�3�

4�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4����
4�
4�
4�
4�
�'��7�7�7�7�7��I�'��7�7�7�7���r�c���	ttt��5}|�|jd��d}t|ddt|��t|d��\}}|�|t��|�|d��ddd��n#1swxYwYttt��dS#ttt��wxYw)NrzA string with a nullr�zA string)
r@rrrxr5r7r3rNr9r*r�s     r � test_read_string_containing_nullz1LocalWinregTests.test_read_string_containing_null�s
��		8��,�m�<�<�
6���#�#�B�I�q�1�1�1�5���2�{�A�v�x�@�@�@�$0��[�$A�$A�!���� � ��6�2�2�2�� � ��*�5�5�5�

6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6�
�'��7�7�7�7�7��I�'��7�7�7�7���r�N)rbrcrdrirrrtr{r�r�r�r�r�r��unittest�
skipUnless�WIN_VERr�r�r�r�r�r�rer"r rgrg�s(������;�;�;�
2�
2�
2�4�4�4�&�&�&�,�,�,�=�=�=�
*�*�*�8�8�8�@8�8�8�
0�
0�
0��X���6�)�+@�A�A�8�8�B�A�8�&
8�
8�
8�8�8�8�"8�8�8� 8�8�8�8�8�8�8�8r"rgzSkipping remote registry testsc��eZdZd�ZdS)�RemoteWinregTestsc�d�ttt��}|�|��dSr)rv�REMOTE_NAMErrY)r�
remote_keys  r �test_remote_registry_worksz,RemoteWinregTests.test_remote_registry_works�s*��$�[�2C�D�D�
����z�"�"�"�"�"r"N)rbrcrdr�rer"r r�r��s#������#�#�#�#�#r"r�zx64 specific registry testsc���eZdZd�Zeje��dvd��d���Zeje	d��d���Z
eje	d��d���Zd�Zd	S)
�Win64WinregTestsc��|�tt��ttttd���dS)Nr)rAr/r\r[)rarrr�r&rs r rtz%Win64WinregTests.test_named_arguments�sD�����/��?�?�?��)�=�)�A�	7�	7�	7�	7�	7�	7r")�WindowsCoreHeadless�	IoTEdgeOSz)APIs not available on WindowsCoreHeadlessc�r�ttd��5}|�t|����|�t|����|�t
|����|�t|����ddd��dS#1swxYwYdS)N�Software)r%rwr4r��assertIsNoner�r�)rrAs  r �test_reflection_functionsz*Win64WinregTests.test_reflection_functions�s����'��
4�
4�	5���O�O�.�s�3�3�4�4�4����1�#�6�6�7�7�7����2�3�7�7�8�8�8��O�O�.�s�3�3�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s�B	B,�,B0�3B0zOS doesn't support reflectionc�l�	tttdttz��5}|�|jd��tttdttz��5}|�|jd��ddd��n#1swxYwYt|ddtd��d�}|�
t|��ddd��n#1swxYwYtttdttz��5}|�|jd��|�
dt|d����t|ddtd��ddd��n#1swxYwYtttdttz��5}|�
dt|d����ddd��n#1swxYwYt!tttd��dS#t!tttd��wxYw)Nrr�32KEYc�T�tttdttz��Sr$)r%r�test_reflect_key_namero�KEY_WOW64_64KEYrer"r rmz2Win64WinregTests.test_reflection.<locals>.<lambda>�s"��G�,=�,A�1�,4��,F�%H�%H�r"�64KEY)r]rr�r&�KEY_WOW64_32KEYrxr5r%r7r3rr'r�r9rLror�)r�created_keyrA�	open_fails    r �test_reflectionz Win64WinregTests.test_reflection�s��$	,��.�0E�q�+�o�=�?�?�
6�BM��#�#�K�$6��:�:�:��.�0E�q�+�o�=�?�?�7�BE��'�'��
�A�6�6�6�7�7�7�7�7�7�7�7�7�7�7����7�7�7�7�
�;��A�v�w�?�?�?�H�H�	��!�!�'�9�5�5�5�#
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6�(�*�,A�1�'�/�9�;�;�
8�>A��#�#�C�J��2�2�2�� � ��*�S�"�*=�*=�>�>�>��3��A�v�w�7�7�7�

8�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8����
8�
8�
8�
8��*�,A�1�!�O�3�5�5�
?�8;�� � ��*�S�"�*=�*=�>�>�>�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?����
?�
?�
?�
?�
�)�+@�'��
,�
,�
,�
,�
,��K�)�+@�'��
,�
,�
,�
,���s��)H�AC%�0B�C%�B	�C%�B	� 9C%�H�%C)�)H�,C)�-,H�AE=�1H�=F�H�F�,H�1%G"�H�"G&�&H�)G&�*H�#H3c��	tttdttz��5}t|��}|�t|��t��|�	|��t|��|�t|����ddd��n#1swxYwYd�}|�t|��tttdttz��5}|�|jd��ddd��n#1swxYwYt%tttd��dS#t%tttd��wxYw)Nrc�T�tttdttz��Sr$)r^rr�ror�rer"r rmz:Win64WinregTests.test_disable_reflection.<locals>.<lambda>�s"��	�*;�*?��*2�_�*D�!F�!F�r")r]rr�r&r�r�r9r��bool�assertFalser�r4rr'r^rorxr5r�)rr��disabledr�rAs     r �test_disable_reflectionz(Win64WinregTests.test_disable_reflection�s���	,��.�0E�q�+�o�=�?�?�	
A�BM�-�k�:�:��� � ��h����6�6�6�� � ��*�*�*�$�[�1�1�1���� 2�;� ?� ?�@�@�@�	
A�	
A�	
A�	
A�	
A�	
A�	
A�	
A�	
A�	
A�	
A����	
A�	
A�	
A�	
A�F�F�I�
���g�y�1�1�1��,�.C�Q�#�o�5�7�7�
3�:=��#�#�C�J��2�2�2�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3����
3�
3�
3�
3�
�)�+@�'��
,�
,�
,�
,�
,��K�)�+@�'��
,�
,�
,�
,���sT�)E�A>B5�)E�5B9�9E�<B9�=A
E�D/�#E�/D3�3E�6D3�7E�#Fc��|�t��5}ttd��ddd��dS#1swxYwYdS)N�some_value_that_does_not_exist)rr�rL�HKEY_CLASSES_ROOT)r�ctxs  r �test_exception_numbersz'Win64WinregTests.test_exception_numbers�s���
�
�
�0�
1�
1�	L�S��(�*J�K�K�K�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L����	L�	L�	L�	L�	L�	Ls�>�A�AN)
rbrcrdrtr��skipIfrr�r��HAS_REFLECTIONr�r�r�rer"r r�r��s�������7�7�7��X�_�]�]�_�_�(L�L�Ny�z�z�5�5�{�z�5��X���)H�I�I�),�),�J�I�),�V�X���)H�I�I�,�,�J�I�,�:L�L�L�L�Lr"r��__main__z)Remote registry calls can be tested usingz('test_winreg.py --remote \\machine_name'))r��sysr�r��test.supportrr��platformrr�
import_moduler�argvrPr��
IndexError�
ValueError�getwindowsversionr��
WIN64_MACHINEr��getpid�
test_key_baserr�r�r�r3�
REG_EXPAND_SZ�REG_MULTI_SZr�r6�TestCaserrgr�r�r�rb�print�mainrer"r �<module>rs.������������������&�&�&�&�&�&�����+�+�+�+�+�+�+�+��
��H�5�'�:�:�:�:�������(�3�8�>�>�*�5�5�a�7�8�K�K���J������K�K�K����� �#�
�
!�
!�"�1�"�
%����	�	�W�,�,���%�
�!�6�)�)���u��3�i�b�i�k�k�^�C�
��}�,�
�-�
�=���b�y�I��(�y�I��&�v�F��*�}�M��8�8�8�|�L��&�&�&�|�L��'�z�J��c�7�m�v�F��d�E�l�z�J���V�,�
�	�R.�R.�R.�R.�R.�h�'�R.�R.�R.�jF8�F8�F8�F8�F8��F8�F8�F8�R���[�"B�C�C�#�#�#�#�#��#�#�D�C�#����]�$A�B�B�_L�_L�_L�_L�_L��_L�_L�C�B�_L�D�z����<�
��9�:�	<�	<�	<��H�M�O�O�O�O�O�	�s�(A$�$	A0�/A0