Delphi-PRAXiS
Seite 2 von 3     12 3      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Comparing functions (https://www.delphipraxis.net/98537-comparing-functions.html)

Razor 5. Nov 2007 07:34

Re: Comparing functions
 
Its a driver for 0 ring access for application,it offers what a hardware driver does... :-D.


I want to use the old functions above in new driver...

Mackhack 5. Nov 2007 07:37

Re: Comparing functions
 
Ok, sounds interesting but I believe the smart guys here that unknowingly tempting with that stuff can cause blue screens :???: and therefore I let those guys mess around with that kind of technology! But keep on going man!!! More power to you!

Razor 5. Nov 2007 07:40

Re: Comparing functions
 
It can couse it yea but if you know how to use it like Muetze1 he knows the stuff like he's here forever.


The finished project will be amd64 x2 Core temp reading with a faster driver and maybe later core 2 duo and quad... :)

Mackhack 5. Nov 2007 07:43

Re: Comparing functions
 
I know Muetze1,

that's why I said before, I let those people work with hardware close apps and drivers since they know what they are doing in this field...

But again,... More power to you and your learning experience!

Razor 5. Nov 2007 07:45

Re: Comparing functions
 
Mackhack if it will work on my system it will also work on yours it wont couse bluescreens on yours and not on mine it just not the way it goes... :)

Mackhack 5. Nov 2007 07:47

Re: Comparing functions
 
You need to read again what I said... I'm not making your project bad nor am I trying to bring you down... I like when people go the trial and error way and learn something!

So stop feeling offended by me! It's all good that's why I was asking what's all about this project!

Razor 5. Nov 2007 07:48

Re: Comparing functions
 
Okay no hard feelings :lol:

Mackhack 5. Nov 2007 07:49

Re: Comparing functions
 
Zitat:

Zitat von Razor
Okay no hard feelings :lol:

Now we're talking :???:

DevidEspenschied 5. Nov 2007 07:54

Re: Comparing functions
 
Zitat:

Zitat von Razor
So why is it there var pdata:cardinal and in the omcdrv.pas its var pdata:dword; dont really really get it; and plus why cant i call that function.... :shock:

Just had a look at your unit.

It seems that Delphi in general (e.g. my Delphi 2007 Pro as well as your version 7) doesn't always update the function parameters for the internal programmer help, which is displayed after entering k.IPCIIORef.

You can be sure that GetPCIRDWord doesn't contain a cardinal value, just a DWord value. If you are confused by the hint of the programmer help, use a DWord variable, compile it and have a look at the bottom messages list. Would the function really need a cardinal variable, there should be a message entry.

Had the same problem here too and Delphi needs sometimes a complete code compilation (sometimes 2 or 3 times) to know, that a variable is a DWord and not a Cardinal. But that must have mean, that a cardinal type was there previously.

To be sure just search the entire unit after a cardinal value - you won't find some. That is the acnowledgement that there isn't one. Hope that helps...

Razor 5. Nov 2007 07:58

Re: Comparing functions
 
As you can see here i was experimenting something and the below looked like is it gonna happen but should i worry about warning?



Delphi-Quellcode:
procedure tmainfrm.amd64x2start;
var
C0:string;
GetInstance:tomcdrv;
pdata: DWord;
begin

       GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
       GetInstance.IPCIIORef.SetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));
       GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
       C0:=Format('%d °C',[(pdata shr 16 and $FF)-49]);
       RzLabel99.caption:=C0;

//But then i get [Warning] Temperatures.inc(117): Variable 'GetInstance' might not have been initialized
Or.....


Delphi-Quellcode:
procedure tmainfrm.amd64x2start;
var
C0:string;

pdata: DWord;
begin

       OMCDRV.tGetPCIRDWord(0,24,$03,$E4,pdata);
       OMCDRV.tSetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));
       OMCDRV.tGetPCIRDWord(0,24,$03,$E4,pdata);
       C0:=Format('%d °C',[(pdata shr 16 and $FF)-49]);
       RzLabel99.caption:=C0;

//But then i get [Fatal Error]Internal error: BA1993 or [Fatal Error] Internal error: L1333

DevidEspenschied 5. Nov 2007 08:10

Re: Comparing functions
 
Zitat:

Zitat von Razor
As you can see here i was experimenting something and the below looked like is it gonna happen but should i worry about warning?

Delphi-Quellcode:
procedure tmainfrm.amd64x2start;
var
C0:string;
GetInstance:tomcdrv;
pdata: DWord;
begin

       GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
       GetInstance.IPCIIORef.SetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));
       GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
       C0:=Format('%d °C',[(pdata shr 16 and $FF)-49]);
       RzLabel99.caption:=C0;

