Closed JohnChedder closed 1 year ago
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.
Good evening again, I came across the fact that nitka compiles for a very long time \ does not compile windows at all windows.generated_def.winstructs, I think it's because of the large weight of the file, what can I do about it?
Sorry, but I never heard of Nuikta before your comment. A recommend you to post an issue on the Nuitka project itself.
The last question, can you give an example of the code, how would my code look on ctypes without your module? My compiler simply cannot turn your module into C code because of its size :( I will be very grateful to you.
Hello, I need to transfer this C++ code to python, I decided to use your module, but I didn't understand how to use it.
I tried to make such an implementation, but nothing worked out for me. Could you help me? I would be very grateful!