1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-04 00:55:15 +00:00

Import ctypes only when necessary

Closes #4541
This commit is contained in:
pukkandan
2022-08-03 17:47:38 +05:30
parent b99ba3df09
commit fe0918bb65
2 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import base64
import contextlib
import ctypes
import http.cookiejar
import json
import os
@ -876,10 +875,12 @@ def _decrypt_windows_dpapi(ciphertext, logger):
References:
- https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptunprotectdata
"""
from ctypes.wintypes import DWORD
import ctypes
import ctypes.wintypes
class DATA_BLOB(ctypes.Structure):
_fields_ = [('cbData', DWORD),
_fields_ = [('cbData', ctypes.wintypes.DWORD),
('pbData', ctypes.POINTER(ctypes.c_char))]
buffer = ctypes.create_string_buffer(ciphertext)