//But then i get [Warning] Temperatures.inc(117): Variable 'GetInstance' might not have been initialized

Thats because TOMCDrv is a class with an initialization routine, which has to be run first. Begin this procedure with GetInstance.Create()

Zitat:

Zitat von Razor
Delphi-Quellcode:
procedure tmainfrm.amd64x2start;
var
C0:string;

pdata: DWord;
begin

       OMCDRV.tGetPCIRDWord(0,24,$03,$E4,pdata);
       OMCDRV.tSetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));
       OMCDRV.tGetPCIRDWord(0,24,$03,$E4,pdata);
       C0:=Format('%d °C',[(pdata shr 16 and $FF)-49]);
       RzLabel99.caption:=C0;

//But then i get [Fatal Error]Internal error: BA1993 or [Fatal Error] Internal error: L1333

I've never had that kind of error and the documentation doesn't provide any info.

But why don't you create a large class and add there all functions for port reading, msr reading and so on ? Your unit contains a lot of double functions, e.g. 4 or 5 times the readportbyte function. That could be combined into one class to avoid those kind of error messages.

Razor 5. Nov 2007 08:11

Re: Comparing functions
 
Okay i will post the thing i am working on as we speak.. :)

Razor 5. Nov 2007 08:20

Re: Comparing functions
 
Okay done i get result -49 C but i dont have AMD so yea...

DevidEspenschied 5. Nov 2007 08:23

Re: Comparing functions
 
Let me test this project on my Athlon64 and I will get back to you later today.

Razor 5. Nov 2007 08:49

Re: Comparing functions
 
Okay the new version with the omc driver so yea go ahead and test it.If you find a bug report back... :zwinker:

[edit=Phoenix]Anhang wg. Copyright entfernt. Mfg, Phoenix[/edit]

Muetze1 5. Nov 2007 12:56

Re: Comparing functions
 
Zitat:

Zitat von devidespe
Had the same problem here too and Delphi needs sometimes a complete code compilation (sometimes 2 or 3 times) to know, that a variable is a DWord and not a Cardinal. But that must have mean, that a cardinal type was there previously.

It is a complete normal behaviour, known - at least - since D3. Delphi extends all size-specific to the actual (compiler size) generic types. So LongInt will be shown as Integer, LongWord as Cardinal, etc. The data types are equal for the actual compiler (32 Bit Compiler), so don't care.

Razor 5. Nov 2007 18:05

Re: Comparing functions
 
Did anybody test this :shock:

mkinzler 5. Nov 2007 18:24

Re: Comparing functions
 
It doesn't work on Vista 64Bit

Razor 5. Nov 2007 18:27

Re: Comparing functions
 
Hmm driver is 64 bit compliant can you try to look in the code? :?

mkinzler 5. Nov 2007 18:34

Re: Comparing functions
 
I ain't a problem of lack of 64bit capability. The programm isn't able to load the IO-driver.

Razor 5. Nov 2007 19:25

Re: Comparing functions
 
But can you fix it? :)

mkinzler 5. Nov 2007 19:28

Re: Comparing functions
 
I guess it's acase of the new driver model

Razor 5. Nov 2007 19:29

Re: Comparing functions
 
Driver source is included?

[edit=Phoenix]Anhang wg. Copyright gelöscht. Mfg, Phoenix[/edit]

Razor 5. Nov 2007 20:53

Re: Comparing functions
 
Sorry for DP but nobody knows how to?


Delphi-Quellcode:
var
  isLoadDr: boolean;


procedure TMainFrm.FormCreate(Sender: TObject);
begin
   isLoadDr := GetInstance.LoadDriver;
  if not isLoadDr then MessageBox(form1.Handle,'Couldn''t Start I/O Driver! Some features will be disabled!', 'Couldn''t Start I/O Driver!', MB_ICONINFORMATION);


end;
So whats wrong with this code

Razor 6. Nov 2007 08:27

Re: Comparing functions
 
:wall: Bump..

Razor 6. Nov 2007 19:23

Re: Comparing functions
 
Bump...can someone try this and report so i know what to fix for god sakes! :shock:

DevidEspenschied 6. Nov 2007 22:08

Re: Comparing functions
 
I'll do it tomorrow, haven't the time yet.

DevidEspenschied 7. Nov 2007 10:44

Re: Comparing functions
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hello,

after the program start on a AMD Athlon 64 3400+ I get the dialog which is attached to this post.

I can't compile and debug the program, because I haven't the component TcxCpu40 installed and a Google search for it was resultless.

Razor 7. Nov 2007 11:55

Re: Comparing functions
 
