The Windows® 95 Setup program can be fully automated using batch scripts. These scripts, which are very similar to INF files, specify what components to install and the parameters for those components. For a description of the standard setup batch script parameters, see the Windows 95 Resource Kit.
Installer DLL developers can add their own parameters to setup batch scripts using an NDI procedure. The function is passed a handle script that they can use to parse the setup script.
When Setup runs, it copies any setup script the user gave to Msbatch.inf in their c:\WINDOWS\INF directory. Whenever Setup or the Network Control Panel runs, it reads parameters out of this setup script. The NDI procedure is passed a handle to this setup script in the NDI_CREATE message. The function can call IpGetProfileString() to read parameters from the INF file.
#include <netdi.h> // also includes setupx.h
RETERR _loadds WINAPI TcpNdiProc(HNDI ndi, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RETERR reterr;
char szBuf[16];
switch (uMsg) {
case NDI_CREATE:
if ( lParam & NDI_CREATE_BATCHMODE ) {
// Read "MyParam=<string>" from "MyComponent" section
// in the batch inf file.
reterr = IpGetProfileString( (HINF) wParam,
"MyComponent",
"MyParam",
szBuf,
sizeof(szBuf) );
}
else {
// read from the registry or ini file ...
}
break;
// .... other messages ....
default:
CallDefProc:
return DefNdiProc(ndi,uMsg,wParam,lParam);
}
}