Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › Function pointer to data?

Function pointer to data?

Posts 1–9 of 9 · Page 1 of 1
T7
t7ancients
Function pointer to data?
Is it possible to have a function pointer that points to say... an array of bytes, and actually execute/call it? I'm a little confused about the limitations on function pointers lol.
#1 · 14y ago
KI
kibbles18
umm functions are like arrays of bytes
#2 · 14y ago
.::SCHiM::.
.::SCHiM::.
Pointers are all the same lower level, it's only in high level languages that there are things like 'function pointers' and 'char pointers'. They are there so that the compiler knows how to handle them and what kinds of instructions to generate for them. I'm guessing you're asking this because you wish to execute a piece of code located on the heap or else in the .data section. Here's how you'd do that in C++

Code:
BYTE ToExecute[] = { 0xEB, 0xFE }; // infinite loop

__asm{
lea eax, ToExecute
jmp eax ;; call eax
}
#3 · 14y ago
T7
t7ancients
Is there any way to do that in 64-bit C++ code? As far as I'm aware, you can't do inline in 64-bit. :/
#4 · 14y ago
.::SCHiM::.
.::SCHiM::.
Function pointers have nothing to do with a function being inline. And in 64 it's the same really, the only difference will be this:


Code:
lea rax, Some_64bit_offset
call rax ; jmp rax
Using rAX instead of eAX, obviously the former is only 32bit while rax is 64 bit.
#5 · 14y ago
T7
t7ancients
I thought inline wasn't supported in x64. 0_o
#6 · 14y ago
.::SCHiM::.
.::SCHiM::.
I don't see why it wouldn't, inline simply means that the compiler doesn't generate a call to a function. But installs the function in the main function.
For example:
Code:
int return1(){ return 1;}
Is:

Code:
Return1 Proc
mov eax, 1
ret
Return1 endp

call Return1  ; not-inline
or:

Code:
mov eax, 1    ;; inline
#7 · 14y ago
Jason
Jason
Alternatively you can use a typedef to define the function's signature and then just cast the pointer to the bytes into the new type pointer and call it same way as you would call any function. It just saves on some manual asm and the compiler can handle it for you, plus it makes things a bit easier to follow.

Code:
typedef int (__stdcall *fMyFunction)(void); //similar to int __stdcall function(void)

BYTE *pData = (BYTE*)"\xDE\xAD\xBE\xEF"; //functions data

fMyFunction MyFunction = (fMyFunction)pData; //cast the data pointer into a function pointer.

MyFunction(); //call the function.
#8 · 14y ago
T7
t7ancients
So if I'm using Visual Studio 2010 Ultimate, 64-bit inline assembly will work? If not, what compiler(s) support it? Also which assembler is better in your opinion, MASM or NASM? Or should I use a different one?
#9 · 14y ago
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Similar Threads

  • Forum Data LossBy Dave84311 in News & Announcements
    9Last post 20y ago
  • Disable some of punkbuster's functions.By System79 in Game Hacking Tutorials
    3Last post 20y ago
  • Weapon Pointer TUTORIALBy Fortran in WarRock - International Hacks
    120Last post 19y ago
  • Warrock Vehicle Weapon No-overheat PointerBy Fortran in Game Hacking Tutorials
    0Last post 19y ago
  • OMS .32 pointersBy Doctrine in MapleStory Hacks, Cheats & Trainers
    3Last post 19y ago

Tags for this Thread

None