• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Installing Network Protocols

I have searched EE and multiple forum sites for 20+ hours now and am coming up with nothing at all. I need a way to automate the installation of RASPPPOE in Windows 98/ME/2k using VB.NET and INF files. The protocol itself can be added manually through Network Neighborhood but I am trying to simplify everything for the end user - they click, say.. "Setup" and it handles everything else for the person automatically. I can create the connection once the protocol is installed but it's getting the protocol installed that is driving me insane.

Yes, the project is in .Net but I will be using the bootstrapper program to allow installation of the .Net framework if is needed so I can fully utilize any classes easily.

The protocol is stored in an .inf file (there are a couple of them) and they also have DLL's associated with them as well as two .sys files. I need to get this installed for the person and then I'll create the connection afterwards.

Does anyone have any suggestions? I'm beating my head against the wall on this one..
0
goconcepts
Asked:
goconcepts
  • 5
1 Solution
 
thenrichCommented:
I'm not sure what the proper syntax would be but I'd think you'd be able to create a batch (.bat) file to accomplish this and run it from your app.
0
 
goconceptsAuthor Commented:
I'll give that one a try and post here what I find, if anything. Thanks for the suggestion!

I'm going to leave this open for now and see if anyone else has any suggestions.
0
 
goconceptsAuthor Commented:
I was just browsing and came across this on www.dotnet247.com. You would need to import Microsoft.Win32 and System.IO and it looks like this will install the INF file. Does anyone have any experience with this? What would the function actually return? A 1 for yet and 2 for no as to whether it was successful? Also, can anyone decipher this a little for me? I could most likely get it working but I'd really like to understand the why factor...what is making this work the way it is supposed to?

Imports System.IO
Imports Microsoft.Win32

Public Function InstallInfFile(ByVal strFileName As String) As Boolean
Dim strClassName As String = ""
Dim strInstallCommand As String = ""
Dim blnInstallationSuccess As Boolean = False
Dim objSubKey As RegistryKey

strFileName = strFileName.Trim

'Do a basic check to ensure that the specified file is an INF file and actually exists

If (strFileName.Length >= 4) AndAlso (strFileName.Substring(strFileName.Length - 4, 4).ToUpper = ".INF") AndAlso File.Exists(strFileName) Then
'Get the command from the regitry that is used to install INF files

objSubKey = Registry.LocalMachine.OpenSubKey("Software\Classes\.inf")

If Not IsNothing(objSubKey) Then
strClassName = objSubKey.GetValue("").Trim

objSubKey.Close()

If (strClassName.Length > 0) Then
objSubKey = Registry.LocalMachine.OpenSubKey("Software\Classes\" & strClassName & "\shell\Install\command")

If Not IsNothing(objSubKey) Then
strInstallCommand = objSubKey.GetValue("").Trim

objSubKey.Close()
End If
End If
End If

'Check that the expected argument placeholder exists at the end of the string

If (strInstallCommand.Length > 3) AndAlso (strInstallCommand.Substring(strInstallCommand.Length - 3, 3) = " %1") Then
'Replace the argument placeholder with the name of the INF file

strInstallCommand = strInstallCommand.Substring(0, strInstallCommand.Length - 2) & strFileName

'Install the INF file

blnInstallationSuccess = (Shell(strInstallCommand, AppWinStyle.Hide, True) = 0)
End If
End If

Return blnInstallationSuccess
End Function
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
goconceptsAuthor Commented:
I've doen some rearranging of the code above as that wasn't doing anything for me (I kept getting JIT errors about converting a string to a double. Here is all current code I am using and everything works up until the point of the installation itself. It finds the file and then attempts the install but I'm assuming it fails because it returns the MsgBox("Failed") window at the end.

Can anyone see what I'm doing wrong? The "Beginning the install.." box pops up but then I just get a failed return, there isn't any error with the try/catch block.

********************************************************************
Private Sub cmdInstall_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdInstall.Click
        Dim strFileName As String = "NETPPPOE.INF"
        'installINFfile(strFileName)
        If installINFfile(strFileName) = True Then
            MsgBox("Success")
        ElseIf installINFfile(strFileName) = False Then
            MsgBox("Failed")
        End If
    End Sub

    Private Function installINFfile(ByVal strFileName As String) As Boolean
        Dim strClassName As String = ""
        Dim strInstallCommand As String = ""
        Dim blnInstallationSuccess As Boolean = False
        Dim objSubKey As RegistryKey

        strFileName = strFileName.Trim
        'MsgBox("Everything is good on 81")

        'If File.Exists(strFileName) Then
        '    MsgBox("Found it")
        'Else
        '    MsgBox("Not included")
        'End If

        'Do a basic check to ensure the specified file is an INF file and actually exists
        'AndAlso (strFileName.Substring(strFileName.Length - 4, 4).ToUpper = ".INF")
        If (strFileName.Length >= 4) AndAlso (strFileName.Substring(strFileName.Length - 4, 4).ToUpper = ".INF") AndAlso File.Exists(strFileName) Then
            'Get the command from the registry that is used to install INF files
            MsgBox("Everything is good on 86")
            objSubKey = Registry.LocalMachine.OpenSubKey("Software\Classes\.inf")
            MsgBox("Everything is good on 88")

            If Not IsNothing(objSubKey) Then
                strClassName = objSubKey.GetValue("").Trim
                objSubKey.Close()
                If (strClassName.Length > 0) Then
                    objSubKey = Registry.LocalMachine.OpenSubKey("Software\Classes\" & strClassName & "\shell\Install\command")
                    If Not IsNothing(objSubKey) Then
                        strInstallCommand = objSubKey.GetValue("").Trim
                        objSubKey.Close()
                    End If
                End If
            End If
            MsgBox("Everything is good on 108 which is right before the actual install")
            'Check that the expected argument placeholder exists at the end of the string
            If (strInstallCommand.Length > 3) AndAlso (strInstallCommand.Substring(strInstallCommand.Length - 3, 3) = "%1") Then
                'Replace the argument placeholder with the name of the INF file
                strInstallCommand = strInstallCommand.Substring(0, strInstallCommand.Length - 2) & strFileName
                'Install the INF file
                MsgBox("Beginning the install..")
                Try
                    blnInstallationSuccess = (Shell(strInstallCommand, AppWinStyle.Hide, True) = 0)
                Catch ex As Exception
                    MsgBox(ex)
                End Try
            End If
        End If
        Return blnInstallationSuccess
    End Function
********************************************************************
0
 
goconceptsAuthor Commented:
No one has any thoughts??
0
 
goconceptsAuthor Commented:
I've since found the answer to this question and a few points could be given to the one answer received but it didn't really do me any good in the end.

Not sure how I handle this however so I guess I'll just leave it open and 21 days later an admin can close it.
0
 
GhostModCommented:
PAQed - no points refunded (of 500)

GhostMod
Community Support Moderator
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now