# How to build an application with MACHINE ID PROTECTION?



## imported_friends_for_all (Feb 23, 2005)

Dear all,

I've developped some video tutorials using
Camtasia Studio v2.1 & ACA Capture Pro v4.31.
They are simple .avi
files. Now I want to distribute them by making
an application and also protecting it (I mean,
the distributable CD) with "MACHINE ID PROTECTION"
feature so that everybody can view it after
entering the proper Serail(Generated based on
the MACHINE ID which differs from PC to PC & 
also OS to OS), but nobody can copy it or, rip
the .avi tutorial files inside. Now, I am going
to discuss it in detail.

1. My tutorial files are simple .avi files which
is playable in Windows Media Player interface.
I've seen in many tutorial/presentation CDs
(e.g. intro games on any Game CD, or, diff. videos
in Encyclopaedia Britanica CDs etc.) that the video
files are encrypted. You are not allowed to play
those video files(I remember, some of those
mysterious video files are in .bik format) using
standard video player(say, Windows media player).
Now, I want to know how these people create those
mysterious video files? Which application they
use? Or, they use some converters to convert
our known video files(.avi, .mpg, .mov etc.) to
a mysterious format which can only be seen/played
using their interface(or, application) only???

2. Next thing I want to know is how to protect an 
application by MACHINE ID PROTECTION??? I've seen
in many appz (say, Pinnacle Studio 9, 3D Studio Max 6,
Autocad 2004 etc.) that, during installation u need
a serial. After installing the app, an authentication
code is req. which is to be calculated using MACHINE ID
of the corresponding PC. I've also seen that MACHINE ID 
varies from OS to OS in the same PC (e.g. Pinnacle Studio 9).
Now I want to know, is it possible to protect my app
which will contain some video files and a menu(an .exe file)
using MACHINE ID protection??? Plz note that, I want to
distribute my app as a shareware (a 14 day trial). After 
the trial period is over, the app should be stopped. And
if proper Activation Key is entered, it should resume
its activities. Is it possible at all? If so, plz
guide me 


thanks in advance,

...friends_for_all


----------



## tuxfan (Feb 24, 2005)

What do you mean by machine id? Machine is made of various parts. So at most you can find the serial number, etc of all parts and make a composite number.

But what if someone plainly changes RAM stick or processor? Should they call you with problems :roll: I guess the best way is to use the hard disk serial number. I have a code in VB to find that out. Let me know if you want that


----------



## imported_friends_for_all (Feb 24, 2005)

dear tuxfan,

if u ever install Pinnacle Studio 8 or, 9 or, Discreet 3D Studio Max 5 or,
later, u would know what do i mean by Machine ID Protection !

and again, if u have some codes to share, then plz go ahead for lots
of developpers like me !

...friends_for_all


----------



## tuxfan (Feb 25, 2005)

Dear friends_for_all, I have never installed those softwares, so I really don't know what is Machine ID Protection 

As for the code. Here's the contents of the FRM file. Open notepad, put this code in that file and save it as .frm file.


