doubt on apc call

hi all
i want to know that when calling a user mode apc from the kernel, can i pass
the user mode api, a buffer (pointer to structure ) from the kernel.
if so then how.

thanks
Mayank

Mayank Kumar wrote:

i want to know that when calling a user mode apc from the kernel, can i pass
the user mode api, a buffer (pointer to structure ) from the kernel.
if so then how.

There is almost certainly a documented way for you to do whatever it
you’re trying to do that doesn’t involve an APC. Is your problem that
you’re porting a VxD that used VWIN32_QueueUserApc? If so, you’ll have
to redesign the app and the driver to work within the boundaries
Microsoft established for drivers, for example by using an IOCTL or a
shared event. If WHQL doesn’t already flag calls to the DDI that relate
to the APCs, they probably will start just in time to torpedo your
submission, and that will be a Good Thing.


Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Check out our schedule at http://www.oneysoft.com

i want to pass some data from the kernel to a specific user thread as a
result of asynchrnous completion of some task.
That is why i want to pass a buffer to the normal routine of the user apc.
What documented procedure will achieve this. kindly also tell me if this is
possibe using apc’s as i have already implemented it using apc’s and this
will same time for me
thanks
mayank

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Walter Oney
Sent: Wednesday, July 16, 2003 3:55 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: doubt on apc call

Mayank Kumar wrote:

i want to know that when calling a user mode apc from the kernel, can i
pass
the user mode api, a buffer (pointer to structure ) from the kernel.
if so then how.

There is almost certainly a documented way for you to do whatever it
you’re trying to do that doesn’t involve an APC. Is your problem that
you’re porting a VxD that used VWIN32_QueueUserApc? If so, you’ll have
to redesign the app and the driver to work within the boundaries
Microsoft established for drivers, for example by using an IOCTL or a
shared event. If WHQL doesn’t already flag calls to the DDI that relate
to the APCs, they probably will start just in time to torpedo your
submission, and that will be a Good Thing.


Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Check out our schedule at http://www.oneysoft.com


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

The user app can call WriteFileEx on some file handle, and the
kernel code will just IoCompleteRequest the IRP.
This is one of the best ways of firing user APCs from the kernel.

Max

----- Original Message -----
From: “Mayank Kumar”
To: “Windows System Software Developers Interest List”

Sent: Wednesday, July 16, 2003 1:03 PM
Subject: [ntdev] doubt on apc call

>
> hi all
> i want to know that when calling a user mode apc from the kernel,
can i pass
> the user mode api, a buffer (pointer to structure ) from the kernel.
> if so then how.
>
> thanks
> Mayank
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com

> i want to pass some data from the kernel to a specific user thread
as a

result of asynchrnous completion of some task.

Pend the IRP, then complete it. Completion will possibly result in
user APC invocation if ReadFileEx is used.

BTW - question to Microsoft - where is DeviceIoControlEx with an APC
routine? why not export such a routine from kernel32?

Max

i got it maxim, i will try this one too.
But will this allow other device io controls to be executed untill this one
is marked pending ie the pending irp is queued and other irps are executed
by the
io manager.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Maxim S. Shatskih
Sent: Wednesday, July 16, 2003 5:19 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: doubt on apc call

i want to pass some data from the kernel to a specific user thread
as a
result of asynchrnous completion of some task.

Pend the IRP, then complete it. Completion will possibly result in
user APC invocation if ReadFileEx is used.

BTW - question to Microsoft - where is DeviceIoControlEx with an APC
routine? why not export such a routine from kernel32?

Max


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

It depends on you you set up your driver and handle queuing and the like.
But in general yes, IOs can pass each other in a driver unless you prohibit
it.

You will need to open the driver with FILE_FLAG_OVERLAPPED and use a
separate OVERLAPPED structure for every IO that will be in process, so it is
a little more work at the user level, but not all that painful.

Loren

> But will this allow other device io controls to be executed untill
this one

is marked pending

Yes, but only if the file was opened with FILE_FLAG_OVERLAPPED.

Max

hi all
i have understood the overlapped io method and will have to test it.
It seems easier and the best part is that it is documented. But due to
the load of work that i have at this point of time, can somebody suggest
me a way of passing a buffer of data as an argument to the normal routine
of the user apc. I want to pass a strcuture of information from the kernel
to the user mode api.
any help would speed up my work in the meanwhile i can incorporate the
documented code later.
thanks again
mayank

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Maxim S. Shatskih
Sent: Wednesday, July 16, 2003 8:38 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: doubt on apc call

But will this allow other device io controls to be executed untill
this one
is marked pending

Yes, but only if the file was opened with FILE_FLAG_OVERLAPPED.

Max


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

Code running in user-mode cannot access kernel-mode memory, period.
There is an article on OSROnline describing how a driver can allocate
memory in a process address space, but I suggest you start over and do
the right thing.

Mayank Kumar wrote:

hi all
i have understood the overlapped io method and will have to test it.
It seems easier and the best part is that it is documented. But due to
the load of work that i have at this point of time, can somebody suggest
me a way of passing a buffer of data as an argument to the normal routine
of the user apc. I want to pass a strcuture of information from the kernel
to the user mode api.
any help would speed up my work in the meanwhile i can incorporate the
documented code later.
thanks again
mayank

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Maxim S. Shatskih
Sent: Wednesday, July 16, 2003 8:38 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: doubt on apc call

>But will this allow other device io controls to be executed untill

this one

>is marked pending

Yes, but only if the file was opened with FILE_FLAG_OVERLAPPED.

Max


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

  • Nick Ryan (MVP for DDK)

The user code cannot receive unsolicited APCs. The action of queuing an APC
must originate in user code, which thus is saying “I’m ready to receive an
APC”.
So, the IRP approach is fine. The user code sends ReadFileEx, thus saying
“I’m ready to receive an APC”. Then the kernel code does IoCompleteRequest on
this IRP, which delivers the APC to user code.

Max

----- Original Message -----
From: “Mayank Kumar”
To: “Windows System Software Developers Interest List”
Sent: Thursday, July 17, 2003 8:14 AM
Subject: [ntdev] Re: doubt on apc call

> hi all
> i have understood the overlapped io method and will have to test it.
> It seems easier and the best part is that it is documented. But due to
> the load of work that i have at this point of time, can somebody suggest
> me a way of passing a buffer of data as an argument to the normal routine
> of the user apc. I want to pass a strcuture of information from the kernel
> to the user mode api.
> any help would speed up my work in the meanwhile i can incorporate the
> documented code later.
> thanks again
> mayank
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Maxim S. Shatskih
> Sent: Wednesday, July 16, 2003 8:38 PM
> To: Windows System Software Developers Interest List
> Subject: [ntdev] Re: doubt on apc call
>
>
> > But will this allow other device io controls to be executed untill
> this one
> > is marked pending
>
> Yes, but only if the file was opened with FILE_FLAG_OVERLAPPED.
>
> Max
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@intersolutions.stpn.soft.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com