Beispiel #1
0
BOOL WINAPI DisconnectDialog (HWND hParent, DWORD dwType)
{
    HRESULT hr = S_OK;
	HRSRC hRsrc;
	HGLOBAL hGlob;
	int iRet;
    HINSTANCE hCoreDllInst = NULL;
    HCURSOR hCur;

    UNREFERENCED_PARAMETER(dwType);

    // Load WNet function pointers, or return error if not present
    hCoreDllInst = LoadLibrary(TEXT("coredll.dll"));
    CWR(hCoreDllInst);

    pfnWNetOpenEnum = (PFN_WNetOpenEnum)GetProcAddress(hCoreDllInst,TEXT("WNetOpenEnumW"));
    CPREx(pfnWNetOpenEnum, E_FAIL);
    
    pfnWNetEnumResource = (PFN_WNetEnumResource)GetProcAddress(hCoreDllInst,TEXT("WNetEnumResourceW"));
    CPREx(pfnWNetEnumResource, E_FAIL);
    
    pfnWNetCloseEnum = (PFN_WNetCloseEnum)GetProcAddress(hCoreDllInst,TEXT("WNetCloseEnum"));
    CPREx(pfnWNetCloseEnum, E_FAIL);
    
    pfnWNetDisconnectDialog1 = (PFN_WNetDisconnectDialog1) GetProcAddress(hCoreDllInst,TEXT("WNetDisconnectDialog1W"));
    CPREx(pfnWNetDisconnectDialog1, E_FAIL);

	hRsrc  = FindResource (HINST_RESDLL, MAKEINTRESOURCE(IDD_NETUI_REMOVE_CONNECTION),RT_DIALOG);
	hGlob = LoadResource (HINST_RESDLL, hRsrc);

	hCur = SetCursor(NULL);
	iRet = DialogBox(HINST_RESDLL, MAKEINTRESOURCE(IDD_NETUI_REMOVE_CONNECTION),
						   SHGetLastActiveWindow(hParent), DlgProcRemoveConnect);
    SetCursor(hCur);

    FreeLibrary(hCoreDllInst);

    if (iRet == -1) {
        RETAILMSG(1,(DBGTEXT("DisconnectDialog: DialogBox returned err %u"),
                     GetLastError()));
        return FALSE;
    }
    else
        return TRUE;

Error:
    if (NULL != hCoreDllInst)
    {
        FreeLibrary(hCoreDllInst);
    }

    return FALSE;
}
Beispiel #2
0
GradientEffect* 
GradientEffect::CreateInstance()
{
    DEBUGMSG(ZONE_SHADER, "GradientEffect::CreateInstance()");

    RESULT        rval      = S_OK;
    GradientEffect* pEffect   = NULL;

    if (Platform::IsOpenGLES2())
    {
        if (!s_GradientShadersLoaded)
        {
            CHR(Init());
        }

        CPREx(pEffect = new GradientEffect(), E_OUTOFMEMORY);
    }
    else 
    {
        RETAILMSG(ZONE_WARN, "Device doesn't support GradientEffect.");
    }

Exit:
    return pEffect;
}
Beispiel #3
0
RESULT
BehaviorManager::PopBehaviorFromGameObject( IN HGameObject hGameObject, IN StateMachineQueue queue )
{
    RESULT               rval                 = S_OK;
    GameObject*          pGameObject          = NULL;
    StateMachineManager* pStateMachineManager = NULL;

    CHR(GOMan.GetGameObjectPointer( hGameObject, &pGameObject ));
    pStateMachineManager = pGameObject->GetStateMachineManager();
    CPREx(pStateMachineManager, E_UNEXPECTED);
    
    pStateMachineManager->PopStateMachine( queue );

    RETAILMSG(ZONE_STATEMACHINE | ZONE_VERBOSE, "BehaviorManager::PopBehaviorFromGameObject( \"%s\", queue: %d )", 
        pGameObject->GetName().c_str(),
        queue);

    
Exit:
    if (FAILED(rval))
    {
        RETAILMSG(ZONE_ERROR, "ERROR: BehaviorManager::PopBehaviorFromGameObject( \"%s\" ) GO not found, or has no Behaviors", 
            pGameObject ? pGameObject->GetName().c_str() : "NULL");
    }   

    return rval;
}
HRESULT
COpenGLRenderer::PreRender(
    HWND hwndRender, 
    HDC hdcRender,
    __in const SIZE* pSurfaceSize, 
    __out BOOL* pNeedsFullRedraw,
    __out ICustomSurface** ppSurface
    )
{
    UNREFERENCED_PARAMETER(hwndRender);
    UNREFERENCED_PARAMETER(hdcRender);
    UNREFERENCED_PARAMETER(ppSurface);

    RETAILMSG(ZONE_FUNCTION, (TEXT("COpenGLRenderer::PreRender() Thread [0x%x]"), GetCurrentThreadId() ));


    HRESULT hr = S_OK;
    bool    fFullRedraw = FALSE;


    // Gain exclusive access to the OpenGL driver
    // until end-of-frame [ ::PostRender() ]
    // This ensures windows render in lock-step (OpenGL ES is not thread-safe).
    // It's also generally the most efficient use of the GPU.
    CHR( m_pOpenGLDevice->Lock() );
    m_bHasDeviceLock = TRUE;

    // Allocate a texture and return it to HgCore.
    // Every scene will have at least one textured quad for the background.
    // This quad is later presented to the screen.
    //
    // We don't actually allocate the pixel buffer here; it's deferred until HgCore
    // calls COpenGLSurface::Lock() to update the bits.
    //
    if (NULL == m_pBackSurface)
    {
        CPREx(pSurfaceSize, E_INVALIDARG);

        hr =  m_pOpenGLDevice->CreateTexture(TRUE, pSurfaceSize->cx, pSurfaceSize->cy, TRUE, (ICustomSurface**)&m_pBackSurface);
        if (FAILED(hr))
        {
            RETAILMSG(ZONE_ERROR, (TEXT("COpenGLRenderer: Failure to create surface, hr=0x%08X\r\n"), hr));
            CHR(hr);
        }

        fFullRedraw = TRUE;
    }

    *pNeedsFullRedraw = fFullRedraw;
    *ppSurface = m_pBackSurface;
    (*ppSurface)->AddRef();

Error:
    return hr;
}
HRESULT
COpenGLRenderer::SetGraphicsDevice( COpenGLDevice* pDevice )
{
    HRESULT hr = S_OK;
    CPREx(pDevice, E_POINTER);

    m_pOpenGLDevice = pDevice;
    m_pOpenGLDevice->AddRef();

Error:
    return hr;
}
Beispiel #6
0
HRESULT IsNetworkSecure(__in __opt LPCTSTR pszSSID, BOOL fUse8021x,
        DWORD dwAuthentication, DWORD dwEncryption,
        __out __opt LPTSTR *ppszSSIDDisplay, DWORD cxpExtent, BOOL fEscapeHtml)
{
    HRESULT hr = S_FALSE;
    BOOL fSecure;
    HDC hdcScreen = NULL;

    // if 802.1x or NOT open and unencrypted then it's secure
    fSecure = fUse8021x || !( (Ndis802_11AuthModeOpen == dwAuthentication) &&
        !CWZCManagerWireless::IsEncrypted(dwEncryption) );
    
    hr = fSecure ? S_OK : S_FALSE;

    if (NULL != ppszSSIDDisplay)
    {
        TCHAR szSSIDEllipsized[MAX_SSID_LEN + ARRAYSIZE(c_szEllipsis)];
        LPVOID rgpvArgs[] = {szSSIDEllipsized};
        int cchTry, cchSSID, cchFit;
        SIZE  size;

        CPREx(pszSSID, E_INVALIDARG);

        // caller wants the string

        *ppszSSIDDisplay = NULL;
        hdcScreen = GetDC(NULL);
        cchSSID = lstrlen(pszSSID);

        // work backwards from the full string less one char
        for (cchTry = cchSSID; cchTry >= 0; cchTry--)
        {
            hr = StringCchCopyN(szSSIDEllipsized,
                ARRAYSIZE(szSSIDEllipsized), pszSSID, cchTry);
            CHR(hr);
            if (cchTry < cchSSID)
            {
                // second and successive times, ellipsize
                hr = StringCchCat(szSSIDEllipsized,
                    ARRAYSIZE(szSSIDEllipsized), c_szEllipsis);
                VHR(hr);
            }
            LocalFree(*ppszSSIDDisplay);

            CWR(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
                (LPTSTR)LoadString(HINST_RESDLL,
                fSecure ? IDS_WZC_NETSEL_FORMAT_SECURE_NETWORK :
                IDS_WZC_NETSEL_FORMAT_OPEN_NETWORK, NULL, 0), 0, 0,
                (LPTSTR)ppszSSIDDisplay, 0, (va_list *)rgpvArgs));
            VBR(GetTextExtentExPoint(hdcScreen, *ppszSSIDDisplay,
                lstrlen(*ppszSSIDDisplay), cxpExtent, &cchFit, NULL,
                &size));
            // need to continue lopping?
            if (size.cx <= (int)cxpExtent)
            {
                if (fEscapeHtml)
                {
                    // Create the escaped version of the SSID
                    hr = EscapeHtmlString(szSSIDEllipsized, ARRAYSIZE(szSSIDEllipsized));
                    CHR(hr);

                    CWR(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                        FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
                        (LPTSTR)LoadString(HINST_RESDLL,
                        fSecure ? IDS_WZC_NETSEL_FORMAT_SECURE_NETWORK :
                        IDS_WZC_NETSEL_FORMAT_OPEN_NETWORK, NULL, 0), 0, 0,
                        (LPTSTR)ppszSSIDDisplay, 0, (va_list *)rgpvArgs));
                }
                break;
            }
            
        }
        ASSERT(cchTry >= 0);

    }

Error:
    if (FAILED(hr) && (NULL != ppszSSIDDisplay) && (NULL != *ppszSSIDDisplay))
    {
        LocalFree(*ppszSSIDDisplay);
        *ppszSSIDDisplay = NULL;
    }

    if (NULL != hdcScreen)
    {
        ReleaseDC(NULL, hdcScreen);
    }

    return hr;
}