Click here to Skip to main content
15,883,901 members
Articles / Programming Languages / C++

The Ultimate Process/Thread spy for Windows 9x.

Rate me:
Please Sign up or sign in to vote.
4.44/5 (9 votes)
27 Mar 20033 min read 106.1K   1K   26  
Process/thread creation/destruction detector for Windows 9x .
include local.inc

StartCDecl Call_Priority_VM_Event@24

    push    ebx
    push	esi
    push	edi

    mov		edi, [esp+36]	; Timeout
    mov		esi, [esp+32]	; Event callback
    mov		edx, [esp+28]	; Ref data
    mov     ecx, [esp+24]	; Flags
    mov		ebx, [esp+20]	; hVM
    mov		eax, [esp+16]	; Priority boost
    VxDCall	Call_Priority_VM_Event
    mov		eax, esi

    pop		edi
    pop		esi
    pop		ebx
    ret		6*4

EndCDecl Call_Priority_VM_Event@24

StartCDecl Cancel_Thread_Event@8

    push	esi
    push	edi

    mov		edi, [esp+16]	; Event handle
    mov		esi, [esp+12]	; Thread handle
    VxDCall	Cancel_Thread_Event

    pop		edi
    pop		esi
    ret		2*4

EndCDecl Cancel_Thread_Event@8

StartCDecl Schedule_Thread_Event@12

    push    esi
    push    edi

    mov     edx, [esp+20]	; Ref data
    mov     esi, [esp+16]	; Event callback
    mov     edi, [esp+12]	; Thread handle
    VxDCall Schedule_Thread_Event
    mov     eax, esi

    pop     edi
    pop     esi
    ret     3*4

EndCDecl Schedule_Thread_Event@12

StartCDecl Test_Sys_VM_Handle@4

    push    ebx

    mov     ebx, [esp+8]	; VM handle to test
    VxDCall Test_Sys_VM_Handle
    setnc   al
    and     eax, 1

    pop     ebx
    ret     1*4

EndCDecl Test_Sys_VM_Handle@4

StartCDecl Validate_VM_Handle@4

    push    ebx

    mov     ebx, [esp+8]	; VM handle to test
    VxDCall Validate_VM_Handle
    setnc   al
    and     eax, 1         ; Returns TRUE if handle is valid

    pop     ebx
    ret     1*4

EndCDecl Validate_VM_Handle@4

StartCDecl Call_When_VM_Returns@12

    push    esi

    mov     esi, [esp+16]  ; callback function address
    mov     edx, [esp+12]  ; reference data
    mov     eax, [esp+8]   ; msec until time out

    VxDCall Call_When_VM_Returns

    pop     esi
    ret     3*4

EndCDecl Call_When_VM_Returns@12

StartCDecl Schedule_VM_Event@12

    push    ebx
    push    esi

    mov     edx, [esp+20]  ; Reference data
    mov     esi, [esp+16]  ; Event callback
    mov     ebx, [esp+12]  ; VM handle

    VxDCall Schedule_VM_Event
    mov     eax, esi

    pop     esi
    pop     ebx
    ret     3*4

EndCDecl Schedule_VM_Event@12

StartCDecl Call_Global_Event@8

    push    esi

    mov     edx, [esp+12]     ; Reference data
    mov     esi, [esp+8]      ; Global event callback

    VxDCall Call_Global_Event
    mov     eax, esi

    pop     esi
    ret     2*4

EndCDecl Call_Global_Event@8

StartCDecl Call_VM_Event@12

    push    ebx
    push    esi

    mov     edx, [esp+20]   ; Reference data
    mov     esi, [esp+16]   ; Event callback
    mov     ebx, [esp+12]   ; VM Handle

    VxDCall Call_VM_Event
    mov     eax, esi

    pop     esi
    pop     ebx
    ret     3*4

EndCDecl Call_VM_Event@12

StartCDecl Cancel_VM_Event@8

    push    ebx
    push    esi

    mov     esi, [esp+16]   ; Event handle
    mov     ebx, [esp+12]   ; VM Handle

    VxDCall	Cancel_VM_Event

    pop     esi
    pop     ebx
    ret     2*4

