Skip to content

Commit b57cad1

Browse files
committed
add support for mingw32 toolsets
support for mingw32 toolsets 20220125
1 parent 3c69ca7 commit b57cad1

33 files changed

+51
-52
lines changed

Release/fmemopen_windows.lib

139 KB
Binary file not shown.

Release/fmemopen_windows.lib.recipe

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
<ProjectOutputs />
4+
<ContentFiles />
5+
<SatelliteDlls />
6+
<NonRecipeFileRefs />
7+
</Project>

Release/fmemopen_windows.log

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
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
1+
 libfmemopen.c
2+
fmemopen_windows.vcxproj -> C:\Users\jj\Desktop\fmemopen_windows-master\Release\fmemopen_windows.lib
Binary file not shown.
9.07 KB
Binary file not shown.
166 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
302 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
2-
Release|Win32|Z:\fmemopen_windows\|
1+
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30037:VCServicingVersionATL=14.29.30038:VCServicingVersionCrtHeaders=14.29.30040:VCServicingVersionCompilers=14.29.30040:TargetPlatformVersion=10.0.19041.0:
2+
Release|Win32|C:\Users\jj\Desktop\fmemopen_windows-master\|
122 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:\Users\jj\Desktop\fmemopen_windows-master\Release\fmemopen_windows.lib

Release/fmemopen_windows_32.lib

-54.7 KB
Binary file not shown.

Release/libfmemopen.obj

83.7 KB
Binary file not shown.

fmemopen_windows.sln

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.40629.0
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31515.178
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmemopen_windows", "fmemopen_windows.vcxproj", "{43D35F74-591E-4AB9-BBB4-083AD3071CD2}"
77
EndProject
8-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzzxcvzxc", "..\testzzxcvzxc\testzzxcvzxc.vcxproj", "{5F327908-581D-424E-ACEE-C305253A571D}"
9-
EndProject
108
Global
119
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1210
Debug|Win32 = Debug|Win32
@@ -23,16 +21,11 @@ Global
2321
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Release|Win32.Build.0 = Release|Win32
2422
{43D35F74-591E-4AB9-BBB4-083AD3071CD2}.Release|x64.ActiveCfg = Release|x64
2523
{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
3424
EndGlobalSection
3525
GlobalSection(SolutionProperties) = preSolution
3626
HideSolutionNode = FALSE
3727
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {F9FFE1D5-853B-4B60-BEC9-8D7A6FA39C2A}
30+
EndGlobalSection
3831
EndGlobal

fmemopen_windows.vcxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@
2727
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2828
<ConfigurationType>StaticLibrary</ConfigurationType>
2929
<UseDebugLibraries>true</UseDebugLibraries>
30-
<PlatformToolset>v120</PlatformToolset>
30+
<PlatformToolset>v142</PlatformToolset>
3131
<CharacterSet>Unicode</CharacterSet>
3232
</PropertyGroup>
3333
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
3434
<ConfigurationType>StaticLibrary</ConfigurationType>
3535
<UseDebugLibraries>true</UseDebugLibraries>
36-
<PlatformToolset>v120</PlatformToolset>
36+
<PlatformToolset>v142</PlatformToolset>
3737
<CharacterSet>Unicode</CharacterSet>
3838
</PropertyGroup>
3939
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
4040
<ConfigurationType>StaticLibrary</ConfigurationType>
4141
<UseDebugLibraries>false</UseDebugLibraries>
42-
<PlatformToolset>v120</PlatformToolset>
42+
<PlatformToolset>v142</PlatformToolset>
4343
<WholeProgramOptimization>true</WholeProgramOptimization>
4444
<CharacterSet>Unicode</CharacterSet>
4545
</PropertyGroup>
4646
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4747
<ConfigurationType>StaticLibrary</ConfigurationType>
4848
<UseDebugLibraries>false</UseDebugLibraries>
49-
<PlatformToolset>v120</PlatformToolset>
49+
<PlatformToolset>v142</PlatformToolset>
5050
<WholeProgramOptimization>true</WholeProgramOptimization>
5151
<CharacterSet>Unicode</CharacterSet>
5252
</PropertyGroup>

fmemopen_windows.vcxproj.user

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

libfmemopen.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#include <stdio.h>
21
#include <windows.h>
32
#include <share.h>
43
#include <io.h>
54
#include <fcntl.h>
65
#include <sys/stat.h>
6+
#include "libfmemopen.h"
7+
/* https://github.com/Arryboom/fmemopen_windows */
78

89
FILE *fmemopen(void *buf, size_t len, const char *type)
910
{

libfmemopen.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#ifndef libfmemopen_windows
22
#define libfmemopen_windows
3+
#include <stdio.h>
4+
/* https://github.com/Arryboom/fmemopen_windows */
35
FILE *fmemopen(void *buf, size_t len, const char *type);
46
#endif

readme.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ a lib to provide **FILE\*** handler based on memory backend for fread,fwrite etc
77
2.include the libary depend on your platform32/64.
88
3.using ``fmemopen``.
99

10-
### sample:
10+
### usage sample:
1111
```
1212
#include <stdio.h>
1313
#include "libfmemopen.h"
@@ -31,8 +31,11 @@ int main(){
3131
```
3232

3333

34+
---
35+
3436

3537
A bad example:
38+
3639
>there may got some security risk in this version,look the code below.I'll dig it later.
3740
3841
```
@@ -114,17 +117,19 @@ during these days I've been try alot way to simulate fmemopen on windows,this li
114117

115118

116119
the way I think we can done this:
117-
- completely rewrite fread,fwrite.... X
118-
- using _open
119-
>https://docs.microsoft.com/zh-tw/previous-versions/z0kc8e3z%28v%3dvs.120%29
120-
>this is the way,due to the lack support of windows kernel,we have to create a temp file on disk then use _open to create a FILE* type handler for use,and by control the create of temp file,we can avoid any actually disk write operation to the temp file(you fmemopen a 100mb file in memory and it's still 0 bits on disk),it's like a pointer which we must need due to the windows kernel.
120+
- completely rewrite fread,fwrite.... X
121121
- mmioOpen
122122
>a good way to perform pure memory File I/O,but the return handler is ``HMMIO`` cannot cast to ``FILE*``
123123
>https://docs.microsoft.com/en-us/windows/win32/multimedia/performing-memory-file-i-o
124124
>and You must call mmioClose to close a file opened by using mmioOpen. Open files are not automatically closed when an application exits. and seems like poor support after win2k.
125+
125126
- using ramdisk
126127
>need to load driver,and perform 'disk' format etc,too heavy.
127128
129+
- using _open
130+
>https://docs.microsoft.com/zh-tw/previous-versions/z0kc8e3z%28v%3dvs.120%29
131+
>this is the way,due to the lack support of windows kernel,we have to create a temp file on disk then use _open to create a FILE* type handler for use,and by control the create of temp file,we can avoid any actually disk write operation to the temp file(you fmemopen a 100mb file in memory and it's still 0 bits on disk),it's like a pointer which we must need due to the windows kernel.
132+
128133
with few experiments the _open is optional way,but it's deprecated and microsoft say they have a newer secure version ``_sopen_s`` and ``_wsopen_s``,so this libary will use ``_sopen_s``.
129134

130135
across the description by msdn,the _sopen_s still got a chance to write things to disk,when memory not enough,so you may better not cache your secret key etc in it.

x64/Release/fmemopen_windows.lib

84 KB
Binary file not shown.
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
<ProjectOutputs />
4+
<ContentFiles />
5+
<SatelliteDlls />
6+
<NonRecipeFileRefs />
7+
</Project>

x64/Release/fmemopen_windows.log

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
1-
Build started 2019/11/7 2:28:48.
2-
1>Project "Z:\fmemopen_windows\fmemopen_windows.vcxproj" on node 2 (Build target(s)).
3-
1>ClCompile:
4-
D:\VS2013\VC\bin\x86_amd64\CL.exe /c /Zi /nologo /W3 /WX- /O2 /Oi /GL /D WIN32 /D NDEBUG /D _LIB /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"x64\Release\\" /Fd"x64\Release\vc120.pdb" /Gd /TC /errorReport:prompt libfmemopen.c
5-
libfmemopen.c
6-
Lib:
7-
D:\VS2013\VC\bin\x86_amd64\Lib.exe /OUT:"Z:\fmemopen_windows\x64\Release\fmemopen_windows.lib" /NOLOGO /MACHINE:X64 /LTCG x64\Release\libfmemopen.obj
8-
fmemopen_windows.vcxproj -> Z:\fmemopen_windows\x64\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.77
1+
 libfmemopen.c
2+
fmemopen_windows.vcxproj -> C:\Users\jj\Desktop\fmemopen_windows-master\x64\Release\fmemopen_windows.lib
Binary file not shown.
9.05 KB
Binary file not shown.
166 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
302 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
2-
Release|x64|Z:\fmemopen_windows\|
1+
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30037:VCServicingVersionATL=14.29.30038:VCServicingVersionCrtHeaders=14.29.30040:VCServicingVersionCompilers=14.29.30040:TargetPlatformVersion=10.0.19041.0:
2+
Release|x64|C:\Users\jj\Desktop\fmemopen_windows-master\|
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:\Users\jj\Desktop\fmemopen_windows-master\x64\Release\fmemopen_windows.lib

x64/Release/libfmemopen.obj

83.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)