示例#1
0
void
delete_partition_from_map(partition_map *entry)
{
    partition_map_header *map;
    DPME *data;

    if (istrncmp(entry->data->dpme_type, kMapType, DPISTRLEN) == 0) {
	printf("Can't delete entry for the map itself\n");
	return;
    }
    if (entry->contains_driver) {
	printf("This program can't install drivers\n");
	if (get_okay("are you sure you want to delete this driver? [n/y]: ", 0) != 1) {
	    return;
	}
    }
    // if past end of disk, delete it completely
    if (entry->next_by_base == NULL &&
	entry->data->dpme_pblock_start >= entry->the_map->media_size) {
      if (entry->contains_driver) {
	remove_driver(entry);	// update block0 if necessary
      }
      delete_entry(entry);
      return;
    }
    // If at end of disk, incorporate extra disk space to partition
    if (entry->next_by_base == NULL) {
      entry->data->dpme_pblocks =
	 entry->the_map->media_size - entry->data->dpme_pblock_start;
    }
    data = create_data(kFreeName, kFreeType,
	    entry->data->dpme_pblock_start, entry->data->dpme_pblocks);
    if (data == NULL) {
	return;
    }
    if (entry->contains_driver) {
    	remove_driver(entry);	// update block0 if necessary
    }
    free(entry->data);
    free(entry->HFS_name);
    entry->HFS_kind = kHFS_not;
    entry->HFS_name = 0;
    entry->data = data;
    combine_entry(entry);
    map = entry->the_map;
    renumber_disk_addresses(map);
    map->changed = 1;
}
示例#2
0
void
delete_partition_from_map(partition_map *entry)
{
    partition_map_header *map;
    DPME *data;

    if (strncmp(entry->data->dpme_type, kMapType, DPISTRLEN) == 0) {
	fprintf(stderr, "Can't delete entry for the map itself\n");
	return;
    }
    if (entry->contains_driver) {
	printf("This program can't install drivers\n");
	if (get_okay("are you sure you want to delete this driver? [n/y]: ", 0) != 1) {
	    return;
	}
    }
    data = create_data(kFreeName, kFreeType,
	    entry->data->dpme_pblock_start, entry->data->dpme_pblocks);
    if (data == NULL) {
	return;
    }
    if (entry->contains_driver) {
    	remove_driver(entry);	// update block0 if necessary
    }
    free(entry->data);
    entry->data = data;
    combine_entry(entry);
    map = entry->the_map;
    renumber_disk_addresses(map);
    map->changed = 1;
}
示例#3
0
/**
 * connman_device_driver_unregister:
 * @driver: device driver definition
 *
 * Remove a previously registered device driver
 */
void connman_device_driver_unregister(struct connman_device_driver *driver)
{
	DBG("driver %p name %s", driver, driver->name);

	driver_list = g_slist_remove(driver_list, driver);

	remove_driver(driver);
}
示例#4
0
//lancement de l'analyse ring 0
void analysis::ring0analysis()
{
	manager=NULL;
	service=NULL;
	int error=0;
	int status = 0;

	status= driverStatus();
	
	if(status==0)
	{
		printf(" [-] Impossible to query the driver status.\n");
		return;
	}

	//si pas déjà installé, installation
	if(status == DRIVER_NOT_INSTALLED)
	{
		//installation
		if(!install_driver())
		{
			printf(" [-] Impossible to install the driver.\n");
			error=2;
		}
	}

	//si pas démarré, démarrage
	if((status == DRIVER_STOPPED || status == DRIVER_NOT_INSTALLED) && !error)
	{
		if(!start_service())
		{
			printf(" [-] Impossible to start the service.\n");
			error=1;
		}
	}
	
	//si pas d'erreurs (et service lancé, donc), analyse
	if(!error)
	{
		ssdt();
		//stop, puisque lancé
		if(!stop_service())
			printf(" [-] Impossible to stop the service.\n");
	}
	
	if(error<1)
	{
		//si installé, désinstallation
		if(!remove_driver())
			printf(" [-] Impossible to delete the driver.\n");
	}

	sCCleanHandles();
}
示例#5
0
void CdenableSysStopRemove(void)
{
	stop_driver();
	remove_driver();
}