2

I'm finishing a helper about driver.

Begining, I use DPInst but it can't work in any arguments.

Devcon is available when a batch file call up like devcon install xxxxxxx.inf *xxxxxxx. It needs to edit the devcon.exe's UAC to open. In c# I never worked it.

All the batch command to upgrade permission are failed.

Is there any lib to install the driver without infInstall? Can't work on my driver. I must to point the HardwareID.

Try to call the devcon in cmd:

        System.Diagnostics.Process p = new System.Diagnostics.Process();
        p.StartInfo.FileName = System.Environment.GetEnvironmentVariable("ComSpec");
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.RedirectStandardInput = true;
        p.StartInfo.Verb = "runas";
        p.StartInfo.CreateNoWindow = true;
        p.StartInfo.Arguments = SourcePath + @"\\x64" + @"\\devcon.exe install xxxx.inf xxxxxxx ";
        p.Start();

It also does not work and returns "devcon.exe failed". I guess it's caused by UAC.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • Did you try running your program as administrator? Also I don't understand your arguments. If you are running cmd.exe (or whatever comspec points to) don't you need to use to /C or /K ? (see https://stackoverflow.com/questions/515309/what-does-cmd-c-mean) – sgmoore Feb 08 '17 at 10:20
  • @sgmoore I tried it but invalid for devcon.exe, just change devcon.exe's properties. Checkbox "Run in Admin" (Sorry I don't know is that accurate because I'm Japanese system)is useful. – ChingHaituen Ji Mar 09 '17 at 12:44

0 Answers0