Categories > Coding > C++ >

[REL] CLIPBOARD FUNCTIONS!

heckerdude

heckerdude

Posts: 129

Threads: 16

Joined: Aug, 2022

Reputation: 6

Posted

These are custom clipboard functions which can be registered into the Lua environment and BLAHHHHHHHHHHHHHHHHHH...

2 years axon working so work for ur skidhax so...

int setclipboard()
{
    const char* clipme = lua_tostring(rl, -1);
    if (!OpenClipboard(nullptr))
        return 1;

    EmptyClipboard();

    HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, 100);
    memcpy(GlobalLock(hMem), clipme , 13);
    GlobalUnlock(hMem);
    SetClipboardData(CF_TEXT, hMem);

    CloseClipboard();
    clipme = "";
    return 0;
}

 

tostring will get the first argument of the function which is a string and can be used like *AXON*:

local function = "my dad used to kiss me"
setclipboard(function)

wait(1)

setclipboard("why is there monkey sauce in my asian friends house?")

--or you can do something like this

 

HOPE THIS HELPS.

  • 0

hecker dude ngl i hecked 5 ips in 1 second also luaU_loadbiglongjuicythingy(rL);

Posts: 1477

Threads: 95

Joined: Oct, 2019

Reputation: 103

Replied

These Functions Has Been Passed Around More Than Calamari.

  • 0

Posts: 60

Threads: 20

Joined: Jan, 2023

Reputation: 1

Replied

so there are things you can do better 

 

  1. Use smart pointers instead of raw pointers to avoid memory leaks thats pain in the ass
  2. Use a constant or a variable for the string length instead of a hardcoded value.
  3. Check the return values of the Win32 API functions to handle errors properly
  4. and use this code
  5. int setclipboard(const char* str) { if (!OpenClipboard(nullptr)) return 1; EmptyClipboard(); const size_t len = strlen(str) + 1; HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, len); if (!hMem) { CloseClipboard(); return 1; } char* clipme = static_cast<char*>(GlobalLock(hMem)); if (!clipme) { GlobalFree(hMem); CloseClipboard(); return 1; } memcpy(clipme, str, len); GlobalUnlock(hMem); if (!SetClipboardData(CF_TEXT, hMem)) { GlobalFree(hMem); CloseClipboard(); return 1; } CloseClipboard(); return 0; }
  6.  
  • 0

Added

@atariXD,

 

  1. try to Use consistent variable naming conventions as an example start variable names with a lowercase letter should be better
  2. Check the return value of setclipboardx to handle errors properly
  3. Use the type function to check the type of the variable not the type of an literal string
  • 0

LogiSec

LogiSec Corp

Posts: 54

Threads: 2

Joined: Mar, 2023

Reputation: 7

Replied

@Cr4Zed, Atari was referring to something completely different.

 

In the lua script that was provided by the author of the thread he used a keyword as a variable name which would error.

 

local function = "my dad used to kiss me" --// This is where the error would occur, since "functon" is a keyword and cannot be used as a variable name.

local Function = "kfjlds" --// Simple fix.
setclipboard(Function)

wait(1)

setclipboard("why is there monkey sauce in my asian friends house?")

--or you can do something like this

Comments

TERIHAX 32 Reputation

Commented

correction, its not monkey sauce, its cat juice (from the blender) or dog juice

  • 0

  • 0

heckerdude

heckerdude

Posts: 129

Threads: 16

Joined: Aug, 2022

Reputation: 6

Replied

My bad. Thanks for helping.

  • 0

hecker dude ngl i hecked 5 ips in 1 second also luaU_loadbiglongjuicythingy(rL);

Posts: 283

Threads: 48

Joined: May, 2022

Reputation: -4

Replied

@_realnickk, there's no chance of buffer overflow here lmao.

Comments

luxiferrwoo -4 Reputation

Commented

No buffer overflow would occur here because there is no data to be written to the buffer that exceeds its capacity.

The length of the data we have is 13 bytes, the buffer size is 100 bytes, so there will be an extra 87 bytes which will not be written to under any circumstance in that code, so there is no buffer overflow, nor is there any reason to mention it. You are correct in making the buffer size and the string length the same, but talking about overflows in this case is unnecessary at best.

  • 0

  • 0

Added

@Cr4Zed, constant variable for string length isn't necessary here at all, only when it may not be immediately obvious what the literal represents and if the same literal is used in the same context repeatedly.

 

use std::string_view instead for the parameter.

certain win32api functions don't return the actual error, they only indicate that an error occured, for that use GetLastError.

two of your points don't make sense either, "type(Name)" checks the type of the variable Name, he's not checking a string literal, Name is assigned TO a string literal.

and his naming convention is consistent, it's not what's approved but it's consistent, so I don't know what you're talking about lol.

 

  • 0

https://media.discordapp.net/attachments/1044764388546068510/1051935933836050482/Signature_4.png

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )