#NEWLINE# def _win32_is_nic_enabled( self , lm , guid , interface_key ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# connection_key = _winreg . OpenKey ( lm , ( 'SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection' % guid ) ) #NEWLINE# try : #NEWLINE# #INDENT# ( pnp_id , ttype ) = _winreg . QueryValueEx ( connection_key , 'PnpInstanceID' ) #NEWLINE# if ( ttype != _winreg . REG_SZ ) : #NEWLINE# #INDENT# raise ValueError #NEWLINE# #UNINDENT# device_key = _winreg . OpenKey ( lm , ( 'SYSTEM\\CurrentControlSet\\Enum\\%s' % pnp_id ) ) #NEWLINE# try : #NEWLINE# #INDENT# ( flags , ttype ) = _winreg . QueryValueEx ( device_key , 'ConfigFlags' ) #NEWLINE# if ( ttype != _winreg . REG_DWORD ) : #NEWLINE# #INDENT# raise ValueError #NEWLINE# #UNINDENT# return ( not ( flags & 1 ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# device_key . Close ( ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# connection_key . Close ( ) #NEWLINE# #UNINDENT# #UNINDENT# except ( EnvironmentError , ValueError ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( nte , ttype ) = _winreg . QueryValueEx ( interface_key , 'NTEContextList' ) #NEWLINE# return ( nte is not None ) #NEWLINE# #UNINDENT# except WindowsError : #NEWLINE# #INDENT# return False