Example #1
0
*/	int OS_Browse(REBCHR *url, int reserved)
/*
***********************************************************************/
{
	#define MAX_BRW_PATH 2044
	long flag;
	long len;
	long type;
	HKEY key;
	REBCHR *path;
	HWND hWnd = GetFocus();

	if (RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("http\\shell\\open\\command"), 0, KEY_READ, &key) != ERROR_SUCCESS)
		return 0;

	if (!url) url = TEXT("");

	path = MAKE_STR(MAX_BRW_PATH+4);
	len = MAX_BRW_PATH;

	flag = RegQueryValueEx(key, TEXT(""), 0, &type, (LPBYTE)path, &len);
	RegCloseKey(key);
	if (flag != ERROR_SUCCESS) {
		FREE_MEM(path);
		return 0;
	}
	//if (ExpandEnvironmentStrings(&str[0], result, len))

	Insert_Command_Arg(path, url, MAX_BRW_PATH);

	len = OS_Create_Process(path, 0);

	FREE_MEM(path);
	return len;
}
Example #2
0
File: base.c Project: zhshr/CS502
void osInit(int argc, char *argv[]) {
	INT32 i;
	MEMORY_MAPPED_IO mmio;
	TimerQueueHead = NULL;
	char *entry;
  // Demonstrates how calling arguments are passed thru to here

    printf( "Program called with %d arguments:", argc );
    for ( i = 0; i < argc; i++ )
        printf( " %s", argv[i] );
    printf( "\n" );
    printf( "Calling with argument 'sample' executes the sample program.\n" );
    // Here we check if a second argument is present on the command line.
    // If so, run in multiprocessor mode
    if ( argc > 2 ){
    	entry = argv[2];
    	printf("Simulation is running as a MultProcessor\n\n");
		mmio.Mode = Z502SetProcessorNumber;
		mmio.Field1 = MAX_NUMBER_OF_PROCESSORS;
		mmio.Field2 = (long) 0;
		mmio.Field3 = (long) 0;
		mmio.Field4 = (long) 0;

		MEM_WRITE(Z502Processor, &mmio);   // Set the number of processors
		multicore = TRUE;
    }
    else {
    	entry = argv[1];
    	printf("Simulation is running as a UniProcessor\n");
    	printf("Add an 'M' to the command line to invoke multiprocessor operation.\n\n");
    }

	//          Setup so handlers will come to code in base.c

	TO_VECTOR[TO_VECTOR_INT_HANDLER_ADDR ] = (void *) InterruptHandler;
	TO_VECTOR[TO_VECTOR_FAULT_HANDLER_ADDR ] = (void *) FaultHandler;
	TO_VECTOR[TO_VECTOR_TRAP_HANDLER_ADDR ] = (void *) svc;

	//  Determine if the switch was set, and if so go to demo routine.

  	if ((argc > 1) && (strcmp(argv[1], "sample") == 0)) {
  		OS_Create_Process(SampleCode);
 	} // End of handler for sample code - This routine should never return here

	//  By default test0 runs if no arguments are given on the command line
	//  Creation and Switching of contexts should be done in a separate routine.
	//  This should be done by a "OsMakeProcess" routine, so that
	//  test0 runs on a process recognized by the operating system.

	mmio.Mode = Z502InitializeContext;
	mmio.Field1 = 0;

	PrintSVC = Full;
	PrintSCH = Full;
	PrintMEM = No;
	if (argv[1]!=NULL){
		if (strcmp(argv[1], "test1a")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test1a);
		}else if (strcmp(argv[1], "test1b")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test1b);
		}else if (strcmp(argv[1], "test1c")==0){
			PrintSVC = Initial;
			PrintSCH = Full;
			OS_Create_Process(test1c);
		}else if (strcmp(argv[1], "test1d")==0){
			PrintSVC = Initial;
			PrintSCH = Full;
			OS_Create_Process(test1d);
		}else if (strcmp(argv[1], "test1e")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test1e);
		}else if (strcmp(argv[1], "test1f")==0){
			PrintSVC = Initial;
			PrintSCH = No;
			OS_Create_Process(test1f);
		}else if (strcmp(argv[1], "test1g")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test1g);
		}else if (strcmp(argv[1], "test1h")==0){
			PrintSVC = Initial;
			PrintSCH = No;
			OS_Create_Process(test1h);
		}else if (strcmp(argv[1], "test1i")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test1i);
		}else if (strcmp(argv[1], "test1j")==0){
			PrintSVC = Initial;
			PrintSCH = Full;
			OS_Create_Process(test1j);
		}else if (strcmp(argv[1], "test1k")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test1k);
		}else if (strcmp(argv[1], "test2a")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test2a);
		}else if (strcmp(argv[1], "test2b")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test2b);
		}else if (strcmp(argv[1], "test2c")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test2c);
		}else if (strcmp(argv[1], "test2d")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test2d);
		}else if (strcmp(argv[1], "test2e")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test2e);
		}else if (strcmp(argv[1], "test2f")==0){
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test2f);
		}else {
			PrintSVC = Full;
			PrintSCH = No;
			OS_Create_Process(test0);
		}
	}else{
		PrintSVC = Full;
		PrintSCH = FALSE;
		OS_Create_Process(test0);
	}
	my_Dispatcher();
}                                               // End of osInit