Hi,

I write a VxD and another win32 program to load that VxD by CreateFile. And use DeviceIoControl() to communicate with VxD.

My code is:
hVxD = CreateFile( VXD_NAME, 0, 0, NULL, 0, FILE_FLAG_DELETE_ON_CLOSE, NULL );

But I always get (hVxD == INVALID_HANDLE_VALUE), I don't understand why?

My program use MFC, Dialog program!

Thanks a lot!

Bung
Posted on 2001-11-23 00:55:44 by bung
Try specifying that you want GENERIC_READ access, and open in
FILE_SHARE_READ mode. You might want to add OPEN_EXISTING
to the FILE_FLAG_DELETE_ON_CLOSE.

Also, how do you define VXD_NAME? Remember that you must
specify it like "\\.\myvxd.vxd"... which, in C, means "\\\\.\\myvxd.vxd".

Good luck.
Posted on 2001-11-23 01:59:06 by f0dder
Thank you for your help!

But I think that error not in my program. Problem is in VxD.

I found a article in Internet and download zip file to see his example.

When I run original file it ran well. But when I rebuild with my command line below, it generates another vxd file. But with this file, the EXE don't open it. And error code return when GetLastError() is 2.

Please help me!

Here is record.zip, contains VXD source and EXE source. If you build again with options below:

ml -coff -c -Cx -DMASM6 -DBLD_COFF -DIS_32 record.asm

and

link -vxd record.obj

then overwrite original file. It will fail.
Posted on 2001-11-23 03:15:57 by bung
Normally you need a .DEF file to export the DDB of your vxd. I cant find any. This might be a problem.

japheth
Posted on 2001-11-23 04:44:35 by japheth
Dir,

When I download it from any where, I didn't remember, the ZIP file didn't have any file like .DEF

I will try again follow your advice! If any thing, will you help me again?

Thank you very much!
Posted on 2001-11-23 04:52:26 by bung
Dir Japheth,

Thank your for your help. If I create new .DEF file and build again, it ran well.

I don't know why is it? Because, when I build it without .DEF, no error appears.

Would you please to explain it to me!

Thank you very much!
Posted on 2001-11-23 18:33:27 by bung
the VMM needs to know the address of the DDB (to get the device ID and other things). So it must be exported (by ordinal @1 as far as I know).

japheth
Posted on 2001-11-26 04:24:59 by japheth