@msdn=http://msdn2.microsoft.com/en-us/library/ms793486.aspx @pinvoke=http://pinvoke.net/$$$.htm Summary: The DriverPackageGetPath function retrieves the fully qualified path of the driver store INF file for a preinstalled driver package. !!!!C# Signature: [DllImport("DIFxAPI.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern Int32 DriverPackageGetPath([MarshalAs(UnmanagedType.LPTStr)] string DriverPackageInfPath, [MarshalAs(UnmanagedType.LPTStr)] string pDestInfPath, out Int32 pNumOfChars); !!!!VB Signature: Public Declare Auto Function DriverPackageGetPath Lib "DIFxAPI.dll" (ByVal DriverPackageInfPath As String, ByVal pDestInfPath As String, ByRef pNumOfChars As Int32) As Int32 !!!!User-Defined Types: None. !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: I was unable to get the C# Signature above to work but this worked fine. [DllImport("DIFxAPI.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern Int32 DriverPackageGetPath( [MarshalAs(UnmanagedType.LPTStr)] string DriverPackageInfPath, StringBuilder pDestInfPath, out Int32 pNumOfChars !!!!Tips & Tricks: To use this function you just need difxapi.dll of appropriate architecture from Windows Server 2008/Vista WDK. The DriverStore will be created automatically for you. !!!!Sample Code: C#: const Int32 ERROR_INSUFFICIENT_BUFFER = 122; string infFile = <INF_file_name>; Int32 infDriverStorePathLength = 256; string infDriverStorePath = String.Empty; infDriverStorePath = infDriverStorePath.PadLeft(infDriverStorePathLength - 1); Int32 GetPathResult = DriverPackageGetPath(infFile, infDriverStorePath, out infDriverStorePathLength); if (GetPathResult == ERROR_INSUFFICIENT_BUFFER) { infDriverStorePath = infDriverStorePath.PadLeft(infDriverStorePathLength-1); GetPathResult = DriverPackageGetPath(infFile, infDriverStorePath, out infDriverStorePathLength); } VB: Const ERROR_INSUFFICIENT_BUFFER As Int32 = 122 Dim infFile As String = <INF_file_name> Dim infDriverStorePathLength As Int32 = 256 Dim infDriverStorePath As String = String.Empty infDriverStorePath = infDriverStorePath.PadLeft(infDriverStorePathLength - 1) Dim GetPathResult As Int32 = DriverPackageGetPath(infFile, infDriverStorePath, infDriverStorePathLength) If GetPathResult = ERROR_INSUFFICIENT_BUFFER Then infDriverStorePath = infDriverStorePath.PadLeft(infDriverStorePathLength - 1) GetPathResult = DriverPackageGetPath(infFile, infDriverStorePath, infDriverStorePathLength) End If Documentation: DriverPackageGetPath@msdn on MSDN
Edit difxapi.DriverPac...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.