Topic: Driver Export DISM for PE Integration  (Read 1085 times)

0 Members and 1 Guest are viewing this topic.

Driver Export DISM for PE Integration
« on: March 17, 2017, 11:20:52 AM »

trashy

  • Code Baker
  • Chef
  • ***
  • Location: US
  • Date Registered: Feb 2013
  • Posts: 158
To all concerned with Driver Integration Plugin.
Driver Export DISM for integration into your PE Build
This started out to be a simple helper for DISM Export Driver process but I had to go all the way!
Export Drivers with DISM or Double Driver from online Host or any other Hard Drive partition or attached VHD.
List View will popup showing driver Class, Provider, Date, Version and arch select your drivers and click save.

Extract Driver Export and ini to workbench\common and DISM 10 path for Windows 7  @ScriptDir\GetWaikTools\ADK_6. YES driver export dism works in windows 7 but you must use DISM 10. Double Driver @ScriptDir\Double Driver\ddc.exe. DriverTemp work folder is deleted after each process completes and default save folder @ScriptDir\Drivers_arch. DISM path for Win 7 @ScriptDir\GetWaikTools\ADK_6\Arch\DISM\Dism.exe Win 8 8.1 and 10 @SystemDir.

Extract Driver_Export_Import.exe and Driver_Export_Settings.ini to workbench\common and run !
Driver Integration Plugin Leave integration folder set to default %GlobalTemplates%\Drivers_x86\
and %GlobalTemplates%\Drivers_x64\
 
Fixed a couple bugs and added manage driver integration folder (see reply 9)
* Driver Export Import v1.5.7z (618.39 kB - downloaded 51 times.)
ila_renderedila_rendered

I will modify to suit your needs, would like to add driver packs feature, looking for a way to reliably get Driver file arcitecture
« Last Edit: March 30, 2017, 07:42:39 PM by trashy »

Re: Driver Export DISM for PE Integration
« Reply #1 on: March 18, 2017, 08:00:56 PM »

trashy

  • Code Baker
  • Chef
  • ***
  • Location: US
  • Date Registered: Feb 2013
  • Posts: 158
I have Successfully and reliably got the driver architecture from the driver.sys file.
Will be adding browse for extracted driver packs now that I can sort and save by driver arch..   

Re: Driver Export DISM for PE Integration
« Reply #2 on: March 19, 2017, 10:26:23 PM »

trashy

  • Code Baker
  • Chef
  • ***
  • Location: US
  • Date Registered: Feb 2013
  • Posts: 158
@ChrisR Your comment here is what started me down this path.
http://theoven.org/index.php?topic=933.msg22294#msg22294

I succeeded adding Driver pkg, Stumbled onto the solution for getting driver arch ( using dll call on .sys file ).
DllCall("kernel32.dll", "hwnd", "GetBinaryType"....I've used this alot to get arch of an exe, I don't Understand it.
Anybody who knows more about dllcall would it be possible to get product name or description from the driver.sys.
Integrating this new process was the real pain in the ass.
 
You will find restore.ini in each driver folder after export or add driver pkg completes.
I got this idea from double driver used their same layout and added driver arch.
This will make getting the driver info I need much easier for future updates because......
NEXT I plan to add a driver manager, same listview template already using select unwanted drivers
and delete them from your driver integration folder.

For all Driver Export functions I am using a single folder DriverTemp as the work folder.
All driver files are either deleted or moved to permenant location = @scriptDir\Drivers_@arch
Driver Pkg driver files are copied to permanent location nothing deleted
For driver export I didn't change the way I get driver arch from host or source os arc.
I've had good results with this new process for Driver Pkg but needs More Testing.
Nobody said a word yet but this should make gathering drivers for integration a breeze.
Please give me some feedback.
« Last Edit: March 19, 2017, 10:28:42 PM by trashy »

Re: Driver Export DISM for PE Integration
« Reply #3 on: March 21, 2017, 03:54:25 AM »

JFX

  • Code Baker
  • Sr. Chef
  • ****
  • Date Registered: Dec 2010
  • Posts: 852
Hi trashy,

GetBinaryType API has couple of problems, when running from older Os on never files.
Maybe this can be a better way.

Code: [Select]
Func GetDriverSys_Info($sDriverFile)

Local $hFile, $Buffer, $aReturn[3]
$hFile = FileOpen($sDriverFile, 16)
IF Not $hFile Then Return SetError(1, 0, 0)

$Buffer = FileRead($hFile, 1024)
IF not @error Then
IF BinaryMid($Buffer, 1, 2) = 0x5A4D Then
Switch BinaryMid($Buffer, Int(BinaryMid($Buffer, 0x3D, 4)) + 5, 2)
Case 0x8664
$aReturn[0] = 'x64'
Case 0x014C
$aReturn[0] = 'x86'
Case 0x01C4
$aReturn[0] = 'ARM'
Case 0xAA64
$aReturn[0] = 'ARM64'
EndSwitch

endif
ENdif

FileClose($hFile)

IF $aReturn[0] Then
$aReturn[1] = FileGetVersion($sDriverFile, 'FileVersion')
$aReturn[2] = FileGetVersion($sDriverFile, 'FileDescription')
Return $aReturn
endif

Return SetError (2, 0, 0)

EndFunc

Local $aDriverInfo = GetDriverSys_Info("C:\Windows\System32\drivers\3ware.sys")
IF not @error Then
ConsoleWrite('Architecture: ' & $aDriverInfo[0] & @CRLF)
ConsoleWrite('Version: ' & $aDriverInfo[1] & @CRLF)
ConsoleWrite('Description: ' & $aDriverInfo[2] & @CRLF)
ENdif
« Last Edit: March 21, 2017, 04:10:36 AM by JFX »

Re: Driver Export DISM for PE Integration
« Reply #4 on: March 22, 2017, 07:11:42 AM »

trashy

  • Code Baker
  • Chef
  • ***
  • Location: US
  • Date Registered: Feb 2013
  • Posts: 158
Thanks JFX looks perfect, because of workload may be a couple days.
I know what amd64 and ia64 are but not arm so did a quick google search is it Linux?

Edit Quick test and the results
Architecture: x64
Version: 9.18.13.0697
Description: NVIDIA Windows Kernel Mode Driver, Version 306.97

Function FileGetVersion - AutoIt and found al the available options, ProductName returns same as FileDescription
was hoping for something like NVIDIA GeForce GT 610
« Last Edit: March 22, 2017, 08:20:33 AM by trashy »

Re: Driver Export DISM for PE Integration
« Reply #5 on: March 22, 2017, 07:59:52 AM »

JFX

  • Code Baker
  • Sr. Chef
  • ****
  • Date Registered: Dec 2010
  • Posts: 852
IA64 is an old architecture already superseded by AMD64.

ARM and ARM64 are very new architectures. You can ignore them for now.
It see Microsoft does not really know what they want with ARM and their Windows RT version.

Re: Driver Export DISM for PE Integration
« Reply #6 on: March 22, 2017, 08:41:53 AM »

trashy

  • Code Baker
  • Chef
  • ***
  • Location: US
  • Date Registered: Feb 2013
  • Posts: 158
Thanks again can use architecture and version but a description like
Description: NVIDIA Windows Kernel Mode Driver, Version 306.97, might just confuse people.

Time for work give me a couple days will swap this for GetBinaryType

Re: Driver Export DISM for PE Integration
« Reply #7 on: March 23, 2017, 09:02:30 AM »

trashy

  • Code Baker
  • Chef
  • ***
  • Location: US
  • Date Registered: Feb 2013
  • Posts: 158
Ran the driver.sys through all the options available to FileGetVersion.
I can use architecture, ProductVersion, CompanyName to get Provider and still haven't decided about FileDescription.
My Autoit script was getting really sloppy, will take a few days to add this new function and clean up the mess.

Re: Driver Export DISM for PE Integration
« Reply #8 on: March 24, 2017, 04:36:04 PM »

trashy

  • Code Baker
  • Chef
  • ***
  • Location: US
  • Date Registered: Feb 2013
  • Posts: 158
v1.3 I think this ones a keeper

I was missing way too many sys files in my search and everything unidentified was getting marked 32 bit.
Driver.inf file is always in parent folder but driver.sys sometimes in a subfolder had to make sys search recursive.
All driver arch for all functions now comes from Driver.sys file. If no driver.sys file found driver arch marked unknown.
If you check a driver with unknown arch it is saved to Drivers_Arch_Unknown and 32bit drivers saved to Drivers_x86
and 64 bit drivers saved to Drivers_x64. Restore.ini contains all the driver info gathered during the process for
easy access in the future. DriverTmp work folder deleted after each process completes.

Everything needs to be thoroughly tested but I think this is the one.
May still add an option to manage driver save folder.

Re: Driver Export DISM for PE Integration
« Reply #9 on: March 30, 2017, 08:07:30 PM »

trashy

  • Code Baker
  • Chef
  • ***
  • Location: US
  • Date Registered: Feb 2013
  • Posts: 158
Added an error check and I was closing a file too soon, both causing program crash.
Added manage driver integration folder, select drivers_x64 or drivers_x86 check the drivers you want to save all unchecked drivers will be deleted.

Now it's time for some kind of plugin. Something to run alongside Driver Integration prior to build time.
Could even be called from driver integration but I will leave that up to someone else to decide.

 

Powered by EzPortal