C/C++ :: How To Hook Function From Same Process And Get Address Of Caller Function

Apr 27, 2013

I need to do it to avoid calling a function of my process from injected code.

So would like to hook this function to check whether the call is from the current module or it is from an external module, then I compare the address of the instruction who did the call with the module address range.

View 1 Replies


ADVERTISEMENT

Visual C++ :: How To Start Process Without Loading Global Hook

Apr 21, 2014

I had created a global hook by SetWindowsHookEx with WH_CALLWNDPROC. It is used to create a new toolbar button in specific window in the specific (3rd party) program (named HOOKEE.exe for example), and it works perfectly fine most of the time. Normally HOOKEE.exe is launched by double clicking the shortcut icon on desktop. But this program could be also launched in another way (provided by the provider of HOOKEE.exe), with this new way, HOOKEE.exe is by conhost.exe (on Windows 7), and then I could see (via ProcessMonitor) my hook is loaded by conhost.exe, but not the process HOOKEE.exe. In my understanding global hook would be loaded by whatever process, I have no idea on the exception, and what conhost.exe does to the HOOKEE.exe.

View 13 Replies View Related

C++ :: Function That Takes Two Input Arguments And Provides Two Separate Results To Caller

Apr 20, 2014

Write a function that takes two input arguments and provides two separate results to the caller, one that is the result of multiplying the two arguments, the other the result of adding them.Since you can directly return only one value from a function, you'll need the second value to be returned through a pointer or reference parameter.

Code:
#include "Code.h"
#include <iostream>
#include <string>

double x, y;

[Code] ....

View 3 Replies View Related

C/C++ :: Function To Return Either Value Or Address Of That Value?

Feb 1, 2015

I'd like a function to return either a value or the address of that value by the users input. So he can call the function like:

function("adress") - gets an adress, or function("value") - gets the value

I've tried both function overloading and templates, but none of them worked. He might input a character for the address and an int for the value... but...

Another strange thing that i observed is that the value returned by the function below is 0, so the output is address 0.

class testing
{
public:
static int x;

[Code].....

View 2 Replies View Related

C/C++ :: Find The Address Of Function?

Oct 14, 2012

find the address of function? mail the ans on (email removed)

View 4 Replies View Related

C/C++ :: How To Take Address Of Member Function

Oct 23, 2013

I want to take address of a member function in c++. How to do this.

View 2 Replies View Related

C++ :: Why Return Values From A Function By Ref Address

Feb 5, 2014

You can return values from functions by ref, address or value you can also do this with parameters, so what is the difference, if you have full return of a passed parameter by ref or address why would you need to ever return the function as a whole?

For ex
Code: int nValue(int& y){
y++;
}
or int& nVlaue(int y){
return y;
}

View 1 Replies View Related

C :: How To Get Address Returned By Malloc Function

Dec 6, 2013

So, I'm in the midst of implementing my own malloc() and free() functions, but I'm having a hard time with the syntax of getting the address that malloc returns. Whenever I check the address, it's 0 Here's the code:

Code:
char *word = malloc(10);
int address = *word;
printf("%d",address);

The reason I want the address is so that I could store it in a data structure for further usage when I'm dealing with different cases for the free() function. Or is there another way to do this?

View 5 Replies View Related

C++ :: Pass Address Of Pointer To Function

Sep 25, 2014

#include <iostream>
using namespace std;
void myfunc(int* ); // what do i put in these parameters to accept a mem loc of a pointer
int main () {
int x = 5;

[Code] .....

SOLUTION:

#include <iostream>
using namespace std;
//Purpose to create a function that returns a pointer to a pointer
int** myfunc(int**);
int main () {
int x = 5;

[Code] ....

View 3 Replies View Related

C/C++ :: How To Find Address Of Library Function

Nov 30, 2012

I want to find the address of printf() in c.

View 2 Replies View Related

C++ :: Return Non-Dynamic Local Address Of Var From Function?

Nov 29, 2014

Can I return a non-dynamic local address of a var from a function?

int* func(int m){
m=1;
return m;
}

My compiler giving warning but compiles and returns add but My tutor handout says it will not compile...!!! she used array in func and returned arr[m]

View 4 Replies View Related

C++ :: Labels As Pointer - Passing Address To A Function

Mar 7, 2014

Is there such thing as passing a winforms label by reference? For example, can I create a pointer label and pass the address to a function? I've looked online but couldn't find anything. Perhaps that's a sign?

View 1 Replies View Related

C/C++ :: Statement Cannot Resolve Address Of Overloaded Function

Feb 11, 2015

#include<iostream>
using namespace std;
#include<string>
main() {
cout<< "donner votre nom:";endl;
string nom("sans nom");
cin>> nom;endl;
cout<< "votre nom est:"<<nom; endl;
return 0;
}

when i try to build this program, i get this masseges:

in function 'int main()':
statement cannot resolve address of overloaded function

this a picture of the errors:

View 6 Replies View Related

C++ :: Calling Function Address - Too Many Arguments For Call Error

Nov 25, 2014

In C you can just load and call the address of a function without defining its arguments like this:

Code: int (__stdcall *pMessageBox)();
int main() {
HMODULE h=0;
h = LoadLibrary("user32.dll");
pMessageBox = GetProcAddress(h, "MessageBoxA");
// MessageBoxA
pMessageBox(0, "MessageBoxA has been called!", "MessageBox Example", MB_OK);
return 0;
}

In C++ the same code gives "too many arguments for call" error unless you define the function first with its parameters.

Is there a way to do it the same way in C++?

View 10 Replies View Related

C++ :: Error - Statement Cannot Resolve Address Of Overloaded Function

Nov 2, 2013

I can't seem to figure out whats causing this error: statement cannot resolve address of overloaded function . Error is before line 14 in bubblesortrand function. Thnx in advance.

void bubblesort(int num[], int a_size)
{
int i, j, temp;
for(i = (a_size - 1); i >= 0; i--)

[Code].....

View 4 Replies View Related

C++ :: Pointer Passed Into A Function Looses Address It Points To

Mar 7, 2013

Sem is a pointer to semantic which is a struct type variable. I pass the sem into function yylex so i can fill the semantic.i and semantic.s(s points to an array). The problem is that when sem->i = a; is used inside yylex function, sem->s stops showing to the array.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <iostream>
using namespace std;
union SEMANTIC_INFO

[Code] ...

View 2 Replies View Related

C :: Simple Valid / Invalid Function - Determine Either A URL Address Is Correct Or Not

Jul 13, 2013

I have to write a code which would determine either a URL address is correct or not.

Now, a valid address should look like: "www.something.something.uk".

It has to have 3 dots, 3 w-s in the beginning, and it must end with "uk".

E.g.

Valid addresses:
1. www.jce.ac.uk
2. www.tr2213.oi34.uk

Invalid addresses:
1. www2.jce.ac.uk
2. òæøéàìé - îëììä à÷ãîéú ìäðãñä éøåùìéí - ìéîåãé äðãñä ìúåàø øàùåï
3. www.something.uk

Just to be clear, this criteria mentioned above is not real, just homework

Code:
#include <iostream>
#include <string.h>
using namespace std;
int isValid (char s[])
{
int dots=0;

[Code] ......

It tells me both strings are incorrect but the first 1 is.

View 4 Replies View Related

C# :: External Window Paint / Draw Hook?

Jan 13, 2014

Is there any way that I can call a function/receive an event whenever an external window (not any of my forms) repaints/draws?

If you create a GDI+ graphics object and give it the HWND of another window that refreshes a lot like a web browser, anything with animated graphics, your draws and the windows draws are out of sync which creates an intense flicker effect.

Googling this issue only brings up results for handling when my own form repaints...

My idea is that I could just redraw my GDI stuff whenever the form redraws, this is indeed possible?

View 9 Replies View Related

C++ :: Hook HW Interrupts In Flat Memory Mode With DOS32/A

Jul 23, 2012

I have a question about how to hook HW interrupt in flat memory mode...

@ about my application...
- application is created by combining Watcom C and DOS32/A.
- application is written for running on DOS mode( not on OS mode )
- with DOS32/A now I can access >1M memory and allocate large memory to use...(running in flat memory mode !!!)

@ current issue...
- I want to write an ISR(interrupt service routine) for one PCI card. Thus I need to "hook" the HW interrupt.
- Ex. the PCI card's interrupt line = 0xE in DOS. That means this device will issue interrupt via 8259's IRQ 14.

But I did not how to achieve my goal to hook this interrupt in flat mode ?

@ resource I found...
- in watcom C's library, there is one sample using _dos_getvect, _dos_setvect, and _chain_intr to hook INT 0x1C...
I tested this code and found OK. But when I apply it to my case: INT76 ( where IRQ 14 is "INT 0x76" <- (14-8) + 0x70 )
then nothing happened...
* I checked HW interrupt is generated but my own ISR did not invoked...

Do I lose something ? or are there any functions I can use to achieve my goal ?

View 2 Replies View Related

C++ :: Syntax Error In Function Call - Type Mismatch In Parameter In Function Sort

Jul 6, 2014

error says "cannot convert 'int*' to 'int' in function main()
and also
type mismatch in parameter in function sort(int,int)

Heres the code:
#include<iostream.h>
#include<conio.h>
void main() {
void sort(int,int);
clrscr();

[Code] .....

View 11 Replies View Related

C :: Function That Will Work For Both Dynamic And Static Implementations Of A Function To Get Transverse Of Matrix

Feb 11, 2013

i need a function that will work for both dynamic and static implementations of a function to get the transverse of a matrix. so far, i have this

Code:

matrix transpose(matrix m)
{
int row, col;
row = m.com_dim;
col= m.row_dim;
}

[code]....

this works well with my static implementation, but when i try it in dynamic it gives me errors. the function has to be the same for both dynamic and static implementation

View 4 Replies View Related

C++ :: Keyboard Function That Is Called In Main Function To Make Shape Move

Jan 19, 2013

Ok so I am working on a game and I'm in the process of developing my Player class. Anyways, what I have is a keyboard function that is called in my main function to make a shape move.

void myKeyboardFunction(unsigned char key, int x, int y) {
switch ( key ) {

[Code].....

But when I try to call it, trying to copy my previous method,

glutKeyboardFunc(Player1.playerControls);

I get an error

error C3867: 'Player::playerControls': function call missing argument list; use '&Player::playerControls' to create a pointer to member

I get an error saying it can't convert parameters. I would just like to understand why the arguments become a problem when I make the function a member of my class, when the first method I used is so easy.

View 2 Replies View Related

Visual C++ :: Error C3867 Function Call Missing Argument List For Calling Thread Function

Mar 19, 2013

I searched the web for error: C3867... and the discussions where murky or obscure.

My code excerpt is:

#pragma once
#include <windows.h>
#include <stdlib.h>
#include <process.h>
void PutUpfrmIO(void *);
namespace WordParsor {

[Code] .....

I get the generic message:

error C3867: 'WordParsor::Form1::PutUpfrmIO': function call missing argument list; use '&WordParsor::Form1::PutUpfrmIO' to create a pointer to memberc:userskingc++wordparsorwordparsorForm1.h... and the suggestion fix generate another error.

One person suggested the gcroot<> object wrapper... but I do not know how to modify/declair the function or its argument type.

View 2 Replies View Related

C :: Reverse Function That Inserts And Prints Binary Function Correctly

Nov 3, 2013

I have written a function that inserts and prints a binary function correctly.

For example a tree like this [URL] ..... would print like this

Code:
node: 10
node: 7
node: 6
node: 8
node: 9

[Code] ....

Here is my print function

Code:
void prt_tree(struct node *tree) {
if (tree == NULL) {
printf("Null Tree
");
return;

[Code] .....

Could I just make some adjustments to my function to reverse it? and if so, how?

View 2 Replies View Related

C++ :: Pass 2 Arrays Into Void Function And Return Values To One Function?

Feb 12, 2014

I'm trying to pass 2 arrays into a void funtion, and return values to one function.

this is the the program I'm working with, after I'm done I have to split it into 3 files, a header, a main, and a separate cpp file for the functions to live in.

#include <iostream>
using namespace std;
void processArrary(int numberCount[], int Numbers[], int intnumberSize, int numberCountSize);
int main() {
int Scores[26] = {76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189};
int numberCount[8] = { 0 };

[code]...

The goal of this program is to separate and count the groups of numbers then output the amount of numbers in each group. Near as I can tell, everthing should work, but I'm getting all zeros to be displayed in each group.

View 6 Replies View Related

C :: Main Function Does Not Return Any Values When Calling Other Function?

Jun 9, 2013

The function is supposed to return value from the file in my main, but I am getting empty value. I am trying to get better with pointer. Right now just teaching myself.

right now the only way for this code to show value is when in put the putchar(*ps) inside my readfile function. I would like to readfile to return value and print in the main function.

Code:

#include <stdio.h>
char *readfile(char filename[]);
int main(int argc, char *argv[] ) {

[Code].....

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved