Skip to content

Commit 8236137

Browse files
committed
Initial version in Git repo. Fixed a a pointer size bug
0 parents  commit 8236137

12 files changed

+1101
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bin/
2+
obj/
3+
*.dll
4+
*.suo
5+
*.user
6+
*.pdb
7+
*.resharper
8+
*.resharper.user
9+
*.gpState
10+
*.swp

FileMap.sln

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 10.00
3+
# Visual Studio 2008
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileMap", "FileMap\FileMap.csproj", "{844CB30E-2F9E-4B34-A601-702D3A394F3E}"
5+
EndProject
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.FileMap", "Test.FileMap\Test.FileMap.csproj", "{3D2A2D6F-B7C6-41A3-B753-A51D8BED8159}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{844CB30E-2F9E-4B34-A601-702D3A394F3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{844CB30E-2F9E-4B34-A601-702D3A394F3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{844CB30E-2F9E-4B34-A601-702D3A394F3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{844CB30E-2F9E-4B34-A601-702D3A394F3E}.Release|Any CPU.Build.0 = Release|Any CPU
18+
{3D2A2D6F-B7C6-41A3-B753-A51D8BED8159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{3D2A2D6F-B7C6-41A3-B753-A51D8BED8159}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{3D2A2D6F-B7C6-41A3-B753-A51D8BED8159}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{3D2A2D6F-B7C6-41A3-B753-A51D8BED8159}.Release|Any CPU.Build.0 = Release|Any CPU
22+
EndGlobalSection
23+
GlobalSection(SolutionProperties) = preSolution
24+
HideSolutionNode = FALSE
25+
EndGlobalSection
26+
EndGlobal

FileMap/FileMap.csproj

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>9.0.30729</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{844CB30E-2F9E-4B34-A601-702D3A394F3E}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>Winterdom.IO.FileMap</RootNamespace>
12+
<AssemblyName>Winterdom.IO.FileMap</AssemblyName>
13+
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<TargetFrameworkSubset>
16+
</TargetFrameworkSubset>
17+
<SignAssembly>true</SignAssembly>
18+
<AssemblyOriginatorKeyFile>Winterdom.snk</AssemblyOriginatorKeyFile>
19+
<StartupObject>
20+
</StartupObject>
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
23+
<DebugSymbols>true</DebugSymbols>
24+
<DebugType>full</DebugType>
25+
<Optimize>false</Optimize>
26+
<OutputPath>bin\Debug\</OutputPath>
27+
<DefineConstants>DEBUG;TRACE</DefineConstants>
28+
<ErrorReport>prompt</ErrorReport>
29+
<WarningLevel>4</WarningLevel>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32+
<DebugType>pdbonly</DebugType>
33+
<Optimize>true</Optimize>
34+
<OutputPath>bin\Release\</OutputPath>
35+
<DefineConstants>TRACE</DefineConstants>
36+
<ErrorReport>prompt</ErrorReport>
37+
<WarningLevel>4</WarningLevel>
38+
</PropertyGroup>
39+
<ItemGroup>
40+
<Reference Include="System" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Drawing" />
43+
<Reference Include="System.Xml" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="FileMapIOException.cs" />
47+
<Compile Include="MapViewStream.cs" />
48+
<Compile Include="MemoryMappedFile.cs" />
49+
<Compile Include="Properties\AssemblyInfo.cs" />
50+
<Compile Include="Win32APIs.cs" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<None Include="Winterdom.snk" />
54+
</ItemGroup>
55+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
56+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
57+
Other similar extension points exist, see Microsoft.Common.targets.
58+
<Target Name="BeforeBuild">
59+
</Target>
60+
<Target Name="AfterBuild">
61+
</Target>
62+
-->
63+
</Project>

FileMap/FileMapIOException.cs

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
2+
//
3+
// FileMapIOException.cs
4+
//
5+
// Implementation of a library to use Win32 Memory Mapped
6+
// Files from within .NET applications
7+
//
8+
// COPYRIGHT (C) 2001, Tomas Restrepo ([email protected])
9+
//
10+
// This library is free software; you can redistribute it and/or
11+
// modify it under the terms of the GNU Lesser General Public
12+
// License as published by the Free Software Foundation; either
13+
// version 2.1 of the License, or (at your option) any later version.
14+
//
15+
// This library is distributed in the hope that it will be useful,
16+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18+
// Lesser General Public License for more details.
19+
//
20+
// You should have received a copy of the GNU Lesser General Public
21+
// License along with this library; if not, write to the Free Software
22+
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23+
//
24+
25+
using System;
26+
using System.IO;
27+
using System.Runtime.InteropServices;
28+
29+
namespace Winterdom.IO.FileMap
30+
{
31+
32+
/// <summary>Exception class thrown by the library</summary>
33+
/// <remarks>
34+
/// Represents an exception occured as a result of an
35+
/// invalid IO operation on any of the File mapping classes
36+
/// It wraps the error message and the underlying Win32 error
37+
/// code that caused the error.
38+
/// </remarks>
39+
// TODO: Make Serializable!
40+
public class FileMapIOException : IOException
41+
{
42+
//
43+
// properties
44+
//
45+
private int m_win32Error = 0;
46+
public int Win32ErrorCode
47+
{
48+
get { return m_win32Error; }
49+
}
50+
public override string Message
51+
{
52+
get
53+
{
54+
if ( Win32ErrorCode != 0 )
55+
return base.Message + " (" + Win32ErrorCode + ")";
56+
else
57+
return base.Message;
58+
}
59+
}
60+
61+
// construction
62+
public FileMapIOException ( int error ) : base()
63+
{
64+
m_win32Error = error;
65+
}
66+
public FileMapIOException ( string message ) : base(message)
67+
{
68+
}
69+
public FileMapIOException ( string message, Exception innerException )
70+
: base(message, innerException)
71+
{
72+
}
73+
74+
} // class FileMapIOException
75+
76+
77+
} // namespace Winterdom.IO.FileMap

0 commit comments

Comments
 (0)