```
VERSION 5.00
Begin VB.Form frmSrNoDateFormat 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Date Format & Data Media Serial Numbers ..."
   ClientHeight    =   3105
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5070
   Icon            =   "SrNo.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3105
   ScaleWidth      =   5070
   StartUpPosition =   2  'CenterScreen
   Begin VB.ComboBox cboSrNo 
      BeginProperty Font 
         Name            =   "Courier"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   120
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   1800
      Width           =   4815
   End
   Begin VB.CommandButton cmdClear 
      Caption         =   "&Clear"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   2520
      Width           =   2295
   End
   Begin VB.CommandButton cmdGetInfo 
      Caption         =   "Get &Information"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2640
      TabIndex        =   0
      Top             =   2520
      Width           =   2295
   End
   Begin VB.Line Line1 
      BorderWidth     =   2
      Index           =   1
      X1              =   0
      X2              =   5160
      Y1              =   1320
      Y2              =   1320
   End
   Begin VB.Label lblDateFormat 
      Alignment       =   2  'Center
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   120
      TabIndex        =   3
      Top             =   480
      Width           =   4815
   End
   Begin VB.Label lblStar 
      Alignment       =   2  'Center
      Caption         =   "(Gives format as ""dmy"" or mdy"", works in most cases)"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   6
      Top             =   840
      Width           =   4815
   End
   Begin VB.Line Line1 
      BorderWidth     =   2
      Index           =   0
      X1              =   0
      X2              =   5160
      Y1              =   2280
      Y2              =   2280
   End
   Begin VB.Label lblSrALbl 
      Alignment       =   2  'Center
      BackColor       =   &H80000012&
      Caption         =   "Serial Number"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000018&
      Height          =   255
      Left            =   120
      TabIndex        =   5
      Top             =   1560
      Width           =   4815
   End
   Begin VB.Label lblDFLbl 
      Alignment       =   2  'Center
      BackColor       =   &H80000012&
      Caption         =   "System Date Format"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000018&
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   240
      Width           =   4815
   End
End
Attribute VB_Name = "frmSrNoDateFormat"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long

Function GetSerialNumber(strDrive As String) As Long
    Dim SerialNum As Long
    Dim Res As Long
    Dim Temp1 As String
    Dim Temp2 As String
    Temp1 = String$(255, Chr$(0))
    Temp2 = String$(255, Chr$(0))
    Res = GetVolumeInformation(strDrive, Temp1, _
    Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
    GetSerialNumber = SerialNum
End Function

Private Sub cmdClear_Click()

lblDateFormat = ""
cboSrNo.Clear

End Sub

Private Sub cmdGetInfo_Click()

On Error Resume Next
lblDateFormat = " " & CurrDateFormat()
cboSrNo.Clear
For x = 65 To 90
    cboSrNo.AddItem " Drive " & Chr(x) & ": - " & SrNo(Chr(x) & ":")
Next
On Error GoTo 0

cboSrNo.ListIndex = 0

End Sub

Private Function SrNo(Drive As String) As String

On Error GoTo ErrHandler
SrNo = " " & GetSerialNumber(Drive)
On Error GoTo 0
Exit Function

ErrHandler:
SrNo = " " & "Error"
On Error GoTo 0

End Function

Public Function CurrDateFormat()
'returns a string in the format as mdy or dmy
Dim SubCurrDate, CurrDate, CurrDay, CurrMonth, CurrYear As String

CurrDate = Trim(Str(Date))

'also take care of the case where day = 1 to 9
'trim and str necessary
CurrDay = Trim(Str(Day(Now)))
If Len(CurrDay) = 1 Then
    CurrDay = "0" & CurrDay
End If

'also take care of the case where month = 1 to 9
'trim and str necessary
CurrMonth = Trim(Str(Month(Now)))
If Len(CurrMonth) = 1 Then
    CurrMonth = "0" & CurrMonth
End If

'trim and str necessary
CurrYear = Trim(Str(Year(Now)))
SubCurrDate = Trim(Mid(CurrDate, 1, 2))

'first two digits of date and day are same then dmy
If SubCurrDate = CurrDay Then
    CurrDateFormat = "dmy"
  Else
    CurrDateFormat = "mdy"
End If

End Function
```


----------



## imported_friends_for_all (Mar 1, 2005)

DEAR tuxfan ,

 thanks for your reply & the codes. i'll check them & get back to u
in case of any problems.  


...friends_for_all


----------



## tuxfan (Mar 2, 2005)

You are welcome.


----------



## onlyutkarsh (Mar 4, 2005)

hey dude!

you can try Visual Protect from *www.visagesoft.com/products/vp/index.php. it's grat tool for licence management u wanted. Though you have to chk out whether it helps u really or not.


----------



## imported_friends_for_all (Mar 5, 2005)

thank u onlyutkarsh for your valuable addition. i'm downloading it right
 now...

i've tested the following...

SerialShield 
ShareGuard Copy Protection v2.1
SoftwareKey Trial Creator v1.10
SoftwareShield System
Hardkey License Manager v3.2
Smart Protector Pro v4.1
The Armadillo Software Protection System v3.60

these applications r wonderful if u use Visual C++ or, VC.NET
or, Delphi. But not very useful in my case.

...friends_for_all


----------



## hitesh_hg (Mar 7, 2005)

Off topic ....why dont some ppl use the full page width for typing their querries...its such a pain to read four five words and then move on to next line...

That was my point of view....

Hitesh Gupta


----------

