Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Ketika sistem operasi memanggil fungsi panggilan balik terdaftar, sistem operasi meneruskan penunjuk ke struktur DEVICE_INTERFACE_CHANGE_NOTIFICATION dalam parameter NotificationStructure .
Contoh kode berikut menunjukkan implementasi fungsi panggilan balik yang memproses pemberitahuan driver asinkron untuk prosesor:
// Asynchronous processor notification callback function
NTSTATUS
AsyncProcessorCallback(
IN PVOID NotificationStructure,
IN PVOID Context
)
{
PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification;
ULONG ProcessorCount;
KAFFINITY ActiveProcessors;
Notification =
(PDEVICE_INTERFACE_CHANGE_NOTIFICATION)
NotificationStructure;
// Verify that this notification is about a processor
// that is being added to the hardware partition.
if (IsEqualGUID(
&Notification->Event,
&GUID_DEVICE_INTERFACE_ARRIVAL
))
{
// Get the current processor count and affinity
ProcessorCount =
KeQueryActiveProcessorCount(
&ActiveProcessors
);
// Adjust any resource allocations that are based
// on the number of processors.
...
// Adjust the assignment of resources that are
// assigned to specific processors.
...
// Begin scheduling any per processor threads
// on the new processor.
...
// Adjust the scheduling of DPCs and other threads
...
// Adjust any load balancing algorithms
...
}
// Always return success status
return STATUS_SUCCESS;
}
Contoh kode berikut menunjukkan implementasi fungsi panggilan balik yang memproses pemberitahuan driver asinkron untuk memori:
// Asynchronous memory notification callback function
NTSTATUS
AsyncMemoryCallback(
IN PVOID NotificationStructure,
IN PVOID Context
)
{
PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification;
Notification =
(PDEVICE_INTERFACE_CHANGE_NOTIFICATION)
NotificationStructure;
// Verify that this notification is about memory
// that is being added to the hardware partition.
if (IsEqualGUID(
&Notification->Event,
&GUID_DEVICE_INTERFACE_ARRIVAL
))
{
// Increase the size of any memory buffers
// for optimal performance of the driver.
...
}
// Always return success status
return STATUS_SUCCESS;
}