2012-12-04 145 views
0

我有這個驅動程序不會編譯。我一直在網上搜索錯誤,並沒有找到解決方案。有什麼想法嗎?錯誤建立Windows 7驅動程序

#include <wdm.h> 

VOID Unload(IN PDRIVER_OBJECT pDriverObject) 
{ 
    DbgPrint("Received signal to unload the driver"); 
    return; 
} 

NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING regPath) 
{ 
    DbgPrint("Driver has been loaded"); 
    (*pDriverObject).DriverUnload = Unload; 
    return(STATUS_SUCCESS); 
} 

錯誤下:

1>------ Build started: Project: KMDF Test, Configuration: Win7 Debug Win32 ------ 
1> Stamping Win7Debug\KMDFTest.inf [Version] section with DriverVer=12/04/2012,10.12.25.726 
1> cl wpp 
1>wpp : error : (WppCreateFile)Cannot open file trace.h, error 2 
2>------ Build started: Project: KMDF Test Package, Configuration: Win7 Debug Win32 ------ 
2>C:\Program Files\Windows Kits\8.0\build\WindowsDriver8.0.common.targets(1347,5): error MSB3030: Could not copy the file "C:\Users\Administrator\documents\visual studio 2012\Projects\KMDF Test\Win7Debug\KMDFTest.sys" because it was not found. 
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ========== 
+0

這是您的驅動程序使用的WPP日誌記錄機制的錯誤。您發佈的代碼與此無關。 – SomeWittyUsername

+0

那麼,我該如何解決它? –

+0

從發佈相關代碼開始。並在網上做一個體面的搜索。這是搜索結果中出現的第一個鏈接:https://www.osronline.com/showthread.cfm?link=228192 – SomeWittyUsername

回答

0

也許你沒有選擇正確的驅動程序模板?

當我同時使用KDM和KDMF模板來創建驅動程序的項目,我遇到了同樣的錯誤,你....所以...

您可以創建一個新項目,並選擇「空WDM驅動程序」模板,那麼一切都會好起來的。

如果您確實想使用WPP,以下鏈接可能會有所幫助。 Supporting WPP Tracing (Windows Drivers)

11

這是我如何解決了這個問題:

在解決方案資源管理器窗口中,右鍵點擊驅動程序項目,然後選擇屬性。在Wpp跟蹤>所有選項中,將運行Wpp跟蹤設置爲否。單擊確定。

Sami

1

你最終修復了這個問題嗎?您的項目很可能無法找到您的trace.h文件。如果你正在使用Visual Studio,然後在項目設置下檢查:

配置屬性 - > WPP跟蹤 - >文件選項 - >掃描配置數據

確保文件路徑是正確的。如果它只是說trace.h,那麼請確保trace.h與項目文件在同一個文件夾中。

如果你不需要做追蹤,那麼薩米的答案就是一樣的好。

0

步驟來解決問題:

  1. 搜索和獲取trace.h裏投入項目文件文件夾或者提供路徑。
  2. 在記事本替換KmdfSmallEvtDeviceAdd與KmdfHelloWorldEvtDeviceAdd
-1

開放* .vcxproj文件並註釋以下行。

<!--  <WppEnabled>true</WppEnabled> 
     <WppScanConfigurationData Condition="'%(ClCompile. ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData> 
     <WppKernelMode>true</WppKernelMode> --> 

然後我做了。它的工作..希望它可以幫助你。