//---------------------------------------------------------------------------
// Operaciones previas y llamada a la función de descarga
//---------------------------------------------------------------------------
void __fastcall TMainForm::b_descargarClick(TObject *Sender)
{
    DWORD       bytes;
    AnsiString  url("http://" + cb_url->Text);
    AnsiString  destino(IncludeTrailingBackslash(m_opciones.m_destino));

    // buscar la extensión. La función ExtractFileExt también nos sirve para Urls, porque
    // lo único que hace el buscar el punto comenzando por el final.
    destino += "datos" + ExtractFileExt(cb_url->Text);

    Screen->Cursor = crHourGlass;

    e_localizacion->Text = "Descargando...";
    e_asociado->Text     = e_localizacion->Text;
    b_abrir->Enabled     = false;
    ts_archivo->Repaint();

    __try
    {
        lb_log->Items->Clear();
        lb_log->Repaint();

        bytes = Descargar(url.c_str(), destino.c_str(), &m_opciones, &DescargaCallback);
    }
    __finally
    {
        Screen->Cursor = crDefault;

        if ( DWORD(-1) == bytes )
        {
            e_localizacion->Text = "";
            e_asociado->Text     = "";

            lb_log->ItemIndex = MainForm->lb_log->Items->Add("Se ha producido un error descargando el recurso.");
        }
        else
        {
            char buff[256];

            FindExecutable(destino.c_str(), NULL, buff);
            e_localizacion->Text = destino;
            e_asociado->Text     = buff;
            b_abrir->Enabled     = true;
            m_vista->Lines->Clear();

            lb_log->ItemIndex = MainForm->lb_log->Items->Add("El recurso ha sido descargado en " +
                    destino + ". Tamaño total: " + IntToStr(bytes) + " bytes.");
        }
    }
}
Esempio n. 2
0
GoGoEncoder::GoGoEncoder() : AEEncoder(ADDON_NAME) {
	PRINT(("GoGoEncoder::GoGoEncoder()\n"));

	if (FindExecutable(GOGO, gogoPath) != B_OK) {
		delete menu;
		menu = 0;
		error = FSS_EXE_NOT_FOUND;
	}

	if (menu) {
		BMenuItem* item = menu->FindItem(_32KBPS);
		if (!item) {
			delete menu;
			menu = 0;
		}
	}
}
Esempio n. 3
0
int open_google_earth()
{
    char *kml_filename = appendExt(curr->filename, ".kml");

    char *basename = get_basename(curr->filename);
    char *dirname = get_dirname(curr->filename);

    char *arg;
    if (strlen(dirname)==0) {
        char *tmpdir = g_get_current_dir();
        dirname = escapify(tmpdir);
        arg = MALLOC(sizeof(char)*(strlen(dirname)+strlen(kml_filename)+20));
        sprintf(arg, "%s/%s", dirname, kml_filename);
        //free(tmpdir);
    }
    else {
        arg = STRDUP(kml_filename);
    }

    char *png_file = appendExt(arg, ".png");

    printf("png file: %s\n", png_file);
    printf("Temporary kml file: %s\n", arg);

    FILE *kml_file = fopen(arg, "w");
    if (!kml_file)
    {
        asfPrintWarning("Couldn't open kml file!\n");        
        return FALSE;
    }

    dbf_header_t *dbf;
    int nAttr, nCoords;
    double *lat, *lon, center_lat, center_lon;
    char configFile[255], *name;
    meta_parameters *meta;

    sprintf(configFile, "%s/convert2vector.config", get_asf_share_dir());
    c2v_config *cfg = read_c2v_config(configFile);

    kml_header(kml_file);

    meta = meta2vector(curr->filename, &dbf, &nAttr, &lat, &lon, &nCoords);
    //meta_parameters *meta = curr->meta;
    if (meta && meta->general &&
        meta_is_valid_double(meta->general->center_latitude) &&
        meta_is_valid_double(meta->general->center_longitude))
    {
        pixbuf2png(pixbuf_small, png_file);
        //kml_entry_with_overlay(kml_file, meta, basename, png_file, dirname);
        name = get_basename(kml_filename);
        center_lat = meta->general->center_latitude;
        center_lon = meta->general->center_longitude;
        write_kml_placemark(kml_file, name, center_lat, center_lon, png_file, 
          dbf, nAttr, lat, lon, nCoords, cfg);
        FREE(lat);
        FREE(lon);
        FREE(dbf);
    }
    else
    {
        asfPrintWarning(
            "Failed, metadata doesn't contain valid lat/lon info.\n");
        return FALSE;
    }

    kml_footer(kml_file);
    fclose(kml_file);

    gchar *ge;

    printf("kml: %s\n", kml_filename);
    printf("dir: %s\n", dirname);

#ifdef win32
    char path[1024];
    FindExecutable((LPCTSTR)kml_filename, (LPCTSTR)dirname, (LPTSTR)path);
    ge = escapify(path);
    printf("Path to google earth: %s\n", ge);
    
    asfSystem("\"%s\" \"%s\"", ge, arg);
#else
    ge = find_in_path("googleearth");
    if (!ge)
    {
       message_box("Couldn't find googleearth! Is it installed?");
       return FALSE;
    }

    int pid = fork();
    if (pid == 0) {
        asfSystem("\"%s\" \"%s\"", ge, arg);
        //unlink(kml_filename);
        exit(EXIT_SUCCESS);
    }
#endif

    free(kml_filename);
    free(basename);
    free(dirname);
    free(arg);

    return TRUE;
}
Esempio n. 4
0
SIGNAL_CALLBACK void
on_help_button_clicked(GtkWidget *widget)
{
#ifdef win32
    char pdf_dir[1024], pdf_file[128], pdf_viewer[1024];
    snprintf(pdf_dir, 1023, "%s/doc/", get_asf_share_dir());
    strcpy(pdf_file, "mapready_manual.pdf");
    //printf("pdf: %s/%s\n", pdf_dir, pdf_file);

    FindExecutable((LPCTSTR)pdf_file, (LPCTSTR)pdf_dir, (LPTSTR)pdf_viewer);
    printf("Found PDF Viewer: %s\n", pdf_viewer);

    if (strlen(pdf_viewer)) {
      asfSystem_NoWait("\"%s\" \"%s/%s\"", pdf_viewer, pdf_dir, pdf_file);
    } else {
      message_box("Couldn't find path to a PDF Viewer!");
    }
#else
    GtkWidget *help_dialog;
    GtkWidget *help_text;
    GtkTextBuffer * text_buffer;
    FILE * help_file;
    gchar * help_filename;

    help_dialog =
        get_widget_checked("help_dialog");

    help_text =
        get_widget_checked("help_text");

    text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(help_text));

    gtk_text_buffer_set_text(text_buffer, "", -1);

    help_filename = "mapready.txt";
    //help_file = fopen(help_filename, "rt");
    help_file = fopen_share_file(help_filename, "rt");
    if (help_file)
    {
        int line_count = 0;
        gchar * buffer = (gchar *) g_malloc(sizeof(gchar) * max_line_len);
        while (!feof(help_file))
        {
            gchar *p = fgets(buffer, max_line_len, help_file);
            if (p)
            {
                if (strlen(p)) line_count++;
                GtkTextIter end;
                gchar * q = strstr(buffer, "$VERSION");

                if (q)
                {
                    gchar * r = g_strdup(q + 8); /* 8 = length of '$VERSION' */

                    strcpy(q, MAPREADY_VERSION_STRING);
                    strcat(buffer, r);
                    g_free(r);
                }

                gtk_text_buffer_get_end_iter(text_buffer, &end);
                gtk_text_buffer_insert(text_buffer, &end, buffer, -1);
            }
        }
        if (!line_count) {
            sprintf(buffer, "\n\n  ERROR: Empty help file (mapready.txt) in share folder\n(%s)\n",
                    get_asf_share_dir());
            GtkTextIter end;
            gtk_text_buffer_get_end_iter(text_buffer, &end);
            gtk_text_buffer_insert(text_buffer, &end, buffer, -1);
        }

        fclose(help_file);
        g_free(buffer);
    }
    else {
        // No help file found
        gchar *buffer = (gchar *) g_malloc(sizeof(gchar) * max_line_len);
        strcpy(buffer, "\n\n  ERROR: Cannot find help file (mapready.txt) in share folder.\n");
        GtkTextIter end;
        gtk_text_buffer_get_end_iter(text_buffer, &end);
        gtk_text_buffer_insert(text_buffer, &end, buffer, -1);
        g_free(buffer);
    }

    gtk_widget_show(help_dialog);
#endif
}
Esempio n. 5
0
bool ecUtils::Launch(const ecFileName &strFileName, const ecFileName &strViewer)
{
	bool rc=false;

	if(!strViewer.IsEmpty())//use custom editor
	{
		wxString strCmdline(strViewer);
		
		PTCHAR pszCmdLine=strCmdline.GetBuffer(strCmdline.GetLength());
		GetShortPathName(pszCmdLine,pszCmdLine,strCmdline.GetLength());
		strCmdline.ReleaseBuffer();

		strCmdline+=_TCHAR(' ');
		strCmdline+=strFileName;
		PROCESS_INFORMATION pi;
		STARTUPINFO si;

		si.cb = sizeof(STARTUPINFO); 
		si.lpReserved = NULL; 
		si.lpReserved2 = NULL; 
		si.cbReserved2 = 0; 
		si.lpDesktop = NULL; 
		si.dwFlags = 0; 
		si.lpTitle=NULL;

		if(CreateProcess(
			NULL, // app name
			//strCmdline.GetBuffer(strCmdline.GetLength()),    // command line
			strCmdline.GetBuffer(strCmdline.GetLength()),    // command line
			NULL, // process security
			NULL, // thread security
			TRUE, // inherit handles
			0,
			NULL, // environment
			NULL, // current dir
			&si, // startup info
			&pi)){
            CloseHandle(pi.hProcess);
            CloseHandle(pi.hThread);
			rc=true;
		} else {
			MessageBoxF(wxT("Failed to invoke %s.\n"),strCmdline);
		}
		strCmdline.ReleaseBuffer();
	} else {// Use association
		TCHAR szExe[MAX_PATH];
		HINSTANCE h=FindExecutable(strFileName,wxT("."),szExe);
		if(int(h)<=32){
			wxString str;
			switch(int(h)){
				case 0:  str=wxT("The system is out of memory or resources.");break;
				case 31: str=wxT("There is no association for the specified file type.");break;
				case ERROR_FILE_NOT_FOUND: str=wxT("The specified file was not found.");break;
				case ERROR_PATH_NOT_FOUND: str=wxT("The specified path was not found.");break;
				case ERROR_BAD_FORMAT:     str=wxT("The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).");break;
				default: break;
			}
			MessageBoxF(wxT("Failed to open document %s.\r\n%s"),strFileName,str);
		} else {

			SHELLEXECUTEINFO sei = {sizeof(sei), 0, AfxGetMainWnd()->GetSafeHwnd(), wxT("open"),
					strFileName, NULL, NULL, SW_SHOWNORMAL, AfxGetInstanceHandle( )};

			sei.hInstApp=0;
			HINSTANCE hInst=ShellExecute(AfxGetMainWnd()->GetSafeHwnd(),wxT("open"), strFileName, NULL, wxT("."), 0)/*ShellExecuteEx(&sei)*/;
			if(int(hInst)<=32/*sei.hInstApp==0*/)
			{
				wxString str;
				switch(int(hInst))
				{
					case 0 : str=wxT("The operating system is out of memory or resources. ");break;
					case ERROR_FILE_NOT_FOUND : str=wxT("The specified file was not found. ");break;
					case ERROR_PATH_NOT_FOUND : str=wxT("The specified path was not found. ");break;
					case ERROR_BAD_FORMAT : str=wxT("The .EXE file is invalid (non-Win32 .EXE or error in .EXE image). ");break;
					case SE_ERR_ACCESSDENIED : str=wxT("The operating system denied access to the specified file. ");break;
					case SE_ERR_ASSOCINCOMPLETE : str=wxT("The filename association is incomplete or invalid. ");break;
					case SE_ERR_DDEBUSY : str=wxT("The DDE transaction could not be completed because other DDE transactions were being processed. ");break;
					case SE_ERR_DDEFAIL : str=wxT("The DDE transaction failed. ");break;
					case SE_ERR_DDETIMEOUT : str=wxT("The DDE transaction could not be completed because the request timed out. ");break;
					case SE_ERR_DLLNOTFOUND : str=wxT("The specified dynamic-link library was not found. ");break;
					//case SE_ERR_FNF : str=wxT("The specified file was not found. ");break;
					case SE_ERR_NOASSOC : str=wxT("There is no application associated with the given filename extension. ");break;
					case SE_ERR_OOM : str=wxT("There was not enough memory to complete the operation. ");break;
					//case SE_ERR_PNF : str=wxT("The specified path was not found. ");break;
					case SE_ERR_SHARE : str=wxT("A sharing violation occurred. ");break;
					default: str=wxT("An unexpected error occurred");break;
				}
				MessageBoxF(wxT("Failed to open document %s using %s.\r\n%s"),strFileName,szExe,str);
			} else {
				rc=true;
			}
		}
	}
	return rc;
}
Esempio n. 6
0
Handle OS_spec_dispatch_c(TaskData *taskData, Handle args, Handle code)
{
    unsigned c = get_C_unsigned(taskData, DEREFWORD(code));
    switch (c)
    {
    case 0: /* Return our OS type.  Not in any structure. */
        return Make_arbitrary_precision(taskData, 1); /* 1 for Windows. */

        /* Windows-specific functions. */
    case 1000: /* execute */
        return execute(taskData, args);

    case 1001: /* Get input stream as text. */
        return openProcessHandle(taskData, args, TRUE, TRUE);

    case 1002: /* Get output stream as text. */
        return openProcessHandle(taskData, args, FALSE, TRUE);

    case 1003: /* Get input stream as binary. */
        return openProcessHandle(taskData, args, TRUE, FALSE);

    case 1004: /* Get output stream as binary. */
        return openProcessHandle(taskData, args, FALSE, FALSE);

    case 1005: /* Get result of process. */
        {
            PHANDLETAB hnd = get_handle(DEREFWORD(args), HE_PROCESS);
            if (hnd == 0)
                raise_syscall(taskData, "Process is closed", EINVAL);
            // Close the streams. Either of them may have been
            // passed to the stream package.
            if (hnd->entry.process.hInput != INVALID_HANDLE_VALUE)
                CloseHandle(hnd->entry.process.hInput);
            hnd->entry.process.hInput = INVALID_HANDLE_VALUE;
            if (hnd->entry.process.hEvent)
                CloseHandle(hnd->entry.process.hEvent);
            hnd->entry.process.hEvent = NULL;
            if (hnd->entry.process.readToken)
            {
                PIOSTRUCT strm =
                    get_stream(hnd->entry.process.readToken);
                if (strm != NULL) close_stream(strm);
            }
            hnd->entry.process.readToken = 0;
            if (hnd->entry.process.hOutput != INVALID_HANDLE_VALUE)
                CloseHandle(hnd->entry.process.hOutput);
            hnd->entry.process.hOutput = INVALID_HANDLE_VALUE;
            if (hnd->entry.process.writeToken)
            {
                PIOSTRUCT strm =
                    get_stream(hnd->entry.process.writeToken);
                if (strm != NULL) close_stream(strm);
            }
            hnd->entry.process.writeToken = 0;

            // See if it's finished.
            while (true) {
                DWORD dwResult;
                if (GetExitCodeProcess(hnd->entry.process.hProcess, &dwResult) == 0)
                    raise_syscall(taskData, "GetExitCodeProcess failed",
                            -(int)GetLastError());
                if (dwResult != STILL_ACTIVE) {
                    /* Finished - return the result. */
                    /* Note: we haven't closed the handle because we might want to ask
                       for the result again.  We only close it when we've garbage-collected
                       the token.  Doing this runs the risk of running out of handles.
                       Maybe change it and remember the result in ML. */
                    return Make_arbitrary_precision(taskData, dwResult);
                }
                // Block and try again.
                WaitHandle waiter(hnd->entry.process.hProcess);
                processes->ThreadPauseForIO(taskData, &waiter);
            }
        }

    case 1006: /* Return a constant. */
        {
            unsigned i = get_C_unsigned(taskData, DEREFWORD(args));
            if (i >= sizeof(winConstVec)/sizeof(winConstVec[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return Make_arbitrary_precision(taskData, winConstVec[i]);
        }

        /* Registry functions. */
    case 1007: // Open a key within one of the roots.
        {
            unsigned keyIndex = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(0));
            // This should only ever happen as a result of a fault in
            // the Windows structure.
            if (keyIndex >= sizeof(hkPredefinedKeyTab)/sizeof(hkPredefinedKeyTab[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return openRegistryKey(taskData, args, hkPredefinedKeyTab[keyIndex]);
        }

    case 1008: // Open a subkey of an opened key.
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_REGISTRY);
            if (hnd == 0)
                raise_syscall(taskData, "Handle is closed", -ERROR_INVALID_HANDLE);
            return openRegistryKey(taskData, args, hnd->entry.hKey);
        }

    case 1009: // Create a subkey within one of the roots.
        {
            unsigned keyIndex = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(0));
            // This should only ever happen as a result of a fault in
            // the Windows structure.
            if (keyIndex >= sizeof(hkPredefinedKeyTab)/sizeof(hkPredefinedKeyTab[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return createRegistryKey(taskData, args, hkPredefinedKeyTab[keyIndex]);
        }

    case 1010: // Create a subkey within an opened key.
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_REGISTRY);
            if (hnd == 0)
                raise_syscall(taskData, "Handle is closed", -ERROR_INVALID_HANDLE);
            return createRegistryKey(taskData, args, hnd->entry.hKey);
        }

    case 1011: // Close a registry handle.
        {
            PHANDLETAB hnd = get_handle(DEREFWORD(args), HE_REGISTRY);
            if (hnd != 0) close_handle(hnd);
            return Make_arbitrary_precision(taskData, 0);
        }

    case 1012: // Get a value
        {
            unsigned keyIndex = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(0));
            // This should only ever happen as a result of a fault in
            // the Windows structure.
            if (keyIndex >= sizeof(hkPredefinedKeyTab)/sizeof(hkPredefinedKeyTab[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return queryRegistryKey(taskData, args, hkPredefinedKeyTab[keyIndex]);
        }

    case 1013: // Get a value
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_REGISTRY);
            if (hnd == 0)
                raise_syscall(taskData, "Handle is closed", -ERROR_INVALID_HANDLE);
            return queryRegistryKey(taskData, args, hnd->entry.hKey);
        }

    case 1014: // Delete a subkey
        {
            unsigned keyIndex = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(0));
            // This should only ever happen as a result of a fault in
            // the Windows structure.
            if (keyIndex >= sizeof(hkPredefinedKeyTab)/sizeof(hkPredefinedKeyTab[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return deleteRegistryKey(taskData, args, hkPredefinedKeyTab[keyIndex]);
        }

    case 1015: // Delete a subkey
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_REGISTRY);
            if (hnd == 0)
                raise_syscall(taskData, "Handle is closed", -ERROR_INVALID_HANDLE);
            return deleteRegistryKey(taskData, args, hnd->entry.hKey);
        }

    case 1016: // Set a value
        {
            unsigned keyIndex = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(0));
            // This should only ever happen as a result of a fault in
            // the Windows structure.
            if (keyIndex >= sizeof(hkPredefinedKeyTab)/sizeof(hkPredefinedKeyTab[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return setRegistryKey(taskData, args, hkPredefinedKeyTab[keyIndex]);
        }

    case 1017: // Set a value
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_REGISTRY);
            if (hnd == 0)
                raise_syscall(taskData, "Handle is closed", -ERROR_INVALID_HANDLE);
            return setRegistryKey(taskData, args, hnd->entry.hKey);
        }

    case 1018: // Enumerate a key in the predefined keys
        {
            unsigned keyIndex = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(0));
            if (keyIndex >= sizeof(hkPredefinedKeyTab)/sizeof(hkPredefinedKeyTab[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return enumerateRegistry(taskData, args, hkPredefinedKeyTab[keyIndex], TRUE);
        }

    case 1019: // Enumerate a key in an opened key
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_REGISTRY);
            if (hnd == 0)
                raise_syscall(taskData, "Handle is closed", -ERROR_INVALID_HANDLE);
            return enumerateRegistry(taskData, args, hnd->entry.hKey, TRUE);
        }

    case 1020: // Enumerate a value in the predefined keys
        {
            unsigned keyIndex = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(0));
            if (keyIndex >= sizeof(hkPredefinedKeyTab)/sizeof(hkPredefinedKeyTab[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return enumerateRegistry(taskData, args, hkPredefinedKeyTab[keyIndex], FALSE);
        }

    case 1021: // Enumerate a value in an opened key
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_REGISTRY);
            if (hnd == 0)
                raise_syscall(taskData, "Handle is closed", -ERROR_INVALID_HANDLE);
            return enumerateRegistry(taskData, args, hnd->entry.hKey, FALSE);
        }

    case 1022: // Delete a value
        {
            unsigned keyIndex = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(0));
            // This should only ever happen as a result of a fault in
            // the Windows structure.
            if (keyIndex >= sizeof(hkPredefinedKeyTab)/sizeof(hkPredefinedKeyTab[0]))
                raise_syscall(taskData, "Invalid index", 0);
            return deleteRegistryValue(taskData, args, hkPredefinedKeyTab[keyIndex]);
        }

    case 1023: // Delete a value
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_REGISTRY);
            if (hnd == 0)
                raise_syscall(taskData, "Handle is closed", -ERROR_INVALID_HANDLE);
            return deleteRegistryValue(taskData, args, hnd->entry.hKey);
        }


    case 1030: // Convert UTC time values to local time. -- No longer used??
        {
            FILETIME ftUTC, ftLocal;
            /* Get the file time. */
            getFileTimeFromArb(taskData, args, &ftUTC);
            if (! FileTimeToLocalFileTime(&ftUTC, &ftLocal))
                raise_syscall(taskData, "FileTimeToLocalFileTime failed",
                        -(int)GetLastError());
            return Make_arb_from_Filetime(taskData, ftLocal);
        }

    case 1031: // Convert local time values to UTC. -- No longer used??
        {
            FILETIME ftUTC, ftLocal;
            /* Get the file time. */
            getFileTimeFromArb(taskData, args, &ftLocal);
            if (! LocalFileTimeToFileTime(&ftLocal, &ftUTC))
                raise_syscall(taskData, "LocalFileTimeToFileTime failed",
                        -(int)GetLastError());
            return Make_arb_from_Filetime(taskData, ftUTC);
        }

    case 1032: // Get volume information.
        {
            TCHAR rootName[MAX_PATH], volName[MAX_PATH], sysName[MAX_PATH];
            DWORD dwVolSerial, dwMaxComponentLen, dwFlags;
            Handle volHandle, sysHandle, serialHandle, maxCompHandle;
            Handle resultHandle;
            POLYUNSIGNED length = Poly_string_to_C(DEREFWORD(args), rootName, MAX_PATH);
            if (length > MAX_PATH)
                raise_syscall(taskData, "Root name too long", ENAMETOOLONG);
            
            if (!GetVolumeInformation(rootName, volName, MAX_PATH,
                    &dwVolSerial, &dwMaxComponentLen, &dwFlags,
                    sysName, MAX_PATH))
                raise_syscall(taskData, "GetVolumeInformation failed",
                    -(int)GetLastError());
            volHandle = SAVE(C_string_to_Poly(taskData, volName));
            sysHandle = SAVE(C_string_to_Poly(taskData, sysName));
            serialHandle = Make_arbitrary_precision(taskData, dwVolSerial);
            maxCompHandle = Make_arbitrary_precision(taskData, dwMaxComponentLen);
            resultHandle = alloc_and_save(taskData, 4);
            DEREFHANDLE(resultHandle)->Set(0, DEREFWORDHANDLE(volHandle));
            DEREFHANDLE(resultHandle)->Set(1, DEREFWORDHANDLE(sysHandle));
            DEREFHANDLE(resultHandle)->Set(2, DEREFWORDHANDLE(serialHandle));
            DEREFHANDLE(resultHandle)->Set(3, DEREFWORDHANDLE(maxCompHandle));
            return resultHandle;
        }

    case 1033:
        {
            TCHAR fileName[MAX_PATH], execName[MAX_PATH];
            POLYUNSIGNED length = Poly_string_to_C(DEREFWORD(args), fileName, MAX_PATH);
            HINSTANCE hInst;
            if (length > MAX_PATH)
                raise_syscall(taskData, "File name too long", ENAMETOOLONG);
            hInst = FindExecutable(fileName, NULL, execName);
            if ((POLYUNSIGNED)hInst <= 32)
            {
               raise_syscall(taskData, "FindExecutable failed", -(int)(POLYUNSIGNED)hInst);
            }
            return SAVE(C_string_to_Poly(taskData, execName));
        }

    case 1034: // Open a document
        {
            SHELLEXECUTEINFO shellEx;
            memset(&shellEx, 0, sizeof(shellEx));
            shellEx.cbSize = sizeof(shellEx);
            shellEx.lpVerb = _T("open");
            shellEx.lpFile = Poly_string_to_T_alloc(DEREFWORD(args));
            shellEx.hwnd = hMainWindow;
            shellEx.nShow = SW_SHOWNORMAL;
            BOOL fRes = ShellExecuteEx(&shellEx);
            free((void*)shellEx.lpFile);
            if (! fRes)
                raise_syscall(taskData, "ShellExecuteEx failed", 0-GetLastError());
            return Make_arbitrary_precision(taskData, 0);
        }

    case 1035: // Launch an application.
        {
            SHELLEXECUTEINFO shellEx;
            memset(&shellEx, 0, sizeof(shellEx));
            shellEx.cbSize = sizeof(shellEx);
            shellEx.lpVerb = _T("open");
            shellEx.lpFile = Poly_string_to_T_alloc(args->WordP()->Get(0));
            shellEx.lpParameters = Poly_string_to_T_alloc(args->WordP()->Get(1));
            shellEx.nShow = SW_SHOWNORMAL;
            BOOL fRes = ShellExecuteEx(&shellEx);
            free((void*)shellEx.lpFile);
            free((void*)shellEx.lpParameters);
            if (! fRes)
                raise_syscall(taskData, "ShellExecuteEx failed", 0-GetLastError());
            return Make_arbitrary_precision(taskData, 0);
        }

    case 1036: // Does the process have its own console?
        return Make_arbitrary_precision(taskData, hMainWindow != NULL ? 1: 0);

    case 1037: // Simple execute.
        return simpleExecute(taskData, args);


        // DDE
    case 1038: // Start DDE dialogue.
        {
            Handle handToken;
            PHANDLETAB pTab;
            HCONV hcDDEConv;
            TCHAR *serviceName = Poly_string_to_T_alloc(args->WordP()->Get(0));
            TCHAR *topicName = Poly_string_to_T_alloc(args->WordP()->Get(1));
            /* Send a request to the main thread to do the work. */
            hcDDEConv = StartDDEConversation(serviceName, topicName);
            free(serviceName); free(topicName);
            if (hcDDEConv == 0) raise_syscall(taskData, "DdeConnect failed", 0);
            // Create an entry to return the conversation.
            handToken = make_handle_entry(taskData);
            pTab = &handleTable[STREAMID(handToken)];
            pTab->entryType = HE_DDECONVERSATION;
            pTab->entry.hcDDEConv = hcDDEConv;
            return handToken;
        }

    case 1039: // Send DDE execute request.
        {
            PHANDLETAB hnd =
                get_handle(DEREFHANDLE(args)->Get(0), HE_DDECONVERSATION);
            LRESULT res;
            char *command;
            if (hnd == NULL)
            {
                raise_syscall(taskData, "DDE Conversation is closed", 0);
            }
            command = Poly_string_to_C_alloc(args->WordP()->Get(1));
            /* Send a request to the main thread to do the work. */
            res = ExecuteDDE(command, hnd->entry.hcDDEConv);
            free(command);
            if (res == -1) raise_syscall(taskData, "DdeClientTransaction failed", 0);
            else return Make_arbitrary_precision(taskData, res);
        }

    case 1040: // Close a DDE conversation.
        {
            PHANDLETAB hnd = get_handle(args->Word(), HE_DDECONVERSATION);
            if (hnd != 0) close_handle(hnd);
            return Make_arbitrary_precision(taskData, 0);
        }


        // Configuration functions.
    case 1050: // Get version data
        {
            OSVERSIONINFO osver;
            ZeroMemory(&osver, sizeof(OSVERSIONINFO));
            osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
            // GetVersionEx is deprecated in Windows 8.1
            if (! GetVersionEx(&osver))
                raise_syscall(taskData, "GetVersionEx failed", -(int)GetLastError());
            Handle major = Make_arbitrary_precision(taskData, osver.dwMajorVersion);
            Handle minor = Make_arbitrary_precision(taskData, osver.dwMinorVersion);
            Handle build = Make_arbitrary_precision(taskData, osver.dwBuildNumber);
            Handle platform = Make_arbitrary_precision(taskData, osver.dwPlatformId);
            Handle version = SAVE(C_string_to_Poly(taskData, osver.szCSDVersion));
            Handle resVal = alloc_and_save(taskData, 5);
            DEREFHANDLE(resVal)->Set(0, DEREFWORDHANDLE(major));
            DEREFHANDLE(resVal)->Set(1, DEREFWORDHANDLE(minor));
            DEREFHANDLE(resVal)->Set(2, DEREFWORDHANDLE(build));
            DEREFHANDLE(resVal)->Set(3, DEREFWORDHANDLE(platform));
            DEREFHANDLE(resVal)->Set(4, DEREFWORDHANDLE(version));
            return resVal;
        }

    case 1051: // Get windows directory
        {
            TCHAR path[MAX_PATH+1];
            if (GetWindowsDirectory(path, sizeof(path)/sizeof(TCHAR)) == 0)
                raise_syscall(taskData, "GetWindowsDirectory failed", -(int)GetLastError());
            return SAVE(C_string_to_Poly(taskData, path));
        }

    case 1052: // Get system directory
        {
            TCHAR path[MAX_PATH+1];
            if (GetSystemDirectory(path, sizeof(path)/sizeof(TCHAR)) == 0)
                raise_syscall(taskData, "GetSystemDirectory failed", -(int)GetLastError());
            return SAVE(C_string_to_Poly(taskData, path));
        }

    case 1053: // Get computer name
        {
            TCHAR name[MAX_COMPUTERNAME_LENGTH +1];
            DWORD dwSize = MAX_COMPUTERNAME_LENGTH +1;
            if (GetComputerName(name, &dwSize) == 0)
                raise_syscall(taskData, "GetComputerName failed", -(int)GetLastError());
            return SAVE(C_string_to_Poly(taskData, name));
        }

    case 1054: // Get user name
        {
            TCHAR name[UNLEN +1];
            DWORD dwSize = UNLEN +1;
            if (GetUserName(name, &dwSize) == 0)
                raise_syscall(taskData, "GetUserName failed", -(int)GetLastError());
            return SAVE(C_string_to_Poly(taskData, name));
        }

    case 1100: // Get the error result from the last call.
               // This is saved when we make a call to a foreign function.
        {
            return(SAVE(TAGGED(taskData->lastError)));
        }

    case 1101: // Wait for a message.
        {
            HWND hwnd = *(HWND*)(DEREFWORDHANDLE(args)->Get(0).AsCodePtr());
            UINT wMsgFilterMin = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(1));
            UINT wMsgFilterMax = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(2));
            while (1)
            {
                MSG msg;
                processes->ThreadReleaseMLMemory(taskData);
                // N.B.  PeekMessage may directly call the window proc resulting in a
                // callback to ML.  For this to work a callback must not overwrite "args".
                BOOL result = PeekMessage(&msg, hwnd, wMsgFilterMin, wMsgFilterMax, PM_NOREMOVE);
                processes->ThreadUseMLMemory(taskData);
                if (result) return Make_arbitrary_precision(taskData, 0);
                // Pause until a message arrives.
                processes->ThreadPause(taskData);
            }
        }

    // case 1102: // Return the address of the window callback function.

    case 1103: // Return the application instance.
        {
            Handle result = alloc_and_save(taskData, 1, F_BYTE_OBJ);
            *(HINSTANCE*)(result->Word().AsCodePtr()) = hApplicationInstance;
            return result;
        }

    case 1104: // Return the main window handle
        {
            Handle result = alloc_and_save(taskData, 1, F_BYTE_OBJ);
            *(HWND*)(result->Word().AsCodePtr()) = hMainWindow;
            return result;
        }

//    case 1105: // Set the callback function

    default:
        {
            char msg[100];
            sprintf(msg, "Unknown windows-specific function: %d", c);
            raise_exception_string(taskData, EXC_Fail, msg);
            return 0;
        }
    }
}
Esempio n. 7
0
/******************************************************************************
* FUNCTION: Intialize()                                                       *
*                                                                             *
* PURPOSE:  To register this program with the DDEML (management lib)          *
*                                                                             *
* RETURNS:  DDE_OK if successful                                              *
*           DDE_ERR_MAKEPROCINST if error calling MakeProcInstance            *
*           DDE_ERR_INITIALIZE if error calling DdeInitialize                 *
*                                                                             *
******************************************************************************/
URLProcessorRetCode CURLProcessor::Initialize()
{
   HINSTANCE               hInst;
   char                    szBrowserEXE[_MAX_PATH];
   CString                 csPublishPath;
   CString                 csBrowserTitlebarName, csBrowserDDEName;

   Util::SplitPath(m_csURL, &csPublishPath, NULL);
   hInst = FindExecutable(m_csURL, csPublishPath, szBrowserEXE);
   if(hInst <= (HINSTANCE) 32)
      return enURLErrorNoDefaultBrowser;

   m_csBrowserPathAndName = szBrowserEXE;

   m_csBrowserPathAndName.MakeUpper();

   if(m_csBrowserPathAndName.Find("NETSCAPE.EXE") >= 0)
      {
         csBrowserTitlebarName = csBrowserDDEName = "NETSCAPE";
      }
   else if(m_csBrowserPathAndName.Find("IEXPLORE.EXE") >= 0)
      {
		   csBrowserDDEName = "IEXPLORE";
		   csBrowserTitlebarName = "INTERNET EXPLORER";
      }
   else if(m_csBrowserPathAndName.Find("AIRMOS.EXE") >= 0)
      {
		   csBrowserDDEName = "MOSAIC";
		   csBrowserTitlebarName = "MOSAIC";
      }
   else
      return enURLErrorNotConfigured;

   m_csBrowserTitlebarName = csBrowserTitlebarName;

   if(m_csBrowserTitlebarName.GetLength() == 0)
      return enURLErrorNotConfigured;
   m_csBrowserTitlebarName.MakeUpper();

   //to seperate out the path from the name, use this:
   int pos = m_csBrowserPathAndName.ReverseFind('\\');
   m_csBrowserPath = m_csBrowserPathAndName.Left(pos);
   m_csBrowserName = m_csBrowserPathAndName.Right(m_csBrowserPathAndName.GetLength()-pos-1); 

   m_csBrowserDDEID = csBrowserDDEName;

   if(m_csBrowserDDEID.GetLength() == 0)
      return enURLErrorNotConfigured;

   m_csWebSearchSpacer = "+";

   if(!(m_lpDdeProc = MakeProcInstance((FARPROC)DdeCallBack, AfxGetApp()->m_hInstance)))
      {
         ASSERT(0);
         return enURLErrorInit;
      }
   if(DdeInitialize((LPDWORD) &m_idInst, (PFNCALLBACK) m_lpDdeProc,APPCMD_CLIENTONLY, 0L) != DMLERR_NO_ERROR)
      {
         ASSERT(0);
         return enURLErrorInit;
      }

   m_bInitialized = TRUE;

   return enURLErrorNone;
} 
Esempio n. 8
0
int open_google_earth()
{
    char *kml_filename = appendExt(curr->filename, ".kml");

    char *basename = get_basename(curr->filename);
    char *dirname = get_dirname(curr->filename);

    char *arg;
    if (strlen(dirname)==0) {
        char *tmpdir = g_get_current_dir();
        dirname = escapify(tmpdir);
        arg = MALLOC(sizeof(char)*(strlen(dirname)+strlen(kml_filename)+20));
        sprintf(arg, "%s/%s", dirname, kml_filename);
        //free(tmpdir);
    }
    else {
        arg = STRDUP(kml_filename);
    }

    char *png_file = appendExt(arg, ".png");

    printf("png file: %s\n", png_file);
    printf("Temporary kml file: %s\n", arg);

    FILE *kml_file = fopen(arg, "w");
    if (!kml_file)
    {
        asfPrintWarning("Couldn't open kml file!\n");        
        return FALSE;
    }

    kml_header(kml_file);

    meta_parameters *meta = curr->meta;
    if (meta && meta->general &&
        meta_is_valid_double(meta->general->center_latitude) &&
        meta_is_valid_double(meta->general->center_longitude))
    {
        pixbuf2png(pixbuf_small, png_file);
        kml_entry_with_overlay(kml_file, meta, basename, png_file, dirname);
    }
    else
    {
        asfPrintWarning(
            "Failed, metadata doesn't contain valid lat/lon info.\n");
        return FALSE;
    }

    kml_footer(kml_file);
    fclose(kml_file);

    gchar *ge;

    printf("kml: %s\n", kml_filename);
    printf("dir: %s\n", dirname);

#ifdef win32
    char path[1024];
    FindExecutable((LPCTSTR)kml_filename, (LPCTSTR)dirname, (LPTSTR)path);
    ge = escapify(path);
    printf("Path to google earth: %s\n", ge);
    
    asfSystem("\"%s\" \"%s\"", ge, arg);
#else
    ge = find_in_path("googleearth");
    if (!ge)
    {
       message_box("Couldn't find googleearth! Is it installed?");
       return FALSE;
    }

    int pid = fork();
    if (pid == 0) {
        asfSystem("\"%s\" \"%s\"", ge, arg);
        //unlink(kml_filename);
        exit(EXIT_SUCCESS);
    }
#endif

    free(kml_filename);
    free(basename);
    free(dirname);
    free(arg);

    return TRUE;
}
Esempio n. 9
0
BOOL CALLBACK DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
   switch (uMsg) {
//		case WM_INITDIALOG:
//         break;
   case WM_COMMAND:
      switch (LOWORD(wParam)) {

      case IDC_COMBO_COMMAND:
      {
        if (HIWORD(wParam) == CBN_SELCHANGE)
        {
          int i = SendDlgItemMessage(hWnd, IDC_COMBO_COMMAND, CB_GETCURSEL, 0, 0);
          if (i != CB_ERR && i >= 0 && i < giCmdData && gpCmdData[i]->bHasArgs)
          {
            ShowWindow(GetDlgItem(hWnd, IDC_STATIC_ARGS_DESCRIPTION), SW_SHOW);
            ShowWindow(GetDlgItem(hWnd, IDC_STATIC_ARGS), SW_SHOW);
            ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARGS), SW_SHOW);
            SetDlgItemText(hWnd, IDC_STATIC_ARGS_DESCRIPTION, gpCmdData[i]->szArgsDesc);
          }
          else
          {
            ShowWindow(GetDlgItem(hWnd, IDC_STATIC_ARGS_DESCRIPTION), SW_HIDE);
            ShowWindow(GetDlgItem(hWnd, IDC_STATIC_ARGS), SW_HIDE);
            ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARGS), SW_HIDE);
          }

        }
        break;
      }

      case IDC_CMD_EDIT:
      {
        char szFileName[MAX_PATH+1];
        GetDlgItemText(hWnd, IDC_EDIT_FILE, szFileName, MAX_PATH);

        char *szFile = findfile(szFileName);
        if (!szFile)
        {
          szFile = new char[MAX_PATH+1];
          wsprintf(szFile, "%s%s", gszUserScripts, szFileName);
        }


        char szViewer[MAX_PATH+1];

        char temp[MAX_PATH];
        GetTempPath(MAX_PATH, temp);
        lstrcat(temp, "sitemp.txt");
        HANDLE hFile = CreateFile(temp, 0, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
        DWORD err = GetLastError();
        if (hFile != INVALID_HANDLE_VALUE) {
           FindExecutable(temp, NULL, szViewer);
           CloseHandle(hFile);
           if (err != ERROR_ALREADY_EXISTS)
              DeleteFile(temp);
        }

        if (!*szViewer)
        {
          lstrcpy(szViewer, "notepad.exe");
        }
        
        SHELLEXECUTEINFO se = { 0 };

        se.cbSize = sizeof(SHELLEXECUTEINFO);
        se.fMask = SEE_MASK_DOENVSUBST | SEE_MASK_NOCLOSEPROCESS;
        se.lpVerb = "Open";
        se.lpFile = szViewer;
        se.lpParameters = szFile;
        se.lpDirectory = NULL;
        se.nShow = SW_SHOWNORMAL;

        ShellExecuteEx(&se);
        

        break;
      }

      case IDC_CMD_BROWSE:
         char *buf = new char[MAX_PATH+1];
         *buf = 0;
         
         OPENFILENAME ofn = {0};
         ofn.lStructSize = sizeof(OPENFILENAME);
         ofn.hInstance = ghInstance;
         ofn.hwndOwner = hWnd;
         
         // "Lua Files\0*.lua\0All Files\0*.*\0";
         char *filter = new char[256];
         char *end = filter;

         lstrcpy(end, STR(LUA_FILES));
         end += lstrlen(end) + 1;
         lstrcpy(end, "*.lua");
         end += lstrlen(end) + 1;

         lstrcpy(end, STR(ALL_FILES));
         end += lstrlen(end) + 1;
         lstrcpy(end, "*.*");
         end += lstrlen(end) + 1;

         *end = 0;

         char szFile[MAX_PATH+1];
         GetDlgItemText(hWnd, IDC_EDIT_FILE, szFile, MAX_PATH);

         ofn.lpstrFile = szFile;
         ofn.lpstrInitialDir = (char *)gszUserScripts;
         ofn.lpstrFilter = filter;
         ofn.lpstrFile = buf;
         ofn.nMaxFile = MAX_PATH;
         ofn.Flags = OFN_PATHMUSTEXIST | 	OFN_LONGNAMES | OFN_EXPLORER;
         
         if (GetOpenFileName(&ofn))
         {
           if ( StrStartsWith(buf, (char *)gszUserScripts) )
           {
             SetDlgItemText(hWnd, IDC_EDIT_FILE, buf + lstrlen((char *)gszUserScripts));
           }
           else if ( StrStartsWith(buf, (char *)gszGlobalScripts) )
           {
             SetDlgItemText(hWnd, IDC_EDIT_FILE, buf + lstrlen((char *)gszGlobalScripts));
           }
           else
           {
             SetDlgItemText(hWnd, IDC_EDIT_FILE, buf);
           }

            // clear the dropdown
            SendDlgItemMessage(hWnd, IDC_COMBO_COMMAND, CB_RESETCONTENT, 0, 0);

            DeleteScriptDetails((s_commandData **) &gpCmdData, giCmdData);
            giCmdData = GetScriptDetails(buf, (s_commandData **) &gpCmdData);


            if (giCmdData > 0)
            {
              // populate the dropdown
              for (int i = 0; i<giCmdData; i++)
                 AddCombo(hWnd, IDC_COMBO_COMMAND, gpCmdData[i]->szCmdName, gpCmdData[i]->szCmdName);

              SendDlgItemMessage(hWnd, IDC_COMBO_COMMAND, CB_SETCURSEL, 0, 0);

              ShowWindow(GetDlgItem(hWnd, IDC_STATIC_COMMAND), SW_SHOW);
              ShowWindow(GetDlgItem(hWnd, IDC_COMBO_COMMAND), SW_SHOW);
            }
            else
            {
              ShowWindow(GetDlgItem(hWnd, IDC_STATIC_COMMAND), SW_HIDE);
              ShowWindow(GetDlgItem(hWnd, IDC_COMBO_COMMAND), SW_HIDE);
            }

            // show/hide the args depending on the selection
            SendMessage(hWnd, WM_COMMAND, MAKELONG(IDC_COMBO_COMMAND, CBN_SELCHANGE), (LPARAM) GetDlgItem(hWnd, IDC_COMBO_COMMAND));

         }

         delete filter;
         delete buf;

      }
      break;
   case WM_CLOSE:
			DestroyWindow(hWnd);
			break;
		default:
			return FALSE;
   }
   return TRUE;
}
Esempio n. 10
0
BOOL CDOSProcess::executeTool(CProcessStatus& status)
{
	CString sCl = getCommandLine(status);

	/* FIND OUT WHERE THE EXECUTABLE IS */

	 CString sActualPath;
	 HINSTANCE hInstance = FindExecutable(getToolPath(), NULL, sActualPath.GetBuffer(MAX_PATH));
	 sActualPath.ReleaseBuffer();

	if((DWORD)hInstance == ERROR_FILE_NOT_FOUND)
	{
		CString s;
		s.Format("The executable %s could not be found.  Make sure it is part of the PATH statement in your AUTOEXEC.BAT file\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance == ERROR_PATH_NOT_FOUND)
	{
		CString s;
		s.Format("Windows gave a PATH NOT FOUND error while trying to  execute %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance == SE_ERR_ACCESSDENIED)
	{
		CString s;
		s.Format("Windows gave an ACCESS DENIED error while trying to  execute %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance <=32)
	{
		CString s;
		s.Format("Unknown problem trying to execute(find?) %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}


	CString sBatchPath = status.makeTempPath(getBatchName(status), ".bat");

	ofstream fout(sBatchPath);
	if(!fout.is_open())
	{
		MessageBox( NULL, "executeTool()", "Couldn't open batch file for writing", MB_ICONEXCLAMATION | MB_OK);
		return FALSE;
	}
	//TRACE("%s Command Line Length=%d\n", getToolPath(), strlen(sCl));
	fout << "REM created by CARLAStudio during a parse operation\n";
	fout << "\"" << sActualPath << "\" " << sCl << "\n";
	fout.close();

	CString s;
#ifdef Before1_04
	if(status.getVerbosity())
		s = sBatchPath;
	else
		s.Format("C:\\WINDOWS\\COMMAND.COM  /c \"%s\"", sBatchPath);
#else  // hab and drz 1.04 to make work with NT
	TCHAR lpszCommand[MAX_PATH];
	if (RunningNT())
	{
		GetSystemDirectory(lpszCommand, MAX_PATH);
		lstrcat(lpszCommand, "\\cmd.exe");
	}
	else
	{
		GetWindowsDirectory(lpszCommand, MAX_PATH);
		lstrcat(lpszCommand, "\\command.com");
	}
	s.Format("%s %s \"%s\"", lpszCommand,
						 (status.getVerbosity()& 0x01)  ? "/k" : "/c", //jdh 11/10/99
						 sBatchPath);
#endif // Before1_04

	return WinExecWait(s, TRUE); //status.getVerbosity());// false makes winoldapps

/*	 hInstance = ShellExecute(
		AfxGetMainWnd( )->m_hWnd,	// handle to parent window
		"open",	// pointer to string that specifies operation to perform
		sBatchPath,	// pointer to filename or folder name string
		NULL,	// pointer to string that specifies executable-file parameters
		// To Do: this is just a guess at the best place to put them
		//status.sRAWPath.getDirectory(),	// pointer to string that specifies default directory
		status.getTempDirectory(),
		status.getVerbosity()?SW_SHOW:SW_HIDE	// whether file is shown when opened
	   );

	return TRUE;
*/
}