Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Hardware Access without Driver?Possible? (https://www.delphipraxis.net/144962-hardware-access-without-driver-possible.html)

nanix 20. Dez 2009 22:12


Hardware Access without Driver?Possible?
 
Hello!

I saw Mitec components and it can access direct memory (DMA) , SMBIOS and lots more!
How is this possible? :P

hathor 21. Dez 2009 09:43

Re: Hardware Access without Driver?Possible?
 
MSIC.dll

Delphi-Quellcode:
{*******************************************************}
{                                                       }
{       MiTeC System Information Component             }
{                 MSIC interface                       }
{       version 9.0.0 for Delphi 5,6,7,2005             }
{                                                       }
{       Copyright © 1997,2005 Michal Mutl              }
{                                                       }
{*******************************************************}

unit MSIC_Intf;

interface

uses Windows;

const
  SO_CPU     = $0001;
  SO_Machine = $0002;
  SO_Devices = $0004;
  SO_Display = $0008;
  SO_Network = $0010;
  SO_Media   = $0020;
  SO_Memory  = $0040;
  SO_Storage = $0080;
  SO_USB     = $0100;
  SO_Engines = $0200;
  SO_APM     = $0400;
  SO_Disk    = $0800;
  SO_OS      = $1000;
  SO_Printers = $2000;
  SO_Software = $4000;
  SO_Startup = $8000;
  SO_Processes= $10000;
  SO_Monitor = $20000;


  SO_All = SO_CPU or SO_Machine or SO_Devices or SO_Display or SO_Network or SO_Media or
          SO_Memory or SO_Engines or SO_STORAGE or SO_USB or SO_APM or SO_Disk or SO_OS or
          SO_Printers or SO_Software or SO_Startup or SO_Processes or SO_Monitor;


type
  TShowSystemOverviewModal = procedure; stdcall;
  TGenerateXMLReport = procedure(Topics: DWORD; Filename: PChar); stdcall;

var
  MSIC_DLL: THandle = 0;
  ShowSystemOverviewModal: TShowSystemOverviewModal = nil;
  GenerateXMLReport: TGenerateXMLReport = nil;
const
  MSIC_DLL_Name = 'MSIC.DLL';

implementation

initialization
  MSIC_DLL:=GetModuleHandle(MSIC_DLL_Name);
  if MSIC_DLL=0 then
    MSIC_DLL:=LoadLibrary(MSIC_DLL_Name);
  if MSIC_DLL<>0 then begin
    @ShowSystemOverviewModal:=GetProcAddress(MSIC_DLL,'ShowSystemOverviewModal');
    @GenerateXMLReport:=GetProcAddress(MSIC_DLL,'GenerateXMLReport');
  end;
finalization
  if MSIC_DLL<>0 then
    FreeLibrary(MSIC_DLL);
end.

nanix 21. Dez 2009 09:44

Re: Hardware Access without Driver?Possible?
 
Yes but how does it do it?

MSIC.Dll is for other languages.To get info from the component.

But i was thinking how does it get Ring 0 Access without driver.

himitsu 21. Dez 2009 10:00

Re: Hardware Access without Driver?Possible?
 
MiTeC System Information Components are also available as Delphi DCUs.

nanix 21. Dez 2009 10:02

Re: Hardware Access without Driver?Possible?
 
Yes but i think i have been misunderstood here.And i have source of these components.Anyway the components
use cpu detection for that you need to read registers from CPU.And if you do it in usermode BSOD! :)

JamesTKirk 22. Dez 2009 20:21

Re: Hardware Access without Driver?Possible?
 
Well, I think either they've written a driver in C (the usual way) or they are using the API provided by the NT kernel to usermode (part of them is available from Win32, too, I think) - and yes, the kernel provides much information about the hardware it's running on :mrgreen:

Regards,
Sven

nanix 22. Dez 2009 21:43

Re: Hardware Access without Driver?Possible?
 
Liste der Anhänge anzeigen (Anzahl: 1)
I dont understand why dont you translate Kmdkit4D to lazarus.It works but cant produce X64 sys driver.It already has all functions.

JamesTKirk 23. Dez 2009 09:45

Re: Hardware Access without Driver?Possible?
 
By only using available documentation like MSDN, books about Windows internals and the source code of ReactOS I can be (mostly) sure that my code will be free of copyright problems. The last I'd want for the Free Pascal / Lazarus community is a copyright infringement.

x64 is only a small problem. All I'd need for it is a VM with a 64-bit Windows and some small adjustments inside the compiler. But first I want to test everything on a system I can debug and that is ReactOS which is currently only supports 32-bit. And most important: I first need to fully understand how the NT kernel (including driver development) works.

Regards,
Sven

nanix 23. Dez 2009 17:21

Re: Hardware Access without Driver?Possible?
 
Drivers in delphi are just as good as one written in C.Sorry but its true! :zwinker:

If you have any test things that you want me to test PM me.I got an x64 cpu.

Its not that delphi can't make drivers.It can but its format won't link sys files.Thats we just use a makefile :wink:

JamesTKirk 24. Dez 2009 20:24

Re: Hardware Access without Driver?Possible?
 
Zitat:

Zitat von nanix
Drivers in delphi are just as good as one written in C.Sorry but its true! :zwinker:

I never doubted this. This is the reason I began the port of Free Pascal in the first place.

Zitat:

Zitat von nanix
If you have any test things that you want me to test PM me.I got an x64 cpu.

My current plan is to test this with a x86 QEMU VM. I only need to get a x64 version of a 2003 or XP (as I'm a stundent I'm able to download this legally ;) ). But I might come back to one, once the first tests are successful.

Zitat:

Zitat von nanix
Its not that delphi can't make drivers.It can but its format won't link sys files.Thats we just use a makefile :wink:

This is not the REASON. The format of sys files is not different to that of "normal" Windows executable. The only real differences are the following:
  • The subsystem field is set to PE_SUBSYSTEM_NATIVE (value 1)
  • The file may only link to ntoskrnl.exe and hal.dll (and other drivers like ndis.sys)
  • The checksum needs to be set
  • The entry point must be different

The points 1, 3 and 4 can be done with external tools (my port only needs a tool for point 3), but the second point relies on a modified RTL that uses the correct functions.

You are using a makefile, because it simplifies all these things which force Delphi to produce device drivers. (this "forcing" is not meant in a negative way - don't get me wrong here)

Regards,
Sven


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:21 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz