-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Why does Microsoft have three periods for versions?) Major refactor of the entire project. Ported the C# code to C++ and also made some other improvements such as removing the dependency on Visual Studio and MSBuild. The C# stuff currently uses Makefiles, Nuget, and the Roslyn C# compilers.
- Loading branch information
Showing
17 changed files
with
122 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/.vscode/ | ||
/bin/ | ||
/cs/bin/ | ||
/cs/obj/ | ||
/cs/*.exe | ||
/cxx/*.res | ||
/cxx/*.exe |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
_ := dotnetfx35installer. | ||
clr := cs\clr.exe | ||
x64 := cxx\x64.exe | ||
bclr := bin\$(_)clr.exe | ||
bx64 := bin\$(_)x64.exe | ||
|
||
cp = copy /v /y /b | ||
|
||
all: $(bclr) $(bx64) | ||
|
||
rebuild: clean all | ||
|
||
bin: | ||
mkdir bin | ||
|
||
$(bclr): $(clr) bin | ||
$(cp) $< $@ | ||
|
||
$(bx64): $(x64) bin | ||
$(cp) $< $@ | ||
|
||
$(clr): | ||
make -C cs | ||
|
||
$(x64): | ||
make -C cxx | ||
|
||
clean: | ||
rd /s /q bin || rem | ||
make -C cs clean | ||
make -C cxx clean | ||
|
||
.PHONY: all clean |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,58 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Diagnostics; | ||
|
||
class Program { | ||
using static System.Console; | ||
class _ { | ||
static string[] files = { | ||
"microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab", | ||
"Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~en-US~.cab" | ||
}; | ||
|
||
static void Main(string[] _) { | ||
Console.Title = "dotnetfx35installer"; | ||
string outdir = Path.GetTempPath() + @"dotnetfx35installer\"; | ||
Console.WriteLine("Writing temporary installation files to " + outdir); | ||
Console.Write("Does this look correct? Press 'y' continue: "); | ||
var confirm = Console.ReadKey().KeyChar; | ||
Console.Clear(); | ||
if (confirm != 'y') { | ||
Title = "dotnetfx35installer.clr"; | ||
|
||
var outdir = Path.GetTempPath() + @"dotnetfx35installer\"; | ||
Write( | ||
$"Writing temporary files to {outdir}\n" | ||
+ "\nDoes this look correct? Press 'y' continue: " | ||
); | ||
if (ReadKey().KeyChar != 'y') { | ||
return; | ||
} | ||
Clear(); | ||
|
||
Title = "Installing..."; | ||
|
||
if (Directory.Exists(outdir)) { | ||
Directory.Delete(outdir, true); | ||
} | ||
|
||
Directory.CreateDirectory(outdir); | ||
|
||
var assembly = Assembly.GetExecutingAssembly(); | ||
foreach (var filename in files) { | ||
var stream = assembly.GetManifestResourceStream($"dotnetfx35installer.{filename}"); | ||
var output = File.Open(outdir + filename, FileMode.CreateNew); | ||
stream.CopyTo(output); | ||
stream.Dispose(); | ||
output.Dispose(); | ||
WriteLine("\nGetting resources:"); | ||
var names = assembly.GetManifestResourceNames(); | ||
for (var i = 0; i < names.Length; ++i) { | ||
var name = names[i]; | ||
WriteLine($"{i}: {name}"); | ||
var res = assembly.GetManifestResourceStream(name); | ||
var file = File.Open(outdir + name, FileMode.CreateNew); | ||
res.CopyTo(file); | ||
res.Dispose(); | ||
file.Dispose(); | ||
WriteLine($"{i}: Done"); | ||
} | ||
|
||
var dism = @"C:\Windows\System32\dism.exe"; | ||
var args = $"/Online /Enable-Feature /FeatureName:NetFX3 /All /LimitAccess /Source:{outdir}"; | ||
Console.WriteLine("Running DISM:"); | ||
Console.WriteLine($"{dism} {args}"); | ||
WriteLine($"{dism} {args}"); | ||
WriteLine("Please be patient!"); | ||
Process.Start(dism, args).WaitForExit(); | ||
Console.WriteLine("\nFinished... probably...?"); | ||
Console.Title = "yay?"; | ||
Console.WriteLine($"Removing {outdir}"); | ||
|
||
Write($"Finished install\nCleaning Up...\n"); | ||
Directory.Delete(outdir, true); | ||
Console.WriteLine("Press any key to exit..."); | ||
Console.ReadKey(); | ||
|
||
Title = "Press any key to exit..."; | ||
WriteLine("Press any key to exit..."); | ||
ReadKey(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
include ../vars.mk | ||
|
||
outfile := clr.exe | ||
|
||
csc := $(shell node where_csc.js) | ||
entry := Main.cs | ||
others := AssemblyInfo.cs | ||
outfile := .clr.exe | ||
args := \ | ||
/target:exe \ | ||
/win32manifest:$(manifest) \ | ||
/resource:$(G11N) \ | ||
/resource:$(L10N) \ | ||
/optimize+ \ | ||
/warnaserror+ | ||
|
||
$(outfile): *.cs $(G11N) $(L10N) | ||
$(csc) *.cs $(args) /out:$@ | ||
|
||
clean: | ||
del /f clr.exe | ||
rd /s /q bin || rem | ||
rd /s /q obj || rem | ||
|
||
$(outfile): $(entry) $(others) | ||
$(csc) $^ /out:$@ | ||
.PHONY: clean |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,20 @@ | ||
infile := Main.cxx | ||
outfile := native.exe | ||
nouac := __nouac__ | ||
manifest := ../dotnetfx35installer.manifest | ||
include ../vars.mk | ||
|
||
G11N := ../proprietary/microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab | ||
L10N := ../proprietary/Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~en-US~.cab | ||
infile := Main.cxx | ||
outfile := x64.exe | ||
|
||
vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" && | ||
|
||
native.exe.run: $(outfile) | ||
$(outfile) | ||
|
||
$(nouac): $(infile) res.res | ||
clang $< res.res -v -o $@ | ||
$(outfile): $(infile) res.res | ||
clang $< res.res -Wall -O2 -o $@ | ||
$(vcvars) mt -manifest $(manifest) -outputresource:$@;1 | ||
|
||
$(outfile): $(nouac) | ||
$(vcvars) mt -manifest $(manifest) -outputresource:$<;1 | ||
del /f $(outfile) | ||
MOVE $< $@ | ||
|
||
# default target | ||
res.res: res.rc $(G11N) $(L10N) | ||
$(vcvars) rc /V $< | ||
|
||
res.rc: res.h | ||
|
||
.PHONY: native.exe.run | ||
clean: | ||
del /f $(outfile) res.res | ||
|
||
.PHONY: clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<!-- Parts of this are handwritten. I hope it works... --> | ||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | ||
<assemblyIdentity version="1.2.0.0" name="dotnetfx35installer.native"/> | ||
<assemblyIdentity version="2.0.0.0" name="dotnetfx35installer"/> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<security> | ||
<requestedPrivileges> | ||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
<application> | ||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> | ||
</application> | ||
</compatibility> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
manifest := ../dotnetfx35installer.manifest | ||
|
||
G11N := ../proprietary/microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab | ||
L10N := ../proprietary/Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~en-US~.cab |
I was gonna say that maybe it had something to do with C++'s cursed stream thing but that doesn't even make any sense. I'm writing to
stdout
butgetchar
is forstdin
. I guess I'll never know,