CreateFile on FDO fails under Vista x64

Hi all,

I have a function driver for a PCI card. In AddDevice I create my FDO by
passing the following parameters to IoCreateDevice:
DeviceName = NULL (unnamed device object)
DeviceCharacteristics = FILE_DEVICE_SECURE_OPEN
Exclusive = FALSE

In AddDevice I also register a device interface with
IoRegisterDeviceInterface. In PNP_START I enable this interface with

In user mode I use SetupDiXxx calls (e.g.
SetupDiGetDeviceInterfaceDetail) to get the symbolic link path to open.
Then I pass the path to CreateFile. I specify the following flags in the
CreateFile call:
lpSecurityAttributes = NULL
dwCreationDisposition = OPEN_EXISTING
dwFlagsAndAttributes = 0
hTemplateFile = NULL

All standard WDM stuff so far. On WinXP and Vista x86 the CreateFile
call succeeds. When I run the app from an admin account on Windows Vista
x64 the CreateFile call fails with error 31 (ERROR_GEN_FAILURE, or “A
device attached to the system is not functioning”). When I launch the
app with right-click and “Run as Admin” then CreateFile succeeds.

What I don’t understand is:
Why does Vista x64 behave different than Vista x86? I understand that
privileges of the admin account are limited on Vista, but there should
be the same behavior on x86 and x64. Do I miss some point?

There is a generic error code returned, but obviously there is a problem
with access permissions. Shouldn’t this return ERROR_ACCESS_DENIED?

Can anyone shade some light on this?