Skip to content

Commit 61da322

Browse files
SND\jaredp110680_cpSND\jaredp110680_cp
SND\jaredp110680_cp
authored and
SND\jaredp110680_cp
committed
Initial upload of PInvoke source
git-svn-id: https://clrinterop.svn.codeplex.com/svn@8514 e17a0e51-4ae3-4d35-97c3-1a29b211df97
1 parent 6e799a0 commit 61da322

File tree

286 files changed

+606174
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+606174
-0
lines changed

PInvokeTool/Installer/PInvokeGeneratorSetup.vdproj

+1,032
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/* **********************************************************************************
2+
*
3+
* Copyright (c) Microsoft Corporation. All rights reserved.
4+
*
5+
* **********************************************************************************/
6+
7+
using System;
8+
using System.IO;
9+
using System.Text;
10+
using System.Diagnostics;
11+
using System.Collections.Generic;
12+
using SignatureGenerator;
13+
14+
namespace ConsoleTool
15+
{
16+
class ConsolePrinter : ICodePrinter, ILogPrinter
17+
{
18+
#region ColorScheme
19+
20+
private struct CodeColorScheme
21+
{
22+
private readonly ConsoleColor[] colors;
23+
24+
public static CodeColorScheme Default = new CodeColorScheme(
25+
ConsoleColor.Cyan,
26+
ConsoleColor.White,
27+
ConsoleColor.White,
28+
ConsoleColor.Yellow,
29+
ConsoleColor.Magenta,
30+
ConsoleColor.Green,
31+
ConsoleColor.White);
32+
33+
public CodeColorScheme(
34+
ConsoleColor keyword,
35+
ConsoleColor @operator,
36+
ConsoleColor identifier,
37+
ConsoleColor typeName,
38+
ConsoleColor literal,
39+
ConsoleColor comment,
40+
ConsoleColor other)
41+
{
42+
this.colors = new ConsoleColor[(int)OutputType.End__];
43+
44+
this.colors[(int)OutputType.Keyword] = keyword;
45+
this.colors[(int)OutputType.Operator] = @operator;
46+
this.colors[(int)OutputType.Identifier] = identifier;
47+
this.colors[(int)OutputType.TypeName] = typeName;
48+
this.colors[(int)OutputType.Literal] = literal;
49+
this.colors[(int)OutputType.Comment] = comment;
50+
this.colors[(int)OutputType.Other] = other;
51+
}
52+
53+
public ConsoleColor GetColor(OutputType outputType)
54+
{
55+
return colors[(int)outputType];
56+
}
57+
}
58+
59+
private struct LogColorScheme
60+
{
61+
private readonly ConsoleColor[] colors;
62+
63+
public static LogColorScheme Default = new LogColorScheme(
64+
ConsoleColor.White,
65+
ConsoleColor.Yellow,
66+
ConsoleColor.Red);
67+
68+
public LogColorScheme(
69+
ConsoleColor info,
70+
ConsoleColor warning,
71+
ConsoleColor error)
72+
{
73+
this.colors = new ConsoleColor[(int)Severity.End__];
74+
75+
this.colors[(int)Severity.Info] = info;
76+
this.colors[(int)Severity.Warning] = warning;
77+
this.colors[(int)Severity.Error] = error;
78+
}
79+
80+
public ConsoleColor GetColor(Severity severity)
81+
{
82+
return colors[(int)severity];
83+
}
84+
}
85+
86+
#endregion
87+
88+
#region Fields
89+
90+
private int indentLevel;
91+
private CodeColorScheme codeScheme = CodeColorScheme.Default;
92+
private LogColorScheme logScheme = LogColorScheme.Default;
93+
94+
private const string indent = " ";
95+
96+
#endregion
97+
98+
#region ICodePrinter Members
99+
100+
public void Print(OutputType codeType, string str)
101+
{
102+
ConsoleColor old_color = Console.ForegroundColor;
103+
Console.ForegroundColor = codeScheme.GetColor(codeType);
104+
105+
Console.Write(str);
106+
107+
Console.ForegroundColor = old_color;
108+
}
109+
110+
public void PrintLn()
111+
{
112+
Console.WriteLine();
113+
114+
for (int i = 0; i < indentLevel; i++) Console.Write(indent);
115+
}
116+
117+
public void PrintLn(OutputType codeType, string str)
118+
{
119+
Print(codeType, str);
120+
PrintLn();
121+
}
122+
123+
#endregion
124+
125+
#region ILogPrinter Members
126+
127+
public void PrintEntry(Severity severity, int code, string message)
128+
{
129+
ConsoleColor old_color = Console.ForegroundColor;
130+
Console.ForegroundColor = logScheme.GetColor(severity);
131+
132+
Console.Error.WriteLine(LogFormatter.Format(severity, code, indentLevel, message));
133+
134+
Console.ForegroundColor = old_color;
135+
}
136+
137+
public void Separate()
138+
{
139+
Console.WriteLine();
140+
}
141+
142+
public void Indent()
143+
{
144+
indentLevel++;
145+
}
146+
147+
public void Unindent()
148+
{
149+
Debug.Assert(indentLevel > 0);
150+
indentLevel--;
151+
}
152+
153+
#endregion
154+
}
155+
156+
public class TextWriterPrinter : TextWriterCodePrinter, ILogPrinter
157+
{
158+
#region Construction
159+
160+
public TextWriterPrinter(TextWriter writer)
161+
: base(writer)
162+
{ }
163+
164+
#endregion
165+
166+
#region ILogPrinter Members
167+
168+
public void PrintEntry(Severity severity, int code, string message)
169+
{
170+
writer.WriteLine(LogFormatter.Format(severity, code, indentLevel, message));
171+
}
172+
173+
public void Separate()
174+
{
175+
writer.WriteLine();
176+
}
177+
178+
#endregion
179+
}
180+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
2+
<PropertyGroup>
3+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5+
<ProductVersion>9.0.21022</ProductVersion>
6+
<SchemaVersion>2.0</SchemaVersion>
7+
<ProjectGuid>{47391AEF-A54F-4971-8B01-10CA3A8AD181}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>ConsoleTool</RootNamespace>
11+
<AssemblyName>sigexp</AssemblyName>
12+
<StartupObject>
13+
</StartupObject>
14+
<FileUpgradeFlags>
15+
</FileUpgradeFlags>
16+
<OldToolsVersion>3.5</OldToolsVersion>
17+
<UpgradeBackupLocation>
18+
</UpgradeBackupLocation>
19+
<PublishUrl>publish\</PublishUrl>
20+
<Install>true</Install>
21+
<InstallFrom>Disk</InstallFrom>
22+
<UpdateEnabled>false</UpdateEnabled>
23+
<UpdateMode>Foreground</UpdateMode>
24+
<UpdateInterval>7</UpdateInterval>
25+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
26+
<UpdatePeriodically>false</UpdatePeriodically>
27+
<UpdateRequired>false</UpdateRequired>
28+
<MapFileExtensions>true</MapFileExtensions>
29+
<ApplicationRevision>0</ApplicationRevision>
30+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
31+
<IsWebBootstrapper>false</IsWebBootstrapper>
32+
<UseApplicationTrust>false</UseApplicationTrust>
33+
<BootstrapperEnabled>true</BootstrapperEnabled>
34+
</PropertyGroup>
35+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
36+
<DebugSymbols>true</DebugSymbols>
37+
<DebugType>full</DebugType>
38+
<Optimize>false</Optimize>
39+
<OutputPath>bin\Debug\</OutputPath>
40+
<DefineConstants>DEBUG;TRACE</DefineConstants>
41+
<ErrorReport>prompt</ErrorReport>
42+
<WarningLevel>4</WarningLevel>
43+
<RunCodeAnalysis>true</RunCodeAnalysis>
44+
<CodeAnalysisRules>-Microsoft.Design#CA1012;-Microsoft.Design#CA2210;-Microsoft.Design#CA1040;-Microsoft.Design#CA1005;-Microsoft.Design#CA1020;-Microsoft.Design#CA1021;-Microsoft.Design#CA1010;-Microsoft.Design#CA1011;-Microsoft.Design#CA1009;-Microsoft.Design#CA1050;-Microsoft.Design#CA1026;-Microsoft.Design#CA1019;-Microsoft.Design#CA1031;-Microsoft.Design#CA1047;-Microsoft.Design#CA1000;-Microsoft.Design#CA1048;-Microsoft.Design#CA1051;-Microsoft.Design#CA1002;-Microsoft.Design#CA1061;-Microsoft.Design#CA1006;-Microsoft.Design#CA1046;-Microsoft.Design#CA1045;-Microsoft.Design#CA1065;-Microsoft.Design#CA1038;-Microsoft.Design#CA1008;-Microsoft.Design#CA1028;-Microsoft.Design#CA1064;-Microsoft.Design#CA1004;-Microsoft.Design#CA1035;-Microsoft.Design#CA1063;-Microsoft.Design#CA1032;-Microsoft.Design#CA1023;-Microsoft.Design#CA1033;-Microsoft.Design#CA1039;-Microsoft.Design#CA1016;-Microsoft.Design#CA1014;-Microsoft.Design#CA1017;-Microsoft.Design#CA1018;-Microsoft.Design#CA1027;-Microsoft.Design#CA1059;-Microsoft.Design#CA1060;-Microsoft.Design#CA1034;-Microsoft.Design#CA1013;-Microsoft.Design#CA1036;-Microsoft.Design#CA1044;-Microsoft.Design#CA1041;-Microsoft.Design#CA1025;-Microsoft.Design#CA1052;-Microsoft.Design#CA1053;-Microsoft.Design#CA1057;-Microsoft.Design#CA1058;-Microsoft.Design#CA1001;-Microsoft.Design#CA1049;-Microsoft.Design#CA1054;-Microsoft.Design#CA1056;-Microsoft.Design#CA1055;-Microsoft.Design#CA1030;-Microsoft.Design#CA1003;-Microsoft.Design#CA1007;-Microsoft.Design#CA1043;-Microsoft.Design#CA1024;-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302;-Microsoft.Globalization#CA1308;-Microsoft.Globalization#CA1306;-Microsoft.Globalization#CA1304;-Microsoft.Globalization#CA1305;-Microsoft.Globalization#CA2101;-Microsoft.Globalization#CA1300;-Microsoft.Globalization#CA1307;-Microsoft.Globalization#CA1309;-Microsoft.Interoperability#CA1403;-Microsoft.Interoperability#CA1406;-Microsoft.Interoperability#CA1413;-Microsoft.Interoperability#CA1402;-Microsoft.Interoperability#CA1407;-Microsoft.Interoperability#CA1404;-Microsoft.Interoperability#CA1410;-Microsoft.Interoperability#CA1411;-Microsoft.Interoperability#CA1405;-Microsoft.Interoperability#CA1409;-Microsoft.Interoperability#CA1415;-Microsoft.Interoperability#CA1408;-Microsoft.Interoperability#CA1414;-Microsoft.Interoperability#CA1412;-Microsoft.Interoperability#CA1400;-Microsoft.Interoperability#CA1401;-Microsoft.Maintainability#CA1506;-Microsoft.Maintainability#CA1502;-Microsoft.Maintainability#CA1501;-Microsoft.Maintainability#CA1505;-Microsoft.Maintainability#CA1504;-Microsoft.Maintainability#CA1500;-Microsoft.Mobility#CA1600;-Microsoft.Mobility#CA1601;-Microsoft.Naming#CA1702;-Microsoft.Naming#CA1700;-Microsoft.Naming#CA1712;-Microsoft.Naming#CA1713;-Microsoft.Naming#CA1714;-Microsoft.Naming#CA1709;-Microsoft.Naming#CA1704;-Microsoft.Naming#CA1708;-Microsoft.Naming#CA1715;-Microsoft.Naming#CA1710;-Microsoft.Naming#CA1720;-Microsoft.Naming#CA1707;-Microsoft.Naming#CA1722;-Microsoft.Naming#CA1711;-Microsoft.Naming#CA1716;-Microsoft.Naming#CA1717;-Microsoft.Naming#CA1725;-Microsoft.Naming#CA1719;-Microsoft.Naming#CA1721;-Microsoft.Naming#CA1701;-Microsoft.Naming#CA1703;-Microsoft.Naming#CA1724;-Microsoft.Naming#CA1726;-Microsoft.Performance#CA1809;-Microsoft.Performance#CA1811;-Microsoft.Performance#CA1812;-Microsoft.Performance#CA1813;-Microsoft.Performance#CA1823;-Microsoft.Performance#CA1800;-Microsoft.Performance#CA1805;-Microsoft.Performance#CA1810;-Microsoft.Performance#CA1824;-Microsoft.Performance#CA1822;-Microsoft.Performance#CA1815;-Microsoft.Performance#CA1814;-Microsoft.Performance#CA1819;-Microsoft.Performance#CA1821;-Microsoft.Performance#CA1804;-Microsoft.Performance#CA1820;-Microsoft.Performance#CA1802;-Microsoft.Portability#CA1901;-Microsoft.Portability#CA1900;-Microsoft.Reliability#CA2001;-Microsoft.Reliability#CA2002;-Microsoft.Reliability#CA2003;-Microsoft.Reliability#CA2004;-Microsoft.Reliability#CA2006;-Microsoft.Usage#CA2243;-Microsoft.Usage#CA2236;-Microsoft.Usage#CA1816;-Microsoft.Usage#CA2227;-Microsoft.Usage#CA2213;-Microsoft.Usage#CA2216;-Microsoft.Usage#CA2214;-Microsoft.Usage#CA2222;-Microsoft.Usage#CA1806;-Microsoft.Usage#CA2217;-Microsoft.Usage#CA2212;-Microsoft.Usage#CA2219;-Microsoft.Usage#CA2201;-Microsoft.Usage#CA2228;-Microsoft.Usage#CA2221;-Microsoft.Usage#CA2220;-Microsoft.Usage#CA2240;-Microsoft.Usage#CA2229;-Microsoft.Usage#CA2238;-Microsoft.Usage#CA2207;-Microsoft.Usage#CA2208;-Microsoft.Usage#CA2235;-Microsoft.Usage#CA2237;-Microsoft.Usage#CA2232;-Microsoft.Usage#CA2223;-Microsoft.Usage#CA2211;-Microsoft.Usage#CA2233;-Microsoft.Usage#CA2225;-Microsoft.Usage#CA2226;-Microsoft.Usage#CA2231;-Microsoft.Usage#CA2224;-Microsoft.Usage#CA2218;-Microsoft.Usage#CA2234;-Microsoft.Usage#CA2239;-Microsoft.Usage#CA2200;-Microsoft.Usage#CA1801;-Microsoft.Usage#CA2242;-Microsoft.Usage#CA2205;-Microsoft.Usage#CA2230</CodeAnalysisRules>
45+
</PropertyGroup>
46+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
47+
<DebugType>pdbonly</DebugType>
48+
<Optimize>true</Optimize>
49+
<OutputPath>bin\Release\</OutputPath>
50+
<DefineConstants>TRACE</DefineConstants>
51+
<ErrorReport>prompt</ErrorReport>
52+
<WarningLevel>4</WarningLevel>
53+
</PropertyGroup>
54+
<ItemGroup>
55+
<Reference Include="System" />
56+
<Reference Include="System.Data" />
57+
<Reference Include="System.Xml" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Compile Include="Console.cs" />
61+
<Compile Include="Errors.cs" />
62+
<Compile Include="Program.cs" />
63+
<Compile Include="Properties\AssemblyInfo.cs" />
64+
<Compile Include="Resources.Designer.cs">
65+
<AutoGen>True</AutoGen>
66+
<DesignTime>True</DesignTime>
67+
<DependentUpon>Resources.resx</DependentUpon>
68+
</Compile>
69+
</ItemGroup>
70+
<ItemGroup>
71+
<ProjectReference Include="..\Engine\EngineLibrary.csproj">
72+
<Project>{F77F8F23-1EDD-474E-9791-DC766FEDA85B}</Project>
73+
<Name>EngineLibrary</Name>
74+
</ProjectReference>
75+
</ItemGroup>
76+
<ItemGroup>
77+
<EmbeddedResource Include="Resources.resx">
78+
<SubType>Designer</SubType>
79+
<Generator>ResXFileCodeGenerator</Generator>
80+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
81+
</EmbeddedResource>
82+
</ItemGroup>
83+
<ItemGroup>
84+
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
85+
<Visible>False</Visible>
86+
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
87+
<Install>true</Install>
88+
</BootstrapperPackage>
89+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
90+
<Visible>False</Visible>
91+
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
92+
<Install>false</Install>
93+
</BootstrapperPackage>
94+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
95+
<Visible>False</Visible>
96+
<ProductName>.NET Framework 3.5</ProductName>
97+
<Install>false</Install>
98+
</BootstrapperPackage>
99+
</ItemGroup>
100+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
101+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
102+
Other similar extension points exist, see Microsoft.Common.targets.
103+
<Target Name="BeforeBuild">
104+
</Target>
105+
<Target Name="AfterBuild">
106+
</Target>
107+
-->
108+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* **********************************************************************************
2+
*
3+
* Copyright (c) Microsoft Corporation. All rights reserved.
4+
*
5+
* **********************************************************************************/
6+
7+
using System;
8+
using System.Text;
9+
using System.Collections.Generic;
10+
11+
using SignatureGenerator;
12+
13+
namespace ConsoleTool
14+
{
15+
internal static class ConsoleErrors
16+
{
17+
public static readonly ErrorDesc ERROR_AssemblyFileNotSpecified = new ErrorDesc(100, Severity.Error, Resources.ERROR_AssemblyFileNotSpecified);
18+
public static readonly ErrorDesc ERROR_MethodIsNotInterop = new ErrorDesc(101, Severity.Error, Resources.ERROR_MethodIsNotInterop);
19+
public static readonly ErrorDesc ERROR_UnableToFindMethod = new ErrorDesc(102, Severity.Error, Resources.ERROR_UnableToFindMethod);
20+
public static readonly ErrorDesc ERROR_UnableToLoadAssembly = new ErrorDesc(103, Severity.Error, Resources.ERROR_UnableToLoadAssembly);
21+
public static readonly ErrorDesc ERROR_UnableToLoadType = new ErrorDesc(104, Severity.Error, Resources.ERROR_UnableToLoadType);
22+
public static readonly ErrorDesc ERROR_UnrecognizedOption = new ErrorDesc(105, Severity.Error, Resources.ERROR_UnrecognizedOption);
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <fxver.h>
2+
3+
#undef VER_PRIVATE
4+
#undef VER_FILEVERSION
5+
#undef VER_PRODUCTVERSION
6+
#undef VER_FILEVERSION_STR
7+
#undef VER_PRODUCTVERSION_STR
8+
#undef VER_COMMENTS_STR
9+
#undef BUILD_MACHINE_TAG_PADDED
10+
#undef VER_PRODUCTNAME_STR
11+
12+
#define VER_PRIVATE 0
13+
#define VER_FILEVERSION 1.0.0.0
14+
#define VER_PRODUCTVERSION 1.0.0.0
15+
#define VER_FILEVERSION_STR "1.0.0.0"
16+
#define VER_PRODUCTVERSION_STR "1.0.0.0"
17+
#define VER_COMMENTS_STR ""
18+
#define BUILD_MACHINE_TAG_PADDED ""
19+
#define VER_PRODUCTNAME_STR "P/Invoke Interop Assistant"
20+
21+
#include <fxver.rc>
22+
23+
#ifndef FEATURE_PAL
24+
#include <UacAsInvoker.rc>
25+
#endif

0 commit comments

Comments
 (0)