Skip to content

Instantly share code, notes, and snippets.

@wumb0
wumb0 / delta_patch.py
Last active March 12, 2025 10:52
a script for applying MS patch deltas
import base64
import hashlib
import zlib
from ctypes import (
CDLL,
POINTER,
LittleEndianStructure,
c_size_t,
c_ubyte,
c_uint64,
@schlamar
schlamar / gist:7024668
Created October 17, 2013 13:14
Handle Windows privileges from Python. Based on http://stackoverflow.com/a/2129589/851737
from __future__ import print_function
import ctypes
from ctypes import wintypes
GetCurrentProcess = ctypes.windll.kernel32.GetCurrentProcess
GetCurrentProcess.restype = wintypes.HANDLE
OpenProcessToken = ctypes.windll.advapi32.OpenProcessToken
OpenProcessToken.argtypes = (wintypes.HANDLE, wintypes.DWORD, ctypes.POINTER(wintypes.HANDLE))
OpenProcessToken.restype = wintypes.BOOL