The following example illustrates checking the incoming BIND image using these features of SLI_OPEN.
lua_vcb.specific.open.lua_open_extension[0].lua_routine_type =
LUA_ROUTINE_TYPE_BIND;
strcpy(lua_vcb.specific.open.lua_open_extension[0].lua_module_name,
"WINSLI32");
strcpy(lua_vcb.specific.open.lua_open_extension[0].lua_procedure_name,
"BindValidation");
lua_vcb.specific.open.lua_open_extension[1].lua_routine_type =
LUA_ROUTINE_TYPE_END;
The following is the skeleton of a sample bind validation callback code for Windows 3.x:
VOID FAR PASCAL BindValidation ( LUA_VERB_RECORD FAR * pVerb )
{
pVerb->common.lua_prim_rc = LUA_STATE_CHECK;
}
Note: For Microsoft Visual C++ 4.0 or 5.0 and Windows 95 or Windows NT, the function prototype should be:
VOID WINAPI BindValidation (LUA_VERB_RECORD FAR * pVerb );
On Windows 95 and Windows NT, the WINAPI macro equates to _STDCall.
The BIND routine has access to the LUA VCB passed to it. The BIND routine should validate the BIND and indicate the appropriate SLI primary and secondary return code in the LUA verb record. Also, the routine may indicate the primary and secondary RU sizes supported by the SLI program by setting bytes 10 and 11 in the common.lua_data_ptr field (where the BIND command is indicated).
The following are the Visual C++ compiler options for the module containing the callback:
/FA -c -Zle -W3 -WX -Ge -Gy -Gz -Ox -Zd
-DCONDITION_HANDLING -DSTD_CALL
-Di386=1 -D_X86_ -DNT_UP -DWIN32 -DDEVL
-D_DLL -D_MT -DWIN32_SUPPORT
The following is the code generated for the callback:
PUBLIC _BindValidation@4
; COMDAT _BindValidation@4
_TEXT SEGMENT
_pVerb$ = 8
_BindValidation@4 PROC NEAR ; COMDAT
// pVerb->common.lua_prim_rc = LUA_STATE_CHECK;
mov eax, DWORD PTR _pVerb$[esp-4]
mov WORD PTR [eax+4], 512 ; 00000200H
ret 4
_BindValidation@4 ENDP
_TEXT ENDS
The following is the code generated by SLI to call this callback:
// (*aSCB->bind_rtn)(sliVCB);
push ebp
call DWORD PTR [ebx+188]
// note there is no ADD ESP,4 following the call
The following is the client internal trace showing WINSLI detecting the user provided bind validation callback:
|00000157.000000f7 OUDMD Opening User DLL Modules
|00000157.000000f7 OUDMD Opening a Bind Routine
|00000157.000000f7 OUDMD Opening DLL = WINSLI32
|00000157.000000f7 OUDMD Loading Routine = BindValidation
The following is client internal trace showing the bind validation callback:
|00000157.0000015c CLUAD Calling BIND Routine
|00000157.0000015c CLUAD Return from BIND routine, prc=512
|00000157.0000015c CLUAD Returned With Error From Routine
|00000157.0000015c FrRUI Freeing RUI vcb = 0x14E424
|00000157.0000015c BINDP USER BIND ROUTINE FAILED
The following is an API trace to show the bind validation error:
000015c SLI ---------------------------------------------- 11:11:52.28
000015c SLI SLI_OPEN post
000015c SLI SESSION_FAILURE - NEG_RSP_FROM_BIND_ROUTINE
000015c SLI ---- Verb Parameter Block at address 00405150 ----
000015c SLI 52004900 000F0000 00000039 01000000
<R.I........9....>
000015c SLI 00000000 4C553220 20202020 48000000
<....LU2 H...>
000015c SLI 88E01400 00000400 C0904000 F4000000
<h.........@.4...>
000015c SLI 00000000 00000000 00000040 00000000
<...........@....>
000015c SLI 00000000 02000000 0157494E 534C4933
<.........WINSLI3>
000015c SLI 32004269 6E645661 6C696461 74696F6E
<2.BindValidation>
000015c SLI 00000000 00000000 00000000 00000000
<................>
000015c SLI 00000000 00000000 00000000 00000000
<................>
000015c SLI 00000000 00000000 00000000 00000000
<................>
000015c SLI 00000000 00000000 00000000 00000000
<................>
000015c SLI 00000000 00000000 00000000 00000000
<................>
000015c SLI 00000000 00000000 00000000 00000000
<................>
000015c SLI 00000000 00000000 0000
<.......... >
000015c SLI ---- Data at address 004090C0 ----
000015c SLI 86998584
<fred >