[英]How to call Wine dll from python on Linux?
I'm writing a python script in Linux, and need to call some Windows functions available in Wine. 我正在Linux中编写一个python脚本,需要调用Wine中的一些Windows函数。 Specifically, AllocateAndInitializeSid
and LookupAccountSidW
, to determine who is logged in to a remote Windows computer. 具体来说, AllocateAndInitializeSid
和LookupAccountSidW
,以确定谁登录到远程Windows计算机。 These functions are part of advapi32.dll in Wine ( edit : using the answers, I was able to call the function, but LookupAccountSidW only works on the local computer). 这些函数是Wine中advapi32.dll的一部分( 编辑 :使用答案,我能够调用该函数,但LookupAccountSidW仅适用于本地计算机)。
How can I access these functions, or a Wine dll in general? 我如何访问这些功能,或一般的Wine dll? I've tried 我试过了
>>> cdll.LoadLibrary("~/.wine/drive_c/windows/system32/advapi32.dll")
but it results in an error: 但它会导致错误:
OSError: ~/.wine/drive_c/windows/system32/advapi32.dll: invalid ELF header
Is there another ctypes
function that would work, or some wine interface I could use? 是否有其他ctypes
功能可以使用,或者我可以使用一些葡萄酒界面?
Doesn't Wine provide *.so
versions of the dlls? Wine不提供*.so
版本的dll吗? I seem to have /usr/lib32/wine/advapi32.dll.so
, for example. 例如,我似乎有/usr/lib32/wine/advapi32.dll.so
。
If you're on a 64-bit machine, keep in mind that you'll need a 32-bit version of Python to load 32-bit libraries. 如果您使用的是64位计算机,请记住,您需要32位版本的Python才能加载32位库。
Understand that .DLL is the format used by Windows. 了解.DLL是Windows使用的格式。
On linux, such libraries end with .SO 在linux上,这些库以.SO结尾
You can't use a library compiled for one platform on the other one. 您不能在另一个平台上使用为一个平台编译的库。 It's not compatible. 它不兼容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.