Skip to content

Commit abe31b6

Browse files
author
arryboom
committed
Initial commit
0 parents  commit abe31b6

34 files changed

+1142
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

LICENSE

+674
Large diffs are not rendered by default.

ReadMe.txt

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
========================================================================
2+
STATIC LIBRARY : fmemopen_windows Project Overview
3+
========================================================================
4+
5+
AppWizard has created this fmemopen_windows library project for you.
6+
7+
No source files were created as part of your project.
8+
9+
10+
fmemopen_windows.vcxproj
11+
This is the main project file for VC++ projects generated using an Application Wizard.
12+
It contains information about the version of Visual C++ that generated the file, and
13+
information about the platforms, configurations, and project features selected with the
14+
Application Wizard.
15+
16+
fmemopen_windows.vcxproj.filters
17+
This is the filters file for VC++ projects generated using an Application Wizard.
18+
It contains information about the association between the files in your project
19+
and the filters. This association is used in the IDE to show grouping of files with
20+
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
21+
"Source Files" filter).
22+
23+
/////////////////////////////////////////////////////////////////////////////
24+
Other notes:
25+
26+
AppWizard uses "TODO:" comments to indicate parts of the source code you
27+
should add to or customize.
28+
29+
/////////////////////////////////////////////////////////////////////////////

Release/fmemopen_windows.log

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Build started 2019/11/7 2:27:55.
2+
1>Project "Z:\fmemopen_windows\fmemopen_windows.vcxproj" on node 2 (Build target(s)).
3+
1>ClCompile:
4+
D:\VS2013\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D WIN32 /D NDEBUG /D _LIB /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc120.pdb" /Gd /TC /analyze- /errorReport:prompt libfmemopen.c
5+
libfmemopen.c
6+
Lib:
7+
D:\VS2013\VC\bin\Lib.exe /OUT:"Z:\fmemopen_windows\Release\fmemopen_windows.lib" /NOLOGO /LTCG Release\libfmemopen.obj
8+
fmemopen_windows.vcxproj -> Z:\fmemopen_windows\Release\fmemopen_windows.lib
9+
1>Done Building Project "Z:\fmemopen_windows\fmemopen_windows.vcxproj" (Build target(s)).
10+
11+
Build succeeded.
12+
13+
Time Elapsed 00:00:00.39
17.7 KB
Binary file not shown.
242 Bytes
Binary file not shown.
346 Bytes
Binary file not shown.
194 Bytes
Binary file not shown.
558 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
2+
Release|Win32|Z:\fmemopen_windows\|
284 Bytes
Binary file not shown.

Release/fmemopen_windows_32.lib

54.7 KB
Binary file not shown.

Release/libfmemopen.obj

54.3 KB
Binary file not shown.

Release/vc120.pdb

76 KB
Binary file not shown.

fmemopen_windows.cbp

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_project_file>
3+
<FileVersion major="1" minor="6" />
4+
<Project>
5+
<Option title="fmemopen_windows" />
6+
<Option pch_mode="2" />
7+
<Option compiler="gcc" />
8+
<Build>
9+
<Target title="Debug">
10+
<Option output="bin/Debug/fmemopen_windows" prefix_auto="1" extension_auto="1" />
11+
<Option working_dir="" />
12+
<Option object_output="obj/Debug/" />
13+
<Option type="2" />
14+
<Option compiler="gcc" />
15+
<Option createDefFile="1" />
16+
<Compiler>
17+
<Add option="-Wall" />
18+
<Add option="-g" />
19+
</Compiler>
20+
</Target>
21+
<Target title="Release">
22+
<Option output="bin/Release/fmemopen_windows" prefix_auto="1" extension_auto="1" />
23+
<Option working_dir="" />
24+
<Option object_output="obj/Release/" />
25+
<Option type="2" />
26+
<Option compiler="gcc" />
27+
<Option createDefFile="1" />
28+
<Compiler>
29+
<Add option="-Wall" />
30+
<Add option="-O2" />
31+
</Compiler>
32+
<Linker>
33+
<Add option="-s" />
34+
</Linker>
35+
</Target>
36+
</Build>
37+
<Unit filename="main.c">
38+
<Option compilerVar="CC" />
39+
</Unit>
40+
<Extensions>
41+
<code_completion />
42+
<envvars />
43+
<debugger />
44+
<lib_finder disable_auto="1" />
45+
</Extensions>
46+
</Project>
47+
</CodeBlocks_project_file>

fmemopen_windows.sln

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.40629.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmemopen_windows", "fmemopen_windows.vcxproj", "{43D35F74-591E-4AB9-BBB4-083AD3071CD2}"
7+
EndProject
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzzxcvzxc", "..\testzzxcvzxc\testzzxcvzxc.vcxproj", "{5F327908-581D-424E-ACEE-C305253A571D}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Win32 = Debug|Win32
13+
Debug|x64 = Debug|x64
14+
Release|Win32 = Release|Win32
15+
Release|x64 = Release|x64
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Debug|Win32.ActiveCfg = Debug|Win32
19+
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Debug|Win32.Build.0 = Debug|Win32
20+
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Debug|x64.ActiveCfg = Debug|x64
21+
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Debug|x64.Build.0 = Debug|x64
22+
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Release|Win32.ActiveCfg = Release|Win32
23+
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Release|Win32.Build.0 = Release|Win32
24+
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Release|x64.ActiveCfg = Release|x64
25+
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Release|x64.Build.0 = Release|x64
26+
{5F327908-581D-424E-ACEE-C305253A571D}.Debug|Win32.ActiveCfg = Debug|Win32
27+
{5F327908-581D-424E-ACEE-C305253A571D}.Debug|Win32.Build.0 = Debug|Win32
28+
{5F327908-581D-424E-ACEE-C305253A571D}.Debug|x64.ActiveCfg = Debug|x64
29+
{5F327908-581D-424E-ACEE-C305253A571D}.Debug|x64.Build.0 = Debug|x64
30+
{5F327908-581D-424E-ACEE-C305253A571D}.Release|Win32.ActiveCfg = Release|Win32
31+
{5F327908-581D-424E-ACEE-C305253A571D}.Release|Win32.Build.0 = Release|Win32
32+
{5F327908-581D-424E-ACEE-C305253A571D}.Release|x64.ActiveCfg = Release|x64
33+
{5F327908-581D-424E-ACEE-C305253A571D}.Release|x64.Build.0 = Release|x64
34+
EndGlobalSection
35+
GlobalSection(SolutionProperties) = preSolution
36+
HideSolutionNode = FALSE
37+
EndGlobalSection
38+
EndGlobal

fmemopen_windows.v12.suo

26.5 KB
Binary file not shown.

fmemopen_windows.vcxproj

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|x64">
9+
<Configuration>Debug</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Release|Win32">
13+
<Configuration>Release</Configuration>
14+
<Platform>Win32</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<ProjectGuid>{43D35F74-591E-4AB9-BBB4-083AD3071CD2}</ProjectGuid>
23+
<Keyword>Win32Proj</Keyword>
24+
<RootNamespace>fmemopen_windows</RootNamespace>
25+
</PropertyGroup>
26+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
28+
<ConfigurationType>StaticLibrary</ConfigurationType>
29+
<UseDebugLibraries>true</UseDebugLibraries>
30+
<PlatformToolset>v120</PlatformToolset>
31+
<CharacterSet>Unicode</CharacterSet>
32+
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
34+
<ConfigurationType>StaticLibrary</ConfigurationType>
35+
<UseDebugLibraries>true</UseDebugLibraries>
36+
<PlatformToolset>v120</PlatformToolset>
37+
<CharacterSet>Unicode</CharacterSet>
38+
</PropertyGroup>
39+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
40+
<ConfigurationType>StaticLibrary</ConfigurationType>
41+
<UseDebugLibraries>false</UseDebugLibraries>
42+
<PlatformToolset>v120</PlatformToolset>
43+
<WholeProgramOptimization>true</WholeProgramOptimization>
44+
<CharacterSet>Unicode</CharacterSet>
45+
</PropertyGroup>
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
47+
<ConfigurationType>StaticLibrary</ConfigurationType>
48+
<UseDebugLibraries>false</UseDebugLibraries>
49+
<PlatformToolset>v120</PlatformToolset>
50+
<WholeProgramOptimization>true</WholeProgramOptimization>
51+
<CharacterSet>Unicode</CharacterSet>
52+
</PropertyGroup>
53+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
54+
<ImportGroup Label="ExtensionSettings">
55+
</ImportGroup>
56+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
57+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
58+
</ImportGroup>
59+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
60+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
61+
</ImportGroup>
62+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
63+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
64+
</ImportGroup>
65+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
66+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
67+
</ImportGroup>
68+
<PropertyGroup Label="UserMacros" />
69+
<PropertyGroup />
70+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
71+
<ClCompile>
72+
<PrecompiledHeader>
73+
</PrecompiledHeader>
74+
<WarningLevel>Level3</WarningLevel>
75+
<Optimization>Disabled</Optimization>
76+
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
77+
</ClCompile>
78+
<Link>
79+
<SubSystem>Windows</SubSystem>
80+
<GenerateDebugInformation>true</GenerateDebugInformation>
81+
</Link>
82+
</ItemDefinitionGroup>
83+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
84+
<ClCompile>
85+
<PrecompiledHeader>
86+
</PrecompiledHeader>
87+
<WarningLevel>Level3</WarningLevel>
88+
<Optimization>Disabled</Optimization>
89+
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
90+
</ClCompile>
91+
<Link>
92+
<SubSystem>Windows</SubSystem>
93+
<GenerateDebugInformation>true</GenerateDebugInformation>
94+
</Link>
95+
</ItemDefinitionGroup>
96+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
97+
<ClCompile>
98+
<WarningLevel>Level3</WarningLevel>
99+
<PrecompiledHeader>
100+
</PrecompiledHeader>
101+
<Optimization>MaxSpeed</Optimization>
102+
<FunctionLevelLinking>true</FunctionLevelLinking>
103+
<IntrinsicFunctions>true</IntrinsicFunctions>
104+
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
105+
</ClCompile>
106+
<Link>
107+
<SubSystem>Windows</SubSystem>
108+
<GenerateDebugInformation>true</GenerateDebugInformation>
109+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
110+
<OptimizeReferences>true</OptimizeReferences>
111+
</Link>
112+
</ItemDefinitionGroup>
113+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
114+
<ClCompile>
115+
<WarningLevel>Level3</WarningLevel>
116+
<PrecompiledHeader>
117+
</PrecompiledHeader>
118+
<Optimization>MaxSpeed</Optimization>
119+
<FunctionLevelLinking>true</FunctionLevelLinking>
120+
<IntrinsicFunctions>true</IntrinsicFunctions>
121+
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
122+
</ClCompile>
123+
<Link>
124+
<SubSystem>Windows</SubSystem>
125+
<GenerateDebugInformation>true</GenerateDebugInformation>
126+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
127+
<OptimizeReferences>true</OptimizeReferences>
128+
</Link>
129+
</ItemDefinitionGroup>
130+
<ItemGroup>
131+
<Text Include="ReadMe.txt" />
132+
</ItemGroup>
133+
<ItemGroup>
134+
<ClCompile Include="libfmemopen.c" />
135+
</ItemGroup>
136+
<ItemGroup>
137+
<ClInclude Include="libfmemopen.h" />
138+
</ItemGroup>
139+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
140+
<ImportGroup Label="ExtensionTargets">
141+
</ImportGroup>
142+
</Project>

fmemopen_windows.vcxproj.filters

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<Text Include="ReadMe.txt" />
19+
</ItemGroup>
20+
<ItemGroup>
21+
<ClCompile Include="libfmemopen.c">
22+
<Filter>Source Files</Filter>
23+
</ClCompile>
24+
</ItemGroup>
25+
<ItemGroup>
26+
<ClInclude Include="libfmemopen.h">
27+
<Filter>Header Files</Filter>
28+
</ClInclude>
29+
</ItemGroup>
30+
</Project>

libfmemopen.c

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <stdio.h>
2+
#include <windows.h>
3+
#include <share.h>
4+
#include <io.h>
5+
#include <fcntl.h>
6+
#include <sys/stat.h>
7+
8+
FILE *fmemopen(void *buf, size_t len, const char *type)
9+
{
10+
int fd;
11+
FILE *fp;
12+
char tp[MAX_PATH - 13];
13+
char fn[MAX_PATH + 1];
14+
int * pfd = &fd;
15+
int retner = -1;
16+
char tfname[] = "MemTF_";
17+
if (!GetTempPathA(sizeof(tp), tp))
18+
return NULL;
19+
if (!GetTempFileNameA(tp, tfname, 0, fn))
20+
return NULL;
21+
retner = _sopen_s(pfd, fn, _O_CREAT | _O_SHORT_LIVED | _O_TEMPORARY | _O_RDWR | _O_BINARY | _O_NOINHERIT, _SH_DENYRW, _S_IREAD | _S_IWRITE);
22+
if (retner != 0)
23+
return NULL;
24+
if (fd == -1)
25+
return NULL;
26+
fp = _fdopen(fd, "w+");
27+
if (!fp) {
28+
_close(fd);
29+
return NULL;
30+
}
31+
/*File descriptors passed into _fdopen are owned by the returned FILE * stream.If _fdopen is successful, do not call _close on the file descriptor.Calling fclose on the returned FILE * also closes the file descriptor.*/
32+
fwrite(buf, len, 1, fp);
33+
rewind(fp);
34+
return fp;
35+
}

libfmemopen.h

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#ifndef libfmemopen_windows
2+
#define libfmemopen_windows
3+
FILE *fmemopen(void *buf, size_t len, const char *type);
4+
#endif

0 commit comments

Comments
 (0)