Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 3rd, 2007, 11:32 PM
Registered User
 
Join Date: Nov 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to saumya
Default Fetch Licence key from Remote Registry

hi,
  i have code a program that fetche serial numbers from Windows Registry. for that i have implemented a registry searching code. But I am unable to fetche same thing from remote machine...
My snipet of code is here

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim key As String = txtKey.Text
        TextBox1.Text = "working... " & vbCrLf
        TextBox1.Text = GetMyStrings(key)

    End Sub

    Private Function GetMyStrings(ByVal key As String) As String
        Debug.Assert(key.Length > 0)
        Dim i As Integer
        Dim k As String
        '''''= key & vbCrLf
        Dim k1 As String = ""
        Dim k2 As String = ""
        Dim R As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(key)
        Dim a() As String = R.GetSubKeyNames
        k += GetMyKeys(key)

        For i = 0 To a.Length - 1
            Application.DoEvents()
            If a(i) <> "Protected Storage System Provider" And a(i) <> "Classes" And a(i) <> "Remote Desktop" And a(i) <> "Credentials" And a(i) <> "GACChangeNotification" And a(i) <> "NetDDE" And a(i) <> "Installer" Then
                k1 = key & "\" & a(i)
                If Registry.LocalMachine.OpenSubKey(k1).SubKeyCount > 0 Then
                    k += GetMyStrings(k1)
                Else
                    k += GetMyKeys(k1)
                End If
            End If
        Next

        Return k.ToString
    End Function


    Private Function GetMyKeys(ByVal key As String) As String
        Debug.Assert(key.Length > 0)
        Dim i As Integer
        Dim k As String = ""
        Dim R As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(key)
        Dim a() As String = R.GetValueNames
        Dim s, str(), str2(), str3(), str4() As String

        For i = 0 To a.Length - 1
            If a(i) <> "" Then
                str = Split(CStr(a(i)), "Serial")
                str2 = Split(CStr(a(i)), "Serializ")
                str3 = Split(CStr(a(i)), "VolumeSerialNumber")
                str4 = Split(CStr(a(i)), "SerialPort")
                If (UBound(str) > 0) Then
                    If (UBound(str2) > 0 Or UBound(str3) > 0 Or UBound(str4) > 0) Then
                        k += ""
                    Else
                        k += key & " "
                        k += a(i) & " value is ---->"
                        s = CStr(R.GetValue(a(i), ""))
                        k += s & vbCrLf
                    End If
                End If
            End If
        Next

        Return k.ToString
    End Function

But there is a problem in this code... i can't fetch licence key of amy Microsoft product.
Please can any one help me to devolop this code......
Best of luck in advance..

Regards
Saumya

"I want to change the world.. but 'HE' doesnt give me the source code.."

Saumya





Similar Threads
Thread Thread Starter Forum Replies Last Post
remote registry ingormation saumya Visual Studio 2005 0 November 28th, 2007 04:23 AM
remote registry access alex_smotritsky General .NET 2 November 28th, 2007 02:53 AM
remote registry carelfrik Access VBA 2 October 28th, 2005 02:18 PM
Remote Registry Kep C++ Programming 3 September 18th, 2003 05:39 PM
Remote Registry Kep VB How-To 1 August 13th, 2003 04:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.