Delphi-PRAXiS
Seite 3 von 4     123 4      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Gigabyte dll functions (https://www.delphipraxis.net/97485-gigabyte-dll-functions.html)

Olli 23. Aug 2007 02:26

Re: Gigabyte dll functions
 
Maybe start up a disassembler and investigate on your own? How about IDA 4.3 Freeware?

Razor 23. Aug 2007 17:25

Re: Gigabyte dll functions
 
Well i wouldnt know even where to start,all i found is this but what does this mean?Does it contain any parameters,well i doubt so.

Zitat:

public LX_IsQDIMainBoard
LX_IsQDIMainBoard proc near
or eax, 0FFFFFFFFh ; LX_IsMSIMainBoard
retn
LX_IsQDIMainBoard endp

Can someone translate this?To delphi..

Zitat:

#include <windows.h>
#include <stdio.h>

typedef int (*isgigabytemobo)(void);

int main()
{
HMODULE hGigabyteLib = NULL;
isgigabytemobo LX_IsGigaMainBoard = NULL;

hGigabyteLib = LoadLibrary(L"W83781D.DLL");

if (hGigabyteLib != NULL)
{
printf("Library loaded: W83781D.DLL.\n");

LX_IsGigaMainBoard = (isgigabytemobo)GetProcAddress(hGigabyteLib, "LX_IsGigaMainBoard");

if (LX_IsGigaMainBoard != NULL)
{
printf("Found LX_IsGigaMainBoard.\n");

printf("i: %i.\n", LX_IsGigaMainBoard());
}
else
printf("Could not find LX_IsGigaMainBoard.\n");

FreeLibrary(hGigabyteLib);
}
else
printf("Couldn't load library W83781D.DLL.\n");

system("pause");

return 0;
}

Olli 23. Aug 2007 23:00

Re: Gigabyte dll functions
 
Zitat:

Zitat von Razor
Well i wouldnt know even where to start,all i found is this but what does this mean?Does it contain any parameters,well i doubt so.

Zitat:

public LX_IsQDIMainBoard
LX_IsQDIMainBoard proc near
or eax, 0FFFFFFFFh ; LX_IsMSIMainBoard
retn
LX_IsQDIMainBoard endp

No parameters. It just returns 0xFFFFFFFF, which is another way of saying -1 (32bit) or setting all bits in a LongBool to 1.


Zitat:

Zitat von Razor
Can someone translate this?To delphi..

The important part is

Code:
typedef int (*isgigabytemobo)(void);
which says that:

Delphi-Quellcode:
type TFNisgigabytemobo = function(): Integer; cdecl;
(where cdecl is not important, because no params are being passed)

Razor 24. Aug 2007 01:03

Re: Gigabyte dll functions
 
Even though if a function doesnt have a parameter can it be called?I guess than it will only return 0 or -1 ,yes or no

Olli 24. Aug 2007 01:11

Re: Gigabyte dll functions
 
Of course can a function without parameters be called.

Given the short disassembly excerpt, this function returns exactly ONE value: -1

But I presume that the actual meaning is BOOL (i.e. LongBool in Delphi) and that this is supposed to return -1 or 0, yes.

Razor 24. Aug 2007 01:15

Re: Gigabyte dll functions
 
public LX_IsQDIMainBoard
LX_IsQDIMainBoard proc near
or eax, 0FFFFFFFFh ; LX_IsMSIMainBoard
retn
LX_IsQDIMainBoard endp


So this is accuall boolean function that returns -1 or 0 ,you can also sometime see the parameter in the name of the function.Is can only be boolean.

Olli 24. Aug 2007 02:04

Re: Gigabyte dll functions
 
Zitat:

Zitat von Razor
So this is accuall boolean function that returns -1 or 0 ,you can also sometime see the parameter in the name of the function.Is can only be boolean.

The point is, that per definition a LongBool (Windows.BOOL) can have any value other than 0 and will be true in that case. This also means that it is not sufficient to check for 1 (as true) and 0 (as false) but rather you should check against 0 (i.e. FALSE) in all cases.

Razor 24. Aug 2007 12:49

Re: Gigabyte dll functions
 
Can you help me with other functions :)

Olli 24. Aug 2007 19:48

Re: Gigabyte dll functions
 
How much do you pay per hour? :mrgreen: :zwinker:

I can try, but my spare time is limited anyway, so I'd prefer you forward only those parts you really can't solve yourself. Please do it via the forum anyway, so other can benefit from the findings.

Razor 29. Aug 2007 11:59

Re: Gigabyte dll functions
 
Liste der Anhänge anzeigen (Anzahl: 2)
For me it returns -1 or false but i dont know for accual users that have gigabyte board.So you may test it


Delphi-Quellcode:
interface

uses
  Fastmm4,Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
    const
  w83781ddll = 'w83781d.dll';
type
  TForm1 = class(TForm)
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
    function LX_IsGigaMainBoard : integer;external 'w83781d.dll';
var
  Form1: TForm1;
   hInstdll: THandle;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
hInstdll := LoadLibrary(w83781ddll);
if LX_IsGigaMainBoard=-1 then
label1.caption:='you dont have a giga board!'
else if  LX_IsGigaMainBoard=0 then
 label1.caption:='you do have a giga board!';
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FreeLibrary(hInstdll);
end;

end.


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:50 Uhr.
Seite 3 von 4     123 4      

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