DLL Call

Status
Not open for further replies.

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
1,486
Likes
165
Points
78
Location
Lithuania
Website
ugbase.eu
15
#1
maybe somebody know What i doing wrong?
Or maybe i have wrong offset?

PHP:
:Set_dialog_Text
{
    0.3.7 - R3
    0AB1: @Set_dialog_Text 1 text [email protected]
}
IF 0AA2: [email protected] = "samp.dll"
THEN 
    0A8E: [email protected] = [email protected] + 0x26E898 // SAMP_DIALOG_INFO_OFFSET
    0A8D: [email protected] = readMem [email protected] sz 4 vp 0
    0A8E: [email protected] = [email protected] + 0x6AE30 //SAMP_SET_DIALOG TEXT
    0AA8: call_function_method [email protected] struct [email protected] num_params 1 pop 0 [email protected] [email protected]
END
0AB2: 0
@springfield or any ...
 

y0mike

Well-Known Member
Joined
May 10, 2014
Messages
97
Likes
41
Points
68
Location
mizus girl's house
Website
0x688sdaddy.com
10
#4
maybe somebody know What i doing wrong?
Or maybe i have wrong offset?
@springfield or any ...
You haven't said, is it crashing when you call it, or just not doing anything?

You should definitely start by verifiying its the correct offset.

If it is, I have noticed only one thing -

Code:
0AA8: call_function_method [email protected] struct [email protected] num_params 1 pop 0 [email protected] [email protected]
I know jack shit about CLEO but it seems you want to pass 2 parameters to the function (thats presumably a __thiscall) but specify "num_params 1 "? Shouldn't it be "num_params 2"?

Honestly it's much easier (imo) and wayy faster to just do this in c++.
 

springfield

Well-Known Member
Staff member
Joined
Feb 18, 2005
Messages
2,968
Likes
77
Points
98
Website
www.ugbase.eu
10
#5
Your offset, 0x6AE30 (0.3.7 R3) is inside a sa-mp font rendering function, nothing related to dialogs. Also is vague which part of the dialog text you want to edit, caption, content, input etc.

I know jack shit about CLEO but it seems you want to pass 2 parameters to the function (thats presumably a __thiscall) but specify "num_params 1 "? Shouldn't it be "num_params 2"?
The last variable is used to store the return value.
 
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
1,486
Likes
165
Points
78
Location
Lithuania
Website
ugbase.eu
15
#6
Your offset, 0x6AE30 (0.3.7 R3) is inside a sa-mp font rendering function, nothing related to dialogs. Also is vague which part of the dialog text you want to edit, caption, content, input etc.
The last variable is used to store the return value.
I trying learn how get this pointer
0B4B: samp set_current_dialog_editbox_text [email protected]
and make it work without sampfuncs.
I tried find it a lot times, but always not successfully.
 

springfield

Well-Known Member
Staff member
Joined
Feb 18, 2005
Messages
2,968
Likes
77
Points
98
Website
www.ugbase.eu
10
#7
I trying learn how get this pointer
0B4B: samp set_current_dialog_editbox_text [email protected]
and make it work without sampfuncs.
I tried find it a lot times, but always not successfully.
Well, for some elements(controls etc.) you can find the static size buffer, and just copy to it, for others(input, lists etc.) that use dynamic buffers, you need to find each function.

C++:
while true
    wait 0    
    if 0ab0: 49 // press 1
    then 
        alloc [email protected] = 64
        format [email protected] "hello there!"
        call @SetCurrentDialogEditBoxText 2 => text [email protected] selected 0
        free [email protected]
        wait 100
    end 
end

:SetCurrentDialogEditBoxText
if 0AA2: [email protected] = "samp.dll"
then 
    0A8E: [email protected] = [email protected] + 0x26E898            // SAMP_DIALOG_INFO_OFFSET (R3)
    0A8D: [email protected] = readMem [email protected] sz 4 vp 0     // pDialog;
    0A8E: [email protected] = [email protected] + 0x24                // pDialog->pEditBox;
    0A8D: [email protected] = readMem [email protected] sz 4 vp 0     // pEditBox;
    
    // you should probably check if all these pointers are valid before using 'em
    0A8E: [email protected] = [email protected] + 0x84E70 // CDXUTEditBox::SetText (offset for 0.3.7 R3)
    
    // CDXUTEditBox::SetText takes 2 params
    // 1 - pointer to zero terminated string
    // 2 - bool, if text is to be selected or not
    
    0AA8: call_function_method [email protected] struct [email protected] num_params 2 pop 0 _bSelected [email protected] _pszText [email protected] _retVal [email protected] 
end
0AB2: 0
 
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
1,486
Likes
165
Points
78
Location
Lithuania
Website
ugbase.eu
15
#11
@springfield
Thx, now i know how get Dialog Set edit box and make snippet for any samp version.
I just wanna ask .

pChat->pChatBox; offset is same like pDialog->pEditBox ?
 
Last edited:

springfield

Well-Known Member
Staff member
Joined
Feb 18, 2005
Messages
2,968
Likes
77
Points
98
Website
www.ugbase.eu
10
#13
So which way is best to find this offset?
Because i wanna learn find it my self.
I using Cheat engine.
Find the text buffer in memory, attach CE, break on write, trace it back.

I just wanna ask .
pChat->pChatBox; offset is same like pDialog->pEditBox ?
I don't know what pChat/pChatBox is supposed to be w/o context.
 
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
1,486
Likes
165
Points
78
Location
Lithuania
Website
ugbase.eu
15
#14
I don't know what pChat/pChatBox is supposed to be w/o context.
@springfield
Last time when you found " set Dialog edit box text " ptr , i do dialog ptr + edit box offset = and now i know how to get " set Dialog edit box text " for any samp.
You give me good example for dialog, thx for that.

if you have time , please find this one.
This is much better use than send cmd which i know how get.
PHP:
0C8F: samp process_chat_input "/save"
Also...
How you know how many params need every time?
I haven't a lot experience with dll call
 
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
1,486
Likes
165
Points
78
Location
Lithuania
Website
ugbase.eu
15
#15
@springfield
This is how i found that ptr for 0.3.DL , after when you found it for 0.3.7 - R3


I asked last time .:
pChat->pChatBox; offset is same like pDialog->pEditBox ?
Because i wanna do that for chat editbox
 
Last edited:

springfield

Well-Known Member
Staff member
Joined
Feb 18, 2005
Messages
2,968
Likes
77
Points
98
Website
www.ugbase.eu
10
#16
Look in mod_sa, i think you mean pInput->pEditBox, sa-mp chat and input are different(different pointers/offsets too).
 

0x32789

Well-Known Member
Joined
May 26, 2014
Messages
839
Likes
29
Points
78
Location
LongForgotten <-> 0x32789
#18
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
1,486
Likes
165
Points
78
Location
Lithuania
Website
ugbase.eu
15
#19
Last edited:
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
1,486
Likes
165
Points
78
Location
Lithuania
Website
ugbase.eu
15
#20
https://github.com/BlastHackNet/mod_s0beit_sa-1/tree/master/src

0.3.7

https://github.com/BlastHackNet/mod_s0beit_sa-1/tree/samp-dl
0.3.DL

I suggest look at s0biet source like.. you will understand everything.
It's so easy to work with 0.3.DL cause s0biet has all the offsets and shit.
Other than it, it is also good to understand how it hooks into directx and raknet.
Look in mod_sa, i think you mean pInput->pEditBox, sa-mp chat and input are different(different pointers/offsets too).

Also how to know how many params need ????
PHP:
0C8F: samp process_chat_input "/save"
Maybe you or somebody else can explain it...

C++:
struct stInputBox
{
    void    *pUnknown;
    uint8_t    bIsChatboxOpen;
    uint8_t    bIsMouseInChatbox;
    uint8_t    bMouseClick_related;
    uint8_t    unk;
    DWORD    dwPosChatInput[2];
    uint8_t    unk2[263];
    int        iCursorPosition;
    uint8_t    unk3;
    int        iMarkedText_startPos; // Highlighted text between this and iCursorPosition
    uint8_t    unk4[20];
    int        iMouseLeftButton;
};
 
Status
Not open for further replies.
Top