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
# Get all network adapters that are configured to use IP | |
$adapters = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = True" | |
# Display the IP address, subnet mask, default gateway, and DNS servers for each adapter | |
foreach ($adapter in $adapters) { | |
Write-Host "Description: $($adapter.Description)" | |
Write-Host "IP Address(es): $($adapter.IPAddress)" | |
Write-Host "Subnet Mask(s): $($adapter.IPSubnet)" | |
Write-Host "Default Gateway(s): $($adapter.DefaultIPGateway)" | |
Write-Host "DNS Server(s): $($adapter.DNSServerSearchOrder)" |
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
const std = @import("std"); | |
const c = @cImport({ | |
@cInclude("windows.h"); | |
}); | |
const KEY_EVENT = 0x0001; | |
pub fn main() !void { | |
_ = std.os.windows.kernel32.SetConsoleOutputCP(65001); | |
const stdin = c.GetStdHandle(c.STD_INPUT_HANDLE); |
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
const std = @import("std"); | |
const c = @cImport({ | |
@cInclude("windows.h"); | |
}); | |
pub fn main() !void { | |
const message = "Hello, World!"; | |
const title = "Zig MessageBox"; | |
// Buffer for UTF-16 strings |
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
const win = @import("std").os.windows; | |
extern "user32" fn MessageBoxA(?win.HWND, [*:0]const u8, [*:0]const u8, u32) callconv(win.WINAPI) i32; | |
pub fn main() !void { | |
_ = MessageBoxA(null, "world!", "Hello", 0); | |
} |
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
use windows::{core::Result, Win32::System::Threading::*}; | |
static COUNTER: std::sync::RwLock<i32> = std::sync::RwLock::new(0); | |
fn main() -> Result<()>{ | |
unsafe { | |
let work = CreateThreadpoolWork(Some(callback), None, None)?; | |
for _ in 0..10 { | |
SubmitThreadpoolWork(work); |
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
[package] | |
name = "thread_pool_work" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies.windows] | |
version = "0.52" | |
features = [ |
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
$xmlFile = "C:\Users\u1\Documents\sample_nodes.xml" | |
$xmlDoc = [xml](Get-Content $xmlFile) | |
$xmlDoc.nodes.node.ip |
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
<?xml version="1.0"?> | |
<nodes> | |
<node> | |
<name>machine1</name> | |
<ip>1.2.3.4</ip> | |
</node> | |
</nodes> |
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
program Project4; | |
{$APPTYPE CONSOLE} | |
{$R *.res} | |
uses | |
System.SysUtils, | |
Winapi.Windows; |
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
program Project1; | |
{$APPTYPE CONSOLE} | |
{$R *.res} | |
uses | |
ActiveX, | |
ComObj, | |
System.SysUtils, |
NewerOlder