--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.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="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>StubAgent</RootNamespace>
+ <ProjectName>LiteAgent</ProjectName>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </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')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </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')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>Powrprof.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ <CustomBuildStep>
+ <Command>copy $(TargetPath) $(SolutionDir)\..\xeniface\x86
+</Command>
+ </CustomBuildStep>
+ <CustomBuildStep>
+ <Message>Copying output files</Message>
+ <Outputs>$(SolutionDir)\..\xeniface\x86\$(TargetFileName)</Outputs>
+ </CustomBuildStep>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>Powrprof.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ <CustomBuildStep>
+ <Command>copy $(TargetPath) $(SolutionDir)\..\xeniface\x64</Command>
+ </CustomBuildStep>
+ <CustomBuildStep>
+ <Message>Copying output files</Message>
+ <Outputs>$(SolutionDir)\..\xeniface\x64\$(TargetFileName)</Outputs>
+ </CustomBuildStep>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Create</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <BrowseInformation>true</BrowseInformation>
+ <PreprocessToFile>false</PreprocessToFile>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>Powrprof.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ <CustomBuildStep>
+ <Message>Copying output files</Message>
+ <Command>copy $(TargetPath) $(SolutionDir)\..\xeniface\x86
+</Command>
+ <Outputs>$(SolutionDir)\..\xeniface\x86\$(TargetFileName)</Outputs>
+ <Inputs>$(TargetPath)</Inputs>
+ </CustomBuildStep>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Create</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <BrowseInformation>true</BrowseInformation>
+ <PreprocessToFile>false</PreprocessToFile>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>Powrprof.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ <CustomBuildStep>
+ <Message>Copying output files</Message>
+ <Command>
+copy $(TargetPath) $(SolutionDir)\..\xeniface\x64</Command>
+ <Outputs>$(SolutionDir)\..\xeniface\x64\$(TargetFileName)</Outputs>
+ <Inputs>$(TargetPath)</Inputs>
+ </CustomBuildStep>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\win32stubagent\errors.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="..\..\src\win32stubagent\stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="..\..\src\win32stubagent\WmiAccessor.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="..\..\src\win32stubagent\XSAccessor.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="..\..\src\win32stubagent\XService.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\win32stubagent\stdafx.h" />
+ <ClInclude Include="..\..\src\win32stubagent\WmiAccessor.h" />
+ <ClInclude Include="..\..\src\win32stubagent\XSAccessor.h" />
+ <ClInclude Include="..\..\src\win32stubagent\XService.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="..\..\src\win32stubagent\messages.mc">
+ <FileType>Document</FileType>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc %(FullPath)</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc %(FullPath)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).rc;%(Filename).h</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).rc;%(Filename).h</Outputs>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc %(FullPath)</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc %(FullPath)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).rc;%(Filename).h</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h</Outputs>
+ </CustomBuild>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="..\..\src\win32stubagent\w32xagent.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="..\..\src\win32stubagent\xen.ico" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project>
\ No newline at end of file
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Windows Developer Preview Debug|Win32">
- <Configuration>Windows Developer Preview Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows Developer Preview Release|Win32">
- <Configuration>Windows Developer Preview Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows 7 Debug|Win32">
- <Configuration>Windows 7 Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows 7 Release|Win32">
- <Configuration>Windows 7 Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows Vista Debug|Win32">
- <Configuration>Windows Vista Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows Vista Release|Win32">
- <Configuration>Windows Vista Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows Developer Preview Debug|x64">
- <Configuration>Windows Developer Preview Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows Developer Preview Release|x64">
- <Configuration>Windows Developer Preview Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows 7 Debug|x64">
- <Configuration>Windows 7 Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows 7 Release|x64">
- <Configuration>Windows 7 Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows Vista Debug|x64">
- <Configuration>Windows Vista Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Windows Vista Release|x64">
- <Configuration>Windows Vista Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{9B071A35-897C-477A-AEB7-95F77618A21D}</ProjectGuid>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
- </PropertyGroup>
- <PropertyGroup Label="PropertySheets">
- <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset>
- <ConfigurationType>Utility</ConfigurationType>
- <DriverType>Package</DriverType>
- <Configuration>Windows Developer Preview Debug</Configuration>
- <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Developer Preview Debug|Win32'" Label="Configuration">
- <TargetVersion>Windows8</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Developer Preview Release|Win32'" Label="Configuration">
- <TargetVersion>Windows8</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows 7 Debug|Win32'" Label="Configuration">
- <TargetVersion>Windows7</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows 7 Release|Win32'" Label="Configuration">
- <TargetVersion>Windows7</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Debug|Win32'" Label="Configuration">
- <TargetVersion>Vista</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Release|Win32'" Label="Configuration">
- <TargetVersion>Vista</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Developer Preview Debug|x64'" Label="Configuration">
- <TargetVersion>Windows8</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Developer Preview Release|x64'" Label="Configuration">
- <TargetVersion>Windows8</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows 7 Debug|x64'" Label="Configuration">
- <TargetVersion>Windows7</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows 7 Release|x64'" Label="Configuration">
- <TargetVersion>Windows7</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Debug|x64'" Label="Configuration">
- <TargetVersion>Vista</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Release|x64'" Label="Configuration">
- <TargetVersion>Vista</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <EnableInf2cat>true</EnableInf2cat>
- <Inf2CatWindowsVersionList Condition="'$(Platform)'=='x64'">Vista_x64;7_x64;Server2008_x64;Server2008R2_x64;Server8_x64</Inf2CatWindowsVersionList>
- <Inf2CatWindowsVersionList Condition="'$(Platform)'=='Win32'">Vista_x86;7_x86;Server2008_x86;8_x86</Inf2CatWindowsVersionList>
- </PropertyGroup>
- <PropertyGroup>
- <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
- <EnableDeployment>False</EnableDeployment>
- <ImportToStore>False</ImportToStore>
- <InstallMode>None</InstallMode>
- <HardwareIdString />
- <CommandLine />
- <ScriptPath />
- <DeployFiles />
- <ScriptName />
- <ScriptDeviceQuery>%PathToInf%</ScriptDeviceQuery>
- <EnableVerifier>False</EnableVerifier>
- <AllDrivers>False</AllDrivers>
- <VerifyProjectOutput>True</VerifyProjectOutput>
- <VerifyDrivers />
- <VerifyFlags>133563</VerifyFlags>
- <PackageDir>..\..\xeniface\$(DDKPlatform)</PackageDir>
- </PropertyGroup>
- <ItemGroup>
- <ProjectReference Include="..\xeniface\xeniface.vcxproj">
- <Project>{22166290-65D8-49D2-BB88-33201797C7D8}</Project>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <FilesToPackage Include="$(KIT)\Redist\DIFx\dpinst\EngMui\x86\dpinst.exe" Condition="'$(Platform)'=='Win32'" />
- <FilesToPackage Include="$(KIT)\Redist\DIFx\dpinst\EngMui\x64\dpinst.exe" Condition="'$(Platform)'=='x64'" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup Label="ProjectConfigurations">\r
+ <ProjectConfiguration Include="Windows Developer Preview Debug|Win32">\r
+ <Configuration>Windows Developer Preview Debug</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows Developer Preview Release|Win32">\r
+ <Configuration>Windows Developer Preview Release</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows 7 Debug|Win32">\r
+ <Configuration>Windows 7 Debug</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows 7 Release|Win32">\r
+ <Configuration>Windows 7 Release</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows Vista Debug|Win32">\r
+ <Configuration>Windows Vista Debug</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows Vista Release|Win32">\r
+ <Configuration>Windows Vista Release</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows Developer Preview Debug|x64">\r
+ <Configuration>Windows Developer Preview Debug</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows Developer Preview Release|x64">\r
+ <Configuration>Windows Developer Preview Release</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows 7 Debug|x64">\r
+ <Configuration>Windows 7 Debug</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows 7 Release|x64">\r
+ <Configuration>Windows 7 Release</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows Vista Debug|x64">\r
+ <Configuration>Windows Vista Debug</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Windows Vista Release|x64">\r
+ <Configuration>Windows Vista Release</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ </ItemGroup>\r
+ <PropertyGroup Label="Globals">\r
+ <ProjectGuid>{9B071A35-897C-477A-AEB7-95F77618A21D}</ProjectGuid>\r
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+ <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>\r
+ </PropertyGroup>\r
+ <PropertyGroup Label="PropertySheets">\r
+ <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset>\r
+ <ConfigurationType>Utility</ConfigurationType>\r
+ <DriverType>Package</DriverType>\r
+ <Configuration>Windows Developer Preview Debug</Configuration>\r
+ <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Developer Preview Debug|Win32'" Label="Configuration">\r
+ <TargetVersion>Windows8</TargetVersion>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Developer Preview Release|Win32'" Label="Configuration">\r
+ <TargetVersion>Windows8</TargetVersion>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows 7 Debug|Win32'" Label="Configuration">\r
+ <TargetVersion>Windows7</TargetVersion>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows 7 Release|Win32'" Label="Configuration">\r
+ <TargetVersion>Windows7</TargetVersion>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Debug|Win32'" Label="Configuration">\r
+ <TargetVersion>Vista</TargetVersion>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Release|Win32'" Label="Configuration">\r
+ <TargetVersion>Vista</TargetVersion>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Developer Preview Debug|x64'" Label="Configuration">\r
+ <TargetVersion>Windows8</TargetVersion>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Developer Preview Release|x64'" Label="Configuration">\r
+ <TargetVersion>Windows8</TargetVersion>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows 7 Debug|x64'" Label="Configuration">\r
+ <TargetVersion>Windows7</TargetVersion>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows 7 Release|x64'" Label="Configuration">\r
+ <TargetVersion>Windows7</TargetVersion>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Debug|x64'" Label="Configuration">\r
+ <TargetVersion>Vista</TargetVersion>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Release|x64'" Label="Configuration">\r
+ <TargetVersion>Vista</TargetVersion>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+ <ImportGroup Label="ExtensionSettings">\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <PropertyGroup Label="UserMacros" />\r
+ <PropertyGroup>\r
+ <EnableInf2cat>true</EnableInf2cat>\r
+ <Inf2CatWindowsVersionList Condition="'$(Platform)'=='x64'">Vista_x64;7_x64;Server2008_x64;Server2008R2_x64;Server8_x64</Inf2CatWindowsVersionList>\r
+ <Inf2CatWindowsVersionList Condition="'$(Platform)'=='Win32'">Vista_x86;7_x86;Server2008_x86;8_x86</Inf2CatWindowsVersionList>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>\r
+ <EnableDeployment>False</EnableDeployment>\r
+ <ImportToStore>False</ImportToStore>\r
+ <InstallMode>None</InstallMode>\r
+ <HardwareIdString />\r
+ <CommandLine />\r
+ <ScriptPath />\r
+ <DeployFiles />\r
+ <ScriptName />\r
+ <ScriptDeviceQuery>%PathToInf%</ScriptDeviceQuery>\r
+ <EnableVerifier>False</EnableVerifier>\r
+ <AllDrivers>False</AllDrivers>\r
+ <VerifyProjectOutput>True</VerifyProjectOutput>\r
+ <VerifyDrivers />\r
+ <VerifyFlags>133563</VerifyFlags>\r
+ <PackageDir>..\..\xeniface\$(DDKPlatform)</PackageDir>\r
+ </PropertyGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Debug|Win32'">\r
+ <CustomBuild>\r
+ <AdditionalInputs>\r
+ </AdditionalInputs>\r
+ </CustomBuild>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Windows Vista Release|Win32'">\r
+ <CustomBuild>\r
+ <AdditionalInputs>\r
+ </AdditionalInputs>\r
+ </CustomBuild>\r
+ </ItemDefinitionGroup>\r
+ <ItemGroup>\r
+ <ProjectReference Include="..\xeniface\xeniface.vcxproj">\r
+ <Project>{22166290-65D8-49D2-BB88-33201797C7D8}</Project>\r
+ </ProjectReference>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <FilesToPackage Include="$(KIT)\Redist\DIFx\dpinst\EngMui\x86\dpinst.exe" Condition="'$(Platform)'=='Win32'" />\r
+ <FilesToPackage Include="$(KIT)\Redist\DIFx\dpinst\EngMui\x64\dpinst.exe" Condition="'$(Platform)'=='x64'" />\r
+ </ItemGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+ <ImportGroup Label="ExtensionTargets">\r
+ </ImportGroup>\r
+</Project>
\ No newline at end of file
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 11
-Project("{F0176BE6-4062-49C9-B0C4-3A8785B99343}") = "xeniface", "xeniface\xeniface.vcxproj", "{22166290-65D8-49D2-BB88-33201797C7D8}"
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xeniface", "xeniface\xeniface.vcxproj", "{22166290-65D8-49D2-BB88-33201797C7D8}"
EndProject
-Project("{F0176BE6-4062-49C9-B0C4-3A8785B99343}") = "package", "package\package.vcxproj", "{9B071A35-897C-477A-AEB7-95F77618A21D}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "package\package.vcxproj", "{9B071A35-897C-477A-AEB7-95F77618A21D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B} = {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LiteAgent", "liteagent\LiteAgent.vcxproj", "{2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
Windows 7 Debug|Win32 = Windows 7 Debug|Win32
Windows 7 Debug|x64 = Windows 7 Debug|x64
Windows 7 Release|Win32 = Windows 7 Release|Win32
Windows Vista Release|x64 = Windows Vista Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|Win32.ActiveCfg = Windows 7 Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|Win32.Build.0 = Windows 7 Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|Win32.Deploy.0 = Windows 7 Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|x64.ActiveCfg = Windows 7 Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|x64.Build.0 = Windows 7 Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|x64.Deploy.0 = Windows 7 Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|Win32.ActiveCfg = Windows 7 Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|Win32.Build.0 = Windows 7 Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|Win32.Deploy.0 = Windows 7 Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|x64.ActiveCfg = Windows 7 Release|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|x64.Build.0 = Windows 7 Release|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|x64.Deploy.0 = Windows 7 Release|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|Win32.ActiveCfg = Windows Developer Preview Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|Win32.Build.0 = Windows Developer Preview Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|Win32.Deploy.0 = Windows Developer Preview Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|x64.ActiveCfg = Windows Developer Preview Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|x64.Build.0 = Windows Developer Preview Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|x64.Deploy.0 = Windows Developer Preview Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|Win32.ActiveCfg = Windows Developer Preview Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|Win32.Build.0 = Windows Developer Preview Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|Win32.Deploy.0 = Windows Developer Preview Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|x64.ActiveCfg = Windows Developer Preview Release|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|x64.Build.0 = Windows Developer Preview Release|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|x64.Deploy.0 = Windows Developer Preview Release|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|Win32.ActiveCfg = Windows Vista Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|Win32.Build.0 = Windows Vista Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|Win32.Deploy.0 = Windows Vista Debug|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|x64.ActiveCfg = Windows Vista Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|x64.Build.0 = Windows Vista Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|x64.Deploy.0 = Windows Vista Debug|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|Win32.ActiveCfg = Windows Vista Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|Win32.Build.0 = Windows Vista Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|Win32.Deploy.0 = Windows Vista Release|Win32
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|x64.ActiveCfg = Windows Vista Release|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|x64.Build.0 = Windows Vista Release|x64
- {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|x64.Deploy.0 = Windows Vista Release|x64
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Debug|Win32.ActiveCfg = Windows 8 Debug|Win32
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Debug|Win32.Build.0 = Windows 8 Debug|Win32
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Debug|Win32.Deploy.0 = Windows 8 Debug|Win32
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Debug|x64.ActiveCfg = Windows 8 Debug|x64
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Debug|x64.Build.0 = Windows 8 Debug|x64
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Release|Win32.ActiveCfg = Windows 8 Release|Win32
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Release|Win32.Build.0 = Windows 8 Release|Win32
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Release|Win32.Deploy.0 = Windows 8 Release|Win32
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Release|x64.ActiveCfg = Windows 8 Release|x64
+ {22166290-65D8-49D2-BB88-33201797C7D8}.Release|x64.Build.0 = Windows 8 Release|x64
{22166290-65D8-49D2-BB88-33201797C7D8}.Windows 7 Debug|Win32.ActiveCfg = Windows 7 Debug|Win32
{22166290-65D8-49D2-BB88-33201797C7D8}.Windows 7 Debug|Win32.Build.0 = Windows 7 Debug|Win32
{22166290-65D8-49D2-BB88-33201797C7D8}.Windows 7 Debug|Win32.Deploy.0 = Windows 7 Debug|Win32
{22166290-65D8-49D2-BB88-33201797C7D8}.Windows Vista Release|x64.ActiveCfg = Windows Vista Release|x64
{22166290-65D8-49D2-BB88-33201797C7D8}.Windows Vista Release|x64.Build.0 = Windows Vista Release|x64
{22166290-65D8-49D2-BB88-33201797C7D8}.Windows Vista Release|x64.Deploy.0 = Windows Vista Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Debug|Win32.ActiveCfg = Windows Vista Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Debug|Win32.Build.0 = Windows Vista Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Debug|Win32.Deploy.0 = Windows Vista Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Debug|x64.ActiveCfg = Windows Vista Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Debug|x64.Build.0 = Windows Vista Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Release|Win32.ActiveCfg = Windows Vista Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Release|Win32.Build.0 = Windows Vista Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Release|Win32.Deploy.0 = Windows Vista Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Release|x64.ActiveCfg = Windows Vista Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Release|x64.Build.0 = Windows Vista Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|Win32.ActiveCfg = Windows 7 Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|Win32.Build.0 = Windows 7 Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|Win32.Deploy.0 = Windows 7 Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|x64.ActiveCfg = Windows 7 Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|x64.Build.0 = Windows 7 Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Debug|x64.Deploy.0 = Windows 7 Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|Win32.ActiveCfg = Windows 7 Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|Win32.Build.0 = Windows 7 Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|Win32.Deploy.0 = Windows 7 Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|x64.ActiveCfg = Windows 7 Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|x64.Build.0 = Windows 7 Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows 7 Release|x64.Deploy.0 = Windows 7 Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|Win32.ActiveCfg = Windows Developer Preview Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|Win32.Build.0 = Windows Developer Preview Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|Win32.Deploy.0 = Windows Developer Preview Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|x64.ActiveCfg = Windows Developer Preview Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|x64.Build.0 = Windows Developer Preview Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Debug|x64.Deploy.0 = Windows Developer Preview Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|Win32.ActiveCfg = Windows Developer Preview Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|Win32.Build.0 = Windows Developer Preview Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|Win32.Deploy.0 = Windows Developer Preview Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|x64.ActiveCfg = Windows Developer Preview Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|x64.Build.0 = Windows Developer Preview Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Developer Preview Release|x64.Deploy.0 = Windows Developer Preview Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|Win32.ActiveCfg = Windows Vista Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|Win32.Build.0 = Windows Vista Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|Win32.Deploy.0 = Windows Vista Debug|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|x64.ActiveCfg = Windows Vista Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|x64.Build.0 = Windows Vista Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Debug|x64.Deploy.0 = Windows Vista Debug|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|Win32.ActiveCfg = Windows Vista Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|Win32.Build.0 = Windows Vista Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|Win32.Deploy.0 = Windows Vista Release|Win32
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|x64.ActiveCfg = Windows Vista Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|x64.Build.0 = Windows Vista Release|x64
+ {9B071A35-897C-477A-AEB7-95F77618A21D}.Windows Vista Release|x64.Deploy.0 = Windows Vista Release|x64
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Debug|Win32.Build.0 = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Debug|Win32.Deploy.0 = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Debug|x64.ActiveCfg = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Release|Win32.ActiveCfg = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Release|Win32.Build.0 = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Release|Win32.Deploy.0 = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Release|x64.ActiveCfg = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows 7 Debug|Win32.ActiveCfg = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows 7 Debug|Win32.Build.0 = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows 7 Debug|Win32.Deploy.0 = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows 7 Debug|x64.ActiveCfg = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows 7 Release|Win32.ActiveCfg = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows 7 Release|Win32.Build.0 = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows 7 Release|Win32.Deploy.0 = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows 7 Release|x64.ActiveCfg = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Developer Preview Debug|Win32.ActiveCfg = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Developer Preview Debug|Win32.Build.0 = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Developer Preview Debug|Win32.Deploy.0 = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Developer Preview Debug|x64.ActiveCfg = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Developer Preview Release|Win32.ActiveCfg = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Developer Preview Release|Win32.Build.0 = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Developer Preview Release|Win32.Deploy.0 = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Developer Preview Release|x64.ActiveCfg = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Debug|Win32.ActiveCfg = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Debug|Win32.Build.0 = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Debug|Win32.Deploy.0 = Debug|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Debug|x64.ActiveCfg = Debug|x64
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Debug|x64.Build.0 = Debug|x64
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Debug|x64.Deploy.0 = Debug|x64
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Release|Win32.ActiveCfg = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Release|Win32.Build.0 = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Release|Win32.Deploy.0 = Release|Win32
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Release|x64.ActiveCfg = Release|x64
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Release|x64.Build.0 = Release|x64
+ {2E61D2CC-865E-442C-8C83-B8DAFD7BBD3B}.Windows Vista Release|x64.Deploy.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
<ClCompile>
- <AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\include;$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__i386__;__MODULE__="XENIFACE";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
+++ /dev/null
-/* Copyright (c) Citrix Systems Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms,
- * with or without modification, are permitted provided
- * that the following conditions are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <windows.h>
-#include "stdafx.h"
-#include "NicInfo.h"
-#include "XSAccessor.h"
-#include <winsock2.h>
-#include <Iphlpapi.h>
-
-NicInfo::NicInfo() : netif_data(NULL), nr_netifs_found(0)
-{
- NicChangeEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- if (!NicChangeEvent) {
- XsLog("Failed to create NicChangeEvent");
- exit(1);
- }
-
- ResetEvent(NicChangeEvent);
-
- memset(&Overlap, 0, sizeof (Overlap));
- Overlap.hEvent = NicChangeEvent;
-}
-
-NicInfo::~NicInfo()
-{
- //CancelIPChangeNotify(&Overlap); <--- Function does not exist in 2k
-}
-
-void NicInfo::Prime()
-{
- DWORD dwRet;
- LONG Attempt;
-
- Attempt = 0;
-again:
- dwRet = NotifyAddrChange(&hAddrChange, &Overlap);
- if (dwRet != NO_ERROR) {
- dwRet = GetLastError();
- if (dwRet != ERROR_IO_PENDING) {
- XsLog("NotifyAddrChange(%d) failed: 0x%08x", Attempt, dwRet);
- if (++Attempt >= 5)
- return;
-
- Sleep(1000); // 1s
- goto again;
- }
- }
-}
-
-void NicInfo::Refresh()
-{
- GetNicInfo();
- XenstoreDoNicDump(nr_netifs_found, netif_data);
-}
-
-void NicInfo::GetNicInfo()
-{
- const char* domainVifPath = "device/vif";
- unsigned int entry;
- int i;
- unsigned int numEntries;
- char** vifEntries = NULL;
- char vifNode[MAX_XENBUS_PATH];
- PIP_ADAPTER_INFO IpAdapterInfo = NULL;
- PIP_ADAPTER_INFO currAdapterInfo;
- ULONG cbIpAdapterInfo;
- ULONG numIpAdapterInfo;
- char AdapterMac[MAX_CHAR_LEN];
-
- //
- // Get the list of vif #'s from xenstore
- //
- if (XenstoreList(domainVifPath, &vifEntries, &numEntries) < 0) {
- goto clean;
- }
- nr_netifs_found = 0;
- if (netif_data) {
- free(netif_data);
- netif_data = NULL;
- }
- netif_data = (VIFData *)calloc(sizeof(VIFData), numEntries);
- if (!netif_data) {
- goto clean;
- }
-
- //
- // Loop through xenstore and collect the vif number and the mac address
- //
- for (entry = 0; entry < numEntries; entry++) {
- netif_data[entry].ethnum = atoi(vifEntries[entry]);
- char* macAddress;
-#pragma prefast(suppress: 28719, "We know the max length of the string")
- sprintf(vifNode, "%s/mac", vifEntries[entry]);
- if (XenstoreRead(vifNode, &macAddress) != -1) {
-#pragma prefast(suppress: 28719, "We know the max length of the string")
- lstrcpyn(netif_data[entry].mac, macAddress, sizeof(netif_data[entry].mac));
- XenstoreFree(macAddress);
- }
- }
-
- //
- // Call GetAdaptersInfo to get a list of network device information.
- // Use this to cooralate a mac address to an IP address and the nics name.
- //
- cbIpAdapterInfo = 0;
- if (GetAdaptersInfo(NULL, &cbIpAdapterInfo) != ERROR_BUFFER_OVERFLOW) {
- goto clean;
- }
- IpAdapterInfo = (PIP_ADAPTER_INFO)malloc(cbIpAdapterInfo);
- if (!IpAdapterInfo) {
- goto clean;
- }
- if (GetAdaptersInfo(IpAdapterInfo, &cbIpAdapterInfo) != NO_ERROR) {
- goto clean;
- }
-
- currAdapterInfo = IpAdapterInfo;
- while (currAdapterInfo) {
-#pragma prefast(suppress:28719, "We know the max length of the string")
- sprintf(AdapterMac, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
- currAdapterInfo->Address[0], currAdapterInfo->Address[1], currAdapterInfo->Address[2],
- currAdapterInfo->Address[3], currAdapterInfo->Address[4], currAdapterInfo->Address[5]);
-
- for (entry = 0; entry < numEntries; entry++) {
- if (!lstrcmpi(AdapterMac, netif_data[entry].mac)) {
- //
- // Found the matching netif_data entry, so fill in the other values from
- // the IP_ADAPTER_INFO values.
- //
-#pragma prefast(suppress: 28719, "We know the max length of the string")
- lstrcpyn(netif_data[entry].name, currAdapterInfo->Description, sizeof(netif_data[entry].name));
-#pragma prefast(suppress: 28719, "We know the max length of the string")
- lstrcpyn(netif_data[entry].ip, currAdapterInfo->IpAddressList.IpAddress.String, sizeof(netif_data[entry].ip));
- break;
- }
- }
-
- currAdapterInfo = currAdapterInfo->Next;
- }
-
- nr_netifs_found = numEntries;
-clean:
- if (vifEntries) {
- for (entry = 0; entry < numEntries; entry++)
- XenstoreFree(vifEntries[entry]);
- XenstoreFree(vifEntries);
- }
- if (IpAdapterInfo) {
- free(IpAdapterInfo);
- }
-}
+++ /dev/null
-/* Copyright (c) Citrix Systems Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms,
- * with or without modification, are permitted provided
- * that the following conditions are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _NICINFO_H
-#define _NICINFO_H
-
-#include <string>
-#include <list>
-#include <map>
-
-#include "vm_stats.h"
-
-using namespace std;
-
-class NicInfo
-{
-public:
- NicInfo();
- ~NicInfo();
-
- void Refresh();
- void Prime();
- HANDLE NicChangeEvent;
-
-private:
- void GetNicInfo();
-
- int nr_netifs_found;
- VIFData *netif_data;
- HANDLE hAddrChange;
- OVERLAPPED Overlap;
-};
-
-#endif
+++ /dev/null
-/* Copyright (c) Citrix Systems Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms,
- * with or without modification, are permitted provided
- * that the following conditions are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#define _WIN32_DCOM
-#include <windows.h>
-#include <tchar.h>
-#include <stdio.h>
-#include <iostream>
-#include <wbemidl.h>
-
-#include "XSAccessor.h"
-#include "TSInfo.h"
-
-using namespace std;
-
-#pragma comment(lib, "wbemuuid.lib")
-
-TSInfo::TSInfo()
-{
-
- Init();
-}
-
-void TSInfo::Init()
-{
- HRESULT Result;
- OSVERSIONINFO VersionInfo;
- BSTR NameSpace;
-
- Result = CoInitializeEx(0,
- COINIT_MULTITHREADED);
- if (FAILED(Result))
- goto fail1;
-
- Result = CoInitializeSecurity(NULL,
- -1,
- NULL,
- NULL,
- RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
- RPC_C_IMP_LEVEL_IMPERSONATE,
- NULL,
- EOAC_NONE,
- NULL);
- if (FAILED(Result) && Result != RPC_E_TOO_LATE)
- goto fail2;
-
- Result = CoCreateInstance(CLSID_WbemLocator,
- 0,
- CLSCTX_INPROC_SERVER,
- IID_IWbemLocator,
- (LPVOID*)&pLocator);
- if (FAILED(Result))
- goto fail3;
-
- VersionInfo.dwOSVersionInfoSize = sizeof (VersionInfo);
- Result = WBEM_E_FAILED;
- if (!GetVersionEx(&VersionInfo))
- goto fail4;
-
- if (VersionInfo.dwMajorVersion >= 6)
- NameSpace = L"ROOT\\CIMV2\\TERMINALSERVICES";
- else
- NameSpace = L"ROOT\\CIMV2";
-
- Result = pLocator->ConnectServer(NameSpace,
- NULL,
- NULL,
- 0,
- NULL,
- 0,
- 0,
- &pNamespace);
- if (FAILED(Result))
- goto fail5;
-
- Result = CoSetProxyBlanket(pNamespace,
- RPC_C_AUTHN_WINNT,
- RPC_C_AUTHZ_NONE,
- NULL,
- RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
- RPC_C_IMP_LEVEL_IMPERSONATE,
- NULL,
- EOAC_NONE);
- if (FAILED(Result))
- goto fail6;
-
- Ready = TRUE;
-
- return;
-
-fail6:
- XsLog("%s: fail6\n", __FUNCTION__);
-
- pNamespace->Release();
-
-fail5:
- XsLog("%s: fail5\n", __FUNCTION__);
-
-fail4:
- XsLog("%s: fail4\n", __FUNCTION__);
-
- pLocator->Release();
-
-fail3:
- XsLog("%s: fail3\n", __FUNCTION__);
-
-fail2:
- XsLog("%s: fail2\n", __FUNCTION__);
-
- CoUninitialize();
-
-fail1:
- XsLog("%s: fail1 (%08x)\n", __FUNCTION__, Result);
-
- Ready = FALSE;
-}
-
-TSInfo::~TSInfo()
-{
- if (Ready) {
- pNamespace->Release();
-
- pLocator->Release();
-
- CoUninitialize();
- }
-}
-
-HRESULT
-TSInfo::Query(
- __out BOOLEAN *pEnabled
- )
-{
- HRESULT Result;
- IEnumWbemClassObject *pEnumerator = NULL;
- IWbemClassObject *pObject = NULL;
- ULONG Count;
- VARIANT Flag;
-
- if (!Ready) {
- Init();
- if (!Ready) {
- Result = WBEM_E_FAILED;
- goto fail_notready;
- }
- }
-
- Result = pNamespace->ExecQuery(L"WQL",
- L"SELECT * FROM Win32_TerminalServiceSetting",
- WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
- NULL,
- &pEnumerator);
- if (FAILED(Result))
- goto fail1;
-
- Count = 0;
- (VOID) pEnumerator->Next(WBEM_INFINITE,
- 1,
- &pObject,
- &Count);
-
- Result = WBEM_S_FALSE;
- if (Count == 0)
- goto fail2;
-
- Result = pObject->Get(L"AllowTSConnections",
- 0,
- &Flag,
- NULL,
- NULL);
-
- if (FAILED(Result))
- goto fail3;
-
- Result = WBEM_E_FAILED;
- if (V_VT(&Flag) != VT_I4)
- goto fail4;
-
- *pEnabled = (V_I4(&Flag) != 0) ? TRUE : FALSE;
-
- VariantClear(&Flag);
-
- pObject->Release();
-
- pEnumerator->Release();
-
- return WBEM_S_NO_ERROR;
-
-fail4:
- XsLog("%s: fail4\n", __FUNCTION__);
-
- VariantClear(&Flag);
-
-fail3:
- XsLog("%s: fail3\n", __FUNCTION__);
-
- pObject->Release();
-
-fail2:
- XsLog("%s: fail2\n", __FUNCTION__);
-
- pEnumerator->Release();
-
-fail1:
- XsLog("%s: fail1 (%08x)\n", __FUNCTION__, Result);
-
- return Result;
-
-fail_notready:
- XsLog("%s: fail not ready\n", __FUNCTION__);
-
- return WBEM_E_FAILED;
-
-}
-
-HRESULT
-TSInfo::Set(
- __in BOOLEAN Enable
- )
-{
- HRESULT Result;
- IEnumWbemClassObject *pEnumerator = NULL;
- IWbemClassObject *pObject = NULL;
- ULONG Count;
- BSTR ClassName = L"Win32_TerminalServiceSetting";
- IWbemClassObject *pClass = NULL;
- BSTR MethodName = L"SetAllowTSConnections";
- IWbemClassObject *pInParamsDefinition = NULL;
- IWbemClassObject *pClassInstance = NULL;
- IWbemClassObject *pOutParams = NULL;
- VARIANT Flag;
- VARIANT Path;
-
- if (!Ready) {
- Init();
- if (!Ready) {
- Result = WBEM_E_FAILED;
- goto fail_notready;
- }
- }
-
- Result = pNamespace->ExecQuery(L"WQL",
- L"SELECT * FROM Win32_TerminalServiceSetting",
- WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
- NULL,
- &pEnumerator);
- if (FAILED(Result))
- goto fail1;
-
- Count = 0;
- (VOID) pEnumerator->Next(WBEM_INFINITE,
- 1,
- &pObject,
- &Count);
-
- Result = WBEM_S_FALSE;
- if (Count == 0)
- goto fail2;
-
- Result = pNamespace->GetObject(ClassName,
- 0,
- NULL,
- &pClass,
- NULL);
- if (FAILED(Result))
- goto fail3;
-
- Result = pClass->GetMethod(MethodName,
- 0,
- &pInParamsDefinition,
- NULL);
- if (FAILED(Result))
- goto fail4;
-
- Result = pInParamsDefinition->SpawnInstance(0,
- &pClassInstance);
- if (FAILED(Result))
- goto fail5;
-
- V_VT(&Flag) = VT_I4;
- V_I4(&Flag) = (Enable) ? 1 : 0;
-
- Result = pClassInstance->Put(L"AllowTSConnections",
- 0,
- &Flag,
- 0);
- if (FAILED(Result))
- goto fail6;
-
- Result = pObject->Get(L"__PATH",
- 0,
- &Path,
- NULL,
- NULL);
- if (FAILED(Result))
- goto fail7;
-
- Result = pNamespace->ExecMethod(Path.bstrVal,
- MethodName,
- 0,
- NULL,
- pClassInstance,
- &pOutParams,
- NULL);
- if (FAILED(Result))
- goto fail8;
-
- pOutParams->Release();
-
- VariantClear(&Path);
-
- VariantClear(&Flag);
-
- pClassInstance->Release();
-
- pInParamsDefinition->Release();
-
- pClass->Release();
-
- pObject->Release();
-
- pEnumerator->Release();
-
- return WBEM_S_NO_ERROR;
-
-fail8:
- XsLog("%s: fail8\n", __FUNCTION__);
-
- VariantClear(&Path);
-
-fail7:
- XsLog("%s: fail7\n", __FUNCTION__);
-
- VariantClear(&Flag);
-
-fail6:
- XsLog("%s: fail6\n", __FUNCTION__);
-
- pClassInstance->Release();
-
-fail5:
- XsLog("%s: fail5\n", __FUNCTION__);
-
- pInParamsDefinition->Release();
-
-fail4:
- XsLog("%s: fail4\n", __FUNCTION__);
-
- pClass->Release();
-
-fail3:
- XsLog("%s: fail3\n", __FUNCTION__);
-
- pObject->Release();
-
-fail2:
- XsLog("%s: fail2\n", __FUNCTION__);
-
- pEnumerator->Release();
-
-fail1:
- XsLog("%s: fail1 (%08x)\n", __FUNCTION__, Result);
-
- return Result;
-
-fail_notready:
- XsLog("%s: fail not ready\n", __FUNCTION__);
-
- return WBEM_E_FAILED;
-}
-
-VOID
-TSInfo::Refresh()
-{
- HRESULT Result;
- BOOLEAN Enabled;
-
- Result = Query(&Enabled);
- if (FAILED(Result))
- goto fail1;
-
- XenstorePrintf("data/ts", "%d", (Enabled) ? 1 : 0);
-
- return;
-
-fail1:
- XsLog("%s: fail1 (%08x)\n", __FUNCTION__, Result);
-}
-
-VOID
-TSInfo::ProcessControl()
-{
- CHAR *Buffer;
- BOOLEAN Enable;
- HRESULT Result;
-
- if (XenstoreRead("control/ts", &Buffer) < 0)
- return;
-
- XenstoreRemove("control/ts");
-
- Enable = (strtol(Buffer, NULL, 0) != 0) ? TRUE : FALSE;
-
- Result = Set(Enable);
- if (FAILED(Result))
- goto fail1;
-
- XsLog("%s terminal services", (Enable) ? "Enabled" : "Disabled");
-
- Refresh();
-
- return;
-
-fail1:
- XsLog("%s: fail1 (%08x)\n", __FUNCTION__, Result);
-}
-
+++ /dev/null
-/* Copyright (c) Citrix Systems Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms,
- * with or without modification, are permitted provided
- * that the following conditions are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#ifndef _TSINFO_H
-#define _TSINFO_H
-
-#define _WIN32_DCOM
-#include <iostream>
-#include <wbemidl.h>
-
-class TSInfo {
-public:
- TSInfo();
- ~TSInfo();
-
- VOID Refresh(VOID);
- VOID ProcessControl(VOID);
-
-private:
- IWbemLocator *pLocator;
- IWbemServices *pNamespace;
-
- void Init();
- BOOLEAN Ready;
-
- HRESULT Query(BOOLEAN *);
- HRESULT Set(BOOLEAN);
-};
-
-#endif // _TSINFO
#include <algorithm>
#include <hash_map>
#include <stdio.h>
+#include "winerror.h"
#include "WMIAccessor.h"
#include "XService.h"
-#include "NicInfo.h"
+#include "comutil.h"
//#include "xs_private.h"
#include <wbemidl.h>
#pragma comment(lib, "wbemuuid.lib")
#pragma comment(lib, "uuid.lib")
-
+#pragma comment(lib, "comsuppw.lib")
BSTR mkBstr(const char *string, size_t len) {
BSTR res = NULL;
}
-
class WatchSink : public IWbemObjectSink
{
LONG m_lRef;
bool bDone;
HANDLE triggerevent;
-
+ HANDLE triggererror;
public:
char *path;
- WatchSink(HANDLE event, const char *path) {
- m_lRef = 0;
+ WatchSink(HANDLE event, HANDLE errorevent, const char *path) {
+ m_lRef = 1;
triggerevent = event;
+ triggererror = errorevent;
this->path = NULL;
if (path) {
this->path=(char *)XsAlloc(strlen(path)+1);
/* [in] */ IWbemClassObject __RPC_FAR *pObjParam
)
{
+ if (FAILED(hResult)) {
+ XsLog("WMI Asyc watch failed %p\n", this);
+ SetEvent(this->triggererror);
+ }
return WBEM_S_NO_ERROR;
}
{
IWbemServices *mpSvc;
IWbemServices *mpXSSvc;
- BOOLEAN com_initialized;
+
HANDLE owning_thread;
};
return wstring2string(wstr);
}
-IWbemClassObject *getClass(WMIAccessor *wmi, BSTR path) {
- if (wmi == NULL)
+IWbemClassObject *getClass(WMIAccessor **wmi, BSTR path) {
+ if (*wmi == NULL)
return NULL;
- ASSERT(wmi->mpXSSvc != NULL);
+
+ if ((*wmi)->mpXSSvc == NULL)
+ return NULL;
+
IWbemClassObject *returnedObject;
- HRESULT hres = wmi->mpXSSvc->GetObject(path,WBEM_FLAG_RETURN_WBEM_COMPLETE,
+ HRESULT hres = (*wmi)->mpXSSvc->GetObject(path,WBEM_FLAG_RETURN_WBEM_COMPLETE,
NULL, &returnedObject, NULL);
if (FAILED(hres)) {
returnedObject =NULL;
return returnedObject;
}
-IWbemClassObject *getObject(WMIAccessor *wmi, BSTR path) {
+IWbemClassObject *getObject(WMIAccessor **wmi, BSTR path) {
IEnumWbemClassObject *returnedEnum;
IWbemClassObject *returnedObject;
- if (wmi == NULL)
+ if (*wmi == NULL)
return NULL;
- ASSERT(wmi->mpXSSvc != NULL);
- HRESULT hres = wmi->mpXSSvc->CreateInstanceEnum(path, WBEM_FLAG_FORWARD_ONLY,
+ ASSERT((*wmi)->mpXSSvc != NULL);
+ HRESULT hres = (*wmi)->mpXSSvc->CreateInstanceEnum(path, WBEM_FLAG_FORWARD_ONLY,
NULL,
&returnedEnum);
if (FAILED(hres)) {
- DBGPRINT(("GetEnum failed\n"));
+ OutputDebugString("GetEnum failed\n");
returnedObject =NULL;
+ return returnedObject;
}
ULONG objects;
if (FAILED(hres) || objects < 1) {
- DBGPRINT(("GetFromEnum failed\n"));
+ OutputDebugString("GetFromEnum failed\n");
returnedObject =NULL;
}
return returnedObject;
}
-HRESULT methodExec(WMIAccessor* wmi, IWbemClassObject* instance, const wchar_t *methodname, IWbemClassObject *inMethodInst, IWbemClassObject **outMethodInst)
+HRESULT methodExec(WMIAccessor** wmi, IWbemClassObject* instance, const wchar_t *methodname, IWbemClassObject *inMethodInst, IWbemClassObject **outMethodInst)
{
HRESULT hres=E_FAIL ;
goto allocmethodname;
}
- hres = wmi->mpXSSvc->ExecMethod(instancepath.bstrVal, bmethodname, 0, NULL,inMethodInst, &outstore, NULL);
+ hres = (*wmi)->mpXSSvc->ExecMethod(instancepath.bstrVal, bmethodname, 0, NULL,inMethodInst, &outstore, NULL);
if (outMethodInst != NULL) {
*outMethodInst = NULL;
if (!FAILED(hres)){
allocpathname:
return hres;
}
-static IEnumWbemClassObject* runXSQuery(WMIAccessor *wmi, BSTR query)
+static IEnumWbemClassObject* runXSQuery(WMIAccessor **wmi, BSTR query)
{
if (wmi == NULL)
return NULL;
- ASSERT(wmi->mpXSSvc != NULL);
+ ASSERT((*wmi)->mpXSSvc != NULL);
// Use the IWbemServices pointer to make requests of WMI.
// Make requests here:
IEnumWbemClassObject* pEnumerator = NULL;
- HRESULT hres = wmi->mpXSSvc->ExecQuery(L"WQL",
+ HRESULT hres = (*wmi)->mpXSSvc->ExecQuery(L"WQL",
query,
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
return pEnumerator;
}
-VOID
-AddHotFixInfoToStore(WMIAccessor* wmi)
-{
- IEnumWbemClassObject *pEnum;
- char buffer2[4096];
- DWORD index;
- ULONG uReturn;
- IWbemClassObject *pclsObj;
- HRESULT hr;
- VARIANT vtData;
-
- index = 0;
- pEnum = runQuery(wmi, L"SELECT HotFixID FROM Win32_QuickFixEngineering");
- if (pEnum == NULL)
- return;
-
- while (1) {
- hr = pEnum->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
- if (FAILED(hr) || 0 == uReturn)
- break;
-
- hr = pclsObj->Get(L"HotFixID", 0, &vtData, NULL, NULL);
-
- if ( !FAILED(hr) ) {
- if ( vtData.vt == VT_BSTR ) {
- //
- // Windows replaces a hotfix id with "File 1" when it has been
- // replaced by a newer hotfix, so just ignore these.
- //
- if (_wcsicmp(vtData.bstrVal, L"File 1")) {
- string str = bstr2string(vtData.bstrVal);
- sprintf(buffer2, "attr/os/hotfixes/%d", index);
- XenstoreWrite(buffer2, str.c_str(), str.length());
- index++;
- }
- }
- VariantClear(&vtData);
- }
-
- pclsObj->Release();
- }
- pEnum->Release ();
+LONG wmicount = 0;
+static BOOLEAN com_initialized = false;
+static IWbemLocator *locator = 0;
+BOOL InitCom(void) {
+ HRESULT hres;
+ XsLog("Init COM");
+ hres = CoInitializeEx(0, COINIT_MULTITHREADED);
+ if (FAILED(hres)) {
+ goto err_out;
+ }
+ com_initialized = TRUE;
+ //wmi->owning_thread = GetCurrentThread();
+ //XsLog("Wmi connect thread %p", GetCurrentThread());
+ // Initialize COM security. Most of this is irrelevant to us.
+ XsLog("Init security");
+ hres = CoInitializeSecurity(
+ NULL, /* Security descriptor. Only relevant to servers */
+ -1, /* Nr. of auth services. Only relevant to servers */
+ NULL, /* List of auth services. Only relevant to servers */
+ NULL, /* Reserved */
+ RPC_C_AUTHN_LEVEL_DEFAULT, /* Default authentication. The
+ details don't really matter when
+ you're localhost. */
+ RPC_C_IMP_LEVEL_IMPERSONATE, /* WMI needs to be able to
+ impersonate us. */
+ NULL, /* Authentication info */
+ EOAC_NONE, /* Additional capabilities */
+ NULL /* Reserved */
+ );
+ if (FAILED(hres)) {
+ goto err_out;
+ }
+ OutputDebugString("CreateInstance\n");
+ hres = CoCreateInstance(
+ CLSID_WbemLocator,
+ 0,
+ CLSCTX_INPROC_SERVER,
+ IID_IWbemLocator,
+ (LPVOID *) &locator);
+ OutputDebugString("Check hres\n");
+ if (FAILED(hres)) {
+ goto err_out;
+ }
+ if (locator == NULL) {
+ OutputDebugString("Null locator");
+ goto err_out;
+ }
+ return true;
+err_out:
+ return false;
}
-void ConnectToWMI(void)
+BOOL ConnectToWMI(void)
{
+ InitCom();
+ HRESULT hres;
+ OutputDebugString("Connect to WMI");
+ wmicount++;
+
+ wmi = (struct WMIAccessor *)XsAlloc(sizeof(*wmi));
+ if (wmi == NULL) {
+ return false;
+ }
+ memset(wmi, 0, sizeof(*wmi));
+
+
+ OutputDebugString("Connect Server\n");
+ try {
+ hres = locator->ConnectServer(
+ L"root\\CIMV2", // WMI namespace
+ NULL, // User name
+ NULL, // User password
+ NULL, // Locale
+ 0, // Security flags
+ NULL, // Authority
+ NULL, // Context object
+ &(wmi->mpSvc) // IWbemServices proxy
+ );
+ }
+ catch(...) {
+ OutputDebugString("Exception connecting to server\n");
+ goto err_out;
+ }
+
+ OutputDebugString("Check result\n");
+ if (FAILED(hres)) {
+ goto err_out;
+ }
+ /* WMI needs to impersonate us, because it normally runs as an
+ unprivileged user and needs our authority in order to access
+ device files and so forth. Turn impersonation on. */
+ OutputDebugString("Proxy blanket\n");
+ hres = CoSetProxyBlanket(
+ wmi->mpSvc, // the proxy to set
+ RPC_C_AUTHN_WINNT, /* LAN manager authentication,
+ although it doesn't really
+ matter on localhost. */
+ RPC_C_AUTHZ_NONE, // LANMAN can't do much authorization.
+ NULL, // Server principal name
+ RPC_C_AUTHN_LEVEL_CALL, // Do authentication on every call
+ RPC_C_IMP_LEVEL_IMPERSONATE, // Allow full impersonation.
+ NULL, // Use current client identity
+ EOAC_NONE // No extended proxy capabilities
+ );
+ if (FAILED(hres)) {
+ goto err_out;
+ }
+ OutputDebugString("WMI Server\n");
+ hres = locator->ConnectServer(
+ L"root\\WMI", // WMI namespace
+ NULL, // User name
+ NULL, // User password
+ NULL, // Locale
+ 0, // Security flags
+ NULL, // Authority
+ NULL, // Context object
+ &wmi->mpXSSvc // IWbemServices proxy
+ );
+
+ if (FAILED(hres)) {
+ goto err_out;
+ }
+ OutputDebugString("Impersonation\n");
+ /* WMI needs to impersonate us, because it normally runs as an
+ unprivileged user and needs our authority in order to access
+ device files and so forth. Turn impersonation on. */
+ hres = CoSetProxyBlanket(
+ wmi->mpXSSvc, // the proxy to set
+ RPC_C_AUTHN_WINNT, /* LAN manager authentication,
+ although it doesn't really
+ matter on localhost. */
+ RPC_C_AUTHZ_NONE, // LANMAN can't do much authorization.
+ NULL, // Server principal name
+ RPC_C_AUTHN_LEVEL_CALL, // Do authentication on every call
+ RPC_C_IMP_LEVEL_IMPERSONATE, // Allow full impersonation.
+ NULL, // Use current client identity
+ EOAC_NONE // No extended proxy capabilities
+ );
+ if (FAILED(hres)) {
+ goto err_out;
+ }
+
+
+ OutputDebugString("Wmi connected\n");
+ /* All done. */
+ return true;
- IWbemLocator *locator;
- HRESULT hres;
-
- wmi = (struct WMIAccessor *)XsAlloc(sizeof(*wmi));
- if (wmi == NULL) {
- return;
- }
- memset(wmi, 0, sizeof(*wmi));
-
- hres = CoInitializeEx(0, COINIT_MULTITHREADED);
- if (FAILED(hres)) {
- goto err_out;
- }
- wmi->com_initialized = TRUE;
- wmi->owning_thread = GetCurrentThread();
-
- // Initialize COM security. Most of this is irrelevant to us.
- hres = CoInitializeSecurity(
- NULL, /* Security descriptor. Only relevant to servers */
- -1, /* Nr. of auth services. Only relevant to servers */
- NULL, /* List of auth services. Only relevant to servers */
- NULL, /* Reserved */
- RPC_C_AUTHN_LEVEL_DEFAULT, /* Default authentication. The
- details don't really matter when
- you're localhost. */
- RPC_C_IMP_LEVEL_IMPERSONATE, /* WMI needs to be able to
- impersonate us. */
- NULL, /* Authentication info */
- EOAC_NONE, /* Additional capabilities */
- NULL /* Reserved */
- );
- if (FAILED(hres)) {
- goto err_out;
- }
-
- hres = CoCreateInstance(
- CLSID_WbemLocator,
- 0,
- CLSCTX_INPROC_SERVER,
- IID_IWbemLocator,
- (LPVOID *) &locator);
- if (FAILED(hres)) {
- goto err_out;
- }
- hres = locator->ConnectServer(
- L"root\\CIMV2", // WMI namespace
- NULL, // User name
- NULL, // User password
- NULL, // Locale
- 0, // Security flags
- NULL, // Authority
- NULL, // Context object
- &wmi->mpSvc // IWbemServices proxy
- );
- locator->Release();
- if (FAILED(hres)) {
- goto err_out;
- }
+err_out:
+ OutputDebugString("WMI connection failed\n");
+ ReleaseWMIAccessor(&wmi);
+ return false;
+}
- /* WMI needs to impersonate us, because it normally runs as an
- unprivileged user and needs our authority in order to access
- device files and so forth. Turn impersonation on. */
- hres = CoSetProxyBlanket(
- wmi->mpSvc, // the proxy to set
- RPC_C_AUTHN_WINNT, /* LAN manager authentication,
- although it doesn't really
- matter on localhost. */
- RPC_C_AUTHZ_NONE, // LANMAN can't do much authorization.
- NULL, // Server principal name
- RPC_C_AUTHN_LEVEL_CALL, // Do authentication on every call
- RPC_C_IMP_LEVEL_IMPERSONATE, // Allow full impersonation.
- NULL, // Use current client identity
- EOAC_NONE // No extended proxy capabilities
- );
- if (FAILED(hres)) {
- goto err_out;
- }
- hres = CoCreateInstance(
- CLSID_WbemLocator,
- 0,
- CLSCTX_INPROC_SERVER,
- IID_IWbemLocator,
- (LPVOID *) &locator);
- if (FAILED(hres)) {
- goto err_out;
- }
- hres = locator->ConnectServer(
- L"root\\WMI", // WMI namespace
- NULL, // User name
- NULL, // User password
- NULL, // Locale
- 0, // Security flags
- NULL, // Authority
- NULL, // Context object
- &wmi->mpXSSvc // IWbemServices proxy
- );
- locator->Release();
- if (FAILED(hres)) {
- goto err_out;
- }
+void ReleaseCom(void) {
- /* WMI needs to impersonate us, because it normally runs as an
- unprivileged user and needs our authority in order to access
- device files and so forth. Turn impersonation on. */
- hres = CoSetProxyBlanket(
- wmi->mpXSSvc, // the proxy to set
- RPC_C_AUTHN_WINNT, /* LAN manager authentication,
- although it doesn't really
- matter on localhost. */
- RPC_C_AUTHZ_NONE, // LANMAN can't do much authorization.
- NULL, // Server principal name
- RPC_C_AUTHN_LEVEL_CALL, // Do authentication on every call
- RPC_C_IMP_LEVEL_IMPERSONATE, // Allow full impersonation.
- NULL, // Use current client identity
- EOAC_NONE // No extended proxy capabilities
- );
- if (FAILED(hres)) {
- goto err_out;
+ if (com_initialized) {
+ OutputDebugString("Release locator\n");
+ locator->Release();
+ //XsLog("Wmi disconnect thread %p", GetCurrentThread());
+ //ASSERT((*wmi)->owning_thread == GetCurrentThread());
+ com_initialized = 0;
+ OutputDebugString("Uninitialize com\n");
+ CoUninitialize();
+
}
-
-
-
- /* All done. */
- return;
-
-err_out:
- ReleaseWMIAccessor(wmi);
- return;
}
/* Careful: WMI accessors must be released on the same thread that
allocated them. */
-void ReleaseWMIAccessor(struct WMIAccessor *wmi)
+void ReleaseWMIAccessor(struct WMIAccessor **wmi)
{
- if (wmi == NULL)
+ OutputDebugString("Should I release wmi?\n");
+ if (*wmi == NULL)
return;
- if (wmi->mpXSSvc != NULL)
- wmi->mpXSSvc->Release();
- if (wmi->mpSvc != NULL)
- wmi->mpSvc->Release();
- if (wmi->com_initialized) {
- ASSERT(wmi->owning_thread == GetCurrentThread());
- CoUninitialize();
- }
+ OutputDebugString("Get rid of WMI servers\n");
+ if ((*wmi)->mpXSSvc != NULL)
+ (*wmi)->mpXSSvc->Release();
+ if ((*wmi)->mpSvc != NULL)
+ (*wmi)->mpSvc->Release();
+ OutputDebugString("Clear WmI\n");
/* Poison wmi to make use-after-free()s a bit more obvious. */
- memset(wmi, 0xab, sizeof(*wmi));
- free(wmi);
+ memset((*wmi), 0xab, sizeof(**wmi));
+ XsFree(*wmi);
+ *wmi = NULL;
+ ReleaseCom();
+ OutputDebugString("Released WMI\n");
}
/* The fact that something is documented as being a uint64_t field
IWbemClassObject *pclsObj;
HRESULT hr;
ULONG uReturn;
- uint64_t result;
query_len = strlen("SELECT FROM ") + wcslen(field) + wcslen(table) + 1;
query = SysAllocStringLen(NULL, query_len);
QueryBstr(WMIAccessor *wmi, PWCHAR field, PWCHAR table)
{
HRESULT hr;
- BSTR res;
VARIANT vt;
memset(&vt, 0, sizeof(vt));
return vt.bstrVal;
}
-void GetWMIData(WMIAccessor *wmi, VMData& data)
-{
- data.meminfo_free = QueryUint64(wmi, L"FreePhysicalMemory",
- L"Win32_OperatingSystem");
- //
- // Get total memory. We don't support ballooning, and so this can't
- // change for the life of the VM.
- //
-
- static int64_t meminfo_total;
- if (meminfo_total == 0) {
- meminfo_total = QueryUint64(wmi, L"TotalPhysicalMemory",
- L"Win32_ComputerSystem");
- /* For some reason, TotalPhysicalMemory is in bytes but
- FreePhysicalMemoryy is in megabytes. The agent expects
- megabytes, so do the conversion here. */
- meminfo_total >>= 10;
- }
- data.meminfo_total = meminfo_total;
-}
-
-void DumpOSData(WMIAccessor *wmi)
-{
- BSTR os_name;
- BSTR host_name;
- BSTR domain;
-
- os_name = QueryBstr(wmi, L"Name", L"Win32_OperatingSystem");
- if (os_name != NULL) {
- string str = bstr2string(os_name);
- SysFreeString(os_name);
-
- XenstoreWrite("data/os_name", str.c_str(), str.length());
- }
- host_name = QueryBstr(wmi, L"Name", L"Win32_ComputerSystem");
- if (host_name != NULL) {
- string str = bstr2string(host_name);
- SysFreeString(host_name);
- XenstoreWrite("data/host_name", str.c_str(), str.length());
- }
- domain = QueryBstr(wmi, L"Domain", L"Win32_ComputerSystem");
- if (domain != NULL) {
- string str = bstr2string(domain);
- SysFreeString(domain);
-
- XenstoreWrite("data/domain", str.c_str(), str.length());
- }
-}
/* hash comparator for strings which strips off trailing .exe
* suffix */
};
-IWbemClassObject *getBase(WMIAccessor* wmi)
+IWbemClassObject *getBase(WMIAccessor** wmi)
{
- return getObject(wmi, L"CitrixXenStoreBase");
+ IWbemClassObject* base = getObject(wmi, L"CitrixXenStoreBase");
+ if (base == NULL) {
+ *wmi = NULL;
+ return NULL;
+ }
+ return base;
}
-IWbemClassObject *getBaseClass(WMIAccessor* wmi)
+
+IWbemClassObject *getBaseClass(WMIAccessor** wmi)
{
- return getClass(wmi, L"CitrixXenStoreBase");
+ IWbemClassObject* baseclass = getClass(wmi, L"CitrixXenStoreBase");
+ if (baseclass == NULL) {
+ *wmi = NULL;
+ return NULL;
+ }
+ return baseclass;
}
ULONGLONG get64BitUnsigned(VARIANT *var) {
return res;
}
-FILETIME WmiGetXenTime(WMIAccessor *wmi) {
+FILETIME WmiGetXenTime(WMIAccessor **wmi) {
FILETIME out;
- IWbemClassObject *base = getBase(wmi);
+
+ IWbemClassObject *base = getBase(wmi);
if (base == NULL) {
DBGPRINT(("Unable to find base WMI session\n"));
- out.dwLowDateTime = 0;
- out.dwHighDateTime = 0;
- return out ;
+ goto getbasefailed;
}
+
VARIANT timevar;
BSTR timename = mkBstr("XenTime", 7);
- base->Get(timename, 0, &timevar, NULL, NULL);
+ if (timename == NULL)
+ goto buildtimenamefailed;
+
+
+
+ if (FAILED(base->Get(timename, 0, &timevar, NULL, NULL)))
+ goto gettimefailed;
ULONGLONG time =get64BitUnsigned(&timevar);;
out.dwHighDateTime = (DWORD)(time>>32);
return out;
+gettimefailed:
+buildtimenamefailed:
+getbasefailed:
+ out.dwLowDateTime = 0;
+ out.dwHighDateTime = 0;
+ return out ;
}
-IWbemClassObject *openSession(WMIAccessor* wmi, const char *sessionname)
+IWbemClassObject *openSession(WMIAccessor** wmi, const char *sessionname)
{
HRESULT hres;
BSTR query = formatBstr("SELECT * FROM CitrixXenStoreSession WHERE Id=\"Citrix Xen Win32 Service : %s\"", sessionname);
-
+ if (query == NULL)
+ goto formatsessionbstrfailed;
IEnumWbemClassObject * sessions = runXSQuery(wmi, query);
SysFreeString(query);
+
if (sessions) {
IWbemClassObject *returnedObject;
ULONG count;
hres = sessions->Next(WBEM_INFINITE, 1, &returnedObject, &count);
- sessions->Release();
+ sessions->Release();
+
if (count>0) {
if (sessionname !=NULL ) {
- WmiSessionEnd(wmi, returnedObject);
+ if (!WmiSessionEnd(wmi, returnedObject)) {
+ return NULL;
+ }
}
else {
return returnedObject;
}
}
}
+
IWbemClassObject *base = getBase(wmi);
if (base==NULL) {
DBGPRINT(("Unable to find base WMI session\n"));
- return NULL;
+ goto getbasefailed;
}
+
IWbemClassObject *baseclass = getBaseClass(wmi);
+
+ if (baseclass == NULL)
+ goto getbaseclassfailed;
+
IWbemClassObject *inMethod;
- IWbemClassObject *outMethod;
+
IWbemClassObject *inMethodInst;
IWbemClassObject *outMethodInst;
- baseclass->GetMethod(L"AddSession",0,&inMethod, &outMethod);
+ if (FAILED(baseclass->GetMethod(L"AddSession",0,&inMethod, NULL)))
+ goto getmethodaddsessionfailed;
+
+ if (FAILED(inMethod->SpawnInstance(0, &inMethodInst)))
+ goto inmethodspawnfailed;
- inMethod->SpawnInstance(0, &inMethodInst);
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal=formatBstr("Citrix Xen Win32 Service : %s", sessionname);
- inMethodInst->Put(L"Id", 0, &var, 0);
- methodExec(wmi, base, L"AddSession", inMethodInst, &outMethodInst);
- VariantClear(&var);
- outMethodInst->Get(L"SessionId", 0, &var, NULL, NULL);
+
+ if (var.bstrVal == NULL)
+ goto formatnamebstrfailed;
+
+ if (FAILED(inMethodInst->Put(L"Id", 0, &var, 0)))
+ goto methodputfailed;
+
+ if (FAILED(methodExec(wmi, base, L"AddSession", inMethodInst, &outMethodInst)))
+ goto methodexecaddsessionfailed;
+
+ if (FAILED(outMethodInst->Get(L"SessionId", 0, &var, NULL, NULL)))
+ goto outmethodgetfailed;
ULONG query_len;
query_len = strlen("SELECT * FROM CitrixXenStoreSession WHERE SessionId=")+10;
query = SysAllocStringLen(NULL, query_len);
+
+ if (query == NULL)
+ goto allocqueryfailed;
+
swprintf_s(query,query_len, L"SELECT * FROM CitrixXenStoreSession WHERE SessionId=%d", var.uintVal);
sessions = runXSQuery(wmi, query );
+ SysFreeString(query);
if (sessions) {
- IWbemClassObject *returnedObject;
+ IWbemClassObject *returnedObject;
ULONG count;
hres = sessions->Next(WBEM_INFINITE, 1, &returnedObject, &count);
+ sessions->Release();
if (count>0) {
- sessions->Release();
return returnedObject;
}
- sessions->Release();
+
}
-
+
+ outMethodInst->Release();
+ VariantClear(&var);
+ inMethodInst->Release();
+ inMethod->Release();
base->Release();
+ baseclass->Release();
return NULL;
+
+allocqueryfailed:
+outmethodgetfailed:
+ outMethodInst->Release();
+
+methodexecaddsessionfailed:
+methodputfailed:
+ VariantClear(&var);
+
+formatnamebstrfailed:
+ inMethodInst->Release();
+inmethodspawnfailed:
+ inMethod->Release();
+
+
+getmethodaddsessionfailed:
+ baseclass->Release();
+
+getbaseclassfailed:
+ base->Release();
+
+getbasefailed:
+
+
+formatsessionbstrfailed:
+ return NULL;
}
-IWbemClassObject* sessionMethodStart(WMIAccessor*wmi,
+IWbemClassObject* sessionMethodStart(WMIAccessor**wmi,
const wchar_t *methodname)
{
IWbemClassObject *inMethod;
- IWbemClassObject *outMethod;
IWbemClassObject *inMethodInst = NULL;
IWbemClassObject *sessionClass;
+ HRESULT hr;
+
+ ASSERT(wmi != NULL);
+
sessionClass = getClass(wmi, L"CitrixXenStoreSession");
- if (sessionClass!=NULL) {
- sessionClass->GetMethod(methodname,0,&inMethod, &outMethod);
- inMethod->SpawnInstance(0, &inMethodInst);
- }
- return inMethodInst;
+ if (sessionClass == NULL)
+ goto getclassfailed;
+
+ hr = sessionClass->GetMethod(methodname,0,&inMethod, NULL);
+ if (FAILED(hr))
+ goto getmethodfailed;
+
+ hr = inMethod->SpawnInstance(0, &inMethodInst);
+ if (FAILED(hr))
+ goto spawninstancefailed;
+
+ inMethod->Release();
+
+ sessionClass->Release();
+ return inMethodInst;
+
+
+spawninstancefailed:
+ inMethod->Release();
+
+getmethodfailed:
+ sessionClass->Release();
+
+getclassfailed:
+ return NULL;
}
-char * bstrToChar(BSTR bst) {
- size_t size = wcslen(bst);
- char *space = (char *)XsAlloc(size+1);
- wcstombs_s(&size, space, size+1, bst, _TRUNCATE);
+char * bstrToChar(BSTR bst, size_t *len) {
+ *len = wcslen(bst);
+ char *space = (char *)XsAlloc(*len+1);
+ if (space)
+ wcstombs_s(len, space, *len+1, bst, _TRUNCATE);
return space;
}
-void WmiSessionLog(WMIAccessor* wmi, void **sessionhandle,const char *fmt, va_list args) {
+void WmiSessionLog(WMIAccessor** wmi, void **sessionhandle,const char *fmt, va_list args) {
IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
char* message = formatCharStrInt(fmt,args);
+ OutputDebugString(message);
+ if (((*wmi)==NULL) || ((*sessionhandle)==NULL) ) {
+ goto nowmi;
+ }
VARIANT vmessage;
if (setVariantString(&vmessage, message))
goto setvmessage;
if (!inMethodInst)
goto sessionstart;
- inMethodInst->Put(L"Message",0,&vmessage,0);
+ if (FAILED(inMethodInst->Put(L"Message",0,&vmessage,0)))
+ goto methodputfailed;
- methodExec(wmi,*session, L"Log", inMethodInst, NULL);
+ if (FAILED(methodExec(wmi,*session, L"Log", inMethodInst, NULL)))
+ goto methodexecfailed;
+
+methodexecfailed:
+methodputfailed:
+ inMethodInst->Release();
sessionstart:
VariantClear(&vmessage);
+
setvmessage:
+nowmi:
return;
}
-char **WmiSessionGetChildren(WMIAccessor* wmi, void **sessionhandle,
- const char * path, unsigned *numentries) {
-
- char **outarray = NULL;
- IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
-
-
- VARIANT vpath;
- if (setVariantString(&vpath, path)){
- goto setvpath;
- }
- IWbemClassObject *outMethodInst;
- IWbemClassObject *inMethodInst = sessionMethodStart( wmi, L"GetChildren");
- if (!inMethodInst)
- goto sessionstart;
- inMethodInst->Put(L"PathName",0,&vpath,0);
- methodExec(wmi,*session, L"GetChildren", inMethodInst, &outMethodInst);
- if (outMethodInst==NULL) {
- *numentries = 0;
- goto sessionExec;
- }
-
- VARIANT children;
- VariantInit(&children);
- outMethodInst->Get(L"children", 0, &children, NULL, NULL);
-
- IWbemClassObject* innerobj = (IWbemClassObject *)(children.byref);
-
- VARIANT noOfChildren;
- innerobj->Get(L"NoOfChildNodes", 0, &noOfChildren, NULL, NULL);
-
-
- VARIANT childNodeArray;
-
- innerobj->Get(L"ChildNodes", 0, &childNodeArray, NULL, NULL);
-
- LONG i;
- *numentries = -1;
- if (noOfChildren.lVal >0) {
- outarray = (char **)XsAlloc(sizeof(char *) * noOfChildren.lVal);
- for (i = 0; i< noOfChildren.lVal; i++) {
-
- BSTR arrayentry;
- HRESULT hres = SafeArrayGetElement(childNodeArray.parray, &i, &arrayentry);
- if (FAILED(hres)) {
- }
- outarray[i] = bstrToChar(arrayentry);
- }
-
- *numentries = noOfChildren.lVal;
- }
- VariantClear(&childNodeArray);
- VariantClear(&noOfChildren);
- VariantClear(&children);
-
-
- if (outMethodInst != NULL) {
- outMethodInst->Release();
- }
-sessionExec:
-sessionstart:
-setvpath:
-
- return outarray;
-
-}
-
-
-char* WmiSessionGetEntry(WMIAccessor* wmi, void **sessionhandle,
+char* WmiSessionGetEntry(WMIAccessor** wmi, void **sessionhandle,
const char * path, size_t* len)
{
IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
VARIANT vpath;
- if (setVariantString(&vpath, path)){
+ if (setVariantString(&vpath, path))
goto setvpath;
- }
+
IWbemClassObject *outMethodInst;
+
IWbemClassObject *inMethodInst = sessionMethodStart( wmi, L"GetValue");
- inMethodInst->Put(L"PathName",0,&vpath,0);
+ if (inMethodInst == NULL)
+ goto sessionmethodstartfailed;
+
+ if (FAILED(inMethodInst->Put(L"PathName",0,&vpath,0)))
+ goto methodexecfailed;
+
methodExec(wmi,*session, L"GetValue", inMethodInst, &outMethodInst);
if (outMethodInst==NULL)
goto sessionExec;
VARIANT outval;
VariantInit(&outval);
- outMethodInst->Get(L"value", 0, &outval, NULL, NULL);
+ if (FAILED(outMethodInst->Get(L"value", 0, &outval, NULL, NULL)))
+ goto methodgetfailed;
- char *space = bstrToChar(outval.bstrVal);
-
+ char *space = bstrToChar(outval.bstrVal, len);
+
+ outMethodInst->Release();
+ inMethodInst->Release();
+ VariantClear(&vpath);
VariantClear(&outval);
return space;
-setvpath:
+
+methodgetfailed:
+ outMethodInst->Release();
+
+methodexecfailed:
sessionExec:
+ inMethodInst->Release();
+
+sessionmethodstartfailed:
+ VariantClear(&vpath);
+
+setvpath:
*len = 0;
return NULL;
}
-int WmiSessionSetEntry(WMIAccessor* wmi, void **sessionhandle,
+int WmiSessionSetEntry(WMIAccessor** wmi, void **sessionhandle,
const char*path, const char * value, size_t len)
{
int err = -1;
IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
VARIANT vpath;
- if (setVariantString(&vpath, path)){
+ if (setVariantString(&vpath, path))
goto setvpath;
- }
+
VARIANT vvalue;
if (setVariantString(&vvalue, value))
goto setvvalue;
+
IWbemClassObject *outMethodInst;
+
IWbemClassObject *inMethodInst = sessionMethodStart( wmi, L"SetValue");
if (!inMethodInst)
goto sessionstart;
+
inMethodInst->Put(L"PathName",0,&vpath,0);
inMethodInst->Put(L"value",0,&vvalue,0);
- methodExec(wmi,*session, L"SetValue", inMethodInst, &outMethodInst);
+
+ if (FAILED(methodExec(wmi,*session, L"SetValue", inMethodInst, &outMethodInst)))
+ goto methodexecfailed;
+
if (outMethodInst==NULL)
goto sessionExec;
err=0;
+methodexecfailed:
sessionExec:
-sessionstart:
+ inMethodInst->Release();
+sessionstart:
SysFreeString(vvalue.bstrVal);
-setvvalue:
+setvvalue:
SysFreeString(vpath.bstrVal);
+
setvpath:
return err;
}
-int WmiSessionSetEntry(WMIAccessor* wmi, void **sessionhandle,
+int WmiSessionSetEntry(WMIAccessor** wmi, void **sessionhandle,
const char*path, const char * value) {
return WmiSessionSetEntry(wmi, sessionhandle, path, value, strlen(value));
}
-int WmiSessionRemoveEntry(WMIAccessor* wmi, void **sessionhandle,
+int WmiSessionRemoveEntry(WMIAccessor** wmi, void **sessionhandle,
const char*path){
+
int err = -1;
IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
VARIANT vpath;
- if (setVariantString(&vpath, path)){
+ if (setVariantString(&vpath, path))
goto setvpath;
- }
+
IWbemClassObject *inMethodInst = sessionMethodStart( wmi, L"RemoveValue");
if (!inMethodInst)
goto sessionstart;
- inMethodInst->Put(L"PathName",0,&vpath,0);
+
+ if (FAILED(inMethodInst->Put(L"PathName",0,&vpath,0)))
+ goto methodputfailed;
+
IWbemClassObject* outMethodInst;
- methodExec(wmi,*session, L"RemoveValue", inMethodInst, &outMethodInst);
+
+ if (FAILED(methodExec(wmi,*session, L"RemoveValue", inMethodInst, &outMethodInst)))
+ goto methodexecfailed;
+
if (outMethodInst==NULL)
goto sessionExec;
outMethodInst->Release();
err=0;
+methodexecfailed:
+methodputfailed:
+ inMethodInst->Release();
+
sessionstart:
VariantClear(&vpath);
+
sessionExec:
setvpath:
return err;
}
-int WmiSessionTransactionStart(WMIAccessor* wmi, void **sessionhandle)
-{
- IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
-
- if (FAILED(methodExec(wmi,*session, L"StartTransaction", NULL,NULL))) {
- return 0;
- }
- return 1;
-}
-
-int WmiSessionTransactionCommit(WMIAccessor* wmi, void **sessionhandle)
-{
- IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
-
- if (FAILED(methodExec(wmi,*session, L"CommitTransaction", NULL,NULL))) {
- return 0;
- }
- return 1;
-}
-
-int WmiSessionTransactionAbort(WMIAccessor* wmi, void **sessionhandle)
-{
- IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
-
- if (FAILED(methodExec(wmi,*session, L"AbortTransaction", NULL,NULL))) {
- return 0;
- }
- return 1;
-}
-
-void WmiSessionUnwatch(WMIAccessor* wmi, void **sessionhandle,
+BOOL WmiSessionUnwatch(WMIAccessor** wmi, void **sessionhandle,
void *watchhandle) {
IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
-
+ XsLog("Unwatch %p",watchhandle);
WatchSink * sink = (WatchSink *)watchhandle;
VARIANT vpath;
- if (setVariantString(&vpath, sink->path)){
+ if (setVariantString(&vpath, sink->path))
goto setvpath;
- }
+
IWbemClassObject *outMethodInst;
IWbemClassObject *inMethodInst = sessionMethodStart( wmi, L"RemoveWatch");
if (!inMethodInst)
goto sessionstart;
+
inMethodInst->Put(L"PathName",0,&vpath,0);
- methodExec(wmi,*session, L"RemoveWatch", inMethodInst, &outMethodInst);
+ if FAILED(methodExec(wmi,*session, L"RemoveWatch", inMethodInst, &outMethodInst))
+ goto methodexecfailed;
if (outMethodInst==NULL)
- goto sessionExec;
+ goto sessionexecfailed;
+
outMethodInst->Release();
-sessionExec:
+
+methodexecfailed:
+sessionexecfailed:
inMethodInst->Release();
+
sessionstart:
setvpath:
sink->Release();
+ return true;
}
-void WmiSessionStart(WMIAccessor* wmi, void **sessionhandle, const char* sessionname)
+BOOL WmiSessionStart(WMIAccessor** wmi, void **sessionhandle, const char* sessionname)
{
IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
- *session = openSession(wmi, sessionname);
+ if ((*session = openSession(wmi, sessionname)) == NULL) {
+ return false;
+ }
+ return true;
}
-void WmiSessionEnd(WMIAccessor* wmi, void *sessionhandle)
+BOOL WmiSessionEnd(WMIAccessor** wmi, void *sessionhandle)
{
+ HRESULT hr;
+ ASSERT(*wmi != NULL);
+
IWbemClassObject *session = (IWbemClassObject *)sessionhandle;
if (session==NULL) {
- return;
+ return false;
}
- methodExec(wmi, session, L"EndSession", NULL,NULL);
+ hr = methodExec(wmi, session, L"EndSession", NULL,NULL);
+ if FAILED(hr)
+ goto execmethodfailed;
session->Release();
+ return true;
+
+execmethodfailed:
+ return false;
}
-void *WmiSessionWatch(WMIAccessor* wmi, void **sessionhandle,
- const char *path, HANDLE event) {
+void *WmiSessionWatch(WMIAccessor** wmi, void **sessionhandle,
+ const char *path, HANDLE event, HANDLE errorevent) {
-
+ HRESULT hr;
+
IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
-
- WatchSink * sink = new WatchSink(event, path);
- BSTR query=formatBstr("SELECT * from CitrixXenStoreWatchEvent WHERE EventId=\"%s\"", path);
+
+ ASSERT((*wmi) != NULL);
+ ASSERT((*sessionhandle) != NULL);
- wmi->mpXSSvc->ExecNotificationQueryAsync(L"WQL", query,0,NULL, sink);
+ WatchSink * sink = new WatchSink(event, errorevent, path);
+ BSTR query=formatBstr("SELECT * from CitrixXenStoreWatchEvent WHERE EventId=\"%s\"", path);
+ if (query == NULL) {
+ goto formatstringfailed;
+ }
+ hr = (*wmi)->mpXSSvc->ExecNotificationQueryAsync(L"WQL", query,0,NULL, sink);
+ if (FAILED(hr)){
+ *wmi = NULL;
+ goto wmifailed;
+ }
VARIANT vpath;
if (setVariantString(&vpath, path)){
goto setvpath;
}
- IWbemClassObject *outMethodInst;
+
+
IWbemClassObject *inMethodInst = sessionMethodStart( wmi, L"SetWatch");
if (!inMethodInst)
goto sessionstart;
- inMethodInst->Put(L"PathName",0,&vpath,0);
- methodExec(wmi,*session, L"SetWatch", inMethodInst, &outMethodInst);
- if (outMethodInst==NULL)
- goto sessionExec;
- outMethodInst->Release();
-sessionExec:
+
+ hr = inMethodInst->Put(L"PathName",0,&vpath,0);
+ if (FAILED(hr))
+ goto methodputfailed;
+
+ hr = methodExec(wmi,*session, L"SetWatch", inMethodInst, NULL);
+ if (FAILED(hr))
+ goto methodexecfailed;
+
+ VariantClear(&vpath);
+
+ SysFreeString(query);
+
+ return sink;
+
+
+methodexecfailed:
+ OutputDebugString(__FUNCTION__ " : methodexecfailed\n");
+methodputfailed:
+ OutputDebugString(__FUNCTION__ " : methodputfailed\n");
+ inMethodInst->Release();
sessionstart:
+ OutputDebugString(__FUNCTION__ " : sessionstart\n");
+ VariantClear(&vpath);
setvpath:
- return sink;
+ OutputDebugString(__FUNCTION__ " : setvpath\n");
+wmifailed:
+ SysFreeString(query);
+formatstringfailed:
+ OutputDebugString(__FUNCTION__ " : formatstringfailed\n");
+ delete sink;
+ return NULL;
}
-void *WmiUnsuspendedEventWatch(WMIAccessor *wmi, HANDLE event)
+void *WmiUnsuspendedEventWatch(WMIAccessor **wmi, HANDLE event, HANDLE errorevent)
{
- WatchSink * sink = new WatchSink(event, NULL);
+ HRESULT hr;
+
+ ASSERT(*wmi != NULL);
+
+ WatchSink * sink = new WatchSink(event, errorevent, NULL);
BSTR query=formatBstr("SELECT * from CitrixXenStoreUnsuspendedEvent");
+ if (query==NULL) {
+ goto formatstringfailed;
+ }
+
+ hr = (*wmi)->mpXSSvc->ExecNotificationQueryAsync(L"WQL", query,0,NULL, sink);
+ if FAILED(hr)
+ goto asyncqueryfailed;
- wmi->mpXSSvc->ExecNotificationQueryAsync(L"WQL", query,0,NULL, sink);
+ SysFreeString(query);
return sink;
+
+asyncqueryfailed:
+ SysFreeString(query);
+formatstringfailed:
+ delete sink;
+ return NULL;
}
#include <map>
#include <string>
-#include "vm_stats.h"
#include "XSAccessor.h"
using namespace std;
extern struct WMIAccessor *wmi;
-void ConnectToWMI(void);
-void ReleaseWMIAccessor(struct WMIAccessor *);
+extern LONG wmicount;
+BOOL InitCom(void);
+void ReleaseCom(void);
+BOOL ConnectToWMI(void);
+void ReleaseWMIAccessor(struct WMIAccessor **);
-void GetWMIData(WMIAccessor *wmi, VMData& data);
-void DumpOSData(WMIAccessor *wmi);
+void UpdateProcessListInStore(WMIAccessor **wmi);
-VOID AddHotFixInfoToStore(WMIAccessor* wmi);
-void UpdateProcessListInStore(WMIAccessor *wmi);
-
-int WmiSessionSetEntry(WMIAccessor* wmi, void **sessionhandle,
+int WmiSessionSetEntry(WMIAccessor** wmi, void **sessionhandle,
const char*path, const char * value);
-int WmiSessionSetEntry(WMIAccessor* wmi, void **sessionhandle,
+int WmiSessionSetEntry(WMIAccessor** wmi, void **sessionhandle,
const char*path, const char * value, size_t len);
-char* WmiSessionGetEntry(WMIAccessor* wmi, void **sessionhandle,
+char* WmiSessionGetEntry(WMIAccessor** wmi, void **sessionhandle,
const char * path, size_t* len) ;
-void *WmiSessionWatch(WMIAccessor* wmi, void **sessionhandle,
- const char *path, HANDLE event);
-void WmiSessionUnwatch(WMIAccessor* wmi, void **sessionhandle,
+void *WmiSessionWatch(WMIAccessor** wmi, void **sessionhandle,
+ const char *path, HANDLE event, HANDLE errorevent);
+BOOL WmiSessionUnwatch(WMIAccessor** wmi, void **sessionhandle,
void *watchhandle);
-int WmiSessionRemoveEntry(WMIAccessor* wmi, void **sessionhandle,
+int WmiSessionRemoveEntry(WMIAccessor** wmi, void **sessionhandle,
const char*path);
-char **WmiSessionGetChildren(WMIAccessor* wmi, void **sessionhandle,
+char **WmiSessionGetChildren(WMIAccessor** wmi, void **sessionhandle,
const char * path, unsigned *numentries);
-void *WmiUnsuspendedEventWatch(WMIAccessor *wmi, HANDLE event);
+void *WmiUnsuspendedEventWatch(WMIAccessor **wmi, HANDLE event, HANDLE errorevent);
-int WmiSessionTransactionAbort(WMIAccessor* wmi, void **sessionhandle);
-int WmiSessionTransactionCommit(WMIAccessor* wmi, void **sessionhandle);
-int WmiSessionTransactionStart(WMIAccessor* wmi, void **sessionhandle);
-void WmiSessionStart(WMIAccessor* wmi, void **sessionhandle, const char *sessionname);
-void WmiSessionEnd(WMIAccessor* wmi, void *sessionhandle);
-FILETIME WmiGetXenTime(WMIAccessor *wmi);
-void WmiSessionLog(WMIAccessor* wmi, void **sessionhandle,const char *fmt, va_list args);
+int WmiSessionTransactionAbort(WMIAccessor** wmi, void **sessionhandle);
+int WmiSessionTransactionCommit(WMIAccessor** wmi, void **sessionhandle);
+int WmiSessionTransactionStart(WMIAccessor** wmi, void **sessionhandle);
+BOOL WmiSessionStart(WMIAccessor** wmi, void **sessionhandle, const char *sessionname);
+BOOL WmiSessionEnd(WMIAccessor** wmi, void *sessionhandle);
+FILETIME WmiGetXenTime(WMIAccessor **wmi);
+void WmiSessionLog(WMIAccessor** wmi, void **sessionhandle,const char *fmt, va_list args);
#endif
#include <windows.h>
#include "stdafx.h"
#include "XSAccessor.h"
-//#include "xs_private.h"
#include "WMIAccessor.h"
static __declspec(thread) void *WmiSessionHandle = NULL;
static LONG volatile threadcount = 0;
static __declspec(thread) LONG localthreadcount = 0;
+static __declspec(thread) LONG localwmicount = 0;
-static int64_t update_cnt;
+static long update_cnt;
#define XENSTORE_MAGIC 0x7e6ec123
void *XsAlloc(size_t size) {
return;
orig_buf = (void *)((ULONG_PTR)buf - 8);
if (*(unsigned *)orig_buf != XENSTORE_MAGIC) {
- OutputDebugString("XsFree() invoked on bad pointer");
+ OutputDebugString("XsFree() invoked on bad pointer\n");
DebugBreak();
}
free(orig_buf);
void GetXenTime(FILETIME *now)
{
- *now = WmiGetXenTime(wmi);
+ *now = WmiGetXenTime(&wmi);
}
-int ListenSuspend(HANDLE event)
+
+int ListenSuspend(HANDLE event, HANDLE errorevent)
{
- if (!WmiUnsuspendedEventWatch(wmi, event))
+ if (!WmiUnsuspendedEventWatch(&wmi, event, errorevent))
return -1;
else
return 0;
}
-void InitXSAccessor()
+BOOL InitXSAccessor()
{
- DBGPRINT(("XSAccessor"));
- if (WmiSessionHandle == NULL) {
+ OutputDebugString("XSAccessor\n");
+ if (wmicount != localwmicount) {
+
if (localthreadcount == 0) {
localthreadcount = InterlockedIncrement(&threadcount);
}
char wminame[12];
_snprintf(wminame, 12, "XS%x", localthreadcount);
- WmiSessionStart(wmi, &WmiSessionHandle, wminame);
+ if (WmiSessionStart(&wmi, &WmiSessionHandle, wminame)) {
+ localwmicount = wmicount;
+ return true;
+ }
+ OutputDebugString("XSAccessor Failed\n");
+ return false;
}
- if (WmiSessionHandle == NULL)
- exit(1);
+ return true;
}
void XsLog(const char *fmt, ...)
{
va_list args;
- if (!WmiSessionHandle) {
- InitXSAccessor();
- }
va_start(args, fmt);
- WmiSessionLog(wmi, &WmiSessionHandle, fmt, args);
+ WmiSessionLog(&wmi, &WmiSessionHandle, fmt, args);
va_end(args);
}
-void ShutdownXSAccessor(void)
+BOOL ShutdownXSAccessor(void)
{
- WmiSessionEnd(wmi, WmiSessionHandle);
+ if (wmi == NULL) {
+ return false;
+ }
+ if (WmiSessionHandle == NULL) {
+ return false;
+ }
+ return WmiSessionEnd(&wmi, WmiSessionHandle);
}
{
va_list l;
char buf[4096];
- int ret;
int cnt;
va_start(l, fmt);
DBGPRINT (("Cannot format data for XenstorePrintf!"));
return -1;
}
-
+ OutputDebugString(buf);
/* Now have the thing we're trying to write. */
- return WmiSessionSetEntry(wmi, &WmiSessionHandle, path, buf);
+ return WmiSessionSetEntry(&wmi, &WmiSessionHandle, path, buf);
}
-int XenstoreWrite(const char *path, const void *data, size_t len)
-{
- return WmiSessionSetEntry(wmi, &WmiSessionHandle, path, (const char *)data, len);
-}
-
-void XenstoreKickXapi()
+BOOL XenstoreKickXapi()
{
/* Old protocol */
- WmiSessionSetEntry(wmi, &WmiSessionHandle, "data/updated", "1");
+ if (WmiSessionSetEntry(&wmi, &WmiSessionHandle, "data/updated", "1"))
+ return false;
/* New protocol */
- XenstorePrintf("data/update_cnt", "%I64d", update_cnt);
+ if (XenstorePrintf("data/update_cnt", "%I64d", update_cnt))
+ return false;
update_cnt++;
+ return true;
}
-void XenstoreDoDump(VMData *data)
-{
- XenstorePrintf("data/meminfo_free", "%I64d", data->meminfo_free);
- XenstorePrintf("data/meminfo_total", "%I64d", data->meminfo_total);
-}
-
-int XenstoreDoNicDump(
- uint32_t num_vif,
- VIFData *vif
- )
-{
- DWORD hStatus;
- unsigned int i;
- int ret = 0;
- char path[MAX_CHAR_LEN] = "";
- const char* domainVifPath = "data/vif";
- unsigned int entry;
- unsigned int numEntries;
- char** vifEntries = NULL;
- char vifNode[MAX_XENBUS_PATH];
-
- //
- // Do any cleanup first outside of a transaction since failures are allowed
- // and in some cases expected.
- //
- // Remove all of the old vif entries in case the nics have been
- // disabled. Otherwise they will have old stale data in xenstore.
- //
- if (XenstoreList(domainVifPath, &vifEntries, &numEntries) >= 0) {
- for (entry = 0; entry < numEntries; entry++) {
- _snprintf(path, MAX_CHAR_LEN, "%s", vifEntries[entry]);
- WmiSessionRemoveEntry(wmi, &WmiSessionHandle, path);
- _snprintf(path, MAX_CHAR_LEN, "attr/eth%s", vifEntries[entry]+9);
- WmiSessionRemoveEntry(wmi, &WmiSessionHandle, path);
- XsFree(vifEntries[entry]);
- }
- XsFree(vifEntries);
- }
- do
- {
- hStatus = ERROR_SUCCESS;
- WmiSessionTransactionStart(wmi, &WmiSessionHandle );
- ret |= XenstorePrintf("data/num_vif", "%d", num_vif);
-
- for( i = 0; i < num_vif; i++ ){
- if (vif[i].ethnum != -1) {
- _snprintf(path, MAX_CHAR_LEN, "data/vif/%d/name" , vif[i].ethnum);
- path[MAX_CHAR_LEN-1] = 0;
- ret |= XenstorePrintf(path, "%s", vif[i].name);
-
-
- //
- // IP address is dumped to /attr/eth[x]/ip
- //
- _snprintf (path, MAX_CHAR_LEN, "attr/eth%d/ip", vif[i].ethnum);
- path[MAX_CHAR_LEN-1] = 0;
- ret |= XenstorePrintf (path, "%s", vif[i].ip);
-
- }
- }
- if(!WmiSessionTransactionCommit(wmi, &WmiSessionHandle))
- {
- hStatus = GetLastError ();
- if (hStatus != ERROR_RETRY)
- {
- return -1;
- }
- }
-
- } while (hStatus == ERROR_RETRY);
- return ret;
-}
-
-int
-XenstoreList(const char *path, char ***entries, unsigned *numEntries)
-{
- *entries = WmiSessionGetChildren(wmi, &WmiSessionHandle, path, numEntries);
- if (*entries) {
- return 0;
- }
- else {
- return -1;
- }
-}
int
XenstoreRemove(const char *path)
{
- if (WmiSessionRemoveEntry(wmi, &WmiSessionHandle, path))
+ if (wmi == NULL)
+ return -1;
+
+ if (WmiSessionHandle == NULL)
+ return -1;
+
+ if (WmiSessionRemoveEntry(&wmi, &WmiSessionHandle, path))
return -1;
else
return 0;
XenstoreRead(const char* path, char** value)
{
size_t len;
- *value =WmiSessionGetEntry(wmi, &WmiSessionHandle, path, &len);
+ *value =WmiSessionGetEntry(&wmi, &WmiSessionHandle, path, &len);
if (*value)
return len;
else
}
void *
-XenstoreWatch(const char *path, HANDLE event)
+XenstoreWatch(const char *path, HANDLE event, HANDLE errorevent)
{
- return WmiSessionWatch(wmi, &WmiSessionHandle, path, event);
-}
-
-void
+ if (wmi == NULL) {
+ OutputDebugString("WMI is null\n");
+ return NULL;
+ }
+ if (WmiSessionHandle == NULL) {
+ OutputDebugString("Session is null\n");
+ return NULL;
+ }
+ return WmiSessionWatch(&wmi, &WmiSessionHandle, path, event, errorevent);
+}
+
+BOOL
XenstoreUnwatch(void *watch)
{
- return WmiSessionUnwatch(wmi, &WmiSessionHandle, watch);
+ return WmiSessionUnwatch(&wmi, &WmiSessionHandle, watch);
}
void
#define _XSACCESSOR_H
#include <string>
+#include "windows.h"
-#include "vm_stats.h"
using namespace std;
typedef long ssize_t;
#endif
-void InitXSAccessor();
-void ShutdownXSAccessor();
-int XenstoreList(const char *path, char ***entries, unsigned *numEntries);
+BOOL InitXSAccessor();
+BOOL ShutdownXSAccessor();
ssize_t XenstoreRead(const char *path, char **value);
int XenstoreRemove(const char *path);
int XenstorePrintf(const char *path, const char *fmt, ...);
int XenstoreWrite(const char *path, const void *data, size_t len);
-void XenstoreKickXapi(void);
-void XenstoreDoDump(VMData *data);
-int XenstoreDoNicDump(uint32_t num_vif, VIFData *vif);
-void *XenstoreWatch(const char *path, HANDLE event);
-void XenstoreUnwatch(void *watch);
-int ListenSuspend(HANDLE event);
+BOOL XenstoreKickXapi(void);
+void *XenstoreWatch(const char *path, HANDLE event, HANDLE errorevent);
+BOOL XenstoreUnwatch(void *watch);
+int ListenSuspend(HANDLE evt, HANDLE errorevent);
void GetXenTime(FILETIME *res);
void XsLog(const char *fmt, ...);
void XenstoreFree(void *tofree);
for (;;) {
p = (TCHAR *)malloc(count * sizeof (TCHAR));
if (!p) {
- OutputDebugString(_T("Out of memory for debug message!"));
+ OutputDebugString(_T("Out of memory for debug message!\n"));
break;
}
res = _vsntprintf(p, count, msg, args);
#include <windows.h>
#include <shlobj.h>
#include <process.h>
-#include <powrprof.h>
+#include "powrprof.h"
#include <winuser.h>
#include "stdafx.h"
#include "XSAccessor.h"
#include "WMIAccessor.h"
#include "XService.h"
-#include "vm_stats.h"
-#include "NicInfo.h"
-//#include "xs_private.h"
-#include "version.h"
#include "messages.h"
-#include "TSInfo.h"
#include <setupapi.h>
#include <cfgmgr32.h>
(LPTSTR) &lpMsgBuf,
0,
NULL);
- DBGPRINT(("%s failed: %s (%lx)\n", func, lpMsgBuf, err));
+ OutputDebugString((LPTSTR)lpMsgBuf);
XenstorePrintf("control/error", "%s failed: %s (%x)", func, lpMsgBuf, err);
LocalFree(lpMsgBuf);
}
void PrintUsage()
{
- printf("Usage: xenservice [-i|-u|-c|-t]\n");
- printf("\t -i: install service\n");
+ printf("Usage: xenservice [-u]\n");
+
printf("\t -u: uninstall service\n");
}
-HMODULE SLC_API;
-HMODULE SLWGA_API;
-
-typedef HRESULT (WINAPI *SL_GET_WINDOWS_INFORMATION_DWORD)(
- __in PCWSTR pwszValueName,
- __out DWORD *pdwValue
- );
-
-typedef GUID SLID;
-
-typedef enum _SL_GENUINE_STATE {
- SL_GEN_STATE_IS_GENUINE = 0,
- SL_GEN_STATE_INVALID_LICENSE = 1,
- SL_GEN_STATE_TAMPERED = 2,
- SL_GEN_STATE_LAST = 3
-} SL_GENUINE_STATE;
-
-typedef HRESULT (WINAPI *SL_IS_GENUINE_LOCAL)(
- __in const SLID *pAppId,
- __out SL_GENUINE_STATE *pGenuineState,
- __inout_opt VOID *pUnused
- );
-
-/* Add operating system version, service pack, etc. to store. */
-static VOID
-AddSystemInfoToStore(
- WMIAccessor* wmi
- )
-{
- OSVERSIONINFOEX info;
- char buf[MAX_PATH];
-
- XenstorePrintf("attr/os/class", "windows NT");
- /* Windows version, service pack, build number */
- info.dwOSVersionInfoSize = sizeof(info);
- if (GetVersionEx((LPOSVERSIONINFO)&info)) {
-#define do_field(name, field) \
- XenstorePrintf("attr/os/" #name , "%d", info. field)
- do_field(major, dwMajorVersion);
- do_field(minor, dwMinorVersion);
- do_field(build, dwBuildNumber);
- do_field(platform, dwPlatformId);
- do_field(spmajor, wServicePackMajor);
- do_field(spminor, wServicePackMinor);
- do_field(suite, wSuiteMask);
- do_field(type, wProductType);
-#undef do_field
-
- XenstorePrintf("data/os_distro", "windows");
- XenstorePrintf("data/os_majorver", "%d", info.dwMajorVersion);
- XenstorePrintf("data/os_minorver", "%d", info.dwMinorVersion);
- } else {
- /* Flag that we couldn't collect this information. */
- XenstorePrintf("attr/os/major", "-1");
- }
- DumpOSData(wmi);
-
- XenstorePrintf("attr/os/boottype", "%d", GetSystemMetrics(SM_CLEANBOOT));
- /* HAL version in use */
- if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_SYSTEM, NULL, SHGFP_TYPE_CURRENT, buf))) {
- DWORD tmp;
- DWORD versize;
- LPVOID buffer = NULL;
- TCHAR buffer2[128];
- LPTSTR halname;
- UINT halnamelen;
- struct {
- WORD language, code_page;
- } *trans;
- UINT trans_size;
-
- XenstorePrintf("attr/os/system32_dir", "%s", buf);
- strcat(buf, "\\hal.dll");
- versize = GetFileVersionInfoSize(buf, &tmp);
- if (versize == 0) {
- XenstorePrintf("attr/os/hal", "<unknown versize=0>");
- goto done_hal;
- }
- buffer = malloc(versize);
- if (!buffer) {
- XenstorePrintf("attr/os/hal", "<unknown versize=%d>", versize);
- goto done_hal;
- }
- if (GetFileVersionInfo(buf, tmp, versize, buffer) == 0) {
- PrintError("GetFileVersioInfo(hal.dll)");
- goto done_hal;
- }
- if (!VerQueryValue(buffer, TEXT("\\VarFileInfo\\Translation"),
- (LPVOID *)&trans, &trans_size)) {
- PrintError("VerQueryValue(hal.Translation");
- goto done_hal;
- }
- if (trans_size < sizeof(*trans)) {
- XenstorePrintf("attr/os/hal", "<no translations>");
- goto done_hal;
- }
- sprintf(buffer2, "\\StringFileInfo\\%04x%04x\\InternalName",
- trans->language, trans->code_page);
- if (VerQueryValue(buffer, buffer2, (LPVOID *)&halname,
- &halnamelen)) {
- XenstorePrintf("attr/os/hal", "%s", halname);
-
- if (!lstrcmpi(halname, "hal.dll")) {
- LegacyHal = TRUE;
- }
- } else {
- PrintError("VerQueryValue(hal.InternalName)");
- }
- done_hal:
- free(buffer);
- }
-
- /* Kernel command line */
- HKEY regKey;
- DWORD res;
- res = RegOpenKey(HKEY_LOCAL_MACHINE,
- "SYSTEM\\CurrentControlSet\\Control",
- ®Key);
- if (res != ERROR_SUCCESS) {
- PrintError("RegOpenKey(\"HKLM\\SYSTEM\\CurrentControlSet\\Control\")");
- } else {
- DWORD keyType;
- DWORD tmp;
- tmp = sizeof(buf);
- res = RegQueryValueEx(regKey, "SystemStartOptions",
- NULL, &keyType, (LPBYTE)buf, &tmp);
- if (res != ERROR_SUCCESS) {
- PrintError("RegQueryValue(SystemStartOptions)");
- } else if (keyType != REG_SZ) {
- XenstorePrintf("attr/os/boot_options", "<not string>");
- } else {
- XenstorePrintf("attr/os/boot_options", buf);
- }
- RegCloseKey(regKey);
- regKey = NULL;
- }
-
- AddHotFixInfoToStore(wmi);
-
-}
struct watch_event {
HANDLE event;
}
static struct watch_event *
-EstablishWatch(const char *path)
+EstablishWatch(const char *path, HANDLE errorevent)
{
struct watch_event *we;
DWORD err;
-
+ XsLog("Establish watch %s",path);
we = (struct watch_event *)malloc(sizeof(*we));
if (!we) {
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
we->watch = NULL;
we->event = CreateEvent(NULL, FALSE, FALSE, NULL);
if (we->event != INVALID_HANDLE_VALUE)
- we->watch = XenstoreWatch(path, we->event);
+ we->watch = XenstoreWatch(path, we->event, errorevent);
if (we->watch == NULL) {
+ OutputDebugString("Watch is null\n");
err = GetLastError();
ReleaseWatch(we);
SetLastError(err);
struct watch_event *watch;
const char *feature_flag;
const char *name;
- void (*handler)(void *);
+ BOOL (*handler)(void *);
void *ctx;
};
unsigned nr_features;
};
-static void
+static BOOL
AddFeature(struct watch_feature_set *wfs, const char *path,
const char *flag, const char *name,
- void (*handler)(void *), void *ctx)
+ BOOL (*handler)(void *), void *ctx, HANDLE errorevent)
{
unsigned n;
if (wfs->nr_features == MAX_FEATURES) {
PrintError("Too many features!", ERROR_INVALID_FUNCTION);
- return;
+ return false;
}
n = wfs->nr_features;
- wfs->features[n].watch = EstablishWatch(path);
+ wfs->features[n].watch = EstablishWatch(path, errorevent);
if (wfs->features[n].watch == NULL) {
PrintError("EstablishWatch() for AddFeature()");
- return;
+ return false;
}
wfs->features[n].feature_flag = flag;
wfs->features[n].handler = handler;
wfs->features[n].ctx = ctx;
wfs->features[n].name = name;
wfs->nr_features++;
+ return true;
}
-static void
+static void RemoveFeatures(struct watch_feature_set *wfs) {
+ unsigned x;
+ for (x = 0; x < wfs->nr_features; x++) {
+ ReleaseWatch(wfs->features[x].watch);
+ wfs->features[x].watch = NULL;
+ XenstoreRemove(wfs->features[x].feature_flag);
+ }
+ wfs->nr_features = 0;
+}
+
+static BOOL
AdvertiseFeatures(struct watch_feature_set *wfs)
{
unsigned x;
for (x = 0; x < wfs->nr_features; x++) {
if (wfs->features[x].feature_flag != NULL)
- XenstorePrintf(wfs->features[x].feature_flag, "1");
- }
-}
-
-int isBetterAgentInstalled() {
- LONG lRet = 0;
- DWORD betterAgent =0;
- HKEY hRegKey;
-
-
-
- lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- XENTOOLS_INSTALL_REG_KEY,
- 0,
- KEY_READ,
- &hRegKey);
-
- if (lRet == ERROR_SUCCESS)
- {
- DWORD cbData;
- lRet = RegQueryValueEx(hRegKey, "MsiGuestAgent", NULL, NULL, (PBYTE)&betterAgent, &cbData);
- if (lRet != ERROR_SUCCESS) {
- betterAgent=0;
- }
- }
- else {
- betterAgent = 0;
- goto failKey;
+ if (XenstorePrintf(wfs->features[x].feature_flag, "1"))
+ return false;
}
- RegCloseKey(hRegKey);
-failKey:
- return betterAgent;
+ return true;
}
-VOID
-RegisterPVAddOns(
- WMIAccessor* wmi
- )
-{
- HKEY hRegKey;
- HANDLE h = INVALID_HANDLE_VALUE;
- DWORD dwVersion;
- DWORD cbData;
-
- // If we get here, the drivers are installed.
- XenstorePrintf ("attr/PVAddons/Installed", "1");
-
- // Put the major, minor, and build version numbers in the store.
- LONG lRet = 0;
-
- lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- XENTOOLS_INSTALL_REG_KEY,
- 0,
- KEY_READ,
- &hRegKey);
-
- if (lRet == ERROR_SUCCESS)
- {
- cbData = sizeof(dwVersion);
-#define DO_VERSION(type) \
- lRet = RegQueryValueEx ( \
- hRegKey, \
- #type "Version", \
- NULL, \
- NULL, \
- (PBYTE)&dwVersion, \
- &cbData); \
- if (lRet == ERROR_SUCCESS) \
- XenstorePrintf ("attr/PVAddons/" #type "Version", "%d", \
- dwVersion); \
- else \
- DBGPRINT (("Failed to get version " #type));
- DO_VERSION(Major);
- DO_VERSION(Minor);
- DO_VERSION(Micro);
- DO_VERSION(Build);
-#undef DO_VERSION
- RegCloseKey(hRegKey);
- }
-
- AddSystemInfoToStore(wmi);
-}
void ServiceUninstall()
{
CloseServiceHandle(hSvc);
- /* Tell dom0 that we're no longer installed. This is a bit
- of a hack. */
- InitXSAccessor();
-
- XenstorePrintf("attr/PVAddons/Installed", "0");
- XenstorePrintf("attr/PVAddons/MajorVersion", "0");
- XenstorePrintf("attr/PVAddons/MinorVersion", "0");
- XenstorePrintf("attr/PVAddons/BuildVersion", "0");
-
- /* Crank the update number so xapi notices it. */
- char *v;
- XenstoreRead("data/update_cnt", &v);
- if (v) {
- int cnt = atoi(v);
- XenstorePrintf("data/update_cnt", "%d", cnt + 1);
- XenstoreFree(v);
- }
}
else
printf("Unable to open service - %d\n", GetLastError());
// Start the control dispatcher thread for our service
if (!StartServiceCtrlDispatcher(ServiceTable))
{
+ int err = GetLastError();
if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
{
DBGPRINT(("XenSvc: unable to start ctrl dispatcher - %d", GetLastError()));
XShutdownS3
};
-static void maybeReboot(void *ctx)
+static BOOL maybeReboot(void *ctx)
{
char *shutdown_type;
- unsigned int len;
BOOL res;
enum XShutdownType type;
int cntr = 0;
HANDLE eventLog;
if (XenstoreRead("control/shutdown", &shutdown_type) < 0)
- return;
+ return true;
DBGPRINT(("Shutdown type %s\n", shutdown_type));
if (strcmp(shutdown_type, "poweroff") == 0 ||
strcmp(shutdown_type, "halt") == 0) {
SHTDN_REASON_MINOR_ENVIRONMENT |
SHTDN_REASON_FLAG_PLANNED);
#pragma warning (default: 28159)
- if (!res)
+ if (!res) {
PrintError("ExitWindowsEx");
+ return false;
+ }
else
- XenstoreRemove("control/shutdown");
+ {
+ if (XenstoreRemove("control/shutdown"))
+ return false;
+ }
} else {
#pragma warning (disable : 28159)
res = InitiateSystemShutdownEx(
#pragma warning (default: 28159)
if (!res) {
PrintError("InitiateSystemShutdownEx");
+ return false;
} else {
- XenstoreRemove("control/shutdown");
+ if (XenstoreRemove("control/shutdown"))
+ return false;
}
}
break;
case XShutdownSuspend:
- XenstorePrintf ("control/hibernation-state", "started");
+ if (XenstorePrintf ("control/hibernation-state", "started"))
+ return false;
/* Even if we think hibernation is disabled, try it anyway.
It's not like it can do any harm. */
res = SetSystemPowerState(FALSE, FALSE);
- XenstoreRemove ("control/shutdown");
+ if (XenstoreRemove ("control/shutdown"))
+ {
+ return false;
+ }
if (!res) {
/* Tell the tools that we've failed. */
PrintError("SetSystemPowerState");
- XenstorePrintf ("control/hibernation-state", "failed");
+ if (XenstorePrintf ("control/hibernation-state", "failed"))
+ return false;
}
break;
case XShutdownS3:
- XenstorePrintf ("control/s3-state", "started");
+ if (XenstorePrintf ("control/s3-state", "started"))
+ return false;
res = SetSuspendState(FALSE, TRUE, FALSE);
XenstoreRemove ("control/shutdown");
if (!res) {
PrintError("SetSuspendState");
- XenstorePrintf ("control/s3-state", "failed");
+ if (XenstorePrintf ("control/s3-state", "failed"))
+ return false;
}
break;
}
out:
XenstoreFree(shutdown_type);
-}
-
-static
-void
-GetWindowsVersion()
-{
- OSVERSIONINFO info;
- info.dwOSVersionInfoSize = sizeof(info);
-
- WindowsVersion = 0;
-
- if (GetVersionEx(&info)) {
- if (((info.dwMajorVersion & ~0xff) == 0)
- && ((info.dwMinorVersion & ~0xff) == 0))
- {
- WindowsVersion = (info.dwMajorVersion << 8) |
- info.dwMinorVersion;
- }
- }
+ return true;
}
/* We need to resync the clock when we recover from suspend/resume. */
DBGPRINT(("Coming back from suspend.\n"));
GetXenTime(&now);
+ if ((now.dwLowDateTime == 0) && (now.dwHighDateTime == 0)) {
+ XsLog("Cannot set system time to xentime, unable to contact WMI");
+ return;
+ }
XsLog("Xen time is %I64x", now);
if (!FileTimeToSystemTime(&now, &sys_time)) {
PrintError("FileTimeToSystemTime()");
}
}
-static void
-refreshStoreData(WMIAccessor *wmi, NicInfo *nicInfo,
- TSInfo *tsInfo, struct watch_feature_set *wfs)
-{
- PCHAR buffer = NULL;
- static int64_t last_meminfo_free;
- static int cntr;
- unsigned need_kick;
-
- need_kick = 0;
- if (XenstoreRead("attr/PVAddons/Installed",
- &buffer) < 0) {
- if (GetLastError() == ERROR_NO_SYSTEM_RESOURCES)
- return;
-
- XsLogMsg("register ourself in the store");
- RegisterPVAddOns(wmi);
- nicInfo->Refresh();
- AdvertiseFeatures(wfs);
- need_kick = 1;
- } else {
- XenstoreFree(buffer);
- }
-
- if (XenstoreRead("data/meminfo_free", &buffer) < 0) {
- cntr = 0;
- last_meminfo_free = 0;
- } else {
- XenstoreFree(buffer);
- }
-
- if (XenstoreRead("data/ts", &buffer) < 0) {
- cntr = 0;
- } else {
- XenstoreFree(buffer);
- }
- /* XXX HACK: Restrict ourselves to only doing this once every two
- * minutes or so (we get called about every 4.5 seconds). */
- if (cntr++ % 26 == 0) {
- VMData data;
- BOOLEAN enabled;
-
- XsLogMsg("Get memory data");
- memset(&data, 0, sizeof(VMData));
- GetWMIData(wmi, data);
-
- if (data.meminfo_free - last_meminfo_free > 1024 ||
- data.meminfo_free - last_meminfo_free < -1024) {
- XsLogMsg("update memory data in store");
- XenstoreDoDump(&data);
- need_kick = 1;
- last_meminfo_free = data.meminfo_free;
- }
-
- XsLogMsg("Refresh terminal services status");
- tsInfo->Refresh();
-
- XsLogMsg("Get volume mapping data");
- }
-
- if (need_kick)
- XenstoreKickXapi();
-}
-
-static void
-ProcessTsControl(void *ctx)
-{
- TSInfo *tsInfo = (TSInfo *)ctx;
-
- tsInfo->ProcessControl();
-}
-
-static void
-processPing(void *ctx)
-{
- XenstoreRemove("control/ping");
-}
-
-static void
-processExec(void *ctx)
-{
- char *val;
- char *file;
- if (XenstoreRead("control/exec/command", &val) >=0) {
- if (strcmp(val, "Install")==0) {
- if (XenstoreRead("control/exec/file", &file) >=0) {
- _spawnlp(_P_NOWAIT, "msiexec.exe", "/qn", "/i", file, NULL);
- XenstoreFree(file);
- }
- XenstoreFree(val);
- }
- }
- XenstoreRemove("control/exec/command");
-
-}
-
-static void
-processDumpLog(void *ctx)
-{
- char *val;
- int do_it;
-
- do_it = 0;
- if (XenstoreRead("control/dumplog", &val) >= 0) {
- XenstoreFree(val);
- do_it = 1;
- } else if (GetLastError() != ERROR_FILE_NOT_FOUND)
- do_it = 1;
-
- if (do_it) {
- XsDumpLogThisThread();
- XenstoreRemove("control/dumplog");
- }
-}
//
// Main loop
//
-void Run()
+BOOL Run()
{
- VMData data;
bool exit=false;
PCHAR pPVAddonsInstalled = NULL;
- STARTUPINFO startInfo;
- PROCESS_INFORMATION processInfo;
+
HANDLE suspendEvent;
- MSG msg;
+
int cntr = 0;
- NicInfo *nicInfo;
- TSInfo *tsInfo;
struct watch_feature_set features;
BOOL snap = FALSE;
- XsLogMsg("Guest agent main loop starting");
+ OutputDebugString("Trying to connect to WMI\n");
+ while (!ConnectToWMI()) {
+ OutputDebugString("Unable to connect to WMI, sleeping\n");
+ if (WaitForSingleObject(hServiceExitEvent, 1000*10) == WAIT_OBJECT_0) {
+ exit = true;
+ return exit;
+ }
+ }
+ while (InitXSAccessor()==false) {
+ OutputDebugString("Unable to initialise WMI session, sleeping\n");
+ if (WaitForSingleObject(hServiceExitEvent, 1000*10) == WAIT_OBJECT_0) {
+ exit = true;
+ return exit;
+ }
+ }
+ XsLogMsg("Guest agent lite main loop starting");
memset(&features, 0, sizeof(features));
- GetWindowsVersion();
-
+ HANDLE wmierrorEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ if (!wmierrorEvent) {
+ PrintError("CreateEvent() wmierrorEvent");
+ return exit;
+ }
+
- AddFeature(&features, "control/shutdown", "control/feature-shutdown",
- "shutdown", maybeReboot, NULL);
- AddFeature(&features, "control/ping", NULL, "ping", processPing, NULL);
- AddFeature(&features, "control/exec/command", NULL, "Exec", processExec, NULL);
- AddFeature(&features, "control/dumplog", NULL, "dumplog", processDumpLog, NULL);
+ if (!AddFeature(&features, "control/shutdown", "control/feature-shutdown",
+ "shutdown", maybeReboot, NULL, wmierrorEvent)) {
+ return exit;
+ }
suspendEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!suspendEvent) {
PrintError("CreateEvent() suspendEvent");
- } else {
- if (ListenSuspend(suspendEvent) < 0) {
- PrintError("ListenSuspend()");
- CloseHandle(suspendEvent);
- suspendEvent = NULL;
- }
+ return exit;
+ }
+
+ if (ListenSuspend(suspendEvent, wmierrorEvent) < 0) {
+ PrintError("ListenSuspend()");
+ CloseHandle(suspendEvent);
+ suspendEvent = NULL;
+ return exit;
}
- nicInfo = new NicInfo();
- nicInfo->Prime();
-
- tsInfo = new TSInfo();
- AddFeature(&features,
- "control/ts",
- "control/feature-ts",
- "ts",
- ProcessTsControl,
- tsInfo);
-
- XenstoreRemove("attr/PVAddons/Installed");
- refreshStoreData(wmi, nicInfo, tsInfo, &features);
+ AdvertiseFeatures(&features);
+ XenstoreKickXapi();
while (1)
{
DWORD status;
- int nr_handles = 2;
+ int nr_handles = 1;
HANDLE handles[3 + MAX_FEATURES];
unsigned x;
handles[0] = hServiceExitEvent;
- handles[1] = nicInfo->NicChangeEvent;
+ if (wmierrorEvent)
+ handles[nr_handles++] = wmierrorEvent;
if (suspendEvent)
handles[nr_handles++] = suspendEvent;
for (x = 0; x < features.nr_features; x++)
handles[nr_handles++] = features.features[x].watch->event;
XsLogMsg("win agent going to sleep");
- status = WaitForMultipleObjects(nr_handles, handles, FALSE, 4500);
+ status = WaitForMultipleObjects(nr_handles, handles, FALSE, INFINITE);
XsLogMsg("win agent woke up for %d", status);
/* WAIT_OBJECT_0 happens to be 0, so the compiler gets shirty
about status >= WAIT_OBJECT_0 (since status is unsigned).
This is more obviously correct than the compiler-friendly
version, though, so just disable the warning. */
- if (status == WAIT_TIMEOUT) {
- refreshStoreData(wmi, nicInfo, tsInfo, &features);
- }
+
#pragma warning (disable: 4296)
- else if (status >= WAIT_OBJECT_0 &&
- status < WAIT_OBJECT_0 + nr_handles)
+ if (status >= WAIT_OBJECT_0 &&
+ status < WAIT_OBJECT_0 + nr_handles)
#pragma warning (default: 4296)
{
HANDLE event = handles[status - WAIT_OBJECT_0];
if (event == hServiceExitEvent)
{
+ OutputDebugString("Service Exit fired\n");
XsLogMsg("service exit event");
+ exit = true;
break;
}
- else if (event == nicInfo->NicChangeEvent)
- {
- XsLogMsg("NICs changed");
- nicInfo->Refresh();
- XenstoreKickXapi();
- XsLogMsg("Handled NIC change");
- nicInfo->Prime();
- }
else if (event == suspendEvent)
{
+ OutputDebugString("Suspend fired\n");
XsLogMsg("Suspend event");
finishSuspend();
- refreshStoreData(wmi, nicInfo, tsInfo, &features);
+ AdvertiseFeatures(&features);
+ XenstoreKickXapi();
XsLogMsg("Handled suspend event");
}
+ else if (event == wmierrorEvent)
+ {
+ break;
+ }
else
{
+ OutputDebugString("Feature fired\n");
+ BOOL fail = false;
for (x = 0; x < features.nr_features; x++) {
if (features.features[x].watch->event == event) {
XsLogMsg("fire feature %s", features.features[x].name);
- features.features[x].handler(features.features[x].ctx);
+ OutputDebugString("Event triggered\n");
+ if (!(features.features[x].handler(features.features[x].ctx)))
+ {
+ PrintError("Feature failed");
+ fail = true;
+ }
XsLogMsg("fired feature %s",
features.features[x].name);
}
}
+ if (fail)
+ break;
}
}
else
break;
}
}
+ OutputDebugString("WMI Watch loop terminated\n");
+ RemoveFeatures(&features);
+ XenstoreKickXapi();
- XsLogMsg("Guest agent finishing");
- ReleaseWMIAccessor(wmi);
-
-
- delete tsInfo;
- delete nicInfo;
+ XsLogMsg("Guest agent lite loop finishing");
+ ReleaseWMIAccessor(&wmi);
- ServiceControlManagerUpdate(0, SERVICE_STOPPED);
- if (SLC_API != NULL)
- FreeLibrary(SLC_API);
- if (SLWGA_API != NULL)
- FreeLibrary(SLWGA_API);
+
- XsLogMsg("Guest agent finished");
+ XsLogMsg("Guest agent lite loop finished %d", exit);
+ return exit;
}
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus (hStatus, &ServiceStatus);
- if (isBetterAgentInstalled()) {
- ServiceStatus.dwCurrentState = SERVICE_STOPPED;
- SetServiceStatus (hStatus, &ServiceStatus);
- }
-
return true;
}
DBGPRINT(("XenSvc: Unable to init xenservice\n"));
return;
}
+ BOOL stopping;
+ //InitCom();
- XsInitPerThreadLogging();
-
- ConnectToWMI();
- InitXSAccessor();
- XsLog("Guest agent service starting");
-
- __try
- {
- Run();
- }
- __except(XsDumpLogThisThread(), EXCEPTION_CONTINUE_SEARCH)
- {
- }
-
+ do {
+
+ __try
+ {
+ stopping = Run();
+
+ }
+ __except(EXCEPTION_EXECUTE_HANDLER)
+ {
+ }
+ } while (!stopping);
+
+ //ReleaseCom();
XsLog("Guest agent service stopped");
ShutdownXSAccessor();
-
+ ServiceControlManagerUpdate(0, SERVICE_STOPPED);
return;
}
--- /dev/null
+/* Copyright (c) Citrix Systems Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the
+ * following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the
+ * following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* Black-box data recorder. This records stuff which is happening
+ while the agent runs, and tries to push it out to dom0 syslog if we
+ crash. */
+#include "stdafx.h"
+#include <windows.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "XService.h"
+#include "XSAccessor.h"
+
+
+#define RING_SIZE 8192
+
+struct message_ring {
+ HANDLE handle;
+ unsigned prod_idx;
+ unsigned cons_idx;
+ unsigned char payload[RING_SIZE];
+};
+
+static __declspec(thread) struct message_ring message_ring;
+
+static char *
+Xsvasprintf(const char *fmt, va_list args)
+{
+ char *work;
+ int work_size;
+ int r;
+
+ work_size = 32;
+ while (1) {
+ work = (char *)malloc(work_size);
+ if (!work)
+ return work;
+ r = _vsnprintf(work, work_size, fmt, args);
+ if (r == 0) {
+ free(work);
+ return NULL;
+ }
+ if (r != -1 && r < work_size) {
+ return work;
+ }
+ free(work);
+ work_size *= 2;
+ }
+}
+
+static char *
+Xsasprintf(const char *fmt, ...)
+{
+ va_list args;
+ char *res;
+
+ va_start(args, fmt);
+ res = Xsvasprintf(fmt, args);
+ va_end(args);
+ return res;
+}
+
+void
+XsLogMsg(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ XsLog(fmt, args);
+ va_end(args);
+}
+
+
+++ /dev/null
-/* Copyright (c) Citrix Systems Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms,
- * with or without modification, are permitted provided
- * that the following conditions are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#ifndef __vm_stats_h
-#define __vm_stats_h
-
-#define MAX_CHAR_LEN 128
-
-typedef unsigned int uint32_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-
-typedef struct _VIFData {
- uint32_t ethnum;
- char mac[MAX_CHAR_LEN];
- char name[MAX_CHAR_LEN];
- char ip[MAX_CHAR_LEN];
-} VIFData;
-
-typedef struct _VMData {
- time_t time;
- int64_t meminfo_free;
- int64_t meminfo_total;
-} VMData;
-
-#endif
-
#include <windows.h>
#include <ntverp.h>
-#include "version.h"
+
#define VER_INTERNALNAME_STR "w32xagent.exe"
#define VER_FILEVERSION_STR "1.0"
xen_icon ICON "xen.ico"
#include "common.ver"
-
-#include "messages.rc"
+#include "messages.rc"
\ No newline at end of file
\r
[DestinationDirs]\r
DefaultDestDir = 12\r
+ServiceDestDir.NT.Copy = 11\r
\r
;*****************************************\r
; Xeniface Device Install Section\r
%XenIfaceDevice.DeviceDesc% =XenIface_Device, XENBUS\VEN_XS0002&DEV_IFACE&REV_00000001\r
\r
[XenIface_Device.NT$ARCH$]\r
-CopyFiles=XenIface_Device.NT.Copy\r
+CopyFiles=XenIface_Device.NT.Copy, ServiceDestDir.NT.Copy\r
\r
[XenIFace_Device.NT.Copy]\r
xeniface.sys\r
\r
+[ServiceDestDir.NT.Copy]\r
+liteagent.exe\r
+\r
;-------------- Service installation\r
\r
[Xeniface_Device.NT$ARCH$.Services]\r
AddService = xeniface, %SPSVCINST_ASSOCSERVICE%, xeniface_Service_Inst\r
+AddService = xenlite, %LITESVC_FLAGS%, xenlite_Service_Inst\r
\r
[xeniface_Service_Inst]\r
DisplayName = %XenIfaceDevice.DeviceDesc%\r
ServiceBinary = %12%\xeniface.sys\r
LoadOrderGroup = Extended Base\r
\r
+[xenlite_Service_Inst]\r
+DisplayName = %xenlite.SVCDESC%\r
+ServiceType = 16 ; SERVICE_WIN32_OWN_PROCESS\r
+StartType = 2 ; SERVICE_AUTO_START \r
+ErrorControl = 1 ; SERVICE_ERROR_NORMAL\r
+ServiceBinary = %11%\liteagent.exe\r
+\r
\r
[SourceDisksNames]\r
1 = %DiskId1%,,,""\r
\r
[SourceDisksFiles]\r
xeniface.sys = 1,,\r
+liteagent.exe = 1,,\r
\r
[Strings]\r
SPSVCINST_ASSOCSERVICE= 0x00000002\r
Citrix= "Citrix Systems, Inc." \r
DiskId1 = "XenServer Tools for Virtual Machines"\r
XenIfaceDevice.DeviceDesc = "XenServer Interface"\r
+xeniface.SVCDESC = "XenServer Interface Device Driver"\r
+LITESVC_FLAGS= 0x00000800\r
+xenlite.SVCDESC= "XenSerrver Lite Guest Agent"\r
\r