/*

Crack.dll, Crack.lib, Crack.h


%
% Hardware Access Wrapper for Windows NT / 2000 / XP
% User mode DLL for kernel driver CrackNT.sys
%
% Copyright 2000-2007 by Werner.Zimmermann
%
% Distributed for non-commercial use without any warranty or support.
% For commercial use contact the author. Use at your own risk!
%
% You may use this software in your own products without further notice, if you do
% not charge money for your product. However you must distribute all files in this
% package together with your software may it be binary or source and you must leave
% this copyright notice unmodified and refer to this notice in your own copyright
% message.
%
%

This package contains the following components
- CrackNT.sys - kernel mode driver
- CrackIns.bat, CrackStat.bat, CrackRem.bat and loaddrv.exe - batch
files to install, check status and uninstall the kernel mode driver
- Crack.DLL as interface between user mode programs and CrackNT.sys
- IOmgr.exe - a user mode application, details see IOlib.htm
- Crack.lib and Crack.h - a Visual C library and a header file, which
you may use to build your own user mode programs based on CrackNT.


//-----------------------------------------------------------------------------
1. Installation

To run programs based on CrackNT you need CrackNT.sys to be installed.
CrackNT.sys is a Windows NT/2000/XP device driver. Installation requires
administrator privileges. Once, when CrackNT.sys has been installed, application
programs using CrackNT can be used by normal users without requiring
administrator privileges.

To install CrackNT.sys, from the Windows command line type 'CrackIns'. To check,
whether CrackNT.sys is running, type 'CrackStat'. This should show CrackNT's
status=running and start=Automatic, which means, when you reboot your PC,
CrackNT.sys will be automatically started again. To remove CrackNT.sys, type
'CrackRem'.

While running application programs based on CrackNT, you also need Crack.dll,
which contains the interface between user mode applications like IOmgr.exe (see
file IOmgr.htm). Crack.dll can be somewhere in Windows' search path, however,
it's best to have Crack.dll in the same directory as the application program.

Crack.h and Crack.lib are needed to build your own user mode applications using
CrackNT. Crack.h is a C header file and contains definitions and function
prototypes. It needs to be included in your own source files. Crack.lib is a
Visual C library, which you must link to your own C files.


//-----------------------------------------------------------------------------
2. Legal notice : A warning before you use CrackNT

Direct hardware access is no problem, as long as you only read data. HOWEVER, BY
WRITING DATA, YOU MAY CRASH OR EVEN PERMANENTLY DAMAGE YOUR HARDWARE AND/OR
DESTROY DATA ON YOUR DISKS. So unless you know exactly what you are doing,
please do not use this tool. This is not a toy to play around for unexperienced
users!!!

This software is neither freeware nor shareware. It is copyrighted by
Werner.Zimmermann.

It is distributed for non-commercial use without any warranty or support. For
commercial use contact the author. Use at your own risk!

You may use this software in your own products without further notice, if you do
not charge money for your product. However you must distribute all files in this
package together with your software may it be binary or source and you must leave
this copyright notice unmodified and refer to this notice in your own copyright
message.


//-----------------------------------------------------------------------------
3. A sample application showPort.cpp

//*****************************************************************************
//A sample application showPort.cpp could use CrackNT as follows:
#include "windows.h"
#include "stdio.h"
#include "conio.h"
#include "crack.h"

void main(void)
{ BYTE toggle = 0;
WORD ioPortAddress=0x378; //LPT1: printer data port
int val=0;
BOOLEAN run;
int i;

//Open the driver (Needed once, must be called before the first use of all other CrackNT functions)
if (CrackLoad())
{ printf("ERROR: Sorry, could not load crackNT.sys - exiting\n");
exit(-1);
}

//From here on CrackNT functions can be called
//e.g. get and print version information
printf("-------------------------------------------------------------------------\n");
printf("Version Info Crack.DLL V%X.%X --- CrackNT.sys V%X.%X\n\n",
(CrackGetDriverVersion()>>24)&0xFF,(CrackGetDriverVersion()>>16)&0xFF,
(CrackGetDriverVersion()>> 8)&0xFF,(CrackGetDriverVersion() )&0xFF);

//e.g. read and write bytes to an I/O port
printf("Let's write a value to the printer data port LPT1:\n");
while (val>=0)
{ printf("Type a 2 digit hexadecimal value between 00 ... FF (type -1 to stop) : ");
scanf("%X",&val);
CrackWriteIoByte(ioPortAddress, (BYTE) val);
printf("Read back your value: %Xh\n", CrackReadIoByte(ioPortAddress));
}

//e.g. toggle printer port bits of LPT1
printf("-------------------------------------------------------------------------\n");
printf("Now toggling all 8 printer port bits (pin 2 to 9 of the 25pole connector)\n");
printf("doing it the 'offical way', i.e. calling a device driver function in\n");
printf("CrackNT.sys via DeviceIoControl() in Crack.dll\n");
printf("Press a key to stop toggling\n\n");
i=0;
run=TRUE;
while (run) //generate square wave signal with approx. 35µs period on a Pentium II, 266MHz
{ toggle = ~toggle;
CrackWriteIoByte(ioPortAddress, toggle);
i++;
if ((i % 4096) == 0)
{ if (kbhit())
{ run = FALSE;
}
}
}
getch();

//Close the driver (Needed once, must be called when you're done using CrackNT functions, typically put it
//at the end of your program)
if (CrackUnload())
{ printf("INFO: Sorry, could not unload crackNT.sys - exiting\n");
}
}
//*****************************************************************************

Using the Visual C++ command line compiler, compile and link with
cl showPort.cpp crack.lib

Other samples can be found in subdirectory .\Samples.

//-----------------------------------------------------------------------------
4. Description of the CrackNT application programming interface

NOTE:
Crack.h contains additional data structures and function prototypes not
documented in Crack.htm. At the time of this writing, these functions should be
regarded as 'not existing'! Some of them are not completeley tested, some of
them are not fully functional and some even may not be realized at all. Please
do not use them even if they may work. In future versions they either may be
documented, changed or removed without further notice.

Some of CrackNT's functions contain static status information, so it is a good
idea to use CrackNT only from a single application at a time.

*/


//#############################################################################
//##### Installation and Deinstallation #######################################
//#############################################################################
//-----------------------------------------------------------------------------

//##### Load and initialize the kernel drivers crackNT.sys ####################
// Return value: 0 success
// <0 failure
CRACK_API int CRACK_CALL CrackLoad(void);
//-----------------------------------------------------------------------------

//##### Unload the kernel drivers crackNT.sys #################################
// Return value: 0 success
// <0 failure
CRACK_API int CRACK_CALL CrackUnload(void);
//-----------------------------------------------------------------------------

//##### Return CrackNT.sys version info #######################################
// Return value: high word
// - high byte major version of Crack.DLL
// - low byte minor version
// low word
// - high byte major version of CrackNT.sys
// - low byte minor version
// -1 driver not found
CRACK_API DWORD CRACK_CALL CrackGetDriverVersion(void);


//#############################################################################
//##### Port Input / Output ###################################################
//#############################################################################
//-----------------------------------------------------------------------------

//##### Read byte from I/O port address #######################################
// Input: 16bit port address
// Return value: read value
CRACK_API BYTE CRACK_CALL CrackReadIoByte(WORD portAddress);
//-----------------------------------------------------------------------------

//##### Read word from I/O port address #######################################
// Input: 16bit port address
// Return value: read value
CRACK_API WORD CRACK_CALL CrackReadIoWord(WORD portAddress);
//-----------------------------------------------------------------------------

//##### Read double word from I/O port address ################################
// Input: 16bit port address
// Return value: read value
CRACK_API DWORD CRACK_CALL CrackReadIoDword(WORD portAddress);
//-----------------------------------------------------------------------------

//##### Write byte to I/O port address ########################################
// Input: 16bit port address
// value, which will be written to port
CRACK_API void CRACK_CALL CrackWriteIoByte(WORD portAddress, BYTE value);
//-----------------------------------------------------------------------------

//##### Write word to I/O port address ########################################
// Input: 16bit port address
// value, which will be written to port
CRACK_API void CRACK_CALL CrackWriteIoWord(WORD portAddress, WORD value);
//-----------------------------------------------------------------------------

//##### Write double word to I/O port address #################################
// Input: 16bit port address
// value, which will be written to port
CRACK_API void CRACK_CALL CrackWriteIoDword(WORD portAddress, DWORD value);


//#############################################################################
//##### Special Port Input / Output Functions #################################
//#############################################################################
//-----------------------------------------------------------------------------

//##### Enable or disable direct port io
// Input: enable=TRUE turn it on, enable=FALSE turn it off
// This function must be called, before CrackDirectPortIo() or CrackGlobalDirectPortIo() is used for the first time.
// Please note:
// Direct port io is NOT compatible with multi core CPUs like Pentium D, Core Duo, Athlon x2 and
// probably will crash your machine (Blue screen) - so if in doubt, don't use it !!!
CRACK_API void CRACK_CALL CrackEnableDirectPortIo(BOOLEAN enable);
//-----------------------------------------------------------------------------

//##### Allow current process direct port io in user mode for given port range#
// Input: enable=TRUE turn it on, enable=FALSE turn it off
// start and end port addresses of i/o port range
// After enabling direct port io the calling process may use normal input() and output()
// commands on the selected ports, which are faster, instead of using CrackReadIo... or
// CrackWriteIo...
// Note: This function uses "dirty" tricks, which may not be compatible with
// future versions of Windows XP. CrackEnableDirectPortIo() must be called before!
CRACK_API void CRACK_CALL CrackDirectPortIo(BOOLEAN enable, WORD startPortAddress, WORD endPortAddress);
//-----------------------------------------------------------------------------

//##### Allow all processes direct port io in user mode for given port range ##
// Input: enable=TRUE turn it on, enable=FALSE turn it off
// start and end port addresses of i/o port range
// After enabling direct port io all processes may use normal input() and output()
// commands on the selected ports, which are faster, instead of using CrackReadIo... or
// CrackWriteIo...
// Note: This function uses "dirty" tricks, which may not be compatible with
// future versions of Windows XP. CrackEnableDirectPortIo() must be called before!
CRACK_API void CRACK_CALL CrackGlobalDirectPortIo(BOOLEAN enable, WORD startPortAddress, WORD endPortAddress);


//#############################################################################
//##### Memory Input / Output #################################################
//#############################################################################
//-----------------------------------------------------------------------------

//##### Read byte from physical memory address ################################
// Input: 32bit physical memory address
// Return value: read value
CRACK_API BYTE CRACK_CALL CrackReadPhysicalMemoryByte(DWORD address);
//-----------------------------------------------------------------------------

//##### Read word from physical memory address ################################
// Input: 32bit physical memory address
// Return value: read value
CRACK_API WORD CRACK_CALL CrackReadPhysicalMemoryWord(DWORD address);
//-----------------------------------------------------------------------------

//##### Read double word from physical memory address #########################
// Input: 32bit physical memory address
// Return value: read value
CRACK_API DWORD CRACK_CALL CrackReadPhysicalMemoryDword(DWORD address);
//-----------------------------------------------------------------------------

//##### Write byte to physical memory address #################################
// Input: 32bit physical memory address
// value, which will be written to memory address
CRACK_API void CRACK_CALL CrackWritePhysicalMemoryByte(DWORD address, BYTE value);
//-----------------------------------------------------------------------------

//##### Write word to physical memory address #################################
// Input: 32bit physical memory address
// value, which will be written to memory address
CRACK_API void CRACK_CALL CrackWritePhysicalMemoryWord(DWORD address, WORD value);
//-----------------------------------------------------------------------------

//##### Write double word to physical memory address ##########################
// Input: 32bit physical memory address
// value, which will be written to memory address
CRACK_API void CRACK_CALL CrackWritePhysicalMemoryDword(DWORD address, DWORD value);
//-----------------------------------------------------------------------------

//##### Map a physical memory address range into a linear user mode address ###
// Input: 32bit physical memory base address
// size of address range in bytes (0 ... 4096)
// Return value: linear address
// NULL, if the mapping fails
// Note: The associated memory can be accessed in user and kernel mode.
// This function uses "dirty" tricks, which may not be compatible with
// future versions of Windows XP.
CRACK_API DWORD CRACK_CALL CrackMapPhysicalMemory(DWORD physAddress, DWORD size);
//-----------------------------------------------------------------------------

//##### Unmap an address range, which has been mapped with CrackMapPhysicalMemory ##
// Input: 32bit linear memory base address
// size of address range in bytes
CRACK_API void CRACK_CALL CrackUnmapPhysicalMemory(DWORD linAddress, DWORD size);
//-----------------------------------------------------------------------------

//##### Allocate kernel memory and map to user space #########################
// Input: memory size in bytes (0 ... 4096)
// 0 paged memory (use whenever possible) or 1 non paged
// Return value: pointer to kernel memory (32bit linear address)
// NULL, if the allocation fails
// Note: The associated memory can be accessed in user and kernel mode.
// This function uses "dirty" tricks, which may not be compatible with
// future versions of Windows XP.
CRACK_API void* CrackAllocateKernelMemory(DWORD size, BOOLEAN nonPaged);
//-----------------------------------------------------------------------------

//##### Release kernel memory allocated by CrackAllocateKernelMemory ##########
// Input: pointer to kernel memory (32bit linear address)
// Return value: 0 success
// -1 failure
CRACK_API int CrackReleaseKernelMemory(void *p);
//-----------------------------------------------------------------------------

//##### Get a physical memory address for a given linear address ##############
// Input: 32bit linear memory address
// Return value: 32bit physical memory address
CRACK_API DWORD CRACK_CALL CrackGetPhysicalAddress(DWORD linAddress);
//-----------------------------------------------------------------------------

//##### Get a linear memory address for a given physical address ##############
// Input: 32bit physical memory address
// Return value: 32bit linear memory address
CRACK_API DWORD CRACK_CALL CrackGetLinearAddress(DWORD physAddress);


//#############################################################################
//##### Interrupt and Timer Callbacks #########################################
//#############################################################################

        

        

        

        
//-----------------------------------------------------------------------------

//##### Install a timer callback routine ######################################
// Input: timer period in msec (periodical timer) or delay time
// in msec (one shot timer)
// oneShot=TRUE for one shot timer
// oneShot=FALSE for periodical timers
// address of callback routine, which will be called, when
// the timer elapses. The callback routine is passed the timer
// handle. All other parameters are dummy.
// Return value: 0 if failure
// timer handle to be used in further timer calls, if success
CRACK_API int CRACK_CALL CrackInstallTimerCallbackRoutine(int period, BOOLEAN oneShot, \
void (CALLBACK *callbackRoutine)(DWORD hTimer, DWORD message, DWORD dwUser, DWORD lparam2, DWORD lparam3));
//-----------------------------------------------------------------------------

//##### Remove a timer callback routine #######################################
// Input: timer handle (value returned by CrackInstallTimerCallbackRoutine)
// Note: If installed timer callback routines are not removed, before the
// program is closed, the computer may crash!!!
CRACK_API void CRACK_CALL CrackRemoveTimerCallbackRoutine(int hTimer);

        

        


//#############################################################################
//##### Misc. functions #######################################################
//#############################################################################

        

        
//-----------------------------------------------------------------------------

// ##### Start high resolution counter (counts in microseconds) ###############
// Input: n=1...15 number of counter (counter 0 is reserved)
// Return value: 0 if success
// !=0 if failure
CRACK_API int CRACK_CALL CrackResetHighResolutionTimerEx(int n);
//-----------------------------------------------------------------------------

//##### Read time in microseconds since last call #############################
// Note: Must be initialized by call to CrackResetHighResolutionTimerEx before
// Input: n=1...15 number of counter (counter 0 is reserved)
// Return value: delta time since last call in microseconds
CRACK_API DWORD CRACK_CALL CrackReadHighResolutionTimerEx(int n);

        

        


//#############################################################################
//##### TCP/IP functions ######################################################
//#############################################################################
// A demo for using the TCP/IP functions can be found in Server.cpp and
// Client.cpp.
//-----------------------------------------------------------------------------

//##### Status of TCP/IP connections ##########################################
// Status info: TCP/IP server TCP/IP client
// --- PASSIVE not connected to client not connected to server
// --- LISTEN waiting for client not used
// --- ACTIVE connected to client connected to server
typedef enum TCPSTATUS {PASSIVE=0, LISTEN=1, ACTIVE=2} TCPSTATUS;
//-----------------------------------------------------------------------------

//##### Parameter structur for TCP/IP connections #############################
typedef struct
{ SOCKET serverSocket;
SOCKADDR_IN serverInetSocketAddr;
SOCKET clientSocket;
SOCKADDR_IN clientInetSocketAddr;
enum TCPSTATUS tcpStatus;
void (*callbackFcn)(void *params, char *buffer, int numBytesReceived);
void (*infoCallback)(void *params);
} CRACK_TCP_PARAMS;
//-----------------------------------------------------------------------------

//##### Open a TCP/IP client connection #######################################
// Input: hostname as string, e.g. "localhost"
// TCP host port number, e.g. 0x1234
// pointer to a TCP/IP parameter structure
// a callback function, which will be called, when the
// client does receive a TCP/IP message (see below)
// Return value: 0 success
// !=0 failure
// Note: This function will set tcpParams->tcpStatus=ACTIVE, if successfully
// connected to the server.
// Note: If no callback function is used, set it to NULL. You can use
// CrackIsTcpDataAvailable() to query for data and CrackTcpRead() to
// read it.
//
CRACK_API int CRACK_CALL CrackCreateTcpClient(char *hostName, short hostPort, CRACK_TCP_PARAMS *tcpParams,
void (*tcpCallbackFcn)(void *params,char *buffer, int numBytesReceived));
//-----------------------------------------------------------------------------

//##### Create a TCP/IP server ################################################
// Input: TCP host port number to which clients can connect, e.g. 0x1234
// pointer to a TCP/IP parameter structure
// a callback function, which will be called, when the
// server does receive a TCP/IP message (see below)
// a callback function, which will be called, when the
// status of the connection changes (see below).
// Return value: 0 success
// !=0 failure
// Note: This function will set tcpParams->tcpStatus=PASSIVE, as long as the server is waiting for
// a client and switch to tcpParams->tcpStatus=ACTIVE, when a client has connected.
// Note: If no callback function is used, set it to NULL. You can use
// CrackIsTcpDataAvailable() to query for data and CrackTcpRead() to
// read it.
// If no info callback function is used, set it to NULL. You can directly
// check tcpParams->tcpStatus.
//
CRACK_API int CRACK_CALL CrackCreateTcpServer(short hostPort, CRACK_TCP_PARAMS *tcpParams,
void (*tcpCallbackFcn)(void *params,char *buffer, int numBytesReceived),
void (*tcpInfoCallback)(void *params));
//-----------------------------------------------------------------------------

//##### User provided callback function, which will be called, when a TCP/IP message
// is received.
// Input: pointer to TCP/IP parameter structure
// pointer to buffer, which contains the message
// number of data bytes in the buffer
//void tcpCallbackFcn(void *params, char *buffer, int numBytesReceived);
//-----------------------------------------------------------------------------

//##### User provided callback function, which will be called, when the status
// of a TCP/IP server changes
// Input: pointer to TCP/IP parameter structure
//void tcpInfoCallback(void *params);
//-----------------------------------------------------------------------------

//##### Send data in buffer via TCP/IP ########################################
// Input: pointer to a TCP/IP parameter structure
// buffer, containing the data to be sent
// number of bytes in buffer to be send
// Return value: number of bytes, which where sent
CRACK_API int CRACK_CALL CrackSendTcpData(CRACK_TCP_PARAMS* tcpParams, char *buffer, int numBytesToSend);
//-----------------------------------------------------------------------------

//##### Close TCP/IP client ###################################################
// Input: pointer to a TCP/IP parameter structure
// Return value: 0 success
// !=0 failure
// Note: This function will set tcpParams->tcpStatus=PASSIVE.
CRACK_API int CRACK_CALL CrackCloseTcpClient(CRACK_TCP_PARAMS *tcpParams);
//-----------------------------------------------------------------------------

//##### Close TCP/IP server ###################################################
// Input: pointer to a TCP/IP parameter structure
// Return value: 0 success
// !=0 failure
// Note: This function will set tcpParams->tcpStatus=SHUTDOWN
CRACK_API int CRACK_CALL CrackCloseTcpServer(CRACK_TCP_PARAMS *tcpParams);
//-----------------------------------------------------------------------------

//##### Get the IP address of the client, which has connected to the local server
// Input: pointer to a TCP/IP parameter structure
// Return value: IP address as dotted character string, e.g. '192.168.0.4'
// empty string, if no connection is active
CRACK_API char* CRACK_CALL CrackGetClientTcpAddr(CRACK_TCP_PARAMS *tcpParams);
//-----------------------------------------------------------------------------

//##### Read data from TCP/UP connection ######################################
// Input: pointer to a TCP/IP parameter structure
// pointer to buffer, to which the data will be copied
// length of buffer in bytes
// mayBlock=TRUE, if the function shall block until data is available
// mayBlock=FALSE, if the function may not block if no data is available
// Return value: number of bytes received
//Note: This function sets tcpParams->tcpStatus=PASSIVE, when receive fails
CRACK_API int CRACK_CALL CrackTcpRead(CRACK_TCP_PARAMS *tcpParams, char* buffer, int bufferLength, BOOLEAN mayBlock);
//-----------------------------------------------------------------------------

//##### Check if TCP data is available ########################################
// Input: pointer to a TCP/IP parameter structure
// Return value: 0, if no data is available or if not connected
// number of bytes, which are available
CRACK_API int CRACK_CALL CrackIsTcpDataAvailable(CRACK_TCP_PARAMS *tcpParams);


//#############################################################################
//##### 80x86 Low Level Functions #############################################
//#############################################################################
//-----------------------------------------------------------------------------

//##### 80x86 descriptor data structures ######################################
typedef struct
{ BYTE Type:4;
BYTE System:1;
BYTE DPL:2;
BYTE Present:1;
} ACCESSRIGHTS; //Access rights field in segment descriptor

typedef struct
{ BYTE Limit_16_19:4;
BYTE Available:1;
BYTE Reserved:1;
BYTE D_B:1;
BYTE Granularity:1;
} FLAGSLIMIT; //Flags field in segment descriptor

typedef struct
{ WORD Limit_0_15;
WORD Base_0_15;
BYTE Base_16_23;
union
{ BYTE Rights;
ACCESSRIGHTS r;
};
union
{ BYTE Flags;
FLAGSLIMIT f;
};
BYTE Base_24_31;
} SEGDESCRIPTOR; //Segment descriptor

typedef struct
{ WORD Offset_0_15;
WORD Selector;
BYTE Params;
BYTE Rights;
WORD Offset_16_31;
} GATEDESCRIPTOR; //Call gate and interrupt descriptor


        

        
//-----------------------------------------------------------------------------

//##### Get (read) a descriptor entry from the global descriptor table (GDT) ##
// Input: 80x86 selector
// pointer to a SEGDESCRIPTOR (segment descriptor) structure
// Return value: 0 if success
// -1 if failure
// The descriptor will be copied into the structure.
CRACK_API int CRACK_CALL CrackGetGdtDescriptor(WORD selector, SEGDESCRIPTOR *segDescriptor);

        
//-----------------------------------------------------------------------------

//##### Get (read) a descriptor entry from the interrupt descriptor table (IDT)
// Input: interrupt number
// pointer to a GATEDESCRIPTOR (gate descriptor) structure
// Return value: 0 if success
// -1 if failure
// The descriptor will be copied into the structure.
CRACK_API int CRACK_CALL CrackGetIdtDescriptor(DWORD interrupt, GATEDESCRIPTOR *gateDescriptor);

        

        

        
//-----------------------------------------------------------------------------

//##### Read one of the CPU control registers CR0, CR1, CR2, CR3 or EFLAGS ####
// Input: 0, 1, 2, 3 number of control register CR...
// 10 EFLAGS register
// Return value: contents of control or EFLAGS register
CRACK_API DWORD CRACK_CALL CrackGetCRx(int x);
//-----------------------------------------------------------------------------

//##### Write one of the CPU control registers CR0, CR1, CR2, CR3 or EFLAGS ###
// Input: 0, 1, 2, 3 number of control register CR...
// 10 EFLAGS register
// Return value: 0 if success
// -1 if failure
CRACK_API int CRACK_CALL CrackSetCRx(int x, DWORD val);
//-----------------------------------------------------------------------------

//##### Read one of the CPU Machine Specific Registers MSR ####################
// Input: x number of MSR
// *value pointer to array with [0]=low dword, [1]=high dword
// len length (in DWORD)
// Return value: 0 if success
// -1 if failure
CRACK_API int CRACK_CALL CrackGetMSR(int x, DWORD *value, int len);
//-----------------------------------------------------------------------------

//##### Write one of the CPU Machine Specific Registers MSR ####################
// Input: x number of MSR
// *value pointer to array with [0]=low dword, [1]=high dword
//
// Return value: 0 if success
// -1 if failure
CRACK_API int CRACK_CALL CrackSetMSR(int x, DWORD *value);

        
//-----------------------------------------------------------------------------

//##### Copy kernel virtual memory ############################################
// Input: pointer to virtual memory destination
// pointer to virtual memory source
// number of bytes
// Return value: number of bytes which have been copied
//
// Note:This function can copy data between user mode and kernel mode memory.
// However, this function may crash the computer if the memory page is
// not present.
//
CRACK_API int CRACK_CALL CrackKmemcpy(void *dest, void *src, int n);
//-----------------------------------------------------------------------------

//##### Call a user supplied callback function from kernel mode (DPL=0) #######
// Input: pointer to user supplied callback function
// pointer to user supplied input parameter structure
// pointer to user supplied output parameter structure
// Return value: 0 if success
// -1 if failure
//
// The user supplied callback function is prototyped as follows:
// void (*pUserKernelModeCallbackFunction)(void *pInputParams, void *pOutputParams)
// Win32-API and C runtime library functions should not be used in this function!
//
CRACK_API DWORD CRACK_CALL CrackCallKernelModeRoutine(void *pUserKernelModeCallbackFunction ,

void *pInputParams, void *pOutputParams);

        

        
//-----------------------------------------------------------------------------

//##### Get Page Table Entry for a given linear address ########################
// Input: linear address
// Output: page table entry
//Note: If the page is a 4MB page, the page directory entry is read instead.
CRACK_API DWORD CrackGetPageTableEntryForLinearAddress(DWORD linAddress);

        

        

        

        

        

        

        

        

        
Automatically created from file crack.h on 22 Sep. 2007