DRA --> Program Logic Manual

FUN interceptors

A FUN interceptor is installed for each main or DLL function to be intercepted. This is done by modifying the Function Descriptor Control Block (FDCB).
The function address in the FDCB is modified to point to the interceptor instead of the function. The original function address is saved. When the application program calls the function then the FUN interceptor gets control and calls the function through the saved address.

FUN interceptors are installed when
option MAIN is specified. In this case DRAINSTM calls DRAFUN00 for each function (FDCB) found in the main application program.
option DLL is specified and the DLL is loaded explicitely. This means the FDCB of every function must be obtained by making a "query function". This is a call to CEEPQDF, which is intercepted by DRAL273. In this case, DRAL273 calls DRAFUN00 to install a FUN interceptor.
option DLL is specified and the DLL is loaded implicitely. This means the DLL is loaded "automatically" as soon as one of its functions is called by the application program. In this case, the DLL is loaded by CEEPTLOR, which is intercepted by DRAL275.
CEEPTLOR (DRAL275) is called via a static stub in the application program. Depending on which stub called CEEPTLOR, one of the following modules is called:
- if called by CEEPTLC: DRAL275 calls DRADLL10
- if called by @@TRGLOC: DRAL275 calls DRADLL20
- if called by @@TRGLOR: DRAL275 calls DRADLL30

DRADLL10, DRADLL20 abd DRADLL30 calls DRAFUN00 for each DLL function found in the loaded DLL.

module caller description calls...
DRAFUN00 DRAINSTM DRAL273 DRADLL10 DRADLL20 DRADLL30 modifies the FDCB to point to the function interceptor DRAFUN05
DRAFUN05 DRAFUN00 if option FUN is specified, checks the filter string if an interceptor should to be installed for this function
DRAFUN10 Application program through modified FDCB interceptor for function with STANDARD linkage DRAFUN30
DRAFUN20 Application program through modified FDCB interceptor for function with FASTLINK linkage DRAFUN30
DRAFUN30 DRAFUN10 DRAFUN20 if option TREE is specified, includes the function in the TREE