Page 4 of 5 FirstFirst ... 2345 LastLast
Results 76 to 100 of 106

Thread: ProSocks

  1. #76
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Try this (a direct link to the plugin on github): https://github.com/Brandon-T/ProSock...3/ProSocks.dll

    I have a feeling you're somehow using a very OLD version of the plugin. The above is the latest build and that's the one myself & the reflection include uses.


    When I run your code I get:

    Progress Report:
    Compiled successfully in 422 ms.
    Scanning for files to update..
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/Authors.txt
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\Authors.txt
    Creating new File C:\Simba\Includes\Alotic\Authors.txt
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/Files.txt
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\Files.txt
    Creating new File C:\Simba\Includes\Alotic\Files.txt
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/Alotic.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\Alotic.simba
    Creating new File C:\Simba\Includes\Alotic\lib\Alotic.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/Updater.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\Updater.simba
    Creating new File C:\Simba\Includes\Alotic\lib\Updater.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/core/globals.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\core\globals.simba
    Creating new File C:\Simba\Includes\Alotic\lib\core\globals.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/core/mainscreen.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\core\mainscreen.simba
    Creating new File C:\Simba\Includes\Alotic\lib\core\mainscreen.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/core/math.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\core\math.simba
    Creating new File C:\Simba\Includes\Alotic\lib\core\math.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/core/mouse.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\core\mouse.simba
    Creating new File C:\Simba\Includes\Alotic\lib\core\mouse.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/core/prayer.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\core\prayer.simba
    Creating new File C:\Simba\Includes\Alotic\lib\core\prayer.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/core/text.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\core\text.simba
    Creating new File C:\Simba\Includes\Alotic\lib\core\text.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/interfaces/bank.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\interfaces\bank.simba
    Creating new File C:\Simba\Includes\Alotic\lib\interfaces\bank.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/interfaces/chatbox.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\interfaces\chatbox.simba
    Creating new File C:\Simba\Includes\Alotic\lib\interfaces\chatbox.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/interfaces/gametab.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\interfaces\gametab.simba
    Creating new File C:\Simba\Includes\Alotic\lib\interfaces\gametab.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/interfaces/interface.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\interfaces\interface.simba
    Creating new File C:\Simba\Includes\Alotic\lib\interfaces\interface.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/interfaces/inventory.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\interfaces\inventory.simba
    Creating new File C:\Simba\Includes\Alotic\lib\interfaces\inventory.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/interfaces/minimap.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\interfaces\minimap.simba
    Creating new File C:\Simba\Includes\Alotic\lib\interfaces\minimap.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/Simba.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\Simba.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\Simba.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/extendedarrays.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\extendedarrays.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\extendedarrays.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/integer.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\integer.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\integer.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/integerarrays.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\integerarrays.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\integerarrays.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/string.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\string.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\string.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/stringarrays.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\stringarrays.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\stringarrays.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/t2dstringarray.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\t2dstringarray.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\t2dstringarray.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/tbox.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\tbox.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\tbox.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/tpoint.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\tpoint.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\tpoint.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/tpointarrays.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\tpointarrays.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\tpointarrays.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/typemath.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\typemath.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\typemath.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/misc/datatypes/types.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\misc\datatypes\types.simba
    Creating new File C:\Simba\Includes\Alotic\lib\misc\datatypes\types.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/player/login.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\player\login.simba
    Creating new File C:\Simba\Includes\Alotic\lib\player\login.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/player/player.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\player\player.simba
    Creating new File C:\Simba\Includes\Alotic\lib\player\player.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/player/varManager.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\player\varManager.simba
    Creating new File C:\Simba\Includes\Alotic\lib\player\varManager.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/canvas.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\canvas.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\canvas.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/color.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\color.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\color.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/debug.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\debug.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\debug.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/debugBox.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\debugBox.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\debugBox.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/drawing.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\drawing.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\drawing.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/file.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\file.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\file.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/timing.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\timing.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\timing.simba
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/wrappers.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\wrappers.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\wrappers.simba
    Updated 37 Files
    Successfully executed.



    and everything gets created and downloaded fine.. Do some error checking in "GetPageEx" make sure res.size > 0. Other than that, there's nothing wrong :S
    Ahh there we go, yes!

    Any idea why it creates blank file but doesn't fill them? Could it be because I'm creating the file and it's trying to write to the file before it's created? (there is that like 2-3 second delay before it's created)

  2. #77
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by rj View Post
    Ahh there we go, yes!

    Any idea why it creates blank file but doesn't fill them? Could it be because I'm creating the file and it's trying to write to the file before it's created? (there is that like 2-3 second delay before it's created)

    You're not actually writing anything to the file in the first place.

    Consider the following sequence:

    Progress Report:
    Webpath = https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/utilities/wrappers.simba
    OpenFile - Exception. Could not open file: C:\Simba\Includes\Alotic\lib\utilities\wrappers.simba
    Creating new File C:\Simba\Includes\Alotic\lib\utilities\wrappers.simba


    Notice the highlighted line. "Exception". When the exception occurs, you've triggered a try-catch block. It automatically jumps straight to the catch block and tries to create the non-existent file but the exception is an internal exception and not one that you can easily handle unless you know the state that the file handle is in after failure or upon the occurrence of the exception.


    This is the reason for "fileExists" instead of trying to catch the exception. You should be using something like:

    Simba Code:
    if (not fileExists(........)) then
      tmpFile := createFile(.........)
    else
      tmpFile := openFile(.........);

    to test the existence of the file INSTEAD of:

    Simba Code:
    try
      tmpFile := openFile(......);
    except
      tmpFile := createFile(......);
    end

    You may not be able to continue after the exception is thrown. The internals may be in an invalid state. I (me) don't have any idea of any the integrity of Simba's internals upon the above exception. You can ask one of the Simba devs about the state of Simba after an internal exception.

    BUT your code works if you do what I said above instead of catching the exception. In other languages you can test if a file exists by trying to open it or to read its attributes. That doesn't seem to be the case in Simba.


    P.S. The exception block in programming, isn't for "getting around an exception 100% of the time" (always ignoring it). It's for "handling the exception in a safe manner". You are mis-using it a bit. Slight but subtle difference. There are cases you can ignore an exception and cases where you cannot.

    Example: Instead of try-catching a null pointer exception and trying to continue execution of some code.. You should be testing for null before using your pointers. This is just an example.

    Test if the file is open first instead of trying to catch the exception and continue execution of some code. Ask a Simba dev for more information on the state of the internals upon an internal Simba exception.
    Last edited by Brandon; 04-28-2015 at 01:39 AM.
    I am Ggzz..
    Hackintosher

  3. #78
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Simba Code:
    {$loadlib ProSocks}

    Code:
    Loading extension C:\Simba\Extensions\companion.sex
    Error in Simba extension compilation (C:\Simba\Extensions\companion.sex) : Unknown compiler directives at 6:3
    I've been told Simba extensions do not support plugins, is there some other way to go about implementing ProSocks within an extension? This one, specifically, as I'd like to implement some in-depth forum features via simulating Villavu logins.

    Picture

  4. #79
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    ...
    Thanks got it. Also found out that you must 'rewrite' the file before writing to it, explains part of the reason the files were blank (after I fixed the try/except)

  5. #80
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Clarity View Post
    ...
    Unless you know how to turn integers to function pointers in pascal script, it won't be possible unless I add functions to the plugin that does that for us..

    Simba Code:
    type ProWritePtr = Function(contents: PChar; size: PtrUInt; nmemb: PtrUint; var userp: String): PtrUInt;
    type ProErrorHandlerPtr = Function(str: PChar; errorcode: LongInt): PtrUInt;
    type ProLenPtr = Function(var Str: String): PtrUInt;


    type
      ProMemoryStruct = record
        memory: PChar;
        size: PtrUInt;
      end;

    type
      SSLSocket = record
        curl_handle: PtrUInt;
        headers: PChar;
        data: PChar;
        params: PChar;
        LengthFunc: ProLenPtr;
        ErrorHandlerFunc: ProErrorHandlerPtr;
        WriteFunc: ProWritePtr;
        HeaderFunc: ProWritePtr;
        hdrs: PChar;
        Timeout: Cardinal;
        Port: Word;
        caller_allocates: Boolean;
      end;

    type
      TPro_InitSocket = Procedure(var curl_info: SSLSocket; WriteFunc: ProWritePtr; HeaderFunc: ProWritePtr; ErrorHandlerFunc: ProErrorHandlerPtr; StrLenFunc: ProLenPtr);
      TPro_CreateSocket = Procedure(var curl_info: SSLSocket; useragent: String);
      TPro_FreeSocket = Procedure(var curl_info: SSLSocket);
      TPro_SetSSL = Procedure(var curl_info: SSLSocket; try_set: Boolean; verifypeer: Boolean; verifyhost: Boolean);
      TPro_SetURL = Procedure(var curl_info: SSLSocket; const URL: String);
      TPro_DoGetEx = Procedure(var curl_info: SSLSocket; var Res: ProMemoryStruct);
      TPro_PerformEx = Procedure(var curl_info: SSLSocket; var Res: ProMemoryStruct);


    function LoadModule(ModulePath: PChar): LongInt; external 'LoadLibraryA@Kernel32.dll stdcall';
    function FreeModule(Module: LongInt): Boolean; external 'FreeLibrary@Kernel32.dll stdcall';

    function Get_ProInitSocket(Module: LongInt; Name: PChar): TPro_InitSocket; external 'GetProcAddress@Kernel32.dll stdcall';
    function Get_ProCreateSocket(Module: LongInt; Name: PChar): TPro_CreateSocket; external 'GetProcAddress@Kernel32.dll stdcall';
    function Get_ProFreeSocket(Module: LongInt; Name: PChar): TPro_FreeSocket; external 'GetProcAddress@Kernel32.dll stdcall';
    function Get_ProSetSSL(Module: LongInt; Name: PChar): TPro_SetSSL; external 'GetProcAddress@Kernel32.dll stdcall';
    function Get_ProSetURL(Module: LongInt; Name: PChar): TPro_SetURL; external 'GetProcAddress@Kernel32.dll stdcall';
    function Get_ProDoGetEx(Module: LongInt; Name: PChar): TPro_DoGetEx; external 'GetProcAddress@Kernel32.dll stdcall';
    function Get_ProPerformEx(Module: LongInt; Name: PChar): TPro_PerformEx; external 'GetProcAddress@Kernel32.dll stdcall';


    function GetProcAddress(Module: LongInt; Name: PChar): LongInt; external 'GetProcAddress@Kernel32.dll stdcall';


    var
      Prosocks: LongInt;
      Pro_InitSocket: TPro_InitSocket;
      Pro_CreateSocket: TPro_CreateSocket;
      Pro_FreeSocket: TPro_FreeSocket;
      Pro_SetSSL: TPro_SetSSL;
      Pro_SetURL: TPro_SetURL;
      Pro_DoGetEx: TPro_DoGetEx;
      Pro_PerformEx: TPro_PerformEx;




    Function GetPageEx(URL: String): String;
    var
      S: SSLSocket;
      res: ProMemoryStruct;
    begin
      Pro_InitSocket(S, nil, nil, nil, nil);
      Pro_CreateSocket(S, '');
      Pro_SetSSL(S, false, false, true);
      Pro_SetURL(S, URL);
      Pro_DoGetEx(S, res);

      {$IFDEF LAPE}
      SetLength(Result, res.size);
      MemMove(res.memory^, Result[1], res.size);
      {$ELSE}
      Result := res.memory;
      {$ENDIF}


      try
        Pro_FreeSocket(S);
      except
        WriteLn('Unable to Free ' + URL + ' ProSocks Error');
      end;
    end;


    function GetName : string;
    begin;
      result := 'My Extension';
    end;

    function GetVersion : string;
    begin;
      result := '0.1';
    end;

    procedure Free;
    begin

    end;

    procedure Attach;
    begin
      writeln('     ~Loaded~     ');
      ProSocks := LoadModule('C:/Simba/Plugins/ProSocks.dll');

      writeln('Prosocks Address: ' + ToStr(ProSocks));
      writeln('ProcAddress using LongInt: ' + ToStr(GetProcAddress(ProSocks, 'Curl_InitSocket')));
      writeln('ProcAddress using Type: ' + ToStr(Get_ProInitSocket(ProSocks, 'Curl_InitSocket')));

      Pro_InitSocket   := Get_ProInitSocket(ProSocks, 'Curl_InitSocket');
      Pro_CreateSocket := Get_ProCreateSocket(ProSocks, 'Curl_CreateSocket');
      Pro_FreeSocket   := Get_ProFreeSocket(ProSocks, 'Curl_FreeSocket');
      Pro_SetSSL       := Get_ProSetSSL(ProSocks, 'Curl_SetSSL');
      Pro_SetURL       := Get_ProSetURL(ProSocks, 'Curl_SetURL');
      Pro_DoGetEx      := Get_ProDoGetEx(ProSocks, 'Curl_DoGetEx');
      Pro_PerformEx    := Get_ProPerformEx(ProSocks, 'Curl_PerformEx');

      //writeln(GetPageEx('https://raw.githubusercontent.com/officerBarbrady/Alotic/master/lib/core/globals.simba'));
    end;

    Procedure Detach;
    begin
      Writeln('~Unloaded~');
      FreeModule(ProSocks);
    end;


    Begin
    End.


    Output:

    Progress Report:
    Loading extension C:\Simba\Extensions\Test.sex
    Extension Enabled
    
         ~Loaded~  
       
    Prosocks Address: 1868300288
    ProcAddress using LongInt: 1868306240
    ProcAddress using Type: Proc: 0 //should not be nil or 0.


    Not sure why it's nil or 0 tbh..
    Last edited by Brandon; 04-28-2015 at 04:38 AM.
    I am Ggzz..
    Hackintosher

  6. #81
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    ...
    Okay, thanks for the reply! I'm very interested in adding this functionality so I'll see what I can learn. Especially regarding the LoadModule/related functions, I would have had no idea how to do something like that.
    Last edited by Clarity; 04-28-2015 at 05:37 AM.

  7. #82
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Clarity View Post
    Okay, thanks for the reply! I'm very interested in adding this functionality so I'll see what I can learn. Especially regarding the LoadModule/related functions, I would have had no idea how to do something like that.
    https://villavu.com/forum/showthread.php?t=65657

    If I cannot figure out why it doesn't work for the extension I posted in the previous post and somehow it works for the above extension in that link, then I will modify the plugin and test if the functions are being called and modify to suit.

    It is odd that it doesn't work in my previous post (unless the return type is longInt) :l
    Last edited by Brandon; 04-28-2015 at 01:26 PM.
    I am Ggzz..
    Hackintosher

  8. #83
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    https://villavu.com/forum/showthread.php?t=65657

    If I cannot figure out why it doesn't work for the extension I posted in the previous post and somehow it works for the above extension in that link, then I will modify the plugin and test if the functions are being called and modify to suit.

    It is odd that it doesn't work in my previous post (unless the return type is longInt) :l
    All method importing & calling has to be put through pascal script first, you cant just import something via GetProcAddress and expect work fully.

    Could also be wrong, but i'm quite sure.
    Last edited by Olly; 04-28-2015 at 04:05 PM.

  9. #84
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    All method importing & calling has to be put through pascal script first, you cant just import something via GetProcAddress and expect work fully.

    Could also be wrong, but i'm quite sure.

    Consider:

    Simba Code:
    someLongInt := GetProcAddress(module, 'funcName');

    That works but:

    Simba Code:
    someFunctionPointer := GetProcAddress(module, 'funcName');

    does not. So it's not the importing that is failing. It's the assignment operator that fails. In fact, I didn't even begin to call the function via the function pointer. I printed just the address of it which turns out to be NULL but the longInt has a valid address.

    Can always pass the func ptr to the plugin and have the plugin give it an address. That would work.
    Last edited by Brandon; 04-29-2015 at 12:14 AM.
    I am Ggzz..
    Hackintosher

  10. #85
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

  11. #86
    Join Date
    Oct 2015
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Does the HTTPS object have a do post command? I myself can't seem to find it nor could I figure out a definitive way of testing if it did it passively, though my guess is that it does not. Would it be simpler for me to adapt your facebook login example using the socket object to accomplish a post request

  12. #87
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Paradoxs View Post
    Does the HTTPS object have a do post command? I myself can't seem to find it nor could I figure out a definitive way of testing if it did it passively, though my guess is that it does not. Would it be simpler for me to adapt your facebook login example using the socket object to accomplish a post request
    It has a doPost and doPostEx (use this one) function. https://github.com/Brandon-T/ProSock...eExports.h#L75

    I was just working on updating the library a few mins ago. Got it working for OSX too http://i.imgur.com/d0Oshvv.png
    Last edited by Brandon; 10-11-2015 at 08:28 PM.
    I am Ggzz..
    Hackintosher

  13. #88
    Join Date
    Oct 2015
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    It does have a doPost and doPostEx function. https://github.com/Brandon-T/ProSock...eExports.h#L75
    I actually realized the stupidity of my question as soon as I asked, my main problem was the same as RJ's, I was messing with the socks.simba function included at the top, which uses prosock.dll, the newer versions of the dll are prosocks.dll

    The https type that the socks.simba has does not have a dopost, but it wasn't needed, since I just went ahead and made my own functions with a custom type, using the new DLL was much much more simple and reading through the socks.simba and figuring out how each part worked in that fashion.

    Correct me if I'm wrong about the socks.simba using an old version part. Might want to update the main post as well, because it really does seem to point to an older version


    and socks.simba needs to be updated to use this newer version as attempting to run it with the newer versions causes failures. This is due to the fact that v.02 introduced the easier to use api (at least that's my assumption)

    using prosocks.dll (v 0.3)
    Error: Unknown declaration "Pro_ReadSocket" at line 75
    Compiling failed.
    using prodock.dll from main post(Assuming it's v 0.1)
    Compiled successfully in 578 ms.
    Successfully executed.
    Also just noticed v0.4, greedily awaiting the windows release
    Attached Images Attached Images

  14. #89
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Paradoxs View Post
    ...

    Yeah anything after v0.1 does NOT use an include. The main post is outdated. Sorry for the confusion. I'll have to update it. Yeah I didn't compile Windows v0.4 version yet because my Windows laptop broke ={. Didn't wanna install a VM. I'll upload a Windows & Linux build when I get a chance but v0.3 works just as well.


    Don't worry about using Socks.simba or any includes. All you need is the plugin. No other files.
    I am Ggzz..
    Hackintosher

  15. #90
    Join Date
    Oct 2015
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Yeah anything after v0.1 does NOT use an include. The main post is outdated. I'll have to update it. Yeah I didn't compile Windows v0.4 version yet because my Windows laptop broke ={ LOL. Didn't wanna install a VM. I'll upload a Windows build when I get a chance but v0.3 works just as well.


    Don't worry about using Socks.simba or any includes. All you need is the plugin. No other files.
    Oh I know, I just meant that without going through the entire thread a new user of proSocks won't know that, I figure the getpostEx function you posted + an updated download to v0.3 will be enough to replace the current sample and incorrect dll

  16. #91
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Paradoxs View Post
    Oh I know, I just meant that without going through the entire thread a new user of proSocks won't know that, I figure the getpostEx function you posted + an updated download to v0.3 will be enough to replace the current sample and incorrect dll
    Updated the OP. Everything should be good now. No more confusing posts or having to go through the thread to figure things out.
    I am Ggzz..
    Hackintosher

  17. #92
    Join Date
    Oct 2015
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Appreciate it man!

    Love the plugin, thanks for taking the time to develop it (and the easy to use API)

    Edit:

    Actually @Brandon In v0.3 Pro_SetParameter causeses an access violation, when downgrading to v0.2 the problem is resolved, when I have time if you haven't already been aware of the issue I'll look and see if I can figure out what exactly is causing it.
    Last edited by Paradoxs; 10-11-2015 at 11:04 PM.

  18. #93
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Paradoxs View Post
    Appreciate it man!

    Love the plugin, thanks for taking the time to develop it (and the easy to use API)

    Edit:

    Actually @Brandon In v0.3 Pro_SetParameter causeses an access violation, when downgrading to v0.2 the problem is resolved, when I have time if you haven't already been aware of the issue I'll look and see if I can figure out what exactly is causing it.


    What is the code you're using to POST? I just tested this:

    C++ Code:
    ProSock sock = {0};
    Pro_InitSocket(&sock, nullptr, nullptr, nullptr, nullptr);
    Pro_CreateSocket(&sock, "");
    Pro_SetVerbose(&sock, false);
    Pro_SetSSL(&sock, false, false, true);
    Pro_SetHeader(&sock, "Content-Type", "text/plain");
    Pro_AddParameter(&sock, "Key1", "Value1", false);
    Pro_AddParameter(&sock, "Key2", "Value2", true);

    Pro_SetURL(&sock, "http://posttestserver.com/post.php?dump");
    //Pro_SetURL(&sock, "http://httpbin.org/post?testArgs=1024");

    ProMemoryStruct mem = {0};
    Pro_DoPostEx(&sock, &mem);

    std::cout.write(mem.memory, mem.size);
    std::cout<<"\n\n"<<std::endl;

    Curl_FreeSocket(&sock);

    Result:

    Progress Report:
    Time: Sun, 11 Oct 15 18:32:28 -0700
    Source ip: XX.XX.XXX.XXX
    
    Headers (Some may be inserted by server)
    HTTP_CONNECTION = close
    REQUEST_URI = /post.php?dump
    QUERY_STRING = dump
    REQUEST_METHOD = POST
    GATEWAY_INTERFACE = CGI/1.1
    REMOTE_PORT = 63111
    REMOTE_ADDR = XX.XX.XXX.XXX
    CONTENT_LENGTH = 23
    CONTENT_TYPE = text/plain
    HTTP_ACCEPT = */*
    HTTP_USER_AGENT = Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36
    HTTP_HOST = posttestserver.com
    UNIQUE_ID = VhsNrNBx6hIAAH1WJScAAAAB
    REQUEST_TIME_FLOAT = 1444613548.1021
    REQUEST_TIME = 1444613548
    
    No Post Params.
    
    == Begin post body ==
    Key1=Value1&Key2=Value2
    == End post body ==
    
    Upload contains PUT data:
    Key1=Value1&Key2=Value2
    
    
    Program ended with exit code: 0



    Progress Report:
    {
      "args": {
        "testArgs": "1024"
      }, 
      "data": "Key1=Value1&Key2=Value2", 
      "files": {}, 
      "form": {}, 
      "headers": {
        "Accept": "*/*", 
        "Content-Length": "23", 
        "Content-Type": "text/plain", 
        "Host": "httpbin.org", 
        "User-Agent": "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"
      }, 
      "json": null, 
      "origin": "XX.XX.XXX.XXX", 
      "url": "http://httpbin.org/post?testArgs=1024"
    }
    
    
    
    Program ended with exit code: 0
    I am Ggzz..
    Hackintosher

  19. #94
    Join Date
    Oct 2015
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    I was using the example, and my own code based off the example and the first Pro_AddParemeter led to an access violation. Could it be that I'm not setting the verbose? (In simba just to clarify, lape interpreter, the pascal interpreter fails too but I don't remember where)

  20. #95
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    ...
    @Brandon;

    How do i use ./configure on windows?
    When i tried to execute it on openssl source it gave this error:


    When i did it on the prosocks source:



    https://github.com/riwu/ProSocks/blo...eExports.h#L53
    How do u specify these directives in lazarus FPC?
    i tried doing {$DEFINE PASCALSCRIPT} it still imported those procedures from L83 (i used Dynlibs.LoadLibrary(), followed by GetProcAddress(libHandle, 'GetFunctionInfo') to retrieve the proc address)

  21. #96
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    @Brandon;

    How do i use ./configure on windows?
    When i tried to execute it on openssl source it gave this error:


    When i did it on the prosocks source:



    https://github.com/riwu/ProSocks/blo...eExports.h#L53
    How do u specify these directives in lazarus FPC?
    i tried doing {$DEFINE PASCALSCRIPT} it still imported those procedures from L83 (i used Dynlibs.LoadLibrary(), followed by GetProcAddress(libHandle, 'GetFunctionInfo') to retrieve the proc address)


    It says you don't have perl installed. Why are you configuring prosocks though? You need to configure curl and openssl and just compile prosocks as normal.

    As for preprocessor arguments, I'm not sure about Lazarus FPC but I know via command line it's -DPASCAL_SCRIPT. Are you building for PascalScript?
    Last edited by Brandon; 12-16-2015 at 01:49 AM.
    I am Ggzz..
    Hackintosher

  22. #97
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Wow, this is fantastic. Great work on this man, would have made the old days so much easier ha.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  23. #98
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    It says you don't have perl installed. Why are you configuring prosocks though? You need to configure curl and openssl and just compile prosocks as normal.

    As for preprocessor arguments, I'm not sure about Lazarus FPC but I know via command line it's -DPASCAL_SCRIPT. Are you building for PascalScript?
    I figured out how to correctly import the dll from FPC, still want to learn how to compile the plugin though.
    I installed ActivePerl and managed to install ZLIB and OpenSSL, but having problem at LIBCURL:
    http://pastebin.com/raw/61GWJ3Pf (entire log from config to make install)
    Last few lines of make install:
    Code:
    c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: curl-tool_cb_dbg.o: bad reloc address 0xec in section `.rdata'
    collect2.exe: error: ld returned 1 exit status
    make[2]: *** [curl.exe] Error 1
    make[2]: Leaving directory `/c/Users/1/Desktop/curl-7.45.0/src'
    make[1]: *** [install] Error 2
    make[1]: Leaving directory `/c/Users/1/Desktop/curl-7.45.0/src'
    make: *** [install-recursive] Error 1
    I googled for some solution, none of them works for me. One of the solution is:
    Code:
    make SYS=mingw CRYPTO=POLARSSL \
    CPATH=/mingw/include LIBRARY_PATH=/mingw/lib SHARED= XLDFLAGS=-static

  24. #99
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    I figured out how to correctly import the dll from FPC, still want to learn how to compile the plugin though.
    I installed ActivePerl and managed to install ZLIB and OpenSSL, but having problem at LIBCURL:
    http://pastebin.com/raw/61GWJ3Pf (entire log from config to make install)
    Last few lines of make install:
    Code:
    c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: curl-tool_cb_dbg.o: bad reloc address 0xec in section `.rdata'
    collect2.exe: error: ld returned 1 exit status
    make[2]: *** [curl.exe] Error 1
    make[2]: Leaving directory `/c/Users/1/Desktop/curl-7.45.0/src'
    make[1]: *** [install] Error 2
    make[1]: Leaving directory `/c/Users/1/Desktop/curl-7.45.0/src'
    make: *** [install-recursive] Error 1
    I googled for some solution, none of them works for me. One of the solution is:
    Code:
    make SYS=mingw CRYPTO=POLARSSL \
    CPATH=/mingw/include LIBRARY_PATH=/mingw/lib SHARED= XLDFLAGS=-static

    .rdata is relocation section in assembly assembly (linker/import section).

    The log says you are trying to link 32-bit libraries with 64-bit ones. Make sure that everything you are building is using the same architecture. That is why I explicitly configured with: --build=i686-pc-windows "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" for 32-bit and --build=x86_64-w64-mingw32 "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" for 64bit.

    I can provide step by step instructions it still doesn't work.
    Last edited by Brandon; 12-17-2015 at 02:36 AM.
    I am Ggzz..
    Hackintosher

  25. #100
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    .rdata is relocation section in assembly assembly (linker/import section).

    The log says you are trying to link 32-bit libraries with 64-bit ones. Make sure that everything you are building is using the same architecture. That is why I explicitly configured with: --build=i686-pc-windows "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" for 32-bit and --build=x86_64-w64-mingw32 "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" for 64bit.

    I can provide step by step instructions it still doesn't work.
    When i tried to install 32-bit openssl it said:
    Code:
    cryptlib.c:1:0: error: CPU you selected does not support x86-64 instruction set
    Full log: http://pastebin.com/raw/KE3itAX6
    So i installed 64bit version of it instead.

    Also i had to remove --no-shared because it gave this error:
    Code:
    gcc.exe: error: unrecognized command line option '--no-shared'
    The link for openssl in your README is broken so i downloaded it from https://github.com/openssl/openssl/r...OpenSSL_1_0_2d

    How do i install 64bit ZLIB and LIBCURL? Will it automatically override my 32-bit version if it's already installed? (Which directories in windows are they even installed to btw?)

    Btw a 32-bit Simba won't be able to load a 64-bit dll right?

Page 4 of 5 FirstFirst ... 2345 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •