Open source Windows 7 product key checker

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

  1. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    420
    60
    your trying this in C# right? when i wrote my key checker it had some errors but it always got the result with the 32bit PidGenX.dll and it worked for both windows 7 and vista keys and on 32bit and 64bit machines

    the different between the two was i used VB

    i tried to convert my key checker to C# but it never worked right
     
  2. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    Hmm, yep works for me too when ran from Visual Studio command Prompt...wtf?
     
  3. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    Well it works fine with fixed dll path, this error only occurs when using dynamic dll path using the method 'MasterDisaster' described
     
  4. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    420
    60
    i understood how to do it when he talked about it but i still dont understand why my 32bit pidgenx.dll works on my 64bit machine when written in vb.net but never worked when i tried converting it to C#
     
  5. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    I guess this is caused by the fact the program build with vb.net is build to be able to run on 'Any CPU' (which basically means X32) right?
     
  6. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    420
    60
    no clue :p but ill try and convert my project to the language you guys are using anyway
     
  7. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    #107 FreeStyler, Nov 12, 2009
    Last edited by a moderator: Apr 20, 2017
    @MasterDisaster
    It works fine when using replaced code snippet

    Code:
            [DllImport("pidgenx_VAMT.dll", EntryPoint = "PidGenX", CharSet = CharSet.Auto)]
            static extern int PidGenX(string ProductKey, string PkeyPath, string MSPID, int UnknownUsage, IntPtr ProductID, IntPtr DigitalProductID, IntPtr DigitalProductID4);
    
            // public string CheckProductKey(string ProductKey)
            public string CheckProductKey(string ProductKey)
            {
                //pidgenxFile is the folder path that has the dll
                string dllPath = pidgenxFile + "\\pidgenx_VAMT.dll";
                IntPtr dllHandle = LoadLibrary(dllPath);
    
    So it seems like it tries to load system default pidgenx.dll in the original example, right?
     
  8. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,256
    674
    60
    #108 MasterDisaster, Nov 12, 2009
    Last edited: Nov 12, 2009
    @FreeStyler

    I reassigned the current directory before making the second call and the script works fine.

    Edit: now its not working i am going out of my head.. I'll try this later.

    After the Ist message box is displayed wait for a few seconds (maybe 5) before pressing OK the 2nd one will appear..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    #109 FreeStyler, Nov 12, 2009
    Last edited by a moderator: Apr 20, 2017
    Code:
                bool clear = FreeLibrary(dllHandle);
                /*
                bool clear = true;
                while(clear) //Must be run thrice in order to dereference the pointer
                    clear = FreeLibrary(dllHandle);
                */
                return result;
    This seems to fix it, can one of you guys confirm?
     
  10. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    420
    60
    #110 PAYMYRENT, Nov 12, 2009
    Last edited: Nov 12, 2009
    ill try it whenever visual studio decides to work properly :p


    EDIT:

    it worked for me :D
     
  11. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    cool, now I just need to fine-tune the returned results
     
  12. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    420
    60
    #112 PAYMYRENT, Nov 12, 2009
    Last edited: Nov 12, 2009
    cscript.exe //NOLOGO

    is how i did it and everything worked fine. i didnt want to push ok everytime i ran the script :p and it loaded the correct .dll everytime
     
  13. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,256
    674
    60
    #113 MasterDisaster, Nov 12, 2009
    Last edited by a moderator: Apr 20, 2017
    Code:
                bool clear = FreeLibrary(dllHandle);
                /*
                bool clear = true;
                while(clear) //Must be run thrice in order to dereference the pointer
                    clear = FreeLibrary(dllHandle);
                */
                return result;
    I needed that snippet to delete the temp folder that i extracted the resources.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    damn you not gonna believe this, seems like webserver can't access the dll with dynamic path (tried with same method as the vbscript) :(
    Always get error: pidgenx.dll file is not found

    back to square one :mad: :mad: :mad:
     
  15. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,256
    674
    60
    #115 MasterDisaster, Nov 13, 2009
    Last edited by a moderator: Apr 20, 2017
    You need to pass the physical path of the dll instead of the virtual path. This can be acheived using Server.MapPath().

    Code:
    Eg. you have /App_Data/win7/
    
    string path = Server.MapPath("/App_Data/win7");
    //path = "C:\\inetpub\\wwwroot\\pidcheck\\App_Data\\win7"
    obj.ConfigPath(path);
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. redalerthan

    redalerthan MDL Novice

    Aug 7, 2009
    20
    13
    0
  17. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    #117 FreeStyler, Nov 13, 2009
    Last edited by a moderator: Apr 20, 2017
    Yeah got it working afterall, although for some strange reason i have to re-install the dll & restart IIS for the path changes to take place
     
  18. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,256
    674
    60
    Good to know it worked :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
  20. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    #120 FreeStyler, Nov 13, 2009
    Last edited by a moderator: Apr 20, 2017