Got it! "You must include 128 to set the default path of the installation to the location of the INF, otherwise a system-provided INF is assumed." (from the page Martin referred to.)
@Martin: No problem and thanks for setting me in the right direction.
After reading the article mentioned by Ver Greeneyes, I had a better idea of what I was looking for and found several other threads here all referring to the rundll32 setupapi method. They usually include a path in front of the setup.inf file. I assumed that if I ran that command from within the folder that contains setup.inf that it would work without requiring a path (that Windows would look in the current folder before checking in the system path). Only when I provide a complete path to setup.inf, even if rundll32 is in the same folder, does this work.
As a bonus, it appears that it suppresses the invalid files error message that shows up when I right-click and install.
@Ricktendo64: I tried placing the setup.inf file in the Windows\inf folder, but that didn't work, probably because the other files it looks for weren't there.
Here are the files I extracted from SCESP4I.exe:
CODE
Directory of C:\TestInf
05/31/2007 07:18 AM <DIR> .
05/31/2007 07:18 AM <DIR> ..
07/16/1998 02:15 PM 1,215,720 immc.exe
10/15/1998 11:04 AM 734,517 mssce.cab
10/15/1998 11:04 AM 222,976 mssce.exe
10/15/1998 11:04 AM 11,830 readme.txt
10/15/1998 11:04 AM 37,136 regsvr32.exe
10/15/1998 11:04 AM 1,462 scefiles.inf
10/15/1998 11:04 AM 267 scesetup.inf
10/15/1998 11:04 AM 8,219 setup.inf
05/31/2007 07:18 AM <DIR> symbols
I doubt that all of those files are really required, but I don't know how to tell which are and which aren't. Evidently, I need to extract the archive into a folder and include the path to that folder in the rundll32 command regardless of where rundll32 is executed from:
CODE
rundll32 setupapi,InstallHinfSection DefaultInstall 128 C:\testinf\setup.inf
That works! I'll use system variables in the path when I actually do this.
The two remaining questions are, what needs to be included in the folder and barring that, how to I extract the exe archive THEN run setup? Here's what setup looks like:
CODE
[Version]
Signature="$Windows NT$"
AdvancedINF=2.5
ExtensionGUID = {d0e72d64-e6ab-11d1-9362-00c04fd92f7b}
Title=%SCETITLE%
LayoutFile=SCEFILES.INF
; Main
[AppInstall]
RegCheck = HKLM,Software\Microsoft\Windows NT\CurrentVersion,,CurrentVersion,>=4.0,%WrongNTVersion%
RegCheck = HKLM,Software\Microsoft\Windows NT\CurrentVersion,,CSDVersion,>=Service Pack 4,%WrongNTServicePack%
UserCheck = ,Administrators,%LogonAsAdmin%
Switch = C,%InstallCmdLineHelp%,\ ;Help for this switch
MFCCheck, \ ;Check for MFC42U.DLL
InstallCmdLine,\ ;Command Line install
CmdLineCheckInstall,\ ;Make sure installion succeded.
SecureDirectory,\ ;Secure our directory.
PostSecureDirectory,\ ;Delete SCP path item
DefFinish ;Display message to user
Switch = ,%DefaultInstallHelp%,\ ;Help for this switch.
MFCCheck,\ ;Check for MFC42U.DLL
CheckForIE,\ ;Checks to make sure IE was installed
DefPromptUser,\ ;Prompt user with install message.
CheckMMCVer,\ ;Install MMC
DefaultInstall,\ ;Copy SCE files and register the DLLS
CmdLineCheckInstall,\
DefCheckInstallation,\ ;Make sure registration completed successfuly
CheckForMMC,\ ;Makes sure MMC was installed
SecureDirectory,\ ;Secure our directory.
PostSecureDirectory,\ ;Delete SCP path item
DefFinish ;Tell the user we finished successfuly
;Alpha check the version of MFC42U.DLL
[MFCCheck.NTAlpha]
; Reverse version check.
FileCheck = %11%\MFC42U.DLL,==4.21.0.7022,%IncompatibleFileVersion%,FC_VERTRUE_END
; Install command line only
[InstallCmdLine]
PreInstallPrompt = %InstallQuestionCmd%
FileCheck = %11%\WLDAP32.DLL,>=5.0,%FileNotFound%
CopyFiles = CmdLineCopy,InfCopy,SceTemplatesCopy,AcluiHelpCopy
Addreg = MMCReg
PostRunApp = PostSetupCmdSection
; Make sure command line was installed correctly.
[CmdLineCheckInstall]
RegCheck = HKLM,Software\Microsoft\Windows Nt\CurrentVersion\Secedit,,,,%SetupNotComplete%
FileCheck =%11%\SceDLL.dll,,%SetupNotCompleteFile%
FileCheck =%11%\secedit.exe,,%SetupNotCompleteFile%
; Check for the version of the MMC file, if it's later then do nothing.
[CheckMMCVer]
FileCheck =if( %11%\MMC.EXE,>5.00.1713.1 ) == SETUP_NORMAL,END,RUN(InstallMMCOnly)
; Prompt user to install MMC.
[InstallMMCOnly]
InstallPrompt = %InstallMMCQ%,,MB_YESNOCANCEL|MB_ICONQUESTION
InstallPrompt = %InstallMMCWarn%,,MB_OK|MB_ICONEXCLMATION
PostRunApp = RunMMC
;Make sure IE is installed.
[CheckForIE]
FileCheck = %11%\WLDAP32.DLL,,%WrongIEVersion%
FileCheck = %11%\SHLWAPI.DLL,,%WrongIEVersion%
FileCheck = %11%\URLMON.DLL,,%WrongIEVersion%
FileCheck = %11%\WININET.DLL,,%WrongIEVersion%
;Default installation prompt
[DefPromptUser]
PreInstallPrompt = %InstallQuestionDef%
;Make sure MMC was installed.
[CheckForMMC]
RegCheck = HKLM,Software\Microsoft\MMC,,,,%MMCNotInstalled%
; i386 Install everything
[DefaultInstall]
CopyFiles = CmdLineCopy, SceTemplatesCopy, WinSysCopy, InfCopy, ,AcluiHelpCopy
RegisterDll = RegisterDLLSection
Addreg = MMCReg
; Alpha install.
;[DefaultInstall.NTAlpha]
; CopyFiles = CmdLineCopyNTAlpha, SceTemplatesCopy, WinSysCopy, InfCopy, ,AcluiHelpCopy
; RegisterDll = RegisterDLLSection
; Addreg = MMCReg
;Make sure our reg key exists.
[DefCheckInstallation]
RegCheck = HKLM,Software\Microsoft\MMC\SnapIns\{803E14A0-B4FB-11D0-A0D0-00A0C90F574B},,,,%SetupNotCompleteMMC%
; Success ful message
[DefFinish]
PostInstallPrompt = %FinishMessage%
; Directory Creation area, and where to copy.
[DestinationDirs]
; SCE stuff.
SceDirCopy=25, Security
SceTemplatesCopy = 25, Security\Templates
WinSysCopy=11,
CmdLineCopy=11
InfCopy=25, Inf
AclUiHelpCopy=25,help
; Install MMC
[RunMMC.NTx86]
IMMC.EXE
[RunMMC.NTAlpha]
AMMC.EXE
; Secure out directoies and registry keys.
[PostSecureDirectory]
DelReg = DelRegSecEdit
PostRunApp = DeleteSetupSAD
[SecureDirectory]
FileCheck = %11%\scedll.dll,,%FileNotFound%
FileCheck = %11%\secedit.exe,,%FileNotFound%
PostRunApp = RunSecureDirectory
[RunSecureDirectory]
secedit.exe /configure /areas FILESTORE REGKEYS /cfg .\scesetup.inf /db %25%\security\database\scesetup.sdb /overwrite
[DeleteSetupSAD]
del /F /Q %25%\security\database\scesetup.sdb
[RegisterDLLSection]
%11%\Scedll.dll
%11%\wsecedit.dll
; If the register section didn't work, then we'll do this instead.
[PostSetupCmdSection]
regsvr32.exe %11%\scedll.dll /s
regsvr32.exe %11%\wsecedit.dll /s
[MMCPostSetupCmdSection]
regsvr32.exe %11%\mmcndmgr.dll /s
regsvr32.exe %11%\hhctrl.ocx /s
regsvr32.exe %11%\itss.dll /s
regsvr32.exe %11%\itircl.dll /s
; BEGIN Register section
[MMCreg]
HKCR,.msc,,2,mscfile
HKCR,mscfile\shell\open\command,,,"%11%\MMC.EXE ""%%1"""
HKCR,Clsid\%CLSID_RSHX_NTFS%,,,%DESCRIPTION%
HKCR,Clsid\%CLSID_RSHX_NTFS%\InProcServer32,,,%MODULENAME%
HKCR,Clsid\%CLSID_RSHX_NTFS%\InProcServer32,"ThreadingModel",,Apartment
HKCR,*\%SHEXPS%\%CLSID_RSHX_NTFS%,,,
HKCR,Drive\%SHEXPS%\%CLSID_RSHX_NTFS%,,,
HKCR,Directory\%SHEXPS%\%CLSID_RSHX_NTFS%,,,
HKCR,Clsid\%CLSID_BRIEFCASE%\%SHEXPS%\%CLSID_RSHX_NTFS%,,,
[DelRegSecEdit]
HKLM,Software\Microsoft\Windows Nt\CurrentVersion\Secedit,DefaultProfile
HKLM,Software\Microsoft\Windows Nt\CurrentVersion\Secedit,TemplateUsed
; END Registr section
; BEGIN Copy Files sections
; Template files to %windir%\security\templates
[AclUiHelpCopy]
Aclui.hlp,,,32
[SceTemplatesCopy]
securws4.inf,,,32
securdc4.inf,,,32
basicwk4.inf,,,32
basicsv4.inf,,,32
basicdc4.inf,,,32
compws4.inf,,,32
compdc4.inf,,,32
hisecws4.inf,,,32
hisecdc4.inf,,,32
off97sr1.inf,,,32
; Win sys copy to %windir%\system32
[CmdLineCopy]
; Sec edit.
SeCEdit.exe,,,32
scedll.dll,,,32
Aclui.dll,,,32
Rshx32_5.dll,,,32
; Jet enjine
esent.dll,,,32
esentprf.dll,,,32
esentutl.exe,,,32
; ACL editor dlls.
[CmdLineCopyNTAlpha]
; Sec edit.
SeCEdit.exe,,,32
scedll.dll,,,32
; ACL editor dlls.
Aclui.dll,,,32
Rshx32_5.dll,,,32
; Jet enjine
esent.dll,,,32
esentprf.dll,,,32
esentutl.exe,,,32
mfc42u.dll,,,32
[WinSysCopy]
; Secedit Executables.
wsecedit.dll,,,32
[InfCopy]
SCEregvl.inf,,,32
; String declartions
[Strings]
WrongNTVersion="You must install Microsoft Windows NT 4.0 or greater."
WrongNTServicePack="You must install Microsoft Windows NT 4.0 Service Pack 4."
WrongIEVersion="You must install Microsoft Internet Explorer 3.0 or greater."
LogonAsAdmin="You must be logged on as adminitrator."
SCETITLE="Microsoft Windows NT Security Configuration Manager"
DISKTITLE="Microsoft Windows NT Service Pack 4 CD"
FinishMessage="Setup completed successfully."
InstallCmdLineHelp="Install command line tools only."
InstallMMCOnlyHelp="Install MMC only."
MMCNotInstalled="You must install Microsoft Management."
DefaultInstallHelp="Default installation installs the UI and command line tools."
MODULENAME=rshx32_5.dll
DESCRIPTION=Security Shell Extension
SHEXPS=shellex\PropertySheetHandlers
InstallQuestionDef="Install Microsoft Windows NT Security Configuration Editor - Full install?"
InstallQuestionCmd="Install Microsoft Windows NT Security Configuration Editor - Command line tool only?"
CLSID_RSHX_NTFS={1f2e5c40-9550-11ce-99d2-00aa006e086c}
CLSID_BRIEFCASE={85BBD920-42A0-1069-A2E4-08002B30309D}
InstallMMCQ="Would you like to Install Microsoft Management Console?"
InstallMMCWarn="This portion of setup may request that you reboot your computer. Please reboot the computer and run setup again if you are asked to do so."
SetupNotCompleteFile="MSSCE did not complete successfully. File '%0' not found."
SetupNotComplete="Setup did not complete successfully! Please run setup again"
SetupNotCompleteMMC="Microsoft Management console was not found. Please run setup again and install Microsoft Manage Console."
IncompatibleFileVersion="'%0' is incompatible with Security Configuration Editor. Please install a compatible version before installing Security Configuration Editor. Setup aborting"
Can anyone tell from that which files from the archive are actually required?
If not, I can copy the archive into a folder during unattended install and have cmdlines extract it before using the rundll command (then delete the folder). Or is there a way to include all of this in an installer or addon so that rundll32 finds setup.inf and any of the other files it needs?
Thanks for the very good information. I learn something new here everyday.
Ray