|
Traditionally, people have used disk serial numbers, or MAC ids, or other hardware identification number to uniquely identify a PC.
Although I will warn you, if used to lock software, these serial numbers are somewhat easy to change for a computer expert (although it may be very hard for a novice to do so).
|
|
|
|
|
Albert Holguin wrote: Traditionally, people have used disk serial numbers, or MAC ids, or other
hardware identification number to uniquely identify a PC.
disk serial numbers is changed when format the disk, and MAC id is also changebale.
i find the processor id like this
struct CPUInfo
{
int EAX;
int EBX;
int ECX;
int EDX;
};
void __cpuid(int CPUInfo[4], int InfoType);
int b[4];
char eax_hex[9]= {0,0,0,0,0,0,0,0};
char edx_hex[9]= {0,0,0,0,0,0,0,0};
char cpuid_hex[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
char* first = &cpuid_hex[0];
char* second = &cpuid_hex[8];
__cpuid(b,1);
sprintf_s(first,9, "%08X",b[3]);
sprintf_s(second,9, "%08X",b[0]);
fprintf(stdout, "processorid (equal to wmi repoted processor id): %s\n", cpuid_hex);
fprintf(stdout,"eax:%d ebx:%d ecx:%d edx:%d\n",b[0],b[1],b[2],b[3]);
its return value like: BFEBFBFF00010676
so please tell me its a write way to calculate the processor id.
and can i use the processor ID as unique ID to idetify the PC.
Thanks in advance.
|
|
|
|
|
Again, NO this is not the correct to implement a hardware ID scheme.
As in to say - you _cannot_ use the just the results of this single instruction to effectively ID a processor.
When I use the following code, and step through it an a debugger - you know what I get?
Main Proc
mov eax, 3
cpuid
RET
Main EndP
Absolutely nothing!
EAX = 0x00000000
EBX = 0x00000000
EDX = 0x00000000
And you're right - the MACID reported by windows can be changed, as can the Volume Serial Number of a harddisk. These aren't the figures traditionally queried.
The figures are the ones reported by hardware itself, not by the operating system between you and the hardware.
Alias Maya, since Autodesk Maya - used to implement a simple MACID/computed hash-value scheme. It was a joke and was defeated trivially.
Other schemes, SECUROM or SAFEDISK (I forget which) would actually write data to a certain sector on the hard-disk. This data was persistant, remaining after a full format of the system!!! You could only kill that nasty critter by manually overwriting it in a editor that supported raw disk-sectors.
If I may respectfully make a suggestion - there are many, many, m a n y protection schemes already available - many for free download. These have years of refinement and intrusion prevention already built in. I'd hate to see (yet another) overestimation on the part of the coder that he/she has the next-best-thing in terms of copyright protection.
Perhaps I could put this another way - I used to surf Softpedia looking for small new apps to try to break into. Invariably, those that proved the hardest to penetrate were those that used commercial protectors - and ones that used virtual machines and opcode/algorithm obfuscation.
PEiD, OllyDbg, ExeDecryptor, exeUnpacker and a loooooooot of hours playing the game have led me to believe that you're probably far better off using a shareware/freeware/cheapware solution than anything you can come up yourself.
Think of it this way - you need to provide a perfect 100% continuous fence of protection around your app. The cracker on the other hand is only required to find a single-hole to get in.
A couple of cases in point:
1 DraftIt - cad program. Coded in C#, unobfuscated assembly with the key algorithm plainly viewable with .NET Reflector.
Price: £99
Time required for correct-serial number entry: 1 hour
Method: copy and paste code from serial number checking algo into a new program
2. Motocalc - RC power system calculator, Delphi
Price: $40
Time required to enter any serial and still gain access: 12 minutes
Method: Change a single instruction so that a branch is no longer taken.
Try having a look at VirtualProtect, Armadillo, AsPack and anything else you can get your hands on.
Good luck keeping the riff-raff out!!
|
|
|
|
|
i just want to find the hardware id not anything else,and i don't want to use any other app for this.
i really need to find the unique hardware ID using my own application.
please help me to find out this.
|
|
|
|
|
|
i m using WMI data to find Processor ID its also return same processor ID that is:BFEBFBFF00010676
"Connected to ROOT\\CIMV2 WMI namespace"
"SELECT * FROM win32_processor"
VARIANT vtProp;
hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0);
wcout << " OS Name : " << vtProp.bstrVal << endl;
VariantClear(&vtProp);
hr = pclsObj->Get(L"ProcessorId", 0, &vtProp, 0, 0);
wcout << " ProcessorId : " << vtProp.bstrVal << endl;
VariantClear(&vtProp);
pclsObj->Release();
is the MachineGuid is unique or not?
modified on Thursday, June 30, 2011 8:23 AM
|
|
|
|
|
enhzflep wrote: These aren't the figures traditionally queried.
I disagree...
Anyway, I have yet to find a method that cannot be overcome, so its worthless chatter IMHO.
|
|
|
|
|
'Traditionally' was the word I used when thinking about the fact that in the past - and still today in the apps worth keeping safe, vendors will query the hardware itself. As we all know from the ability of one to change the MACID reported by their OS, this [EDIT:] approach of asking Windows for the information [EDIT/] is clearly insufficient and somewhat amateurish.
Generally, the publications that continue to be difficult to beat are the ones that install drivers or services and from there can query hardware directly, running in a much less restrictive environment than an exe that's just been run.
However I digress - you've put succinctly the problem with the cpuid instruction - this is not a measure to obtain a unique serial number.
modified on Thursday, June 30, 2011 1:04 PM
|
|
|
|
|
|
means the EAX,EBX,ECX,EDX can be different for same machine?
|
|
|
|
|
Le@rner wrote: means the EAX,EBX,ECX,EDX can be different for same machine?
Unless I misunderstand you, I believe it means that EAX, EBX, ECX, EDX will be the same for different machines.
|
|
|
|
|
ok now please tell me what is unique?
|
|
|
|
|
From something I read recently, I've come to believe that one may query the motherboard's serial number using WPF.
|
|
|
|
|
i m trying to finding motherboard number by WMI using Win32_BaseBoard but its return "To be filled by O.E.M" for SerialNumber.
|
|
|
|
|
Don't you just hate that..
Albert made some useful suggestions earlier - regarding collecting information about a number of different pieces of hardware. The more items you check, the less it matters if any of the methods fail to provide unique information.....
|
|
|
|
|
Means different machines with the same hardware can give you the same exact result.
|
|
|
|
|
Hello,
I am C++/VC++ developer. Many times for debugging we need to attach running project to our code. My project is huge. There are whole lot of processes are running. Suppose I have a code and I wanted to attach with process. I don't know name of process I wanted to attach with. Is there any way by which I can identify name of the process from my code (or IDE).
I highly appropriate, any help regarding this concern.
Thanks and Regards
Happy Programming.
|
|
|
|
|
|
Here [^]is the link on how to get list of all process.
|
|
|
|
|
If you mean to attach a debugger to the running executable of your code, then, usually, your debugger will have a means to do that. E. g. in Visual Studio you select the menu Debug-->Processes to get a list of processes that are currently running, and then choose one of that list to attach to.
If your code is part of a specific program, the name of that program defines the name of the process. If this program spawns multiple threads, you will still need to attach to that program - it will cause the debugger to attach to all threads spawned by this process.
If you mean to attach the running program of your code to attach to ... something else (to what?) then you need a programatical solution as pointed out in the other responses.
Pranit Kothari wrote: I highly appropriate
I think you mean 'appreciate'
|
|
|
|
|
Hello,
int _tmain(int argc, _TCHAR* argv[])
{
char *ptr = new char[100];
cout<<"Enter value";
cin>>ptr;
cout<<ptr;
return 0;
}
Above code will work fine.
In statement char * ptr = new char[100]; I have assinged 100 bytes of memory to ptr.
But I am some weired requirement. I don't want to assign any memory like 100 bytes still I want to get variable character. First question is, is it possible? If yes please suggest way. I will use char * only, no stl::string no CString.
Thanks and Regards
|
|
|
|
|
If you mean the length based on the number of characters typed by the user, that is not possible as you can never know how many will be typed. You can only do it this way by setting some reasonable maximum.
The best things in life are not things.
|
|
|
|
|
You could try reading the user input character by character e.g. by using getch or somesuch, dinamically reallocating your string as it goes, but you would need to handle special characters yourself, like when the user hits backspace or enter. Implementing this can be a pain in the assembly.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Pranit Kothari wrote: I will use char * only, no stl::string...
Then why are you using C++?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
yes, it's possible, you will need to create a wrapper class around the char* .
The class will have the responsibility to allocated and re-allocate the char* buffer.
It can be as simple or as complicated as you want it to be.
Watched code never compiles.
|
|
|
|
|