Jump to content

Recursive file search


 Share

Recommended Posts

Use DISM 10 on Win 7 online and source folder contains 12 drivers all drivers successfully copied to new folder structure.

DISM 10 export drivers from offline Win 7, source folder contains 10 drivers and only half the drivers get copied to destination.

That's what's got me baffled.

Link to comment
Share on other sites

Yes I checked and double checked. EXAMPLE: nv_dispi.inf_x86_neutral_86a60910630f5129 and nv_dispiwu.inf_x86_neutral_a49377ab801ab8a9 are newer and older version nvidia drivers. Online they both get copied offline only one gets copied.

I tested from PE exporting from the same partition I was testing online. from PE out of 12 drivers only 6 were copied online all 12 are copied. Same scenario from Windows booting to different partition.

Using [SourceDiskFiles] some of the older drivers list some of the needed files under different titles and I only get a few of the needed files. but that has nothing to do with the online\offline problem.

Example of an old sound blaster driver inf from this I only get 3 files most of the needed files are in a subfolder

This is an old Sound Blaster Audigy driver still working on Win 7
I left out a bunch of registry entries
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;   Device Install Section   ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;**************** NT Install ****************
;;
;;**************** CTAudio_Device ****************
[CTAudio_Device.NTX86.CoInstallers]
CopyFiles=CoInst.CopyList.ntx86
AddReg=COINST.AddReg

[CTAudio_Device.NTAMD64.CoInstallers]
CopyFiles=CoInst.CopyList.ntamd64
AddReg=COINST.AddReg

[CTAudio_Device.NTX86]
Include=ks.inf, wdmaudio.inf
Needs=KS.Registration, WDMAUDIO.Registration
CopyFiles=SysFiles.CopyList.ntx86,P17RES.CopyList.ntx86,APO.CopyList.ntx86,APOINI.CopyList.ntx86,others.CopyList.ntx86,coinst.CopyList.ntx86
AddReg=CTAudio_Device.AddReg.ntx86,Resource.AddReg.ntx86,CoInst.AddReg
RegisterDlls=APO.RegisterDlls.ntx86
;AddProperty=CTDev.AddProperty

[CTAudio_Device.NTAMD64]
Include=ks.inf, wdmaudio.inf
Needs=KS.Registration, WDMAUDIO.Registration
CopyFiles=SysFiles.CopyList.amd64,P17RES.CopyList.amd64,APO.CopyList.amd64,APOINI.CopyList.amd64,SysWow64.CopyList.amd64,others.CopyList.ntamd64,coinst.CopyList.ntamd64
AddReg=CTAudio_Device.AddReg.amd64,Resource.AddReg.amd64,CoInst.AddReg
RegisterDlls=APO.RegisterDlls.amd64
;AddProperty=CTDev.AddProperty

[APO.CopyList.ntx86]
P17APO32.dll
P17pld32.dll
OemSpiE.dll
P17RunE.dll

[APO.CopyList.amd64]
P17APO64.dll
P17pld64.dll

[SysWow64.CopyList.amd64]
P17APO32.dll
OemSpiE.dll
P17RunE.dll

[APO.RegisterDlls.ntx86]
11,,P17APO32.dll,1
11,,P17pld32.dll,1

[APO.RegisterDlls.amd64]
11,,P17APO64.dll,1
11,,P17pld64.dll,1

[APOINI.CopyList.ntx86]
P17EP.ini
P17EPLS.ini
P17EP51.ini
ResDefE.exe

[APOINI.CopyList.amd64]
P17EP.ini
P17EPLS.ini
P17EP51.ini
ResDefE.exe

[others.CopyList.ntx86]
AddCat.exe
P17APO32.p17
APOIM32.exe
AppSetup.exe

[others.CopyList.ntamd64]
AddCat.exe
P17APO64.p17
APOIM64.exe
AppSetup.exe

[coinst.CopyList.ntx86]
ctzapxx.ini
ludap17.ini
ctcoins1.dll
ctdvins1.dll

[coinst.CopyList.ntamd64]
ctzapxx.ini
ludap17.ini
ctcoins1.dll
ctdvins1.dll

