Ben H
Ben H

Reputation: 3905

Can non-white-listed APIs in a Win32 library be used in a WinRT app?

I'm building a Windows Store App in C++ for desktop only, and I need to use a Win32 API that is not white-listed. For some background, only white-listed Win32 APIs are available to WinRT apps. I know that Win32 libraries can be used in WinRT apps, but my question is can the library contain non-white-listed API calls? Does it matter if the library is a DLL or static lib? I am not going to submit this app to the Windows Store, so as long as the app works, I'm not concerned about getting it approved by MS.

Upvotes: 0

Views: 107

Answers (1)

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21889

If you can get the same behavior through supported API then I'd strongly recommend that. If not, then take a look at brokered Windows Runtime Components to allow the sideloaded Windows Runtime app to call a component in the desktop environment which can then use any desktop API.

If you deploy through the store then the app must pass certification and can only use or link to allowed API. The app won't pass certification if it contains any library which references blocked API.

If you aren't deploying through the store then passing certification is recommended but not required. The app can link to and call API which are not permitted for Windows Store apps, but the behavior is not guaranteed. Functions may not work as desired from the Windows Store app's context. In some cases it may be always fail. In others it may sometimes fail. In others it may succeed. Unsupported behavior may change without notice. Using a brokered Windows Runtime Component to call the desktop API from the desktop environment will be safer and more consistent.

At a high level it doesn't matter if the library is a DLL or a static lib; however, since the linker will likely remove unused calls from the static lib, linking to a static library which contains disallowed but unused calls may pass certification while linking to a DLL with the same calls would fail.

Upvotes: 1

Related Questions