The following functions are callback functions which are implemented in your
Kernel PlugIn driver, and which will be called when their calling event occurs.
For example: KP_Init
KP_InitKP_Open
KP_Open
For example:
kpOpenCall->funcClose = KP_Close;
kpOpenCall->funcCall = KP_Call;
kpOpenCall->funcIntEnable = KP_IntEnable;
kpOpenCall->funcIntDisable = KP_IntDisable;
kpOpenCall->funcIntAtIrql = KP_IntAtIrql;
kpOpenCall->funcIntAtDpc = KP_IntAtDpc;
kpOpenCall->funcIntAtIrqlMSI = KP_IntAtIrqlMSI;
kpOpenCall->funcIntAtDpcMSI = KP_IntAtDpcMSI;
kpOpenCall->funcEvent = KP_Event;
![]() | |
As explained in KP_<functionality> — e.g., KP_Open.
However, you are free to select any name that you wish for your Kernel PlugIn
callback functions, apart from KP_Init. The generated DriverWizard
Kernel PlugIn code, for example, uses the selected driver name in the callback
function names (e.g., for a <MyKP> driver it creates callbacks named
KP_MyKP_Open, KP_MyKP_Call, etc.).
|
Kernel PlugIn initialization function.
This function is called when the Kernel PlugIn driver is loaded.
The function sets the name of the Kernel PlugIn driver and the
KP_Open callback function(s)
BOOL __cdecl KP_Init(KP_INIT *kpInit);
| Name | Type | Input/Output |
|---|---|---|
| kpInit | KP_INIT* | Output |
| Name | Description |
|---|---|
| kpInit |
Pointer to a pre-allocated Kernel PlugIn initialization information
structure |
TRUE if successful. Otherwise FALSE.
You must define the KP_Init function in your code in order to link
the Kernel PlugIn driver to WinDriver. KP_Init is called when the
driver is loaded. Any code that you want to execute upon loading should be in
this function.
BOOL __cdecl KP_Init(KP_INIT *kpInit)
{
/* Check if the version of the WinDriver Kernel
PlugIn library is the same version
as windrvr.h and wd_kp.h */
if (kpInit->dwVerWD != WD_VER)
{
/* You need to recompile your Kernel PlugIn
with the compatible version of the WinDriver
Kernel PlugIn library, windrvr.h and wd_kp.h */
return FALSE;
}
kpInit->funcOpen = KP_Open;
kpInit->funcOpen_32_64 = KP_PCI_VIRT_Open_32_64;
strcpy (kpInit->cDriverName, "KPDriver"); /* Up to 12 chars */
return TRUE;
}
Kernel PlugIn open function.
This function sets the rest of the Kernel PlugIn callback functions
(KP_CallKP_IntEnable
The returned driver context (*ppDrvContext) will be passed to rest
of the Kernel PlugIn callback functions.
The KP_Open callback is called when the
WD_KernelPlugInOpen() function (see the WinDriver PCI Low-Level API Reference) is
called from the user mode — either directly (when using the low-level
WinDriver API
WD_KernelPlugInOpen() is called from the
WDC_KernelPlugInOpen()WDC_xxxDeviceOpen() functions (PCIpcKPDriverName parameter).
![]() | |
The WDC_xxxDeviceOpen() functions cannot be used to open a handle
to a 64-bit Kernel PlugIn function from a 32-bit application. For this
purpose, use WDC_KernelPlugInOpen() (or the low-level
WD_KernelPlugInOpen() function).
|
The Kernel PlugIn driver can implement two types of KP_Open
callback functions —
funcOpen field of the
KP_INIT structureKP_InitfuncOpen_32_64 field of
the KP_INIT structureKP_Init
A Kernel PlugIn driver can provide either one or both of these
KP_Open callbacks, depending on the target configuration(s).
![]() | |
The KP_PCI sample (WinDriver/samples/pci_diag/kp_pci/kp_pci.c) implements both
types of KP_Open callbacks — KP_PCI_Open()
(standard) and KP_PCI_Open_32_64() (for opening a handle to a
64-bit Kernel PlugIn from a 32-bit application).The generated DriverWizard Kernel PlugIn code always implements a standard Kernel PlugIn open function — KP_XXX_Open().
When selecting the 32-bit application for a 64-bit Kernel PlugIn DriverWizard code-generation
option (see KP_XXX_Open_32_64() function, for opening a handle to a 64-bit
Kernel PlugIn driver from a 32-bit application.
|
BOOL __cdecl KP_Open(
KP_OPEN_CALL *kpOpenCall,
HANDLE hWD,
PVOID pOpenData,
PVOID *ppDrvContext);
| Name | Type | Input/Output |
|---|---|---|
| kpOpenCall | KP_OPEN_CALL | Input |
| hWD | HANDLE | Input |
| pOpenData | PVOID | Input |
| ppDrvContext | PVOID* | Output |
| Name | Description |
|---|---|
| kpOpenCall |
Structure to fill in the addresses of the
KP_xxx callback functions |
| hWD |
The WinDriver handle that WD_KernelPlugInOpen() was called with
|
| pOpenData | Pointer to data passed from user mode |
| ppDrvContext |
Pointer to driver context data with which the KP_CloseKP_CallKP_IntEnableKP_Event |
TRUE if successful. If FALSE, the call to
WD_KernelPlugInOpen() from the user mode will fail.
BOOL __cdecl KP_Open(KP_OPEN_CALL *kpOpenCall, HANDLE hWD,
PVOID pOpenData, PVOID *ppDrvContext)
{
kpOpenCall->funcClose = KP_Close;
kpOpenCall->funcCall = KP_Call;
kpOpenCall->funcIntEnable = KP_IntEnable;
kpOpenCall->funcIntDisable = KP_IntDisable;
kpOpenCall->funcIntAtIrql = KP_IntAtIrql;
kpOpenCall->funcIntAtDpc = KP_IntAtDpc;
kpOpenCall->funcIntAtIrqlMSI = KP_IntAtIrqlMSI;
kpOpenCall->funcIntAtDpcMSI = KP_IntAtDpcMSI;
kpOpenCall->funcEvent = KP_Event;
/* You can allocate driver context memory here: */
*ppDrvContext = malloc(sizeof(MYDRV_STRUCT));
return *ppDrvContext!=NULL;
}
Called when WD_KernelPlugInClose() (see the WinDriver PCI Low-Level API Reference) is
called from user mode.
The high-level WDC_xxxDeviceClose() functions (PCIWD_KernelPlugInClose() for devices that contain an open
Kernel PlugIn handle (see
This functions can be used to perform any required clean-up for the Kernel PlugIn (such as freeing memory previously allocated for the driver context, etc.).
void __cdecl KP_Close(PVOID pDrvContext);
KP_FUNC_CLOSE Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pDrvContext | PVOID | Input |
| Name | Description |
|---|---|
| pDrvContext | Driver context data that was set by KP_Open |
None
void __cdecl KP_Close(PVOID pDrvContext)
{
if (pDrvContext)
free(pDrvContext); /* Free allocated driver context memory */
}
Called when the user-mode application calls WDC_CallKerPlug()WD_KernelPlugInCall() function — see the
WinDriver PCI Low-Level API Reference).
This function is a message handler for your utility functions.
void __cdecl KP_Call(
PVOID pDrvContext,
WD_KERNEL_PLUGIN_CALL
*kpCall,
BOOL fIsKernelMode);
KP_FUNC_CALL Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pDrvContext | PVOID | Input/Output |
| kpCall | WD_KERNEL_PLUGIN_CALL | |
| • dwMessage | DWORD | Input |
| • pData | PVOID | Input/Output |
| • dwResult | DWORD | Output |
| fIsKernelMode | BOOL | Input |
| Name | Description |
|---|---|
| pDrvContext |
Driver context data that was set by KP_OpenKP_CloseKP_IntEnableKP_Event |
| kpCall |
Structure with user-mode information received from the
WDC_CallKerPlug()WD_KernelPlugInCall() function — see the
WinDriver PCI Low-Level API Reference) and/or with information to return back to the user
mode |
| fIsKernelMode |
This parameter is passed by the WinDriver kernel — see the
|
None
WDC_CallKerPlug()WD_KernelPlugInCall() function — see the
WinDriver PCI Low-Level API Reference) in the user mode will call your KP_CallKP_Call function
in the Kernel PlugIn will determine which routine to execute according to
the message passed to it.
fIsKernelMode parameter is passed by the WinDriver kernel to
the KP_Call routine. The user is not required to do anything
about this parameter. However, notice how this parameter is passed in the
sample code to the macro COPY_TO_USER_OR_KERNEL — This
is required for the macro to function correctly. Please refer to
COPY_TO_USER_OR_KERNEL and
COPY_FROM_USER_OR_KERNEL macros.
void __cdecl KP_Call(PVOID pDrvContext,
WD_KERNEL_PLUGIN_CALL *kpCall, BOOL fIsKernelMode)
{
kpCall->dwResult = MY_DRV_OK;
switch (kpCall->dwMessage)
{
/* In this sample we implement a GetVersion message */
case MY_DRV_MSG_VERSION:
{
DWORD dwVer = 100;
MY_DRV_VERSION *ver = (MY_DRV_VERSION *)kpCall->pData;
COPY_TO_USER_OR_KERNEL(&ver->dwVer, &dwVer,
sizeof(DWORD), fIsKernelMode);
COPY_TO_USER_OR_KERNEL(ver->cVer, "My Driver V1.00",
sizeof("My Driver V1.00")+1, fIsKernelMode);
kpCall->dwResult = MY_DRV_OK;
}
break;
/* You can implement other messages here */
default:
kpCall->dwResult = MY_DRV_NO_IMPL_MESSAGE;
}
}
Called when a Plug-and-Play or power management event for the device is received,
provided the user-mode application first called WDC_EventRegister()fUseKP = TRUE (or the low-level
EventRegister() function with a Kernel PlugIn handle — see
WinDriver PCI Low-Level API Reference) (see the Remarks below).
BOOL __cdecl KP_Event(
PVOID pDrvContext,
WD_EVENT *wd_event);
KP_FUNC_EVENT Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pDrvContext | PVOID | Input/Output |
| wd_event | WD_EVENT* | Input |
TRUE in order to notify the user about the event.
KP_Event will be called if the user mode process called
WDC_EventRegister()fUseKP= TRUE (or of the
low-level EventRegister() function was called with a
Kernel PlugIn handle — see the WinDriver PCI Low-Level API Reference).
BOOL __cdecl KP_Event(PVOID pDrvContext, WD_EVENT *wd_event)
{
/* Handle the event here */
return TRUE; /* Return TRUE to notify the user about the event */
}
Called when WD_IntEnable() (see WinDriver PCI Low-Level API Reference) is called from
the user mode with a Kernel PlugIn handle.
WD_IntEnable() is called automatically from
WDC_IntEnable()InterruptEnable() (see
WinDriver PCI Low-Level API Reference).
The interrupt context that is set by this function (*ppIntContext)
will be passed to the rest of the Kernel PlugIn interrupt functions.
BOOL __cdecl KP_IntEnable (
PVOID pDrvContext,
WD_KERNEL_PLUGIN_CALL *kpCall,
PVOID *ppIntContext);
KP_FUNC_INT_ENABLE Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pDrvContext | PVOID | Input/Output |
| kpCall | WD_KERNEL_PLUGIN_CALL | Input |
| • dwMessage | DWORD | Input |
| • pData | PVOID | Input/Output |
| • dwResult | DWORD | Output |
| ppIntContext | PVOID* | Input/Output |
| Name | Description |
|---|---|
| pDrvContext |
Driver context data that was set by KP_OpenKP_CloseKP_CallKP_Event |
| kpCall |
Structure with information from WD_IntEnable() |
| ppIntContext |
Pointer to interrupt context data that will be passed to
KP_IntDisable |
Returns TRUE if enable is successful; otherwise returns
FALSE.
This function should contain any initialization needed for your Kernel PlugIn interrupt handling.
BOOL __cdecl KP_IntEnable(PVOID pDrvContext,
WD_KERNEL_PLUGIN_CALL *kpCall, PVOID *ppIntContext)
{
DWORD *pIntCount;
/* You can allocate specific memory for each interrupt
in *ppIntContext */
*ppIntContext = malloc(sizeof (DWORD));
if (!*ppIntContext)
return FALSE;
/* In this sample the information is a DWORD used to
count the incoming interrupts */
pIntCount = (DWORD *) *ppIntContext;
*pIntCount = 0; /* Reset the count to zero */
return TRUE;
}
Called when WD_IntDisable() (see WinDriver PCI Low-Level API Reference) is called from
the user mode for interrupts that were enabled in the Kernel PlugIn.
WD_IntDisable() is called automatically from
WDC_IntDisable()InterruptDisable() (see
WinDriver PCI Low-Level API Reference).
This function should free any memory that was allocated in
KP_IntEnable
void __cdecl KP_IntDisable(PVOID pIntContext);
KP_FUNC_INT_DISABLE Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pIntContext | PVOID | Input |
| Name | Description |
|---|---|
| pIntContext |
Interrupt context data that was set by KP_IntEnable |
None
void __cdecl KP_IntDisable(PVOID pIntContext)
{
/* You can free the interrupt specific memory
allocated to pIntContext here */
free(pIntContext);
}
High-priority legacy interrupt handler routine, which is run at high interrupt
request level. This function is called upon the arrival of a legacy interrupt
that has been enabled using a Kernel PlugIn driver — see the description
of WDC_IntEnable()InterruptEnable() and WD_IntEnable() functions (see
WinDriver PCI Low-Level API Reference).
BOOL __cdecl KP_IntAtIrql(
PVOID pIntContext,
BOOL *pfIsMyInterrupt);
KP_FUNC_INT_AT_IRQL Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pIntContext | PVOID | Input/Output |
| pfIsMyInterrupt | BOOL* | Output |
| Name | Description |
|---|---|
| pIntContext |
Pointer to interrupt context data that was set by
KP_IntEnableKP_IntAtDpcKP_IntDisable |
| pfIsMyInterrupt |
Set *pfIsMyInterrupt to TRUE if the interrupt
belongs to this driver; otherwise set it to FALSE in order to
enable the interrupt service routines of other drivers for the same
interrupt to be called
|
TRUE if deferred interrupt processing (DPC) is required; otherwise
FALSE.
WDC_xxx() read/write address or configuration space
functions.
WDC_MultiTransfer()WD_Transfer(), WD_MultiTransfer(), or
WD_DebugAdd() functions (see the WinDriver PCI Low-Level API Reference).
malloc(), free(), or any
WDC_xxx or WD_xxx API other than those listed
above.
KP_IntAtDpcBOOL __cdecl KP_IntAtIrql(PVOID pIntContext,
BOOL *pfIsMyInterrupt)
{
DWORD *pdwIntCount = (DWORD*)pIntContext;
/* Check your hardware here to see if the interrupt belongs to you.
If it does, you must set *pfIsMyInterrupt to TRUE.
Otherwise, set *pfIsMyInterrupt to FALSE. */
*pfIsMyInterrupt = FALSE;
/* In this example we will schedule a DPC once in every 5 interrupts */
(*pdwIntCount) ++;
if (*pdwIntCount==5)
{
*pdwIntCount = 0;
return TRUE;
}
return FALSE;
}
Deferred processing legacy interrupt handler routine.
This function is called once the high-priority legacy interrupt handling is
completed, provided that KP_IntAtIrqlTRUE.
DWORD __cdecl KP_IntAtDpc(
PVOID pIntContext,
DWORD dwCount);
KP_FUNC_INT_AT_DPC Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pIntContext | PVOID | Input/Output |
| dwCount | DWORD | Input |
| Name | Description |
|---|---|
| pIntContext |
Interrupt context data that was set by KP_IntEnableKP_IntAtIrqlKP_IntDisable |
| dwCount |
The number of times KP_IntAtIrqlTRUE
since the last DPC call. If dwCount is 1,
KP_IntAtIrql requested a DPC only once since the last DPC
call. If the value is greater than 1, KP_IntAtIrql has
already requested a DPC a few times, but the interval was too short,
therefore KP_IntAtDpc was not called for each DPC request.
|
Returns the number of times to notify user mode (i.e., return from
WD_IntWait() — see the WinDriver PCI Low-Level API Reference).
KP_IntAtIrqlKP_IntAtDpc returns with a value greater than zero,
WD_IntWait() returns and the user-mode interrupt handler will
be called in the amount of times set in the return value of
KP_IntAtDpc. If you do not want the user-mode interrupt
handler to execute, KP_IntAtDpc should return zero.
DWORD __cdecl KP_IntAtDpc(PVOID pIntContext, DWORD dwCount)
{
/* Return WD_IntWait as many times as KP_IntAtIrql
scheduled KP_IntAtDpc */
return dwCount;
}
High-priority Message-Signaled Interrupts (MSI) / Extended Message-Signaled Interrupts (MSI-X) handler routine, which
is run at high interrupt request level. This function is called upon the
arrival of an MSI/MSI-X that has been enabled using a Kernel PlugIn —
see the description of WDC_IntEnable()InterruptEnable() and WD_IntEnable() functions (see
WinDriver PCI Low-Level API Reference).
BOOL __cdecl KP_PCI_IntAtIrqlMSI(
PVOID pIntContext,
ULONG dwLastMessage,
DWORD dwReserved);
KP_FUNC_INT_AT_IRQL_MSI Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pIntContext | PVOID | Input/Output |
| dwLastMessage | DWORD | Input |
| dwReserved | DWORD | Input |
| Name | Description |
|---|---|
| pIntContext |
Pointer to interrupt context data that was set by
KP_IntEnableKP_IntAtDpcMSIKP_IntDisable |
| dwLastMessage | The message data for the last received interrupt (applicable only on Windows Vista and higher) |
| dwReserved | Reserved for future use. Do not use this parameter. |
TRUE if deferred MSI/MSI-X processing (DPC) is required;
otherwise FALSE.
WDC_xxx() read/write address or configuration space
functions.
WDC_MultiTransfer()WD_Transfer(), WD_MultiTransfer(), or
WD_DebugAdd() functions (see the WinDriver PCI Low-Level API Reference).
malloc(), free(), or any
WDC_xxx or WD_xxx API other than those listed
above.
KP_IntAtDpcMSIBOOL __cdecl KP_PCI_IntAtIrqlMSI(PVOID pIntContext,
ULONG dwLastMessage, DWORD dwReserved)
{
return TRUE;
}
Deferred processing Message-Signaled Interrupts (MSI) / Extended Message-Signaled Interrupts (MSI-X) handler
routine.
This function is called once the high-priority MSI/MSI-X handling is
completed, provided that KP_IntAtIrqlMSITRUE.
DWORD __cdecl KP_IntAtDpcMSI( PVOID pIntContext, DWORD dwCount, ULONG dwLastMessage, DWORD dwReserved);
KP_FUNC_INT_AT_DPC_MSI Kernel PlugIn callback
function type.
| Name | Type | Input/Output |
|---|---|---|
| pIntContext | PVOID | Input/Output |
| dwCount | DWORD | Input |
| dwLastMessage | DWORD | Input |
| dwReserved | DWORD | Input |
| Name | Description |
|---|---|
| pIntContext |
Interrupt context data that was set by KP_IntEnableKP_IntAtIrqlMSIKP_IntDisable |
| dwCount |
The number of times KP_IntAtIrqlMSITRUE since the last DPC call. If dwCount is 1,
KP_IntAtIrqlMSI requested a DPC only once since the last DPC
call. If the value is greater than 1, KP_IntAtIrqlMSI has
already requested a DPC a few times, but the interval was too short,
therefore KP_IntAtDpcMSI was not called for each DPC request.
|
| dwLastMessage | The message data for the last received interrupt (applicable only on Windows Vista and higher) |
| dwReserved | Reserved for future use. Do not use this parameter. |
Returns the number of times to notify user mode (i.e., return from
WD_IntWait() — see the WinDriver PCI Low-Level API Reference).
KP_IntAtIrqlMSIKP_IntAtDpcMSI returns with a value greater than zero,
WD_IntWait() returns and the user-mode interrupt handler will
be called in the amount of times set in the return value of
KP_IntAtDpcMSI. If you do not want the user-mode interrupt
handler to execute, KP_IntAtDpcMSI should return zero.
DWORD __cdecl KP_IntAtDpcMSI(PVOID pIntContext, DWORD dwCount,
ULONG dwLastMessage, DWORD dwReserved)
{
/* Return WD_IntWait as many times as KP_IntAtIrqlMSI
scheduled KP_IntAtDpcMSI */
return dwCount;
}
Macros for copying data from the user mode to the Kernel PlugIn and vice versa.
COPY_TO_USER_OR_KERNEL and
COPY_FROM_USER_OR_KERNEL are macros used for copying data
(when necessary) to/from user-mode memory addresses (respectively), when
accessing such addresses from within the Kernel PlugIn. Copying the data
ensures that the user-mode address can be used correctly, even if the
context of the user-mode process changes in the midst of the I/O
operation. This is particularly relevant for long operations, during
which the context of the user-mode process may change. The use of macros
to perform the copy provides a generic solution for all supported
operating systems.
COPY_TO_USER_OR_KERNEL and
COPY_FROM_USER_OR_KERNEL macros are defined in the
WinDriver\include\kpstdlib.h header file.
COPY_TO_USER_OR_KERNEL macro, see
the KP_CallKP_PCI_Call()) in the
sample WinDriver/samples/pci_diag/kp_pci/kp_pci.c Kernel PlugIn file.
KP_IntAtIrqlKP_IntAtDpc
This section describes the Kernel Plug-In synchronization APIs.
These APIs support the following synchronization mechanisms:
![]() | |
The Kernel PlugIn spinlock functions can be called from any context
apart from high interrupt request level. Hence, they can be called from
any Kernel PlugIn function except for KP_IntAtIrqlKP_IntAtIrqlMSINote that the spinlock functions can be called from the deferred processing interrupt handler functions — KP_IntAtDpcKP_IntAtDpcMSI |
![]() | |
| The Kernel PlugIn interlocked functions can be called from any context in the Kernel PlugIn, including from high interrupt request level. Hence, they can be called from any Kernel PlugIn function, including the Kernel PlugIn interrupt handler functions. |
The Kernel PlugIn synchronization APIs use the following types:
Initializes a new Kernel PlugIn spinlock object.
KP_SPINLOCK * kp_spinlock_init(void);
If successful, returns a pointer to the new Kernel PlugIn
spinlock objectNULL.
Waits on a Kernel PlugIn spinlock object.
void kp_spinlock_wait(KP_SPINLOCK *spinlock);
| Name | Type | Input/Output |
|---|---|---|
| spinlock | KP_SPINLOCK* | Input |
| Name | Description |
|---|---|
| spinlock |
Pointer to the Kernel PlugIn
spinlock object |
None
Releases a Kernel PlugIn spinlock object.
void kp_spinlock_release(KP_SPINLOCK *spinlock);
| Name | Type | Input/Output |
|---|---|---|
| spinlock | KP_SPINLOCK* | Input |
| Name | Description |
|---|---|
| spinlock |
Pointer to the Kernel PlugIn
spinlock object |
None
Uninitializes a Kernel PlugIn spinlock object.
void kp_spinlock_uninit(KP_SPINLOCK *spinlock);
| Name | Type | Input/Output |
|---|---|---|
| spinlock | KP_SPINLOCK* | Input |
| Name | Description |
|---|---|
| spinlock |
Pointer to the Kernel PlugIn
spinlock object |
None
Initializes a Kernel PlugIn interlocked counter.
void kp_interlocked_init(KP_INTERLOCKED *target);
| Name | Type | Input/Output |
|---|---|---|
| target | KP_INTERLOCKED* | Input/Output |
| Name | Description |
|---|---|
| target |
Pointer to the Kernel PlugIn
interlocked counter |
None
Uninitializes a Kernel PlugIn interlocked counter.
void kp_interlocked_uninit(KP_INTERLOCKED *target);
| Name | Type | Input/Output |
|---|---|---|
| target | KP_INTERLOCKED* | Input/Output |
| Name | Description |
|---|---|
| target |
Pointer to the Kernel PlugIn
interlocked counter |
None
Increments the value of a Kernel PlugIn interlocked counter by one.
int kp_interlocked_increment(KP_INTERLOCKED *target);
| Name | Type | Input/Output |
|---|---|---|
| target | KP_INTERLOCKED* | Input/Output |
| Name | Description |
|---|---|
| target |
Pointer to the Kernel PlugIn
interlocked counter |
Returns the new value of the interlocked counter (target).
Decrements the value of a Kernel PlugIn interlocked counter by one.
int kp_interlocked_decrement(KP_INTERLOCKED *target);
| Name | Type | Input/Output |
|---|---|---|
| target | KP_INTERLOCKED* | Input/Output |
| Name | Description |
|---|---|
| target |
Pointer to the Kernel PlugIn
interlocked counter |
Returns the new value of the interlocked counter (target).
Adds a specified value to the current value of a Kernel PlugIn interlocked counter.
int kp_interlocked_add(
KP_INTERLOCKED *target,
int val);
| Name | Type | Input/Output |
|---|---|---|
| target | KP_INTERLOCKED* | Input/Output |
| val | val | Input |
| Name | Description |
|---|---|
| target |
Pointer to the Kernel PlugIn
interlocked counter |
| val |
The value to add to the interlocked counter (target)
|
Returns the new value of the interlocked counter (target).
Reads to the value of a Kernel PlugIn interlocked counter.
int kp_interlocked_read(KP_INTERLOCKED *target);
| Name | Type | Input/Output |
|---|---|---|
| target | KP_INTERLOCKED* | Input |
| Name | Description |
|---|---|
| target |
Pointer to the Kernel PlugIn
interlocked counter |
Returns the value of the interlocked counter (target).
Sets the value of a Kernel PlugIn interlocked counter to the specified value.
void kp_interlocked_set(
KP_INTERLOCKED *target,
int val);
| Name | Type | Input/Output |
|---|---|---|
| target | KP_INTERLOCKED* | Input/Output |
| val | val | Input |
| Name | Description |
|---|---|
| target |
Pointer to the Kernel PlugIn
interlocked counter |
| val |
The value to set for the interlocked counter (target)
|
None
Sets the value of a Kernel PlugIn interlocked counter to the specified value and returns the previous value of the counter.
int kp_interlocked_exchange(
KP_INTERLOCKED *target,
int val);
| Name | Type | Input/Output |
|---|---|---|
| target | KP_INTERLOCKED* | Input/Output |
| val | val | Input |
| Name | Description |
|---|---|
| target |
Pointer to the Kernel PlugIn
interlocked counter |
| val |
The new value to set for the interlocked counter (target)
|
Returns the previous value of the interlocked counter (target).