-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Auto Casting C-types #4
Comments
And if we assume from Windows.Win32.System.Rpc import RpcStringBindingComposeW
from Windows import c_wchar_p
strBinding = c_wchar_p()
rStatus = RpcStringBindingComposeW("0767a036-0d22-48aa-ba69-b619480f38cb", "ncalrpc", None, None, None, strBinding)
print(rStatus, strBinding.value) I think this is current behavior in |
WIP |
It seems to work. |
That's great, I can confirm both WIP examples above have been tested and passed successfully, |
Reopened bcz still need to work to be complete. Look at this example (you can try to repro): currently working script: from Windows.Win32.System.Rpc import RPC_SECURITY_QOS_V3_W
from Windows.Win32.Security import CreateWellKnownSid, WELL_KNOWN_SID_TYPE_WinLocalSystemSid
from ctypes import cast, c_ulong, c_void_p, create_string_buffer
SECURITY_MAX_SID_SIZE = 68
sidSize = c_ulong(SECURITY_MAX_SID_SIZE)
sid = create_string_buffer(SECURITY_MAX_SID_SIZE)
rStatus = CreateWellKnownSid(
WELL_KNOWN_SID_TYPE_WinLocalSystemSid,
None,
sid,
sidSize)
if not rStatus:
raise
security = RPC_SECURITY_QOS_V3_W()
security.Sid = cast(sid, c_void_p) Expected Work with auto casting: from Windows.Win32.System.Rpc import RPC_SECURITY_QOS_V3_W
from Windows.Win32.Security import CreateWellKnownSid, WELL_KNOWN_SID_TYPE_WinLocalSystemSid
from ctypes import cast, c_ulong, c_void_p, create_string_buffer
SECURITY_MAX_SID_SIZE = 68
sidSize = SECURITY_MAX_SID_SIZE # removed c_ulong
sid = create_string_buffer(SECURITY_MAX_SID_SIZE)
rStatus = CreateWellKnownSid(
WELL_KNOWN_SID_TYPE_WinLocalSystemSid,
None,
sid,
sidSize) # not work after removed c_ulong
if not rStatus:
raise
security = RPC_SECURITY_QOS_V3_W()
security.Sid = sid # not work after removed cast |
^^^ This PR still not able to to cover removed |
In continue of #8 I decided to create a TODO list to improve auto casting:
|
py-win32more/Windows/__init__.py Lines 65 to 74 in c723275
the function name is
I think these 2 should break into separate functions. if I had time, I'll send a PR for these. |
For |
what's the latest update on this? |
I am still not sure how it should be. |
In continue of #2 (comment)
All functions are typed for both arguments and results. but current behavior is, it'll raise if our entered arguments types are not exact same as specified.
proposed behavior is that it should auto casting the types for both arguments and results.
here is current working script:
Auto Casting will remove cast from our side:
The text was updated successfully, but these errors were encountered: