Solved

Installing Network Protocols

Posted on 2004-09-07
9
184 Views
Last Modified: 2010-04-23
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
Comment
Question by:goconcepts
  • 5
9 Comments
 
LVL 5

Expert Comment

by:thenrich
ID: 12005728
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
 

Author Comment

by:goconcepts
ID: 12006930
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
 

Author Comment

by:goconcepts
ID: 12007052
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:goconcepts
ID: 12009497
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
 

Author Comment

by:goconcepts
ID: 12035655
No one has any thoughts??
0
 

Author Comment

by:goconcepts
ID: 12041279
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
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 12313317
PAQed - no points refunded (of 500)

GhostMod
Community Support Moderator
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question