home *** CD-ROM | disk | FTP | other *** search
- ; Copyright: (c) 1988-1994 Apple Computer, Inc. All Rights Reserved.
- ;
- ; Project: QuickTime for Windows
- ;
- ; Component: Data Handler
- ;
- ; Description: Function dispatcher
- ;
- ; ---------------------------------------------------------------------
- INCLUDE QTMACROS.INC
- INCLUDE dhlrsel.inc
-
- DGROUP GROUP _DATA
- _DATA SEGMENT PARA PUBLIC 'DATA'
- _DATA ENDS
-
- CODESEG SEGMENT PARA USE16 PUBLIC 'CODE'
- OPTION LANGUAGE:C
- .386
- ASSUME DS:DGROUP
-
- ; ***************************************************************
- ; * THESE JUMP TABLES MUST BE IN THE CORRECT ORDER, I.E. THE
- ; * SAME ORDER AS THE COMPONENT FUNCTION SELECTOR IDS. IF A
- ; * CALL IS NOT SUPPORTED, PUT A '0' (ZERO) IN THE TABLE ENTRY
- ; ***************************************************************
-
- ; jump table for selectors < 0 (standard component manger calls)
- ; NOTE that these are in reverse order, i.e. they are in the
- ; order of their call selectors, but negated.
- DataHJumpTableUnder0:
- EXTERN C DataHOpen:NEAR
- EXTERN C DataHClose:NEAR
- EXTERN C DataHCanDo:NEAR
- EXTERN C DataHVersion:NEAR
-
- DW DataHOpen ; -1
- DW DataHClose ; -2
- DW DataHCanDo ; -3
- DW DataHVersion ; -4
- DW 0 ; -5, Register
- DW 0 ; -6, Target
- DW 0 ; -7, Unregister
-
- ; jump table for selectors 1-255
- DataHJumpTableUnder256:
- EXTERN C DataHCanUseDataRef:NEAR
- EXTERN C DataHGetVolumeList:NEAR
- EXTERN C DataHGetDeviceIndex:NEAR
- EXTERN C DataHSetDataRef:NEAR
- EXTERN C DataHGetDataRef:NEAR
- EXTERN C DataHCompareDataRef:NEAR
- EXTERN C DataHResolveDataRef:NEAR
- EXTERN C DataHOpenForRead:NEAR
- EXTERN C DataHCloseForRead:NEAR
- EXTERN C DataHOpenForWrite:NEAR
- EXTERN C DataHCloseForWrite:NEAR
- EXTERN C DataHGetData:NEAR
- EXTERN C DataHPutData:NEAR
- EXTERN C DataHScheduleData:NEAR
- EXTERN C DataHFinishData:NEAR
- EXTERN C DataHTask:NEAR
- EXTERN C DataHFlushCache:NEAR
- EXTERN C DataHFlushData:NEAR
- EXTERN C DataHGetFileSize:NEAR
- EXTERN C DataHSetFileSize:NEAR
- EXTERN C DataHCreateFile:NEAR
- EXTERN C DataHGetPreferredBlockSize:NEAR
- EXTERN C DataHGetFreeSpace:NEAR
- EXTERN C DataHPreextend:NEAR
- EXTERN C DataHWrite:NEAR
- EXTERN C DataHGetScheduleAheadTime:NEAR
- EXTERN C DataHPlaybackHints:NEAR
- EXTERN C DataHSetOSFileReference:NEAR
- EXTERN C DataHGetOSFileReference:NEAR
-
- DW 0 ; 1
- DW DataHGetData ; 2
- DW DataHPutData ; 3
- DW DataHFlushData ; 4
- DW DataHOpenForWrite ; 5
- DW DataHCloseForWrite ; 6
- DW 0 ; 7
- DW DataHOpenForRead ; 8
- DW DataHCloseForRead ; 9
- DW DataHSetDataRef ; 10
- DW DataHGetDataRef ; 11
- DW DataHCompareDataRef ; 12
- DW DataHTask ; 13
- DW DataHScheduleData ; 14
- DW DataHFinishData ; 15
- DW DataHFlushCache ; 16
- DW DataHResolveDataRef ; 17
- DW DataHGetFileSize ; 18
- DW DataHCanUseDataRef ; 19
- DW DataHGetVolumeList ; 20
- DW DataHWrite ; 21
- DW DataHPreextend ; 22
- DW DataHSetFileSize ; 23
- DW DataHGetFreeSpace ; 24
- DW DataHCreateFile ; 25
- DW DataHGetPreferredBlockSize ; 26
- DW DataHGetDeviceIndex ; 27
- DW 0 ; 28
- DW 0 ; 29
- DW DataHGetScheduleAheadTime ; 30
-
- ; selector codes in the 0x100 range
- DataHJumpTableOver256:
- DW 0 ; 0x100 + 1
- DW 0 ; 0x100 + 2
- DW DataHPlaybackHints ; 0x100 + 3
-
- ; selector codes in the 0x200 range
- DataHJumpTableOver512:
- DW 0 ; 0x200 + 1
- DW 0 ; 0x200 + 2
- DW 0 ; 0x200 + 3
- DW DataHSetOSFileReference ; 0x200 + 4
- DW DataHGetOSFileReference ; 0x200 + 5
-
- ; **********************************************************************
- ; *
- ; * Name: DataHEntry
- ; *
- ; * Description:
- ; *
- ; * This is the entry point for dispatching of component manger
- ; * calls.
- ; *
- ; **********************************************************************
- PUBLIC C DataHEntry
- DataHEntry PROC FAR
- cmp bx,0
- je BadSelector ; no selector 0
-
- ; check for a negative selector id (standard component
- ; manager call)
- jl NegativeSelector ; skip if selector is negative
-
- ; check each section in the order of highest range to lowest
- ; range
-
- ; check for an out of range selector (beyond the 0x200 group)
- cmp bx,0200h+kDataHFunctionGroup512Count
- jge BadSelector
-
- ; check for a call in the 0x200 group
- cmp bx,0200h
- jge CheckSelector512
-
- ; check for a call in the 0x100 group
- cmp bx,0100h
- jge CheckSelector256
-
- ; it is a call selector less than 256, convert to zero-based
- ; index and double to make a word index
- dec bx
- add bx,bx
-
- ; make sure the function pointer is non-zero
- mov ax,WORD PTR DataHJumpTableUnder256[bx]
- or ax,ax ; zero?
- je BadSelector ; yes, unsupported call
-
- ; dispatch the call
- MOV AX, DGROUP ; Set DS for this DLL
- MOV DS, AX
- jmp WORD PTR cs:DataHJumpTableUnder256[bx];
-
- CheckSelector256:
- ; strip high byte to make less than 256, convert to zero-based
- ; index and double to make a word index
- and bx,0ffh
- cmp bx,kDataHFunctionGroup256Count ; insure it's within range
- jg BadSelector
- dec bx
- add bx,bx
-
- ; make sure the function pointer is non-zero
- mov ax,WORD PTR DataHJumpTableOver256[bx]
- or ax,ax ; zero?
- je BadSelector ; yes, unsupported call
-
- ; dispatch the call
- MOV AX, DGROUP ; Set DS for this DLL
- MOV DS, AX
- jmp WORD PTR cs:DataHJumpTableOver256[bx];
-
-
- CheckSelector512:
- ; strip high byte to make less than 512, convert to zero-based
- ; index and double to make a word index
- and bx,0ffh
- cmp bx,kDataHFunctionGroup512Count ; insure it's within range
- jg BadSelector
- dec bx
- add bx,bx
-
- ; make sure the function pointer is non-zero
- mov ax,WORD PTR DataHJumpTableOver512[bx]
- or ax,ax ; zero?
- je BadSelector ; yes, unsupported call
-
- ; dispatch the call
- MOV AX, DGROUP ; Set DS for this DLL
- MOV DS, AX
- jmp WORD PTR cs:DataHJumpTableOver512[bx];
-
- NegativeSelector:
- NEG BX ; Make positive
- cmp bx,kDataHFunctionGroupNegativeCount ; insure it's within range
- jge BadSelector
- DEC BX ; One relative to zero relative
- ADD BX, BX ; WORD offset to byte offset
- MOV AX, DGROUP ; Set DS for this DLL
- MOV DS, AX
- JMP WORD PTR cs:DataHJumpTableUnder0[BX]
-
- BadSelector:
- MOV DX,8000h ; Load special error return
- MOV AX,8002h ; badComponentSelector
- RET
-
- DataHEntry ENDP
-
- CODESEG ENDS
- END