User APCs and WOW64

A driver I am developing makes use of user APCs (yes, I know,
undocumented and therefore bad, still, in this case, I’m fairly certain
it is the best solution - at least for the time being) to callback into
userland applications.

This code works fine on both 64 bit and 32 bit versions of Windows.
WOW64 however is a problem. In this case, the APC generates a callback
as expected, however the callback is called with a 64 bit stack. I’m
aware that Windows’ own use of user apcs users helper functions with the
wow64 dll to manage the thunking and stack manipulation problems, but I
do not see a clear way I can use these to my advantage.

The alternative seems to be writing my own routines to manage to move
from 64 to 32 bit (something I would rather avoid if I had the chance)

Has anyone come across this problem and got a better solution?

Many Thanks

Ben Chalmers

Since you have dove into unchartered waters, I see you have hit a
precipice :|. There is no documented solution for this. I would
strongly suggest that you use the inverted call model by pending irps
and let the OS do the work for you. Even if you can home grow your own
wow64 solution for x64, uf you ever want to run on ia64, you will have
to figure it out on that platform as well.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ben Chalmers
Sent: Tuesday, May 02, 2006 1:00 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] User APCs and WOW64

A driver I am developing makes use of user APCs (yes, I know,
undocumented and therefore bad, still, in this case, I’m fairly certain
it is the best solution - at least for the time being) to callback into
userland applications.

This code works fine on both 64 bit and 32 bit versions of Windows.
WOW64 however is a problem. In this case, the APC generates a callback
as expected, however the callback is called with a 64 bit stack. I’m
aware that Windows’ own use of user apcs users helper functions with the

wow64 dll to manage the thunking and stack manipulation problems, but I
do not see a clear way I can use these to my advantage.

The alternative seems to be writing my own routines to manage to move
from 64 to 32 bit (something I would rather avoid if I had the chance)

Has anyone come across this problem and got a better solution?

Many Thanks

Ben Chalmers


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer