Skip to content

Instantly share code, notes, and snippets.

void CorrectFileCase(const wchar_t* srcFileName, wchar_t* dstFileName, int maxLength)
{
struct FILE_NAME_INFORMATION
{
ULONG FileNameLength;
WCHAR FileName[1024 + 1];
};
typedef NTSTATUS (NTAPI *_NtQueryInformationFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FILE_INFORMATION_CLASS);
@maxmcguire
maxmcguire / ReorderComponents.cs
Last active July 10, 2023 11:41
A small utility to reorder components with drag and drop in Unity
/**
The MIT License (MIT)
Copyright (c) 2015, Max McGuire
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:
// This is a small Unity utility that will add a new menu item which can be used to force
// shaders to be rebuilt when an included file is updated (Unity will only automatically do
// this if the #including file is in the same directory).
// To use it, simply select the Assets/Shaders/Rebuild Shaders menu option. Any shader file
// which #includes a file that has a newer timestamp will be trivially modified to force it
// to be rebuilt.
using UnityEngine;
using UnityEditor;
void* GetStackBase()
{
static __declspec(thread) void* stackBase = nullptr;
if (stackBase == nullptr)
{
MEMORY_BASIC_INFORMATION mbi;
VirtualQuery(&mbi, &mbi, sizeof(mbi));
stackBase = mbi.AllocationBase;
}
return stackBase;
char pixels[32 * 32 * 4];
GLuint texture1;
glGenTextures(1, &texture1);
glBindTexture( GL_TEXTURE_2D, texture1 );
// Removing, moving this call after glTexSubImage2D, or changing GL_LINEAR to GL_POINT eliminates the crash
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);