mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2024-11-14 17:40:24 -08:00
22 lines
454 B
Python
22 lines
454 B
Python
import ctypes
|
|
|
|
from .api import library
|
|
|
|
|
|
def find_lib(lib):
|
|
r"""
|
|
Find the DLL for a given library.
|
|
|
|
Accepts a string or loaded module
|
|
|
|
>>> print(find_lib('kernel32').lower())
|
|
c:\windows\system32\kernel32.dll
|
|
"""
|
|
if isinstance(lib, str):
|
|
lib = getattr(ctypes.windll, lib)
|
|
|
|
size = 1024
|
|
result = ctypes.create_unicode_buffer(size)
|
|
library.GetModuleFileName(lib._handle, result, size)
|
|
return result.value
|