473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

cypher

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
Mar 25 '08 #1
5 2066
mshmyob
904 Expert 512MB
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.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4.    Private Const NCBASTAT = &H33
  5.    Private Const NCBNAMSZ = 16
  6.    Private Const HEAP_ZERO_MEMORY = &H8
  7.    Private Const HEAP_GENERATE_EXCEPTIONS = &H4
  8.    Private Const NCBRESET = &H32
  9.  
  10.    Private Type NCB
  11.         ncb_command As Byte 'Integer
  12.         ncb_retcode As Byte 'Integer
  13.         ncb_lsn As Byte 'Integer
  14.         ncb_num As Byte ' Integer
  15.         ncb_buffer As Long 'String
  16.         ncb_length As Integer
  17.         ncb_callname As String * NCBNAMSZ
  18.         ncb_name As String * NCBNAMSZ
  19.         ncb_rto As Byte 'Integer
  20.         ncb_sto As Byte ' Integer
  21.         ncb_post As Long
  22.         ncb_lana_num As Byte 'Integer
  23.         ncb_cmd_cplt As Byte  'Integer
  24.         ncb_reserve(9) As Byte ' Reserved, must be 0
  25.         ncb_event As Long
  26.    End Type
  27.    Private Type ADAPTER_STATUS
  28.         adapter_address(5) As Byte 'As String * 6
  29.         rev_major As Byte 'Integer
  30.         reserved0 As Byte 'Integer
  31.         adapter_type As Byte 'Integer
  32.         rev_minor As Byte 'Integer
  33.         duration As Integer
  34.         frmr_recv As Integer
  35.         frmr_xmit As Integer
  36.         iframe_recv_err As Integer
  37.         xmit_aborts As Integer
  38.         xmit_success As Long
  39.         recv_success As Long
  40.         iframe_xmit_err As Integer
  41.         recv_buff_unavail As Integer
  42.         t1_timeouts As Integer
  43.         ti_timeouts As Integer
  44.         Reserved1 As Long
  45.         free_ncbs As Integer
  46.         max_cfg_ncbs As Integer
  47.         max_ncbs As Integer
  48.         xmit_buf_unavail As Integer
  49.         max_dgram_size As Integer
  50.         pending_sess As Integer
  51.         max_cfg_sess As Integer
  52.         max_sess As Integer
  53.         max_sess_pkt_size As Integer
  54.         name_count As Integer
  55.    End Type
  56.    Private Type NAME_BUFFER
  57.         name  As String * NCBNAMSZ
  58.         name_num As Integer
  59.         name_flags As Integer
  60.    End Type
  61.    Private Type ASTAT
  62.         adapt As ADAPTER_STATUS
  63.         NameBuff(30) As NAME_BUFFER
  64.    End Type
  65.  
  66.    Private Declare Function Netbios Lib "netapi32.dll" _
  67.            (pncb As NCB) As Byte
  68.    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
  69.            hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
  70.    Private Declare Function GetProcessHeap Lib "kernel32" () As Long
  71.    Private Declare Function HeapAlloc Lib "kernel32" _
  72.            (ByVal hHeap As Long, ByVal dwFlags As Long, _
  73.            ByVal dwBytes As Long) As Long
  74.    Private Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, _
  75.            ByVal dwFlags As Long, lpMem As Any) As Long
  76.  
  77.  
  78. ' button ONCLICK event
  79. Private Sub cmdGetMAC_Click()
  80. Dim myNcb As NCB
  81.        Dim bRet As Byte
  82.        myNcb.ncb_command = NCBRESET
  83.        bRet = Netbios(myNcb)
  84.  
  85.        myNcb.ncb_command = NCBASTAT
  86.        myNcb.ncb_lana_num = 0
  87.        myNcb.ncb_callname = "*               "
  88.  
  89.        Dim myASTAT As ASTAT, tempASTAT As ASTAT
  90.        Dim pASTAT As Long
  91.        myNcb.ncb_length = Len(myASTAT)
  92.        Debug.Print Err.LastDllError
  93.        pASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS _
  94.                 Or HEAP_ZERO_MEMORY, myNcb.ncb_length)
  95.        If pASTAT = 0 Then
  96.           Debug.Print "memory allcoation failed!"
  97.           Exit Sub
  98.        End If
  99.        myNcb.ncb_buffer = pASTAT
  100.        bRet = Netbios(myNcb)
  101.        Debug.Print Err.LastDllError
  102.        CopyMemory myASTAT, myNcb.ncb_buffer, Len(myASTAT)
  103.        MsgBox Hex(myASTAT.adapt.adapter_address(0)) & " " & _
  104.               Hex(myASTAT.adapt.adapter_address(1)) _
  105.               & " " & Hex(myASTAT.adapt.adapter_address(2)) & " " _
  106.               & Hex(myASTAT.adapt.adapter_address(3)) _
  107.               & " " & Hex(myASTAT.adapt.adapter_address(4)) & " " _
  108.               & Hex(myASTAT.adapt.adapter_address(5))
  109.        HeapFree GetProcessHeap(), 0, pASTAT
  110. End Sub
  111.  
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
Mar 25 '08 #2
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.
Mar 29 '08 #3
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)
Mar 29 '08 #4
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 #)?
Mar 30 '08 #5
mshmyob
904 Expert 512MB
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)
Mar 30 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
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...
5
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...
24
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:
4
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...
0
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...
3
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...
0
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...
2
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
marktang
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,...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.