Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 293249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:15:16+00:00 2026-05-12T06:15:16+00:00

We have written an application that manages OpenVPN from the tray as an add-on

  • 0

We have written an application that manages OpenVPN from the tray as an add-on for a bigger software package.

OpenVPN includes a file called tapinstall.exe that installs the OpenVPN adapter (or any driver for that matter). Doing some research, this file is the exact same as a command-line tool called devcon that Microsoft includes in the Windows DDK. The OpenVPN guys just renamed it for their use.

So we use it during our setup (msi) installer in a custom action to install the driver, which for the most part, works just fine.

Every now and again, devcon fails and hangs–never exiting. After that point, you can re-run devcon and it will install the driver twice… which basically breaks OpenVPN.

Has anyone seen this issue with devcon, know what it’s doing, or know a way to fix it?

As an alternate solution, does anyone know how to install a driver from C#? (we have a .inf and a .sys file)

UPDATE: We’ve found this issues to be pretty rare. It occurs most often when we’ve applied an update where we uninstall the V8 version of the OpenVPN adapter and then install the new version (V9) of the OpenVPN adapter. It also seems to not happen if you restart your PC in between installs, so we might be better off forcing a PC restart on uninstall….

SIDE NOTE: I’ve heard of people using WiX and the DifxAPI (I think that is what it’s called) to install drivers from an MSI installer. Any ideas if this can be done from plain C# in a custom action? We don’t really want to start over with our setup project using WiX (it could be time consuming).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:15:16+00:00Added an answer on May 12, 2026 at 6:15 am

    I don’t have a solution for your problem, but here are some ideas:

    • The source code for DevCon is available as part of the Windows DDK under DDK root\Src\Setup\Devcon. If your problem is reproducable, you could build your own version and debug it in your IDE.

    • The sources of the OpenVPN installer can be found in the OpenVPN SVN repository. You could compare how DevCon is invoked and see if the OpenVPN is doing it in a way that prevents the problem.

    • INF files can be installed from the command line using something like

      rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 .\<file>.inf

      but I’d guess that DevCon is doing more than that, so I don’t know if this is a viable way. There has to be some reason obviously why the OpenVPN installer is using DevCon, right?


    @update:

    The OpenVPN installer seems to set a “Reboot Flag” depending of the return value of DevCon.

    ;------------------------------------------
    ;Set reboot flag based on tapinstall return
    
    Function CheckReboot
      IntCmp $R0 1 "" noreboot noreboot
      IntOp $R0 0 & 0
      SetRebootFlag true
      DetailPrint "REBOOT flag set"
     noreboot:
    FunctionEnd
    

    @side note:

    I’d guess you should be able to port DevCon to C# using P/Invokes. DevCon apparently is just a wrapper around SetupAPI and DIFxAPI.


    DIFxAPI

    Documentation:

    • Perform a Default DIFxAPI Installation
    • Perform a Default DIFxAPI Uninstall Operation

    P/Invokes:

    • SetDifxLogCallback
    • DIFLOGCALLBACK
    • DIFXAPI_LOG
    • DriverPackageInstall
    • DriverPackageUninstall

    Test program:

    SetDifxLogCallback(DIFLogCallbackFunc, IntPtr.Zero);
    
    bool needReboot;
    
    var error =
        DriverPackageInstall(driverPackageInfPath, 0, IntPtr.Zero, out needReboot);
    
    if (error != 0)
        throw new Win32Exception(error);
    

    Output:

    INFO: ENTER:  DriverPackageInstallW. Error code: 0
    INFO: Installing INF file 'C:\Program Files (x86)\OpenVPN\driver\OemWin2k.inf' (Plug and Play).. Error code: 0
    INFO: Looking for Model Section [tap0901.NTamd64].... Error code: 0
    INFO: Installing devices with Id "tap0901" using INF "C:\Windows\system32\DriverStore\FileRepository\oemwin2k.inf_128556d6\OemWin2k.inf".. Error code: 0
    INFO: ENTER UpdateDriverForPlugAndPlayDevices.... Error code: 0
    SUCCESS: RETURN UpdateDriverForPlugAndPlayDevices.. Error code: 0
    INFO: Installation was successful.. Error code: 0
    SUCCESS: Install completed. Error code: 0
    INFO: RETURN: DriverPackageInstallW  (0x0). Error code: 0
    

    The program must be run as administrator, otherwise you get an ERROR_ACCESS_DENIED.

    If the driver is already installed you get an ERROR_NO_MORE_ITEMS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application written in Python 2.7 that reads user's file from the
I have written a console application in Delphi that queries information from several locations.
I have written a WinForms application (C# 2.0, VS2008) that registers several file types
I have a dll which includes a function called ReadPort that reads data from
I have an application that manages documents called Notes. Like a blog, Notes can
I have written an application that keeps erasing my shared preference. It was always
I have written a PHP application that uses Objects heavily. Added, deleting, updating etc..
I have written a little console application that uses s#arp. I can create an
I have written a Scala (2.9.1-1) application that needs to process several million rows
I have C# application that makes use of some C libaries(which I have written

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.