Announcement

Collapse
No announcement yet.

Need function similar to _dos_setvect

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need function similar to _dos_setvect

    Does anyone know of anything like this? the Dos Libs for Windows come with this function but I would then have to link to the lib file, which means I would have to write this program in C or C++.

    Anyone know of an equivelent?

    Thanks
    Sr. Software Development Engineer and Sr. Information Security Analyst,
    CEH, Digital Forensic Examiner

    #2
    Courtesy: Google search
    MSC: void _dos_setvect( unsigned intnum,
    void (interrupt far *handler)() )


    - prototype in dos.h

    - intnum = interrupt vector to set (0..255)
    - handler = new interrupt routine

    - Turbo C uses setvect()
    - see INT 21,25 _dos_getvect()
    If you are creating an MS_DOS program using PB/DOS (not shown), use CALL INTERRUPT for INT 21, whatever function SETS vectors (probably 24 or 26, since the GET is 25).

    If you are creating a Windows program, what are you trying to do?

    Setting interrupt vectors under MS-DOS was done to redirect certain system events such as keystrokes, mouse clicks, file opens, etc etc etc. But under Windows all 'user' actions are sent to your program in the form of notification message, and most of the others can be handled using some of the 'event services' provided.


    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


      #3
      Under windows.

      Background, when a dos program runs in windows the OS will load a DOS VM called NTVDM. NTVDM will then look to the OS for a registered handler for the Interrupt being called.

      What I need to do is register a handler for &H14 (this is the FOSSIL Interrupt) and set the handler to the procedure that will be handling that interrupt.
      Sr. Software Development Engineer and Sr. Information Security Analyst,
      CEH, Digital Forensic Examiner

      Comment


        #4
        Woo. Good Description.

        But I'm afraid this one is WAAAAY beyond my pay grade....
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


          #5
          How about this, I think I can do it from PDDOS, it may be that the DOS forum is a good place for this but I need to mimic this call, but not sure how to do it
          Code:
           push    ds              ;Move ds segment
                  pop     es              ;  to es
                  lea     si,DLLname      ;Point to our desired drivers DLL name
                  lea     di,DLLinit      ;Point to the desired Init routine name
                  lea     bx,DLLdisp      ;Point to the desired dispatch routine name
                                          ;So now we have       Dispatch in ds:bx
                                          ;                     Init     in es:di
                                          ;  and                DLLname  in ds:si
          
                  db 0C4h,0C4h,58h,0h     ;--Execute NTVDM RegisterModule-----
                                          ;We should have invoked our DLL at this point
                  lea     di,Handle       ;Address our handle location
                  mov     [di],ax         ;Save the VDD handle sent back to us by NTVDM
          
                  jnc     RgDone          ;Jump if we have a good VDD handle
                  mov     ax,0
                  mov     [di],ax         ;--ELSE we have a problem - probably no DLL----
          Sr. Software Development Engineer and Sr. Information Security Analyst,
          CEH, Digital Forensic Examiner

          Comment


            #6
            Got It For PB DOS
            Code:
            Dim sDll as string
            Dim sInit as string
            Dim sDispatch as string
            Dim dllptr as word
            Dim initPtr as word
            Dim dispatchPtr as word
            Dim hHandler as dword
            
            sDll = "DLLNAME.DLL" & chr$(0)
            sInit = "INITROUTINE" & chr$(0)
            sDispatch = "DISPATCHROUTINE" & chr$(0)
            
            dllPtr = varptr(sDll)
            dllInit = varptr(sInit)
            dllDispatch = varptr(sDispatch)
            
            PRINT "RUNNING ASM"
            
            ASM push es
            ASM push ds
            ASM pop es
            ASM mov si, dllPtr
            ASM mov di, dllInit
            ASM mov bx, dllDispatch
            '--- this calls the dll from here using special ntvdm opcode ----
            ASM db &H0C4
            ASM db &H0C4
            ASM db &H58
            ASM db &H0
            ASM mov hHandler, AX
            
            Select case hHandler
                    case 0
                          'okay
                    case 1 
                          'dll could not be found
                    case 2
                          'dispatch could not be found
                    case 3 
                          'init could not be found
                    case 4
                          'not enough memory
                    case else
                          'something blew up
            End select
            Sr. Software Development Engineer and Sr. Information Security Analyst,
            CEH, Digital Forensic Examiner

            Comment

            Working...
            X
            😀
            🥰
            🤢
            😎
            😡
            👍
            👎