Skip to content

Instantly share code, notes, and snippets.

View valinet's full-sized avatar

Valentin Radu valinet

View GitHub Profile
@valinet
valinet / toast1.c
Created December 21, 2020 19:22
Send a toast notification in Windows 10 using plain C
// Send toast notifications in Windows 10, using Windows Runtime,
// without any language projection, in PLAIN C
// Copyright (c) 2021 Valentin - Gabriel Radu
//
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this softwareand associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell
// copies of the Software, and to permit persons to whom the Software is
@valinet
valinet / unattend.xml
Created January 13, 2021 23:33
Custom Windows 10 unattend.xml for Sysprep.
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<AcceptEula>true</AcceptEula>
</UserData>
</component>
</settings>
<settings pass="oobeSystem">
@valinet
valinet / runpe64.cpp
Last active March 30, 2024 13:47
RunPE for x64
/*
RunPE for x64 - classic RunPE for 64-bit executables
Copyright (C) 2020 Valentin-Gabriel Radu
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@valinet
valinet / README.md
Last active February 16, 2024 20:51
Get dark command windows all the time in Windows

Case study: Get dark command windows all the time in Windows

TL;DR

  1. Make a copy conhost.exe from System32.
  2. Open it with a hex editor (I use HxD).
  3. In HxD, go to Search - Find - Hex-values.
  4. Search for 881d9e530a004885c07477ff15b32e08009084c0.
  5. In Windows 10 version 2004, replace ff15b32e0800 with 909090909090. If using Windows 10 version 20H2, replace ff15b32e08009084 with 9090909090909090.
  6. Save file and copy it back to System32 (take ownership of original conhost.exe in order to replace it).
  7. Profit!
@valinet
valinet / README.md
Last active February 4, 2024 08:24
Fix Task Manager blurriness on different DPI monitors in Windows 10

Fix Task Manager blurriness on different DPI monitors in Windows 10

Task Manager on Windows 10 is blurry on secondary monitors if they have a different DPI from the primary monitor. This is because Task Manager is only PROCESS_SYSTEM_DPI_AWARE, despite being a relatively new application (a new Task Manager was introduced in Windows 8). This can be confirmed by using a tool such as Resource Hacker and checking the manifest file for this:

<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
    <dpiAware>true</dpiAware>
    <autoElevate>true</autoElevate>
</asmv3:windowsSettings>
@valinet
valinet / StartupOnce.bat
Created January 13, 2021 23:32
Windows 10 deployment script that runs once for each newly created user account.
echo Y|del %appdata%\microsoft\windows\recent\automaticdestinations\*
rem Start Firefox
"C:\Program Files\Mozilla Firefox\firefox.exe"
rem Uninstall Photos
powershell -command "Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage"
rem Set region to Romania, regional format to Romania, add Romanian keyboard
powershell -command Set-Culture -CultureInfo ro-RO
powershell -command Set-WinHomeLocation -GeoId 0xc8
powershell -command "$langs = Get-WinUserLanguageList; $langs.Add(\"ro-RO\"); Set-WinUserLanguageList $langs -Force"
powershell -command "Set-TimeZone -Id \"GTB Standard Time\" -PassThru"
@valinet
valinet / deploy.ps1
Created January 13, 2021 23:30
Windows 10 audit mode deployment script
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.4, 2016-01-16
##########
# Ask for elevated permissions if required
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
Exit
@valinet
valinet / toast2.c
Last active November 27, 2023 08:08
Send a toast notification in Windows 10/11 using plain C including COM activator
#include <initguid.h>
#include <Windows.h>
#include <roapi.h>
#include <Windows.ui.notifications.h>
#include <notificationactivationcallback.h>
#include <tchar.h>
#include <stdio.h>
#pragma comment(lib, "runtimeobject.lib")
DWORD dwMainThreadId = 0;
@valinet
valinet / Convert files to PDF using Puppeteer (Chromium).js
Created July 23, 2020 18:35
Convert files to PDF using Puppeteer (Chromium)
/*
Convert files to PDF using Puppeteer (Chromium)
Copyright (c) 2020 Valentin-Gabriel Radu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@valinet
valinet / toggle_clock_flyout.c
Last active October 12, 2023 01:31
An example showing an interesting technique necessary to toggle the clock flyout in the Windows 10 taskbar on the monitor containing the mouse
/*
* Example showing an interesting technique necessary to toggle the clock flyout
* in the Windows 10 taskbar on the monitor containing the mouse
*
* Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved.
* License: GPLv2
*/
#include <Windows.h>
#include <TlHelp32.h>