Link to home
Start Free TrialLog in
Avatar of has
has

asked on

Int 21h Function 440Dh

if you look up help under Int 21h Function 440Dh Minor Code 46h(FAT32)

and make a working code out of it, that is all I need.

I have a structure

struct MID
{
    WORD midInfoLevel;
    DWORD midSerialNum;  
    char midVolLabel[11];
    char midFileSysType[8];
};

and a puhbutton function
void CMyDlg::OnButtonRUN()
{
      // TODO: Add your control notification handler codehere
      MID* MediaID;
      MediaID->midInfoLevel = 0;
      __asm
      {

mov     bx, 1               ;See below
mov     ch, 48h           ;See below
mov     cl, 46h                 ;Set Media ID
mov     dx, seg MediaID         ;See below
mov     ds, dx
mov     dx, offset MediaID      ;ds:dx points to MID structure
mov     ax, 440Dh               ;IOCTL for block device
int     21h

//jc      error_handler           ;carry set means error

      }
}

asm doesnot like mystructure, so try yourself
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of has
has

ASKER

thank you for your help. I use winNT, and tried the code above
but could not get it working. I used exact same code except

"\\\\.\\vwin32" ( I used "\\\\.\\a:") and on my test button
void CFormatDlg::OnButtonTest()
{
      // TODO: Add your control notification handler code here
      MID mid;
      UINT nDrive = 0;
      if(GetMediaID(&mid, nDrive))
      {
            CString name;
            name = mid.midVolLabel;
            MessageBox(name);
      }
      else MessageBox("error");
}

but line
fResult = DeviceIoControl(hDevice, VWIN32_DIOC_DOS_IOCTL,
preg, sizeof(*preg), preg, sizeof(*preg), &cb, 0);

returns false ? can you tell ? is because of NT not win 95 ?
thanks
Yes, it is because of Windows NT. First, the Int 21h Function 440Dh Minor Code 46h(FAT32) is one of the Windows 95 features according to the documentation. And FAT32 is supported only by Windows 95 OEM Service Release 2 and later. Second, VWIN32.VXD is used in Windows 95.