本文整理汇总了Python中win32api.FreeLibrary方法的典型用法代码示例。如果您正苦于以下问题:Python win32api.FreeLibrary方法的具体用法?Python win32api.FreeLibrary怎么用?Python win32api.FreeLibrary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类win32api
的用法示例。
在下文中一共展示了win32api.FreeLibrary方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FormatMessage
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import FreeLibrary [as 别名]
def FormatMessage( eventLogRecord, logType="Application" ):
"""Given a tuple from ReadEventLog, and optionally where the event
record came from, load the message, and process message inserts.
Note that this function may raise win32api.error. See also the
function SafeFormatMessage which will return None if the message can
not be processed.
"""
# From the event log source name, we know the name of the registry
# key to look under for the name of the message DLL that contains
# the messages we need to extract with FormatMessage. So first get
# the event log source name...
keyName = "SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s" % (logType, eventLogRecord.SourceName)
# Now open this key and get the EventMessageFile value, which is
# the name of the message DLL.
handle = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, keyName)
try:
dllNames = win32api.RegQueryValueEx(handle, "EventMessageFile")[0].split(";")
# Win2k etc appear to allow multiple DLL names
data = None
for dllName in dllNames:
try:
# Expand environment variable strings in the message DLL path name,
# in case any are there.
dllName = win32api.ExpandEnvironmentStrings(dllName)
dllHandle = win32api.LoadLibraryEx(dllName, 0, win32con.LOAD_LIBRARY_AS_DATAFILE)
try:
data = win32api.FormatMessageW(win32con.FORMAT_MESSAGE_FROM_HMODULE,
dllHandle, eventLogRecord.EventID, langid, eventLogRecord.StringInserts)
finally:
win32api.FreeLibrary(dllHandle)
except win32api.error:
pass # Not in this DLL - try the next
if data is not None:
break
finally:
win32api.RegCloseKey(handle)
return data or u'' # Don't want "None" ever being returned.
示例2: __exit__
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import FreeLibrary [as 别名]
def __exit__(self, type, value, traceback):
win32api.FreeLibrary(self._handle)
示例3: __exit__
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import FreeLibrary [as 别名]
def __exit__(self, type, value, traceback):
win32api.FreeLibrary(self._handle)
示例4: GetResources
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import FreeLibrary [as 别名]
def GetResources(filename, types=None, names=None, languages=None):
"""
Get resources from dll/exe file.
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.
"""
hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
res = _GetResources(hsrc, types, names, languages)
win32api.FreeLibrary(hsrc)
return res
示例5: decode
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import FreeLibrary [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
示例6: hook
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import FreeLibrary [as 别名]
def hook(mod):
import sys
newname = 'pywintypes%d%d' % sys.version_info[:2]
if mod.typ == 'EXTENSION':
mod.__name__ = newname
else:
import win32api
h = win32api.LoadLibrary(newname + '.dll')
pth = win32api.GetModuleFileName(h)
#win32api.FreeLibrary(h)
mod = PyInstaller.depend.modules.ExtensionModule(newname, pth)
return mod
示例7: hook
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import FreeLibrary [as 别名]
def hook(mod):
import sys
newname = 'pythoncom%d%d' % sys.version_info[:2]
if mod.typ == 'EXTENSION':
mod.__name__ = newname
else:
import win32api
h = win32api.LoadLibrary(newname + '.dll')
pth = win32api.GetModuleFileName(h)
#win32api.FreeLibrary(h)
mod = PyInstaller.depend.modules.ExtensionModule(newname, pth)
return mod
示例8: load_string_resource
# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import FreeLibrary [as 别名]
def load_string_resource(pointer):
"""Resolve a @dllname,ordinal string resource pointer"""
if pointer[0] != "@":
return pointer
resfile, resid = pointer[1:].split(",")
resid = int(resid)
hRes = Api.LoadLibraryEx(resfile, 0, Con.LOAD_LIBRARY_AS_DATAFILE)
val = Api.LoadString(hRes, -resid, 1024)
Api.FreeLibrary(hRes)
return val.split('\x00', 1)[0]