Python win32api.LoadResource() Examples
The following are 22
code examples of win32api.LoadResource().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32api
, or try the search function
.
Example #1
Source File: gyptest-link-enable-uac.py From gyp with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #2
Source File: gyptest-link-enable-uac.py From android-xmrig-miner with GNU General Public License v3.0 | 5 votes |
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
Example #3
Source File: gyptest-link-embed-manifest.py From android-xmrig-miner with GNU General Public License v3.0 | 5 votes |
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
Example #4
Source File: gyptest-link-update-manifest.py From android-xmrig-miner with GNU General Public License v3.0 | 5 votes |
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
Example #5
Source File: gyptest-link-generate-manifest.py From android-xmrig-miner with GNU General Public License v3.0 | 5 votes |
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
Example #6
Source File: versioninfo.py From ConTroll_Remote_Access_Trojan with Apache License 2.0 | 5 votes |
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
Example #7
Source File: gyptest-link-enable-uac.py From kawalpemilu2014 with GNU Affero General Public License v3.0 | 5 votes |
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
Example #8
Source File: gyptest-link-embed-manifest.py From kawalpemilu2014 with GNU Affero General Public License v3.0 | 5 votes |
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
Example #9
Source File: gyptest-link-update-manifest.py From kawalpemilu2014 with GNU Affero General Public License v3.0 | 5 votes |
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
Example #10
Source File: gyptest-link-generate-manifest.py From kawalpemilu2014 with GNU Affero General Public License v3.0 | 5 votes |
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
Example #11
Source File: gyptest-link-generate-manifest.py From GYP3 with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #12
Source File: gyptest-link-embed-manifest.py From gyp with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #13
Source File: gyptest-link-update-manifest.py From gyp with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #14
Source File: gyptest-link-generate-manifest.py From gyp with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #15
Source File: gyptest-link-enable-uac.py From gyp with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #16
Source File: gyptest-link-embed-manifest.py From gyp with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #17
Source File: gyptest-link-update-manifest.py From gyp with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #18
Source File: gyptest-link-generate-manifest.py From gyp with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #19
Source File: gyptest-link-enable-uac.py From GYP3 with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #20
Source File: gyptest-link-embed-manifest.py From GYP3 with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #21
Source File: gyptest-link-update-manifest.py From GYP3 with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #22
Source File: winresource.py From ConTroll_Remote_Access_Trojan with Apache License 2.0 | 4 votes |
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