当前位置: 首页>>代码示例>>Python>>正文


Python win32api.LoadResource方法代码示例

本文整理汇总了Python中win32api.LoadResource方法的典型用法代码示例。如果您正苦于以下问题:Python win32api.LoadResource方法的具体用法?Python win32api.LoadResource怎么用?Python win32api.LoadResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32api的用法示例。


在下文中一共展示了win32api.LoadResource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: extract_manifest

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import LoadResource [as 别名]
def extract_manifest(path, resource_name):
  """Reads manifest from |path| and returns it as a string.
  Returns None is there is no such manifest."""
  with LoadLibrary(path) as handle:
    try:
      return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
    except pywintypes.error as error:
      if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
        return None
      else:
        raise 
开发者ID:refack,项目名称:GYP3,代码行数:13,代码来源:gyptest-link-generate-manifest.py

示例2: extract_manifest

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import LoadResource [as 别名]
def extract_manifest(path, resource_name):
  """Reads manifest from |path| and returns it as a string.
  Returns None is there is no such manifest."""
  with LoadLibrary(path) as handle:
    try:
      return win32api.LoadResource(
          handle, RT_MANIFEST, resource_name).decode('utf-8', 'ignore')
    except pywintypes.error as error:
      if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
        return None
      else:
        raise 
开发者ID:refack,项目名称:GYP3,代码行数:14,代码来源:gyptest-link-update-manifest.py

示例3: extract_manifest

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import LoadResource [as 别名]
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
开发者ID:turbulenz,项目名称:gyp,代码行数:13,代码来源:gyptest-link-generate-manifest.py

示例4: extract_manifest

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import LoadResource [as 别名]
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(
            handle, RT_MANIFEST, resource_name).decode('utf-8', 'ignore')
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
开发者ID:turbulenz,项目名称:gyp,代码行数:14,代码来源:gyptest-link-update-manifest.py

示例5: decode

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import LoadResource [as 别名]
def decode(pathnm):
    h = win32api.LoadLibraryEx(pathnm, 0, LOAD_LIBRARY_AS_DATAFILE)
    nm = win32api.EnumResourceNames(h, RT_VERSION)[0]
    data = win32api.LoadResource(h, RT_VERSION, nm)
    vs = VSVersionInfo()
    j = vs.fromRaw(data)
    if TEST:
        print vs
        if data[:j] != vs.toRaw():
            print "AAAAAGGHHHH"
        glbls = {
            'VSVersionInfo': VSVersionInfo,
            'FixedFileInfo': FixedFileInfo,
            'StringFileInfo': StringFileInfo,
            'StringTable': StringTable,
            'StringStruct': StringStruct,
            'VarFileInfo': VarFileInfo,
            'VarStruct': VarStruct,
            }
        vs2 = eval(repr(vs), glbls)
        if vs.toRaw() != vs2.toRaw():
            print
            print 'reconstruction not the same!'
            print vs2
    win32api.FreeLibrary(h)
    return vs 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:28,代码来源:versioninfo.py

示例6: _GetResources

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import LoadResource [as 别名]
def _GetResources(hsrc, types=None, names=None, languages=None):
    """
    Get resources from hsrc.
    
    types = a list of resource types to search for (None = all)
    names = a list of resource names to search for (None = all)
    languages = a list of resource languages to search for (None = all)
    Return a dict of the form {type_: {name: {language: data}}} which 
    might also be empty if no matching resources were found.
    
    """
    if types: types = set(types)
    if names: names = set(names)
    if languages: languages = set(languages)
    res = {}
    try:
        # logger.debug("Enumerating resource types")
        enum_types = win32api.EnumResourceTypes(hsrc)
        if types and not "*" in types:
            enum_types = filter(lambda type_: 
                                type_ in types, 
                                enum_types)
        for type_ in enum_types:
            # logger.debug("Enumerating resources of type %s", type_)
            enum_names = win32api.EnumResourceNames(hsrc, type_)
            if names and not "*" in names:
                enum_names = filter(lambda name: 
                                    name in names, 
                                    enum_names)
            for name in enum_names:
                # logger.debug("Enumerating resources of type %s name %s", type_, name)
                enum_languages = win32api.EnumResourceLanguages(hsrc, 
                                                                type_, 
                                                                name)
                if languages and not "*" in languages:
                    enum_languages = filter(lambda language: 
                                            language in languages, 
                                            enum_languages)
                for language in enum_languages:
                    data = win32api.LoadResource(hsrc, type_, name, language)
                    if not type_ in res:
                        res[type_] = {}
                    if not name in res[type_]:
                        res[type_][name] = {}
                    res[type_][name][language] = data
    except pywintypes.error, exception:
        if exception.args[0] in (ERROR_RESOURCE_DATA_NOT_FOUND,
                                 ERROR_RESOURCE_TYPE_NOT_FOUND,
                                 ERROR_RESOURCE_NAME_NOT_FOUND,
                                 ERROR_RESOURCE_LANG_NOT_FOUND):
            # logger.info('%s: %s', exception.args[1:3])
            pass
        else:
            raise exception 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:56,代码来源:winresource.py


注:本文中的win32api.LoadResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。