Real Time Module For Windows XP - CodeProject
Real Time Module For Windows XP - CodeProject
Not quite what you are looking for? You may want to try: ×
Bypassing Windows XP Logon Password using bootkit
Designing Asynchronous Processing Using COM+ Queued Services
highlights off
Home Articles Questions & Answers Learning Zones Features Help! The Lounge Real-Time module windows XP
This article presents the Hadcon's real time module for Windows 7/XP
Article Browse Code Stats Revisions (4) 2.98 (21 votes) 32 Sponsored Links
See Also...
XFxDetect - A utility to detect which
versions of .Net are installed
XFxDetect inspects registry and file
system of...
Http Monitor for Webbrowser
Control
The ATL COM DLL that captures
requests from...
A Type-safe Generic Pointer
A safer alternative to void*, any_ptr
Introduction can...
Suppress Flickering Scrollbars in
For a variety of business and technical reasons, Microsoft Windows Vista, XP/2000 operating systems Autosizing CListCtrl
are increasingly being considered as a platform for deployment of real-time systems. The reasons How to avoid flickering scrollbars
include: that appear...
1. The many applications available on the platform AI for Target Number Game Using
2. The variety of development tools available on the platform Genetic Algorithm
3. The richness of the Microsoft Win32 application programming interface (API) Implementing AI for Target Number
4. The large number of developers, support personnel, and end users who are familiar with the Game using a...
system
The Hadcon's real time module (RTM) has been developed to bring "hard " real time capabilities (such Announcements
as creation of timers, system thread, of management by resources – memory, ports, interrupts) to
Windows, excepting necessity of creating of the driver.
http://www.codeproject.com/KB/system/RealTimeModule.aspx[03/04/2011 21:32:26]
Real Time Module for Windows 7/XP - CodeProject
RTM uses the "mixed" code i.e. timer's, interrupt's routines (working in Ring 0) and user routines
(working in Ring 3) are incorporated in one DLL module.
Real-time components (timer, system thread and interrupt routines) must be locked in memory to
avoid latencies due to page faults. Therefore RTM defines its own sections for location of a code, data
and stack using the data_seg , code_seg , and bss_seg pragmas.
Timers
RTM uses the system timer.The system timer generates system ticks at a fixed rate of one tick per
millisecond(or 100, 200 ,500 microsecond), which is the rate at which a timer interrupt is generated
and serviced by the operating system (interrupt service routine ISR).
RTmCreateTimer function lets you attach a handling routine to an timer interrupt, much the same
way that the RTM timer routines allow you to associate a handling routine with a given timer expiration.
RTM timers are not synchronization objects which means threads cannot wait for single objects with an
RTM timer handle.
This is in contrast to the Windows waitable timer, which is an object on which a thread can wait, or
against which a thread can receive notification.
http://www.codeproject.com/KB/system/RealTimeModule.aspx[03/04/2011 21:32:26]
Real Time Module for Windows 7/XP - CodeProject
Example Code
Using Threads
The RtmCreateThread function creates a system thread (See: PsCreateSystemThread in the
DDK for Windows XP/2000).
You can set the priority value for the specified thread using KeSetPriorityThread and
KeSetBasePriorityThread functions.
Inside of the body thread function, we can use majority DDK functions.
RTM thread defines own sections for location of a code.
Example Code
http://www.codeproject.com/KB/system/RealTimeModule.aspx[03/04/2011 21:32:26]
Real Time Module for Windows 7/XP - CodeProject
0,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_WRITE,
FILE_OPEN_IF,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL,
0 );
if(NT_SUCCESS(status))
{
ZwWriteFile(FileHandle,
NULL,
NULL,
NULL,
&IoStatus,
(void *)addr,
nsize,
NULL,
NULL );
ZwClose(FileHandle);
DbgPrint ("Close file");
}
if(fileName1.Buffer)
ExFreePool(fileName1.Buffer);
}
int systhread(void *param)
{
unsigned int _cr3 = 0;
PVOID pv;
PHYSICAL_ADDRESS pf;
n_count_task++;
if(n_count_task == 10)
{
_asm mov eax,cr3
_asm mov _cr3,eax
pf.HighPart = 0;
pf.LowPart = _cr3;
pv = MmGetVirtualForPhysical (pf);
writetofile(L"\\??\\C:\\tmp\\qqq1",(UINT)pv ,0x1000);
}
return 0;
}
#pragma code_seg()
void func()
{
int error;
HANDLE tm;
HANDLE th;
if(RtmInit(hRTMDLL,KERNEL_MODE) == -1) return 0;
th = RtmCreateThread(hRTMDLL ,(THREAD_START_ROUTINE)systhread,NULL);
}
Interrupts
RTM allows a process to directly interface with a device without having to write a Windows driver via
RtmConnectInterrupt or RtmHookInterrupt functions. A process can attach to an interrupt
handler using RtmConnectInterrupt function (See: HalGetInterruptVector in the DDK for
Windows XP/2000).
The RtmHookInterrupt function allows to hook an interrupt.
Example Code
http://www.codeproject.com/KB/system/RealTimeModule.aspx[03/04/2011 21:32:26]
Real Time Module for Windows 7/XP - CodeProject
E-mail: [email protected]
URL: http://www.hadcon.ru
License
This article, along with any associated source code and files, is licensed under The Code Project Open
License (CPOL)
Russian Federation
Member
visual studio 2005 LNK1104 LIBC.LIB not found devCoder 3:43 30 May '09
demo does not work-and missing function exporting from dll devCoder 23:26 30 May '09
http://www.codeproject.com/KB/system/RealTimeModule.aspx[03/04/2011 21:32:26]
Real Time Module for Windows 7/XP - CodeProject
Last Visit: 19:00 31 Dec '99 Last Update: 15:30 3 Apr '11 1 2 Next »
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.
http://www.codeproject.com/KB/system/RealTimeModule.aspx[03/04/2011 21:32:26]