저는 Excel VBA 응용 프로그램을 작성 중입니다.VBA 응용 프로그램 용 제품 키를 만들어 소프트웨어 불법 배포를 방지하려면 어떻게합니까?
저희 회사는 제품으로 만들고 싶습니다. 이 응용 프로그램은 하나의 시스템에만 설치할 수 있어야합니다. 누군가 나를 도와주세요.
저는 Excel VBA 응용 프로그램을 작성 중입니다.VBA 응용 프로그램 용 제품 키를 만들어 소프트웨어 불법 배포를 방지하려면 어떻게합니까?
저희 회사는 제품으로 만들고 싶습니다. 이 응용 프로그램은 하나의 시스템에만 설치할 수 있어야합니다. 누군가 나를 도와주세요.
이것은 하나의 시스템에만 제품을 설치하는 방법에 대한 기본적인 예제 일뿐입니다.
논리 : 당신은 또한 사용자 이름과 이메일 주소
Unique Code
전송 (이 앱 내에서 수행되는)를 Unique Code
를 생성하는 (이메일을 통해 만나 /온라인 활성화/전화)를 검색하기위한 Unique Code
코드를 기반으로 사용자 Activation Id
를 보냅니다. 이 정보가 있으면, 당신은 다음 이름으로 병합 할 수
'~~> Get the CPU No
CPU = GetWmiDeviceSingleValue("Win32_Processor", "ProcessorID")
'~~> Get the Hard Disk No
Dim h As HDSN
Set h = New HDSN
With h
.CurrentDrive = 0
HDNo = .GetSerialNumber
End With
Set h = Nothing
사용하여 코드)
Private Const VER_PLATFORM_WIN32S = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2
Private Const DFP_RECEIVE_DRIVE_DATA = &H7C088
Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const GENERIC_READ = &H80000000
Private Const GENERIC_WRITE = &H40000000
Private Const OPEN_EXISTING = 3
Private Const CREATE_NEW = 1
Private Enum HDINFO
HD_MODEL_NUMBER
HD_SERIAL_NUMBER
HD_FIRMWARE_REVISION
End Enum
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Type IDEREGS
bFeaturesReg As Byte
bSectorCountReg As Byte
bSectorNumberReg As Byte
bCylLowReg As Byte
bCylHighReg As Byte
bDriveHeadReg As Byte
bCommandReg As Byte
bReserved As Byte
End Type
Private Type SENDCMDINPARAMS
cBufferSize As Long
irDriveRegs As IDEREGS
bDriveNumber As Byte
bReserved(1 To 3) As Byte
dwReserved(1 To 4) As Long
End Type
Private Type DRIVERSTATUS
bDriveError As Byte
bIDEStatus As Byte
bReserved(1 To 2) As Byte
dwReserved(1 To 2) As Long
End Type
Private Type SENDCMDOUTPARAMS
cBufferSize As Long
DStatus As DRIVERSTATUS
bBuffer(1 To 512) As Byte
End Type
Private Declare Function GetVersionEx _
Lib "kernel32" Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function CreateFile _
Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
ByVal lpSecurityAttributes As Long, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle _
Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function DeviceIoControl _
Lib "kernel32" _
(ByVal hDevice As Long, _
ByVal dwIoControlCode As Long, _
lpInBuffer As Any, _
ByVal nInBufferSize As Long, _
lpOutBuffer As Any, _
ByVal nOutBufferSize As Long, _
lpBytesReturned As Long, _
ByVal lpOverlapped As Long) As Long
Private Declare Sub ZeroMemory _
Lib "kernel32" Alias "RtlZeroMemory" _
(dest As Any, _
ByVal numBytes As Long)
Private Declare Sub CopyMemory _
Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As Any, _
Source As Any, _
ByVal Length As Long)
Private Declare Function GetLastError _
Lib "kernel32"() As Long
Private mvarCurrentDrive As Byte
Private mvarPlatform As String
Public Property Get Copyright() As String
Copyright = "HDSN Vrs. 1.00, (C) Antonio Giuliana, 2001-2003"
End Property
Public Function GetModelNumber() As String
GetModelNumber = CmnGetHDData(HD_MODEL_NUMBER)
End Function
Public Function GetSerialNumber() As String
GetSerialNumber = CmnGetHDData(HD_SERIAL_NUMBER)
End Function
Public Function GetFirmwareRevision() As String
GetFirmwareRevision = CmnGetHDData(HD_FIRMWARE_REVISION)
End Function
Public Property Let CurrentDrive(ByVal vData As Byte)
If vData < 0 Or vData > 3 Then
Err.Raise 10000, , "Illegal drive number" ' IDE drive 0..3
End If
mvarCurrentDrive = vData
End Property
Public Property Get CurrentDrive() As Byte
CurrentDrive = mvarCurrentDrive
End Property
Public Property Get Platform() As String
Platform = mvarPlatform
End Property
Private Sub Class_Initialize()
Dim OS As OSVERSIONINFO
OS.dwOSVersionInfoSize = Len(OS)
Call GetVersionEx(OS)
mvarPlatform = "Unk"
Select Case OS.dwPlatformId
Case Is = VER_PLATFORM_WIN32S
mvarPlatform = "32S"
Case Is = VER_PLATFORM_WIN32_WINDOWS
If OS.dwMinorVersion = 0 Then
mvarPlatform = "W95"
Else
mvarPlatform = "W98"
End If
Case Is = VER_PLATFORM_WIN32_NT
mvarPlatform = "WNT"
End Select
End Sub
Private Function CmnGetHDData(hdi As HDINFO) As String
Dim bin As SENDCMDINPARAMS
Dim bout As SENDCMDOUTPARAMS
Dim hdh As Long
Dim br As Long
Dim ix As Long
Dim hddfr As Long
Dim hddln As Long
Dim s As String
Select Case hdi
Case HD_MODEL_NUMBER
hddfr = 55
hddln = 40
Case HD_SERIAL_NUMBER
hddfr = 21
hddln = 20
Case HD_FIRMWARE_REVISION
hddfr = 47
hddln = 8
Case Else
Err.Raise 10001, "Illegal HD Data type"
End Select
Select Case mvarPlatform
Case "WNT"
hdh = CreateFile("\\.\PhysicalDrive" & mvarCurrentDrive, _
GENERIC_READ + GENERIC_WRITE, FILE_SHARE_READ + FILE_SHARE_WRITE, _
0, OPEN_EXISTING, 0, 0)
Case "W95", "W98"
hdh = CreateFile("\\.\Smartvsd", _
0, 0, 0, CREATE_NEW, 0, 0)
Case Else
Err.Raise 10002, , "Illegal platform (only WNT, W98 or W95)"
End Select
If hdh = 0 Then
Err.Raise 10003, , "Error on CreateFile"
End If
ZeroMemory bin, Len(bin)
ZeroMemory bout, Len(bout)
With bin
.bDriveNumber = mvarCurrentDrive
.cBufferSize = 512
With .irDriveRegs
If (mvarCurrentDrive And 1) Then
.bDriveHeadReg = &HB0
Else
.bDriveHeadReg = &HA0
End If
.bCommandReg = &HEC
.bSectorCountReg = 1
.bSectorNumberReg = 1
End With
End With
DeviceIoControl hdh, DFP_RECEIVE_DRIVE_DATA, _
bin, Len(bin), bout, Len(bout), br, 0
s = ""
For ix = hddfr To hddfr + hddln - 1 Step 2
If bout.bBuffer(ix + 1) = 0 Then Exit For
s = s & Chr(bout.bBuffer(ix + 1))
If bout.bBuffer(ix) = 0 Then Exit For
s = s & Chr(bout.bBuffer(ix))
Next ix
CloseHandle hdh
CmnGetHDData = Trim(s)
End Function
당신은 다음을 호출 할 수 있습니다에서 언급 된 저작권 정보를 원하시면, 성 및 이메일 주소 문자열을 만듭니다. 예를 들어
strg = Trim(FirstName) & Chr(1) & Trim(LastName) & Chr(1) & _
Trim(EmailAddress) & Chr(1) & Trim(CPU) & Chr(1) & Trim(HDNo)
문자열이 생기면 암호화 할 수 있습니다. 다음은 암호화하는 또 다른 기본 예제입니다. 당신은 당신이
For i = 1 To Len(strg)
RandomNo = (Rnd * 100)
tmp = tmp & Hex((Asc(Mid(strg, i, 1)) Xor RandomNo))
Next
tmp
위의 암호화 된 문자열을 보유하고 싶습니다 암호화의 모든 유형을 선택할 수 있습니다.
이 문자열을 받으면이를 디코딩하여 그에 따라 Activation Id
을 만들어야합니다. 귀하는 앱이 Activation Id
을 수락 할 수 있어야합니다. 이 정보를 레지스트리 또는 Dat File에 저장할 수도 있습니다.
간단한 등록 창이 다음과 같이 보일 수 있습니다.
희망이 당신이 시작됩니다! :)
IMP : VBA 프로젝트를 잠글 수 있지만 확실히 해킹을 증명할 수는 없지만. 위의 작업을 수행하는 DLL을 만들려면 VSTO를 탐색해야 할 수 있습니다.
모든 세부 단계에 대해 sooooooooooooo 감사합니다.모든 정보를 정리하는 시간을 가져 주셔서 감사합니다. 니가 내 목숨을 구했어. 고마워요. – Developer
당신은 환영합니다 :) –
@SiddharthRout 안녕하세요, 뒤에 아이디어는 VBA 프로젝트를 잠그고 있습니까? 그러나 당신이 언급했듯이, 그것은 쉽게 해킹 될 수 있습니까? – Larry