feat(semantics): add portable annotation, learning and review contracts
Add portable corpus, annotation provenance, admission, review and bounded agent-cycle contracts. Preserve dataset ownership and explicit research acceptance limits.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Windows-owned conversion descendants die with the learning coordinator."""
|
||||
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
|
||||
|
||||
class NativeChildren:
|
||||
def __init__(self):
|
||||
self.kernel = ctypes.WinDLL("kernel32", use_last_error=True)
|
||||
self.kernel.CreateJobObjectW.restype = wintypes.HANDLE
|
||||
self.kernel.CreateJobObjectW.argtypes = [ctypes.c_void_p, wintypes.LPCWSTR]
|
||||
self.kernel.SetInformationJobObject.argtypes = [
|
||||
wintypes.HANDLE,
|
||||
ctypes.c_int,
|
||||
ctypes.c_void_p,
|
||||
wintypes.DWORD,
|
||||
]
|
||||
self.kernel.AssignProcessToJobObject.argtypes = [wintypes.HANDLE, wintypes.HANDLE]
|
||||
self.kernel.CloseHandle.argtypes = [wintypes.HANDLE]
|
||||
self.handle = self.kernel.CreateJobObjectW(None, None)
|
||||
limits = ctypes.create_string_buffer(144)
|
||||
ctypes.c_uint32.from_buffer(limits, 16).value = 0x2000
|
||||
if not self.handle or not self.kernel.SetInformationJobObject(self.handle, 9, limits, 144):
|
||||
raise ctypes.WinError(ctypes.get_last_error())
|
||||
|
||||
def assign(self, process):
|
||||
if not self.kernel.AssignProcessToJobObject(self.handle, int(process._handle)):
|
||||
process.kill()
|
||||
process.wait(timeout=30)
|
||||
raise ctypes.WinError(ctypes.get_last_error())
|
||||
|
||||
def close(self):
|
||||
self.kernel.CloseHandle(self.handle)
|
||||
Reference in New Issue
Block a user