如何在Linux上从python调用Wine dll? [英] How to call Wine dll from python on Linux?

查看:562
本文介绍了如何在Linux上从python调用Wine dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux中编写一个python脚本,需要调用Wine中的一些Windows功能。具体来说, AllocateAndInitializeSid LookupAccountSidW ,以确定谁登录到远程Windows计算机。这些功能是葡萄酒中的advapi32.dll 编辑)的一部分:使用答案,我可以调用该函数,但LookupAccountSidW只适用于本地计算机)。



如何访问这些函数,或一般的酒dll?我试过

 >>> cdll.LoadLibrary(〜/ .wine / drive_c / windows / system32 / advapi32.dll)

但是会导致错误:

 
OSError:〜/ .wine / drive_c / windows / system32 / advapi32.dll:无效的ELF头

是否有另一个 ctypes 功能可以工作,或者一些可以使用的葡萄酒界面?

解决方案

不提供 *。所以 dll文件?例如,我似乎有 /usr/lib32/wine/advapi32.dll.so



如果您使用的是64位计算机,请记住,您需要一个32位版本的Python才能加载32位库。 p>

I'm writing a python script in Linux, and need to call some Windows functions available in Wine. Specifically, AllocateAndInitializeSid and LookupAccountSidW, to determine who is logged in to a remote Windows computer. 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).

How can I access these functions, or a Wine dll in general? 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?

解决方案

Doesn't Wine provide *.so versions of the dlls? I seem to have /usr/lib32/wine/advapi32.dll.so, for example.

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.

这篇关于如何在Linux上从python调用Wine dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