diff options
Diffstat (limited to 'setup/DIFxAPI')
| -rw-r--r-- | setup/DIFxAPI/AppDrv/AppDrv.vcxproj | 187 | ||||
| -rw-r--r-- | setup/DIFxAPI/AppDrv/AppDrv.vcxproj.Filters | 22 | ||||
| -rw-r--r-- | setup/DIFxAPI/AppDrv/AppDrvDepend.c | 147 | ||||
| -rw-r--r-- | setup/DIFxAPI/AppDrv/readme.htm | 109 | ||||
| -rw-r--r-- | setup/DIFxAPI/DIFxAPI.sln | 46 | ||||
| -rw-r--r-- | setup/DIFxAPI/DIFxCmd/DIFxCmd.vcxproj | 187 | ||||
| -rw-r--r-- | setup/DIFxAPI/DIFxCmd/DIFxCmd.vcxproj.Filters | 22 | ||||
| -rw-r--r-- | setup/DIFxAPI/DIFxCmd/difxcmd.c | 218 | ||||
| -rw-r--r-- | setup/DIFxAPI/DIFxCmd/readme.htm | 59 | ||||
| -rw-r--r-- | setup/DIFxAPI/ReadMe.md | 5 |
10 files changed, 1002 insertions, 0 deletions
diff --git a/setup/DIFxAPI/AppDrv/AppDrv.vcxproj b/setup/DIFxAPI/AppDrv/AppDrv.vcxproj new file mode 100644 index 00000000..c82e3348 --- /dev/null +++ b/setup/DIFxAPI/AppDrv/AppDrv.vcxproj @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{2431EBAC-383A-407F-B131-FDA52CCA3DFF}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems" /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>AppDrv</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>AppDrv</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>AppDrv</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>AppDrv</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);difxapi.lib</AdditionalDependencies> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);difxapi.lib</AdditionalDependencies> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);difxapi.lib</AdditionalDependencies> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);difxapi.lib</AdditionalDependencies> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="AppDrvDepend.c" /> + </ItemGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> + <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> + <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/setup/DIFxAPI/AppDrv/AppDrv.vcxproj.Filters b/setup/DIFxAPI/AppDrv/AppDrv.vcxproj.Filters new file mode 100644 index 00000000..7c8e3101 --- /dev/null +++ b/setup/DIFxAPI/AppDrv/AppDrv.vcxproj.Filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{9481CE08-D6B5-4535-BEB1-2150D2E62176}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{FCEAD7F6-88BE-4D1B-B2DB-3C93C6E8D318}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{78BA1C9C-DC6C-4ED4-8B64-78677A62B0A0}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="AppDrvDepend.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/setup/DIFxAPI/AppDrv/AppDrvDepend.c b/setup/DIFxAPI/AppDrv/AppDrvDepend.c new file mode 100644 index 00000000..27180f00 --- /dev/null +++ b/setup/DIFxAPI/AppDrv/AppDrvDepend.c @@ -0,0 +1,147 @@ +/*++ + +Copyright (c) Microsoft Corporation + + +Description: + +This sample demonstrates how to use the application-to-driver dependency +feature of the Driver Install Frameworks (DIFx) API. The DriverPackageInstall +and the DriverPackageUninstall APIs allow the calling application to register +and remove dependencies on a driver package. In order to register or remove +a dependency on a driver package, the calling application needs to populate +the fields of an INSTALLERINFO structure with information about itself. It +then needs to pass in this structure as a parameter to the DIFx APIs, as +shown in this sample. + +--*/ +#include <windows.h> +#include <stdio.h> +#include <difxapi.h> + +int __cdecl +wmain( int argc, WCHAR* argv[] ) +{ + WCHAR *InfPath = NULL; + INSTALLERINFO AppInfo; + BOOL Result; + BOOL NeedReboot; + + if (argc < 7) { + wprintf( TEXT("USAGE: AppDrv.exe <option> <full path to the inf file> <Application ID> <Product display name> <Product name> <Manufacturer name>\n") ); + wprintf( TEXT("<option> can be one of the following -\n") ); + wprintf( TEXT("/i - Install the driver\n") ); + wprintf( TEXT("/u - Uninstall the driver\n") ); + return 0; + } + + // + // Initialization + // + NeedReboot = FALSE; + + // + // Get the path to the INF file + // + InfPath = argv[2]; + + // + // Fill in the fields of the INSTALLERINFO structure with information about + // the application performing the install. + // + + // + // The application ID should be some random string unique to this + // application. + // + AppInfo.pApplicationId = argv[3]; + AppInfo.pDisplayName = argv[4]; + AppInfo.pProductName = argv[5]; + AppInfo.pMfgName = argv[6]; + + // + // The option parameter should be present and be exactly two characters. + // + if ((argv[1] == NULL) || + (argv[1][0] == TEXT('\0')) || + (argv[1][1] == TEXT('\0')) || + (argv[1][2] != TEXT('\0'))) { + wprintf( TEXT("ERROR: An invalid command line option %ws was passed in!\n"), argv[1] ); + goto clean0; + } + + if ((argv[1][0] == TEXT('/')) && + ((argv[1][1] == TEXT('i')) || + (argv[1][1] == TEXT('I')))) { + // + // Install the driver package, passing in the INSTALLERINFO structure with + // information about the application performing the install. By passing in + // this structure, the "MySoftware" application is expressing a dependency + // on the driver being installed. + // + wprintf( TEXT("INFO: Attempting to install the driver package %ws.\n"), InfPath ); + + Result = DriverPackageInstall(InfPath, + 0, // flags + &AppInfo, // dependency information + &NeedReboot); + + if (ERROR_SUCCESS == Result) { + wprintf( TEXT("SUCCESS: installed driver package %ws.\n"), InfPath ); + } else if (ERROR_NO_MORE_ITEMS == Result) { + wprintf( TEXT("INFO: the driver package %ws was successfully staged on the machine.\n"), InfPath ); + wprintf( TEXT("INFO: All devices found already have a better driver than what is contained in the specified inf file.\n")); + } else if (ERROR_NO_SUCH_DEVINST == Result) { + wprintf( TEXT("INFO: the driver package %ws was successfully staged on the machine.\n"), InfPath ); + wprintf( TEXT("INFO: There aren't any live devnodes with the device ID contained in the INF.\n")); + } else if (ERROR_NO_DEVICE_ID == Result) { + wprintf( TEXT("INFO: the driver package %ws was successfully staged on the machine.\n"), InfPath ); + wprintf( TEXT("INFO: No device IDs found in INF '%ws' for current platform.\n"), InfPath); + } else { + wprintf( TEXT("ERROR: An error occurred while installing driver package %ws. Error code - 0x%X.\n"), InfPath, Result); + goto clean0; + } + + if (NeedReboot){ + wprintf( TEXT("INFO: Machine will have to be rebooted to complete install.\n")); + } + + } else if ((argv[1][0] == TEXT('/')) && + ((argv[1][1] == TEXT('u')) || + (argv[1][1] == TEXT('U')))) { + // + // Uninstall the driver package, passing in the INSTALLERINFO structure + // with information about the application performing the uninstall. By + // passing in this structure, the "MySoftware" application is removing + // its dependency on the driver. The driver will actually be + // uninstalled only if there are no other applications dependent on it. + // If there are other applications depending on the driver, then the call + // to DriverPackageUninstall will simply remove the dependency of the + // "MySoftware" application on the driver, and return + // ERROR_DEPENDENT_APPLICATIONS_EXIST. + // + wprintf( TEXT("INFO: Attempting to uninstall the driver package %ws.\n"), InfPath ); + + Result = DriverPackageUninstall(InfPath, + 0, // flags + &AppInfo, // dependency information + &NeedReboot); + if (ERROR_SUCCESS != Result) { + if (ERROR_DEPENDENT_APPLICATIONS_EXIST == Result) { + wprintf( TEXT("INFO: The driver package %ws was not uninstalled because there were some applications still depending on it.\n"), InfPath); + } else { + wprintf( TEXT("ERROR: An error occurred while uninstalling driver package %ws\n."), InfPath); + goto clean0; + } + } else { + wprintf( TEXT("SUCCESS: Uninstalled driver package %ws.\n"), InfPath ); + } + } else { + wprintf( TEXT("ERROR: An invalid command line option %ws was passed in!\n"), argv[1] ); + } + + clean0: + return 0; +} + + diff --git a/setup/DIFxAPI/AppDrv/readme.htm b/setup/DIFxAPI/AppDrv/readme.htm new file mode 100644 index 00000000..bffaefc3 --- /dev/null +++ b/setup/DIFxAPI/AppDrv/readme.htm @@ -0,0 +1,109 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML><HEAD><TITLE>DIFxAPI AppDrv</TITLE> +<META http-equiv=Content-Type content="text/html; charset=windows-1252"> +<META content="MSHTML 6.00.2900.2802" name=GENERATOR><!-- #BeginEditable "doctitle" --><!-- #EndEditable --></HEAD> +<BODY link=#0000FF><FONT face=Verdana size=5> +<H2>Driver Install Frameworks API (DIFx API) </H2></FONT><FONT +face=Verdana size=2> +<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><A +href="file:///C:/Documents%20and%20Settings/tstone/My%20Documents/DIFx%20Readmes/DPInst/readme.htm#Note">Note</A> + +<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><A +href="file:///C:/Documents%20and%20Settings/tstone/My%20Documents/DIFx%20Readmes/DPInst/readme.htm#Intro">Description</A> +<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><A +href="file:///C:/Documents%20and%20Settings/tstone/My%20Documents/DIFx%20Readmes/DPInst/readme.htm#Run">Building the Sample</A> +<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><A +href="file:///C:/Documents%20and%20Settings/tstone/My%20Documents/DIFx%20Readmes/DPInst/readme.htm#Plug">Running the Sample</A> +<H3><A name=Note></A>Note</H3> +<P>This sample works only on an x86 Windows operating system. However, the +techniques illustrated in this sample apply to Windows operating systems for +other architectures as well.<BR> +<H3><A name=Intro></A>Description</H3> +<P>This sample demonstrates the usage of the application to driver dependency feature of DIFx API. It provides an example of how the INSTALLERINFO structure is to be used in calls to DriverPackageInstall and DriverPackageUninstall functions. By passing the INSTALLERINFO structure as a parameter to the DriverPackageInstall function, an application expresses a dependency on the driver package. By passing the INSTALLERINFO structure as a parameter to the DriverPackageUninstall function, an application removes its dependency on the driver package. +</P> +<H3><A name=Run></A>Building the Sample</H3> +<P>Navigate to the src\setup\DIFxAPI\AppDrv directory and run the following command: + +<P> build -cZ + +<H3><A name=Plug></A>Running the Sample</H3> +<P>The usage of AppDrv.exe is as follows:</P> +<P>AppDrv.exe <option> <full path to the inf file> <Application ID> <Product +display name> <Product name> <Manufacturer name><br> + </P> +<P><option><option> <full path to the inf file> <Application ID> <Product display name> <Product name> <Manufacturer name> + +<option> can be one of the following:</P> +<P> /i - Install the driver + +</P> +<P> /u - Uninstall the driver + +<Application ID> + +</P> +<P><Application ID> is a unique identifier that denotes the application that is installing the driver</P> +<P><Product Display name> is a user-friendly display name for the application that is installing the driver +<Product name> + +</P> +<P><Product name> is the name of the application that is installing the driver</P> +<P><Manufacturer name> is the name of the company that is shipping that is installing the driver + +</P> +<P>In order to understand the application to driver dependency feature of DIFx +API, try the following:</P> +<P>1) Run the command</P> +<P> AppDrv.exe /i <Path to some INF> <Path to INF> abc123 "My first application" "App 1" "Good Company, Inc." + +<Path to INF> + +</P> +<P> <Path to INF> should be the full path to the INF file for some driver package. + +</P> +<P>For example, you can use one of the sample driver packages that are provided in the directory src\setup\DIFxSampleDriverPackages in the DDK. + +At this point DIFx API will install the driver and it will register that an application with application ID "abc123" is dependent on the driver. + +</P> +<P>2) Run the command:</P> +<P> AppDrv.exe /i <Path to the same INF> <Path to the same INF> xyz456 "My second application" "App 2" "Good Company, Inc." + +<Path to the same INF> + +</P> +<P> <Path to the same INF> should be the path to the same INF that was used in step 1. + +</P> +<P>At this point DIFx API will register that two applications, with application IDs "abc123" and "xyz456" are dependent on the driver. + +</P> +<P>3) Run the command:</P> +<P> AppDrv.exe /u <Path to the same INF> <Path to the same INF> abc123 "My first application" "App 1" "Good Company, Inc." + +<Path to the same INF> + +</P> +<P> <Path to the same INF> should be the path to the same INF that was used in step 1. + +</P> +<P>At this point, DIFx API will remove the dependency of the application with application ID "abc123" from the driver. However, it will not uninstall the driver, because the application with application ID "xyz456" is still dependent on it. + +</P> +<P>4) Run the command:</P> +<P> AppDrv.exe /u <Path to the same INF> <Path to the same INF> xyz456 "My second application" "App 2" "Good Company, Inc." + +<Path to the same INF> +</P> +<P> <Path to the same INF> should be the path to the same INF that was used in step 1. + +</P> +<P>At this point, DIFx API will remove the dependency of the application with application ID "xyz456" from the driver. Since no other applications are dependent on the driver, DIFx API will also uninstall the driver. +</P> + +<P align=center><A +href="file:///C:/Documents%20and%20Settings/tstone/My%20Documents/DIFx%20Readmes/DPInst/readme.htm#top"><FONT +face=Verdana size=2>Top of page</FONT></A><FONT face=Verdana size=2> +</P></FONT><FONT face="MS Sans Serif" size=1> +<P>� Microsoft Corporation 2002</FONT> </FONT></P></BODY></HTML> diff --git a/setup/DIFxAPI/DIFxAPI.sln b/setup/DIFxAPI/DIFxAPI.sln new file mode 100644 index 00000000..c7fc6244 --- /dev/null +++ b/setup/DIFxAPI/DIFxAPI.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AppDrv", "AppDrv", "{B11F7E40-EE73-4682-AB3B-064469A819E1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DIFxCmd", "DIFxCmd", "{2B03F68A-553F-4311-89F2-C8FFC7525379}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppDrv", "AppDrv\AppDrv.vcxproj", "{51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DIFxCmd", "DIFxCmd\DIFxCmd.vcxproj", "{C368C716-AC0A-4165-861B-42D55AD9FB99}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}.Debug|Win32.ActiveCfg = Debug|Win32 + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}.Debug|Win32.Build.0 = Debug|Win32 + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}.Release|Win32.ActiveCfg = Release|Win32 + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}.Release|Win32.Build.0 = Release|Win32 + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}.Debug|x64.ActiveCfg = Debug|x64 + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}.Debug|x64.Build.0 = Debug|x64 + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}.Release|x64.ActiveCfg = Release|x64 + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4}.Release|x64.Build.0 = Release|x64 + {C368C716-AC0A-4165-861B-42D55AD9FB99}.Debug|Win32.ActiveCfg = Debug|Win32 + {C368C716-AC0A-4165-861B-42D55AD9FB99}.Debug|Win32.Build.0 = Debug|Win32 + {C368C716-AC0A-4165-861B-42D55AD9FB99}.Release|Win32.ActiveCfg = Release|Win32 + {C368C716-AC0A-4165-861B-42D55AD9FB99}.Release|Win32.Build.0 = Release|Win32 + {C368C716-AC0A-4165-861B-42D55AD9FB99}.Debug|x64.ActiveCfg = Debug|x64 + {C368C716-AC0A-4165-861B-42D55AD9FB99}.Debug|x64.Build.0 = Debug|x64 + {C368C716-AC0A-4165-861B-42D55AD9FB99}.Release|x64.ActiveCfg = Release|x64 + {C368C716-AC0A-4165-861B-42D55AD9FB99}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {51E48BC7-B82C-4F02-8C66-9A94C32E8DE4} = {B11F7E40-EE73-4682-AB3B-064469A819E1} + {C368C716-AC0A-4165-861B-42D55AD9FB99} = {2B03F68A-553F-4311-89F2-C8FFC7525379} + EndGlobalSection +EndGlobal diff --git a/setup/DIFxAPI/DIFxCmd/DIFxCmd.vcxproj b/setup/DIFxAPI/DIFxCmd/DIFxCmd.vcxproj new file mode 100644 index 00000000..65d9c57b --- /dev/null +++ b/setup/DIFxAPI/DIFxCmd/DIFxCmd.vcxproj @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C368C716-AC0A-4165-861B-42D55AD9FB99}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{EB4A0E3E-31D0-4D1E-9415-453DC8D122F6}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems" /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;_UNICODE</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>DIFxCmd</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>DIFxCmd</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>DIFxCmd</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>DIFxCmd</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);difxapi.lib</AdditionalDependencies> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);difxapi.lib</AdditionalDependencies> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);difxapi.lib</AdditionalDependencies> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);difxapi.lib</AdditionalDependencies> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="difxcmd.c" /> + </ItemGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> + <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> + <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/setup/DIFxAPI/DIFxCmd/DIFxCmd.vcxproj.Filters b/setup/DIFxAPI/DIFxCmd/DIFxCmd.vcxproj.Filters new file mode 100644 index 00000000..6657863f --- /dev/null +++ b/setup/DIFxAPI/DIFxCmd/DIFxCmd.vcxproj.Filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{EB72BAFA-7E87-4214-8F90-7AB380D50C9E}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{E9A405A6-0CA8-4171-A852-CA5C44A9B6BA}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{784DA48C-700C-4454-974B-0DA8644295CB}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="difxcmd.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/setup/DIFxAPI/DIFxCmd/difxcmd.c b/setup/DIFxAPI/DIFxCmd/difxcmd.c new file mode 100644 index 00000000..7cc64b95 --- /dev/null +++ b/setup/DIFxAPI/DIFxCmd/difxcmd.c @@ -0,0 +1,218 @@ +/*++ + +Copyright (c) Microsoft Corporation + + +Description: + + Command line program that demonstrates how to use DIFxAPI. + + Link with either DIFXAPI.LIB and have DIFXAPI.DLL on the path. + + This sample demonstrates how to use DIFXAPI to preinstall, install and uninstall + a driver package. It also allows to retrieve the path to an already preinstalled + or installed driver package. It further shows how to capture logging information + and print it out. +--*/ + +#include <windows.h> +#include <tchar.h> +#include <stdlib.h> +#include <stdio.h> +#include <difxapi.h> + +static VOID __cdecl +LogCallback( + DIFXAPI_LOG Event, + DWORD Error, + const TCHAR * pEventDescription, + PVOID CallbackContext + ); + + +int __cdecl +_tmain( + int argc, + TCHAR* argv[] + ) +{ + TCHAR DestPath[MAX_PATH]; + ULONG Size = MAX_PATH; + TCHAR * InfPath = NULL; + TCHAR DriverPackageInfPath[MAX_PATH]; + DWORD Ret; + TCHAR Option; + BOOL NeedReboot = FALSE; + DWORD Flags = 0; + LPTSTR lpFilePart; + int i; + DWORD dw; + Size = MAX_PATH; + + + _tprintf( TEXT("DIFxAPI Sample Program\n") ); + if( argc < 3 ) + { + _tprintf( TEXT("USAGE: test /p /i /u /g <inf-filename> [Flag(s)]\n") ); + _tprintf( TEXT("\nOptions:\n")); + _tprintf( TEXT("/p : preinstall driver package.\n") ); + _tprintf( TEXT("/i : install driver package.\n") ); + _tprintf( TEXT("/u : uninstall driver package.\n") ); + _tprintf( TEXT("/g : get driver package path.\n") ); + + _tprintf( TEXT("\n<inf-filename> : has to be in the current directory.\n") ); + _tprintf( TEXT("\nFlags:\n")); + _tprintf( TEXT("DRIVER_PACKAGE_REPAIR: 0x00000001 ( 1)\n")); + _tprintf( TEXT("DRIVER_PACKAGE_SILENT: 0x00000002 ( 2)\n")); + _tprintf( TEXT("DRIVER_PACKAGE_FORCE: 0x00000004 ( 4)\n")); + _tprintf( TEXT("DRIVER_PACKAGE_ONLY_IF_DEVICE_PRESENT: 0x00000008 ( 8)\n")); + _tprintf( TEXT("DRIVER_PACKAGE_LEGACY: 0x00000010 (16)\n")); + _tprintf( TEXT("DRIVER_PACKAGE_DELETE_FILES: 0x00000020 (32)\n")); + + return 0; + } + + // + // Get command line choices + // + + // + // The code suppresses the warning 28193 for the call to _totlower. + // This suppression is done because that function has a check return + // annotation on it. However, it doesn't return an error code + // and the check return annotation is really being used to indicate + // that the return value of the function should be looked at and/or + // assigned to a variable. The check return annotation means the return + // value should always be checked in all code paths. The return value is + // assigned to a variable, but the return in the for loop could cause + // this function to exit before Option is ever examined. For that case, + // the code doesn't need to check the value of Option so the warning + // is being suppressed + // +#pragma warning( suppress: 28193) + Option = (TCHAR)_totlower(argv[1][1]); + InfPath = argv[2]; + + for ( i = 3; i<argc; i++ ){ + dw = _ttol( argv[i] ); + // + // Either an error occurred during conversion of a flags parameter + // into a long or a flag of 0 was specified. Either way, + // this is invalid input. + // + if (0 == dw) + { + _tprintf( TEXT("An invalid flag was specified.") ); + + return 0; + } + + Flags |= dw; + } + + + GetFullPathName( InfPath, MAX_PATH, DriverPackageInfPath, &lpFilePart); + + _tprintf( TEXT("INFO: Option \"/%c\"\n"), Option ); + _tprintf( TEXT("INFO: Input file \"%s\"\n"), DriverPackageInfPath ); + _tprintf( TEXT("INFO: Flags 0x%X (%u)\n\n"), Flags, Flags ); + + + DIFXAPISetLogCallback( LogCallback, (PVOID)NULL ); + + Ret = ERROR_SUCCESS; + + if ( TEXT('p') == Option ) + { + _tprintf( TEXT("TEST: preinstalling driver package.\n")); + Ret = DriverPackagePreinstall( DriverPackageInfPath, Flags ); + if( ERROR_SUCCESS == Ret ){ + _tprintf( TEXT("INFO: preinstalled package.\n") ); + } else if (ERROR_ALREADY_EXISTS == Ret){ + _tprintf( TEXT("INFO: package was already in store.\n") ); + } else { + _tprintf( TEXT("ERROR: failed with error code 0x%X\n"), Ret ); + } + } + else if ( TEXT('i') == Option ) + { + _tprintf( TEXT("TEST: installing driver package.\n")); + + Ret = DriverPackageInstall( + DriverPackageInfPath, + Flags, + NULL, + &NeedReboot ); + + if( ERROR_SUCCESS == Ret ){ + _tprintf( TEXT("SUCCESS: installed package %s.\n"), DriverPackageInfPath ); + } else if (ERROR_NO_MORE_ITEMS == Ret){ + _tprintf( TEXT("INFO: All devices found already have a better driver than what is contained in the specified inf file. To force an install, use the ForceIfNotBetter flag.\n")); + } else if (ERROR_NO_SUCH_DEVINST == Ret){ + _tprintf( TEXT("INFO: There aren't any live devnodes with the DeviceId contained in the INF.\n")); + } + else{ + _tprintf( TEXT("ERROR: failed with error code 0x%X\n"), Ret ); + } + + if (NeedReboot){ + _tprintf( TEXT("INFO: Machine will have to be rebooted to complete install.") ); + } + + } + else if ( TEXT('u') == Option ) + { + _tprintf( TEXT("TEST: uninstalling driver package.\n")); + + Ret = DriverPackageUninstall( + DriverPackageInfPath, + Flags, + NULL, + &NeedReboot ); + + if( ERROR_SUCCESS == Ret ){ + _tprintf( TEXT("SUCCESS: uninstalled driver package %s.\n"), DriverPackageInfPath ); + } else { + _tprintf( TEXT("ERROR: failed with error code 0x%X\n"), Ret ); + } + + if (NeedReboot) { + _tprintf( TEXT("INFO: Machine will have to be rebooted to complete uninstall.") ); + } + + } + else if ( TEXT('g') == Option ) + { + _tprintf( TEXT("TEST: getting driver package path.\n")); + Ret = DriverPackageGetPath( DriverPackageInfPath, DestPath, &Size ); + if ( ERROR_SUCCESS==Ret ){ + _tprintf( TEXT("INFO: INF path is %s\n"), DestPath ); + } else { + _tprintf( TEXT("ERROR: failed with error code 0x%X\n"), Ret ); + } + } else { + _tprintf( TEXT("ERROR: invalid command line option /%c.\n"), Option ); + } + + DIFXAPISetLogCallback( NULL, (PVOID)NULL ); + + return 1; +} + + + +VOID __cdecl +LogCallback( + DIFXAPI_LOG Event, + DWORD Error, + const TCHAR * pEventDescription, + PVOID CallbackContext + ) +{ + UNREFERENCED_PARAMETER(CallbackContext); + if (0==Error){ + _tprintf( TEXT("LOG Event: %u, %s\n"), Event, pEventDescription ); + } else { + _tprintf( TEXT("LOG Event: %u, Error = %u, %s\n"), Event, Error, pEventDescription); + } +} diff --git a/setup/DIFxAPI/DIFxCmd/readme.htm b/setup/DIFxAPI/DIFxCmd/readme.htm new file mode 100644 index 00000000..a369e56e --- /dev/null +++ b/setup/DIFxAPI/DIFxCmd/readme.htm @@ -0,0 +1,59 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML><HEAD><TITLE>DIFxAPI AppDrv</TITLE> +<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> +<META content="MSHTML 6.00.2900.2802" name=GENERATOR><!-- #BeginEditable "doctitle" --><!-- #EndEditable --></HEAD> +<BODY link=#0000ff><FONT face=Verdana size=5> +<H2>Driver Install Frameworks API (DIFx API) </H2></FONT><FONT face=Verdana +size=2> + +<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><a href="#Intro">Description</a> + +<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><a href="#Build">Building +the Sample </a> +<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><a href="#Run">Running +the Sample</a> +<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><a href="#Usage">Usage of the +DIFXAPI Sample Program</a><P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"> <H3><A name=Intro></A>Description</H3> +<P>This sample demonstrates how to use DIFx API. It shows how to preinstall, +install and uninstall driver packages. It also shows how to retrieve the path to +an already preinstalled or installed driver package. It furthers shows how to +capture logging information that the APIs create during installs and uninstalls. </P> +<H3><a name="Build"></a>Building the Sample</H3> +<P>Navigate to the src\setup\DIFxAPI\DIFXCMD directory and run the following +command: +<P> build -cZ +<H3><a name="Run"></a>Running the Sample</H3> +<P>Once the sample is built, run the following commands. Before running the +command, copy a complete driver package into the same directory:</P> +<P>difxcmd.exe to print out how to use the command line tool + +</P> +<P>difxcmd.exe /p my.inf , to preinstall my.inf </P> +<P>difxcmd.exe /i my.inf , to install my.inf </P> +<P>difxcmd.exe /i my.inf 16, to install my.inf in legacy mode (accepting unsigned drivers) +</P> +<P>difxcmd.exe /p my.inf , to obtain the path to the installed my.inf </P> +<P>difxcmd.exe /u my.inf , to uninstall my.inf </P> +<H3><a name="Usage"></a>Usage of the DIFXAPI Sample Program </H3> +<p>difxapi /p /i /u /g <inf-filename> [Flag(s)]<br> +<br> +Options:<br> +/p : preinstall driver package.<br> +/i : install driver package.<br> +/u : uninstall driver package.<br> +/g : get driver package path.<br> +<br> +<inf-filename> : has to be in the current directory.<br> +<br> +Flags:<br> +DRIVER_PACKAGE_REPAIR: 0x00000001 ( 1)<br> +DRIVER_PACKAGE_SILENT: 0x00000002 ( 2)<br> +DRIVER_PACKAGE_FORCE: 0x00000004 ( 4)<br> +DRIVER_PACKAGE_ONLY_IF_DEVICE_PRESENT: 0x00000008 ( 8)<br> +DRIVER_PACKAGE_LEGACY: 0x00000010 (16)<br> +DRIVER_PACKAGE_DELETE_FILES: 0x00000020 (32)</p> +<P align=center><A +href="file:///C:/Documents%20and%20Settings/tstone/My%20Documents/DIFx%20Readmes/DPInst/readme.htm#top"><FONT +face=Verdana size=2>Top of page</FONT></A><FONT face=Verdana size=2> +</P></FONT><FONT face="MS Sans Serif" size=1> +<P>� Microsoft Corporation 2002</FONT> </FONT></P></BODY></HTML> diff --git a/setup/DIFxAPI/ReadMe.md b/setup/DIFxAPI/ReadMe.md new file mode 100644 index 00000000..cbbea926 --- /dev/null +++ b/setup/DIFxAPI/ReadMe.md @@ -0,0 +1,5 @@ +Driver Install Frameworks API (DIFxAPI) Sample +============================================== + +[Driver Install Frameworks API (DIFxAPI)](http://msdn.microsoft.com/en-us/library/windows/hardware/ff544834) Sample. + |
