I want to protect my program from illegal copying;

How can I get the serial number of the processor or other hardware

And is there a better way for protection?