Example #1
0
int test_field_eval( DTK_UserApplicationHandle dtk_handle, UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_FIELD_SIZE_FUNCTION, field_size, &u );
    DTK_set_function( dtk_handle, DTK_EVALUATE_FIELD_FUNCTION, evaluate_field,
                      &u );

    return check_registry( "test_field_eval", dtk_handle );
}
Example #2
0
int test_missing_function( DTK_UserApplicationHandle dtk_handle,
                           UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_NODE_LIST_SIZE_FUNCTION, node_list_size,
                      &u );

    return check_registry( "test_missing_function", dtk_handle );
}
Example #3
0
int test_single_topology_dof( DTK_UserApplicationHandle dtk_handle,
                              UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_DOF_MAP_SIZE_FUNCTION, dof_map_size, &u );
    DTK_set_function( dtk_handle, DTK_DOF_MAP_DATA_FUNCTION, dof_map_data, &u );

    return check_registry( "test_single_topology_dof", dtk_handle );
}
// Check the registry for any installations of Python that we can use.
// TODO: Refactor the common checks/logic/etc from this and find_in_path
// into a static function.
static int find_in_registry()
{
	char sPythonBuf[MAX_PATH+1] = {0};
	char sCheck[MAX_PATH+1] = {0};
	long szPythonBuf = MAX_PATH + 1;
	int i = 0;
	
	// Some debugging.
	debug("Searching the registry for a python installation.");

	for(i = PYTHON2_MINOR_MIN; i <= PYTHON2_MINOR_MAX; i++) {
		if(!check_registry(2, i, sPythonBuf, &szPythonBuf)) continue;
		// RegQueryValueA includes the trailing zero in the length.
		szPythonBuf--;
		
		// Double check our result.
		if(!sPythonBuf || szPythonBuf <= 0) continue;
		
		// Set up our temporary work variable.
		strcpy(sCheck, sPythonBuf);

		// Remove trailing slashes.
		if(!remove_trailing_slashes(sCheck, (size_t*)&szPythonBuf)) {
			debug(
				"After removing all trailing slashes, path's length was less than 3. This "
				"indicates an invalid path in your registry."
			);
			debug("Original: %s", sPythonBuf);
			debug("Result: %s", sCheck);
			continue;
		}

		// Max sure our resulting string wont be too big.
		if(!(check_python_length(szPythonBuf))) {
			debug(
				"Length of path, \"%s\" (%d) added to length of \"\\" PYTHON_EXE "\" (%d) results "
				"in a length that is bigger than the maximum file path length. Skipping.",
				sPythonBuf,
				szPythonBuf,
				szPyExe
			);
			continue;
		}

		// Assemble our python path and check it.
		strcat(sCheck, "\\" PYTHON_EXE);
		if(!check_python(sCheck)) continue;

		// If we make it here, we have successfully found our python installation.
		strcpy(python_exe, sCheck);
		break;
	}

	// Some debugging.
	debug("find_in_registry resulted in \"%s\"", python_exe);

	return *python_exe != 0;
}
Example #5
0
int test_multiple_topology_cell( DTK_UserApplicationHandle dtk_handle,
                                 UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_CELL_LIST_SIZE_FUNCTION,
                      cell_list_size, &u );
    DTK_set_function( dtk_handle, DTK_CELL_LIST_DATA_FUNCTION,
                      cell_list_data, &u );

    return check_registry( "test_multiple_topology_cell", dtk_handle );
}
Example #6
0
int test_polyhedron_list( DTK_UserApplicationHandle dtk_handle,
                          UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_POLYHEDRON_LIST_SIZE_FUNCTION,
                      polyhedron_list_size, &u );
    DTK_set_function( dtk_handle, DTK_POLYHEDRON_LIST_DATA_FUNCTION,
                      polyhedron_list_data, &u );

    return check_registry( "test_polyhedron_list", dtk_handle );
}
Example #7
0
int test_bounding_volume_list( DTK_UserApplicationHandle dtk_handle,
                               UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_BOUNDING_VOLUME_LIST_SIZE_FUNCTION,
                      bounding_volume_list_size, &u );
    DTK_set_function( dtk_handle, DTK_BOUNDING_VOLUME_LIST_DATA_FUNCTION,
                      bounding_volume_list_data, &u );

    return check_registry( "test_bounding_volume_list", dtk_handle );
}
Example #8
0
int test_field_push_pull( DTK_UserApplicationHandle dtk_handle,
                          UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_FIELD_SIZE_FUNCTION, field_size, &u );
    DTK_set_function( dtk_handle, DTK_PULL_FIELD_DATA_FUNCTION, pull_field_data,
                      &u );
    DTK_set_function( dtk_handle, DTK_PUSH_FIELD_DATA_FUNCTION, push_field_data,
                      &u );

    return check_registry( "test_field_push_pull", dtk_handle );
}
Example #9
0
int test_too_many_functions( DTK_UserApplicationHandle dtk_handle,
                             UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_DOF_MAP_SIZE_FUNCTION, dof_map_size, &u );
    DTK_set_function( dtk_handle, DTK_DOF_MAP_DATA_FUNCTION, dof_map_data, &u );
    DTK_set_function( dtk_handle, DTK_MIXED_TOPOLOGY_DOF_MAP_SIZE_FUNCTION,
                      mixed_topology_dof_map_size, &u );
    DTK_set_function( dtk_handle, DTK_MIXED_TOPOLOGY_DOF_MAP_DATA_FUNCTION,
                      mixed_topology_dof_map_data, &u );

    return check_registry( "test_too_many_functions", dtk_handle );
}
Example #10
0
void start_roxen(void)
{
  STARTUPINFO info;
  PROCESS_INFORMATION proc;
  TCHAR *filename=" ntroxenloader.pike", cmd[4000];
  void *env=NULL;
  int ret,i;

  check_registry();
  if(!pike_location || !server_location)
  {
    // No location found in registry. Do something smart.
    return;
  }

  key=malloc(8);

  srand(time(0));
  for(i=0;i<8;i++)
    key[i]=65+32+((unsigned char)rand())%24;
  strcpy(cmd, pike_location);
  strcat(cmd, filename);
  strcat(cmd," +");
  strcat(cmd,key);
  
  GetStartupInfo(&info);
/*   info.wShowWindow=SW_HIDE; */
  info.dwFlags|=STARTF_USESHOWWINDOW;
  ret=CreateProcess(NULL,
					cmd,
                    NULL,  /* process security attribute */
                    NULL,  /* thread security attribute */
                    1,     /* inherithandles */
                    0,     /* create flags */
                    env,   /* environment */
                    server_location,   /* current dir */
                    &info,
                    &proc);
  if(!ret)
  {
	    FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
		       NULL,
		       GetLastError(),
		       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
		       (LPTSTR) &lpMsgBuf,
		       0,
		       NULL );
	    MessageBox( NULL, lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION );
        LocalFree( lpMsgBuf );
  }

  hProcess=proc.hProcess;
}
Example #11
0
VOID ServiceStop()
{	
	FILE *f;
	char tmp[8192];

	check_registry();
	strcpy(tmp,log_location);
	strcat(tmp,"\\");
	strcat(tmp,key);
	f=fopen(tmp,"wb");
	fprintf(f,"Kilroy was here.");
	fclose(f);
	stopping=1;
    if ( hServerStopEvent )
        SetEvent(hServerStopEvent);
}
Example #12
0
int test_boundary( DTK_UserApplicationHandle dtk_handle, UserTestClass u )
{
    DTK_set_function( dtk_handle, DTK_BOUNDARY_SIZE_FUNCTION, boundary_size,
                      &u );
    DTK_set_function( dtk_handle, DTK_BOUNDARY_DATA_FUNCTION, boundary_data,
                      &u );
    DTK_set_function( dtk_handle, DTK_CELL_LIST_SIZE_FUNCTION, cell_list_size,
                      &u );
    DTK_set_function( dtk_handle, DTK_CELL_LIST_DATA_FUNCTION, cell_list_data,
                      &u );
    DTK_set_function( dtk_handle, DTK_POLYHEDRON_LIST_SIZE_FUNCTION,
                      polyhedron_list_size, &u );
    DTK_set_function( dtk_handle, DTK_POLYHEDRON_LIST_DATA_FUNCTION,
                      polyhedron_list_data, &u );

    return check_registry( "test_boundary", dtk_handle );
}