Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi openlibsys.org Open source driver (https://www.delphipraxis.net/113252-openlibsys-org-open-source-driver.html)

Razor 5. Mai 2008 11:25


openlibsys.org Open source driver
 
I found the driver! http://openlibsys.org/

-Supports all the things i want...
-Supports delphi wich is nice! :lol:

mkinzler 5. Mai 2008 11:33

Re: openlibsys.org Open source driver
 
A driver for what?

Muetze1 5. Mai 2008 15:25

Re: openlibsys.org Open source driver
 
For his CPU detection, temperature, GPU, I2C, bla blubb tool. Just collect all his threads and combine the questions and you will find the answer.

mkinzler 5. Mai 2008 15:43

Re: openlibsys.org Open source driver
 
But it would be nice from him to describes it, if he put a link in this forum

Razor 5. Mai 2008 18:23

Re: openlibsys.org Open source driver
 
Muetze why are you mean,i just don't get it.I put it on this forum in sense that other people achive the same thing if they need it.And yes in some days i'll combine everything and post it as one topic while moderators can delete those topics.Just that you can be happy! :zwinker:

I don't see such project for delphi atleast that Gpu tool for Nvidia by turboPASCAL.Here it ends.




And no Muetze not for CPU Detection..I think you have a bit more knowledge in this case..I won't argue with you couse we all know that you aren't an easy person that just dosen't like to help.





As for the driver

-What is it>
WinRing0 is a hardware access library for Windows.
WinRing0 provides your application to access I/O port, MSR, PCI bus, and etc...


-Manual
http://openlibsys.org/manual/

mkinzler 5. Mai 2008 18:27

Re: openlibsys.org Open source driver
 
Muetze1's answer adressing me not you

Razor 5. Mai 2008 18:31

Re: openlibsys.org Open source driver
 
I had to say it once it for all.I had enough..

Muetze1 5. Mai 2008 19:39

Re: openlibsys.org Open source driver
 
Zitat:

Zitat von Razor
Muetze why are you mean,...

That should not be meant mean, it was just some hint, because your threads should be well known here, so I was wondering about the question. You will do your thing and I am proud to see, that you learned some things and even the basics (the biggest problem some times before), so I am anxious to see your next threads and questions. So, keep up and do your project...

Razor 5. Mai 2008 19:58

Re: openlibsys.org Open source driver
 
The problem was the driver all in all,since delphi isnt notorious for making drivers i seeked outside for some.
And i face a new problem X64 Vista Driver signing...

The solution..Wich i am going to use.

One of the more annoying components in Vista x64 is the need for signed drivers. This hinders the use of many freeware applications out there (even though they come with an x64 driver) just because the driver isn’t digitally signed. About a month ago I ran into a piece of software I had to use, but alas, no signed drivers. So I set out on a quest to figure out how to permanently disable the driver signing checks in Vista x64. And guess what? I found it :).

Here’s how to get it done:

Open an elevated command prompt
type “bcdedit /set loadoptions DDISABLE_INTEGRITY_CHECKS” without the quotes (and no the DD is not a typo).
Reboot and enjoy being able to use unsigned drivers in Vista x64.
Remember who told you about this first ;).

Voila! :P

Razor 5. Mai 2008 23:32

Re: openlibsys.org Open source driver
 
I made this but it dosen't seem to work....I bet i forgot something,some stupid mistake or i forgot to put in the params.

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure koki;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
const
  RING0     = 'WinRing0x64.DLL';

var
  Form1: TForm1;
  RING0: THandle;


implementation

{$R *.dfm}


procedure tform1.koki;
VAR
ho: AnsiString;

begin
ho := ExtractFilePath(application.ExeName) + 'WinRing0x64.DLL';



  if FileExists(ho) then
  begin
RING0 := LoadLibrary(PChar(Pfad));
if RING0 > 0 then
  showmessage('loaded');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
koki;
end;
end.

Muetze1 5. Mai 2008 23:47

Re: openlibsys.org Open source driver
 
Zitat:

Zitat von Razor
Delphi-Quellcode:
  ho := ExtractFilePath(application.ExeName) + 'WinRing0x64.DLL';

  if FileExists(ho) then
  begin
    RING0 := LoadLibrary(PChar(Pfad));   // build "ho" and use "Pfad"? Copy&Paste error

    if RING0 > 0 then                    // why > 0?  see MSDN documentation: it states != NULL
      showmessage('loaded');
  end;
end;

Be more accurate on the basics! This is fundamental for such applications as you want to build...

Razor 6. Mai 2008 07:50

Re: openlibsys.org Open source driver
 
Here we this more alike :) .Works!

Delphi-Quellcode:
Const
ring: THandle;

procedure tform1.Load;
VAR
Pfad: AnsiString;

begin
Pfad := ExtractFilePath(application.ExeName) + 'WinRing0x64.DLL';


if FileExists(Pfad) then
begin

form1.Color:=clgreen;

ring := LoadLibrary(PChar(Pfad));

if ring = 0 then

showmessage('loaded');

end;
end;


Now for the functions,this is wrong i know,but if it says it has no params and return value then i thought why not but this wont work.I have clearly no idea how to call how to call a function off an dll. :oops:
Delphi-Quellcode:
type
  TInitializeDll = function(InitializeDll) stdcall;
From the manual

Zitat:

InitializeDll
This function initializes the DLL.

Syntax
VOID InitializeDll();Parameters
None
Return Values
None

Remarks
This function must be called before using any other function in the DLL.

Requirements
WinRing0 1.0.6 or later



Zitat:

bool InitWinRing0()
{
InitializeDll();

DWORD status = GetDllStatus();

switch (status)
{
case 1:
MessageBox(NULL, L"WinRing0 Unsupported platform", L"WinRing0 Error!", MB_OK);
return false;
case 2:
MessageBox(NULL, L"WinRing0 Driver not loaded", L"WinRing0 Error!", MB_OK);
return false;
case 3:
MessageBox(NULL, L"WinRing0 Driver not found", L"WinRing0 Error!", MB_OK);
return false;
case 4:
MessageBox(NULL, L"WinRing0 Driver unloaded by other process", L"WinRing0 Error!", MB_OK);
return false;
case 5:
MessageBox(NULL, L"WinRing0 Driver not loaded because of executing on Network Drive", L"WinRing0 Error!", MB_OK);
return false;
case 6:
MessageBox(NULL, L"WinRing0 Unknown error", L"WinRing0 Error!", MB_OK);
return false;
}

return true;
}

Muetze1 6. Mai 2008 08:48

Re: openlibsys.org Open source driver
 
I am frightened, that you have not learned some basics. Learn the basics!

What is the difference between function and procedure? If there is none, we do not need two identifiers in the Delphi language...

Razor 6. Mai 2008 09:01

Re: openlibsys.org Open source driver
 
Ofcourse theres a difrence
Delphi-Quellcode:
var
  Form1: TForm1;
  ring: THandle;


implementation

{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
load;
end;

procedure tform1.Load;
VAR
Pfad: AnsiString;

  Intalize: procedure(InitializeDll: Pointer); stdcall;
begin
Pfad := ExtractFilePath(application.ExeName) + 'WinRing0x64.DLL';


if FileExists(Pfad) then
begin

form1.Color:=clgreen;

ring := LoadLibrary(PChar(Pfad));

if ring = 0 then
Intalize:= GetProcAddress(ring,'InitializeDll');
if Assigned(Intalize) then
showmessage('intalized');
showmessage('loaded');

end;
end;
Like this?

Assertor 6. Mai 2008 09:45

Re: openlibsys.org Open source driver
 
Hi Razor,

Zitat:

Zitat von Razor
Remember who told you about this first ;).

Yes: I told the bcdedit fixes availability first :? See thread here. By the way: I wrote about bcdedit in November 2006...

Zitat:

Zitat von Razor
type “bcdedit /set loadoptions DDISABLE_INTEGRITY_CHECKS” without the quotes (and no the DD is not a typo).
Reboot and enjoy being able to use unsigned drivers in Vista x64.

