I would like to create a registration # for my db so after the trial period has expired the user must enter the registration #.
to do this I would like to get 2 unique values from the pc
posable the Mac address from the motherboard, and I think every processor has an adress or serial # that is uniqe to it(correct me if im wrong)
and with those 2 vaules perform a cypher on them and add the 2 cypers together.
so how to get those 2 values using VBA? and then how do I create my cypher (Ie: A cold = 1) ,(lower case e = capitale Z), in my example my cypher isn't realy thaught out as to the algarythem but you have the idea if you don't know what a cypher is. a cypher is an algarythm that when appied increment or dincremnets the origonal value to algarythm of the chyper
for the end user to get this registration code , I would have the generator that would then give me the correct values to tell the user to enter.
thanks for helping
5 2066
Here is the code to get the MAC address. I would not suggest trying to get the CPU serial number only because you cannot get it from every machine (it can be disabled) so it would not be reliable.
You could get the MAC address and then do a CRC checksum on it and create a unique number and use that as your registration code.
I did that years ago in DOS Basic so I would need to take some time to work out the CRC in VBA.
Any ways here is the MAC address code. -
Option Compare Database
-
Option Explicit
-
-
Private Const NCBASTAT = &H33
-
Private Const NCBNAMSZ = 16
-
Private Const HEAP_ZERO_MEMORY = &H8
-
Private Const HEAP_GENERATE_EXCEPTIONS = &H4
-
Private Const NCBRESET = &H32
-
-
Private Type NCB
-
ncb_command As Byte 'Integer
-
ncb_retcode As Byte 'Integer
-
ncb_lsn As Byte 'Integer
-
ncb_num As Byte ' Integer
-
ncb_buffer As Long 'String
-
ncb_length As Integer
-
ncb_callname As String * NCBNAMSZ
-
ncb_name As String * NCBNAMSZ
-
ncb_rto As Byte 'Integer
-
ncb_sto As Byte ' Integer
-
ncb_post As Long
-
ncb_lana_num As Byte 'Integer
-
ncb_cmd_cplt As Byte 'Integer
-
ncb_reserve(9) As Byte ' Reserved, must be 0
-
ncb_event As Long
-
End Type
-
Private Type ADAPTER_STATUS
-
adapter_address(5) As Byte 'As String * 6
-
rev_major As Byte 'Integer
-
reserved0 As Byte 'Integer
-
adapter_type As Byte 'Integer
-
rev_minor As Byte 'Integer
-
duration As Integer
-
frmr_recv As Integer
-
frmr_xmit As Integer
-
iframe_recv_err As Integer
-
xmit_aborts As Integer
-
xmit_success As Long
-
recv_success As Long
-
iframe_xmit_err As Integer
-
recv_buff_unavail As Integer
-
t1_timeouts As Integer
-
ti_timeouts As Integer
-
Reserved1 As Long
-
free_ncbs As Integer
-
max_cfg_ncbs As Integer
-
max_ncbs As Integer
-
xmit_buf_unavail As Integer
-
max_dgram_size As Integer
-
pending_sess As Integer
-
max_cfg_sess As Integer
-
max_sess As Integer
-
max_sess_pkt_size As Integer
-
name_count As Integer
-
End Type
-
Private Type NAME_BUFFER
-
name As String * NCBNAMSZ
-
name_num As Integer
-
name_flags As Integer
-
End Type
-
Private Type ASTAT
-
adapt As ADAPTER_STATUS
-
NameBuff(30) As NAME_BUFFER
-
End Type
-
-
Private Declare Function Netbios Lib "netapi32.dll" _
-
(pncb As NCB) As Byte
-
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
-
hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
-
Private Declare Function GetProcessHeap Lib "kernel32" () As Long
-
Private Declare Function HeapAlloc Lib "kernel32" _
-
(ByVal hHeap As Long, ByVal dwFlags As Long, _
-
ByVal dwBytes As Long) As Long
-
Private Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, _
-
ByVal dwFlags As Long, lpMem As Any) As Long
-
-
-
' button ONCLICK event
-
Private Sub cmdGetMAC_Click()
-
Dim myNcb As NCB
-
Dim bRet As Byte
-
myNcb.ncb_command = NCBRESET
-
bRet = Netbios(myNcb)
-
-
myNcb.ncb_command = NCBASTAT
-
myNcb.ncb_lana_num = 0
-
myNcb.ncb_callname = "* "
-
-
Dim myASTAT As ASTAT, tempASTAT As ASTAT
-
Dim pASTAT As Long
-
myNcb.ncb_length = Len(myASTAT)
-
Debug.Print Err.LastDllError
-
pASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS _
-
Or HEAP_ZERO_MEMORY, myNcb.ncb_length)
-
If pASTAT = 0 Then
-
Debug.Print "memory allcoation failed!"
-
Exit Sub
-
End If
-
myNcb.ncb_buffer = pASTAT
-
bRet = Netbios(myNcb)
-
Debug.Print Err.LastDllError
-
CopyMemory myASTAT, myNcb.ncb_buffer, Len(myASTAT)
-
MsgBox Hex(myASTAT.adapt.adapter_address(0)) & " " & _
-
Hex(myASTAT.adapt.adapter_address(1)) _
-
& " " & Hex(myASTAT.adapt.adapter_address(2)) & " " _
-
& Hex(myASTAT.adapt.adapter_address(3)) _
-
& " " & Hex(myASTAT.adapt.adapter_address(4)) & " " _
-
& Hex(myASTAT.adapt.adapter_address(5))
-
HeapFree GetProcessHeap(), 0, pASTAT
-
End Sub
-
Create a form with a button called 'cmdGetMac' and click on it.
cheers,
I would like to create a registration # for my db so after the trial period has expired the user must enter the registration #.
to do this I would like to get 2 unique values from the pc
posable the Mac address from the motherboard, and I think every processor has an adress or serial # that is uniqe to it(correct me if im wrong)
and with those 2 vaules perform a cypher on them and add the 2 cypers together.
so how to get those 2 values using VBA? and then how do I create my cypher (Ie: A cold = 1) ,(lower case e = capitale Z), in my example my cypher isn't realy thaught out as to the algarythem but you have the idea if you don't know what a cypher is. a cypher is an algarythm that when appied increment or dincremnets the origonal value to algarythm of the chyper
for the end user to get this registration code , I would have the generator that would then give me the correct values to tell the user to enter.
thanks for helping
Thanks for the code, sorry it took me a while to get back to you,
I can't tell by looking at it if it gets the MAC addresss and performs the crc check, or if it just gets the Mac Address?
I would like to display the Mac in a textbox for testing, whet line of the core is the reulting Mac, it would be easyer for me if your code was commented :-p
The mesgbox is only displaying 6 0's
thanks.
Im Always getting 6 0's in the messagebox , mnd does code perform a crc check or just return the MAC( getting lost reading the code)
I was able to get Cpu ID and motherboard serial by re working some vbscripts I had so they would work in my access Db(not hard) but with out testing them in a corperate enviroment, I have 1 question( I'll be able to hopefully test them monday) how likly is it for 2 pcs in an office setting to have the same cpu ID and motherboard serial (knowing companies buy the same computer configuratian several times over (yes I know the #'s are suposedly uniqe but I've been reading and some manufacture don't have cpu ID's or they use the same ID # as a modle # and it will come up as an ID #)?
Could you post your complete code so I can see. this has always worked for me and still does.
It does not include the CRC check.
cheers,
Im Always getting 6 0's in the messagebox , mnd does code perform a crc check or just return the MAC( getting lost reading the code)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: user |
last post by:
when i first load index.php with arguments ie: "index.php?page=x", the
$_SERVERvalue is null. I then get the session id appended to
each link. If i refresh the page, I get the $_SERVER I want,
but...
|
by: Didier C |
last post by:
Hi!
I was wondering if we can pass some arguments to system("cmdline")?
E.g in Perl, we can do something like:
$dir="/home/cypher";
system("ls $dir");
which would instruct Perl to do an...
|
by: Christopher Benson-Manica |
last post by:
Is there anything wrong with my attempt (below) at implementing
something resembling a smart pointer?
template < class T >
class SmartPointer
{
private:
T *t;
public:
|
by: Gactimus |
last post by:
Here is a program that encodes and decodes a text file. What I need to do
is write a C++ program that requests 3 different file names. One filename
is for the source file to be encoded, another is...
|
by: Daniel Reber |
last post by:
I am getting a strange unhandeled exception message. The same code is
working on many serevrs but I am getting an error at this one. The server is
locked down security wise and many of the windows...
|
by: John Lee |
last post by:
Hi,
Which API can I use to encrypt data without using the secret key and also
without purchased certificate? Is there an API that uses NT domain account
to get sort of "certificate" and encrypt...
|
by: smonroe |
last post by:
Hi All,
I thought our technology might interest the group.
Cypher is one of the first software program available which generates
the RDF graph and SeRQL query representations of a natural...
|
by: deVroned |
last post by:
Hi,
I'm just starting off with C++ and I'm having trouble compiling some code. There doesn't seem to be any form information included, but I would assume that each void_fastcall statement is for...
|
by: erictheone |
last post by:
so here is my code. My getlines for the strings keyword and phrase at lines 44 and 79 respectively don't work. Please help!!!
#include <cstdlib>
#include <string>
#include <iostream>
#include...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |