Solved

CPU Serial Nnumber?

Posted on 1997-05-12
2
283 Views
Last Modified: 2012-08-14
Is it possible to obtain a PC's CPU serial number?

I'm trying to add functionality to an application to prevent
illegal copies.  I'm open for obtaining anything unique
on a PC so the application will recognize that it's been
copied and halt.

A dummy file in an obscure directory will not work..

Thanks,
 Jim..
0
Comment
Question by:jselman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
Lucas041697 earned 100 total points
ID: 1426224
Sorry, is not possible obtain CPU serial number.

You can obtain the HD serial number with:

16 bit
(use VBIO.VBX or VBASM.DLL)

32 bit
This program shows how to retrieve information about a specific file.
 1.      Create a new project in Visual Basic. Form1 is created by default.
 2.      From the Visual Basic Insert menu, select Module to create a new module. Module1.Bas is created by default.
 3.      Add the following code to Module1.Bas (note that each Declare statement must be typed as a single line of code):
 
Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String,
   lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Declare Function GetFileInformationByHandle Lib "kernel32" (ByVal hFile
   As Long, lpFileInformation As BY_HANDLE_FILE_INFORMATION) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FileTime,
   lpSystemTime As SYSTEMTIME) As Long
Public Const OFS_MAXPATHNAME = 128
Public Const OF_READ = &H0
Type OFSTRUCT
        cBytes As Byte
        fFixedDisk As Byte
        nErrCode As Integer
        Reserved1 As Integer
        Reserved2 As Integer
        szPathName(OFS_MAXPATHNAME) As Byte
End Type
Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
End Type
Type FileTime
        dwLowDateTime As Long
        dwHighDateTime As Long
End Type
Type BY_HANDLE_FILE_INFORMATION
        dwFileAttributes As Long
        ftCreationTime As FileTime
        ftLastAccessTime As FileTime
        ftLastWriteTime As FileTime
        dwVolumeSerialNumber As Long
        nFileSizeHigh As Long
        nFileSizeLow As Long
        nNumberOfLinks As Long
        nFileIndexHigh As Long
        nFileIndexLow As Long
End Type
 
 4.      Add a Command Button control to Form1. Command1 is created by default.
 5.      Add the following code to the Click event for Command1:
 
Private Sub Command1_Click()
    Dim Ret As Long
    Dim FileHandle As Long
    Dim FileInfo As BY_HANDLE_FILE_INFORMATION
    Dim lpReOpenBuff As OFSTRUCT
    Dim FileTime As SYSTEMTIME

    FileHandle = OpenFile("c:\autoexec.bat", lpReOpenBuff, OF_READ)
    Ret = GetFileInformationByHandle(FileHandle, FileInfo)

    Ret = FileTimeToSystemTime(FileInfo.ftCreationTime, FileTime)
    Print "File created on " & FileTime.wYear, FileTime.wMonth,
       FileTime.wDay

    Ret = FileTimeToSystemTime(FileInfo.ftLastAccessTime, FileTime)
    Print "File last accessed on: " & FileTime.wYear, FileTime.wMonth,
       FileTime.wDay

    Ret = FileTimeToSystemTime(FileInfo.ftLastWriteTime, FileTime)
    Print "File last written to: " & FileTime.wYear, FileTime.wMonth,
       FileTime.wDay

    Print "Volume Serial Number is: " & FileInfo.dwVolumeSerialNumber
    Print "File attributes are: " & FileInfo.dwFileAttributes


    Ret = CloseHandle(FileHandle)
End Sub
 
 
Run the example program by pressing F5. Click the Command Button control. The program displays the file's creation date, last access date, and last write date, as well as the disk's volume serial number and the attributes associated with the file.

! Use Serial Disk Number and merge with your protect string to
 obtain a secure attivation code. !!

--------------------------------------------------------------------------
P.S. Excuse for my english, i'm italian developer
-------------------------------------------------------------------------

I hope this help !
0
 

Author Comment

by:jselman
ID: 1426225
Thanks Lucas.  This will save me a a lot of research time digging
through API manuals, etc....


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 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