And just for your interest: AFAIK has Microsoft released an security update (released long time before Vista SP1) disabling the possibility to circumvent this protection in x64...

So, no go for your x64 Driver without Digital Signature or F8 on boot...

Cheers Assertor

devidespe 6. Mai 2008 09:52

Re: openlibsys.org Open source driver
 
As far as I know does the driver within WinRing0 have a Verisign certification and is runable under Vista x64 even without the BCDEdit option.

That option was originally a way for developers to test their X64 drivers, as long as the Verisign certification process is running.

Muetze1 6. Mai 2008 10:03

Re: openlibsys.org Open source driver
 
Zitat:

Zitat von Razor
Like this?

Does it work as aspected?

What about all the warnings and hints of your source? Why do you access the global Form1 variable in a method of TForm1? What about a basic source code formating?

Razor 6. Mai 2008 10:08

Re: openlibsys.org Open source driver
 
This what ive done so far,error comes up i uploaded the image..

http://img504.imageshack.us/img504/3955/captureke1.jpg

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure load;
    procedure Button1Click(Sender: TObject);

     
  private
    { Private declarations }
  public
    { Public declarations }

  end;




var
  Form1: TForm1;
  ring: THandle;
   procedure InitializeDll(); stdcall; external 'WinRing0x64.dll';
 
implementation

{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
load;
end;


procedure tform1.Load;
VAR
  Pfad: AnsiString;
begin
Pfad := ExtractFilePath(application.ExeName) + 'WinRing0x64.dll';


if FileExists(Pfad) then
begin


ring := LoadLibrary(PChar(Pfad));

if ring = 0 then
form1.Color:=clgreen;
 showmessage('loaded');
  end;
 InitializeDll();
end;

end.

Muetze1 6. Mai 2008 12:00

Re: openlibsys.org Open source driver
 
So the imports of the WinRing0x64.dll could not be resolved by the module loader.

devidespe 6. Mai 2008 12:44

Re: openlibsys.org Open source driver
 
Set a debug breakpoint before the line:

Delphi-Quellcode:
ring := LoadLibrary(PChar(Pfad));
and check the content of the Pfad variable. Maybe some backslash is missing.

Muetze1 6. Mai 2008 13:20

Re: openlibsys.org Open source driver
 
Zitat:

Zitat von devidespe
Set a debug breakpoint before the line:

Delphi-Quellcode:
ring := LoadLibrary(PChar(Pfad));
and check the content of the Pfad variable. Maybe some backslash is missing.

This can't happen, because FileExists() would fail in that case...

The DLL references some other DLLs that can not be found or exports in that DLLs could not be found.

FAlter 6. Mai 2008 13:26

Re: openlibsys.org Open source driver
 
Hi,

why loading the DLL with LoadLibrary when using start-time linking in this line?

Delphi-Quellcode:
procedure InitializeDll(); stdcall; external 'WinRing0x64.dll';
Mfg
FAlter

Razor 6. Mai 2008 18:58

Re: openlibsys.org Open source driver
 
Static loading trouble only dynamic loading will probably solve this but i have no IDEA how to do it! :?



Delphi-Quellcode:
 procedure InitializeDll(); stdcall; external 'WinRing0.dll';

This one works 100% But as i have vista x64 then its no good.

Razor 6. Mai 2008 19:33

Re: openlibsys.org Open source driver
 
Liste der Anhänge anzeigen (Anzahl: 1)
I did it for AMD core reading...

However it needs testing so people with AMD 64 K7 cpus.

People please test! :-D

Needs translation!

Delphi-Quellcode:
void ReadTemp(HWND hWnd)
{
   DWORD eax, edx;

   RdmsrEx(0x19C, &eax, &edx, 1);

   eax &= 0x007F0000;
   eax = eax >> 16;

   SetDlgItemInt(hWnd, IDC_STATIC1, -(int)eax, TRUE);

   RdmsrEx(0x19C, &eax, &edx, 1 << 1);

   eax &= 0x007F0000;
   eax = eax >> 16;

   SetDlgItemInt(hWnd, IDC_STATIC2, -(int)eax, TRUE);

   if(numCPU == 4){
      RdmsrEx(0x19C, &eax, &edx, 1 << 2);

      eax &= 0x007F0000;
      eax = eax >> 16;

      SetDlgItemInt(hWnd, IDC_STATIC3, -(int)eax, TRUE);

      RdmsrEx(0x19C, &eax, &edx, 1 << 3);

      eax &= 0x007F0000;
      eax = eax >> 16;

      SetDlgItemInt(hWnd, IDC_STATIC4, -(int)eax, TRUE);
   }
}

Razor 7. Mai 2008 12:06

Re: openlibsys.org Open source driver
 
Zero comments and 2 downloads thats pathetic! :pale:

Muetze1 7. Mai 2008 12:10

Re: openlibsys.org Open source driver
 
What you want? I have no AMD CPU and I tried it on my old K6-2, but it does not work (as expected). So whats your problem?

Razor 7. Mai 2008 12:11

Re: openlibsys.org Open source driver
 
No it works good the author of Core temp tested it on his X2.He says its quite good.

But Muetze what about the Intel core reading?The c++ code above.

Phoenix 7. Mai 2008 12:16

Re: openlibsys.org Open source driver
 
Zitat:

Zitat von Razor
This what ive done so far,error comes up i uploaded the image..
Delphi-Quellcode:
   procedure InitializeDll(); stdcall; external 'WinRing0x64.dll';

:wall:

1.) Please attach images directly to your posts and do not link to external images. That would brake the post if the external source vanishes.

2.) WinRing0x64.dll seems to be a dll for 64 bit systems.
You DO know that you can't load (or even execute) 64bit code in 32bit processes?

As long as CodeGear does not support a 64bit compiler (which will be somewhere at the end of 2009 telling from the current roadmap) you simply can't work with that 64bit dll in Delphi...

Razor 7. Mai 2008 12:18

Re: openlibsys.org Open source driver
 
Thanks Phoenix for the clearing stuff out,i didn't know that...No really thanks.
I will upload images via DP uploading system.. :)

Razor 7. Mai 2008 18:21

Re: openlibsys.org Open source driver
 
Liste der Anhänge anzeigen (Anzahl: 1)
After running this delphi 2007 starts acting weird its creating and exiting threads like nuts...
A picture bellow..


And then it wont even show the temperature I am starting to get left out and boored. :roll:

Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
VAR
EAX,EDX:DWORD;
Temperature ,delta,maxcores,x,TJunction:integer;

begin
InitializeDll();
cxCpu401.Available.Available:=maxcores;

Rdmsr($00EE,EAX,EDX);
IF EAX and $40000000 = 0 then TJunction := 100 Else TJunction := 85;
form1.Caption:=inttostr(TJunction);


For X := 1 to MaxCores do
Begin
Delta := TJunction;
SetThreadAffinty(X) ;// makes that the function now runs on core X //this<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
Rdmsr($019,EAX,EDX);
If HiWord(EAX) and $8000 > 0 then
Delta := HiWord(EAX) and $7F; // Delta-value from the temperature for reading TJunction
Temperature := TJunction-Delta;
End;

himitsu 7. Mai 2008 18:36

Re: openlibsys.org Open source driver
 
where is MaxCores initialized/defined?

Razor 7. Mai 2008 18:38

Re: openlibsys.org Open source driver
 
Liste der Anhänge anzeigen (Anzahl: 1)
this dosent matter now first we need to make it working for 1 core then threads and multithreading comes in hand...got it?
Should i upload the driver so you can test it?
Delphi-Quellcode:
 procedure InitializeDll(); stdcall; external 'WinRing0.dll';
  procedure DeinitializeDll(); stdcall; external 'WinRing0.dll';
  function Rdmsr(index:DWORD;eax:DWORD;edx:DWORD): DWord; stdcall; external 'WinRing0.dll';


Zitat:

Rdmsr
This function executes "RDMSR" (Opcode : 0F 32) instruction.

"RDMSR" : Loads the contents of a 64-bit model specific register (MSR) specified in an index register into registers EDX:EAX.

Syntax
BOOL Rdmsr(
DWORD index,
PDWORD eax,
PDWORD edx
);Parameters
index
[in] MSR index
eax
[out] value of EAX register (bit 31- 0)
edx
[out] value of EDX register (bit 63-32)
Return Values
If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE.

Remarks
You can check whether "RDMSR" instruction is supported on your system with IsMsr.

Razor 7. Mai 2008 19:37

Re: openlibsys.org Open source driver
 
Well i think i solved it...

Works well i tested with MSR Editor,

i read the MSR address 0x19C and got this

0x88340000 for MSR (31-0)

now the 5th and the 6th charters show that its 34 you take that to calculator qword and convert to dec.

We get 52 wich is the delta.

Temperature =Tjunction -Delta

Temperature = 100 (Q6600) -52 = 48 C << Wich is exactly what speed fan is showing..


I did it but what about the above code why it wont work..Can some really really check... :-D

Razor 8. Mai 2008 13:41

Re: openlibsys.org Open source driver
 
Alright i know its a bump or however you guys call it if its still no answers i leave DP once and for all,it just isnt a right way anymore i saw XY threads being replyed all the time. :wall:

Muetze1 8. Mai 2008 13:53

Re: openlibsys.org Open source driver
 
Zitat:

Zitat von Razor
Alright i know its a bump or however you guys call it if its still no answers i leave DP once and for all,it just isnt a right way anymore i saw XY threads being replyed all the time. :wall:

You can't be serious - you are joking, or?

What do you expect? This is not a all-day problem and most of the users here are beginners and intermediate with no experiences in such hardware relative things.

What about your DLL loading problem? This is more common and you got answers in minutes...

Razor 8. Mai 2008 13:57

Re: openlibsys.org Open source driver
 
This Loading of dll is solved voila gone!
The only thing is this code


Problem code look at it muetze atleast now.

What i think its the problem well the label2.Caption:=IntTostr(Delta);
becouse author of Core Temp said that it can be writting in 1 hour if you have a driver

Zitat:

David says:
maybe couse i convert the dword to integer?
Arthur says:
most likely
Arthur says:
I told you no integers...

Delphi-Quellcode:
procedure InitializeDll(); stdcall; external 'WinRing0.dll';
procedure DeinitializeDll(); stdcall; external 'WinRing0.dll';
function Rdmsr(index:DWORD;eax:dWORD;edx:DWORD): DWord; stdcall; external 'WinRing0.dll';

var
EAX,EDX:DWORD;
delta:dword;
TJunction:integer;
begin
Rdmsr($019C,EAX,EDX);
If HiWord(EAX) and $8000 > 0 then
Delta := hiWord(EAX) and $7F;

label2.Caption:=IntTostr(Delta);

Razor 8. Mai 2008 15:43

Re: openlibsys.org Open source driver
 
Liste der Anhänge anzeigen (Anzahl: 1)
Alright i made SOMETHING big! :lol:

http://img369.imageshack.us/img369/5783/capturequ1.jpg

No comments now i hope just muetze1 can verify this and make any adjustments for it,so many programers here and i am the first one to do it :shock:

Razor 9. Mai 2008 09:56

Re: openlibsys.org Open source driver
 
And completed!

http://img233.imageshack.us/img233/6131/capturerg6.jpg

As for the threads how can we make em ive already searched google and DP alot on this issue however i still dont know how to..

Razor 11. Mai 2008 21:45

Re: openlibsys.org Open source driver
 
I also figured out the Amd K10 internal temperature reading.So far i got k7,k8,intelcore and k10 muahahahaha! :lol: 8)

timurlenk 14. Aug 2009 13:14

Re: openlibsys.org Open source driver
 
hi can someone please tell me where i can get examples of winring0 dll usage..
in winring site there are no real examples for it just a little about dll functions

----

hi kann mir jemand sagen wo ich beispiele für winring0 dll bekomme in der winring seite gibts keine echten
beispiele nur ne liste was für dll funkionen die dll hat..


is zwar ein alter thread aber habs ers eben gesehen :D


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:46 Uhr.

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