pnkiller78 Posted October 28, 2005 Share Posted October 28, 2005 (edited) @tommypthank tommy for the ! alternative, it worked...ok.. I figured out how to make directory recursion and read the contents of files... increment the directory number and everything... for the directory recursion i needed an extra tool, called munge found on this page, it allow you to replace strings inside files, i put on HFTOOLS folder.., it needed cause when you issue a DIR command with a /S switch it prints the absolute path of the directories it founds.. so, here we are working with relative paths, so they have to be cutted to only include the relative path..Sometimes, there are aplications (like SQL Server SQL-DMO) which requiries that certain files to be present within a folder structure hardcoded inside the application to work properly, and sometimes this structure have empty folders before reaching the folders with the actual files needed by the aplication. So, we must exclude those empty folders, and Windows Setup recreates the empty folders when it installs the files.To skip the folders not containing files (just subfolders), I had to put a DUMMY.FIL inside them, 'cause I couldn't figure out how to exclude empty folders in the final FOR inside the batch, so I created DUMMY.FIL file inside them and removed those folders with DUMMY files from the paths used in final list which will run the final FOR statement.One usefull thing with this it's that you can also put folders inside the system folders used by windows, and the script will include it the same way you create 'em, to test it try puting a folder inside system32 and you will see [WinntDirectories]601 = SYSTEM32\FolderName in TXTSETUP.SIFhere's the script@ECHO OFFCLSSET DIRNUMBER=600DIR HFEXPERT\* /AD /OGN /B /ON /S >WORK\HFOTHER.TXTDIR HFEXPERT\DUMMY.FIL /B /S /ON >WORK\HFOTHER1.TXTFINDSTR /E /V /I "APPREPLACEMENT HELP CODECS DRIVERS SYSTEM SYSTEM32" WORK\HFOTHER.TXT >WORK\HFOTHER2.TXTrem munging the WORK\HFOTHER1.TXT and WORK\HFOTHER2.TXT file to remove the absolute pathsECHO "%CD%\HFEXPERT\" ""> scriptFile.txtHFTOOLS\munge scriptFile.txt -t WORK\HFOTHER1.TXTHFTOOLS\munge scriptFile.txt -t WORK\HFOTHER2.TXTrem munging the DUMMY.FIL of WORK\HFOTHER1.TXT list of foldersECHO "\DUMMY.FIL" ""> scriptFile.txtHFTOOLS\munge scriptFile.txt -t WORK\HFOTHER1.TXTDEL /f /q scriptFile.txtrem removing directories with DUMMY.FIL from WORK\HFOTHER2.TXTSET LIST=FOR /F %%I IN (WORK\HFOTHER1.TXT) DO SET LIST=!LIST! %%IFINDSTR /E /V /I "%LIST%" WORK\HFOTHER2.TXT >WORK\HFOTHER3.TXTrem ...them I use WORK\HFOTHER3.TXT for the final part of the scriptFOR /F %%I IN (WORK\HFOTHER3.TXT) DO ( ECHO [WinntDirectories]>>SOURCESS\I386\TXTSETUP.SIF ECHO !DIRNUMBER! = %%I >>SOURCESS\I386\TXTSETUP.SIF DIR HFEXPERT\%%I /A-D /OGN /B /ON >WORK\HFEXPERT.TXT XCOPY HFEXPERT\%%I\*.* WORK\I386E /H /Y > nul REM COPY THE FILES ECHO [sourceDisksFiles] >>SOURCESS\I386\TXTSETUP.SIF FOR /F %%I IN (WORK\HFEXPERT.TXT) DO ( REM DO THE TXTSETUP.SIF ECHO %%I = 1,,,,,,,!DIRNUMBER!,0,0 ;HFEXPERT >>SOURCESS\I386\TXTSETUP.SIF REM DO THE DOSNET.INF ECHO d1,%%I ;HFEXPERT >>SOURCESS\I386\DOSNET.INF ) echo. >>SOURCESS\I386\TXTSETUP.SIF SET /A DIRNUMBER=!DIRNUMBER! + 1)rem cleaning temp TXT filesDEL /F /Q WORK\HFOTHER.TXTDEL /F /Q WORK\HFOTHER1.TXTDEL /F /Q WORK\HFOTHER2.TXTDEL /F /Q WORK\HFOTHER3.TXTrem see the result...CLSTYPE SOURCESS\I386\TXTSETUP.SIFDEL /F /Q SOURCESS\I386\TXTSETUP.SIFDEL /F /Q SOURCESS\I386\DOSNET.INFHope, this helps other people like me... Edited October 28, 2005 by pnkiller78 Link to comment Share on other sites More sharing options...
pnkiller78 Posted October 28, 2005 Share Posted October 28, 2005 As far as the W2K rollup goes. See if this does the trick. Rename the SYSTEM32\Windows Media\Server\NSCM.EXE to NSM.EXE. I thought I found that as a typo the other day and I corrected it, see if that file rename does the trick. Report back. I don't use WU, so I'll need your help with that. No, that didn't do the trick, i renamed the file and run WU and still tells me that Update rollup is not installed. Link to comment Share on other sites More sharing options...
tommyp Posted October 29, 2005 Author Share Posted October 29, 2005 @pnkiller78 - Try swapping the halmacpi.dll from the rollup back into the system32 folder. Test that out. It was a buggy dll that won't make your PC happy, but will make WU happy. Thanks for the scripting, I'll see if it all works, and if it does, I'll incorporate it. Thanks for the help!@dziubek - Are you getting the copy error during the txtmode copy stage? Are you installing from a CD? I just did an english version here on a real box and it works fine. Are you installing anything else to cause this? Check the version number of that dll in the sourcess folder. Google for the version number. Oh and see if it's a QFE type. Link to comment Share on other sites More sharing options...
Yzöwl Posted October 29, 2005 Share Posted October 29, 2005 @ pnkiller78 & tommypBased upon what I understood your needs to be, the following should allow you to add directories to HFEXPERT, update both dosnet.inf and txtsetup.sif accordingly and add the directories to the WORK\I386E directory. Tommy would just need to ensure that the folders are integrated into I386 okay.P.S. - no third party tools are required@echo off&setlocal enableextensions enabledelayedexpansionset basedir=%~dp0HFEXPERT\for /f "delims=" %%? in ('dir/b/s/on/ad HFEXPERT ^|findstr/i/e/v "appreplacement bin codecs drivers gre help system system32 win" ^2^>nul') do if errorlevel 0 dir/b/a-d %%? >nul 2>&1&&call :paths "%%~?"if not exist WORK\XpertDir.txt endlocal&goto :eofset "sifdir=599"&set "infdir=4"echo/[WinntDirectories]>WORK\TXTSETUP.DIRecho/[SourceDisksFiles]>WORK\TXTSETUP.FILecho/[Directories]>WORK\DOSNET.DIRecho/[Files]>WORK\DOSNET.FILfor /f "delims=" %%? in (WORK\XpertDir.txt) do ( set /a sifdir+=1 set /a infdir+=1 echo/!sifdir! = %%?>>WORK\TXTSETUP.DIR echo/d!infdir! = \I386\%%?>>WORK\DOSNET.DIR dir/b/on/a-d HFEXPERT\%%?>WORK\HFEXPERT.TXT for /f "delims=" %%? in (WORK\HFEXPERT.TXT) do ( echo/%%? = 1,,,,,,,!sifdir!,0,0 ;HFEXPERT>>WORK\TXTSETUP.FIL echo/d!infdir!,%%? ;HFEXPERT>>WORK\DOSNET.FIL ))copy WORK\TXTSETUP.DIR+WORK\TXTSETUP.FIL WORK\TXTSETUP.TMP>nul&&del /q WORK\TXTSETUP.DIR WORK\TXTSETUP.FILcopy WORK\DOSNET.DIR+WORK\DOSNET.FIL WORK\DOSNET.TMP>nul&&del /q WORK\DOSNET.DIR WORK\DOSNET.FILfor /f "delims=" %%? in (WORK\TXTSETUP.TMP) do echo/%%?>>SOURCESS\I386\TXTSETUP.SIFfor /f "delims=" %%? in (WORK\DOSNET.TMP) do echo/%%?>>SOURCESS\I386\DOSNET.INFdel /q WORK\TXTSETUP.TMP WORK\DOSNET.TMP WORK\XpertDir.txt WORK\HFEXPERT.TXTendlocal&goto :eof:pathsset DirName=%~1set PathName=!DirName:%basedir%=!echo/%PathName%>>WORK\XpertDir.txtxcopy "%DirName%" "WORK\I386E\%PathName%" /s/i/q/h/y>nulgoto :eof@ tommypjust a note to say that in line 3 I have included drivers and help in the findstr command, for pnkiller78s benefit only. Link to comment Share on other sites More sharing options...
pnkiller78 Posted October 29, 2005 Share Posted October 29, 2005 (edited) @YzöwlWow... That script really kick my **sI tested and it does the job, just one thing: AFAIK the files doesn't need to be copied to the WORK\I386E folder along with the folder structure, you just need to copy the files plain inside WORK\I386E, cause after that they are compressed by makecab and incoporated into the SOURCESS\I386.After that, during Windows Setup the structure is recreated inside WinNT isntallation directory using the directory numbers information stored in txtsetup.sif (somebody correct my if I'm wrong); apart of that is great, by the way: I didn't know that cmd prompt can do that... Well, i suppose that if tommy wants to include something it will be yours, mine it more simple and easy to understand for begginers (like me), but yours is more pro... it doesn't need any dummy files nor third party tools.. great.By the way, where do you think I can read a more professional doc about Command prompt scripting for Windows..., i would really want to learn...Thank you. Edited October 29, 2005 by pnkiller78 Link to comment Share on other sites More sharing options...
Crash&Burn Posted October 29, 2005 Share Posted October 29, 2005 Here's one I found, Rob van der Woude's Scripting Pages, that seemed to be better than any I'd seen before... Click on Batch files on the left page index. Link to comment Share on other sites More sharing options...
Yzöwl Posted October 29, 2005 Share Posted October 29, 2005 I added the directories for the simple reason that someone is bound to add sufficient additional folders plus subfolders to have matching filenames. At that point overwrites or the lack of will cause problems.The ideal, as I suggested in my last post would be to integrate the folders structure into I386 instead of just individual files.I am always asked about resources for learning, however other than whatever you can find on Google, everything I do is trial and error type learning. Link to comment Share on other sites More sharing options...
pnkiller78 Posted October 29, 2005 Share Posted October 29, 2005 I added the directories for the simple reason that someone is bound to add sufficient additional folders plus subfolders to have matching filenames. At that point overwrites or the lack of will cause problems.The ideal, as I suggested in my last post would be to integrate the folders structure into I386 instead of just individual files.OK, that's ok, but recreating that folder structure in the final SOURCESS\I386 would make that installation directory look a little overcharged... i see why you add the folder entries on DOSNET.INF [Directories] section, to allow WinSetup find the files in that folder structure inside I386 at install time.I would prefer just to compress the files and put'em on I386 using d1, filename.fil in DOSNET.INF, less cleaner I386 folder..for this to you only have to modify the line 31 where you xcopy the files along with the structure to just copy the files.. maybe a simple copy "%DirName%" "WORK\I386E" /y>nul Link to comment Share on other sites More sharing options...
dirtwarrior Posted October 29, 2005 Share Posted October 29, 2005 Does the .inf have entries to disable uneeded services? Maybe a few other reg tweaks too. Link to comment Share on other sites More sharing options...
tommyp Posted October 29, 2005 Author Share Posted October 29, 2005 @Yzöwl - You da man. That's the coolest thing I've seen. I'm in the middle of integrating it into HFS. I think I like it when files are all crammed into one place. So I modded it a bit so it's all packed into i386. I'll see if there is a need to put it into additional folders in i386 later. I would prefer to have it all packed into one place. Remember, the intent of HFSLIP isn't to make a big source and to slipstream programs. But if the need arises, maybe I'll have to change my tune. Again, thanks Yzöwl, you create the coolest scripts. Link to comment Share on other sites More sharing options...
tommyp Posted October 30, 2005 Author Share Posted October 30, 2005 I'm running into trouble finalizing Yzöwl's code (with some mods to HFSLIPify it). Can someone help me? Let's say your file/folder structure is this:SOURCESS\I386\FOLDER1SOURCESS\I386\FOLDER1\FILENAME1.FILSOURCESS\I386\FOLDER2SOURCESS\I386\FOLDER2\FILENAME2.FILWhat lines does txtsetup.sif need so that it finds the files during the file copy stage? The code below doesn't do it. What am I missing? [WinntDirectories]1000 = "FOLDER1" 1001 = "FOLDER2"[SourceDisksFiles]FILENAME1.FIL = 1,,,,,,,1000,0,0FILENAME2.FIL = 1,,,,,,,1001,0,0 Link to comment Share on other sites More sharing options...
Yzöwl Posted October 30, 2005 Share Posted October 30, 2005 Txtsetup.sif is only used to place files, not find them. The files added to it are only for inclusion into the %SYSTEMROOT% structure. i.e. all locations shown in [WinntDirectories] are relative to the location within %SYSTEMROOT% where the relevant files in [sourceDisksFiles] will be copied.I was under the impression that the files were all added using the [Files] and [Directories] sections of Dosnet.inf. This would tell the locations on the CD for the first phase of the unattended file copy process to a temporary location. At that point the Txtsetup file would be used to place the files in their final location from that temporary location. Link to comment Share on other sites More sharing options...
tommyp Posted October 30, 2005 Author Share Posted October 30, 2005 I plan on having two versions of HFEXPERT in the future. One is to just slipstream it along with the source (which works now). With this method, anything placed there will overwrite any existing binaries on a CD. But I also plan on having anther HFEXPERT structure where you place files/folders a different HFEXPERT subfolder. With the latter method, the folders you create will be additonal folders inside the I386 folder, so no binaries will overwrite. There may be some overlap there, but tinkering with txtsetup.sif is pretty limited. Anyway, with the code I presented in the post above, the files cannot be found on the cd. There must be something to put between the commas so the setup can find the files that are nested inside folders inside the i386 folder. I think this could be cool because you would be able to slipstream firefox and rip out IE. A perfect addition to the HFEXPERT hidden utility. Link to comment Share on other sites More sharing options...
pnkiller78 Posted October 30, 2005 Share Posted October 30, 2005 (edited) I'm running into trouble finalizing Yzöwl's code (with some mods to HFSLIPify it). Can someone help me? Let's say your file/folder structure is this:SOURCESS\I386\FOLDER1SOURCESS\I386\FOLDER1\FILENAME1.FILSOURCESS\I386\FOLDER2SOURCESS\I386\FOLDER2\FILENAME2.FILWhat lines does txtsetup.sif need so that it finds the files during the file copy stage? The code below doesn't do it. What am I missing? [WinntDirectories]1000 = "FOLDER1" 1001 = "FOLDER2"[SourceDisksFiles]FILENAME1.FIL = 1,,,,,,,1000,0,0FILENAME2.FIL = 1,,,,,,,1001,0,0Well, if the files filename1.fi_ and filename2.fi_ are in the <SourceDrive>:\I386 folder during setup it will work fine, but if they are located in <SourceDrive>:\I386\FOLDER1 and <SourceDrive>:\I386\FOLDER2 respectily it will not work, at least that FOLDER1 and FOLDER2 are declared in DOSNET.INF like this[Directories]d1 = \d2 = \folder1d3 = \folder2...[Files]d2, FILENAME1.FILd3, FILENAME2.FIL[]I think that there's an error on Yzöwl's script, not completely sure, but in DOSNET.INF, under [Directories], d1 = \ refers to the <SourceDrive>:\I386 folder, the files are actually there, that's why in the [Files] section you only especify the filename, in Yzöwl's script he creates the DOSNET.INF like this[Directories]d1 = \d2 = \I386\folder1d3 = \I386\folder2...[Files]d2, FILENAME1.FILd3, FILENAME2.FILI think that could be the problem because WinSetup would think that FILENAME1.FIL is in <SourceDrive>:\I386\I386\FOLDER1Personally i don't like the idea of recreating the needed folder structure under the <SourceDrive>:\I386 folder. Well imagine this situation.You put this files under you HFEXPERT\SYSTEM32 folder...HFEXPERT\SYSTEM32\MyDir\DllVer.dllHFEXPERT\SYSTEM32\YourDir\DllVer.dlland suppose that the file in <MyDir> is a newer version that the same file in <YourDir>, when those files get installed there would be 2 version of the same DLL in the system, one being older that another... I don't know if that could create problem in WinRegistry, but for me would be better just put everything you need under <SourceDrive>:\I386, there will be no need to alter DOSNET.INF with extra source folder in the [Directories] section, just throw the files with d1, FILENAME1.FIL, there would be a more clean <SourceDrive>:\I386 folder, not those strange directories scatered all over the place... and the need structure would be recreated by TXTSETUP.SIFas far as I know, somebody correct if I'm wrong, one of the functions of DOSNET.INF is to copy the source files on the hard disk during the textmode part of windows setup, I think is uses a folde called $WINNT$.$LS$ or something like that; after that, the final location of those files in created by the [WinntDirectories] section on TXTSETUP.SIF. So, i think that cosmetically is unncessary to recreate the custom folder structure under the sources media.The logic in my script is just to throw the files in WORK\I386E, then let HFSLIP compress them and add them at the end of DOSNET.INF using d1, FILANEMES.FIL, then I insert the final (and so needed) folder structure in [WinntDirectories] section in TXTSETUP.SIF along with their proper filenames declarations in then [sourceDiskFiles] section.That way, you just end with one version of any file, the source files stay in <SourceDrive>:\I386, and the ultimate goal of all this is reached succefull.Oh, by the way, i tested the halmacpi.dll thing, and it didn't work too, this file, I think, it's the Hardware abstraction layer (HAL.DLL) that end in system32... but this particular file (halmacpi.dll) is for multiprocessor systems kernel... that why I think that have nothing to do with my problem, cause my test system is an UniProccesor system, the proper hal.dll I think it's halaacpi.dll, cause in fact TXTSETUP.SIF rename the file properly acording to the detected system during installation, you can check out this in [Hal] section in TXTSETUP.SIF... I suppose the during the hardware detection WinSetup detect the type of system and TXTSETUP.SIF install the proper file, in my case I'm testing on "ACPI Uniprocesor PC", so setup uses the halaacpi.dll, rename it to hal.dll an install it... I compared the expanded halaacpi.dl_ that it's my in my sourcess media against my installed and running C:\winnt\system32\hal.dll and both files are the same..., that why I think that halmacpi.dll got nothing to do with the UpdateRollup problem in WU... and another clue it that in your previous HFSLIP version HFSLIP_51017 there were no problem with WU... everything worked like a charm... also, in this version there are some application which I was testing to install via a CMD file launched in SVCPACK.INF that now doesn't install, these program (Paint Shop Pro 9, and TextPad 4.7.3) I install them using MSI files and now if use the /log switch to see what happened they abort with this error in the logDEBUG: Error 2103 : Coudl not resolve path for shell folder 26MSI (s) (28:2C) Product JASC Paint Shop Pro 9 -- Internal error 2103, 26 Edited October 30, 2005 by pnkiller78 Link to comment Share on other sites More sharing options...
tommyp Posted October 30, 2005 Author Share Posted October 30, 2005 @pain, thanks for the info. About the windowsrollup. Are you still doing the network installation? Remember, HFSLIP is for a CD installation. With a CD install, all the files are there as are the registry changes. As far as the HFEXPERT thing goes, I don't plan on going to wild with dosnet.inf and HFEXPERT. Dosnet.inf isn't needed for a CD install. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now