Questions tagged [c++]
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is considered an intermediate level language.
432
questions
2
votes
1
answer
991
views
Trying to hook DirectX9 using C++ - Keeps crashing
I posted a thread on StackOverflow a few days ago, and it's got little attention, so i though it's possible this might be a better place for it.
As the title says, i'm trying to hook/detour DirectX9 ...
2
votes
1
answer
173
views
Avoid program detecting a thread being used [closed]
I'm writing a DLL for a program that needs to run in an infinite loop (with delays, of course). For example:
while (true) {
std::cout << "I am running.\n";
Sleep(1000);
}
I'm not sure ...
2
votes
1
answer
804
views
How can I call a function that acts like __thiscall, except the caller cleans the stack?
I'm trying to call a function with a function pointer in C++, but I can't find any convention that fits it. Its stack arguments are (right to left):
func(float x, float y, int unk);
...but ecx needs ...
2
votes
1
answer
1k
views
vTable size calculation (for MSVC)
I made some PE analysis script. One part is virtual functions extraction, I implemented vTables lookup using this schema.
Actual algorithm of lookup is not important part of question. I don't know ...
2
votes
1
answer
1k
views
Why is mhook failing to hook my function?
So I'm exploring mhook 2.3 and have build a sample executable specifically for this purpose. I have an injector that injects a dll containing mhook into the target process.
This all works ...
2
votes
2
answers
1k
views
turning decompiled C++ code into writable C++
Here's my scenario I currently have a DLL that was made in like 2003 archived that has data and functions I still need to use and I'm also 90% sure the DLL doesn't work correctly as its too outdated. (...
2
votes
2
answers
438
views
C++, Windows UI Automation and DaVinci Resolve
I've been researching this topic for a while, but the information is extremely limited and very confusing.
DaVinci Resolve is an editing and color grading software, its tools are so many and so ...
2
votes
1
answer
1k
views
convert C++ code to python code
while I'm doing RE using ghidra i saw this code
byte bVar1;
byte bVar2;
uint uVar3;
uVar3 = 0;
while (bVar2 = (byte)uVar3, (char)bVar2 < '\b') {
bVar1 = *(byte *)(uVar3 + param_1) ^...
2
votes
1
answer
89
views
What C++ construct could emit such Watcom C++ 10.5 assembler listing?
Based on the assembler listings, a C++ object is locally allocated on the stack without constructing the object in the caller routine and the callee takes the address to the allocated stack space and ...
2
votes
1
answer
199
views
How does Borland C++ 5 exception handling work?
So, I'm still working on reverse-engineering an 1996 game. I have cleared a lot of roadblocks, but one thing that continues to annoy me is exception handling and RTTI metadata.
There is a function ...
2
votes
2
answers
715
views
C++ hide string parameter for string viewer
bool isLaunched = CreateProcessW(
L"C:\\Windows\\System32\\Notepad.exe", // Should be shown in any string viewer or decompiler.
0x0,
0x0,
0x0,
TRUE,
0,
0x0,
...
2
votes
1
answer
392
views
How use signature pattern for hooking
I like to replace the static function address:
AddressOfHookSoundFunction = (DWORD)GetModuleHandleA("myfile.exe") + 0x0F3B65; // good: 4406117 (integer)
using signature pattern:
SigScan ...
2
votes
1
answer
3k
views
How to set the type of a variable or function to an std::string?
I'm using IDA Pro and have identified a function that takes an std::string as an argument.
However when I click on the function and "Set Item Type", entering its definition:
std::__ndk1::...
2
votes
2
answers
137
views
VC 6 C++ Exception handling, nTryBlocks=0, pTryBlockMap=0 , how?why?
I'm trying to decompile an old binary (about 20 year old).
The program uses exceptions.
I found some FuncInfo but they do not contain any pTryBlockMap and nTryBlocks is 0.
I've tried many options ...
2
votes
1
answer
316
views
Arrangement of variables on the stack - out of order?
I was practicing some reverse engineering crack-mes as part of our university curriculum, and I have a question around the arrangement of variables on the stack.
I have a very basic C++ code, like ...
2
votes
4
answers
933
views
Understanding RE output of a simple C++ program
I am trying to learn RE and I decided to explore this field by reverse engineering a simple C++ program, which I post here:
SIMPLE C++ PROGRAM
#include <iostream>
int main()
{
int value;
...
2
votes
2
answers
4k
views
Patching JNZ (two byte opcode) into JMP near (one byte opcode)?
I've been tinkering with Fallout New Vegas, and have focused on modifying a very simple record that's hardcoded in the game engine. It's called an Imagespace Modifier, which is a very basic shader ...
2
votes
1
answer
1k
views
Hooking function with C++, IDA and .pdb file
I want to call a function in a program. I do this from a DLL entry point. I opened the program in IDA together with its .pdb file. This is what the function looks like according to IDA:
void ...
2
votes
1
answer
51
views
Reversing assembler DCD directive list into a c++ variable
For example we have assembler variable "foo" defined as:
.text:00001078 foo DCD 0xffffffff, 0xffffeeee
How it(variable foo) would look like in c++(or whatever higher lang)???
2
votes
1
answer
113
views
What is an easy way to update the addresses of hooked functions in an exe
I have hooked into some functions in an exe. I was wondering if there were any simple ways to detect the memory addresses of these functions after the exe has a new build (not my exe). Is the best way ...
2
votes
3
answers
172
views
Virtual Method that returns <this>?
In my vtable i found a method that simply returns ecx.
Now im confused as to what this tries to accomplish ?
Is this a known useful sequence ?
2
votes
1
answer
2k
views
Anti reverse engineering tools that are easy to set up
I will be distributing a c++ application, and I was wondering if there was any tools available to add an extra layer of security against reverse engineering. I'm looking for a quick fix because I don'...
2
votes
1
answer
593
views
Need to recover C++ code from binary of server and client
We have an old 2D space shooter multiplayer game community form late 1990s. The game is still alive today but the problem is the creators of the game are no where to be found and the source code is ...
2
votes
0
answers
113
views
I trying rewrite asm to c++ [closed]
This code generates an API key. I use it in an android app as .so file,
but I need to rewrite it to java from c++. How do I translate?
push rbp
push r15
push r14
push r13
push r12
push ...
2
votes
0
answers
101
views
statically placing hooks on PE file's IAT
recently I started writing my own PE library for C++, and wanted to implement static IAT/EAT hooking, (basically hooking by patching the file instead of hooking at runtime), I managed to successfully ...
2
votes
0
answers
52
views
Reversing internal function, can't call it with injected DLL
I'm currently learning RE. I've chosen to do so by trying to RE Skyrim for PC. I'm trying to call the ingame function for printing to the console, I'm doing this via an Injected DLL.
The function call ...
2
votes
0
answers
519
views
Passing a String into a Function With GDB
So, I have a function with the prototype according to GDB:
{std::string (std::string)} 0x56027729e545
<function(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator&...
2
votes
1
answer
740
views
Can't find references (xref) to function
I am reversing a function and when I trying to see its references, it doesn't show me the calls to the function. It only show the place of the object in RVA.
Is there a plug-in or something that I ...
2
votes
0
answers
37
views
How can I tell whether or not a given library method is being referenced by a consumer program statically in OOP languages?
Preface: This question is about source code reverse engineering and static analysis. Meaning, there is no built code available but I have access to the source code of the program.
Imagine I'm looking ...
2
votes
0
answers
485
views
Ghidra - Export namespaces
I am currently learning to use ghidra, and I found the Symbol Tree.
Ghidra found some namespaces that I would like to export.
These namespaces don't even have to be readable, just reusable, such that ...
2
votes
0
answers
281
views
How to return a list of vtable methods?
I'm relatively new to scripting environments in disassemblers. What I am looking for is a way to dump all of the vtable methods from a C++ disassembly in such a way that I can access them later for ...
2
votes
0
answers
960
views
Dump c++ class definitions from .exe + .pdb on windows
Is there any way to dump C++ class definitions on windows if executable and PDB files are available. I've seen this done before using gdb but haven't had any luck doing this on windows. I've tried ...
2
votes
1
answer
2k
views
How to override c++ string class with LD_PRELOAD
i am trying to override predefined functions such as strcmp, getenv, etc.
i already override some of them using LD_PRELOAD options.
but i can't override string class, how can i override c++ string ...
2
votes
0
answers
452
views
Calling original function that uses unconventional calling convention
I'm using MinHook to hook a static function with the following signature:
float __usercall RadarManager::Add_Blip@<xmm0>(int position@<ecx>, int shape@<edx>, int colorId, float ...
2
votes
0
answers
265
views
Unable to use C++ to read memory image file [closed]
I'm using winpmem to create a memory image. I would like to create an interface that would allow a user to search for various patterns in the image. I'm using C++ to open and read the file but I am ...
2
votes
0
answers
117
views
Patching a variable's type in an executable file
Let's say i have a program.In this program i have a variable named PacketSize of type Short.I want to change the variable's type to Int.
Now if i am able to locate this variable's location in the ...
2
votes
3
answers
3k
views
Can't find the base address of a function with IDA PRO (compiled with vs2015)
Hi so I was just trying to learn reverse-engineering and when I open my program in IDA pro I find this address sub_11330 (rebased to 0) https://gyazo.com/1c34d2c31f29583f05d0dd4d956d6f74 however when ...
2
votes
0
answers
349
views
Looking to RE a Ducky Shine 5
I know how to program in C++/C# and a few other low level languages. I'm however in the dark about reverse engineering firmware etc. I was wondering if anyone could point me towards some learning ...
2
votes
0
answers
369
views
Is it possible to get address of function that implement virtual
I have address of virtual function in export table , is it possible to get implementation function address, that makes whole logic of virtual ?
Code sample:
this is virtual function that goes to ...
2
votes
0
answers
67
views
How to know the C++ try/throw/catch block size and address from machine code? [duplicate]
I'm doing a project that reorders basic blocks inside a function at runtime in C++ under 64-bit Linux. The reordering process includes updating instructions like "jmp". One problem is that if the ...
2
votes
0
answers
271
views
How to include these exception handle symbols in x86 assembly code?
The test is on 32bit x86 Linux, with g++ 4.6.3.
So basically I use a IDA pro script to recover the .gcc_excpt_table and .eh_frame sections from binary compiled from C++ language.
Basically I want to ...
2
votes
1
answer
538
views
Why module address is different in Cheat Engine than in x32dbg?
Why the module address is different in Cheat Engine than in x32dbg?
I'm trying to read this:
My c++ attempt:
#include "pch.h"
#include "Functions.h"
#include "offsets.h"...
1
vote
2
answers
5k
views
How to find how global variables defined in binary
In Visual Studio I have written simple code,
int pranit = 2;
int& sumit = pranit;
int main(int argc, char** argv) {
sumit++;
return sumit;
}
I used OllyDbg to Disassamble, but I am not ...
1
vote
2
answers
1k
views
Are vTable pointers always located inside a module?
Assuming the standard VC++ vTable layout:
Heap-Addr TableAddr
+-----------+ +-----------+
| TableAddr | ----> | Funcion-1 | ----> Exec region of module
+-----------+ +---...
1
vote
1
answer
3k
views
How does new operator internally work in C++?
The articles explaining the internals of malloc and free in glibc are abundant in number. However, I'd like to know how dynamic memory management works in C++, specifically the nitty gritty of new and ...
1
vote
2
answers
2k
views
How to set breakpoint on C++ symbols?
How to set breakpoint on this C++ symbol?
bp qmgr!TokenHandle::operator-:
Could not resolve error at 'qmgr!TokenHandle::operator-:'
in windbg?
1
vote
2
answers
1k
views
How to find specific function in IDA pro
Apologies if this account question may sound a bit stupid but I really need help with something
Let's say I had a function that looks something like this :
#undef curl_easy_setopt
CURLcode ...
1
vote
2
answers
5k
views
Getting the correct memory address for a specific value
I was watching this series of videos and I noticed that his memory addresses were not changing every time he restarted the game and/or olly. In addition, his comments seemed to stick around and he was ...
1
vote
3
answers
3k
views
Cyber security student wanting to start learning reverse engineering [duplicate]
I'm really interested in learning reverse engineering. Especially in regards to malware. Any help is much appreciated
What should I learn before I start to learn reverse engineering?
Is learning C/...
1
vote
2
answers
2k
views
Extract decrypted token from EXE
EDIT
As some people have pointed out, this exe file classifies as a 'virus' on some analysers. I can assure you this exe is from a very trusted source, and is actually part of a large puzzle (which ...