Open source Windows 7 product key checker

Discussion in 'MDL Projects and Applications' started by Daz, Oct 15, 2009.

  1. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,563
    3,848
    120
  2. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    #122 PAYMYRENT, Nov 13, 2009
    Last edited by a moderator: Apr 20, 2017
  3. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,563
    3,848
    120
    Yeah you can just increase the values until it works, allthough i think the C++ uses all proper lengths, no need to gamble
     
  4. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    ill mess around with it then ill tell you what happens

    i was thinking instead of a number like 40 or 60 there put a variable then have it parse the data differently for every key
     
  5. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,563
    3,848
    120
    #125 FreeStyler, Nov 13, 2009
    Last edited by a moderator: Apr 20, 2017
    Code:
                Dim pid As String = enc.GetString(pidb).Replace(vbNullChar, "") 'PID
                Dim epid As String = enc.GetString(core, 8, 96).Replace(vbNullChar, "") 'Extendend PID 
                Dim aid As String = enc.GetString(core, 136, 72).Replace(vbNullChar, "") 'Activation ID 
                Dim edi As String = enc.GetString(core, 280, 256).Replace(vbNullChar, "") 'Edition
                Dim  As String = enc.GetString(core, 888, 64).Replace(vbNullChar, "") 'SubType
                Dim lit As String = enc.GetString(core, 1016, 64).Replace(vbNullChar, "") 'License Type
                Dim lic As String = enc.GetString(core, 1144, 64).Replace(vbNullChar, "") 'License Channel
                Dim cid As String = epid.Substring(8, 3) 'Crypto ID
    


    Editing it like above seems to work as well

    how are the hex values for the C# version calculated? do i overlook something, or what? just don't get it i guess...
     
  6. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    #126 PAYMYRENT, Nov 13, 2009
    Last edited by a moderator: Apr 20, 2017


    that works fine for me

    i dont know how its done in C# MasterDisaster is the one to ask

    im the vb.net guy :p
     
  7. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,563
    3,848
    120
    #127 FreeStyler, Nov 13, 2009
    Last edited by a moderator: Apr 20, 2017
    The C# version seems to have been off a liitle sinse the beginning, guess that is what was putting me on the wrong track

    Code:
                    string pid = enc.GetString(gpid).Replace("\0", ""); //PID
                    string eid = enc.GetString(npid, 0x08, 0x68).Replace("\0", ""); //Extendend PID
                    string aid = enc.GetString(npid, 0x88, 0x48).Replace("\0", ""); //Activation ID
                    string edi = enc.GetString(npid, 0x118, 0x18).Replace("\0", ""); //Edition Type 
                    string sub = enc.GetString(npid, 0x378, 0x18).Replace("\0", ""); //Edition ID
                    string lit = enc.GetString(npid, 0x3F8, 0x18).Replace("\0", ""); //Key Type 
                    string lic = enc.GetString(npid, 0x478, 0x10).Replace("\0", ""); //EULA
                    string cid = eid.Substring(8, 3); //Crypto ID
    
    Code:
                    string pid = enc.GetString(gpid).Replace("\0", ""); //PID
                    string eid = enc.GetString(npid, 0x08, 0x60).Replace("\0", ""); //Extendend PID
                    string aid = enc.GetString(npid, 0x88, 0x48).Replace("\0", ""); //Activation ID
                    string edi = enc.GetString(npid, 0x118, 0x100).Replace("\0", ""); //Edition Type 
                    string sub = enc.GetString(npid, 0x378, 0x40).Replace("\0", ""); //Edition ID
                    string lit = enc.GetString(npid, 0x3F8, 0x40).Replace("\0", ""); //Key Type 
                    string lic = enc.GetString(npid, 0x478, 0x40).Replace("\0", ""); //EULA
                    string cid = eid.Substring(8, 3); //Crypto ID
    
     
  8. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    #128 MasterDisaster, Nov 13, 2009
    Last edited: Nov 13, 2009
    I came up with those values by viewing the DigitalProductId4 key in the registry. The C++ struct values seem to be safe. The string "ServerMediumBusinessManagement" seems to be the longest string for the EditionID, so instead of assigning 256 bytes that can hold 128 chars we can assign 64 bytes that can hold 32 chars. For the SubType it is enough to assign 18 bytes because it is of fixed length "X15-39278". The License Channel and License Type do not require 64 bytes, 32 bytes would be enough.

    Extended PID - 96 0x60
    Activation ID - 72 0x48
    Edition ID - 64 0x32
    Sub Type - 18 0x12
    License Channel - 32 0x20
    Licence Type - 32 0x20
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,563
    3,848
    120
    @MasterDisaster,


    License Channel it to short as well, eg 'Retail:TB:Eval' is shortened to 'Retail:TB:Ev'
    Anyway, i believe the C++ code uses proper lengths, so i gonna use that values
     
  10. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    #130 MasterDisaster, Nov 14, 2009
    Last edited by a moderator: Apr 20, 2017
    This function returns a null terminated string

    Code:
    static string GetString(byte[] bytes, int index)
    {
        int n = index;
        while (!(bytes[n] == 0 && bytes[n + 1] == 0)) n++;
        return Encoding.ASCII.GetString(bytes, index, n - index).Replace("\0", "");
    }
    
    Replace your existing code with this one. Looks a bit cleaner than the previous one.

    Code:
    string pid = GetString(gpid, 0x0000);
    string eid = GetString(npid, 0x0008);
    string aid = GetString(npid, 0x0088);
    string edi = GetString(npid, 0x0118);
    string sub = GetString(npid, 0x0378);
    string lit = GetString(npid, 0x03F8);
    string lic = GetString(npid, 0x0478);
    string cid = eid.Substring(8, 3);
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,563
    3,848
    120
  12. laidbacktokyo

    laidbacktokyo MDL Junior Member

    Aug 18, 2007
    77
    19
    0
  13. borongan

    borongan MDL Novice

    Sep 5, 2009
    21
    0
    0
    @PAYMYRENT, can you please share the program, thank you.
     
  14. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    #134 PAYMYRENT, Nov 23, 2009
    Last edited by a moderator: May 23, 2017
  15. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    ill have you test it if you want :p
     
  16. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    Let me guess, your program runs from a cd.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. borongan

    borongan MDL Novice

    Sep 5, 2009
    21
    0
    0
    PAYMYRENT, thank you very much, add a reputation.
     
  18. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    ha no it already does that :p