EndCDecl Cancel_VM_Event@8

StartCDecl Cancel_Priority_VM_Event@4

    push    esi

    mov     esi, [esp+8]   ; Event handle
	      
    VxDCall	Cancel_Priority_VM_Event

    pop     esi
    ret     1*4

EndCDecl Cancel_Priority_VM_Event@4

StartCDecl Map_Flat@8

    mov     ecx, [esp+4]   ; Segment
    shl     ecx, 8
    mov     eax, [esp+8]   ; Offset
    or      eax, ecx
		     
    VxDCall	Map_Flat       ; eax holds -1 on error, else ring-0 address

    ret     2*4

EndCDecl Map_Flat@8

StartCDecl Map_Lin_To_VM_Addr@16

    mov     ecx, [esp+8]      ; Segment limit
    mov     eax, [esp+4]      ; Linear address to convert
		     
    VxDCall Map_Lin_To_VM_Addr
    setnc   al
    and     eax, 1
    push    eax

    mov     eax, [esp+20]     ; Get offset pointer
    mov     [eax], edx        ; Return offset
    mov     eax, [esp+16]     ; Get segment pointer
    mov     [eax], ecx        ; Return segment

    pop     eax
    ret     4*4

EndCDecl Map_Lin_To_VM_Addr@16

StartCDecl Adjust_Exec_Priority@8

    push    ebx

    mov     ebx, [esp+12]   ; VM handle
    mov     eax, [esp+8]    ; Priority boost
	      
    VxDCall Adjust_Exec_Priority

    pop     ebx
    ret     2*4

EndCDecl Adjust_Exec_Priority@8

StartCDecl End_Crit_And_Suspend@0

    VxDCall	Adjust_Exec_Priority
    setnc   al
    and     eax, 1

    ret     0*4		
        
EndCDecl End_Crit_And_Suspend@0

StartCDecl Claim_Critical_Section@8

    mov     ecx, [esp+8]    ; Flags
    mov     eax, [esp+4]    ; Claims

    VxDCall	Claim_Critical_Section

    ret     2*4
                
EndCDecl Claim_Critical_Section@8

StartCDecl Release_Critical_Section@4

    mov     ecx, [esp+4]    ; Claims

    VxDCall	Release_Critical_Section

    ret     1*4
                
EndCDecl Release_Critical_Section@4

StartCDecl Call_When_Not_Critical@8

    push    esi

    mov     edx, [esp+12]   ; Reference data
    mov     esi, [esp+8]    ; Critical section callback

    VxDCall Call_When_Not_Critical

    pop     esi
    ret     2*4
                
EndCDecl Call_When_Not_Critical@8

StartCDecl Get_Crit_Section_Status@8

    push    ebx

    VxDCall Get_Crit_Section_Status

    setc    al
    and     eax, 1          ; Return TRUE if carry set
    push    eax

    mov     eax, [esp+12]   ; Get pointer to VM handle
    mov     [eax], ebx      ; Return VM handle
    mov     eax, [esp+16]   ; Get pointer to claims
    mov     [eax], ecx      ; Return claims

    pop     eax
    pop     ebx
    ret     2*4
                
EndCDecl Get_Crit_Section_Status@8

StartCDecl Call_When_Task_Switched@4

    push    esi

    mov     esi, [esp+8] ; Task switch callback
    VxDCall	Call_When_Task_Switched

    pop     esi
    ret     1*4
                
EndCDecl Call_When_Task_Switched@4

StartCDecl Suspend_VM@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle
    VxDCall	Suspend_VM
    setnc   al
    and     eax, 1

    pop     ebx
    ret     1*4
                
EndCDecl Suspend_VM@4

StartCDecl Resume_VM@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle
    VxDCall	Resume_VM
    setnc   al
    and     eax, 1

    pop     ebx
    ret     1*4
                
EndCDecl Resume_VM@4

StartCDecl No_Fail_Resume_VM@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle
    VxDCall	No_Fail_Resume_VM
    
    pop     ebx
    ret     1*4
                
EndCDecl No_Fail_Resume_VM@4

StartCDecl Nuke_VM@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle
    VxDCall	Nuke_VM
    
    pop     ebx
    ret     1*4
                
EndCDecl Nuke_VM@4

StartCDecl Crash_Cur_VM@0

    VxDCall	Crash_Cur_VM

    ret     0*4
                                
EndCDecl Crash_Cur_VM@0

StartCDecl Set_Execution_Focus@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle
    VxDCall	Set_Execution_Focus
    setnc   al
    and     eax, 1

    pop     ebx
    ret     1*4
                
EndCDecl Set_Execution_Focus@4

StartCDecl Get_Time_Slice_Info@12

    push    ebx

    VxDCall	Get_Time_Slice_Info
    mov     edx, eax        ; Save num scheduled
    mov     eax, [esp+16]   ; Return num idle
    mov     [eax], ecx
    mov     eax, [esp+12]   ; Return current VM
    mov     [eax], ebx
    mov     eax, [esp+8]    ; Return num scheduled
    mov     [eax], edx

    pop     ebx
    ret     3*4
                        
EndCDecl Get_Time_Slice_Info@12

StartCDecl Release_Time_Slice@0

    VxDCall	Release_Time_Slice

    ret     0*4
                                
EndCDecl Release_Time_Slice@0

StartCDecl Wake_Up_VM@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle

    VxDCall	Wake_Up_VM
    
    pop     ebx
    ret     1*4
                        
EndCDecl Wake_Up_VM@4

StartCDecl Get_Next_VM_Handle@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle

    VxDCall	Get_Next_VM_Handle
    mov     eax, ebx

    pop     ebx
    ret     1*4
                        
EndCDecl Get_Next_VM_Handle@4

StartCDecl Get_System_Time@0

    VxDCall	Get_System_Time
    ret     0*4
                                
EndCDecl Get_System_Time@0

StartCDecl Get_VM_Exec_Time@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle
    VxDCall	Get_VM_Exec_Time

    pop     ebx
    ret     1*4
                    
EndCDecl Get_VM_Exec_Time@4

StartCDecl Set_PM_Int_Vector@12

    mov     edx, [esp+12]       ; Offset for interrupt routine
    mov     ecx, [esp+8]        ; Selector for interrupt routine
    mov     eax, [esp+4]        ; Interrupt number

    VxDCall	Set_PM_Int_Vector
    
    ret     3*4
                        
EndCDecl Set_PM_Int_Vector@12

StartCDecl Simulate_Int@4

    mov     eax, [esp+4]        ; Interrupt number

    VxDCall	Simulate_Int
    
    ret     1*4
                        
EndCDecl Simulate_Int@4

StartCDecl Simulate_Iret@0

    VxDCall	Simulate_Iret

    ret     0*4
                                
EndCDecl Simulate_Iret@0

StartCDecl Simulate_Far_Call@8

    mov     edx, [esp+8]        ; offset of procedure
    mov     cx,  [esp+4]        ; Segment containing procedure
    
    VxDCall	Simulate_Far_Call
    
    ret     2*4
                        
EndCDecl Simulate_Far_Call@8

StartCDecl Simulate_Far_Jmp@8

    mov     edx, [esp+8]        ; offset of procedure
    mov     ecx, [esp+4]        ; Segment containing procedure
    
    VxDCall	Simulate_Far_Jmp
    
    ret     2*4
                        
EndCDecl Simulate_Far_Jmp@8

StartCDecl Simulate_Far_Ret@0

    VxDCall	Simulate_Far_Ret

    ret     0*4
                                
EndCDecl Simulate_Far_Ret@0

StartCDecl Simulate_Far_Ret_N@4

    mov     eax, [esp+4]        ; no of bytes to pop from stack
           
    VxDCall	Simulate_Far_Ret_N
    
    ret     1*4
                        
EndCDecl Simulate_Far_Ret_N@4

StartCDecl Simulate_Pop@0
                       
    VxDCall	Simulate_Pop
    ret     0*4
                                
