A.3.5.2  DLLs in Detect Sections

In a detect section, the line to call a DLL function has the following format:

var = value ? LibHandle_or_Path FunctionName [Args]*

 

This is similar to other detect lines that use the var = value format. If the detect section is called using the read-syms command, value is assigned to var. But if the detect section is called using the detect command, the DLL function is called to get a value assigned to var.

LibHandle_or_Path

This can be a handle to a library module returned by a LoadLibrary command executed in a shell or install section. Alternatively, it can be a string containing the full or partial path of the DLL file.

FunctionName

Name of the DLL function to call (case-sensitive).

Args

Zero or more argument strings.

The DLL function called from a detect section must conform to the prototype shown below. The function’s return value indicates the actual number of bytes returned by the function in the lpszValue buffer. If the return value is greater than the size of the buffer, cbValue, the Setup program reallocates the buffer to the specified size and recalls the function.

UINT FunctionName(lpszArgs[], cArgs, lpszValue, cbValue)
LPSTR lpszArgs[];
USHORT cArgs;
LPSTR lpszValue;
UINT cbValue);

lpszArgs[]

An array of string arguments.

cArgs

The number of arguments in the lpszArgs array.

lpszValue

Points to a buffer allocated by the Setup program, to receive the value assigned to the variable in the INF file.

cbValue

Size, in bytes, of the buffer pointed to by lpszValue.