Skip to content
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

varkind and invoke_type #1199

Closed
wants to merge 1 commit into from

Conversation

GitBadSanta
Copy link

@GitBadSanta GitBadSanta commented Apr 18, 2018

Regarding this commit

Previous implementation was :

def _GetDescInvokeType(entry, default_invoke_type):
    if not entry or not entry.desc: return default_invoke_type
    return entry.desc[4]   # apparently varkind

So this was always returning varkind when entry.desc was defined. The function name is consistent : we try to retrieve invoke_type from desc and return default_invoke_type otherwise.

Regarding new implementation :

def _GetDescInvokeType(entry, invoke_type):
    # determine the wFlags argument passed as input to IDispatch::Invoke
    if not entry or not entry.desc: return invoke_type
    varkind = entry.desc[4] # from VARDESC struct returned by ITypeComp::Bind
    if varkind == pythoncom.VAR_DISPATCH and invoke_type == pythoncom.INVOKE_PROPERTYGET:
        return pythoncom.INVOKE_FUNC | invoke_type # DISPATCH_METHOD & DISPATCH_PROPERTYGET can be combined in IDispatch::Invoke
    else:
        return invoke_type

The logic is totally different, we check varkind to possibly amend invoke_type, but we never return varkind.

In the related issue of this pull request, we found out that when setting AdminQueueInfo member of an MSMQ.MSMQMessage , we call _GetDescInvokeType with an entry verifying entry.desc[4] = 8 and an invoke_type = INVOKE_PROPERTYPUT.
We should get a INVOKE_PROPERTYPUTREF (8), corresponding to entry.desc[4] but new function returns INVOKE_PROPERTYPUT and makes invoke crash.

The pull request is proposing a mix between two implementations, but I'm still really confused, especially with entry.desc[4] which apparently should correspond to varkind. Looking to documentation
varkind values can only be 0,1,2,3.

So what is really entry.desc[4] ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant