WindowsStoreErrorType store_initialize()

in WindowsStore/WindowsStore.cpp [24:62]


    WindowsStoreErrorType store_initialize(WindowsStorePtr* storePtr, HWND window, WindowsStoreCallback licenseChangedCallback, void* userData)
    {
        *storePtr = nullptr;

        // Initialize the Windows Runtime.
        HRESULT hr = RoInitialize(RO_INIT_MULTITHREADED);

        if (!SUCCEEDED(hr))
        {
            return WINRT_WINDOWS_RUNTIME_ERROR;
        }

        // Check if Windows 10 Windows.Services.Store api is supported
        if (!Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Services.Store.StoreContext"))
        {
            return WINRT_WINDOWS_VERSION_ERROR;
        }

        // Check if app is running inside of an App Package
        if (!isRunningInsideAppPackage())
        {
            return WINRT_APP_PACKAGE_ERROR;
        }

        // attempt to initialize the Windows Store WinRT Implementation
        WindowsStoreImpl* store = new WindowsStoreImpl();
        WindowsStoreErrorType result = store->Initialize(window, licenseChangedCallback, userData);
        if (result != WINRT_NO_ERROR)
        {
            delete store;
            *storePtr = nullptr;
        }
        else
        {
            *storePtr = (WindowsStorePtr)store;
        }

        return result;
    }