Пример #1
0
 def __setitem__(self, key, value):
     if key == 'Data' and isinstance(value, NDR) is False:
         try:
             value.encode('utf-16le')
         except UnicodeDecodeError:
             import sys
             value = value.decode(sys.getfilesystemencoding())
         self['Length'] = len(value) * 2
         self['MaximumLength'] = len(value) * 2
     return NDRSTRUCT.__setitem__(self, key, value)
Пример #2
0
 def __setitem__(self, key, value):
     if key == 'Data' and isinstance(value, NDR) is False:
         self['Length'] = len(value)
         self['MaximumLength'] = len(value)
     return NDRSTRUCT.__setitem__(self, key, value)