Treiber, DIFxAPI.dll, DllCall

  • Hi,

    ich versuche gerade die API Aufrufe der DIFxAPI.all per Autoit zu machen.
    Aber das funktioniert irgendwie nicht, ich bekomme als Feedback in $aRes
    immer "00000000", egal was ich mache oder übergebe. @error wird nicht
    gesetzt. Statt usbser.inf kann man auch eine andere INF eines Treiber Setups
    benutzen.

    Weiß einer was ich falsch mache?

    Es geht erstmal um die Funktion DriverPackageInfPath
    http://msdn.microsoft.com/en-us/library/…0(v=vs.85).aspx

    Code
    DWORD DriverPackageGetPath(
      _In_       PCTSTR DriverPackageInfPath,
      _Out_opt_  PWSTR pDestInfPath,
      _Inout_    DWORD *pNumOfChars
    );


    [autoit]


    #include <array.au3>
    #include <Debug.au3>

    [/autoit][autoit][/autoit][autoit]

    _DebugSetup("DriverPackage", True)

    [/autoit][autoit][/autoit][autoit]

    Local $DriverPackageInfPath = "usbser.inf"
    _DebugReportVar("$DriverPackageInfPath", $DriverPackageInfPath)
    Local $pDestInfPath
    Local $pNumOfChars

    [/autoit][autoit][/autoit][autoit]

    Local $DIFxAPIdll = DllOpen("DIFxAPI.dll")
    _DebugReportVar("$DIFxAPIdll", $DIFxAPIdll)

    [/autoit][autoit][/autoit][autoit]

    Local $aRes = DllCall($DIFxAPIdll, "DWORD", "DriverPackageGetPath", _
    "PCTSTR", $DriverPackageInfPath, _
    "PWSTR", $pDestInfPath, _
    "PTR", $pNumOfChars)
    _DebugReportVar("aRes", Hex($aRes))

    [/autoit][autoit][/autoit][autoit]

    DllClose($DIFxAPIdll)

    [/autoit]
    • Offizieller Beitrag

    Es wäre sinnvoll, wenn du
    a) die Beschreibung der Funktionsparameter lesen würdest und
    b) zumindest darauf verlinkst (nicht jeder - z.B. ich - hat Lust extra einen Anhang herunterzuladen)

    Hier mal die Parameter (Quelle:(

    Spoiler anzeigen
    Code
    DriverPackageInfPath [in]
    A pointer to a NULL-terminated string that supplies the fully qualified path of a driver package's INF file. DIFx uses this string to retrieve the corresponding INF file within the DIFx driver store. The INF file cannot be in the system INF file directory. For more information about how to specify an INF file path for a driver package, see Specifying a Driver Package INF File Path.
    pDestInfPath [out, optional]
    A pointer to a buffer that receives a NULL-terminated string that contains the fully qualified path of the INF file within the DIFx driver store. This string corresponds to the driver package's INF file that is supplied by DriverPackageInfPath. This pointer is optional and can be NULL.
    pNumOfChars [in, out]
    A pointer to a DWORD-typed variable that receives the buffer size, in characters, of the buffer that is pointed to by pDestInfPath. If the pDestInfPath buffer is large enough to hold the requested INF file path within the DIFx driver store, DriverPackageGetPath returns ERROR_SUCCESS and sets *pNumOfChars to the size, in characters, of the INF file path. If the buffer is not large enough to retrieve the requested INF file path, the function returns ERROR_INSUFFICIENT_BUFFER. Also, the function sets *pNumOfChars to the buffer size, in characters, that is required to retrieve the requested INF file path in addition to the NULL terminator.

    - Parameter "DriverPackageInfPath" ist ein Pointer auf einen Null-terminierten String!
    - Parameter "pDestInfPath" (optional, wenn nicht gebraucht: 0 übergeben) ist ebenfalls ein Pointer auf einen Buffer (String) zur Aufnahme des Null-terminierten Rückgabestrings
    - Parameter "pNumOfChars" ist der Pointer auf eine DWORD-Variable, die setzt du auf den Wert: Länge InPath +1 (Nullterminator). Ist der Wert zu klein schlägt die Funktion fehl und du kannst aus diesem Parameter die erforderliche Größe ablesen.

    Mit diesen Angaben solltest du jetzt den korrekten Aufruf erstellen können.