bool XDAOsImageWriter::Close()
{
	if (!m_bOpen)
		return false;
	m_bOpen= false;
	
	if (!m_nbf) 
		return false;
    if (!m_nbf->Close())
		return false;

    if (!RunApplication(g_cfg.ProgrammeAcommand.c_str(), ""))
		return false;

	return true;
}
Beispiel #2
0
int Run(MAIN_ARGS, const TCHAR* szAppName, const TCHAR* szAppVersion, const TCHAR* szAppURL)
{
    size_t lenAppName = _tcslen(szAppName);
    g_szAppName = new TCHAR[lenAppName + 1];
    g_szAppVersion = new TCHAR[_tcslen(szAppVersion) + 1];
    g_szAppURL = new TCHAR[_tcslen(szAppURL) + 8];
    
    _tcscpy(g_szAppName, szAppName);
    _tcscpy(g_szAppVersion, szAppVersion);

#ifdef USE_WEBVIEW
    _tcscpy(g_szAppURL, szAppURL);
#endif
#ifdef USE_CEF
    _tcscpy(g_szAppURL, TEXT("http://"));
    _tcscat(g_szAppURL, szAppURL);
#endif
    
    // initialize with default values
    InitDefaultStrings();
    
#ifdef OS_WIN
    // - set the registry key to "Software\<AppName>"
	if (g_windowsInfo.szRegistryKey == NULL)
    {
        g_windowsInfo.szRegistryKey = new TCHAR[9 + lenAppName + 1];
        _tcscpy(g_windowsInfo.szRegistryKey, TEXT("Software\\"));
        _tcscat(g_windowsInfo.szRegistryKey, g_szAppName);
    }
#endif
    
    if (g_pNativeExtensions == NULL)
        g_pNativeExtensions = new DefaultNativeExtensions();

    // initialize and start the application
    return RunApplication(INIT_APPLICATION_ARGS);
}
Beispiel #3
0
void *startSSDS(void *)
{
	CFStringRef bundlePath = CopyMacBundlePath();
	CFRelease(bundlePath);
	char confPath[1024];
	chdir(CFStringGetCStringPtr(bundlePath, CFStringGetFastestEncoding(bundlePath)));
	sprintf(confPath, "%s/Test/ssds.cfg", CFStringGetCStringPtr(bundlePath, CFStringGetFastestEncoding(bundlePath)));

	int argc = 3;
	const char *argv[] = { "SSDS", "-C", "ssds.cfg" };
#else
int main(int argc, char *argv[])
{
#endif
   try {
      Initialise(argc, (char **)argv);
      BuildRecogniser();
      RunApplication();
   }
   catch (ATK_Error e){
      int n = HRErrorCount();
      printf("ATK Error %d\n",e.i);
      for (int i=1; i<=n; i++)
         printf("  %d. %s\n",i,HRErrorGetMess(i));
   }
   catch (HTK_Error e){
      int n = HRErrorCount();
      printf("HTK Error %d\n",e.i);
      for (int i=1; i<=n; i++)
         printf("  %d. %s\n",i,HRErrorGetMess(i));
   }
#ifdef __APPLE__
	CFRelease(confPath);
#endif

   return 0;
}
Beispiel #4
0
static HRESULT RunNormal(
    __in HINSTANCE hInstance,
    __in BURN_ENGINE_STATE* pEngineState
    )
{
    HRESULT hr = S_OK;
    HANDLE hPipesCreatedEvent = NULL;
    BOOL fContinueExecution = TRUE;
    BOOL fReloadApp = FALSE;

    // Initialize logging.
    hr = LoggingOpen(&pEngineState->log, &pEngineState->variables, pEngineState->command.display, pEngineState->registration.sczDisplayName);
    ExitOnFailure(hr, "Failed to open log.");

    // Ensure the cache functions are initialized since we might use them soon.
    hr = CacheInitialize(&pEngineState->registration, &pEngineState->variables);
    ExitOnFailure(hr, "Failed to initialize internal cache functionality.");

    // When launched explicitly unelevated, create the pipes so the elevated process can connect.
    if (BURN_ELEVATION_STATE_UNELEVATED_EXPLICITLY == pEngineState->elevationState)
    {
        Assert(pEngineState->companionConnection.dwProcessId);
        Assert(pEngineState->companionConnection.sczName);
        Assert(pEngineState->companionConnection.sczSecret);
        Assert(!pEngineState->companionConnection.hProcess);
        Assert(INVALID_HANDLE_VALUE == pEngineState->companionConnection.hPipe);
        Assert(INVALID_HANDLE_VALUE == pEngineState->companionConnection.hCachePipe);

        hr = PipeCreatePipes(&pEngineState->companionConnection, TRUE, &hPipesCreatedEvent);
        ExitOnFailure(hr, "Failed to create pipes to connect to elevated parent process.");

        hr = PipeWaitForChildConnect(&pEngineState->companionConnection);
        ExitOnFailure(hr, "Failed to connect to elevated parent process.");

        ReleaseHandle(hPipesCreatedEvent);
    }

    // Ensure we're on a supported operating system.
    hr = ConditionGlobalCheck(&pEngineState->variables, &pEngineState->condition, pEngineState->command.display, pEngineState->registration.sczDisplayName, &pEngineState->userExperience.dwExitCode, &fContinueExecution);
    ExitOnFailure(hr, "Failed to check global conditions");

    if (!fContinueExecution)
    {
        LogId(REPORT_STANDARD, MSG_FAILED_CONDITION_CHECK);

        // If the block told us to abort, abort!
        ExitFunction1(hr = S_OK);
    }

    if (pEngineState->userExperience.fSplashScreen && BOOTSTRAPPER_DISPLAY_NONE < pEngineState->command.display)
    {
        SplashScreenCreate(hInstance, NULL, &pEngineState->command.hwndSplashScreen);
    }

    // Create a top-level window to handle system messages.
    hr = UiCreateMessageWindow(hInstance, pEngineState);
    ExitOnFailure(hr, "Failed to create the message window.");

    // Query registration state.
    hr = CoreQueryRegistration(pEngineState);
    ExitOnFailure(hr, "Failed to query registration.");

    // Set some built-in variables before loading the BA.
    hr = PlanSetVariables(pEngineState->command.action, &pEngineState->variables);
    ExitOnFailure(hr, "Failed to set action variables.");

    hr = RegistrationSetVariables(&pEngineState->registration, &pEngineState->variables);
    ExitOnFailure(hr, "Failed to set registration variables.");

    // If a layout directory was specified on the command-line, set it as a well-known variable.
    if (pEngineState->command.wzLayoutDirectory && *pEngineState->command.wzLayoutDirectory)
    {
        hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_LAYOUT_DIRECTORY, pEngineState->command.wzLayoutDirectory, FALSE);
        ExitOnFailure(hr, "Failed to set layout directory variable to value provided from command-line.");
    }

    do
    {
        fReloadApp = FALSE;

        hr = RunApplication(pEngineState, &fReloadApp);
        ExitOnFailure(hr, "Failed while running ");
    } while (fReloadApp);

LExit:
    // If the message window is still around, close it.
    UiCloseMessageWindow(pEngineState);

    VariablesDump(&pEngineState->variables);

    // end per-machine process if running
    if (INVALID_HANDLE_VALUE != pEngineState->companionConnection.hPipe)
    {
        PipeTerminateChildProcess(&pEngineState->companionConnection, pEngineState->userExperience.dwExitCode, (BURN_ELEVATION_STATE_UNELEVATED_EXPLICITLY == pEngineState->elevationState) ? pEngineState->fRestart : FALSE);
    }

    // If the splash screen is still around, close it.
    if (::IsWindow(pEngineState->command.hwndSplashScreen))
    {
        ::PostMessageW(pEngineState->command.hwndSplashScreen, WM_CLOSE, 0, 0);
    }

    ReleaseHandle(hPipesCreatedEvent);

    return hr;
}
Beispiel #5
0
Bool TERMWINDOWMEMBER parseLine(char *line)
    {
    int i, j, k;
    char *words[128];
    char newline[82];
    char done;

    const int count = parse_it(words, line);

    i = -1;

    while (++i < count)
        {
        switch (tolower(*words[i++]))
            {
            case 'd':
                {
                if (debug)
                    {
                    OC.ansiattr = cfg.wattr;
                    cPrintf(getdbmsg(6), words[i], words[i + 1], words[i + 2]);
                    OC.ansiattr = cfg.attr;
                    cPrintf(spc);
                    }
                else
                    {
                    cPrintf(getmsg(433));
                    }

                const protocols *theProt = GetProtocolByKey(words[i][0], TRUE);

                if (!theProt)
                    {
                    return (FALSE);
                    }

                wxrcv(words[i + 1], words[i + 2], theProt);

                i += 2;
                break;
                }

            case 'p':
                {
                if (debug)
                    {
                    OC.ansiattr = cfg.wattr;
                    cPrintf(getdbmsg(7), words[i]);
                    OC.ansiattr = cfg.attr;
                    cPrintf(spc);
                    }
                else
                    {
                    cPrintf(getmsg(433));
                    }

                netpause(atoi(words[i]) * 100);
                break;
                }

            case 'r':
                {
                if (debug)
                    {
                    OC.ansiattr = cfg.wattr;
                    cPrintf(getdbmsg(8), words[i], words[i+1], words[i+2]);
                    OC.ansiattr = cfg.attr;
                    cPrintf(spc);
                    }
                else
                    {
                    cPrintf(getmsg(433));
                    }

                k = atoi(words[i+2]);

                for (done = FALSE, j = 0; j < k && !done; j++)
                    {
                    if (debug)
                        {
                        OC.ansiattr = cfg.wattr;
                        cPrintf(getdbmsg(9), words[i]);
                        OC.ansiattr = cfg.attr;
                        cPrintf(spc);
                        }
                    else
                        {
                        cPrintf(getmsg(433));
                        }

                    if (!wait_for(words[i], node->GetWaitTimeout()))
                        {
                        if (debug)
                            {
                            OC.ansiattr = cfg.wattr;
                            cPrintf(getdbmsg(10), words[i+1]);
                            OC.ansiattr = cfg.attr;
                            cPrintf(spc);
                            }
                        else
                            {
                            cPrintf(getmsg(433));
                            }

                        CommPort->OutString(words[i + 1], node->GetOutputPace());
                        }
                    else
                        {
                        done = TRUE;
                        }
                    }

                i += 2;

                if (!done)
                    {
                    return (FALSE);
                    }

                break;
                }

            case 's':
                {
                if (debug)
                    {
                    OC.ansiattr = cfg.wattr;
                    cPrintf(getdbmsg(10), words[i]);
                    OC.ansiattr = cfg.attr;
                    cPrintf(spc);
                    }
                else
                    {
                    cPrintf(getmsg(433));
                    }

                CommPort->OutString(words[i], node->GetOutputPace());
                break;
                }

            case 'u':
                {
                if (debug)
                    {
                    OC.ansiattr = cfg.wattr;
                    cPrintf(getdbmsg(11), words[i], words[i + 1],
                            words[i + 2]);
                    OC.ansiattr = cfg.attr;
                    cPrintf(spc);
                    }
                else
                    {
                    cPrintf(getmsg(433));
                    }

                const protocols *theProt = GetProtocolByKey(words[i][0],
                        TRUE);

                if (!theProt)
                    {
                    return (FALSE);
                    }

                wxsnd(words[i + 1], words[i + 2], theProt, 0);

                i += 2;
                break;
                }

            case 'w':
                {
                if (debug)
                    {
                    OC.ansiattr = cfg.wattr;
                    cPrintf(getdbmsg(9), words[i]);
                    OC.ansiattr = cfg.attr;
                    cPrintf(spc);
                    }
                else
                    {
                    cPrintf(getmsg(433));
                    }

                if (!wait_for(words[i], node->GetWaitTimeout()))
                    {
                    return (FALSE);
                    }

                break;
                }

            case '!':
                {
                RunApplication(words[i], NULL, TRUE, TRUE);
                break;
                }

            case '@':
                {
                FILE *file;

                if ((file = fopen(words[i], FO_R)) != NULL)
                    {
                    while (fgets(newline, 80, file))
                        {
                        if (!parseLine(newline))
                            {
                            fclose(file);
                            return (FALSE);
                            }
                        }

                    fclose(file);
                    }
                else
                    {
                    return (FALSE);
                    }

                break;
                }

            default:
                {
                OC.ansiattr = (uchar)(cfg.cattr | 128);
                cPrintf(getnetmsg(52), words[i-1], words[i]);
                OC.ansiattr = cfg.attr;
                cPrintf(spc);
                break;
                }
            }
        }

    return (TRUE);
    }