Introduction 

long time ago i felt that, like our countries there is no protection of our application when we sell to our clients so i got some ideas and i just gave some logics

i dont know some how first part got deleted and from then theres lot of changes made in dot net so i didnt tried and re-uploaded part1

Any how if you are interested i will give you some logic and you will try it on your own and if you have any trouble just email me.

   

So lets begin  

you should download WMI creator from microsoft site here is the link

<a target="_blank" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en">http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en</a> 

note: that it can generate code both in csharp and vb.net and second download tutorials from

<a target="_blank" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=720F0CAE-64A7-457F-BB95-E4F33E0CBC55&displaylang=en">http://www.microsoft.com/downloads/en/details.aspx?FamilyID=720F0CAE-64A7-457F-BB95-E4F33E0CBC55&displaylang=en</a> 

 

third read this article

<a target="_blank" href="http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=114">http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=114</a>

 

now the basic idea is Windows Media Instrument WMI class directly communicate with hardware

for Example if you want to get the OS information you can use class OperatingSystem and you will get all os information for eg. when os was installed

virtual memory used by os etc now how to generate these classes use WMI code generator which i mention it to download first

now if you got the id of any hardware for eg Harddisk or processor you can compare it with hardcoded id and compare it and thus making your application secure

now once i have tried this i had hard coded the Network Mac address and compare it with your code(Generate code to get mac address of your network card through WMI code generator) 

You may also try it on usb ,  give your client a specific usb and get its id from WMI Code generator and make your application run only when you inset that specific usb

and last thing there are certain other ways you can generate a WMI Class directly form visual studio 2008 server explorer 

As i have in part 1 i have develped a main form and the comparison of ids

so you must read part1

i have been emailed and asked to submit the source code for the processorid.dll

copy this code and paste in new project naming HardwareProcessorId
add a new class and name it CPUId for fetching processor id

'---------------------------------------------------------

Imports System

Imports System.Management

Namespace nsProcessorID

Public Class CPUId

'make a function which will get processor id from the system and return a string

Public Shared Function GetProcessorId() As String

Dim strProcessorId As String

Dim query As New SelectQuery("Win32_processor")

Dim search As New ManagementObjectSearcher(query)

Dim info As ManagementObject

For Each info In search.Get()

strProcessorId = info("processorId").ToString()

Next

Return strProcessorId

End Function

End Class

End Namespace

'--------------------------------------------------------

for motherboard id

add a new project and name it HardwareMotherboardID copy and paste the following source code into new class MotherBoardID.vb

'-----------------------------------------------------

Imports System

Imports System.Management

Namespace nsMotherBoardID

Public Class MotherBoardID

Public Shared Function GetMotherBoardID() As String

Dim strMotherBoardID As String

Dim query As New SelectQuery("Win32_BaseBoard")

Dim search As New ManagementObjectSearcher(query)

Dim info As ManagementObject

For Each info In search.Get()

strMotherBoardID = info("SerialNumber").ToString()

Next

Return strMotherBoardID

End Function

End Class

End Namespace

'-------------------------------------------------------

NOTE: i have used scriptomatic or WMI Creator  from microsoft.com u can use it to find other querry e.g usb and hardisk etc

推荐.NET配套的通用数据层ORM框架:CYQ.Data 通用数据层框架
新浪微博粉丝精灵,刷粉丝、刷评论、刷转发、企业商家微博营销必备工具"