pkeyconfig Info Reader +Plus+ [v19.0.2]

Discussion in 'MDL Projects and Applications' started by Dark Vador, Apr 22, 2024.

  1. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    Can I have a screen shot
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Low Level Perform

    Low Level Perform MDL Member

    Jul 21, 2024
    113
    99
    10
    #162 Low Level Perform, Aug 19, 2025
    Last edited: Aug 19, 2025
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    Can you provide latest pkeyconfig file ( yours )
    Or just extract data and export to excel
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Low Level Perform

    Low Level Perform MDL Member

    Jul 21, 2024
    113
    99
    10
    #164 Low Level Perform, Aug 19, 2025
    Last edited: Aug 19, 2025
    I just downloaded it from your page and tried it out.
    pkeyconfig_gui v18.0.3 (ReUpload).rar on page 1
    Didn't make any changes.

    update:
    I understand now. It turns out that the operating system used makes a difference.
    I opened it in 24H2, and it turned out that it could be displayed.
    @Dark Vador, I'm sorry to bother you.

    The problem has been solved.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    Darki found bug,
    i will re write the code for decode key
    to match C dissambly logic

    Code:
    <#
            sppcomapi.dll
            __int64 __fastcall GetWindowsPKeyInfo(_WORD *a1, __int64 a2, __int64 a3, __int64 a4)
            {
                __int128 v46[3]; // __m128 v46[3], 48 bytes total
                int v47[44];
                int v48[320];
                memset(v46, 0, sizeof(v46));
                memset_0(v47, 0, 0xA4ui64);
                memset_0(v48, 0, 0x4F8ui64);
                v47[0] = 164;   // size of structure 1
                v48[0] = 1272;  // size of structure 2
            }
            #>    
    
    So, darky write a small C++,
    with sizeof, and get diffrent size's
    so, to mimic to real api call,
    Aka, decode key using pidgenx,
    you actualy need do this,
    Code:
    # Allocate unmanaged memory for PID, DPID, and DPID4
    $PIDPtr   = New-IntPtr -Size 0x30 -WriteSizeAtZero
    $DPIDPtr  = New-IntPtr -Size 0xB0 -InitialValue 0xA4
    $DPID4Ptr = New-IntPtr -Size 0x500 -InitialValue 0x4F8
    
    and intersting part,
    Code:
       CChkMacroETWLoggerT<CEmptyType>::LogHResultEvent(0i64);
        if ( v21 )
          v11 = ((__int64 (__fastcall *)(_WORD *, LPCWSTR, const wchar_t *, _QWORD, __int128 *, int *, int *))ProcAddress)(
                  v44,
                  v9,
                  L"03612" --> ????
                  0i64,
                  v46,
                  v47,
                  v48);
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    #166 Dark Vador, Aug 26, 2025
    Last edited: Aug 26, 2025
    (OP)
    bump version to [18.0.6.]
    Main change's -->
    • Application info tab have new property, Trusted time [latest activation time]
    • SLInstallProofOfPurchase, use `msft:rm/algorithm/pkey/detect` as default
    • PidGenX implementation was changed [[[ *** ]]]
    • Add new function IsTokenBasedEdition [still think how it can be useful]
    • Some other Little fixe`s, don't remember :D
    [*]
    Code:
            <#
            sppcomapi.dll
            __int64 __fastcall GetWindowsPKeyInfo(_WORD *a1, __int64 a2, __int64 a3, __int64 a4)
            {
                __int128 v46[3]; // __m128 v46[3], 48 bytes total
                int v47[44];
                int v48[320];
                memset(v46, 0, sizeof(v46)); // size of structure 2
                memset_0(v47, 0, 0xA4ui64);
                memset_0(v48, 0, 0x4F8ui64);
                v47[0] = 164;   // size of structure 3
                v48[0] = 1272;  // size of structure 4
            }
            #>
    
            # Allocate unmanaged memory for PID, DPID, and DPID4
            $PIDPtr   = New-IntPtr -Size 0x30  -WriteSizeAtZero
            $DPIDPtr  = New-IntPtr -Size 0xB0  -InitialValue 0xA4
            $DPID4Ptr = New-IntPtr -Size 0x500 -InitialValue 0x4F8
    
            try {
                try {
                    # Call the function with appropriate parameters
                    $result = $Global:PIDGENX::PidGenX(
                        $key, $configPath,
                        "03612",  # Default value for MSPID, 03612 ?? 00000 ?
                        0,        # UnknownUsage
                        $PIDPtr, $DPIDPtr, $DPID4Ptr
                    )
    
                    #Dump-MemoryAddress -Pointer $PIDPtr   -Length 0x30  -FileName PIDPtr
                    #Dump-MemoryAddress -Pointer $DPIDPtr  -Length 0xB0  -FileName DPIDPtr
                    #Dump-MemoryAddress -Pointer $DPID4Ptr -Length 0x500 -FileName DPID4Ptr
    
                } catch {
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    #167 Dark Vador, Sep 3, 2025
    Last edited: Sep 3, 2025
    (OP)
    Darki re upload the version
    fix few bugs, and upgrade some modules
    ~~~~~~~~~~~~~~~
    found intresting thing,
    so, in my prev` list, i have missing prev`
    called SeDelegateSessionUserImpersonatePrivilege
    for next time.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    Upload new version now.
    now show active Service / License*
    Include Active License / Oem License Information & more.

    * if you go an oem, default is oem, else, show active license

    upload_2025-9-7_19-7-25.png
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. Low Level Perform

    Low Level Perform MDL Member

    Jul 21, 2024
    113
    99
    10
    @Dark Vador, Is it possible for the Extract menu to display the ESU serial number?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    i think i can only get last 5 digits :D
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. Low Level Perform

    Low Level Perform MDL Member

    Jul 21, 2024
    113
    99
    10
    that shows promising progress. Good to know. :mushy:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. pm67310

    pm67310 MDL Guru

    Sep 6, 2011
    3,681
    2,934
    120
    Or capture generated esu key , apply and display if success and key esu end match captured key
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    #174 Dark Vador, Sep 12, 2025 at 08:36
    Last edited: Sep 12, 2025 at 08:49
    (OP)
    v19.0.2 [compiled at 12/09/2025]
    Code:
    * Add new Helper NtStatus,
      to achieve direct pointer for imprtant str`
      needed for Script
    * Updated with latest encode Blob from Mas
    * Updated with latest tsforge dll library
    * Also, to decode key's, now use PidGenX2
    
    interesting diff`` between 2 function
    Code:
        $result = $Global:PIDGENX::PidGenX(
            # Most important Roles
            $key, $configPath,
            # Default value for MSPID, 03612 ?? 00000 ?
            # PIDGENX2 -> v26 = L"00000" // SPPCOMAPI, GetWindowsPKeyInfo -> L"03612"
            "00000",
            # Unknown1
            0,
            # Structs
            $PIDPtr, $DPIDPtr, $DPID4Ptr
        )
    
        $result = $Global:PIDGENX::PidGenX2(
            # Most important Roles
            $key, $configPath,
            # Default value for MSPID, 03612 ?? 00000 ?
            # PIDGENX2 -> v26 = L"00000" // SPPCOMAPI, GetWindowsPKeyInfo -> L"03612"
            "00000",
            # Unknown1 / [Unknown2, Added in PidGenX2!]
            0,0,
            # Structs
            $PIDPtr, $DPIDPtr, $DPID4Ptr
        )
    
    And i did wonder what this 03612.
    solve you the mystery. [tsforge project]
    Code:
            public string GetMPC()
            {
                if (mpc != null)
                {
                    return mpc;
                }
    
                int build = Environment.OSVersion.Version.Build;
    
                mpc = build >= 10240 ? "03612" :
                        build >= 9600 ? "06401" :
                        build >= 9200 ? "05426" :
                        "55041";
    
    which later been used here :D
    Code:
       public static void InstallGenPKey(PSVersion version, bool production, Guid actId)
            {
                if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008.");
                if (actId == Guid.Empty) throw new ArgumentException("Activation ID must be specified for generated product key install.");
    
                PKeyConfig pkc = new PKeyConfig();
                
                try
                {
                    pkc.LoadConfig(actId);
                }
                catch (ArgumentException)
                {
                    pkc.LoadAllConfigs(SLApi.GetAppId(actId));
                }
    
                ProductConfig config;
                pkc.Products.TryGetValue(actId, out config);
    
                if (config == null) throw new ArgumentException("Activation ID " + actId + " not found in PKeyConfig.");
    
                ProductKey pkey = config.GetRandomKey();
    
                Guid instPkeyId = SLApi.GetInstalledPkeyID(actId);
                if (instPkeyId != Guid.Empty) SLApi.UninstallProductKey(instPkeyId);
    
                if (pkey.Algorithm == PKeyAlgorithm.PKEY2009)
                {
                    uint status = SLApi.InstallProductKey(pkey);
                    Logger.WriteLine(string.Format("Installing generated product key {0} status {1:X}", pkey, status));
    
                    if ((int)status < 0)
                    {
                        throw new ApplicationException("Failed to install generated product key.");
                    }
    
                    Logger.WriteLine("Successfully deposited generated product key.");
                    return;
                }
    
                Logger.WriteLine("Key range is PKEY2005, creating fake key data...");
    
                if (pkey.Channel == "Volume:GVLK" && version == PSVersion.Win7) throw new NotSupportedException("Fake GVLK generation is not supported on Windows 7.");
    
                VariableBag pkb = new VariableBag(version);
                pkb.Blocks.AddRange(new[]
                {
                    new CRCBlockModern
                    {
                        DataType = CRCBlockType.STRING,
                        KeyAsStr = "SppPkeyBindingProductKey",
                        ValueAsStr = pkey.ToString()
                    },
                    new CRCBlockModern
                    {
                        DataType = CRCBlockType.STRING,
                        KeyAsStr = "SppPkeyBindingMPC",
                        ValueAsStr = pkey.GetMPC()
                    },
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. haber123

    haber123 MDL Member

    Nov 5, 2009
    117
    45
    10
    Thank you, I look forward to trying this.
     
  16. haber123

    haber123 MDL Member

    Nov 5, 2009
    117
    45
    10
    Running this on server 2022, on PS 7 i get this:


    $tb.DefinePInvokeMethod(
    | ~~~~~~~~~~~~~~~~~~~~~~~~
    | You cannot call a method on a null-valued expression.
    InvalidOperation: M:\4\1902.pkeyconfig_gui.ps1:2519
    Line |
    2519 | $tb.DefinePInvokeMethod(
    | ~~~~~~~~~~~~~~~~~~~~~~~~
    | You cannot call a method on a null-valued expression.
    InvalidOperation: M:\4\1902.pkeyconfig_gui.ps1:2519
    Line |
    2519 | $tb.DefinePInvokeMethod(
    | ~~~~~~~~~~~~~~~~~~~~~~~~
    | You cannot call a method on a null-valued expression.
    InvalidOperation: M:\4\1902.pkeyconfig_gui.ps1:2519
    Line |
    2519 | $tb.DefinePInvokeMethod(
    | ~~~~~~~~~~~~~~~~~~~~~~~~
    | You cannot call a method on a null-valued expression.
    InvalidOperation: M:\4\1902.pkeyconfig_gui.ps1:2531
    Line |
    2531 | return $tb.CreateType()
    | ~~~~~~~~~~~~~~~~
    | You cannot call a method on a null-valued expression.
    InvalidOperation: M:\4\1902.pkeyconfig_gui.ps1:2501
    Line |
    2501 | $asm = [AppDomain]::CurrentDomain.DefineDynamicAssembly($asmN …
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | Method invocation failed because [System.AppDomain] does not contain a method named 'DefineDynamicAssembly'.
    InvalidOperation: M:\4\1902.pkeyconfig_gui.ps1:2502
    Line |
    2502 | $mod = $asm.DefineDynamicModule("DynamicDllHelperModule")
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | You cannot call a method on a null-valued expression.
    InvalidOperation: M:\4\1902.pkeyconfig_gui.ps1:2503
    Line |
    2503 | $tb = $mod.DefineType("NativeMethods", $TypeAttributes)
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
  17. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    is this an x86 or x64 version,
    x86 version could be problemtic,
    it work well under x64 version of any win 10-11
    with ps version --> 5
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. haber123

    haber123 MDL Member

    Nov 5, 2009
    117
    45
    10
    It is server 2022, updated, powershell 5.1 and7.x. Something about specifying where the modules are.
     
  19. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,806
    7,071
    150
    the only real possible things, who can be cause it, modules missing / differences
    and i am also can't test it under server, cause i aint have one
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...