There is a workaround that does not involve SEH. Yes, it is a bit
painful and iterative, but like peter Wieland said, you can use the
current OS version with some built in knowledge to know whether to make
the call or not until we can provide a real solution that does not
require every driver to hack around the bug. Essentially, you can do
this
If (TheCurrentVersionExportsThisDDI()) { MmGetSystemRoutineAddress() }
Instead of a blind call to MmGetSystemRoutineAddress on all platforms.
Kinda ugly? Yeah, but not that bad compared to other workarounds, esp
b/c the knowledge here is static and you will encounter the issue well
before you ship.
no need to be snide and create a straw man about a bug in the API vs SEH
and contracts. My point about contracts is that while it appears to
work, you can very well leave the OS in an unknown state (locks still
held or worse, a random address that was touched and we now have
corrupted some other structure or UM process, etc). You use SEH where
it is documented to be used, not to trap bugs (in your code, some other
driver, or the OS).
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Dan Kyler
Sent: Thursday, May 31, 2007 9:00 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] MmGetSystemRoutineAddress BugCheck?
Bad advice my ass.
Every indication I’ve seen indicates that this would be caught by
try/except
(and I expect that several people on this list have already verified
this).
And if not, it wouldn’t make it any worse.
I have a huge amount of respect for Doron, his knowledge and abilities,
and
his selfless and abundant help on this list. But I think his last post
was
irresponsible.
However, it is in keeping with Microsoft’s “response” to this problem.
Microsoft has for years been actively pushing the use of
MmGetSystemRoutineAddress in response to the community’s complaint’s
that
API x is not available on Windows version y. Now we discover that it
crashes the system and blames your driver for 20% of the valid range of
inputs.
What is the response to that? Is it a Windows Update hotfix to EVERY
affected system regardless of whether or not it is still officially
supported? No, it’s don’t worry, it’s been fixed in some random
assortment
of operating systems that we can’t really define. And don’t try to
protect
yourself against it, because that’s “not recommended”, and “not in the
formal contract”.
If I’m not mistaken, the “formal contract” indicates that
MmGetSystemRoutineAddress will not BSOD if given valid inputs. You can
throw the “formal contract” out the window at this point.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@microsoft.com
Sent: Thursday, May 31, 2007 8:49 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] MmGetSystemRoutineAddress BugCheck?
My apology for the bad advice on using SEH. I composed and discarded
posts
on the issue this morning, and began with a “maybe you can do this but
it
hasn’t been verified” and moved to “it appears you can”, as the day wore
on-
partly based upon the fact that I’ve done my own code for locating
kernel
exports and didn’t remember any unwindable state in that solution, and
partly on an over-optimistic reading of what information I could glean
on
the subject myself (not having ready access to or time to sift through
all
that legacy source).
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
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