RE: How to implement the callback to application functions in a driver
- From: Neverhoodboy <Neverhoodboy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 8 Jul 2005 19:16:01 -0700
Anybody know?
Thanks for your help in advance!!!
"Neverhoodboy" wrote:
> Suppose I have the following data structure:
>
> typedef struct {
> void* data_ptr;
> void* notify_param;
> void (*notify_func)(void* param);
> } ExampleStructure;
>
> Here is what the application looks like:
>
> void notification(void* param)
> {
> /* Does not have to be free(), user can specify the parameter and do
> whatever he wants */
> free(param);
> }
>
> void main()
> {
> void* data_ptr = malloc(1024);
> ExampleStructure example = {data_ptr, data_ptr, notification};
> DeviceIoControl(hDevice, &example);
> while (1) {}
> }
>
> In the driver, I use GetOwnerProcess() and MapPtrToProcess() to map the
> example.data_ptr, and then do something with the data pointed by that
> pointer. When done, I call the example.notification (the address is also
> mapped) to notify the application that I'm done and let application do
> whatever it needs, usually a free(). However, what I've experienced is that
> if I do something as simple as operating the local variables in the
> notification function, it works, however, if I put a call to free() or access
> any global variable of the application, it generates data abort exception.
> Does anyone know how to solve this? Thanks a bunch!!!
.
- Follow-Ups:
- Re: How to implement the callback to application functions in a driver
- From: Steve Maillet \(eMVP\)
- Re: How to implement the callback to application functions in a driver
- References:
- How to implement the callback to application functions in a driver
- From: Neverhoodboy
- How to implement the callback to application functions in a driver
- Prev by Date: Re: HW supported by Windows CE
- Next by Date: Re: How to implement the callback to application functions in a driver
- Previous by thread: How to implement the callback to application functions in a driver
- Next by thread: Re: How to implement the callback to application functions in a driver
- Index(es):
Loading