;;;;;;;;;;;;;;;;;;;;;;;;
;;   Common Section   ;;
;;;;;;;;;;;;;;;;;;;;;;;;

[DestinationDirs]
DefaultDestDir      = 10,system32\drivers
SysFiles.CopyList.ntx86 = 10,system32\drivers       ; %SystemRoot%\system32\drivers
SysFiles.CopyList.amd64 = 10,system32\drivers       ; %SystemRoot%\system32\drivers
P17RES.CopyList.ntx86   = 11                ; (Win9X)%Windows%\system,(WinNT)%SystemRoot%\system32
P17RES.CopyList.amd64   = 11                ; (Win9X)%Windows%\system,(WinNT)%SystemRoot%\system32
APO.CopyList.ntx86  = 11                ; (Win9X)%Windows%\system,(WinNT)%SystemRoot%\system32
APO.CopyList.amd64  = 11                ; %SystemRoot%\system32
APOINI.CopyList.ntx86   = 10                ; %SystemRoot%
APOINI.CopyList.amd64   = 10                ; %SystemRoot%
SysWow64.CopyList.amd64 = 10,SysWow64           ; %SystemRoot%\SysWow64                 

others.CopyList.ntx86   = 11
others.CopyList.ntamd64 = 10,SysWow64
coinst.CopyList.ntx86   = 11
coinst.CopyList.ntamd64 = 11


[SourceDisksNames]
101 = %DriverDisk%,,

[SourceDisksFiles]
P17res.dll      = 101,Win2k_xp
P17.sys         = 101,Win2k_xp\I386
P17EP.ini       = 101,Win2k_xp
P17EPLS.ini   = 101,Win2k_xp
P17EP51.ini   = 101,Win2k_xp
P17APO32.dll    = 101,Win2k_xp\I386
P17pld32.dll    = 101,Win2k_xp\I386
OemSpiE.dll     = 101,Win2k_xp
P17RunE.dll     = 101,Win2k_xp
ResDefE.exe = 101,Win2k_xp

ctzapxx.ini = 101
ludap17.ini = 101
AddCat.exe  = 101,Win2k_xp
P17APO32.p17    = 101,Win2k_xp\I386
APOIM32.exe = 101,Win2k_xp\I386
AppSetup.exe    = 101,Win2k_xp 

ctcoins1.dll    = 101,Win2k_xp\I386
ctdvins1.dll    = 101,Win2k_xp\I386

[SourceDisksFiles.amd64]
P17res.dll   = 101,Win2k_xp
P17.sys      = 101,Win2k_xp\AMD64
P17EP.ini    = 101,Win2k_xp
P17EPLS.ini   = 101,Win2k_xp
P17EP51.ini   = 101,Win2k_xp
P17APO64.dll  = 101,Win2k_xp\AMD64
P17pld64.dll  = 101,Win2k_xp\AMD64
P17APO32.dll  = 101,Win2k_xp\I386
OemSpiE.dll   = 101,Win2k_xp
P17RunE.dll   = 101,Win2k_xp
ResDefE.exe =101,Win2k_xp

ctzapxx.ini = 101
ludap17.ini = 101
AddCat.exe  = 101,Win2k_xp
AppSetup.exe    = 101,Win2k_xp
P17APO64.p17    = 101,Win2k_xp\AMD64
APOIM64.exe = 101,Win2k_xp\AMD64

ctcoins1.dll    = 101,Win2k_xp\AMD64
ctdvins1.dll    = 101,Win2k_xp\AMD64

 

Link to comment
Share on other sites

Suggest running "Dism /Image:<ImagePath> /Get-Drivers" from an elevated command prompt to see exactly what drivers are stored in the image and get further information regarding versions etc...  If you can post the results that would be great.

WIth regards to the script, I suggest we just use DirMove rather than FileCopy it would get around the SourceDiskFiles issue and you no longer have to delete the directory if it exists.  It should also be alot quicker since the move is occurring in the same folder, something like:

#include <Array.au3>
#include <File.au3>

Global $hSRC_FILEPATH = 'D:\Drivers', $hDST_FILEPATH = 'D:\NewDriver', $aSRC_DISKFILE

Global $aSRC_FILEPATH = _FileListToArrayRec ($hSRC_FILEPATH, "*.inf", 1, 1, 1, 1)

Global $aINF_FILEINFO[UBound($aSRC_FILEPATH)][5]

For $i = 1 To $aSRC_FILEPATH[0]
    ;~ .inf Source File Path
    $aINF_FILEINFO[$i][0] = $hSRC_FILEPATH & '\' & $aSRC_FILEPATH[$i]
    ;~ .inf Class name
    $aINF_FILEINFO[$i][1] = _FNC_INFCLEAN(IniRead($aINF_FILEINFO[$i][0], 'Version', 'Class', 'Misc'))
    ;~ .inf Provider name
    $aINF_FILEINFO[$i][2] = _FNC_INFCLEAN(IniRead($aINF_FILEINFO[$i][0], 'Version', 'Provider', 'Unknown_Provider'))
    ;~ .inf Source Folder Path
    $aINF_FILEINFO[$i][3] = $hSRC_FILEPATH & '\' & StringLeft($aSRC_FILEPATH[$i], StringInStr($aSRC_FILEPATH[$i], '\', 0, -1) - 1)
    ;~ .inf Destination Folder Path
    $aINF_FILEINFO[$i][4] = $hDST_FILEPATH & '\' & $aINF_FILEINFO[$i][1] & '\' & StringLeft($aSRC_FILEPATH[$i], StringInStr($aSRC_FILEPATH[$i], '\', 0, -1) - 1)
Next
_ArraySort($aINF_FILEINFO, 0, 1, 0, 1)
$aINF_FILEINFO[0][0] = UBound($aINF_FILEINFO) - 1
SplashTextOn('Move Driver Folders', '', 700, 100, -1, -1, 4, 'Trebuchet MS')
For $i = 1 To $aINF_FILEINFO[0][0]
    ControlSetText('Move Driver Folders', '', 'Static1', 'Moving: ' & $aINF_FILEINFO[$i][3] & @CRLF & @CRLF & 'To: ' & $aINF_FILEINFO[$i][4], $aINF_FILEINFO[$i][4])
    DirMove($aINF_FILEINFO[$i][3], $aINF_FILEINFO[$i][4], 1)
Next
SplashOff()

Func _FNC_INFCLEAN($sINF_CLASSNAME)
    $sINF_CLASSNAME = StringStripWS($sINF_CLASSNAME, 7)
    $sINF_CLASSNAME = StringReplace($sINF_CLASSNAME, '"', '')
    $sINF_CLASSNAME = StringReplace($sINF_CLASSNAME, '%', '')
    Return $sINF_CLASSNAME
EndFunc

 

Link to comment
Share on other sites

Subz you're the best

This solved both problems!!! Not only with the sub folders and a few missing files but it now works flawlessly with drivers exported from offline windows! (That still blows my mind) I had tried changing filecopy to dirmove and editing the $aINF_FILEINFO[$i][3] strings but was getting unexpected results.

Are there any functions I could add to Easy_DISM for you, you mentioned  removing provisioned apps.

Thanks again

Link to comment
Share on other sites

Glad to hear it's been resolved.

Currently I have an Ini File that I have set up as follows:
NB: These apps are included in Windows 10 1607 and may change depending on builds, you can use /Get-ProvisionedAppxPackage to get this information

[Packages]
Microsoft.3DBuilder = True
Microsoft.BingWeather = True
Microsoft.DesktopAppInstaller = False
Microsoft.Getstarted = True
Microsoft.Messaging = True
Microsoft.MicrosoftOfficeHub = True
Microsoft.MicrosoftSolitaireCollection = True
Microsoft.MicrosoftStickyNotes = True
Microsoft.Office.OneNote = True
Microsoft.OneConnect = True
Microsoft.People = False
Microsoft.SkypeApp = True
Microsoft.StorePurchaseApp = False
Microsoft.Windows.Photos = False
Microsoft.WindowsAlarms = False
Microsoft.WindowsCalculator = False
Microsoft.WindowsCamera = False
microsoft.windowscommunicationsapps = True
Microsoft.WindowsFeedbackHub = True
Microsoft.WindowsMaps = False
Microsoft.WindowsSoundRecorder = False
Microsoft.WindowsStore = False
Microsoft.XboxApp = True
Microsoft.XboxIdentityProvider = True
Microsoft.ZuneMusic = True
Microsoft.ZuneVideo = True

[Microsoft.3DBuilder]
DisplayName = Microsoft.3DBuilder
Version = 11.0.47.0
PackageName = Microsoft.3DBuilder_11.0.47.0_neutral_~_8wekyb3d8bbwe

[Microsoft.BingWeather]
DisplayName = Microsoft.BingWeather
Version = 4.9.51.0
PackageName = Microsoft.BingWeather_4.9.51.0_neutral_~_8wekyb3d8bbwe

[Microsoft.DesktopAppInstaller]
DisplayName = Microsoft.DesktopAppInstaller
Version = 1.5.26001.0
PackageName = Microsoft.DesktopAppInstaller_1.5.26001.0_neutral_~_8wekyb3d8bbwe

[Microsoft.Getstarted]
DisplayName = Microsoft.Getstarted
Version = 3.11.3.0
PackageName = Microsoft.Getstarted_3.11.3.0_neutral_~_8wekyb3d8bbwe

[Microsoft.Messaging]
DisplayName = Microsoft.Messaging
Version = 2.7.1001.0
PackageName = Microsoft.Messaging_2.7.1001.0_neutral_~_8wekyb3d8bbwe

[Microsoft.MicrosoftOfficeHub]
DisplayName = Microsoft.MicrosoftOfficeHub
Version = 2015.6801.23751.0
PackageName = Microsoft.MicrosoftOfficeHub_2015.6801.23751.0_neutral_~_8wekyb3d8bbwe

[Microsoft.MicrosoftSolitaireCollection]
DisplayName = Microsoft.MicrosoftSolitaireCollection
Version = 3.9.5100.0
PackageName = Microsoft.MicrosoftSolitaireCollection_3.9.5100.0_neutral_~_8wekyb3d8bbwe

[Microsoft.MicrosoftStickyNotes]
DisplayName = Microsoft.MicrosoftStickyNotes
Version = 1.0.136.0
PackageName = Microsoft.MicrosoftStickyNotes_1.0.136.0_neutral_~_8wekyb3d8bbwe

[Microsoft.Office.OneNote]
DisplayName = Microsoft.Office.OneNote
Version = 2015.6868.57981.0
PackageName = Microsoft.Office.OneNote_2015.6868.57981.0_neutral_~_8wekyb3d8bbwe

[Microsoft.OneConnect]
DisplayName = Microsoft.OneConnect
Version = 1.1605.17.0
PackageName = Microsoft.OneConnect_1.1605.17.0_neutral_~_8wekyb3d8bbwe

[Microsoft.People]
DisplayName = Microsoft.People
Version = 2016.709.155.0
PackageName = Microsoft.People_2016.709.155.0_neutral_~_8wekyb3d8bbwe

[Microsoft.SkypeApp]
DisplayName = Microsoft.SkypeApp
Version = 11.4.86.0
PackageName = Microsoft.SkypeApp_11.4.86.0_neutral_~_kzf8qxf38zg5c

[Microsoft.StorePurchaseApp]
DisplayName = Microsoft.StorePurchaseApp
Version = 1.0.454.0
PackageName = Microsoft.StorePurchaseApp_1.0.454.0_neutral_~_8wekyb3d8bbwe

[Microsoft.Windows.Photos]
DisplayName = Microsoft.Windows.Photos
Version = 2016.511.9510.0
PackageName = Microsoft.Windows.Photos_2016.511.9510.0_neutral_~_8wekyb3d8bbwe

[Microsoft.WindowsAlarms]
DisplayName = Microsoft.WindowsAlarms
Version = 2016.622.2118.0
PackageName = Microsoft.WindowsAlarms_2016.622.2118.0_neutral_~_8wekyb3d8bbwe

