1 Star 0 Fork 0

何亚红 / linux_binfmt_pe

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

说明

在Linux下虽然可以通过wine执行windows的PE格式程序,但需要手动调用wine命令。于是参考Linux内核中脚本的调用方式,直接执行PE可执行文件。

本仓库为Linux模块工程,仅供测试。

若未特殊说明,默认测试的操作系统为ubuntu22.04.

其他实现方式

若系统中安装了binfmt_misc内核模块及update-binfmts,可使用以下命令直接开启:

#安装
sudo update-binfmts --install win32_pe /usr/bin/wine --magic '\x4d\x5a'
#启用
sudo update-binfmts --enable win32_pe

更多操作可使用man update-binfmts查询帮助。

使用条件

  • wine:在/usr/bin目录下必须包含wine。

自动启动

当binfmt_pe模块正常编译安装后,可通过将binfmt_pe写入/etc/modules实现自动启动。

编译安装

注意:需要先安装以下软件包以支持编译使用:

sudo apt-get install build-essential make dkms wine

本工程由dkms管理,编译安装如下:

#dkms添加
sudo dkms add .
#dkms安装
sudo dkms install binfmt_pe/0.1

测试截图

binfmt_pe

MIT License Copyright (c) 2023 何亚红 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

使用wine直接执行PE可执行文件的Linux内核模块 展开 收起
C 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/HEYAHONG/linux_binfmt_pe.git
git@gitee.com:HEYAHONG/linux_binfmt_pe.git
HEYAHONG
linux_binfmt_pe
linux_binfmt_pe
master

搜索帮助