'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.
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.....
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.
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.
int _tmain(int argc, _TCHAR* argv)
char *ptr = new char;
Above code will work fine.
In statement char * ptr = new char; 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.
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.
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<