[Microsoft.WindowsCalculator]
DisplayName = Microsoft.WindowsCalculator
Version = 2016.606.1706.0
PackageName = Microsoft.WindowsCalculator_2016.606.1706.0_neutral_~_8wekyb3d8bbwe

[Microsoft.WindowsCamera]
DisplayName = Microsoft.WindowsCamera
Version = 2016.404.190.0
PackageName = Microsoft.WindowsCamera_2016.404.190.0_neutral_~_8wekyb3d8bbwe

[microsoft.windowscommunicationsapps]
DisplayName = microsoft.windowscommunicationsapps
Version = 2015.6868.41201.0
PackageName = microsoft.windowscommunicationsapps_2015.6868.41201.0_neutral_~_8wekyb3d8bbwe

[Microsoft.WindowsFeedbackHub]
DisplayName = Microsoft.WindowsFeedbackHub
Version = 1.3.1741.0
PackageName = Microsoft.WindowsFeedbackHub_1.3.1741.0_neutral_~_8wekyb3d8bbwe

[Microsoft.WindowsMaps]
DisplayName = Microsoft.WindowsMaps
Version = 2016.701.2235.0
PackageName = Microsoft.WindowsMaps_2016.701.2235.0_neutral_~_8wekyb3d8bbwe

[Microsoft.WindowsSoundRecorder]
DisplayName = Microsoft.WindowsSoundRecorder
Version = 2016.611.2.0
PackageName = Microsoft.WindowsSoundRecorder_2016.611.2.0_neutral_~_8wekyb3d8bbwe

[Microsoft.WindowsStore]
DisplayName = Microsoft.WindowsStore
Version = 11606.1001.394.0
PackageName = Microsoft.WindowsStore_11606.1001.394.0_neutral_~_8wekyb3d8bbwe

[Microsoft.XboxApp]
DisplayName = Microsoft.XboxApp
Version = 2016.623.248.0
PackageName = Microsoft.XboxApp_2016.623.248.0_neutral_~_8wekyb3d8bbwe

[Microsoft.XboxIdentityProvider]
DisplayName = Microsoft.XboxIdentityProvider
Version = 2016.616.818.0
PackageName = Microsoft.XboxIdentityProvider_2016.616.818.0_neutral_~_8wekyb3d8bbwe

[Microsoft.ZuneMusic]
DisplayName = Microsoft.ZuneMusic
Version = 2019.6.19261.0
PackageName = Microsoft.ZuneMusic_2019.6.19261.0_neutral_~_8wekyb3d8bbwe

[Microsoft.ZuneVideo]
DisplayName = Microsoft.ZuneVideo
Version = 2019.6.19281.0
PackageName = Microsoft.ZuneVideo_2019.6.19281.0_neutral_~_8wekyb3d8bbwe

I then have a function to add or remove those packages from the Offline mounted image, depending on whether [Package] value = True or False.
nb: You probably could just swap PackageName for the [Package] key, but in my Dism Tool I have it displaying the status when adding/removing from the Image.

Global $sINI_FILEPATH = @ScriptDir & '\Dism.ini'
FNC_PACKAGES()
Func FNC_PACKAGES()
    Local $aINI_PACKAGES = IniReadSection($sINI_FILEPATH, 'Packages')
        If @error <> 0 Then Exit
    For $x = 1 To $aINI_PACKAGES[0][0]
        If $aINI_PACKAGES[$x][1] = 'False' Then ContinueLoop
        RunWait(@ComSpec & ' /c Dism.exe /Image:"' & GUICtrlRead($hGUI_WIMMOUNT) & '" /Remove-ProvisionedAppxPackage /PackageName:' & IniRead($sINI_FILEPATH, $aINI_PACKAGES[$x][0], 'PackageName', ''), '', @SW_HIDE)
    Next
EndFunc

I also like to configure the Default User within the Offline Image, by loading the Default User hive and adding various registry and files.  I'd add my script but it's really messy at the moment.

Edited by Subz
Link to comment
Share on other sites

So  you're reading the ini file externally that you can edit and update  as the need arises.  Shouldn't be too hard to figure something out. I want to find a home for Easy_DISM in the download section and start a discussion thread.

I'll see you there and many thanks

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...