Hi!
When I need to run some interrupt under Win9x I can write vxd, load and execute it. E.g. those strings inside vxd generates sound on the speaker
...
mov .Client_dl,7
mov .Client_ah,2
mov eax,21h
VMMCall Exec_Int
...
Later I load and execute vxd
...
invoke CreateFile,addr VxDName,0,0,0,0,FILE_FLAG_DELETE_ON_CLOSE,0
invoke DeviceIoControl, hVxD,1,NULL,0,NULL,NULL, NULL, NULL
...
All this works under Win9x, but how about Win2k ? What must I write there if I need int 21h/25h/13h etc ?

Thanks,
Mike.
Posted on 2002-06-09 02:36:03 by Mike
Im afraid you cannot use Int21... in win32 apps under Win2k. The int 21 stuff is emulated in VDMs for Win16, DOS apps and DPMI apps, but its slow and buggy. So depending on what you want to do you may need to write a KMD.
Posted on 2002-06-09 05:46:54 by japheth
I dont know abbreviation "KMD" but I can work without int 21h (it's only DOS service) but what you can recommend me inplace int 13h or 25h? For example, I want to read zero track of HDD or any sector of disk (FAT/ FAT32/ NTFS). How can I do it?
Thanx,
Mike
Posted on 2002-06-09 06:56:58 by Mike
KMD = kernel mode driver ;)
Posted on 2002-06-09 10:02:19 by cynix
Where can I read about KMD? Can I load it dynamically?
Posted on 2002-06-09 10:42:52 by Mike
Posted on 2002-06-09 11:19:52 by Rama
Nice thing is that on NT, you don't need those steenkin' interrupts -
you can CreateFile \\.\PHYSICALDRIVEx or \\.\x: for raw drive or partition
access. Read what PSDK has to say about CreateFile :)
Posted on 2002-06-09 13:57:43 by f0dder
You are right f0dder, it's very easy to get access to physical drive in Win2k with CreateFile. But later... See this example.

.data
devname db "\\.\PHYSICALDRIVEx", 0
hDevice dd ?
pdg DISK_GEOMETRY <>
ctr dd ?

.code
.....
invoke CreateFile, offset devname,
0,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL
mov hDevice, eax

invoke DeviceIoControl,
hDevice, ; handle to device of interest
IOCTL_DISK_GET_DRIVE_GEOMETRY, ; control code of operation to perform
NULL, ; pointer to buffer to supply input data
0, ; size of input buffer
addr pdg, ; pointer to buffer to receive output data
sizeof pdg, ; size of output buffer
addr ctr, ; pointer to variable to receive output byte count
NULL ; overlapped

invoke CloseHandle, hDevice

Now please try to assemble it. There are no structures DISK_GEOMETRY, MEDIA_TYPE and IOCTL_DISK_GET_DRIVE_GEOMETRY constant. And I dont know how to read/write e.g sector 3 of the zero track. If you know - please write because this method better than interrupts.

Thank you,
Mike
Posted on 2002-06-10 11:24:17 by Mike
look in WinIoCtl.h from the PlatformSDK...
Posted on 2002-06-10 11:28:10 by f0dder
Sorry, f0dder but I could not find anything on the theme specified by you. It's because Platform SDK too large. Can you specify concrete function carrying out reading of sectors of a disk inplace int 13h?
Mike
P.S I tried to search "WinIOCtl.h" and has received more than 100 "answers" !
Posted on 2002-06-11 10:35:22 by Mike
You can damage your disk drives if you don't know what you are doing when using WriteFile.

If I knew how to get the handle to the console the messagebox might not go background.
Posted on 2002-06-12 07:37:26 by roaknog
The perfect program, roaknog!
Large, huge thanks to you a for it. I write my programs for a long time and if now my hard disk is not damaged then later (I hope) it will be too, but now I can write programs for Win2k.
Once again thanks, Mike
Posted on 2002-06-13 05:39:51 by Mike
H-mmm, there is a little difference between int13 and this method in sector addressing. In int13 format was Cyl-Head-Sec and ReadFile uses sequential number of sector. Is there some function to translate formats or formula?
Thanks, Mike
Posted on 2002-06-13 05:48:59 by Mike