Skip to content

Instantly share code, notes, and snippets.

View luojunyuan's full-sized avatar
🏠
have a good day

k1mlka luojunyuan

🏠
have a good day
View GitHub Profile

AYN Odin M0 Windows ARM 双系统刷机复刻手顺

整理日期:2026-11-08
设备:AYN Odin 1 / Odin_M0 / 8 GB RAM + 128 GB UFS
目标:重装 Windows,同时保留 Android 双启动

结果摘要

这次最终成功进入 Windows 的路线是:Tiny11 ARM64 ISO -> 从 ISO 取出 install.wim -> 拆成 FAT32 可存放的 SWM 分卷 -> 制作 Valhalla ARM64 WinPE U 盘 -> 从 Odin 启动菜单选 U 盘 -> WinPE 自动部署 WIM、注入 Odin 驱动并重建 Windows EFI/BCD -> 从内部存储启动 Windows。 用户随后确认已进入 Windows。

@luojunyuan
luojunyuan / uwp.rs
Created October 23, 2026 02:54
uwp hello world in rust
#![windows_subsystem = "windows"]
use bindings::*;
use windows::core::{implement, HSTRING, Interface, Ref, Result};
use windows::Foundation::PropertyValue;
#[implement(IApplicationOverrides)]
struct MyApp();
#[allow(non_snake_case)]
设计一个语言无关的 windows 上的 Updater.exe
https://github.com/github/spec-kit
目的
1 用于安装 windows app sdk runtime
2 用于主程序的更新
备注
* 要有 manifest 以避免被标记为强制 UAC 的应用
using Microsoft.UI.Reactor.Wrappers;
namespace CommunityToolkit.WinUI.Controls;
[GenerateReactorWrapper(typeof(SettingsCard))]
partial record SettingsCardFactory;
@luojunyuan
luojunyuan / MainWindow.cs
Created April 22, 2026 16:50
最标称的 csharp win32 窗口
using System;
using System.Runtime.InteropServices;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Gdi;
using Windows.Win32.UI.WindowsAndMessaging;
internal static unsafe class App
{
private const string ClassName = "AppCoreApplication_MainWnd";
@luojunyuan
luojunyuan / petype.ps
Created December 26, 2025 09:51
powershell check pe type (x86/x64/arm64)
function Get-ExeArchitecture {
param([string]$Path)
$bytes = [System.IO.File]::ReadAllBytes($Path)
# 检查 PE 头标志
$machineType = [System.BitConverter]::ToUInt16($bytes, [System.BitConverter]::ToUInt16($bytes, 0x3C) + 4)
switch ($machineType) {
0x014c { "x86 (32位)" }
@luojunyuan
luojunyuan / GetObservable.cs
Created November 26, 2025 07:12
Avalonia GetObservable for WPF
extension(DependencyObject obj)
{
public Observable<T> GetObservable<T>(DependencyProperty property)
{
var descriptor = DependencyPropertyDescriptor.FromProperty(property, obj.GetType());
return Observable
.FromEventHandler(
h => descriptor.AddValueChanged(obj, h),
h => descriptor.RemoveValueChanged(obj, h))
.Select(_ => (T)obj.GetValue(property))
@luojunyuan
luojunyuan / App.axaml.cs
Created July 7, 2025 08:03
blazonia app template
public partial class App : BlazoniaApplication<MainWindow>
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
}
@luojunyuan
luojunyuan / App1.csproj
Last active October 3, 2026 19:47
the minimal request csproj properties for creating an unpackage desktop winui app
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
@luojunyuan
luojunyuan / SplashScreen.cs
Last active January 17, 2025 03:19
SplashScreen with System.Drawing.Common + CSWin32
public class SplashScreen
{
public static SplashScreen Show(string imagePath)
{
using var image = Image.FromFile(imagePath);
return InternalShow(image);
}
public static SplashScreen Show(Stream stream)
{