AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Treiberinstallation

Ein Thema von Nuclear-Ping · begonnen am 28. Aug 2007 · letzter Beitrag vom 30. Aug 2007
Antwort Antwort
Nuclear-Ping
(Gast)

n/a Beiträge
 
#1

Re: Treiberinstallation

  Alt 30. Aug 2007, 12:55
Great suggestions, thanks. But none of them work ...

Suggestion to separate file name and root path:
Delphi-Quellcode:
const
  infPath = '.\drivers\NT_2K_XP\lqr\';
  infFile = 'lqr_usb.inf';
var
  srcPath,
  srcFile: PChar;
begin
  GetMem (srcPath, Length (infPath) + 1);
  GetMem (srcFile, Length (infFile) + 1);
  StrCopy (srcPath, infPath);
  StrCopy (srcFile, infFile);
  if SetupInstallFile (
        nil,
        nil,
        srcFile,
        srcPath,
        nil,
        SP_COPY_SOURCE_ABSOLUTE,
        nil,
        nil) then
    showmessage ('OK')
  else showmessage ('Oh Oh ...');
  FreeMem (srcPath);
  FreeMem (srcFile);
end;
Suggestion to use SetupOpenInfFile: I get an AV when calling SetupOpenInfFile, Read of Adress 000...
I already tried several ways, without GetMem, with GetMem, without ZeroMemory, ...
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
const
  infPath = '.\drivers\NT_2K_XP\lqr\';
  infFile = 'lqr_usb.inf';
var
  srcPath,
  srcFile,
  InfClass: PChar;
  Inf: HINF;
  ErrorLine: PUINT;
begin
  GetMem (InfClass, 32);
  ZeroMemory (InfClass, 32);
  GetMem (srcFile, Length (infPath + infFile) + 1);
  StrCopy (srcFile, infPath + infFile);
  showmessage (srcFile);
  Inf := SetupOpenInfFile (srcFile, InfClass, INF_STYLE_WIN4, ErrorLine);
  try
    if SetupInstallFile (
          Inf,
          nil,
          nil,
          nil,
          nil,
          SP_COPY_SOURCE_ABSOLUTE,
          nil,
          nil) then
      showmessage ('OK')
    else showmessage ('Failed');
  finally
    FreeMem (srcFile);
    FreeMem (InfClass);
    SetupCloseInfFile (Inf);
  end;
end;
[Edit]
Ich hab ne Lösung gefunden mit der DIFxAPI von MSDN!

Hab parallel zu dem Vorhaben mit SetupApi die difxapi.h nach Delphi übersetzt - soweit das meine Kenntnisse zuliesen - und scheinbar klappt das.

Die Header-Datei:
http://www.108bits.de/private/files/sources/difxapi.zip

Der Code:
Delphi-Quellcode:
const
  lqrInfFile: String = '.\drivers\NT_2K_XP\lqr\lqr_usb.inf';
  ftdiInfFile1: String = '.\drivers\NT_2K_XP\rs232\FTDIPORT.INF';
  ftdiInfFile2: String = '.\drivers\NT_2K_XP\rs232\FTDIBUS.INF';
var
  NR: Boolean;
  Info: PCINSTALLERINFO_A;
begin
  GetMem (Info, 128);
  Info.pApplicationId := 'AppGUID';
  Info.pDisplayName := 'ApplicationDisplayName';
  Info.pProductName := 'YourProductName';
  Info.pMfgName := 'ManufacturerName';
  DriverPackageInstall (PChar (ftdiInfFile1), DRIVER_PACKAGE_FORCE or DRIVER_PACKAGE_LEGACY_MODE, Info, NR);
  FreeMem (Info);

{...}
end;
Das funzt. Kurze Sanduhr, Treiber ist installiert.

Allerdings hab ich hier bei der Übersetzung der Header-Datei wohl auch bissl geschlampt. Wenn ich Info nil übergebe (was bei MSDN ok ist), bekomme ich nach der Funktion eine AV, der Treiber wird aber trotzdem installiert.
Auch funktioniert "DriverPackagePreinstall" scheinbar nicht, da dort gleich mal garnix passiert, weder Sanduhr noch Treiberinstallation.
Bin halt kein C'ler ... Wer also Fehler findet darf sie gern korrigieren und der Community 'ne optimierte Übersetzung zur Verfügung stellen.
[/Edit]
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:41 Uhr.
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