我想利用FILEMON来开发一个实时监控程序,想在驱动中使用loadlibray函数来加载DLL,但WINXPDDK总是报winbase.h文件出错,好像是和ntddk.h有重复的宏定义。请大家帮帮忙!以下是错误报告:
1>g:\winddk\inc\crt\winbase.h(293) : error C2061: syntax error : identifier 'CRITICAL_SECTION'
1>g:\winddk\inc\crt\winbase.h(293) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(294) : error C2061: syntax error : identifier 'PCRITICAL_SECTION'
1>g:\winddk\inc\crt\winbase.h(294) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(295) : error C2061: syntax error : identifier 'LPCRITICAL_SECTION'
1>g:\winddk\inc\crt\winbase.h(295) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(297) : error C2061: syntax error : identifier 'CRITICAL_SECTION_DEBUG'
1>g:\winddk\inc\crt\winbase.h(297) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(298) : error C2061: syntax error : identifier 'PCRITICAL_SECTION_DEBUG'
1>g:\winddk\inc\crt\winbase.h(298) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(299) : error C2061: syntax error : identifier 'LPCRITICAL_SECTION_DEBUG'
1>g:\winddk\inc\crt\winbase.h(299) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(302) : error C2061: syntax error : identifier 'LPLDT_ENTRY'
1>g:\winddk\inc\crt\winbase.h(302) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(1141) : error C4010: single-line comment contains line-continuation character
1>g:\winddk\inc\crt\winbase.h(1154) : error C2059: syntax error : '('
1>g:\winddk\inc\crt\winbase.h(1183) : error C4005: 'InterlockedCompareExchangePointer' : macro redefinition
1>ntddk.h(6957) : error see previous definition of 'InterlockedCompareExchangePointer'
1>g:\winddk\inc\crt\winbase.h(1196) : error C2375: 'InitializeSListHead' : redefinition; different linkage
1>ntddk.h(12139) : error see declaration of 'InitializeSListHead'
1>g:\winddk\inc\crt\winbase.h(1203) : error C2373: 'InterlockedPopEntrySList' : redefinition; different type modifiers
1>ntddk.h(12329) : error see declaration of 'InterlockedPopEntrySList'
1>g:\winddk\inc\crt\winbase.h(1211) : error C2373: 'InterlockedPushEntrySList' : redefinition; different type modifiers
1>ntddk.h(12336) : error see declaration of 'InterlockedPushEntrySList'
1>g:\winddk\inc\crt\winbase.h(1218) : error C2373: 'ExInterlockedFlushSList' : redefinition; different type modifiers
1>ntddk.h(12320) : error see declaration of 'ExInterlockedFlushSList'
1>g:\winddk\inc\crt\winbase.h(1225) : error C2059: syntax error : '('
1>g:\winddk\inc\crt\winbase.h(1543) : error C2146: syntax error : missing ')' before identifier 'lpBuffer'
1>g:\winddk\inc\crt\winbase.h(1543) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(1543) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(1543) : error C2143: syntax error : missing ')' before 'identifier'
1>g:\winddk\inc\crt\winbase.h(1543) : error C2081: 'PMEMORY_BASIC_INFORMATION' : name in formal parameter list illegal
1>g:\winddk\inc\crt\winbase.h(1543) : error C2061: syntax error : identifier 'lpBuffer'
1>g:\winddk\inc\crt\winbase.h(1543) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(1543) : error C2059: syntax error : ','
1>g:\winddk\inc\crt\winbase.h(1545) : error C2059: syntax error : ')'
1>g:\winddk\inc\crt\winbase.h(1605) : error C2146: syntax error : missing ')' before identifier 'lpBuffer'
1>g:\winddk\inc\crt\winbase.h(1605) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(1605) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(1605) : error C2143: syntax error : missing ')' before 'identifier'
1>g:\winddk\inc\crt\winbase.h(1605) : error C2081: 'PMEMORY_BASIC_INFORMATION' : name in formal parameter list illegal
1>g:\winddk\inc\crt\winbase.h(1605) : error C2061: syntax error : identifier 'lpBuffer'
1>g:\winddk\inc\crt\winbase.h(1605) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(1605) : error C2059: syntax error : ','
1>g:\winddk\inc\crt\winbase.h(1607) : error C2059: syntax error : ')'
1>g:\winddk\inc\crt\winbase.h(1748) : error C2146: syntax error : missing ')' before identifier 'HeapInformationClass'
1>g:\winddk\inc\crt\winbase.h(1748) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(1748) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(1748) : error C2143: syntax error : missing ')' before 'identifier'
1>g:\winddk\inc\crt\winbase.h(1748) : error C2081: 'HEAP_INFORMATION_CLASS' : name in formal parameter list illegal
1>g:\winddk\inc\crt\winbase.h(1748) : error C2061: syntax error : identifier 'HeapInformationClass'
1>g:\winddk\inc\crt\winbase.h(1748) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(1748) : error C2059: syntax error : ','
1>g:\winddk\inc\crt\winbase.h(1751) : error C2059: syntax error : ')'
1>g:\winddk\inc\crt\winbase.h(1758) : error C2146: syntax error : missing ')' before identifier 'HeapInformationClass'
1>g:\winddk\inc\crt\winbase.h(1758) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(1758) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(1758) : error C2143: syntax error : missing ')' before 'identifier'
1>g:\winddk\inc\crt\winbase.h(1758) : error C2081: 'HEAP_INFORMATION_CLASS' : name in formal parameter list illegal
1>g:\winddk\inc\crt\winbase.h(1758) : error C2061: syntax error : identifier 'HeapInformationClass'
1>g:\winddk\inc\crt\winbase.h(1758) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(1758) : error C2059: syntax error : ','
1>g:\winddk\inc\crt\winbase.h(1762) : error C2059: syntax error : ')'
1>g:\winddk\inc\crt\winbase.h(2247) : error C2146: syntax error : missing ')' before identifier 'lpSelectorEntry'
1>g:\winddk\inc\crt\winbase.h(2247) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(2247) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(2247) : error C2143: syntax error : missing ')' before 'identifier'
1>g:\winddk\inc\crt\winbase.h(2247) : error C2081: 'LPLDT_ENTRY' : name in formal parameter list illegal
1>g:\winddk\inc\crt\winbase.h(2247) : error C2061: syntax error : identifier 'lpSelectorEntry'
1>g:\winddk\inc\crt\winbase.h(2247) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(2248) : error C2059: syntax error : ')'
1>g:\winddk\inc\crt\winbase.h(2484) : error C2146: syntax error : missing ')' before identifier 'lpCriticalSection'
1>g:\winddk\inc\crt\winbase.h(2484) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(2484) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(2484) : error C2143: syntax error : missing ')' before 'identifier'
1>g:\winddk\inc\crt\winbase.h(2484) : error C2061: syntax error : identifier 'lpCriticalSection'
1>g:\winddk\inc\crt\winbase.h(2484) : error C2059: syntax error : ';'
1>g:\winddk\inc\crt\winbase.h(2485) : error C2059: syntax error : ')'
1>g:\winddk\inc\crt\winbase.h(2491) : error C2146: syntax error : missing ')' before identifier 'lpCriticalSection'
1>g:\winddk\inc\crt\winbase.h(2491) : error C2144: syntax error : '' should be preceded by ''
1>g:\winddk\inc\crt\winbase.h(2491) : error C2144: syntax error : '' should be preceded by ''
filemon包含两部分,一部分是exe,一部分是sys, sys理论上是不能加载dll的,不在同一地址空间。
你可以使用exe加载dll.
如果要在驱动中加载DLL,那么这个DLL不能是应用层的,你要先把它改写成驱动层的,调用方法跟应用的差不多,只要把它的头文件和LIB文件包括了,就可以调用里面的函数了.但是你这个DLL一定要改写,应用层的不行.
1楼的不太对,我做过在驱动调用DLL的,后缀名可以改成sys,呵呵。还有,如果楼主你已经改写了,那么头文件的包含顺序也有一些关系,有时候顺序不同就会出错。
驱动只能调用内核态的DLL, 不能使用用户态的API LoadLibrary()。如何创建内核态的DLL,网上有一篇很经典的E文说明了步骤,参考一下你就明白怎么做了