question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IEnumExplorerCommand.Next array marshaling SizeParameterIndex incorrect?

See original GitHub issue

https://github.com/dahall/Vanara/blob/c88bf0acfd4e0b209b5ed6d2d688fd22a1aad37a/PInvoke/Shell32/ShObjIdl.IExplorerCommand.cs#L115

Here, should the celt be used as the size parameter, instead of pceltFetched? That is should the SizeParamIndex be set to 0, instead of 2?

The documentation says :

celt Specifies the number of elements to fetch. pceltFetched When this method returns, contains a pointer to the number of elements actually retrieved.

When this method gets called, the out parameter pceltFetched will always be the default value zero, so, seems pUICommand should be initialized as an array of size celt, instead of pceltFetched? otherwise, the initial value of pUICommand will always be an empty array and can’t be populated later.

Also see: https://github.com/wjk/MSIExtractApp/blob/ba59307319a97c8a1d0a49bdaaa5be54fbf479af/src/MSIExtract.ShellExtension/Interop/IEnumExplorerCommand.cs#L18

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dahallcommented, Jul 9, 2020

Thank you. That helps my understanding immensely. I think I need to expand my testing to including implementations and then adjust all the SizeParamIndex values accordingly.

0reactions
dahallcommented, Jul 12, 2020

I have updated all interfaces with similar patterns to using the input size parameter for SizeParamIndex.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IEnumExplorerCommand::Next method (shobjidl_core.h)
Retrieves a specified number of elements that directly follow the current element.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found