
    <eX                        d dl Z d dlZd dlZd dlZd dlmZ d dlZd dlmZm	Z	  ej
        ddg           d dlT 	 ej        ej                            d          d	z            Zn# eef$ r dZY nw xY w ej                    dd
         Z e            dk    rdndZedk     rdndZd e j                    fz  Zdez   Zdez   Zddefddefddefddefdg defdg defddefd d!d"z  efd#d$d%z  efd&d'efg
Z G d( d)ej                   Z! G d* d+e!          Z" ej#        ed,           G d- d.e!                      Z$ ej#        ed/           G d0 d1e!                      Z%e&d2k    res e'd3d4            ej(                     dS dS )5    N)import_helper)machinewin32_editionwinregwin)required_on)*z--remote      AMD64TF)   r
   z Python Test Key [%d] - Delete Mez	SOFTWARE\zSOFTWARE\Classes\z	Int Value-   zQword Valuel   w*M	 z
String ValzA string valueStringExpandzThe path is %path%zMulti-string)Lotsofstringvaluesz	Multi-nul) r   r   r   zRaw Datas   binary dataz
Big Stringxi?  z
Big Binary   xi @  u   Japanese 日本u	   日本語c                   H    e Zd Zd Zd ZdefdZdefdZd
dZ	d
dZ
d Zd	S )BaseWinregTestsc                 F    |                      t          t                     d S N)delete_treeHKEY_CURRENT_USERtest_key_nameselfs    '/usr/lib/python3.11/test/test_winreg.pysetUpzBaseWinregTests.setUp6   s!     	*M:::::    c                    	 t          ||dt                    }n# t          $ r Y d S w xY w	 	 t          |d          }n# t          $ r Y nw xY w|                     ||           9t          |           t          ||           d S Nr   )OpenKeyKEY_ALL_ACCESSOSErrorEnumKeyr   CloseKey	DeleteKey)r   rootsubkeyhkey	subsubkeys        r    r   zBaseWinregTests.delete_tree;   s    	4N;;DD 	 	 	FF		.#D!,,		    T9---	. 	$s    
((> 
A
Asub_keyc                 x   t          |t          t          d            ||t                    }|                     |j        dk                |||          }t
          D ]\  }}}t          ||d||           t          |          \  }	}
}|                     |	dd           |                     |
dd           t          |          \  }	}
}|                     |	dd           |                     |
t          t
                    d           t          |          }t          |           	 t          |           |                     d           n# t          $ r Y nw xY wt          |          }|                                 	 t          |           |                     d           d S # t          $ r Y d S w xY w)NDefault valuer   r
   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_dataK   s    	=&/BBBi-00
a((()C++ 3< 	G 	G.J
Jw
Az: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..;	= 	= 	=
 'll	%%%II 2 3 3 3 3 	 	 	D	 c((			!!!II 7 8 8 8 8 8 	 	 	DD	s$   ,$E 
EE$F+ +
F98F9c                 X   t          |t                    }|                     |dd            ||t                    } |||          5 }d}	 	 t          ||          }n# t          $ r Y n(w xY w|                     |t
          v dd           |dz   }F|                     |t          t
                    d           t
          D ]G\  }	}
}t          ||	          \  }}|                     ||
d           |                     ||d           H	 d d d            n# 1 swxY w Y   |                                 t          |d          }|                     ||d	           	 t          |d           | 
                    d
           n# t          $ r Y nw xY w|                                 d S )Nr1   z+Registry didn't give back the correct valuer   r
   Tz&Didn't read back the correct test dataz'Didn't read the correct number of itemsz!Could not directly read the valuezRead subkey value wrongz2Was able to get a second key when I only have one!)
QueryValuer   r9   	EnumValuer'   r6   r:   QueryValueExr=   r(   r<   )r   r>   r?   r%   valrA   r/   indexdatarB   rC   rD   read_valread_typs                 r    _read_test_datazBaseWinregTests._read_test_datat   sh   =11oF	H 	H 	H gh..WS)$$ 	FE"$We44DD   E  !2D!IK K K	" UC	NN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OOOIIJKKKK 	 	 	D	 			sI   
DA D 
A-*D,A--BDD D %F 
FFc                    t          |t          dt                    }t          ||dt                    }t          D ]\  }}}t	          ||           t          |          \  }}	}
|                     |dd           |                     |	dd           |                                 t          ||           	 t          ||           | 	                    d           n# t          $ r Y nw xY w|                                 t          |t                     	 t          |t                    }| 	                    d           d S # t          $ r Y d S w xY w)Nr   zsubkey not empty before deletez Deleting the key twice succeededzCould open the non-existent key)r%   r   r&   r6   DeleteValuer8   r9   r=   r*   r<   r'   )r   r>   r?   rA   r/   rB   rC   rD   rE   rF   rG   s              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!!!	c9%%%II89999 	 	 	D			(M***	(M22CII788888 	 	 	DD	s$   8%C 
C+*C+*E 
EEc                     |                      ||           |                     ||           |                     ||           d S r   )rJ   rT   rW   )r   r>   r?   s      r    	_test_allzBaseWinregTests._test_all   sJ    h	222Xy111x33333r"   c                 @   t          ||dt                    5 }|                     |j        dk               d d d            n# 1 swxY w Y   t	          ||dt                    5 }|                     |j        dk               d d d            d S # 1 swxY w Y   d S )Nr   )rA   r/   reservedaccess)CreateKeyExr&   r4   r5   	OpenKeyEx)r   rA   r/   ckeyokeys        r    _test_named_argsz BaseWinregTests._test_named_args   s'   S'A .0 0 0 	.37OODK1,---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 3!,. . . 	.15OODK1,---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s#   AAA'BBBN)r/   )__name__
__module____qualname__r!   r   r@   rJ   r%   rT   rW   rY   ra    r"   r    r   r   4   s        ; ; ;
       4=#,( ( ( (R 3<W & & & &P   <4 4 4 4
. . . . .r"   r   c                       e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Z ej        edk     d          d             Zd Zd Zd Zd Zd ZdS )LocalWinregTestsc                 p    |                      t                     |                      t          d           d S )Nu   日本-subkey)rY   r   r   s    r    test_registry_worksz$LocalWinregTests.test_registry_works   s0    ()))(/:::::r"   c                     d }|                      t          |           d }|                     t          |           |                     t                     d S )Nc                 0    t          | |dt                    S r$   )r]   r&   rA   r/   s     r    <lambda>zILocalWinregTests.test_registry_works_extended_functions.<locals>.<lambda>   s    ;sGQ#O#O r"   )r@   c                 0    t          | |dt                    S r$   )r^   KEY_READrl   s     r    rm   zILocalWinregTests.test_registry_works_extended_functions.<locals>.<lambda>   s    9S'1h#G#G r"   )r%   )rJ   r   rT   rW   )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    |                      t          t                     t          t          t                     d S r   )ra   r   r   r*   r   s    r    test_named_argumentsz%LocalWinregTests.test_named_arguments   s2    /??? 	#]33333r"   c                     t          d t                    }|                     |j        d           |                                 |                     |j        d           d S r$   )ConnectRegistryHKEY_LOCAL_MACHINEassertNotEqualr5   r=   r9   r   hs     r    ,test_connect_registry_to_local_machine_worksz=LocalWinregTests.test_connect_registry_to_local_machine_works   sU    D"455AHa(((				1%%%%%r"   c                 B    d }|                      t          |           d S )Nc                  ,    t          dt                    S )Nabcdefghijkl)rv   r   re   r"   r    rm   zCLocalWinregTests.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                     t          d          }|                     t          |          t                     |                     |t          j        d         dz              d S )Nz%windir%\testwindirz\test)ExpandEnvironmentStringsr9   typestrosenviron)r   rs     r    testExpandEnvironmentStringsz-LocalWinregTests.testExpandEnvironmentStrings   sT    $%566a#&&&BJx08;<<<<<r"   c                     	 t          d t                    5 }|                     |j        d           t          # 1 swxY w Y   d S # t          $ r |                     |j        d           Y d S w xY wr$   )rv   rw   rx   r5   r'   r9   ry   s     r    test_context_managerz%LocalWinregTests.test_context_manager   s    	* '9:: a##AHa000           	* 	* 	*QXq))))))	*s)   A #:>A >A %A0/A0c                   
 d
 G 
fddt           j                  } |            }|                                 	 t          t          t
          dz             5 }t          d          D ]M}t          |          \  }}}t          |          D ](}t          ||          }	t          ||	d                    )N	 d d d            n# 1 swxY w Y   d
|
                                 t          t          t
          dz              t          t          t
                     d S # d
|
                                 t          t          t
          dz              t          t          t
                     w xY w)NFc                       e Zd Z fdZdS )>LocalWinregTests.test_changing_value.<locals>.VeryActiveThreadc                     t          t          t                    5 }d}d}s"|rdn|}| }t          |dt          |           "d d d            d S # 1 swxY w Y   d S )NT  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr   changing_value)r@   r   r   r2   r3   )r   rA   	use_shortlong_stringsdones        r    runzBLocalWinregTests.test_changing_value.<locals>.VeryActiveThread.run  s    0-@@ CC $I"*K" C#,=CC+(1M	 &6BBB # CC C C C C C C C C C C C C C C C C Cs   )AAAN)rb   rc   rd   r   )r   s   r    VeryActiveThreadr      s5        C C C C C C Cr"   r   z\changing_valuei  r   T)	threadingThreadstartr@   r   r   ranger8   rM   rL   joinr*   )r   r   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 1A1=c1B1B.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KKMMM'7I)IJJJ'77777 DKKMMM'7I)IJJJ'7777s1   D AC9D C		D C	D AE.c           	         d}	 t          t          t                    5 }t          ||t          d           t          |          \  }}}t          |d           d d d            n# 1 swxY w Y   t          t          d                    t          |f                     t          t          t                     d S # t          t          d                    t          |f                     t          t          t                     w xY w)N   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr   r   \)	r@   r   r   r2   r3   r8   r(   r*   r   )r   r   rA   r   r   r   s         r    test_long_keyzLocalWinregTests.test_long_key  s    	8,m<<  dFC000-9#->->*ZQ                             
 'M43H)I)IJJJ'77777 'M43H)I)IJJJ'7777s/   B; ;A%B; %A))B; ,A)-B; ;ADc                     	 t          t          d           nG# t          $ r:}|j        t          j        t          j        fv r|                     d            d }~ww xY wt          t          d           d S )Nr   zMaccess 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//// 	 	 	w5;555 P Q Q Q		
 	*B/////s    
A5AA)   r   zRequires Windows XPc                    	 t          t          t                    5 }|                     |j        d           d d d            n# 1 swxY w Y   t          t          t                    }|                     |j        d           |                     t                    5  t          |           d d d            n# 1 swxY w Y   |                     t                    5  t          |           d d d            n# 1 swxY w Y   |                     t                    5  t          |           d d d            n# 1 swxY w Y   |                     t                    5  t          t          t                     d d d            n# 1 swxY w Y   t          t          t                     d S # t          t          t                     w xY wr$   )r@   r   r   rx   r5   r%   r   NotImplementedErrorDisableReflectionKeyEnableReflectionKeyQueryReflectionKeyDeleteKeyExr*   )r   ckrA   s      r    test_reflection_unsupportedz,LocalWinregTests.test_reflection_unsupported6  s   	8,m<< 2##BIq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7I'7777s   F/ AF/ AF/ AAF/ 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/ /Gc                 D   	 t          t          t                    5 }|                     |j        d           t          |dd t          d           d d d            n# 1 swxY w Y   t          t          t                     d S # t          t          t                     w xY w)Nr   	test_name        )r@   r   r   rx   r5   r7   	REG_DWORDr*   r   r   s     r    test_setvalueex_value_rangez,LocalWinregTests.test_setvalueex_value_rangeJ  s    
	8,m<< I##BIq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7I'7777s.   B 4AB A  B #A $B Bc           	      *   	 t          t          t                    5 }|                     t                    5  t          |dd t          d           t          |dd t          d           d d d            n# 1 swxY w Y   |                     t          t          |d           |                     t          t          |d           d d d            n# 1 swxY w Y   t          t          t                     d S # t          t          t                     w xY w)Ntest_name_dwordtest_name_qword)r@   r   r   r   OverflowErrorr7   r   	REG_QWORDFileNotFoundErrorrN   r*   r   s     r    "test_setvalueex_negative_one_checkz3LocalWinregTests.test_setvalueex_negative_one_checkV  s   		8,m<< Z&&}55 K Kr#4dIrJJJr#4dIrJJJK K K K K K K K K K K K K K K !!"3\2GXYYY!!"3\2GXYYYZ Z Z Z Z Z Z Z Z Z Z Z Z Z Z '77777I'7777sR   C6 C1A4(C4A8	8C;A8	<ACC6 CC6 CC6 6Dc                    	 t          t          t                    5 }|                     |j        d           d}t          |dd t          |           t          |d          \  }}|                     |t                     |                     ||           d d d            n# 1 swxY w Y   t          t          t                     d S # t          t          t                     w xY w)Nr   r   r   )
r@   r   r   rx   r5   r7   r   rN   r9   r*   r   r   test_valret_valret_types        r    test_queryvalueex_return_valuez/LocalWinregTests.test_queryvalueex_return_valueg  s   
		8,m<< 4##BIq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7I'7777/   C	 A:B"C	 "B&&C	 )B&*C	 	C%c                    	 t          t          t                    5 }|                     |j        d           d }t          |ddt          |           t          |d          \  }}|                     |t                     |                     ||           d d d            n# 1 swxY w Y   t          t          t                     d S # t          t          t                     w xY w)Nr   r   )
r@   r   r   rx   r5   r7   
REG_BINARYrN   r9   r*   r   s        r    #test_setvalueex_crash_with_none_argz4LocalWinregTests.test_setvalueex_crash_with_none_argw  s   		8,m<< 4##BIq1112{Az8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7I'7777r   c                    	 t          t          t                    5 }|                     |j        d           d}t          |ddt          |           t          |d          \  }}|                     |t                     |                     |d           d d d            n# 1 swxY w Y   t          t          t                     d S # t          t          t                     w xY w)Nr   zA string  with a nullr   zA string)
r@   r   r   rx   r5   r7   r3   rN   r9   r*   r   s        r     test_read_string_containing_nullz1LocalWinregTests.test_read_string_containing_null  s   		8,m<< 6##BIq11152{Avx@@@$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7I'7777r   N)rb   rc   rd   ri   rr   rt   r{   r   r   r   r   r   r   unittest
skipUnlessWIN_VERr   r   r   r   r   r   re   r"   r    rg   rg      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"   rg   zSkipping remote registry testsc                       e Zd Zd ZdS )RemoteWinregTestsc                 d    t          t          t                    }|                     |           d S r   )rv   REMOTE_NAMEr   rY   )r   
remote_keys     r    test_remote_registry_worksz,RemoteWinregTests.test_remote_registry_works  s*    $[2CDD
z"""""r"   N)rb   rc   rd   r   re   r"   r    r   r     s#        # # # # #r"   r   zx64 specific registry testsc                       e Zd Zd Z ej         e            dv d          d             Z ej        e	d          d             Z
 ej        e	d          d             Zd Zd	S )
Win64WinregTestsc                     |                      t          t                     t          t          t          t          d           d S )Nr   )rA   r/   r\   r[   )ra   r   r   r   r&   r   s    r    rt   z%Win64WinregTests.test_named_arguments  sD    /???)=)A	7 	7 	7 	7 	7 	7r"   )WindowsCoreHeadless	IoTEdgeOSz)APIs not available on WindowsCoreHeadlessc                 r   t          t          d          5 }|                     t          |                     |                     t          |                     |                     t          |                     |                     t          |                     d d d            d S # 1 swxY w Y   d S )NSoftware)r%   rw   r4   r   assertIsNoner   r   )r   rA   s     r    test_reflection_functionsz*Win64WinregTests.test_reflection_functions  s     '44 	5OO.s334441#667772377888OO.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3B0zOS doesn't support reflectionc                 l   	 t          t          t          dt          t          z            5 }|                     |j        d           t          t          t          dt          t          z            5 }|                     |j        d           d d d            n# 1 swxY w Y   t          |ddt          d           d }| 
                    t          |           d d d            n# 1 swxY w Y   t          t          t          dt          t          z            5 }|                     |j        d           |                     dt          |d                     t          |ddt          d           d d d            n# 1 swxY w Y   t          t          t          dt          t          z            5 }|                     dt          |d                     d d d            n# 1 swxY w Y   t!          t          t          t          d           d S # t!          t          t          t          d           w xY w)Nr   r   32KEYc                  T    t          t          t          dt          t          z            S r$   )r%   r   test_reflect_key_namero   KEY_WOW64_64KEYre   r"   r    rm   z2Win64WinregTests.test_reflection.<locals>.<lambda>  s"    G,=,A1,4,F%H %H r"   64KEY)r]   r   r   r&   KEY_WOW64_32KEYrx   r5   r%   r7   r3   r   r'   r   r9   rL   ro   r   )r   created_keyrA   	open_fails       r    test_reflectionz Win64WinregTests.test_reflection  s   $	,.0Eq+o=? ? 6BM##K$6::: .0Eq+o=? ? 7BE''
A6667 7 7 7 7 7 7 7 7 7 7 7 7 7 7
 ;Avw???H H	 !!'9555#6 6 6 6 6 6 6 6 6 6 6 6 6 6 6( *,A1'/9; ; 8>A##CJ222  *S"*=*=>>>3Avw7778 8 8 8 8 8 8 8 8 8 8 8 8 8 8 *,A1!O35 5 ?8;  *S"*=*=>>>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? )+@', , , , ,K)+@', , , ,s   )H AC%0BC%B	C%B	 9C%H %C))H ,C)-,H AE=1H =FH F,H 1%G"H "G&&H )G&*H #H3c                    	 t          t          t          dt          t          z            5 }t          |          }|                     t          |          t                     | 	                    |           t          |           |                     t          |                     d d d            n# 1 swxY w Y   d }|                     t          |           t          t          t          dt          t          z            5 }|                     |j        d           d d d            n# 1 swxY w Y   t%          t          t          t          d           d S # t%          t          t          t          d           w xY w)Nr   c                  T    t          t          t          dt          t          z            S r$   )r^   r   r   ro   r   re   r"   r    rm   z:Win64WinregTests.test_disable_reflection.<locals>.<lambda>  s"    	*;*?*2_*D!F !F r"   )r]   r   r   r&   r   r   r9   r   boolassertFalser   r4   r   r'   r^   ro   rx   r5   r   )r   r   disabledr   rA   s        r    test_disable_reflectionz(Win64WinregTests.test_disable_reflection  s   	,.0Eq+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 gy111 ,.CQ#o57 7 3:=##CJ2223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 )+@', , , , ,K)+@', , , ,sT   )E A>B5)E 5B99E <B9=A
E D/#E /D33E 6D37E #F c                     |                      t                    5 }t          t          d           d d d            d S # 1 swxY w Y   d S )Nsome_value_that_does_not_exist)r   r   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 	Ls   >AAN)rb   rc   rd   rt   r   skipIfr   r   r   HAS_REFLECTIONr   r   r   re   r"   r    r   r     s        7 7 7 X_]]__(LLNyzz5 5 {z5 X)HII), ), JI),V X)HII, , JI,:L L L L Lr"   r   __main__z)Remote registry calls can be tested usingz('test_winreg.py --remote \\machine_name'))r   sysr   r   test.supportr   r   platformr   r   import_moduler   argvrP   r   
IndexError
ValueErrorgetwindowsversionr   WIN64_MACHINEr   getpidtest_key_baser   r   r   r   r3   REG_EXPAND_SZREG_MULTI_SZr   r6   TestCaser   rg   r   r   r   rb   printmainre   r"   r    <module>r     s.                & & & & & &     + + + + + + + +  H5' : : : :    (38>>*55a78KKJ   KKK  #

!
!"1"
%		W,,% !6))u 3ibikk^C},-=  byI(yI&vF*}M888|L&&&|L'zJc7mvFdElzJV,	R. R. R. R. R.h' R. R. R.jF8 F8 F8 F8 F8 F8 F8 F8R ["BCC# # # # # # # DC# ]$ABB_L _L _L _L _L _L _L CB_LD z <9:	< 	< 	<HMOOOOO	 s   (A$ $	A0/A0