Как я могу вызвать метод в качестве обратного вызова?C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Как я могу вызвать метод в качестве обратного вызова?

Сообщение Anonymous »


I'm trying to rewrite my driver to the OOP architecture and I'm faced with the problem of calling a method like callback when I don't have any std::XXXX, as well as when arguments to the function itself are passed by a template.

So I have the following class:

class Log { public: /*static*/ VOID LogNotifyUsermodeCallback(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2); NTSTATUS LogRegisterIrpBasedNotification(PDEVICE_OBJECT DeviceObject, PIRP Irp); NTSTATUS LogRegisterEventBasedNotification(PDEVICE_OBJECT DeviceObject, PIRP Irp); }; Also I have the following code:

NTSTATUS Log::LogRegisterIrpBasedNotification(PDEVICE_OBJECT DeviceObject, PIRP Irp) { //Some line of code.... KeInitializeDpc(&NotifyRecord->Dpc, // Dpc LogNotifyUsermodeCallback, // DeferredRoutine NotifyRecord // DeferredContext ); //Some line of code.... } DeferredRoutine has the following pattern of calling arguments:

VOID Log::LogNotifyUsermodeCallback(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2) I can't call the LogNotifyUsermodeCallback method as static, because arguments are passed there by template, and other methods of the Log class are also called in this method itself, and I don't have other ideas. So, the main question is: how, under all these conditions, can I call LogNotifyUsermodeCallback as a callback method?


Источник: https://stackoverflow.com/questions/769 ... a-callback
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»