def UpdateResources(dstpath, data, type_, names=None, languages=None):
 res = GetResources(dstpath, [type_], names, languages)
 if ((not (type_ in res)) and (type_ != '*')):
  res[type_] = {}
 if names:
  for name in names:
   if ((not (name in res[type_])) and (name != '*')):
    res[type_][name] = []
    if languages:
     for language in languages:
      if ((not (language in res[type_][name])) and (language != '*')):
       res[type_][name].append(language)
 hdst = win32api.BeginUpdateResource(dstpath, 0)
 for type_ in res:
  for name in res[type_]:
   for language in res[type_][name]:
    logger.info('Updating resource type %s name %s language %s', type_, name, language)
    win32api.UpdateResource(hdst, type_, name, data.encode('UTF-8'), language)
 win32api.EndUpdateResource(hdst, 0)

def UpdateResources ( dstpath , data , type_ , names = None , languages = None ) : res = GetResources ( dstpath , [ type_ ] , names , languages ) if ( ( not ( type_ in res ) ) and ( type_ != '*' ) ) : res [ type_ ] = { } if names : for name in names : if ( ( not ( name in res [ type_ ] ) ) and ( name != '*' ) ) : res [ type_ ] [ name ] = [ ] if languages : for language in languages : if ( ( not ( language in res [ type_ ] [ name ] ) ) and ( language != '*' ) ) : res [ type_ ] [ name ] . append ( language ) hdst = win32api . BeginUpdateResource ( dstpath , 0 ) for type_ in res : for name in res [ type_ ] : for language in res [ type_ ] [ name ] : logger . info ( 'Updating resource type %s name %s language %s' , type_ , name , language ) win32api . UpdateResource ( hdst , type_ , name , data . encode ( 'UTF-8' ) , language ) win32api . EndUpdateResource ( hdst , 0 )
update or add resource data in dll/exe file dstpath .