I've spent all night researching this without a solution.
I'm trying to verify the digital signature of a file in the drives folder (C:\Windows\System32\drivers*.sys) pick whatever one you want. I know that the code is correct because if you move the file from that folder to C:\ the test works.
WinVerifyTrust
gives error 80092003
http://pastebin.com/nLR7rvZe
CryptQueryObject
gives error 80092009
http://pastebin.com/45Ra6eL4
What's the deal?