EndCDecl Simulate_Pop@0

StartCDecl Simulate_Push@4

    mov     eax, [esp+4]        ; value to push
           
    VxDCall	Simulate_Push
    
    ret     1*4
                        
EndCDecl Simulate_Push@4

StartCDecl Build_Int_Stack_Frame@8

    mov     edx, [esp+8]        ; offset of routine to call
    mov     cx,  [esp+4]        ; code segment of routine to call
    
    VxDCall	Build_Int_Stack_Frame
    
    ret     2*4
                        
EndCDecl Build_Int_Stack_Frame@8

StartCDecl MMGR_SetNULPageAddr@4

    mov     eax, [esp+4]        ; physical address for system nul page
            
    VxDCall	MMGR_SetNULPageAddr
    
    ret     1*4
                        
EndCDecl MMGR_SetNULPageAddr@4

StartCDecl Hook_VMM_Fault@12

    push    esi

    mov     esi, [esp+12]       ; points to a fault handler
    mov     eax, [esp+8]        ; fault number to hook
            
    VxDCall	Hook_VMM_Fault
    setnc   al
    and     eax, 1
    push    eax
        
    mov     eax, [esp+20]       ; get pointer to previous hook
    mov     [eax], esi          ; return previous hook

    pop     eax
    pop     esi
    ret     3*4
                        
EndCDecl Hook_VMM_Fault@12

StartCDecl Exec_Int@4

    push    [esp+4]         ; push interrupt number

    VxDCall	Exec_Int
    ret     1*4
                        
EndCDecl Exec_Int@4

StartCDecl Allocate_PM_App_CB_Area@4

    mov     ecx, [esp+4]        ; Size
            
    VxDCall	Allocate_PM_App_CB_Area
    mov     eax, ecx
    
    ret     1*4
                        
EndCDecl Allocate_PM_App_CB_Area@4

StartCDecl Save_Client_State@4

    push    edi

    mov     edi, [esp+8]        ; Buffer
            
    VxDCall	Save_Client_State
    
    pop     edi
    ret     1*4
                        
EndCDecl Save_Client_State@4

StartCDecl Restore_Client_State@4

    push    esi

    mov     esi, [esp+8]        ; Buffer
            
    VxDCall	Restore_Client_State
    
    pop     esi
    ret     1*4
                        
EndCDecl Restore_Client_State@4

; Offsets into REGISTERS structure
EDI_reg EQU 0
ESI_reg EQU 4
EBP_reg EQU 8
ESP_reg EQU 12
EBX_reg EQU 16
EDX_reg EQU 20
ECX_reg EQU 24
EAX_reg EQU 28
Flags   EQU 32

StartCDecl Exec_VxD_Int@8

	push ebx
	push esi
	push edi
	push ebp

	mov eax, [esp+20]		; Interrupt number
	push eax

	mov eax, [esp+28]		; REGISTERS ptr
	mov edi, [eax]
	mov esi, [eax+ESI_reg]
	mov ebp, [eax+EBP_reg]
	mov ebx, [eax+EBX_reg]
	mov edx, [eax+EDX_reg]
	mov ecx, [eax+ECX_reg]
	mov eax, [eax+EAX_reg]

	VxDCall	Exec_VxD_Int

	pushfd					; save flags

	push eax
	mov eax, [esp+32]		; get REGISTERS ptr
	pop [eax+EAX_reg]		; save registers
	pop [eax+Flags]
	mov [eax], edi
	mov [eax+ESI_reg], esi
	mov [eax+EBP_reg], ebp
	mov [eax+ESP_reg], esp
	mov [eax+EBX_reg], ebx
	mov [eax+EDX_reg], edx
	mov [eax+ECX_reg], ecx

	pop ebp
	pop edi
	pop esi
	pop ebx

	ret 2*4

EndCDecl Exec_VxD_Int@8

StartCDecl Hook_Device_Service@8

    push    esi

    mov     esi, [esp+12]
    mov     eax, [esp+8]

    VxDCall	Hook_Device_Service
    ;not implemented

    pop     esi
    ret     2*4
                        
EndCDecl Hook_Device_Service@8

StartCDecl System_Control@28

    pusha

    mov     edx, [esp+52]       ; Param3
    mov     edi, [esp+48]       ; Param2
    mov     esi, [esp+44]       ; Param1
    mov     ebx, [esp+40]       ; VM handle
    mov     eax, [esp+36]       ; system control msg        
    
    VxDCall	System_Control
    setnc   al                  ; Return TRUE if successful
    and     eax, 1
    push    eax

    mov     eax, [esp+64]       ; Get pointer to thread handle
    jz      @f
    mov     [eax], edi
@@:
    mov     eax, [esp+60]       ; Get pointer to HVM
    jz      @f
    mov     [eax], ebx          ; Return new VM handle
@@:

    popa
    ret     7*4
                        
EndCDecl System_Control@28

StartCDecl Simulate_IO@20

    push    ebx
    push    ebp
    push    esi
    push    edi

    mov     ebp, [esp+36]       ; address of Client_Reg_Struc
    mov     edx, [esp+32]       ; I/O port number
    mov     ecx, [esp+28]       ; type of I/O operation
    mov     ebx, [esp+24]       ; VM handle
    mov     eax, [esp+20]       ; data for output operations       
    
    VxDCall	Simulate_IO

    pop     edi
    pop     esi
    pop     ebp
    pop     ebx
    ret     5*4
                    
EndCDecl Simulate_IO@20

StartCDecl Install_Mult_IO_Handlers@4

    push    edi

    mov     edi, [esp+8]       ; points to an I/O table       
    
    VxDCall	Install_Mult_IO_Handlers
    setnc   al
    and     eax, 1

    pop     edi
    ret     1*4
                        
EndCDecl Install_Mult_IO_Handlers@4

StartCDecl Install_IO_Handler@8

    push    esi

    mov     edx, [esp+12]       ; I/O port number
    mov     esi, [esp+8]        ; points to callback procedure       
    
    VxDCall	Install_IO_Handler
    setnc   al
    and     eax, 1

    pop     esi
    ret     2*4
                        
EndCDecl Install_IO_Handler@8

StartCDecl Enable_Global_Trapping@4

    mov     edx, [esp+4]        ; I/O port number       
    
    VxDCall	Enable_Global_Trapping
    
    ret     1*4
                        
EndCDecl Enable_Global_Trapping@4

StartCDecl Enable_Local_Trapping@8

    push    ebx

    mov     edx, [esp+12]       ; I/O port number       
    mov     ebx, [esp+8]        ; VM handle

    VxDCall	Enable_Local_Trapping
    
    pop     ebx
    ret     2*4
                        
EndCDecl Enable_Local_Trapping@8

StartCDecl Disable_Global_Trapping@4

    mov     edx, [esp+4]        ; I/O port number       
    
    VxDCall	Disable_Global_Trapping
    
    ret     1*4
                        
EndCDecl Disable_Global_Trapping@4

StartCDecl Disable_Local_Trapping@8

    push    ebx

    mov     edx, [esp+12]       ; I/O port number       
    mov     ebx, [esp+8]        ; VM handle

    VxDCall	Disable_Local_Trapping
    
    pop     ebx
    ret     2*4
                        
EndCDecl Disable_Local_Trapping@8

StartCDecl Get_Profile_Decimal_Int@16

    push    esi
    push    edi
    push    ebx

    mov     eax, [esp+24]       ; points to default value
    mov     edi, [esp+20]       ; points to key name
    mov     esi, [esp+16]       ; points to section name

    VxDCall	Get_Profile_Decimal_Int

    xor     ebx, ebx            ; save return flags
    setc    bl
    setz    bh
    
    push    eax
    mov     eax, [esp+28]       ; store 'found' flags
    mov     [eax], ebx
    pop     eax

    pop     ebx
    pop     edi
    pop     esi

    ret     4*4
                        
EndCDecl Get_Profile_Decimal_Int@16

StartCDecl Get_Profile_Fixed_Point@20

    push    esi
    push    edi
    push    ebx

    mov     eax, [esp+28]       ; default
    mov     ecx, [esp+24]       ; num places
    mov     edi, [esp+20]       ; entry name
    mov     esi, [esp+16]       ; section name
        
    VxDCall	Get_Profile_Fixed_Point
    xor     ebx, ebx            ; save return flags
    setc    bl
    setz    bh
    
    push    eax
    mov     eax, [esp+28]       ; store 'found' flags
    mov     [eax], ebx
    pop     eax

    pop     ebx
    pop     edi
    pop     esi
    ret     5*4
                        
EndCDecl Get_Profile_Fixed_Point@20

StartCDecl Convert_Decimal_String@8
                
    mov     edx, [esp+4]        ; address of decimal string
    
    VxDCall	Convert_Decimal_String

    mov     ecx, eax            ; save return value in ecx
    mov     eax, [esp+8]        ; store converted value 
    mov     [eax], ecx
    mov     eax, edx            ; return pointer to end of string
    ret     2*4
                        
EndCDecl Convert_Decimal_String@8

StartCDecl Convert_Fixed_Point_String@12
                
    mov     edx, [esp+8]        ; address of fixed-point string
    mov     ecx, [esp+4]        ; no of decimal places

    VxDCall	Convert_Fixed_Point_String

    mov     ecx, eax            ; save return value in ecx
    mov     eax, [esp+12]       ; store converted value
    mov     [eax], ecx
    mov     eax, edx            ; return pointer to end of string
    ret     3*4
                        
EndCDecl Convert_Fixed_Point_String@12

StartCDecl Convert_Hex_String@8
                
    mov     edx, [esp+4]        ; address of hexadecimal string
    
    VxDCall	Convert_Hex_String

    mov     ecx, eax            ; save return value in ecx
    mov     eax, [esp+8]        ; store converted value
    mov     [eax], ecx
    mov     eax, edx            ; return pointer to end of string
    ret     2*4
                        
EndCDecl Convert_Hex_String@8

StartCDecl Convert_Boolean_String@8
                
    mov     edx, [esp+4]        ; address of Boolean string
    
    VxDCall	Convert_Boolean_String
    jc      @f

    mov     edx, eax
    and     edx, 1              ; convert -1 to 1
    mov     eax, [esp+8]        ; store boolean value
    mov     [eax], edx          
    mov     eax, 1              ; return TRUE
    ret     2*4

@@:             
    xor     eax, eax            ; not successful -return FALSE
    ret     2*4
                        
EndCDecl Convert_Boolean_String@8

StartCDecl Get_Profile_String@16

    push    ebx
    push    esi
    push    edi

    mov     edx, [esp+24]       ; default value
    mov     edi, [esp+20]       ; entry name
    mov     esi, [esp+16]       ; section name
    
    VxDCall	Get_Profile_String
    xor     ebx, ebx            ; save return flags
    setc    bl
        
    mov     eax, [esp+28]       ; store 'found' flags
    mov     [eax], ebx
    mov     eax, edx            ; return string


    pop     edi
    pop     esi
    pop     ebx
    ret     4*4
                        
EndCDecl Get_Profile_String@16

StartCDecl Get_Next_Profile_String@12

    push    edi
    push    ebx

    mov     edi, [esp+16]       ; points to keyname for entry       
    mov     edx, [esp+12]       ; points to previous entry value
    
    VxDCall	Get_Next_Profile_String
    xor     ebx, ebx            ; save return flags
    setc    bl
        
    mov     eax, [esp+28]       ; store 'found' flags
    mov     [eax], ebx
    mov     eax, edx            ; return string

    pop     ebx
    pop     edi
    ret     3*4
                        
EndCDecl Get_Next_Profile_String@12

StartCDecl OpenFile@12

    push    edi
    push    ebx

    mov     edi, [esp+16]       ; buffer to receive full path      
    mov     edx, [esp+12]       ; address of name of file to open
    
    VxDCall	OpenFile
    xor     ebx, ebx            ; save return flags
    setc    bl
        
    mov     eax, [esp+28]       ; store 'found' flags
    mov     [eax], ebx
    mov     eax, edx            ; return handle

    pop     ebx
    pop     edi
    ret     3*4
                    
