problem with function GetVDMPointer

My WIN16 application tries to access a range of memory addresses in NT. In
order to do this, I make a VDD to install a meory hook for this bunch of
memory. The code is as follows.

MIOAddress = (ULONG) GetVDMPointer(MIO_ADDRESS, MIO_RANGE, TRUE);
// Hook memory-mapped I/O.
MIOHook =
VDDInstallMemoryHook(hVDD,(PVOID)MIOAddress,MIO_RANGE,(PVDD_MEMORY_HANDLER)M
IOHandler);

where, MIO_ADDRESS is a 32bit x86 address like 0xd0004000. MIO_RANGE is 2k.

This code works with MS-DOS program when the third parameter of
GetVDMPointer is 0. But it doesn’t work with WIN16 application.

From NT DKK document, if the third parameter (ProtectedMode) is 0, this
function will take the high word of MIO_ADDRESS as segment. If the parameter
is 1, the high word will be seen as a selector.

Can anyone tell me where the problem is?

Thanks a lot.

-----Original Message-----
From: Jim Young [mailto:xxxxx@youngendeavors.com]
Sent: Wednesday, November 07, 2001 2:12 PM
To: NT Developers Interest List
Subject: [ntdev] RE: a VDD question

The only way I know is to write a thunking DLL (its ugly). Look under
Thunking Compiler in MSDN. You can also pass data to a 16 bit process using
WM_COPYDATA or DDE, etc. If you have the source code for the 16 bit DLL a
better option may be to re-compile it as a 32 bit DLL.

Jim

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Mingshu Wang
Sent: Wednesday, November 07, 2001 9:54 AM
To: NT Developers Interest List
Subject: [ntdev] a VDD question

How can I call a function in a win16 DLL from a VDD under NT or WIN2K?


You are currently subscribed to ntdev as: xxxxx@youngendeavors.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@ccontrols.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hmmm…

With NT/2000/XP MSDOS programs run as threads under the ntvdm.exe process.
It is my understanding that the whole VDD architechture is designed to allow
MSDOS programs to access hardware via a user mode driver. ntvdm.exe uses
VDDs to allow this to happen. On the other hand, Win16 applications run
under the WOW subsystem, which emulates the 16 bit API. If a Win16
application tries to access hardware directly I’m not sure whether a VDD is
invoked to handle this or not. According to Microsoft’s specs Win16
application are never to access hardware directly (yea right!). So it may be
that all bets are off if it does.

Jim

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Mingshu Wang
Sent: Wednesday, November 07, 2001 2:29 PM
To: NT Developers Interest List
Subject: [ntdev] problem with function GetVDMPointer

My WIN16 application tries to access a range of memory addresses in NT. In
order to do this, I make a VDD to install a meory hook for this bunch of
memory. The code is as follows.

MIOAddress = (ULONG) GetVDMPointer(MIO_ADDRESS, MIO_RANGE, TRUE);
// Hook memory-mapped I/O.
MIOHook =
VDDInstallMemoryHook(hVDD,(PVOID)MIOAddress,MIO_RANGE,(PVDD_MEMORY_HANDLER)M
IOHandler);

where, MIO_ADDRESS is a 32bit x86 address like 0xd0004000. MIO_RANGE is 2k.

This code works with MS-DOS program when the third parameter of
GetVDMPointer is 0. But it doesn’t work with WIN16 application.

From NT DKK document, if the third parameter (ProtectedMode) is 0, this
function will take the high word of MIO_ADDRESS as segment. If the parameter
is 1, the high word will be seen as a selector.

Can anyone tell me where the problem is?

Thanks a lot.

-----Original Message-----
From: Jim Young [mailto:xxxxx@youngendeavors.com]
Sent: Wednesday, November 07, 2001 2:12 PM
To: NT Developers Interest List
Subject: [ntdev] RE: a VDD question

