Author Topic: How To use Win32 Interrupts?  (Read 14538 times)

Offline ngochuan1st

  • Jr. Member
  • *
  • Posts: 30
How To use Win32 Interrupts?
« on: December 11, 2012, 02:09:25 PM »
i want to use win32 interrupts same as int 21h (16bits), this is not work in win32 :-??

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: How To use Win32 Interrupts?
« Reply #1 on: December 11, 2012, 04:07:28 PM »
No. You'll have to use the Windows API. Both BIOS and dos interrupts are 16-bit code, and just won't work in 32-bit code. If you're really desperate to use interrupts in 32-bit code, int 80h will work in Linux. I understand that there IS an interrupt "under the hood" but Windows won't let us near it. I've never even seen an example! For Windows, use the API(s) - really don't have much choice!

Best,
Frank


Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: How To use Win32 Interrupts?
« Reply #2 on: December 11, 2012, 08:47:53 PM »
I understand that there IS an interrupt "under the hood" but Windows won't let us near it. I've never even seen an example!

On newer Windows systems, sysenter has replaced system call interrupts. On older windows machines, the native API can be accessed through the 2Eh interrupt. EAX will contain a function number and EDX will contain the address to the parameters to be passed to the function. Most of the usermode API simply sets up the parameters and passes control on to the 2Eh handler.

You won't find much information on the subject because Microsoft never officially released any info (other than letting users know that the function numbers and parameters could be changed at any time), however since these have more or less been completely replaced, it's fairly safe to assume that they have no intentions of going back and reordering things just to mess with ya. That said, probably the best list of the "known" native API function numbers is from Ralph Brown's Interrupt List (Table 2586).

About Bryant Keller
bkeller@about.me

Offline ngochuan1st

  • Jr. Member
  • *
  • Posts: 30
Re: How To use Win32 Interrupts?
« Reply #3 on: December 12, 2012, 05:21:13 AM »
Oh. Thanks!!!