Installing driver works through batchfile but not using C++

597 Views Asked by At

I have installed a driver named Abc.inf using a batchfile which contains RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 %~dp0ABC.inf.

When I run the batchfile, the driver installs successfully and I can view it using driverquery command in cmd.

Now I try the same using c++. My code being

LPWSTR cmdLine = L"DefaultInstall 132 C:\\ABC.inf";

InstallHinfSection(NULL,NULL,cmdLine,0);

A small popup comes and vanishes incredibly fast(so fast that I'm not able to read what it is). The function executes successfully but there is no such entries of the driver when I check using command prompt.

Am I missing out anything in this? Any solutions?

0

There are 0 best solutions below