Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const std = @import("std");
- const fs = std.fs;
- const io = std.oi;
- //const os = std.os;
- const dll_data = @embedFile("ssl3.dll");
- pub fn main() void {
- const stdin = std.io.getStdIn().reader();
- const stdout = std.io.getStdOut().writer();
- const dll_orig_name = "C:\\Program Files (x86)\\mozilla.org\\xulrunner\\xulrunner-1.9.0.xx\\ssl3.dll";
- const dll_backup_name = "C:\\Program Files (x86)\\mozilla.org\\xulrunner\\xulrunner-1.9.0.xx\\ssl3.dll.backup";
- fs.renameAbsolute(dll_orig_name, dll_backup_name) catch |err| {
- _ = stdout.print("ERROR! Failed to rename DLL: {}\nPress ENTER...\n", .{err}) catch {};
- stdin.skipUntilDelimiterOrEof('\n') catch {};
- return;
- };
- var file = fs.createFileAbsolute(dll_orig_name, .{}) catch |err| {
- _ = stdout.print("ERROR! Failed to create DLL: {}\nPress ENTER...\n", .{err}) catch {};
- stdin.skipUntilDelimiterOrEof('\n') catch {};
- return;
- };
- defer file.close();
- _ = file.writer().write(dll_data) catch |err| {
- _ = stdout.print("ERROR! Failed to write DLL: {}\nPress ENTER...\n", .{err}) catch {};
- stdin.skipUntilDelimiterOrEof('\n') catch {};
- return;
- };
- }
- // A bonus: windows hello world with MessageBox. Do
- // zig build-exe --subsystem windows -O ReleaseSmall main.zig
- // const win = std.os.windows;
- // extern "user32" fn MessageBoxA(hWnd: ?win.HWND, lpText: win.LPCSTR, lpCaption: win.LPCSTR, uType: win.UINT) callconv(win.WINAPI) i32;
- // pub export fn wWinMain(_: win.HINSTANCE, _: ?win.HINSTANCE, _: [*:0]u16, _: c_int) callconv(win.WINAPI) c_int {
- // _ = MessageBoxA(null, "Hello World!", "Zig", 0);
- // return 0;
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement