#include "KeApp.h"
NTSTATUS extern "C" DriverEntry(PDRIVER_OBJECT pDriverObject,PUNICODE_STRING reg_path)
{
CKEAPP KeApp;
KeApp.Init(pDriverObject,reg_path);
return STATUS_SUCCESS;
}
class CKEAPP
{
public:
void * operator new(unsigned int size);
void operator delete(void *p);
void Init(PDRIVER_OBJECT pDriverObject,PUNICODE_STRING reg_path);
};
void CKEAPP::Init(PDRIVER_OBJECT pDriverObject,PUNICODE_STRING reg_path)
{
pDriverObject->DriverUnload = KeAppDriverUnload;
}
error LNK2010: unresolved external symbol " publc": void __thiscall CKEAPP::Init(struce _Driver_object *,struct _unicode_string *) ([email protected]@............)referenced in function [email protected]
------解决方案--------------------
DriverEntry是声明成extern "C"的函数。所以,会按照C的函数调用方式进行。
试着在Init函数声明前加关键字static,改变Init函数的访问方式。
- C/C++ code
class CKEAPP{public:void * operator new(unsigned int size);void operator delete(void *p);static void Init(PDRIVER_OBJECT pDriverObject,PUNICODE_STRING reg_path);};