locked
Using unsupported Win32 functions in Metro-style apps

    Question

  • At which point is the use of unsupported Win32 functions caught?

    At runtime? Installation?

    Thursday, September 15, 2011 5:42 AM

Answers

  • Dan is correct.  Functions which aren't allowed in Metro-style apps should be #ifdeffed out of the SDK headers if you build for WinRT.  Thanks Dan.

     

    -Greg Binkerd

    Microsoft Developer Support

     

     

     

    • Marked as answer by Greg Binkerd Thursday, September 15, 2011 4:03 PM
    Thursday, September 15, 2011 4:03 PM
  • It's actually at two points. Dan is correct that it is done at build time. However, it is also done during onboarding to the store (as part of our validation process). If you want to run the same checks that the store will do, you can run the wlskui.exe tool that is in the Developer Preview image (located at C:\Program Files (x86)\Windows Kits\8.0\Software Logo Toolkit).

    On top of Win32, there are also additional checks for the creation of COM components. If you are using the new CoCreateInstanceFromApp to create COM objects from a Metro style app, we validate at runtime what COM objects can or can't be created by the app.


    Program Manager, Windows Runtime

    jason.olson@microsoft.com

    http://www.twitter.com/jolson88

    Thursday, September 15, 2011 4:23 PM

All replies

  • Build time. windows.h (and included sub .h files) has checks in it for whether you're building for WinRT.
    Dan
    Thursday, September 15, 2011 3:08 PM
  • Dan is correct.  Functions which aren't allowed in Metro-style apps should be #ifdeffed out of the SDK headers if you build for WinRT.  Thanks Dan.

     

    -Greg Binkerd

    Microsoft Developer Support

     

     

     

    • Marked as answer by Greg Binkerd Thursday, September 15, 2011 4:03 PM
    Thursday, September 15, 2011 4:03 PM
  • It's actually at two points. Dan is correct that it is done at build time. However, it is also done during onboarding to the store (as part of our validation process). If you want to run the same checks that the store will do, you can run the wlskui.exe tool that is in the Developer Preview image (located at C:\Program Files (x86)\Windows Kits\8.0\Software Logo Toolkit).

    On top of Win32, there are also additional checks for the creation of COM components. If you are using the new CoCreateInstanceFromApp to create COM objects from a Metro style app, we validate at runtime what COM objects can or can't be created by the app.


    Program Manager, Windows Runtime

    jason.olson@microsoft.com

    http://www.twitter.com/jolson88

    Thursday, September 15, 2011 4:23 PM
  • Jason, I've been told if I wrap old code with a WinRT interface in a DLL that the app store will reject it. Is the true?

    That is to say, create a metro app that uses wrapped code can't be sold in the store.

    • Edited by scarless Monday, September 19, 2011 11:54 PM
    Saturday, September 17, 2011 8:18 PM
  • That is correct.  The block is on the use of the APIs, regardless of whether they're wrapped or not.

    If you have APIs you feel you need, please let us know which ones and we can consider how best to handle the request.

     

    Tuesday, September 20, 2011 5:18 AM
  • Build time. windows.h (and included sub .h files) has checks in it for whether you're building for WinRT.
    Dan
    I just tried including windows.h in my Metro apps, now I can compile CreateFile (not CreateFile2) and DeviceIoControl and a lot of other APIs not listed in the Metro Win32 references, these calls fail at runtime of course, but why I can compile them ?
    Tuesday, September 20, 2011 5:36 AM