EndCDecl OpenFile@12

StartCDecl Get_PSP_Segment@0

    VxDCall	Get_PSP_Segment
    ret     0*4
                        
EndCDecl Get_PSP_Segment@0

StartCDecl Set_PM_Int_Type@8

    mov     edx, [esp+8]        ; 0 if trap gate, else interrupt gate      
    mov     eax, [esp+4]        ; interrupt number
    
    VxDCall	Set_PM_Int_Type
    
    ret     2*4
                        
EndCDecl Set_PM_Int_Type@8

StartCDecl Get_Last_Updated_VM_Exec_Time@4

    push    ebx

    mov     ebx, [esp+8]        ; VM handle

    VxDCall	Get_Last_Updated_VM_Exec_Time

    pop     ebx
    ret     1*4
                        
EndCDecl Get_Last_Updated_VM_Exec_Time@4

StartCDecl Get_Name_Of_Ugly_TSR@4

    push    ebx

    VxDCall	Get_Name_Of_Ugly_TSR
    jz      @f

    mov     ecx, eax
    mov     eax, [esp+8]    ; Get pointer to TSR name
    mov     [eax], ecx      ; Store first 4 chars
    add     eax, 4
    mov     [eax], ebx      ; Store next 4 chars
    add     eax, 4
    xor     ebx, ebx
    mov     [eax], bl       ; Zero terminator

    mov     eax, 1          ; Return TRUE
    pop     ebx
    ret     1*4

@@:
    xor     eax, eax        ; Return FALSE
    pop     ebx
    ret     1*4
                    
EndCDecl Get_Name_Of_Ugly_TSR@4

StartCDecl Set_Physical_HMA_Alias@4

    push    esi
    push    edi

    mov     esi, [esp+12]       ; points to page-table entries for physical HMA alias

    VxDCall	Set_Physical_HMA_Alias
    
    pop     edi
    pop     esi
    ret     1*4
                        
EndCDecl Set_Physical_HMA_Alias@4

StartCDecl Get_Crit_Status_No_Block@8

    push    ebx

    VxDCall	Get_Crit_Status_No_Block
    setc    al
    and     eax, 1
    push    eax

    mov     eax, [esp+16]   ; Get pointer to count
    mov     [eax], ecx      ; Return count
    mov     eax, [esp+12]   ; Get pointer to VM handle
    mov     [eax], ebx      ; Return VM handle

    pop     eax
    pop     ebx
    ret     2*4
                        
EndCDecl Get_Crit_Status_No_Block@8

StartCDecl Call_When_Thread_Switched@4

    push    esi

    mov     esi, [esp+8]        ; thread switch callback

    VxDCall	Call_When_Thread_Switched
    
    pop     esi
    ret     1*4
                        
EndCDecl Call_When_Thread_Switched@4

StartCDecl Test_Cur_Thread_Handle@4

    push    edi

    mov     edi, [esp+8]        ; handle to thread

    VxDCall	Test_Cur_Thread_Handle

    setz    al
    and     eax, 1
    
    pop     edi
    ret     1*4
                        
EndCDecl Test_Cur_Thread_Handle@4

StartCDecl Get_Sys_Thread_Handle@0

    push    edi

    VxDCall	Get_Sys_Thread_Handle
    mov     eax, edi
    
    pop     edi
    ret     0*4
                        
EndCDecl Get_Sys_Thread_Handle@0

StartCDecl Test_Sys_Thread_Handle@4

    push    edi

    mov     edi, [esp+8]            ; handle to thread

    VxDCall	Test_Sys_Thread_Handle

    setz    al
    and     eax, 1
    
    pop     edi
    ret     1*4
                        
EndCDecl Test_Sys_Thread_Handle@4

StartCDecl Validate_Thread_Handle@4

    push    edi

    VxDCall	Validate_Thread_Handle

    setnc   al
    and     eax, 1
    
    pop     edi
    ret     1*4
                        
EndCDecl Validate_Thread_Handle@4

StartCDecl Get_Initial_Thread_Handle@4

    push    ebx
    push    edi

    mov     ebx, [esp+12]       ; VM handle
    VxDCall	Get_Initial_Thread_Handle
    mov     eax, edi

    pop     edi
    pop     ebx
    ret     1*4
                        
EndCDecl Get_Initial_Thread_Handle@4

StartCDecl Test_Initial_Thread_Handle@4

    push    edi

    mov     edi, [esp+8]       ; handle to thread
    VxDCall	Test_Initial_Thread_Handle
    setc    al
    and     eax, 1
        
    pop     edi
    ret     1*4
                        
EndCDecl Test_Initial_Thread_Handle@4

StartCDecl Get_Next_Thread_Handle@0

    push    edi

    VxDCall	Get_Next_Thread_Handle
    mov     eax, edi
    
    pop     edi
    ret     0*4
                        
EndCDecl Get_Next_Thread_Handle@0

StartCDecl Remove_IO_Handler@4

    mov     edx, [esp+4]        ; I/O port address
    VxDCall	Remove_IO_Handler
    setnc   al
    and     eax, 1
    
    ret     1*4
                        
EndCDecl Remove_IO_Handler@4

StartCDecl Remove_Mult_IO_Handlers@4

    push    edi

    mov     edi, [esp+8]        ; VxD I/O table
    VxDCall	Remove_Mult_IO_Handlers
    
    pop     edi
    ret     1*4
                        
EndCDecl Remove_Mult_IO_Handlers@4

StartCDecl Unhook_Device_Service@8

    push    esi

    mov     esi, [esp+8]

    VxDCall	Unhook_Device_Service
    setnc   al
    and     eax, 1


    pop     esi
    ret     2*4
                        
EndCDecl Unhook_Device_Service@8

StartCDecl Cancel_Call_When_Not_Critical@4

    push    esi

    mov     esi, [esp+8]
    VxDCall	Cancel_Call_When_Not_Critical
    setnc   al
    and     eax, 1
    
    pop     esi
    ret     1*4
                        
EndCDecl Cancel_Call_When_Not_Critical@4

StartCDecl Signal_Semaphore_No_Switch@4

    mov     eax, [esp+4]

    VxDCall	Signal_Semaphore_No_Switch
    
    ret     1*4
                        
EndCDecl Signal_Semaphore_No_Switch@4

StartCDecl Get_Crit_Status_Thread@8

    push    edi

    VxDCall	Get_Crit_Status_Thread
    setc    al
    and     eax, 1
    push    eax

    mov     eax, [esp+16]
    mov     [eax], edi      ; return thread
    mov     eax, [esp+12]    
    mov     [eax], ecx      ; return count

    pop     eax
    pop     edi
    ret     2*4
                        
EndCDecl Get_Crit_Status_Thread@8

StartCDecl Time_Slice_Sleep@4

    mov     eax, [esp+4]

    VxDCall	Time_Slice_Sleep
    setnz   al          ; return TRUE if sleep timed out
    and     eax, 1

    ret     1*4
                        
EndCDecl Time_Slice_Sleep@4

MakeCDecl _AddInstanceItem

MakeCDecl _Allocate_Device_CB_Area

MakeCDecl _Allocate_LDT_Selector

MakeCDecl _AllocateThreadDataSlot

MakeCDecl _Deallocate_Device_CB_Area

MakeCDecl _FreeThreadDataSlot

MakeCDecl _GetLastUpdatedThreadExecTime

MakeCDecl _GetThreadExecTime

MakeCDecl _ModifyPageBits

MakeCDecl _PageCommit

; Search for _TetradynePage in vxbuild.h and see comment there
StartCDecl _TetradynePageReserve
    VxDJmp _PageReserve
EndCDecl _TetradynePageReserve

StartCDecl _TetradynePageCommitPhys
    VxDJmp _PageCommitPhys
EndCDecl _TetradynePageCommitPhys

MakeCDecl _CopyPageTable

END

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions