Today, I accidentally found a project named Windows product key finder on codeplex, and its purpose can be seen from its name. With this software, you can easily obtain the product key for local windows. Of course, this is a practical tool for people who cannot find the key CD, but if you are in the hands of some people who are looking at it, your product key must be under threat.
Read the projectSource codeActuallyProgramThe core and most valuable part is to decode the digitalproductid value in \ HKLM \ Software \ Microsoft \ Windows NT \ CurrentVersion. As follows:CodeAs shown in:
Public static string Decodeproductkey ( Byte [] Digitalproductid ){ // Offset of first byte of encoded product key in // 'digitalproductidxxx "REG_BINARY value. offset = 34 h. Const int Keystartindex = 52;// Offset of last byte of encoded product key in // 'digitalproductidxxx "REG_BINARY value. offset = 43 H. Const int Keyendindex = keystartindex + 15; // Possible alpha-numeric characters in product key. Char [] Digits = New char [] { 'B' , 'C' , 'D' , 'F' , 'G' , 'H' ,'J' , 'K' , 'M' , 'P' , 'Q' , 'R' , 'T' , 'V' , 'W' , 'X' , 'Y' , '2' , '3' , '4' ,'6' , '7' , '8' , '9' ,}; // Length of decoded Product Key Const int Decodelength = 29; // Length of decoded product key in byte-form. // each byte represents 2 chars. Const int Decodestringlength = 15; // Array of containing the decoded product key. Char [] Decodedchars = New char [Decodelength];// Extract byte 52 to 67 random Sive. Arraylist Hexpid = New Arraylist (); For ( Int I = keystartindex; I <= keyendindex; I ++) {hexpid. Add (digitalproductid [I]);} For ( Int I = decodelength-1; I> = 0; I --){ // Every sixth char is a separator. If (I + 1) % 6 = 0) {decodedchars [I] = '-' ;} Else { // Do the actual decoding. Int Digitmapindex = 0; For ( Int J = decodestringlength-1; j> = 0; j --){ Int Bytevalue = (digitmapindex <8) | ( Byte ) Hexpid [J]; hexpid [J] = ( Byte ) (Bytevalue/24); digitmapindex = bytevalue % 24; decodedchars [I] = digits [digitmapindex];} Return New String (Decodedchars );}
Finally, the read digitalproductid value (byte) is assigned to the decodeproductkey method to calculate the Windows product key. The project description indicates that the program can run on XP, Vista, and Windows 7 systems.
RegistrykeyHKLM =Registry. Localmachine; HKLM = HKLM. opensubkey ("Software \ Microsoft \ Windows NT \ CurrentVersion");Byte[] Digitalproductid = HKLM. getvalue ("Digitalproductid")As byte[]; Textbox1.text = decodeproductkey (digitalproductid );
It can be seen that a few lines of code can make the product key fall into the hands of others, and there are many such programs on the Internet. Recommended for Vista and Windows 7 usersSlmgr/cpkyFor more information, see Windows 7 Product Key Security. After you clear the product key information from the Registry, then run the program and the product key is displayed as "B", so that you do not have to worry about the security of the product key.