Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

[BUG] 32位程序和64位程序编译后无法加载问题 #17

Closed
IBinary6 opened this issue Oct 31, 2022 · 11 comments
Closed

[BUG] 32位程序和64位程序编译后无法加载问题 #17

IBinary6 opened this issue Oct 31, 2022 · 11 comments
Labels
bug Something isn't working

Comments

@IBinary6
Copy link

IBinary6 commented Oct 31, 2022

32位程序Debug/Release编译后(空驱动,里面只使用std::string)
类似代码如下:

#include "main.h"

#include <string>

VOID DriverUnLoad(PDRIVER_OBJECT driver) {
  UNREFERENCED_PARAMETER(driver);
  KdPrint(("DriverUnload\r\n"));
}

NTSTATUS DriverMain(PDRIVER_OBJECT driver,
                     PUNICODE_STRING driver_self_reg_path)
/*  NTSTATUS DriverEntry(PDRIVER_OBJECT driver,
                     PUNICODE_STRING driver_self_reg_path)*/ {
  UNREFERENCED_PARAMETER(driver_self_reg_path);
  DbgPrint("DriverEntry");
  std::string s1 = "HelloWOrld";
  DbgPrint("%s", s1.c_str());
  driver->DriverUnload = DriverUnLoad;

  return STATUS_SUCCESS;
}

无法加载,编译可以通过.但是加载的时候提示找不到程序(127错误).(说明驱动文件不符合)
64的release遇到过,但是后面用家里的电脑(纯净电脑) 重新安装了Nuget包中的咱们这个库. 64的release可以编译通过了并且可以加载.
但是32的驱动可以编译通过,但是不能加载. 不知道那里的问题.
家里电脑使用的 WDK SDK = 2019 18362
生成的Debug 常见配置如下:
运行库 = MTD
安全检查 = 禁用GS
spectre缓解 = 已禁用
SDL = 否
警告为错误 = 否(Wx)
警告等级 = 4

Target Os version = windows 7
Target Platform = Desktop
Driver Mode =KMDF
Driver sign = Off

@IBinary6 IBinary6 added the bug Something isn't working label Oct 31, 2022
@IBinary6
Copy link
Author

测试的驱动加载平台上 win7 32位

@MeeSong
Copy link

MeeSong commented Oct 31, 2022

The location of the wrong code:

__acrt_ptd_km ptd{};
ptd.tid = PsGetCurrentThreadId();
ptd.create_time = PsGetThreadCreateTime(PsGetCurrentThread());

PsGetThreadCreateTime only Win10 or higher.

@IBinary6
Copy link
Author

IBinary6 commented Nov 1, 2022

请问下,可否支持下win7, win7很需要.

@IBinary6
Copy link
Author

IBinary6 commented Nov 1, 2022

亦或者是,能否告知下底层这些类似函数位置. 我可以自己改改. 感谢了.

@IBinary6
Copy link
Author

IBinary6 commented Nov 1, 2022

Win10 32 10240 =
图片
Win7 32 sp1 =
图片
ETHREAD + 0X200 = CreateTime.

@MiroKaku
Copy link
Owner

MiroKaku commented Nov 1, 2022

Thanks.

@IBinary6
Copy link
Author

IBinary6 commented Nov 1, 2022

Thank you for providing such a good library. May I ask how I can sponsor you? Can you susport (Win7 win8.1 )32bit and 64bit?

@MeeSong
Copy link

MeeSong commented Nov 1, 2022

已经移除了 PsGetThreadCreateTime ,Win7之后的版本应该是支持的。

@IBinary6
Copy link
Author

IBinary6 commented Nov 2, 2022

Nuget和Release更新没. 我下载咱们这个库编译没法通过.

@MiroKaku
Copy link
Owner

MiroKaku commented Nov 2, 2022

编译有什么问题?新开一个 issues

@IBinary6
Copy link
Author

IBinary6 commented Nov 2, 2022

可否给个联系方式. 稍等,我给个新的issues

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants