|
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.
|
|
|
|
|
this sounds like making a string class... why not use what's there already at this point?
|
|
|
|
|
I hoped someone would get a hint!!
Watched code never compiles.
|
|
|
|
|
in that case........
|
|
|
|
|
I agree that this requirement is weird, specificallly as you are using cin and cout, which are also part of the STL, and internally do use dynamic container classes! Not to mention that for the purpose of writing and reading simple char arrays, cin and cout are hopelessly inefficient, you'd be better served with puts() and _getch() .
Since you don't know the length of the input in advance, the only way to ensure you have a sufficiently large buffer is using a container that dynamically resizes itself. If you don't want to use std::string, or other string classes like CString, then I suppose using std::vector is out of the question as well? If that is so, you have to implement a dynamical container yourself. I don't see why anyone would want you to waste time on that though, unless it is for homework.
Anyway, what you need to do is
1. use or implement your own dynamical container, such as std::vector
2. make a loop to read the input, using _getch() to read individual characters
3. for each character, check whether it belongs to the input, or indocates the end of input; if input, store it in your dynamical container.
Also, at the end of the program, don't forget to release the memory that you allocated for your dynamical container. std::vector or std::string will do that for you, but if you have your own class, you need to take care of it yourself.
|
|
|
|
|
Hi!
I need to get hash key for a string using MD5 algorithm. How to do this in C++? Where to start?
|
|
|
|