2012-02-17 8 views
0

PNDIS_GENERIC_OBJECT変数を宣言した後、コンパイラエラーが発生します。なぜこれが起こるのですか、それをどうやって避けることができますか?PNDIS_GENERIC_OBJECTエラーC2061

#include <ntddk.h> 
#include <ndis.h> 

PNDIS_GENERIC_OBJECT gNdisGenericObj; 

VOID DriverUnload(IN PDRIVER_OBJECT driverObject){ 
     UNREFERENCED_PARAMETER(driverObject); 
} 


NTSTATUS DriverEntry( IN PDRIVER_OBJECT driverObject, 
         IN PUNICODE_STRING registryPath) 
{ 
    NTSTATUS status = STATUS_SUCCESS; 


    if (driverObject != NULL) 
     driverObject->DriverUnload = DriverUnload; 

    return status; 
} 

エラーC2061:構文エラー:識別子 'gNdisGenericObj'

エラーC2059:構文エラー: ';'

+0

適切なヘッダーファイルから 'PNDIS_GENERIC_OBJECT'の定義を貼り付けることはできますか?それが失敗を理解するのに役立つかもしれません。 – tomlogic

答えて

2

コードを適切なNDISバージョン定義でコンパイルする必要があります。だから、要約すると、-DNDIS60=1のようなフラグを使用してコンパイル

/* 
Before including this header, you must define one or more macros. In all 
examples, "630" can be any version number (as explained later). 

1. If you are compiling a kernel-mode miniport driver, define: 
     #define NDIS_MINIPORT_DRIVER 1 
     #define NDIS630_MINIPORT 1 
    Additionally, if you are compiling a WDM or WDF (i.e., KMDF) driver, 
    you must include wdm.h/wdf.h before including ndis.h, and also define: 
     #define NDIS_WDM 

2. If you are compiling any other kernel-mode code (including protocol 
    drivers, lightweight filters, or generic code not using the NDIS 
    driver model), define: 
     #define NDIS630 

3. An IM driver, because it is both a protocol and a miniport, should 
    follow both 1. and 2. above. 

4. If you would like to use NDIS definitions from user-mode, do not 
    include this ndis.h header. Instead, include ntddndis.h from the SDK. 
    Before including it, include windows.h, and define: 
     #define UM_NDIS630 

Definitions with NDIS version numbers may use any of the following: 

    Version  First available in 
    ------------------------------------------------------------------ 
    630   Windows "8"/Windows Server "8" 
    620   Windows 7/Windows Server 2008 R2 
    61   Windows Vista SP1/Windows Server 2008 RTM 
    60   Windows Vista RTM 
    52   Windows Server 2003 R2/Windows Server 2003 + SNP 
    51   Windows XP/Windows Server 2003 
    50   Windows 2000 
    40   Windows 95 

Code should define only the versions it explicitly supports at runtime. In 
most cases, this is exactly one version (e.g., your driver only defines 
NDIS630 and no other versions). But if you have a driver that can register 
either a 6.0 or a 6.20 protocol at runtime based on the results of 
NdisGetVersion(), then you may define support for multiple macros (e.g., 
define both NDIS60 and NDIS630). 
*/ 

、あなたが行くように良いことがあります:私は、Windowsの開発者向けプレビュー版でNDIS.Hの上から引用します。

関連する問題