Okay sorry for going mad but i thought you arent gonna test :).

I will include ALL components!!


Salute!

[edit=Phoenix]Anhang wg. Copyright gelöscht. Mfg, Phoenix[/edit]

Razor 7. Nov 2007 19:49

Re: Comparing functions
 
Bump.... :(

Muetze1 7. Nov 2007 22:46

Re: Comparing functions
 
Will you ever try to follow the rules? Will you ever learn the rules about pushing within 24 hours? Will you ever ...?

Jelly 7. Nov 2007 22:53

Re: Comparing functions
 
Razor...
stop pushing. You have already been told several times, even via ICQ. This is not the way we follow here in DP.

DevidEspenschied 8. Nov 2007 09:43

Re: Comparing functions
 
I wanted to test your package again but having serious problems with the installation of TcxCPU40 within Delphi 2007.

I load the DPK package and want to install it via the Project Management, but it can't compile and needs the file cxCPU40NVReg.dcr. Currently I'm having only the cxCPU40NVReg.pas and cxCPU40NVReg.dcu files.

Any idea why the package needs a dcr file ?

Because the package is from 2004, maybe there are some compatibility problems in combination with my Delphi 2007...

Muetze1 8. Nov 2007 09:57

Re: Comparing functions
 
The DCR ist only the Picture of the component for the component palette. Remove the resource-compiler-instruction {$R *.res} from the package and install it.

DevidEspenschied 8. Nov 2007 11:16

Re: Comparing functions
 
Wow, that was tricky.

Some things to notice. First of all, if you declare a procedure with the name amd64x2, it is better to call it. So the correct FormCreate procedure would be:

Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
  isLoadDr := GetInstance.LoadDriver;
  if not isLoadDr then MessageBox(form1.Handle,'Couldn''t Start I/O Driver! Some features will be disabled!', 'Couldn''t Start I/O Driver!', MB_ICONINFORMATION)
  else amd64x2;
end;
The next thing is within amd64x2, where you have the following if line:

Delphi-Quellcode:
cxCpu401.Available.Available=2
According to the TcxCPU40 component this line checks, if there is more then one physical core. But that is not correct, because my AMD Athlon 64 +3400 does have only one core (here the value 1) and that core provides internal temperature readings via #THERMPRIP. So the line should be updated to:

Delphi-Quellcode:
cxCpu401.Available.Available IN [1..2]
And the last, but most catastrophically thing, is the exception, which is generated with the line:

Delphi-Quellcode:
GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
within TForm1.Timer1Timer. And I doesn't have the time to check this within the OMCDrv unit, because there are so many types, classes and structurtes. I would suggest, you manipulate this program somehow to read a basic PC port, such as the parallel port ($378) or the CMOS port ($70) to make sure, that your core reading routine works fine. The results from these port readings could be shown via the ShowMessage function, and compared with a simple DOS reading. Herefore you could create a simple DOS application like:

Delphi-Quellcode:
program dosporttest;
uses crt, dos;
begin
  clrscr;
  writeln(port[$378]);
  writeln(port[$70]);
  readln;
end.
At least that is always my way to verify a windows based hardware near function.

Muetze1 8. Nov 2007 13:15

Re: Comparing functions
 
Zitat:

Zitat von devidespe
Herefore you could create a simple DOS application like:

Delphi-Quellcode:
program dosporttest;
uses crt, dos;
begin
  clrscr;
  writeln(port[$378]);
  writeln(port[$70]);
  readln;
end.
At least that is always my way to verify a windows based hardware near function.

Only possible if you are using a 16 bit compiler system like turbo pascal. (or - with changes in code - 32 bit windows app unter Win9x)

Razor 8. Nov 2007 13:16

Re: Comparing functions
 
Yes....any other suggestions to for testing i/o ports... :gruebel:

Razor 8. Nov 2007 13:21

Re: Comparing functions
 
Okay finally something good from me!:D Found a delphi port tester program with source

http://www.wideman-one.com/gw/tech/D...m/PortTest.htm


I fixed the stuff and i get 209 C so i think the thing must be working..

Reply please...

Razor 8. Nov 2007 14:34

Re: Comparing functions
 
I did it HAHA :mrgreen: :lol:

http://img215.imageshack.us/img215/8...reenie4ob3.jpg friend ran it with with AMD 64 3000+ Just look at it rofl.It changes...


Hahaahh i did it!

DevidEspenschied 8. Nov 2007 14:40

Re: Comparing functions
 
Congratulations.

Is it possible to tell us something about your future application ? What does it do ? Will it be available as freeware or source ?

Thanks, Devud


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:52 Uhr.
Seite 2 von 3     12 3      

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