Install usb device without manager prompt - installation

We have a usb device and the drivers (.inf, libusb.dll, libusb.sys) and can install it using Windows' Device Installation Wizard (by pointing to the .inf file). However, we need to install the drivers without using the wizard (passively, so the user doesn't need to do anything). Does anyone know how this can be achieved?

You added the "installer" tag, so I'm assuming you're talking about some kind of installation package, like Windows Installer, InstallShield InstallScript, etc.
If that's the case, you should probably use Microsoft's DIFx framework.
DIFx makes it easier for you to create
high-quality driver packages,
customize the installation of driver
packages, allow the installation of
driver packages in combination with
application software, and use the
standard Windows APIs and installation
tools. DIFx also makes it easier for
end users to diagnose device and
driver problems. End users can be
confident that, if necessary, drivers
can be uninstalled or rolled back.
I've used DIFx from both Windows Installer-based installs and InstallScript installs. Very user-friendly, easy to debug, and effective.

My colleague came up with an answer that is working very well. It appears that, unless you hardware/driver combination is WHQL signed, the Add New Hardware Wizard will always appear in Win XP. However, with the following method it is possible to have the "Search" button in the wizard find your driver automatically. In Windows 7, there is no prompt and the device installs just fine. You'll need to watch out on 64-bit machines, though, as they have much stricter signing enforcement.
So here is the relevant excerpt from the whole document:
Use the DIFxAPi merge module. (Read a good introduction to drivers in Windows, the use of INF files, and DIFxAPP.) The DIFxAPI merge module is included in the WDK in the ‘WDDK//redist\DIFx\DIFxApp\MergeModule\’ directory. The merge module can be included in an MSI package and can be set to install multiple device drivers. Here are the steps to create an MSI with the DIFxAPP merge module:
In the setup folder, create a separate directory in the Application Folder for the driver package and add the driver files to the folder.
Add the DIFxApp.msm to the setup project.
Build the setup
Use Orca to edit the MSI database table and add the INF component to the DIFxAPP merge modules table.
The Orca installation is included in the Windows SDK in the ‘C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin’ directory. (The Windows SDK can be downloaded from Microsoft)
Run Orca and select the MSI package that needs to be modified.
Read part 5 for automation.
In the ‘File’ table, locate the INF file of the driver package you would like to install and copy the Component value.
Create a new row in the MsiDriverPackages table. Add the Component value into Component field. The following flags can be used (although some are ignored by Windows 7):
0 - Not set (default)
1 – Force installation of driver, even if it the currently installed drivers is
a better match than the driver being installed
2 – Suppress message box telling user to plug in devices after the driver
has been installed.
4 – Suppress adding an entry in Add/Remove Programs for driver.
Driver will be uninstalled when main application is uninstalled.
8 – Install unsigned driver packages
16 – Remove driver binaries during uninstall.
Save the MSI. In order to automate the process, the editing of the MSI database can be recorded to a Transform and then the Transform can be applied in a post build process.
Open the MSI in Orca.
Select Transform->New Transform
Complete steps 3 and 4 in the above directions.
Select Tranform->Generate transform and save the transform.
Add the following line to the post build of the Setup Project
MsiDb.exe -t transform.mst -d $(TargetDir)\DriverInstall.msi
Note: MsiDB.exe comes with the Microsoft SDK and is located in
C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin
If you get an error installing from the MSI (e.g. I got error code 2356 which ended up being due to an invalid Flag value), use Orca's Validate function to see if there are any errors. EDIT: Fixing these errors still has not gotten rid of the error. I remember reading that inf files should be in their own sub-directory, but that didn't fix my problem either.

Related

How can I install a locally developed WDM driver?

I'm following a video tutorial that covers developing WDM drivers and I've managed to put together a very barebones driver that doesn't really do anything other than print when it's loaded or unloaded. I did not make any modifications to the INF file generated by visual studio, and have built the driver successfully under Debug x64. Im slight confused by the output of the build, because the resulting driver and INF file are generated in two places:
Under \ProjectName\x64\Debug along with the pdb and certificate
Under \ProjectName\x64\Debug\ProjectName with only a cat file
Attemnpting to install from teh first location gives me the error:
The third-party INF does not contain digital signature information.
And from the second I get:
A problem was encountered while attempting to add the driver to the store.
I've tried installing the certificate, but it doesn't seem to work and there's no information in the Event Log. I get this same error, attempting to install on my local machine and on a VM both running Win 10 x64.
I guess I have 2 question: for starters, why do two driver / INF pairs get generated, which is the right one for me to use? And secondly, what do I need to do / fix / change /etc. so that I can install my locally developed driver on my machine>

Why doesn't Chocolatey install packages into `C:\Program Files\`?

According to the Windows installation rules, programs should be installed to
C:\Program Files (64-bit program / x86-64) or C:\Program Files (x86) (32-bit program / x86). The program is copied into a sub-sub-folder containing the vendor name and the program name.
But why doesn't Chocolatey install packages into C:\Program Files\<Vendor>\<Program>\?
10. Apps must install to the correct folders by default
Users should have a consistent and secure experience with the default installation location of files, while maintaining the option to install an app in the location of their choice. It is also necessary to store app data in the correct location to allow several people to use the same computer without corrupting or overwriting each other's data and settings. Windows provides specific locations in the file system to store programs and software components, shared app data, and app data specific to a user
10.1 Your app must be installed in the Program Files folder by default
For native 32-bit and 64-bit apps in %ProgramFiles%, and %ProgramFiles(x86)% for 32-bit apps running on x64. User data or app data must never be stored in this location because of the security permissions configured for this folder.
Source: Certification requirements for Windows desktop apps
Version: 10 (July 29, 2015)
It depends on your version of Chocolatey, it's settings and the packages themselves.
To start, see Tools vs Applications and Chocolatey's distinction (
https://github.com/chocolatey/chocolatey/wiki/ChocolateyFAQs at the
bottom).
If the package does not use a native installer (a tool), it depends on
if the package author has used the bin_root concept that is up and
coming in a future version.
For example, SysInternals will go to c:/sysinternals right now unless
you have a defined $env:chocolatey_bin_root variable. The concept in
the code will change as well as right now this requires it to be a
subfolder of the system drive and I don't see us developing the final
feature with that limitation.
If the package doesn't have that concept yet, one can always ask the
package author to incorporate it.
If the package uses a native installer (an application), one can use
installArgs to pass arguments to the native installer
(https://github.com/chocolatey/chocolatey/wiki/CommandsInstall) and
tell it the directory to install the application to. This does require
you to know what you need to pass to the native installer. If you want
your applications in a custom directory, there is an assumption that
you are already an advanced user so it is expected that you would know
what to pass the installer if you were doing a silent install.
Slightly paraphrased from: https://groups.google.com/forum/#!msg/chocolatey/uucAz8GxebA/HEPAKp69d90J
Also,
NOTICE: As of 0.9.8.24, Chocolatey's default install location is
C:\ProgramData\Chocolatey
This reduces the attack surface on a local installation of chocolatey
and limits who can make changes to the directory.
Source: https://github.com/chocolatey/chocolatey/wiki/DefaultChocolateyInstallReasoning
And from personal experience I can attest that that concept is an excellent line of defense (when properly configured, used and understood).
PS:
As you already added to your answer, technically the requirement is %ProgramFiles% and %ProgramFiles(x86)% environment variable(s where applicable).
For example, %ProgramFiles(x86)% could as well point to P:\Software\Programs\x86\ (instead of C:\Program Files (x86)\).
There is obviously a lot of legacy software (now (re-)packaged) that never used a <vendor> section in the path-name.
Hope this helps!

Uninstall Faulty MSI --> System Crash

A few customers have an MSI installed on their system (servers and desktop's, winxp, win7, server2k8r2, server2012r2).
The MSI is created by a default VS2010 "Visual Studio Installer Setup Project".
There are 2 reg keys created with the installation.
HKLM\Software\Microsoft\Silverlight\AllowElevatedTrustAppsInBrowser = 1
HKLM\Software\Wow6432Node\Microsoft\Silverlight\AllowElevatedTrustAppsInBrowser = 1
When uninstalling, on some system's, the whole Software\*\Microsoft node gets deleted.
Anyone got an idea how I can solve this, without crashing the systems.
(This already happened a few times, but there are still a lot of installations.)
The zip contains an exe that install's requirements + certificates + MSI.
The MSI itself is in the IG folder.
There is also an install.log & uninstall.log (from windows 7 virtual box)
https://www.dropbox.com/sh/ku3vqoajfxbnluq/AACQ6evVw4pzRJ6WTzqCHR8Ba?dl=0
This reminds me of a similar incident ( using InstallShield instead of VS but both create MSIs )
InstallShield 2008 HOTFIX: COM Extraction Causes System Corruption during Uninstall
Your question isn't directly answerable given the information. I would need to evaluate the .MSI looking for custom actions, registry table entries and any self registering DLLs. An uninstall log file would help also. You might have to boot from recovery media to get to it but it should be there if you log the uninstall.
You should treat this as an emergency before many more clients are impacted. Investigate root cause and issue a patch so that customers can safely uninstall.
The only thing I can see obviously wrong is that you think you are changing the Silverlight registry entries in the native 64 bit registry and the 32 bit Wow registry. Your install is x86 and you can't do that. If you're going to alter that key in the 32 bit world you just use the normal registry path and an x86 install maps it to WoW6432. So you have got two different components uninstalling the same thing, one of them incorrectly addressing the WoW6432 location directly. I don't know if this could screw things up but it's plainly wrong. You need an x64 setup for x64 systems, and as a matter of customer security I would not change those policy settings without making it clear to the customer.
The only other odd thing is that you seem to be installing the uninstall.bat file twice. What's in it? If it uninstalls the app, what's wronmg with using Control Panel? And hopefully that's not got anything that might be responsibe, if users are running that to do the uninstall.

Creating an Installer package

So I have a compliled matlab code, 'Example.exe'...I want to create an installer package that does the following:
My exe file will reside on a network drive.
My installer will first ask the user for the installation path.
It will then copy the exe (along with some other supporting files) in the given path....IF the folder already exists, it will ask the user for overwrite confirmation.
After the copying is done, my installer will ask the user if they want to install the MCR and accordingly install it(or not).
After everything is done, a shortcut to the exe is created on the desktop.
My question is, is there some installer package generator that can do all this ?? I understand matlab can create an installer package, but I want my file to be copied from the network drive. I also don't have Visual Studio so, can't create an msi.
There's a simple way to do this, you'll need a software called IExpress, It can create a self-extracting executable (.EXE) or a compressed Cabinet (.CAB) file using the provided interface (IExpress Wizard). Its included in all versions of windows (I think..). To run the IExpress Wizard, go to your local drive then: Windows\System32, Search for "iexpress" then run the program.
then...
Follow these steps:
1. Run iexpress.exe
2. Create a new 'Self Extraction Directive' file
3. Extract files only
4. Specify the title, promt user options, license, etc
5. Start adding files to your package
7. Specify other options (window, message)
8. Enter the path where you want your package to be.
Then you're almost done, create your package (might take a few mins), distribute it, upload it and all.
For more details visit http://www.makeuseof.com/tag/how-to-make-an-exe-installation-file/
There is no simple way to do that. But if you tightly tied to Windows platform, you definitely can learn Windows Installer technology. It's NOT related to Visual Studio!
Just download WiX toolset (it is free and Open Source!) and learn MSDN docs about Windows Installer.
But it is complex way, remember. You can spent months learning how to make great Windows installers.
Ofcourse, you can use Inno Setup or NSIS, but I don't recommend that, because them re-engineer installer technology instead of native Windows Installer's.
If you want, I can learn you by Skype or something like. :-)
Or (isn't great offer?) I can write the installer for you and send you all code and describe which for what is.
Use iExpress! Available from win xoxo and over (xp)
With windows 8 pro you can make a package with your voice! Only with win 8 or 8.1 pro.

NTSVC.OCX issues on Windows 7

I have a VB6 Service that uses the standard NTSVC.ocx file to help manage all the NT service functions. The application has been running on Windows 2003 Server RC1 with no troubles. Our sales team asked if we could put this same application on a notebook that could be used as a live site demo. The only issue I am having is that the notebook is brand new, running Windows 7 and the manufacturer only has Windows 7 drivers for the devices.
There is no installer for this service. I manually load the ocx and supporting other dll's into the various Windows and System32 folder and then run regsvr32 from the command prompt to load the OCX. The service has a command line set of parameters to install and uninstall the service itself.
When I try to REGSVR32 the OCX I get the following error:
The module "C:\Windows\System32\ntsvc.ocx" failed to load. Make sure the binary is stored at the specified path or debug to check for problems with the binary or dependent .DLL files. The specified module could not be found.
One potential reason that might lead to your problem, is that the NTSVC.OCX is built with a fixed Base Address (in other words, the Image has been bound by the Linker with the /FIXED switch). Starting with Vista, the Windows Loader uses Address Space Layour Randomization (ASLR) mechanism.
Based on this ASLR feature the Windows Loader attempts to load the OCX component at another Base Address than the predefined one (the one hardcoded in the OCX image file). Since your OCX Address Base is hardcoded, the Loader will fail to load your OCX (which is technically just a DLL!).
See Snapshot below showing these fields of the NTSVC.OCX image using PeStudio:
I would first try Dependency walker. If that doesn't give you a clue as to what you need you may be SOL. Also you will have to run regsvr32 as an administrator so you should get the little UAC popup.
this ocx (an also other ocx such as vbwheelscollfix.dll) to register ist very easy.
First Step:
copy this OCX into the Folder C:\Windows\SYSWOW64 (on 32 bit, i suspect its SYSWOW32).
Second Step:
Open a CMD with administrative rights.
Last Step:
Now you can register / unregister the file from the SYSWOW path.
As ich said:
in an administrative shell:
regsvr32 C:\Windows\SYSWOW64\NTSVC.ocx did work for me. Note that \System32 did not work, as it gave me an error. It might work in a x86 environment, though.
I now have no errors in my project but did not try if it works properly.

Resources