Hi,

I used to program in ASM many years ago, back in the DOS days...
I'm now attempting to code a VDD for NT, and because I have absolutly no C background, I'm hoping it can be done all in ASM.

I created a DOS INT14 handler, which loads a .DLL and connects to the VDD using the "RegisterModual" and "DispatchCall" functions I found in the NT DDK (in a file called ISVBOP.H).

The problem is that when my DOS app does a DispatchCall to the VDD, the call works fine (as the VDD currently shows a hello world message), but all registers are lost during the DispatchCall, and when the VDD returns to the DOS app, it is unable to return any registers as well.

I've looked at some C examples of simular functions, and in C the DLL can access the DOS programs registers by using functions such as getAX() AND setAX(). I've not been able to find any information on how this can be done in ASM however.

Can anyone give me a clue please?
:confused:

micron
Posted on 2001-11-03 12:23:54 by micron
the getAX() or setAX() "functions" are possibly macros. These will be defined in one of the header files of your C source. So just make a "findall" about all header files (*.H) your C source includes and look for "#define getAX() ..."
Posted on 2001-11-03 13:08:46 by japheth
Thanks for the reply, but the only reference to any get??() functions in the NT DDK files are in the VDDSVC.H file.

It has get and set macros for all the registers in this fashon:

#define getEAX() (ULONG)c_getAX()
#define getAX() c_getAX()
#define getAL() c_getAL()
#define getAH() c_getAH()

I have no C background, but it appears that these C_get??() functions are part of C itself, so I can not find any way of duplicating the function in ASM.

micron
Posted on 2001-11-03 13:26:48 by micron
micron,

these functions are NOT part of C. If they aren't macros, they are functions and part of an object module or library. In such a form they can be used from C and ASM as well. If you dont find a prototype for c_getAX(), call this function with:



c_getAX proto c
invoke c_getAX
Posted on 2001-11-03 15:04:48 by japheth
That makes sense...

I searched all the .lib files which were included in the DDK VDD example driver:

kernel32.lib
user32.lib
ntvdm.lib

The ntvdm.lib (binary) file does contain references to the set?? and get?? commands.. here is a clip:

__imp__getAX@0 _getAX@0 __imp__getAL@0 _getAL@0 __imp__getAH@0 _getAH@0 __imp__getBX@0 _getBX@0 __imp__getBL@0 _getBL@0 __imp__getBH@0 _getBH@0

I expected to find "c_get??" in here as well, but there were none.

So armed with this bit of knowledge, I copied the ntvdm.lib to my \masm32\lib\ dir, and added the following to my .asm header:

includelib \masm32\lib\ntvdm.lib
getAX proto c

and added this to the .code:

invoke getAX

But this fails to link, generating the following error:

testvdd.obj : error LNK2001: unresolved external symbol _getAX


Am I overlooking the obvious here? :confused:

micron
Posted on 2001-11-03 19:18:41 by micron
It turns out it was something simple...

I just had to remove the "c" in "getAX proto c".
Now its working great!

Thanks for your help japheth!
:grin:

micron
Posted on 2001-11-04 00:53:40 by micron