|
ID: 15526, dpmi dos memory alloc
GlobalDosAlloc -> 16bit dpmi dos function = GetDiskSerialNumber
|
Download
| Details
|
|
FTP
download also available
|
0 bytes |
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
|
To download this, you must have registered:
|
For C++Builder, Version 2.0
to 5.0
12 downloads
Copyright: No significant restrictions
Size: 0 bytes
Updated on Wed, 24 Jan 2001 22:55:30 GMT
Originally uploaded on Wed, 24 Jan 2001 22:55:30 GMT
|
|
Description
|
Hi !
I have quite unusual dilema.
I need to convert workable dpmi Win16 function to DOS.
There it is.
==============================================
// Structure to contain the register values for the
// DPMI services
typedef struct
{
DWORD di,si,bp,res1,bx,dx,cx,ax;
WORD flags, es,ds,fs,gs,res2,res3,sp,ss;
} DPMIRegs;
// Use DPMI services to access Real mode
void SimRealInt (BYTE i, DPMIRegs far *p)
{
int retcode;
asm {
mov bl, [i] // DOS interupt
mov bh, 0
les di, [p] // Register Values
mov cx, 0
mov ax, 0300h
int 31h
}
}
The main function
==============================================
DWORD far pascal dpmiGetDiskInfo(int Drive)
{
DWORD dwValue, sn;
unsigned size;
// Create globally to initialize to Zero
DPMIRegs r;
WORD wSegment, wSelector;
Info far *WindowsPtr;
r.di=0; r.si=0; r.bp=0; r.res1=0; r.bx=0; r.dx=0; r.cx=0; r.ax=0;
r.es=0; r.ds=0; r.fs=0; r.res3=0; r.sp=0; r.ss=0; r.gs=0; r.res2=0;
r.flags=0;
size=sizeof(Info);
dwValue=GlobalDosAlloc(size);
if ( !dwValue )
return 0; // Cann't allocate dos memory block
wSegment = HIWORD(dwValue) ;
wSelector = LOWORD(dwValue) ;
WindowsPtr = (Info far *)MK_FP(wSelector,0) ;
r.ax = 0x6900;
r.bx = Drive ;
r.dx = 0;
r.ds = wSegment;
SimRealInt(0x21, &r) ; // Call DOS int 21h, 69h
// Check for read error
if ( r.flags & 0x01)
sn=0;
else
sn=WindowsPtr->Serial;
GlobalDosFree(wSelector) ; // Exit
return sn;
}
==============================================
All we have to do is to replace Windows GlobalDosAlloc and GlobalDosFree
with dpmi equivalent. I tried to use dpmi int 31h fn 0501h and 050Ah.
But function failed to work.( Though the memory was allocated succesfully).
Are there gurus? How to do such thing?
Thank you.
Best regards,
Dima
|
|

Server Response from: ETNACDC04
|
Connect with Us