Autor Beitrag
kandesbunzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116
Erhaltene Danke: 1


Delphi 7, XE2
BeitragVerfasst: Do 19.04.12 17:41 
Hallo,

wie kann ich die Windowsversion bis einschließlich Windows 7 sowie deren 'Bitbreiten' ermitteln.

Ich habe hierzu bereits etliche Ansätze in verschiedenen Foren durchgelesen, (bspw.
www.swissdelphicente.../showcode.php?id=316
www.swissdelphicente...showcode.php?id=1126
www.delphipraxis.net...indowserkennung.html
www.delphi-forum.de/...ws+version+ermitteln
www.delphi-treff.de/...-version-ermitteln/).

Leider sind etliche Beiträge schon älteren Datums oder ich bekomme es einfach nicht zum Laufen.

Über eine Lösung oder Beispielprojekt würde ich mich freuen.

Danke und Gruß,
kandesbunzler.
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Do 19.04.12 18:14 
vielleicht hilft der Anhang
Einloggen, um Attachments anzusehen!
_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS

Für diesen Beitrag haben gedankt: Apo95
kandesbunzler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116
Erhaltene Danke: 1


Delphi 7, XE2
BeitragVerfasst: Do 19.04.12 22:40 
Danke bummi.

Ich versuche gerade, die Unit uGetWindowsVersion einzubinden, erhalte aber beim Compilieren die Fehlermeldung: "The data area passed to a system call is too small". Der Debugger bleibt in Zeile 143 stehen (raise Exception.Create(SysErrorMessage(getLastError)).

Was könnte hier fehlschlagen?

Gruß,
kandesbunzler.

PS: Ergänzungen/Alternativen sind willkommen!
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 20.04.12 00:33 
szCSDVersion: array[0..127] of WideChar;

ändern in

szCSDVersion: array[0..127] of AnsiChar;
kandesbunzler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116
Erhaltene Danke: 1


Delphi 7, XE2
BeitragVerfasst: Fr 20.04.12 06:44 
Guten Morgen,

es hat prima geklappt, danke an Euch.

Gruß
kandesbunzler.
Delphi-Laie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1600
Erhaltene Danke: 232


Delphi 2 - RAD-Studio 10.1 Berlin
BeitragVerfasst: Fr 20.04.12 15:00 
Es funktioniert im Sinne einer sinnvollen Ausgabe durchaus.

Allerdings stört / stößt sich Delphi beim Compilieren doch noch an etwas: "[Warnung] uGetWindowsVersion.pas(253): Variable 'GetProductInfo' wurde wahrscheinlich nicht Initialisiert".
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 20.04.12 19:10 
//GetProductInfo
statt: @GetProductInfo := GetProcAddress(LibraryHandle, 'GetProductInfo');

ausblenden Delphi-Quelltext
1:
2:
3:
4:
initialization
   @GetProductInfo := GetProcAddress(LibraryHandle('KERNEL32.DLL'),'GetProductInfo');

End.
Delphi-Laie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1600
Erhaltene Danke: 232


Delphi 2 - RAD-Studio 10.1 Berlin
BeitragVerfasst: Sa 21.04.12 11:51 
Die meinerseits monierte Warnung lag (nur) daran, daß in besagter Unit um die Zeile 250:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
LibraryHandle := LoadLibrary('kernel32.dll');
if LibraryHandle <> 0 then
begin
  @GetProductInfo := GetProcAddress(LibraryHandle, 'GetProductInfo');
  if Assigned(GetProductInfo) then
  begin
    GetProductInfo(osvi.dwMajorVersion, osvi.dwMinorVersion, 00, ProductType);
  end;
end;

GetProductInfo(osvi.dwMajorVersion, osvi.dwMinorVersion, 00, ProductType);


GetProductInfo irrtümlich noch einmal aufgerufen wurde.