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,445
    421
    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#
     
  2. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,566
    3,876
    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?
     
  3. PAYMYRENT

    PAYMYRENT MDL Developer

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

    FreeStyler MDL Guru

    Jun 23, 2007
    3,566
    3,876
    120
    #104 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?
     
  5. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    676
    60
    #105 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...
  6. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,566
    3,876
    120
    #106 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?
     
  7. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,445
    421
    60
    #107 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
     
  8. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,566
    3,876
    120
    cool, now I just need to fine-tune the returned results
     
  9. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,445
    421
    60
    #109 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
     
  10. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    676
    60
    #110 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...
  11. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,566
    3,876
    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:
     
  12. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    676
    60
    #112 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...
  13. redalerthan

    redalerthan MDL Novice

    Aug 7, 2009
    20
    13
    0
  14. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,566
    3,876
    120
    #114 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
     
  15. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    676
    60
    Good to know it worked :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,566
    3,876
    120
  17. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,566
    3,876
    120
  18. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,445
    421
    60
    #119 PAYMYRENT, Nov 13, 2009
    Last edited by a moderator: Apr 20, 2017
  19. FreeStyler

    FreeStyler MDL Guru

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