• 01.VS2010 32位和64位WDK环境设置 2种方法


    创建32位

    1.VS2010新建空项目 DRIVER_X86

    在这里插入图片描述
    2.配置管理器新建配置方案DRIVER_X86
    在这里插入图片描述
    3.属性管理器添加属性表,名字为DriverX86Property.props
    在这里插入图片描述
    在这里插入图片描述

    4.修改DriverX86Property.props内容,复制下面XML,替换完内容重启VS2010

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <ImportGroup Label="PropertySheets" />
      <PropertyGroup Label="UserMacros" />
      <PropertyGroup>
        <ExecutablePath>C:\WinDDK\7600.16385.1\bin\x86;$(ExecutablePath)</ExecutablePath>
      </PropertyGroup>
      <PropertyGroup>
        <IncludePath>C:\WinDDK\7600.16385.1\inc\api;C:\WinDDK\7600.16385.1\inc\ddk;C:\WinDDK\7600.16385.1\inc\crt;$(IncludePath)</IncludePath>
      </PropertyGroup>
      <PropertyGroup>
        <LibraryPath>C:\WinDDK\7600.16385.1\lib\win7\i386;$(LibraryPath)</LibraryPath>
        <TargetExt>.sys</TargetExt>
        <LinkIncremental>false</LinkIncremental>
        <GenerateManifest>false</GenerateManifest>
      </PropertyGroup>
      <ItemDefinitionGroup>
        <ClCompile>
          <PreprocessorDefinitions>WIN32=100;_X86_=1;WINVER=0x500;DBG=1</PreprocessorDefinitions>
          <CallingConvention>StdCall</CallingConvention>
          <ExceptionHandling>false</ExceptionHandling>
          <BasicRuntimeChecks>Default</BasicRuntimeChecks>
          <BufferSecurityCheck>false</BufferSecurityCheck>
          <CompileAs>Default</CompileAs>
          <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
        </ClCompile>
        <Link>
          <AdditionalDependencies>ntoskrnl.lib;wdm.lib;wdmsec.lib;wmilib.lib;ndis.lib;Hal.lib;MSVCRT.LIB;LIBCMT.LIB;%(AdditionalDependencies)</AdditionalDependencies>
        </Link>
        <Link>
          <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
          <EnableUAC>false</EnableUAC>
          <SubSystem>Native</SubSystem>
          <EntryPointSymbol>DriverEntry</EntryPointSymbol>
          <BaseAddress>0x10000</BaseAddress>
          <RandomizedBaseAddress>
          </RandomizedBaseAddress>
          <DataExecutionPrevention>
          </DataExecutionPrevention>
          <GenerateDebugInformation>true</GenerateDebugInformation>
          <Driver>Driver</Driver>
        </Link>
      </ItemDefinitionGroup>
      <ItemGroup />
    </Project>
    

    5.新增DRIVER_X86.C文件,代码如下

    #include 
    
    VOID DriverUnload(PDRIVER_OBJECT driver)
    {
    	DbgPrint("卸载\r\n");
    }
     
    NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
    {
    	DbgPrint("开始!\r\n");
    	driver->DriverUnload = DriverUnload;
    	return STATUS_SUCCESS;
    }
    

    6.生成SYS,运行日志为下图就成功了

    在这里插入图片描述

    创建64位

    1.VS2010新建空项目 DRIVER_X64,和3位一样
    2.配置管理器新建配置方案 DRIVER_X64,这里和32位不一样,需要把默认的win32换成X64
    在这里插入图片描述

    3.属性管理器添加属性表,名字为DriverX64Property.props,这里和32位也是一样的操作

    4.修改DriverX64Property.props内容,复制下面XML,替换完内容重启VS2010

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <ImportGroup Label="PropertySheets" />
      <PropertyGroup Label="UserMacros" />
      <PropertyGroup>
        <ExecutablePath>C:\WinDDK\7600.16385.1\bin\x86;$(ExecutablePath)</ExecutablePath>
      </PropertyGroup>
      <PropertyGroup>
        <IncludePath>C:\WinDDK\7600.16385.1\inc\api;C:\WinDDK\7600.16385.1\inc\ddk;C:\WinDDK\7600.16385.1\inc\crt;$(IncludePath)</IncludePath>
      </PropertyGroup>
      <PropertyGroup>
        <LibraryPath>C:\WinDDK\7600.16385.1\lib\win7\amd64;$(LibraryPath)</LibraryPath>
        <TargetExt>.sys</TargetExt>
        <LinkIncremental>false</LinkIncremental>
        <GenerateManifest>false</GenerateManifest>
      </PropertyGroup>
      <ItemDefinitionGroup>
        <ClCompile>
          <PreprocessorDefinitions>WIN32=100;_AMD64_=1;WINVER=0x501;DBG=1;</PreprocessorDefinitions>
          <CallingConvention>StdCall</CallingConvention>
          <ExceptionHandling>false</ExceptionHandling>
          <BasicRuntimeChecks>Default</BasicRuntimeChecks>
          <BufferSecurityCheck>false</BufferSecurityCheck>
          <CompileAs>Default</CompileAs>
          <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
        </ClCompile>
        <Link>
          <AdditionalDependencies>ntoskrnl.lib;wdm.lib;wdmsec.lib;wmilib.lib;ndis.lib;Hal.lib;MSVCRT.LIB;LIBCMT.LIB;%(AdditionalDependencies)</AdditionalDependencies>
        </Link>
        <Link>
          <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
          <EnableUAC>false</EnableUAC>
          <SubSystem>Native</SubSystem>
          <EntryPointSymbol>DriverEntry</EntryPointSymbol>
          <BaseAddress>0x10000</BaseAddress>
          <RandomizedBaseAddress>
          </RandomizedBaseAddress>
          <DataExecutionPrevention>
          </DataExecutionPrevention>
          <GenerateDebugInformation>true</GenerateDebugInformation>
          <Driver>Driver</Driver>
        </Link>
      </ItemDefinitionGroup>
      <ItemGroup />
    </Project>
    

    5.新增DRIVER_X64.C文件,代码和32位的一样

    6.生成SYS,运行日志和32位的一样就可以了

  • 相关阅读:
    如何使用Pyarmor保护你的Python脚本
    Elasticsearch 浅尝
    Python爬虫:如何下载汽车之家的数据(完整代码)
    [buuctf][WUSTCTF2020]level1
    arrow(c++)改写empyrical系列1---用arrow读取基金净值数据并计算夏普率
    数据问题排查思路
    那么你面试必须知道的H5C3知识点
    高精度除法的实现
    Kubernetes平台部署Grafana Loki Promtail系统
    Docker安装可视化管理器Portainer
  • 原文地址:https://blog.csdn.net/u011488769/article/details/127109363