The only way I know is to write a thunking DLL (its ugly). Look under
Thunking Compiler in MSDN. You can also pass data to a 16 bit process using
WM_COPYDATA or DDE, etc. If you have the source code for the 16 bit DLL a
better option may be to re-compile it as a 32 bit DLL.

Jim

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Mingshu Wang
Sent: Wednesday, November 07, 2001 9:54 AM
To: NT Developers Interest List
Subject: [ntdev] a VDD question

How can I call a function in a win16 DLL from a VDD under NT or WIN2K?


You are currently subscribed to ntdev as: xxxxx@youngendeavors.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@ccontrols.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@youngendeavors.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

WIN16 application can access memory directly with selectors in 98. From DDK
document, it looks like GetVDMPointer can still support selector. But I
don’t know why it doesn’t work indeed. In VDD chapter of DDK document, there
are only two functions specially for WOW and others are called VDD
something. So, I suppose all VDDfunctions are fine to WIN16 application.

-----Original Message-----
From: Jim Young [mailto:xxxxx@youngendeavors.com]
Sent: Wednesday, November 07, 2001 4:58 PM
To: NT Developers Interest List
Subject: [ntdev] RE: problem with function GetVDMPointer

Hmmm…

With NT/2000/XP MSDOS programs run as threads under the ntvdm.exe process.
It is my understanding that the whole VDD architechture is designed to allow
MSDOS programs to access hardware via a user mode driver. ntvdm.exe uses
VDDs to allow this to happen. On the other hand, Win16 applications run
under the WOW subsystem, which emulates the 16 bit API. If a Win16
application tries to access hardware directly I’m not sure whether a VDD is
invoked to handle this or not. According to Microsoft’s specs Win16
application are never to access hardware directly (yea right!). So it may be
that all bets are off if it does.

Jim

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Mingshu Wang
Sent: Wednesday, November 07, 2001 2:29 PM
To: NT Developers Interest List
Subject: [ntdev] problem with function GetVDMPointer

My WIN16 application tries to access a range of memory addresses in NT. In
order to do this, I make a VDD to install a meory hook for this bunch of
memory. The code is as follows.

MIOAddress = (ULONG) GetVDMPointer(MIO_ADDRESS, MIO_RANGE, TRUE);
// Hook memory-mapped I/O.
MIOHook =
VDDInstallMemoryHook(hVDD,(PVOID)MIOAddress,MIO_RANGE,(PVDD_MEMORY_HANDLER)M
IOHandler);

where, MIO_ADDRESS is a 32bit x86 address like 0xd0004000. MIO_RANGE is 2k.

This code works with MS-DOS program when the third parameter of
GetVDMPointer is 0. But it doesn’t work with WIN16 application.

From NT DKK document, if the third parameter (ProtectedMode) is 0, this
function will take the high word of MIO_ADDRESS as segment. If the parameter
is 1, the high word will be seen as a selector.

Can anyone tell me where the problem is?

Thanks a lot.

-----Original Message-----
From: Jim Young [mailto:xxxxx@youngendeavors.com]
Sent: Wednesday, November 07, 2001 2:12 PM
To: NT Developers Interest List
Subject: [ntdev] RE: a VDD question

The only way I know is to write a thunking DLL (its ugly). Look under
Thunking Compiler in MSDN. You can also pass data to a 16 bit process using
WM_COPYDATA or DDE, etc. If you have the source code for the 16 bit DLL a
better option may be to re-compile it as a 32 bit DLL.

Jim

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Mingshu Wang
Sent: Wednesday, November 07, 2001 9:54 AM
To: NT Developers Interest List
Subject: [ntdev] a VDD question

How can I call a function in a win16 DLL from a VDD under NT or WIN2K?


You are currently subscribed to ntdev as: xxxxx@youngendeavors.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@ccontrols.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@youngendeavors.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@ccontrols.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> VDDs to allow this to happen. On the other hand, Win16 applications run

under the WOW subsystem, which emulates the 16 bit API.

…and runs inside NTVDM too, though in protected mode.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com