Creating VxD for Win9x using the MS VC++ 6.0 compiler

Dear Friends,
I have written a virtual serial port driver which gets registered with
VCOMM and internally uses the VCOMM Cleint Services to access the physical
serial ports to send / receive data.
Thou the code works fine it is very unstable. It crashes the system
once every 3-4 times it is run. Considering that the debugging support
with WDEB98/RTERM98 is not very extensive I am not able to clearly figure
out the problem. It sometimes gives a “page fault” and sometimes a
“Invalid Opcode” error message. The program hasbeen written fully in “C”.
As I was trying to find out the cause, I noticed that the ddk
documentation writes that we should not use MS VC++ 6.0 for compiling and
linking the programs because it has some decoration problems. I am using
VC++ 6.0 as that is the only version I have. Couldit cause such fatal
errors to occur or since there is “decoration incompatibilities” will it
only affect symbolic debugging information?
Regards,
Ganesh

Ganesh,

Could this be the cause of the problem … ???
The code (virtual serial port) vxd is built with 8 bytes alignment - the
default one.
but the unfortunate part is that VCOMM is build with 1 byte alignment. so
there
could chance of memory violation (page faults) when exchanging data with
structures… You never know, the padding of structures with different
byte
alignment can go and modify stack, or any thing VCOMM data etc.

I had this problem of byte aligment stuff, leading to un predictable
crashes.
Build the VxD with single byte alignment solved these problems for me…

Good luck
Cheers,

  • Jay

----- Original Message -----
From: “Ganesh Okade”
To: “NT Developers Interest List”
Sent: Wednesday, July 24, 2002 10:30 AM
Subject: [ntdev] Creating VxD for Win9x using the MS VC++ 6.0 compiler

> Dear Friends,
> I have written a virtual serial port driver which gets registered with
> VCOMM and internally uses the VCOMM Cleint Services to access the physical
> serial ports to send / receive data.
> Thou the code works fine it is very unstable. It crashes the system
> once every 3-4 times it is run. Considering that the debugging support
> with WDEB98/RTERM98 is not very extensive I am not able to clearly figure
> out the problem. It sometimes gives a “page fault” and sometimes a
> “Invalid Opcode” error message. The program hasbeen written fully in “C”.
> As I was trying to find out the cause, I noticed that the ddk
> documentation writes that we should not use MS VC++ 6.0 for compiling and
> linking the programs because it has some decoration problems. I am using
> VC++ 6.0 as that is the only version I have. Couldit cause such fatal
> errors to occur or since there is “decoration incompatibilities” will it
> only affect symbolic debugging information?
> Regards,
> Ganesh
>
> —
> You are currently subscribed to ntdev as: xxxxx@vsnl.net
> To unsubscribe send a blank email to %%email.unsub%%
>

Hello Jay,
Thanks for the input - seems valuable. But could you please tellme how
to build the Vxd using single byte alignment.
Additionally I am facing one more problem. I am using the following
string functions in my Vxd - strcpy, strlen, strncmp, sprintf and atoi.
The default build doesnot seem to include the libraries for it. I started
my driver with the “cvxd32” ‘C’ driver example from 98DDK. So I am using
the same makefile with some modifications. Which library should be
included for this? I tried crtdll.lib both from the “checked” and “free”
directories. But the driver doesnot load with a “bad object in driver”
error message. Can you please help me out?

Regards,
Ganesh