How to use SetProcessMitigationPolicy?
Closed this issue · 6 comments
Hi !
Thank you for your issue.
Definition inwindows.generated_def
are based on the ctypes
module.
When you want to use a structure (like PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY
) you should work on an instance and not directly on the class itself.
You first line should look like something like this:
p = windows.generated_def.PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY()
Moreover, you will need to use ctypes.sizeof(p)
to get the sizeof(PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY)
as the last parameter of you call to SetProcessMitigationPolicy
.
I tested the following code which seems to work:
import ctypes
import windows
import windows.generated_def as gdef
p = gdef.PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY()
p.MicrosoftSignedOnly = 1
windows.winproxy.SetProcessMitigationPolicy(gdef.ProcessSignaturePolicy, p, ctypes.sizeof(p))
Does it work for you ?
Do not hesitate if you have any other issues.
It works, thanks a lot, you are a wonderful person just like your module! :)
glad to help !
Do not hesitate to open other issues if you encounter bugs or have ideas about improvements.
Sorry, but I never heard of Nuikta before your comment.
A recommend you to post an issue on the Nuitka project itself.