|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Computer Name - Best way to obtain this VB.NetThanks for your tolerance on this list. I asked the question regarding
Commercial Copy Protection along with Unique PC Idnetifier and obtaining the active IP address. This was all to identify and tie down software to each PC on a network. I have just realised that the unique identity that I need to go for on the network and should be easy to get in a foolproof manner is the computer name. Hence which method will ALWAYS return the computer name on any XP Win2K or Vista machine - 100% of the time?? Best wishes and thanks Paul Bromley I assume that this is likely to be the best way? :-
mComputerNetBiosName = System.Environment.MachineName Best wishes Paul Bromley Show quoteHide quote "Paul Bromley" <flyfis***@dsl.pipex.com> wrote in message news:%23FhhfCKHHHA.3540@TK2MSFTNGP02.phx.gbl... > Thanks for your tolerance on this list. I asked the question regarding > Commercial Copy Protection along with Unique PC Idnetifier and obtaining > the active IP address. This was all to identify and tie down software to > each PC on a network. I have just realised that the unique identity that I > need to go for on the network and should be easy to get in a foolproof > manner is the computer name. Hence which method will ALWAYS return the > computer name on any XP Win2K or Vista machine - 100% of the time?? > > Best wishes and thanks > > > Paul Bromley > Paul Bromley wrote:
> I assume that this is likely to be the best way? :- Yes, you're correct with this.> > mComputerNetBiosName = System.Environment.MachineName > I've followed your other posts and would like to suggest that generating a unique Serial Number for your software, on each machine that it is executed, is not that difficult. I use the following code (watch for wrapping!) - Imports System.Management ''' <summary> ''' String of 1 to 2 chars. eg. "C" or "C:". ''' </summary> ''' <param name="sDriveLetter"></param> ''' <returns></returns> ''' <remarks></remarks> Public Function GetDriveSerialNumber(ByVal sDriveLetter As String) As String If Len(sDriveLetter) = 1 Then sDriveLetter &= ":" Else sDriveLetter = Strings.Left(Environment.SystemDirectory, 2) End If Dim HardDiskInfo As New ManagementObject("Win32_LogicalDisk.DeviceID=" & ChrW(34) & sDriveLetter & ChrW(34)) Dim HardDiskProperty As PropertyData = HardDiskInfo.Properties("VolumeSerialNumber") Return HardDiskProperty.Value.ToString End Function I first obtain the Drive Serial Number and then ensure it is 8-Characters in length - Dim sA As String = GetDriveSerialNumber(Strings.Left(Environment.SystemDirectory, 2)) Dim N As UInt16 = Len(sA) If N < 8 Then sA = sA.PadRight(8 - N, "0") ElseIf N > 8 Then sA = Strings.Left(sA, 8) 'Truncate to 8 Chars. End If After this I "AND" the value with another routine that automatically generates an 8-Character HEX number based on the title of my software. I then end up with a 16-Character HEX number, which is unique to each of my applications and unique on every computer, I then do some more XOR'ing and present this to the User as the Application Serial Number. I obviously have another application that reverses all of this to provide an Unlock Code that the User enters. There are literally hundreds of Users running my applications using this method, and although it really only stops the honest pirates, it serves my purposes well. If you'd like to see an example, please download one of my apps (written for specific clients) from the following site - www.arnfieldcomputerservices.com/apps/spi/publish.htm This will provide an example of what my Registration Screen looks like. If you require any further assistance, please feel free to contact me direct via the email address used in this post. ShaneO There are 10 kinds of people - Those who understand Binary and those who don't. Many thanks for this Shane - I will take a look tomorrow. Has this worked OK
on Win2K as well as XP? Best wishes Paul Bromley Show quoteHide quote "ShaneO" <spc***@optusnet.com.au> wrote in message news:457c99ff$0$16557$afc38c87@news.optusnet.com.au... > Paul Bromley wrote: >> I assume that this is likely to be the best way? :- >> >> mComputerNetBiosName = System.Environment.MachineName >> > > Yes, you're correct with this. > > I've followed your other posts and would like to suggest that generating a > unique Serial Number for your software, on each machine that it is > executed, is not that difficult. > > I use the following code (watch for wrapping!) - > > Imports System.Management > > ''' <summary> > ''' String of 1 to 2 chars. eg. "C" or "C:". > ''' </summary> > ''' <param name="sDriveLetter"></param> > ''' <returns></returns> > ''' <remarks></remarks> > Public Function GetDriveSerialNumber(ByVal sDriveLetter As String) As > String > > If Len(sDriveLetter) = 1 Then > sDriveLetter &= ":" > Else > sDriveLetter = Strings.Left(Environment.SystemDirectory, 2) > End If > > Dim HardDiskInfo As New ManagementObject("Win32_LogicalDisk.DeviceID=" & > ChrW(34) & sDriveLetter & ChrW(34)) > Dim HardDiskProperty As PropertyData = > HardDiskInfo.Properties("VolumeSerialNumber") > Return HardDiskProperty.Value.ToString > > End Function > > > I first obtain the Drive Serial Number and then ensure it is 8-Characters > in length - > > Dim sA As String = > GetDriveSerialNumber(Strings.Left(Environment.SystemDirectory, 2)) > > Dim N As UInt16 = Len(sA) > If N < 8 Then > sA = sA.PadRight(8 - N, "0") > ElseIf N > 8 Then > sA = Strings.Left(sA, 8) 'Truncate to 8 Chars. > End If > > > After this I "AND" the value with another routine that automatically > generates an 8-Character HEX number based on the title of my software. I > then end up with a 16-Character HEX number, which is unique to each of my > applications and unique on every computer, I then do some more XOR'ing and > present this to the User as the Application Serial Number. > > I obviously have another application that reverses all of this to provide > an Unlock Code that the User enters. > > There are literally hundreds of Users running my applications using this > method, and although it really only stops the honest pirates, it serves my > purposes well. > > If you'd like to see an example, please download one of my apps (written > for specific clients) from the following site - > > www.arnfieldcomputerservices.com/apps/spi/publish.htm > > This will provide an example of what my Registration Screen looks like. > > If you require any further assistance, please feel free to contact me > direct via the email address used in this post. > > ShaneO > > There are 10 kinds of people - Those who understand Binary and those who > don't. Paul Bromley wrote:
> Many thanks for this Shane - I will take a look tomorrow. Has this worked OK Yes, this works on both Win2K and XP. It also works on Windows Server > on Win2K as well as XP? > > 2000 + 2003. I haven't tested it on Win98, but I believe if it can run the .NET Framework then it will work. ShaneO There are 10 kinds of people - Those who understand Binary and those who don't. Shane,
Not all drives have serialnumbers. Cor Show quoteHide quote "ShaneO" <spc***@optusnet.com.au> schreef in bericht news:457cbda3$0$9772$afc38c87@news.optusnet.com.au... > Paul Bromley wrote: >> Many thanks for this Shane - I will take a look tomorrow. Has this worked >> OK on Win2K as well as XP? >> >> > Yes, this works on both Win2K and XP. It also works on Windows Server > 2000 + 2003. I haven't tested it on Win98, but I believe if it can run > the .NET Framework then it will work. > > ShaneO > > There are 10 kinds of people - Those who understand Binary and those who > don't. Cor Ligthert [MVP] wrote:
> Shane, Cor, yes I've read that and certainly don't dispute it, however in my > > Not all drives have serialnumbers. > > Cor > experience (so far) I haven't found it to be the case. Looking at my code sample, what do you believe would be returned in this case? Under what circumstances are Serial Numbers not available? ShaneO There are 10 kinds of people - Those who understand Binary and those who don't. Hi Paul
You could also use the MAC address as this is specific to the NIC card (as far as I understand) and has to be unique on the same network. As a failsafe to the code that's posted here for getting the serial number of the harddrive, you could use a combination of the MAC address and the harddrive serial - that way, if the drive doesn't have a serial then you can use the MAC address. There's plenty of code available for getting the MAC address should you need it. Martin Paul Bromley wrote: Show quoteHide quote > Many thanks for this Shane - I will take a look tomorrow. Has this worked OK > on Win2K as well as XP? > > Best wishes > > Paul Bromley > > > "ShaneO" <spc***@optusnet.com.au> wrote in message > news:457c99ff$0$16557$afc38c87@news.optusnet.com.au... > > Paul Bromley wrote: > >> I assume that this is likely to be the best way? :- > >> > >> mComputerNetBiosName = System.Environment.MachineName > >> > > > > Yes, you're correct with this. > > > > I've followed your other posts and would like to suggest that generating a > > unique Serial Number for your software, on each machine that it is > > executed, is not that difficult. > > > > I use the following code (watch for wrapping!) - > > > > Imports System.Management > > > > ''' <summary> > > ''' String of 1 to 2 chars. eg. "C" or "C:". > > ''' </summary> > > ''' <param name="sDriveLetter"></param> > > ''' <returns></returns> > > ''' <remarks></remarks> > > Public Function GetDriveSerialNumber(ByVal sDriveLetter As String) As > > String > > > > If Len(sDriveLetter) = 1 Then > > sDriveLetter &= ":" > > Else > > sDriveLetter = Strings.Left(Environment.SystemDirectory, 2) > > End If > > > > Dim HardDiskInfo As New ManagementObject("Win32_LogicalDisk.DeviceID=" & > > ChrW(34) & sDriveLetter & ChrW(34)) > > Dim HardDiskProperty As PropertyData = > > HardDiskInfo.Properties("VolumeSerialNumber") > > Return HardDiskProperty.Value.ToString > > > > End Function > > > > > > I first obtain the Drive Serial Number and then ensure it is 8-Characters > > in length - > > > > Dim sA As String = > > GetDriveSerialNumber(Strings.Left(Environment.SystemDirectory, 2)) > > > > Dim N As UInt16 = Len(sA) > > If N < 8 Then > > sA = sA.PadRight(8 - N, "0") > > ElseIf N > 8 Then > > sA = Strings.Left(sA, 8) 'Truncate to 8 Chars. > > End If > > > > > > After this I "AND" the value with another routine that automatically > > generates an 8-Character HEX number based on the title of my software. I > > then end up with a 16-Character HEX number, which is unique to each of my > > applications and unique on every computer, I then do some more XOR'ing and > > present this to the User as the Application Serial Number. > > > > I obviously have another application that reverses all of this to provide > > an Unlock Code that the User enters. > > > > There are literally hundreds of Users running my applications using this > > method, and although it really only stops the honest pirates, it serves my > > purposes well. > > > > If you'd like to see an example, please download one of my apps (written > > for specific clients) from the following site - > > > > www.arnfieldcomputerservices.com/apps/spi/publish.htm > > > > This will provide an example of what my Registration Screen looks like. > > > > If you require any further assistance, please feel free to contact me > > direct via the email address used in this post. > > > > ShaneO > > > > There are 10 kinds of people - Those who understand Binary and those who > > don't. Thanks for all of the feedback on this and my recent posts. I have decided
to go with computer name and to use this along with other strings in an encrypted format to produce my registartion keys. This will be more than adequate for my purposes, as I do not want to make life difficult ofr my users, but just want to preevent them from making multpile unpaid installs on the same network. Best wishes, Paul Bromley Show quoteHide quote "Pritcham" <dontwanttogivemyn***@hotmail.com> wrote in message news:1165841082.577163.65320@j72g2000cwa.googlegroups.com... > Hi Paul > > You could also use the MAC address as this is specific to the NIC card > (as far as I understand) and has to be unique on the same network. > > As a failsafe to the code that's posted here for getting the serial > number of the harddrive, you could use a combination of the MAC address > and the harddrive serial - that way, if the drive doesn't have a serial > then you can use the MAC address. > > There's plenty of code available for getting the MAC address should you > need it. > > Martin > > Paul Bromley wrote: > >> Many thanks for this Shane - I will take a look tomorrow. Has this worked >> OK >> on Win2K as well as XP? >> >> Best wishes >> >> Paul Bromley >> >> >> "ShaneO" <spc***@optusnet.com.au> wrote in message >> news:457c99ff$0$16557$afc38c87@news.optusnet.com.au... >> > Paul Bromley wrote: >> >> I assume that this is likely to be the best way? :- >> >> >> >> mComputerNetBiosName = System.Environment.MachineName >> >> >> > >> > Yes, you're correct with this. >> > >> > I've followed your other posts and would like to suggest that >> > generating a >> > unique Serial Number for your software, on each machine that it is >> > executed, is not that difficult. >> > >> > I use the following code (watch for wrapping!) - >> > >> > Imports System.Management >> > >> > ''' <summary> >> > ''' String of 1 to 2 chars. eg. "C" or "C:". >> > ''' </summary> >> > ''' <param name="sDriveLetter"></param> >> > ''' <returns></returns> >> > ''' <remarks></remarks> >> > Public Function GetDriveSerialNumber(ByVal sDriveLetter As String) As >> > String >> > >> > If Len(sDriveLetter) = 1 Then >> > sDriveLetter &= ":" >> > Else >> > sDriveLetter = Strings.Left(Environment.SystemDirectory, 2) >> > End If >> > >> > Dim HardDiskInfo As New ManagementObject("Win32_LogicalDisk.DeviceID=" >> > & >> > ChrW(34) & sDriveLetter & ChrW(34)) >> > Dim HardDiskProperty As PropertyData = >> > HardDiskInfo.Properties("VolumeSerialNumber") >> > Return HardDiskProperty.Value.ToString >> > >> > End Function >> > >> > >> > I first obtain the Drive Serial Number and then ensure it is >> > 8-Characters >> > in length - >> > >> > Dim sA As String = >> > GetDriveSerialNumber(Strings.Left(Environment.SystemDirectory, 2)) >> > >> > Dim N As UInt16 = Len(sA) >> > If N < 8 Then >> > sA = sA.PadRight(8 - N, "0") >> > ElseIf N > 8 Then >> > sA = Strings.Left(sA, 8) 'Truncate to 8 Chars. >> > End If >> > >> > >> > After this I "AND" the value with another routine that automatically >> > generates an 8-Character HEX number based on the title of my software. >> > I >> > then end up with a 16-Character HEX number, which is unique to each of >> > my >> > applications and unique on every computer, I then do some more XOR'ing >> > and >> > present this to the User as the Application Serial Number. >> > >> > I obviously have another application that reverses all of this to >> > provide >> > an Unlock Code that the User enters. >> > >> > There are literally hundreds of Users running my applications using >> > this >> > method, and although it really only stops the honest pirates, it serves >> > my >> > purposes well. >> > >> > If you'd like to see an example, please download one of my apps >> > (written >> > for specific clients) from the following site - >> > >> > www.arnfieldcomputerservices.com/apps/spi/publish.htm >> > >> > This will provide an example of what my Registration Screen looks like. >> > >> > If you require any further assistance, please feel free to contact me >> > direct via the email address used in this post. >> > >> > ShaneO >> > >> > There are 10 kinds of people - Those who understand Binary and those >> > who >> > don't. >
Retrieving info out of a MDB
Commercial copy protection? ERROR: The state information is invalid for this page and might be corrupted Settings in VB.NET/WinForms How to Add *AND* Process Checkbox Column in a DataGridView? WebBrowser BeforeNavigate2 - What is pDisp? How to create an IDE? Creating A Movie Player? Exit Button Placeholder Control |
|||||||||||||||||||||||