Sponsored Content
Full Discussion: Execute code in kernel mode.
Top Forums Programming Execute code in kernel mode. Post 302504480 by lilezek on Monday 14th of March 2011 05:45:25 PM
Old 03-14-2011
I'm forcing that function to print twice as the time that happened but nothing happens. To test, I added print("LOOOLAZO") but it doesn't print Smilie. Here is the code I'm using:

speed hack library:
Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <dlfcn.h>
#include <stdio.h>

static timeval * timezero = 0;

typedef int (*go)(timeval *tv, timezone *tz);

int gettimeofday(timeval *tv, timezone *tz)
{
    // Testing purposes:
    printf("LOOOLAZO");
    go gettimeofday_orig;
    int val;
    gettimeofday_orig=(go)dlsym(RTLD_NEXT,"gettimeofday");
    if (!timezero)
    {
        timezero = new timeval;
        timezone tmp;
        val = gettimeofday_orig(timezero,&tmp);
        (*tv) = (*timezero);
        (*tz) = tmp;
        return val;
    }
    // Double speed:
    timezone tmpz;
    timeval tmpv;
    val = gettimeofday_orig(&tmpv,&tmpz);
    tmpv.tv_sec = 2*tmpv.tv_sec - timezero->tv_sec;
    tmpv.tv_usec = 2*tmpv.tv_usec - timezero->tv_usec;
    while(tmpv.tv_usec >= 1000000)
    {
        tmpv.tv_usec -= 1000000;
        tmpv.tv_sec += 1;
    }
    return val;
}

executable main.cpp:
Code:
#include <stdio.h>
#include <sys/time.h>

using namespace std;

int main(int argc, char ** argv)
{
    struct timezone tmpz;
    timeval tmpv;
    while (true)
    {
        gettimeofday(&tmpv,&tmpz);
        printf("S: %i MS: %i\n",tmpv.tv_sec, tmpv.tv_usec);
    }

    return 0;
}

Line export:

Code:
export LD_PRELOAD="/home/******/proyectos/cheat engine/bin/speedhacklib/speedhack.so"

Output:
Code:
S: 1300139092 MS: 722327
S: 1300139092 MS: 722330
S: 1300139092 MS: 722333
S: 1300139092 MS: 722336
S: 1300139092 MS: 722340
S: 1300139092 MS: 722343
S: 1300139092 MS: 722346
S: 1300139092 MS: 722349
S: 1300139092 MS: 722352
S: 1300139092 MS: 722355
S: 1300139092 MS: 722358
S: 1300139092 MS: 722361
S: 1300139092 MS: 722365

No LOOOLAZO anywhere. Any idea?

Thank you for reading.
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

k_trap - kernel mode trap type 0x0000000E

HELP is urgently required, I run on SCO Unix 3 and this is the panic message that I get every time that I reboot 10U k_trap - kernel mode trap type 0x0000000E I have checked the swap already having the following results: #swap -l path dev swaplo blocks free... (3 Replies)
Discussion started by: alex_slb
3 Replies

2. SCO

unexpected trap in kernel mode

hi, I am trying to install sco openserver 5.0.4 on an old system. However, l was not able to proceed after putting the bootstr l have this panic message of PANIC: K_trap - kernel mode trap tupe 0x00000006 will someone kindly help to decode this error kayode (1 Reply)
Discussion started by: kayode
1 Replies

3. Linux

Kernel panic - not syncing: cannot execute a PAE-enabled kernel on PAE-less CPU

ok so I just installed fedora core 6 on my dell inspiron 700m and I go to boot into linux and I get this error. Has anyone seen this before? I also had XP Pro and Vista installed on this pc prior to putting fedora core 6 on the machine. I'm trying to setup a triple boot system. Please Help... (2 Replies)
Discussion started by: dave043
2 Replies

4. Programming

Aplication user and kernel mode (data access)

Hi all, I am trying to setup a program to use a device driver and am confusing buffer access between User and Kernel mode. I think all applications running in User space have to communicate with the device drivers using io control calls and then have some functions called back from the driver... (1 Reply)
Discussion started by: Brendan Kennedy
1 Replies

5. UNIX for Dummies Questions & Answers

Kernel Mode

Hi all i have queastion. Can anybody pease help me what is user mode and kernel mode and the term "De-mountable volumes" means? Thanks Palash (2 Replies)
Discussion started by: palash2k
2 Replies

6. SCO

PANIC: k_trap - Kernel mode trap type 0x0000000E

Hi, i'm another question: I'm a directory /usr/data on my server sco unix 5.0.5: # du /usr/data 4386948 /usr/data I'm tried to connect to ftp directory /usr/data to this server and: PANIC: k_trap - Kernel mode trap type 0x0000000E Cannot dump 262040 pages to dumpdev hd(1/41):space... (3 Replies)
Discussion started by: sebpes
3 Replies

7. Programming

which function copies data from user to kernel mode

when transitionaning from user to kernel mode which function copies data from user mode buffer to kernel mode? (5 Replies)
Discussion started by: rupeshkp728
5 Replies

8. Programming

HELP!!: CPU resource allocation between kernel modules and user mode process

Hi,all: I run my program which consists of one kernel module and one user mode process on a dual core server. The problem here is the kernel module consumes 100% of one core while the user mode process only consumes 10% of the other core, is there any solution that I can assign some computing... (1 Reply)
Discussion started by: neyshule
1 Replies

9. UNIX for Advanced & Expert Users

Precaution to access user mode buffers from kernel

When accessing a user mode buffers from kernel space drivers what precautions must we take and how those precautions need to be implemented? (0 Replies)
Discussion started by: rupeshkp728
0 Replies
gettimeofday(3UCB)				     SunOS/BSD Compatibility Library Functions					gettimeofday(3UCB)

NAME
gettimeofday, settimeofday - get or set the date and time SYNOPSIS
/usr/ucb/cc[ flag ... ] file ... #include <sys/time.h> int gettimeofday( tp, tzp); struct timeval *tzp; struct timezone *tzp; int settimeofday( tp, tzp); struct timeval *tzp; struct timezone *tzp; DESCRIPTION
The system's notion of the current Greenwich time is obtained with the gettimeofday() call, and set with the settimeofday() call. The cur- rent time is expressed in elapsed seconds and microseconds since 00:00 GMT, January 1, 1970 (zero hour). The resolution of the system clock is hardware dependent; the time may be updated continuously, or in clock ticks. long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* and microseconds */ tp points to a timeval structure, which includes the following members: If tp is a NULL pointer, the current time information is not returned or set. tzp is an obsolete pointer formerly used to get and set timezone information. tzp is now ignored. Timezone information is now handled using the TZ environment variable; see TIMEZONE(4). Only the privileged user may set the time of day. RETURN VALUES
A -1 return value indicates an error occurred; in this case an error code is stored in the global variable errno. ERRORS
The following error codes may be set in errno: EINVAL tp specifies an invalid time. EPERM A user other than the privileged user attempted to set the time. SEE ALSO
adjtime(2), ctime(3C), gettimeofday(3C), TIMEZONE(4) NOTES
Use of these interfaces should be restricted to only applications written on BSD platforms. Use of these interfaces with any of the system libraries or in multi-thread applications is unsupported. tzp is ignored in SunOS 5.X releases. tv_usec is always 0. SunOS 5.10 18 Feb 1993 gettimeofday(3UCB)
All times are GMT -4. The time now is 11:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy