News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

int xxx in windows

Started by korte, May 15, 2008, 06:48:53 AM

Previous topic - Next topic

korte

My program,  consists of 2 parts. (1 EXE)
In one of the parts generating int 80h interruption and I would like to digest it in the other part.
Under Windows.

Tedd

Windows doesn't use 'int' for system calls like Linux does, you need to call the appropriate API functions..
You'll have to lookup the appropriate API function for each of the int 80h system calls, or if you want to post your code we can help convert it.
No snowflake in an avalanche feels responsible.

korte


call int generating exception.

Special exception handler?

hutch--

korte,

You did not read Ted's answer, in protected mode 32 bit windows the addresses for 16 bit DOS interrupts will always generate an exception as yu are trying to use a method that was designed in another era under a different memory scheme.

Look up the Windows API functions to get the capacity you eed and do it that way.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

korte

my program used int 80-88 system call.
I want to run under dos and under windows.
DOS loader handling software interrupt.
I want writing windows loader.

japheth


Hi korte,

if you want to emulate int 80h behavior, you have to catch the exception caused by int 80h in Win32. Here's an example, might be a starting point:



    .386
    .model flat,stdcall
   
ExitProcess proto :dword
GetStdHandle proto :dword
WriteConsoleA proto :dword, :dword, :dword, :dword, :dword

    assume FS:NOTHING

    .data
szText db "caught an int 80h!",13,10
lszText equ $ - szText
    .code

CONTEXT_EIP = 184   ;offset of rEip in CONTEXT structure

start:
    push    offset myexc
    push    dword ptr fs:[0]
    mov     fs:[0], esp
    int 80h
    pop     dword ptr fs:[0]
    pop     ecx         ;adjust stack
   
    invoke ExitProcess, 0

myexc:
    ;do whatever you want here to emulate int 80h
    invoke  GetStdHandle, -11
    push    0
    mov     edx,esp
    invoke  WriteConsoleA, eax, offset szText, lszText, esp, 0
    pop     ecx
    mov     eax, [esp+12]   ;get context
    add     dword ptr [eax+CONTEXT_EIP], 2
    xor     eax, eax        ;== _XCPT_CONTINUE_EXECUTION
    retn
   
    END start