CoCreateInstanceAsAdmin and the Elevation Moniker

You might see that API referred here and there to help with the new UAC scenarios. And you'll also read that some people are wondering where the API declaration is...

I understand that the COM team implemented Elevation Moniker to super-set this API functionality: The COM Elevation Moniker. From that page:

 HRESULT CoCreateInstanceAsAdmin(HWND hwnd, REFCLSID rclsid, REFIID riid, void ** ppv) {
    BIND_OPTS3 bo;
    WCHAR  wszCLSID[50];
    WCHAR  wszMonikerName[300];

    StringFromGUID2(rclsid, wszCLSID, sizeof(wszCLSID)/sizeof(wszCLSID[0])); 
    HRESULT hr = StringCchPrintf(wszMonikerName, 
                                 sizeof(wszMonikerName)/sizeof(wszMonikerName[0]),
                                 L"Elevation:Administrator!new: %s",
                                 wszCLSID);
    if (FAILED(hr))
        return hr;
    memset(&bo, 0, sizeof(bo));
    bo.cbStruct = sizeof(bo);
    bo.hwnd = hwnd;
    bo.dwClassContext  = CLSCTX_LOCAL_SERVER;
    return CoGetObject(wszMonikerName, &bo, riid, ppv);
}

Auf wiedersehen!