Move the SDK API to its own IDL file#40784
Conversation
| </RegistryKey> | ||
|
|
||
| <!-- IWSLCSDKTerminationCallback--> | ||
| <RegistryKey Root="HKCR" Key="Interface\{86A807EA-F2A1-4382-93E5-09FB5F2F4A31}"> |
There was a problem hiding this comment.
Pull request overview
This PR refactors the WSLC SDK-facing COM surface by moving it into a separate IDL contract (WSLCCompat.idl) and adds a compatibility layer so the service can continue using wslc.idl internally while the SDK consumes the compat contract.
Changes:
- Introduces
WSLCCompat.idland wires it into IDL generation + proxy/stub build outputs. - Updates the service COM objects (session/container/process/session manager) to also implement
IWSLCCompat*interfaces and forward compat calls to existing implementations via conversion helpers. - Updates the SDK and tests to use
IWSLCCompat*interfaces/types instead of the internalwslc.idltypes.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/WslcSdkWinRTTests.cpp | Updates tests to obtain an IWSLCSession via QI from the SDK’s compat session. |
| test/windows/WslcSdkTests.cpp | Updates tests to use QI from compat session to the internal session interface for launching. |
| src/windows/wslcsession/WSLCSession.h | Makes WSLCSession implement IWSLCCompatSession and declares forwarding methods. |
| src/windows/wslcsession/WSLCSession.cpp | Adds IWSLCCompatSession forwarding implementations using the compat conversion layer. |
| src/windows/wslcsession/WSLCProcess.h | Makes WSLCProcess implement IWSLCCompatProcess and declares forwarding methods. |
| src/windows/wslcsession/WSLCProcess.cpp | Implements IWSLCCompatProcess forwarding methods. |
| src/windows/wslcsession/WSLCContainer.h | Makes WSLCContainer implement IWSLCCompatContainer and declares forwarding methods. |
| src/windows/wslcsession/WSLCContainer.cpp | Implements IWSLCCompatContainer forwarding methods. |
| src/windows/WslcSDK/WslcsdkPrivate.h | Switches SDK internals to store compat COM interfaces (IWSLCCompat*). |
| src/windows/WslcSDK/wslcsdk.cpp | Updates SDK implementation to use compat types/interfaces and adds handle conversion for compat contract. |
| src/windows/WslcSDK/TerminationCallback.h | Switches termination callback COM interface to compat version. |
| src/windows/WslcSDK/TerminationCallback.cpp | Updates termination callback implementation for compat reason enum. |
| src/windows/WslcSDK/ProgressCallback.h | Switches progress callback COM interface to compat version. |
| src/windows/WslcSDK/ProgressCallback.cpp | Updates progress callback implementation comments to compat interface name. |
| src/windows/WslcSDK/IOCallback.h | Switches IO callback plumbing to use IWSLCCompatProcess and compat handle type. |
| src/windows/WslcSDK/IOCallback.cpp | Updates IO callback implementation to use compat process/handle APIs. |
| src/windows/WslcSDK/CrashDumpCallback.h | Switches crash dump callback COM interface to compat version. |
| src/windows/WslcSDK/CrashDumpCallback.cpp | Updates crash dump callback implementation comments to compat interface name. |
| src/windows/service/stub/CMakeLists.txt | Adds generated compat proxy/stub sources to the stub target. |
| src/windows/service/inc/WSLCCompat.idl | New SDK-facing IDL contract defining IWSLCCompat* interfaces and types. |
| src/windows/service/inc/wslc.idl | Annotates intended usage and adds a coclass decl guard shared with compat IDL. |
| src/windows/service/inc/CMakeLists.txt | Adds WSLCCompat.idl to IDL generation. |
| src/windows/service/exe/WSLCSessionManager.h | Makes WSLCSessionManager implement IWSLCCompatSessionManager and declares forwarding methods. |
| src/windows/service/exe/WSLCSessionManager.cpp | Implements IWSLCCompatSessionManager forwarding using conversion helpers. |
| src/windows/common/CMakeLists.txt | Adds APICompat.{h,cpp} to the common library build. |
| src/windows/common/APICompat.h | Declares conversion helpers and owning conversion wrappers bridging compat <-> internal contracts. |
| src/windows/common/APICompat.cpp | Implements compat <-> internal enum/struct/callback conversions and owning wrapper conversions. |
| msipackage/package.wix.in | Registers the new compat interface IIDs for proxy/stub marshaling. |
|
|
||
| cpp_quote("#ifdef __cplusplus") | ||
| cpp_quote("class DECLSPEC_UUID(\"a9b7a1b9-0671-405c-95f1-e0612cb4ce8f\") WSLCSessionManager;") | ||
| cpp_quote("class DECLSPEC_UUID(\"9FCD2067-9FC6-4EFA-9EB0-698169EBF7D3\") WSLCSessionFactory;") |
There was a problem hiding this comment.
Fixed the casing here while I was reviewing this
| @@ -922,10 +919,8 @@ | |||
| object | |||
There was a problem hiding this comment.
Removed this method from that interface because it's only useful to the SDK
|
I don't really understand the rationale here, but my best guess is to create a more obvious "you will be breaking things if you change this" set of interfaces so that you can freely modify the "internal only" interfaces without caring about compat. While this can work, we will need to update the "Compat" layer with new SDK visible items using standard COM versioning practices anyway. So you end up managing two copies of the same interface. A better layout might be to split out the "unstable" portions into |
The thinking behind this is to make it easy to update the "internal" version of the COM API, which we'll likely have to change as we add features to wslc.exe (which we expect to require a lot more changes than the SDK API). And yeah the main objective is to reduce the risk of us incorrectly assuming that a method / structure / flag can be changed without affecting the SDK, while it actually does. With this design, we know that |
Summary of the Pull Request
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed