Skip to content

Instantly share code, notes, and snippets.

@sevaa
sevaa / a.cpp
Created March 2, 2023 14:38
COM double hop test
#include <windows.h>
static const GUID CLSID_B =
{ 0x51addb47, 0xd26a, 0x4f69, { 0xb9, 0x7b, 0x7e, 0x30, 0x62, 0x8d, 0xcf, 0x5b } };
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
@sevaa
sevaa / json_validate.sql
Last active June 5, 2024 18:14
JSON_VALIDATE.sql
create or alter function dbo.JSON_VALIDATE(
@doc nvarchar(max), -- JSON document to validate
@schema nvarchar(max), -- JSON schema to validate against
-- Pass nulls, those parameters are for recursive invokations
@res1 bit = null,
@res2 bit = null,
@schema_path nvarchar(max) = null,
@type tinyint = null,
@root nvarchar(max) = null)
returns @t table(
@sevaa
sevaa / tasks.schema.amended.json
Created May 28, 2024 19:50
tasks.schema.amended.json
{
"$schema": "http://json-schema.org/draft-04/schema",
"id": "https://raw.githubusercontent.com/Microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
"title": "Azure DevOps Tasks schema",
"type": "object",
"additionalProperties": false,
"properties": {
"serverOwned":{"type":"boolean"},
"contentsUploaded":{"type":"boolean"},
"iconUrl":{
@sevaa
sevaa / UUIDUtil.java
Last active March 2, 2025 19:06
Java/Android UUID (GUID) to bytes in a Windows compatible way
package com.example;
import java.util.UUID;
class UUIDUtil
{
static private final int []s_Shuffle = {32, 40, 48, 56, 16, 24, 0, 8};
public static void UUIDToBytes(UUID g, byte[]b, int offset)
{
@sevaa
sevaa / CertEnrollUI.def
Last active March 24, 2025 23:24
CertEnrollUI API
; To build the import library, run one of the following with this file under the Development Command prompt:
; lib /def:CertEnrollUI.def /out:CertEnrollUI.lib /machine:x64
; The /machine switch can also be x86, arm, or arm64
LIBRARY CertEnrollUI
EXPORTS
CreateUIObject @200
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <comdef.h>
#include <process.h>
#include <list>
#include <string>
#include <sstream>
#include <Wincrypt.h>
#include <certenroll.h>
#include "certenrollui.h"
param($Src, $Dest, $Name)
function CopyRecset($Table, $KeyField)
{
$svw = $sdb.OpenView("select * from $Table where $KeyField=?")
$svw.Execute($NameParam)
$sdr = $svw.Fetch()
$dvw = $ddb.OpenView("select * from $Table")
$dvw.Execute($null)
while($null -ne $sdr)