Exemplo n.º 1
0
static void process_dbg_opt(const char *opt)
{
    char *buf = dbg_buf + strlen(dbg_buf);
    if (0 == strncmp(opt, "regr:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned int addr = (unsigned int) simple_strtoul(p, &p, 16);

        if (addr) 
        {
            unsigned int regVal = DISP_REG_GET(addr);
            DDP_DRV_INFO("regr: 0x%08X = 0x%08X\n", addr, regVal);
            sprintf(buf, "regr: 0x%08X = 0x%08X\n", addr, regVal);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "regw:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned int addr = (unsigned int) simple_strtoul(p, &p, 16);
        unsigned int val = (unsigned int) simple_strtoul(p + 1, &p, 16);
        if (addr) 
        {
            unsigned int regVal;
            DISP_REG_SET(addr, val);
            regVal = DISP_REG_GET(addr);
            DDP_DRV_DBG("regw: 0x%08X, 0x%08X = 0x%08X\n", addr, val, regVal);
            sprintf(buf, "regw: 0x%08X, 0x%08X = 0x%08X\n", addr, val, regVal);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "ddp_drv_dbg_log:", 16))
    {
        char *p = (char *)opt + 16;
        unsigned int enable = (unsigned int) simple_strtoul(p, &p, 10);
        if (enable)
            ddp_drv_dbg_log = 1;
        else
            ddp_drv_dbg_log = 0;

        sprintf(buf, "ddp_drv_dbg_log: %d\n", ddp_drv_dbg_log);
    }
    else if (0 == strncmp(opt, "ddp_drv_irq_log:", 16))
    {
        char *p = (char *)opt + 16;
        unsigned int enable = (unsigned int) simple_strtoul(p, &p, 10);
        if (enable)
            ddp_drv_irq_log = 1;
        else
            ddp_drv_irq_log = 0;
        
        sprintf(buf, "ddp_drv_irq_log: %d\n", ddp_drv_irq_log);        
    }
    else if (0 == strncmp(opt, "backlight:", 10))
    {
        char *p = (char *)opt + 10;
        unsigned int level = (unsigned int) simple_strtoul(p, &p, 10);

        if (level) 
        {
            disp_bls_set_backlight(level);            
            sprintf(buf, "backlight: %d\n", level); 
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dump_reg:", 9))
    {
        char *p = (char *)opt + 9;
        unsigned int module = (unsigned int) simple_strtoul(p, &p, 10);
        DDP_DRV_INFO("process_dbg_opt, module=%d \n", module);
        if (module<DISP_MODULE_MAX) 
        {
            disp_dump_reg(module);            
            sprintf(buf, "dump_reg: %d\n", module); 
        } else {
            DDP_DRV_INFO("process_dbg_opt2, module=%d \n", module);
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dump_aal:", 9))
    {        
        char *p = (char *)opt + 9;
        unsigned int arg = (unsigned int) simple_strtoul(p, &p, 10);
        if (arg == 0)
        {
            int i;
            unsigned int hist[LUMA_HIST_BIN];
            disp_get_hist(hist);
            for (i = 0; i < LUMA_HIST_BIN; i++)
            {
                DDP_DRV_DBG("LUMA_HIST_%02d: %d\n", i, hist[i]);
                sprintf(dbg_buf + strlen(dbg_buf), "LUMA_HIST_%2d: %d\n", i, hist[i]);
            }
        }
        else if (arg == 1)
        {
            int i;
            DISP_AAL_PARAM param;
            
            GetUpdateMutex();
            memcpy(&param, get_aal_config(), sizeof(DISP_AAL_PARAM));
            ReleaseUpdateMutex();

            DDP_DRV_DBG("pwmDuty: %lu\n", param.pwmDuty);
            sprintf(dbg_buf + strlen(dbg_buf), "pwmDuty: %lu\n", param.pwmDuty);
            for (i = 0; i < LUMA_CURVE_POINT; i++)
            {
                DDP_DRV_DBG("lumaCurve[%02d]: %lu\n", i, param.lumaCurve[i]);
                sprintf(dbg_buf + strlen(dbg_buf), "lumaCurve[%02d]: %lu\n", i, param.lumaCurve[i]);
            }
        }
    }
    else if (0 == strncmp(opt, "debug:", 6))
    {
        char *p = (char *)opt + 6;
        unsigned int enable = (unsigned int) simple_strtoul(p, &p, 10);
        if(enable==1)
        {
            printk("[DDP] debug=1, trigger AEE\n");
            aee_kernel_exception("DDP-TEST-ASSERT", "[DDP] DDP-TEST-ASSERT");
        }
        else if(enable==2)
        {
           ddp_mem_test();
        }
        else if(enable==3)
        {
           ddp_mem_test2();
        }
#if 0
        else if(enable==4)
        {
            DDP_IRQ_ERR("test 4");
        }
#endif
        else if(enable==5)
        {
            DISP_MSG("SMI_LARB_MON_REQ0=0x%x, SMI_LARB_MON_REQ1=0x%x, SMI_0=0x%x, SMI_600=0x%x, SMI_604=0x%x, SMI_610=0x%x, SMI_614=0x%x, \
                              color_h_cnt=%d, color_line_cnt=%d, ovl_add_con=0x%x, ovl_ctrl_flow=0x%x \n", 
                              *(volatile unsigned int*)0xf4010450, 
                              *(volatile unsigned int*)0xf4010454,
                              *(volatile unsigned int*)0xf4010000,
                              *(volatile unsigned int*)0xf4010600,
                              *(volatile unsigned int*)0xf4010604,
                              *(volatile unsigned int*)0xf4010610,
                              *(volatile unsigned int*)0xf4010614,
                              *(volatile unsigned int*)0xf400b404,
                              *(volatile unsigned int*)0xf400b408,
                              DISP_REG_GET(DISP_REG_OVL_ADDCON_DBG),
                              DISP_REG_GET(DISP_REG_OVL_FLOW_CTRL_DBG));
             sprintf(dbg_buf + strlen(dbg_buf), "SMI_LARB_MON_REQ0=0x%x, SMI_LARB_MON_REQ1=0x%x, SMI_0=0x%x, SMI_600=0x%x, SMI_604=0x%x, SMI_610=0x%x, SMI_614=0x%x,"
                       "color_h_cnt=%d, color_line_cnt=%d, ovl_add_con=0x%x, ovl_ctrl_flow=0x%x \n",
                       *(volatile unsigned int*)0xf4010450, 
                       *(volatile unsigned int*)0xf4010454,
                       *(volatile unsigned int*)0xf4010000,
                       *(volatile unsigned int*)0xf4010600,
                       *(volatile unsigned int*)0xf4010604,
                       *(volatile unsigned int*)0xf4010610,
                       *(volatile unsigned int*)0xf4010614,
                       *(volatile unsigned int*)0xf400b404,
                       *(volatile unsigned int*)0xf400b408,
                       DISP_REG_GET(DISP_REG_OVL_ADDCON_DBG),
                       DISP_REG_GET(DISP_REG_OVL_FLOW_CTRL_DBG));               
        }
Exemplo n.º 2
0
static DWORD WINAPI BackgroundUpdateThread(
    __in_opt LPVOID pvContext
    )
{
    HRESULT hr = S_OK;
    BACKGROUND_UPDATE_THREAD_CONTEXT* pContext = reinterpret_cast<BACKGROUND_UPDATE_THREAD_CONTEXT*>(pvContext);
    DWORD64 dw64Version = 0;
    LPWSTR pwzFeedUri = NULL;
    DWORD64 dw64NextUpdateTime = 0;

    HANDLE hProcess = INVALID_HANDLE_VALUE;
    HANDLE hUpdateMutex = INVALID_HANDLE_VALUE;

    if (!pContext || !pContext->pwzApplicationId || !*pContext->pwzApplicationId)
    {
        hr = E_INVALIDARG;
        ExitOnFailure(hr, "Background thread was not passed application identifier.");
    }

    if (vbShutdownThread)
    {
        ExitFunction1(hr = S_OK);
    }

    hr = GetUpdateMutex(pContext->pwzApplicationId, &hUpdateMutex);
    ExitOnFailure(hr, "Failed to get update mutex, skipping update check.");

    if (vbShutdownThread)
    {
        ExitFunction1(hr = S_OK);
    }

    hr = RssUpdateGetAppInfo(pContext->pwzApplicationId, &dw64Version, &pwzFeedUri, NULL);
    ExitOnFailure(hr, "Failed to get app info.");

    if (pContext->fExecuteUpdate)
    {
        // If an update is available and higher version that the application currently on the local 
        // machine, launch the install and bail.
        hr = RssUpdateTryLaunchUpdate(pContext->pwzApplicationId, dw64Version, &hProcess, &dw64NextUpdateTime);
        if (SUCCEEDED(hr))
        {
            if (hProcess)
            {
                ::CloseHandle(hProcess);
                ExitFunction(); // bail since we're doing an update
            }
        }
    }

    if (vbShutdownThread)
    {
        ExitFunction1(hr = S_OK);
    }

    // If no update process was launched, go check for a feed update.
    hr = RssUpdateCheckFeed(pContext->pwzApplicationId, dw64Version, pwzFeedUri, dw64NextUpdateTime);

LExit:
    if (INVALID_HANDLE_VALUE != hUpdateMutex)
    {
        ::CloseHandle(hUpdateMutex);
    }

    if (INVALID_HANDLE_VALUE != hProcess)
    {
        ::CloseHandle(hProcess);
    }

    ReleaseStr(pwzFeedUri);

    if (pContext)
    {
        ReleaseStr(pContext->pwzApplicationId);
        MemFree(pContext);
    }

    return hr;
}
static void process_dbg_opt(const char *opt)
{
    char *buf = dbg_buf + strlen(dbg_buf);
    if (0 == strncmp(opt, "regr:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned int addr = (unsigned int) simple_strtoul(p, &p, 16);

        if (addr) 
        {
            unsigned int regVal = DISP_REG_GET(addr);
            DDP_DRV_INFO("regr: 0x%08X = 0x%08X\n", addr, regVal);
            sprintf(buf, "regr: 0x%08X = 0x%08X\n", addr, regVal);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "regw:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned int addr = (unsigned int) simple_strtoul(p, &p, 16);
        unsigned int val = (unsigned int) simple_strtoul(p + 1, &p, 16);
        if (addr) 
        {
            unsigned int regVal;
            DISP_REG_SET(addr, val);
            regVal = DISP_REG_GET(addr);
            DDP_DRV_DBG("regw: 0x%08X, 0x%08X = 0x%08X\n", addr, val, regVal);
            sprintf(buf, "regw: 0x%08X, 0x%08X = 0x%08X\n", addr, val, regVal);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "ddp_drv_dbg_log:", 16))
    {
        char *p = (char *)opt + 16;
        unsigned int enable = (unsigned int) simple_strtoul(p, &p, 10);
        if (enable)
            ddp_drv_dbg_log = 1;
        else
            ddp_drv_dbg_log = 0;

        sprintf(buf, "ddp_drv_dbg_log: %d\n", ddp_drv_dbg_log);
    }
    else if (0 == strncmp(opt, "ddp_drv_irq_log:", 16))
    {
        char *p = (char *)opt + 16;
        unsigned int enable = (unsigned int) simple_strtoul(p, &p, 10);
        if (enable)
            ddp_drv_irq_log = 1;
        else
            ddp_drv_irq_log = 0;
        
        sprintf(buf, "ddp_drv_irq_log: %d\n", ddp_drv_irq_log);        
    }
    else if (0 == strncmp(opt, "backlight:", 10))
    {
        char *p = (char *)opt + 10;
        unsigned int level = (unsigned int) simple_strtoul(p, &p, 10);

        if (level) 
        {
            disp_bls_set_backlight(level);            
            sprintf(buf, "backlight: %d\n", level); 
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dump_reg:", 9))
    {
        char *p = (char *)opt + 9;
        unsigned int module = (unsigned int) simple_strtoul(p, &p, 10);
        DDP_DRV_INFO("process_dbg_opt, module=%d \n", module);
        if (module<DISP_MODULE_MAX) 
        {
            disp_dump_reg(module);            
            sprintf(buf, "dump_reg: %d\n", module); 
        } else {
            DDP_DRV_INFO("process_dbg_opt2, module=%d \n", module);
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dump_aal:", 9))
    {        
        char *p = (char *)opt + 9;
        unsigned int arg = (unsigned int) simple_strtoul(p, &p, 10);
        if (arg == 0)
        {
            int i;
            unsigned int hist[LUMA_HIST_BIN];
            disp_get_hist(hist);
            for (i = 0; i < LUMA_HIST_BIN; i++)
            {
                DDP_DRV_DBG("LUMA_HIST_%02d: %d\n", i, hist[i]);
                sprintf(dbg_buf + strlen(dbg_buf), "LUMA_HIST_%2d: %d\n", i, hist[i]);
            }
        }
        else if (arg == 1)
        {
            int i;
            DISP_AAL_PARAM param;
            
            GetUpdateMutex();
            memcpy(&param, get_aal_config(), sizeof(DISP_AAL_PARAM));
            ReleaseUpdateMutex();

            DDP_DRV_DBG("pwmDuty: %lu\n", param.pwmDuty);
            sprintf(dbg_buf + strlen(dbg_buf), "pwmDuty: %lu\n", param.pwmDuty);
            for (i = 0; i < LUMA_CURVE_POINT; i++)
            {
                DDP_DRV_DBG("lumaCurve[%02d]: %lu\n", i, param.lumaCurve[i]);
                sprintf(dbg_buf + strlen(dbg_buf), "lumaCurve[%02d]: %lu\n", i, param.lumaCurve[i]);
            }
        }
    }
    else if (0 == strncmp(opt, "debug:", 6))
    {
        char *p = (char *)opt + 6;
        unsigned int enable = (unsigned int) simple_strtoul(p, &p, 10);
        if(enable==1)
        {
            printk("[DDP] debug=1, trigger AEE\n");
            aee_kernel_exception("DDP-TEST-ASSERT", "[DDP] DDP-TEST-ASSERT");
        }
        else if(enable==2)
        {
           ddp_mem_test();
        }
        else if(enable==3)
        {
           ddp_mem_test2();
        }
    }
    else if (0 == strncmp(opt, "mmp", 3))
    {
        init_ddp_mmp_events();
    }
    else if (0 == strncmp(opt, "dpfd_ut1:", 9))
    {
#if 0
        char *p = (char *)opt + 9;
        unsigned int channel = (unsigned int) simple_strtoul(p, &p, 10);        
        //ddpk_testfunc_1(channel);
#endif
    }
    else if (0 == strncmp(opt, "dpfd_ut2:", 9))
    {
#if 0
        char *p = (char *)opt + 9;
        unsigned int channel = (unsigned int) simple_strtoul(p, &p, 10);        
        //ddpk_testfunc_2(channel);
#endif
    }
    else if (0 == strncmp(opt, "dpfd:log", 8))
    {
    }
    else if (0 == strncmp(opt, "pqon", 4))
    {
        pq_debug_flag=0;
        sprintf(buf, "Turn on PQ %d\n", pq_debug_flag);
    }
    else if (0 == strncmp(opt, "pqoff", 5))
    {
        pq_debug_flag=1;
        sprintf(buf, "Turn off PQ %d\n", pq_debug_flag);        
    }
    else if (0 == strncmp(opt, "pqdemo", 6))
    {
        pq_debug_flag=2;
        sprintf(buf, "Turn on PQ (demo) %d\n", pq_debug_flag);    
    }
    else if (0 == strncmp(opt, "pqstop", 6))
    {
        pq_debug_flag=3;
        sprintf(buf, "Stop mutex update %d\n", pq_debug_flag);    
    }
    else if (0 == strncmp(opt, "aalon", 5))
    {
        aal_debug_flag=0;
        sprintf(buf, "resume aal update %d\n", aal_debug_flag);    
    }
    else if (0 == strncmp(opt, "aaloff", 6))
    {
        aal_debug_flag=1;
        sprintf(buf, "suspend aal update %d\n", aal_debug_flag);    
    }
    else if (0 == strncmp(opt, "color_win:", 10))
    {
        char *p = (char *)opt + 10;
        unsigned int sat_upper, sat_lower, hue_upper, hue_lower;
        sat_upper = (unsigned int) simple_strtoul(p, &p, 10);
        p++;
        sat_lower = (unsigned int) simple_strtoul(p, &p, 10);
        p++;
        hue_upper = (unsigned int) simple_strtoul(p, &p, 10);
        p++;
        hue_lower = (unsigned int) simple_strtoul(p, &p, 10);
        DDP_DRV_INFO("Set color_win: %u, %u, %u, %u\n", sat_upper, sat_lower, hue_upper, hue_lower);
        disp_pq_set_window(sat_upper, sat_lower, hue_upper, hue_lower);
    }
    else if (0 == strncmp(opt, "dpx", 3))
    {
        ddp_debug_flag = ddp_debug_flag ^ 1;
        DDP_DRV_INFO("ddp_debug_flag: %d\n", ddp_debug_flag);
    }
    else if (0 == strncmp(opt, "ovl_reg:", 8))
    {
        char *p = (char *)opt + 8;
        unsigned int offset = (unsigned int) simple_strtoul(p, &p, 16);
        unsigned int value = (unsigned int) simple_strtoul(p + 1, &p, 16);

        disp_path_get_mutex_(gMutexID);
        DISP_REG_SET(DISP_OVL_BASE+offset, value);
        disp_path_release_mutex_(gMutexID);

        DDP_DRV_INFO("ovl_reg: 0x%08X = 0x%08X\n", DISP_OVL_BASE+offset, value);
    }
    else if (0 == strncmp(opt, "rdma_reg:", 9))
    {
        char *p = (char *)opt + 9;
        unsigned int offset = (unsigned int) simple_strtoul(p, &p, 16);
        unsigned int value = (unsigned int) simple_strtoul(p + 1, &p, 16);

        disp_path_get_mutex_(gMutexID);
        DISP_REG_SET(DISP_RDMA_BASE+offset, value);
        disp_path_release_mutex_(gMutexID);

        DDP_DRV_INFO("rdma_reg: 0x%08X = 0x%08X\n", DISP_RDMA_BASE+offset, value);
    }
    else if (0 == strncmp(opt, "bls_reg:", 8))
    {
        char *p = (char *)opt + 8;
        unsigned int offset = (unsigned int) simple_strtoul(p, &p, 16);
        unsigned int value = (unsigned int) simple_strtoul(p + 1, &p, 16);

        disp_path_get_mutex_(gMutexID);
        DISP_REG_SET(DISP_BLS_BASE+offset, value);
        disp_path_release_mutex_(gMutexID);

        DDP_DRV_INFO("bls_reg: 0x%08X = 0x%08X\n", DISP_BLS_BASE+offset, value);
    }
    else if (0 == strncmp(opt, "pq_reg:", 7))
    {
        char *p = (char *)opt + 7;
        unsigned int offset = (unsigned int) simple_strtoul(p, &p, 16);
        unsigned int value = (unsigned int) simple_strtoul(p + 1, &p, 16);

        disp_path_get_mutex_(gMutexID);
        DISP_REG_SET(DISP_PQ_BASE+offset, value);
        disp_path_release_mutex_(gMutexID);

        DDP_DRV_INFO("pq_reg: 0x%08X = 0x%08X\n", DISP_PQ_BASE+offset, value);
    }
    else
    {
	    goto Error;
    }

    return;

Error:
    DDP_DRV_ERR("parse command error!\n%s\n\n%s", opt, STR_HELP);
}
Exemplo n.º 4
0
int __cdecl wmain(
    __in int argc,
    __in WCHAR * argv[]
    )
{
    HRESULT hr = S_OK;
    LPWSTR pwzCommandLine = NULL;

    LPWSTR wzAppId = NULL;
    GUID guidApp;

    DWORD64 dw64Version;
    LPWSTR pwzFeedUri = NULL;
    LPWSTR pwzApplicationPath = NULL;
    LPWSTR pwzApplicationDirectory = NULL;

    DWORD64 dw64NextUpdateTime = 0;
    BOOL fUpdateReady = FALSE;
    DWORD64 dw64UpdateVersion = 0;
    LPWSTR pwzFeedPath = NULL;
    LPWSTR pwzSetupPath = NULL;

    DWORD dwTimeToLive = 0;
    LPWSTR pwzApplicationId = NULL;
    LPWSTR pwzApplicationSource = NULL;

    BOOL bDeleteUpdateInfoPath = FALSE;
    BOOL bDeleteUpdateBinaryPath = FALSE;
    HANDLE hProcess = INVALID_HANDLE_VALUE;
    HANDLE hUpdateMutex = INVALID_HANDLE_VALUE;

    //
    // Process command-line arguments.
    //
    for (int i=1; i<argc; i++)
    {
        if (argv[i][0] == L'-' || argv[i][0] == L'/')
        {
            if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"ac", -1))
            {
                if (wzAppId)
                {
                    ExitOnFailure(hr = E_INVALIDARG, "May only specify one -ac switch.");
                }

                wzAppId = argv[++i];
                hr = ::CLSIDFromString(wzAppId, &guidApp);
                ExitOnFailure(hr, "Failed to parse the -ac argument.");
            }
        }
        else
        {
            ExitOnFailure1(hr = E_INVALIDARG, "Bad commandline argument: %S", argv[i]);
        }
    }
    ExitOnNull(wzAppId, hr, E_INVALIDARG, "Must specify a -ac switch.");

    hr = GetUpdateMutex(&guidApp, &hUpdateMutex);
    if (FAILED(hr))
    {
        TraceError(hr, "Failed to query the update mutex.  Proceeding as if this process didn't acquire the mutex.");
    }

    hr = RssUpdateGetAppInfo(wzAppId, &dw64Version, &pwzFeedUri, &pwzApplicationPath);
    ExitOnFailure(hr, "Failed to get app info.");

    // If we acquired the update lock and there is already an update downloaded, install that now.
    if (INVALID_HANDLE_VALUE != hUpdateMutex)
    {
        Trace(REPORT_DEBUG, "Got the update mutex.  Will check for updates on local machine before launching app.");

        // If an update is available and higher version that the application currently on the local 
        // machine, launch the install and bail.
        hr = RssUpdateTryLaunchUpdate(wzAppId, dw64Version, &hProcess, &dw64NextUpdateTime);
        if (SUCCEEDED(hr))
        {
            if (hProcess)
            {
                ::CloseHandle(hProcess);
                ExitFunction(); // bail since we're doing an update
            }
        }
    }
    else
    {
        Trace(REPORT_DEBUG, "Didn't get the update mutex.  Won't check for updates.");
    }

    hr = PathExpand(&pwzCommandLine, pwzApplicationPath, PATH_EXPAND_FULLPATH);
    ExitOnFailure(hr, "Failed to expand application path.");

    if (pwzCommandLine && L'\"' != pwzCommandLine[0])
    {
        // Get the working directory.
        hr = PathGetDirectory(pwzCommandLine, &pwzApplicationDirectory);
        ExitOnFailure(hr, "Failed to get application directory from command-line.");

        // Put quotes around the command line.
        hr = StrAllocPrefix(&pwzCommandLine, L"\"", 0);
        ExitOnFailure(hr, "Failed to prefix command-line with quote.");

        hr = StrAllocConcat(&pwzCommandLine, L"\"", 0);
        ExitOnFailure(hr, "Failed to concat command-line with quote.");
    }

    Trace1(REPORT_DEBUG, "Launching the target app with commandline: %ls.", pwzCommandLine);
    hr = LaunchTarget(pwzCommandLine, pwzApplicationDirectory, &hProcess);
    ExitOnFailure1(hr, "Failed to launch %ls", pwzCommandLine);

    // If we acquired the update lock then check to see if enough time has passed such that we look for more updates.
    if (INVALID_HANDLE_VALUE != hUpdateMutex)
    {
        hr = RssUpdateCheckFeed(wzAppId, dw64Version, pwzFeedUri, dw64NextUpdateTime);

        hr = S_OK;
    }

LExit:
    if (INVALID_HANDLE_VALUE != hUpdateMutex)
    {
        ::CloseHandle(hUpdateMutex);
    }

    if (INVALID_HANDLE_VALUE != hProcess)
    {
        ::CloseHandle(hProcess);
    }

    if (bDeleteUpdateInfoPath)
    {
        ::DeleteFileW(pwzFeedPath);
    }

    if (bDeleteUpdateBinaryPath)
    {
        ::DeleteFileW(pwzSetupPath);
    }

    ReleaseStr(pwzApplicationSource);
    ReleaseStr(pwzApplicationId);
    ReleaseStr(pwzSetupPath);
    ReleaseStr(pwzFeedPath);
    ReleaseStr(pwzApplicationPath);
    ReleaseStr(pwzFeedUri);
    ReleaseStr(pwzCommandLine);
    ReleaseStr(pwzApplicationDirectory);

    return SCODE_CODE(hr);
}