Skip to content

Instantly share code, notes, and snippets.

View exoosh's full-sized avatar
💭
🦷🤓

Oliver Schneider exoosh

💭
🦷🤓
View GitHub Profile
@mgexo
mgexo / AboutMixedModeDllNoEntryCrashInVS2022_17_7.md
Last active January 24, 2024 13:58
AboutMixedModeDllNoEntryCrashInVS2022_17_7.md

About Mixed Mode DLL with /NOENTRY crash since Visual Studio 2022 17.7.0 and the global static initializer problem (2024-01-15)

The problem had been originally reported https://developercommunity.visualstudio.com/t/Visual-Studio-2022-1770-CRT-crash-when/10441303.but also in other posts e.g. here https://developercommunity.visualstudio.com/t/CRT-crash-when-loading-mixed-dll-from-N/10559475#T-ND10570501

After further investigation we found out, that the reason is that we used /NOENTRY in our Managed C++ DLL which worked fine with all compilers before we used VS17.7. Now with VS17.7 there seems to be a change on how the atexit table/functionality in the CRT’s utility.cpp works. The functions __scrt_initialize_onexit_tables and __scrt_dllmain_before_initialize must now be called to work correctly whereas in previous VS versions it seems that this was not the case.

The internal analysis was much more comp

@alkampfergit
alkampfergit / WingetUpgrade.ps1
Last active April 2, 2024 19:02
Upgrade with Winget being able to select list of software to skip
class Software {
[string]$Name
[string]$Id
[string]$Version
[string]$AvailableVersion
}
$upgradeResult = winget upgrade | Out-String
$lines = $upgradeResult.Split([Environment]::NewLine)
@theTonyHo
theTonyHo / autoVersion.csproj
Last active March 28, 2023 15:39
MSBuild AutoVersion using Regex
<!-- reference: https://stackoverflow.com/questions/2982559/extract-number-from-string-in-msbuild -->
<!-- source: https://gist.github.com/theTonyHo/e346d59a886433cccd990800f1cefceb -->
<Target Name="NugetPackAutoVersioning" AfterTargets="Build">
<PropertyGroup Condition=" '$(AssemblyVersion)'=='' ">
<AssemblyInfo>$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs</AssemblyInfo>
<AssemblyInfoContent>$([System.IO.File]::ReadAllText('$(AssemblyInfo)'))</AssemblyInfoContent>
<Pattern>\[assembly: AssemblyVersion\("(\d+.\d+.\d+.\d+)</Pattern>
<AssemblyVersion>$([System.Text.RegularExpressions.Regex]::Match($(AssemblyInfoContent), $(Pattern), System.Text.RegularExpressions.RegexOptions.Multiline).Groups[1].Value) (From $(AssemblyInfo))</AssemblyVersion>
</PropertyGroup>
<PropertyGroup>
@sevaa
sevaa / Delta.cs
Created October 18, 2019 14:48
C# wrapper around MSDelta's ApplyDeltaB API
class Delta
{
[StructLayout(LayoutKind.Sequential)]
private struct DELTA_INPUT
{
public IntPtr lpcStart;
public UIntPtr uSize;
[MarshalAs(UnmanagedType.Bool)]
public bool Editable;
}
@Edu4rdSHL
Edu4rdSHL / luks-upgrade.md
Last active April 29, 2024 02:11 — forked from kravietz/luks-upgrade.md
Ubuntu LUKS cryptsetup upgrade

If you installed your #ubuntu with full-disk #encryption a while, you may want to upgrade your #luks header version to enjoy improved #security and stronger password hashing algorithms.

Boot from USB

You can't change LUKS header from a live system - you need to boot a live Ubuntu USB to be able to access the encrypted partition. First, create a bootable USB stick using a regular Ubuntu installer image.

  • Just get the latest installer ISO available
  • You need the full installer, the mini network installer won't work
  • You may need to disable Secure Boot in BIOS temporarily to boot from USB
@mattifestation
mattifestation / NiftyETWProviders.json
Created December 21, 2018 19:27
ETW providers you never knew existed...
[
{
"ProviderGUID": "72d164bf-fd64-4b2b-87a0-62dbcec9ae2a",
"ProviderName": "AccEventTool",
"ProviderGroupGUID": "4f50731a-89cf-4782-b3e0-dce8c90476ba",
"AssociatedFilenames": [
"accevent.exe",
"inspect.exe",
"narrator.exe",
"srh.dll"
@mattifestation
mattifestation / TLGMetadataParser.psm1
Last active January 18, 2024 17:21
Retrieves TraceLogging metadata from a file.
#requires -version 5
<#
The things you find on Google searching for specific GUIDs...
Known Keyword friendly names:
"UTC:::CATEGORYDEFINITION.MS.CRITICALDATA":"140737488355328"
"UTC:::CATEGORYDEFINITION.MS.MEASURES":"70368744177664"
"UTC:::CATEGORYDEFINITION.MS.TELEMETRY":"35184372088832"
"UTC:::CATEGORYDEFINITION.MSWLAN.CRITICALDATA":"2147483648"
@ricardojba
ricardojba / windows_hardening.cmd
Last active July 1, 2024 19:59
A Windows hardening script
::##########################################################################################################################
::
:: This script can ruin your day, if you run it without fully understanding what it does, you don't know what you are doing,
::
:: OR BOTH!!!
::
:: YOU HAVE BEEN WARNED!!!!!!!!!!
::
:: This script is provided "AS IS" with no warranties, and confers no rights.
:: Feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section,
@fearthecowboy
fearthecowboy / Test.csproj
Last active April 18, 2024 23:37
The definitive way to use PowerShell from an msbuild script
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- #1 Place this line at the top of any msbuild script (ie, csproj, etc) -->
<PropertyGroup><PowerShell># 2>nul || type %~df0|find /v "setlocal"|find /v "errorlevel"|powershell.exe -noninteractive -&amp; exit %errorlevel% || #</PowerShell></PropertyGroup>
<!-- #2 in any target you want to run a script -->
<Target Name="default" >
<PropertyGroup> <!-- #3 prefix your powershell script with the $(PowerShell) variable, then code as normal! -->
<myscript>$(PowerShell)