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
Add support for InProc Com invocation #2035
Conversation
@check-spelling-bot ReportUnrecognized words, please review:
Previously acknowledged words that are now absentactivatable amd Archs dsc Globals hackathon mytool Packagedx parametermap whatifTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the git@github.com:yao-msft/winget-cli.git repository |
It would be interesting to have the sample caller app be able to swap to this as well for test purposes.
| @@ -191,7 +191,7 @@ | |||
| <Link> | |||
| <SubSystem>Console</SubSystem> | |||
| <GenerateWindowsMetadata>false</GenerateWindowsMetadata> | |||
| <AdditionalDependencies Condition="'$(Configuration)'=='Debug'">wininet.lib;shell32.lib;winsqlite3.lib;shlwapi.lib;icuuc.lib;icuin.lib;urlmon.lib;Advapi32.lib;winhttp.lib;onecoreuap.lib;msi.lib;%(AdditionalDependencies)</AdditionalDependencies> | |||
| <AdditionalDependencies Condition="'$(Configuration)'=='Debug'">%(AdditionalDependencies)</AdditionalDependencies> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this now a no-op?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I leave the node here in unlikely case we'll need something in the future.
|
|
||
| extern "C" | ||
| { | ||
| BOOL WINDOWS_PACKAGE_MANAGER_API_CALLING_CONVENTION DllMain( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be using a macro for calling convention that is more in line with what this expects, not just whatever we happen to use.
|
|
||
| WINDOWS_PACKAGE_MANAGER_API DllCanUnloadNow() | ||
| { | ||
| return WindowsPackageManagerInProcModuleTerminate() ? S_OK : S_FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the right way to do it? It seems like there are potential error paths here, although given the calling patterns it might be ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this pattern is what I found in most other com dlls we wrote in the past.
|
|
||
| WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerInProcModuleInitialize() try | ||
| { | ||
| ::Microsoft::WRL::Module<::Microsoft::WRL::ModuleType::InProc>::Create(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need an initialization of our code? I suppose that might be what the state separation config would do.
We don't need to RegisterObjects? Is that out-of-proc only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. RegisterObjects is for out of proc only. In proc automatically recognizes the creator map.
@check-spelling-bot ReportUnrecognized words, please review:
Previously acknowledged words that are now absentactivatable amd Archs dsc Globals hackathon mytool Packagedx parametermap whatifTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the git@github.com:yao-msft/winget-cli.git repository |
Change
Added a shim dll to support in-proc Com activation of winget Com apis.
Validation
Validated by writing a sample caller consuming winget Com apis through in-proc activation. Codes run fine with in-proc activation.
Next
Microsoft Reviewers: Open in CodeFlow