mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Generated windows lib files
This commit is contained in:
parent
e5de60c87f
commit
c3238272d0
14 changed files with 127 additions and 3 deletions
5
IDE/dist/lib/gen/BeefProj.toml
vendored
Normal file
5
IDE/dist/lib/gen/BeefProj.toml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "gen"
|
||||
StartupObject = "gen.Program"
|
5
IDE/dist/lib/gen/BeefSpace.toml
vendored
Normal file
5
IDE/dist/lib/gen/BeefSpace.toml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
Projects = {gen = {Path = "."}}
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "gen"
|
114
IDE/dist/lib/gen/src/Program.bf
vendored
Normal file
114
IDE/dist/lib/gen/src/Program.bf
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Interop;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
using System.Collections;
|
||||
|
||||
namespace gen
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static String[] sNames = new .[]("comdlg32", "gdi32", "kernel32", "ole32", "netapi32", "ntdll", "rpcrt4", "user32", "version", "winmm") ~ delete _;
|
||||
|
||||
public static int Main(String[] args)
|
||||
{
|
||||
bool isFirst = true;
|
||||
|
||||
for (var name in sNames)
|
||||
{
|
||||
for (int pass < 2)
|
||||
{
|
||||
String resultStr = scope String();
|
||||
|
||||
//
|
||||
{
|
||||
ProcessStartInfo startInfo = scope .();
|
||||
startInfo.SetFileName(@"c:\bin\dumpbin.exe");
|
||||
if (pass == 0)
|
||||
startInfo.SetArguments(scope $"/exports c:\\windows\\system32\\{name}.dll");
|
||||
else
|
||||
startInfo.SetArguments(scope $"/exports c:\\windows\\SysWow64\\{name}.dll");
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.CreateNoWindow = false;
|
||||
SpawnedProcess process = scope SpawnedProcess();
|
||||
if (process.Start(startInfo) case .Err)
|
||||
continue;
|
||||
|
||||
FileStream fileStream = scope FileStream();
|
||||
process.AttachStandardOutput(fileStream);
|
||||
StreamReader streamReader = scope StreamReader(fileStream, null, false, 4096);
|
||||
streamReader.ReadToEnd(resultStr).IgnoreError();
|
||||
|
||||
if (process.ExitCode != 0)
|
||||
Runtime.FatalError(scope $"Failed to read lib '{name}'");
|
||||
}
|
||||
|
||||
var outStr = scope String();
|
||||
outStr.Append("EXPORTS\n");
|
||||
|
||||
for (var line in resultStr.Split('\n'))
|
||||
{
|
||||
if ((line.Length > 26) && (line.StartsWith(" ")) && (line[25] == ' ') && (line[26] != '['))
|
||||
{
|
||||
var exportStr = line.Substring(26);
|
||||
|
||||
int fwdIdx = exportStr.IndexOf("(forwarded to");
|
||||
if (fwdIdx != -1)
|
||||
{
|
||||
outStr.Append(exportStr.Substring(0, fwdIdx - 1));
|
||||
outStr.Append(" = ");
|
||||
outStr.Append(exportStr.Substring(fwdIdx + 14, exportStr.Length - fwdIdx - 15));
|
||||
}
|
||||
else
|
||||
{
|
||||
outStr.Append(exportStr);
|
||||
|
||||
switch (exportStr)
|
||||
{
|
||||
case "DllMain",
|
||||
"DllGetClassObject",
|
||||
"DllCanUnloadNow",
|
||||
"DllRegisterServer",
|
||||
"DllUnregisterServer",
|
||||
"DllInstall":
|
||||
outStr.Append(" PRIVATE");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
outStr.Append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
File.WriteAllText(scope $"{name}.txt", outStr);
|
||||
|
||||
//
|
||||
{
|
||||
ProcessStartInfo startInfo = scope .();
|
||||
startInfo.SetFileName(@"c:\bin\lib.exe");
|
||||
if (pass == 0)
|
||||
startInfo.SetArguments(scope $"/def:{name}.txt /machine:x64 /out:..\\x64\\{name}.lib");
|
||||
else
|
||||
startInfo.SetArguments(scope $"/def:{name}.txt /machine:x64 /out:..\\x86\\{name}.lib");
|
||||
startInfo.CreateNoWindow = false;
|
||||
SpawnedProcess process = scope SpawnedProcess();
|
||||
if (process.Start(startInfo) case .Err)
|
||||
continue;
|
||||
|
||||
process.WaitFor();
|
||||
if (process.ExitCode != 0)
|
||||
Runtime.FatalError(scope $"Failed to generate lib '{name}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
BIN
IDE/dist/lib/x64/comdlg32.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/comdlg32.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/gdi32.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/gdi32.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/kernel32.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/kernel32.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/netapi32.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/netapi32.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/ntdll.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/ntdll.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/ole32.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/ole32.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/rpcrt4.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/rpcrt4.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/user32.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/user32.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/version.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/version.lib
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/lib/x64/winmm.lib
vendored
Normal file
BIN
IDE/dist/lib/x64/winmm.lib
vendored
Normal file
Binary file not shown.
|
@ -874,10 +874,10 @@ namespace IDE
|
|||
minRTModName.Insert(0, "_");
|
||||
|
||||
if (!is64Bit)
|
||||
linkLine.Append(gApp.mInstallDir, @"lib\x86\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT32", minRTModName, ".lib ");
|
||||
linkLine.Append("-libpath:\"", gApp.mInstallDir, "lib\\x86\" ", gApp.mInstallDir, "lib\\x86\\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT32", minRTModName, ".lib ");
|
||||
else
|
||||
linkLine.Append(gApp.mInstallDir, @"lib\x64\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT64", minRTModName, ".lib ");
|
||||
linkLine.Append("ntdll.lib user32.lib kernel32.lib gdi32.lib winmm.lib shell32.lib ole32.lib rpcrt4.lib version.lib comdlg32.lib chkstk.obj -ignore:4049 -ignore:4217 ");
|
||||
linkLine.Append("-libpath:\"", gApp.mInstallDir, "lib\\x64\" ", gApp.mInstallDir, "lib\\x64\\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT64", minRTModName, ".lib ");
|
||||
linkLine.Append("ntdll.lib user32.lib kernel32.lib gdi32.lib winmm.lib shell32.lib ole32.lib rpcrt4.lib version.lib comdlg32.lib -ignore:4049 -ignore:4217 ");
|
||||
}
|
||||
|
||||
for (var libPath in libPaths)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue