Example #1
0
/*!
  Set the key "arg" to "value" in source device.
*/
static int
set_arg_win32 (void *p_user_data, const char key[], const char value[])
{
  _img_private_t *p_env = p_user_data;

  if (!strcmp (key, "source"))
    {
      if (!value)
	return -2;

      free (p_env->gen.source_name);
      
      p_env->gen.source_name = strdup (value);
    }
  else if (!strcmp (key, "access-mode"))
    {
      p_env->access_mode = str_to_access_mode_win32(value);
      if (p_env->access_mode == _AM_ASPI && !p_env->b_aspi_init) 
	return init_aspi(p_env) ? 1 : -3;
      else if (p_env->access_mode == _AM_IOCTL && !p_env->b_ioctl_init) 
	return init_win32ioctl(p_env) ? 1 : -3;
      else
	return -4;
      return 0;
    }
  else 
    return -1;

  return 0;
}
Example #2
0
File: win32.c Project: Gatada/atv2
/*!
  Initialize CD device.
 */
static bool
_cdio_init_win32 (void *user_data)
{
  _img_private_t *p_env = user_data;
  if (p_env->gen.init) {
    cdio_error ("init called more than once");
    return false;
  }
  
  p_env->gen.init     = true;
  p_env->gen.toc_init = false;
  p_env->gen.b_cdtext_init  = false;
  p_env->gen.b_cdtext_error = false;

  /* Initializations */
  p_env->h_device_handle = NULL;
  p_env->i_sid           = 0;
  p_env->hASPI           = 0;
  p_env->lpSendCommand   = 0;
  p_env->b_aspi_init     = false;
  p_env->b_ioctl_init    = false;

#if !(defined (WIN32) || defined (_XBOX))
  if ( _AM_IOCTL == p_env->access_mode ) {
    return init_win32ioctl(p_env);
  } else {
    return init_aspi(p_env);
  }
#else
    return init_win32ioctl(p_env);
#endif
}
Example #3
0
/*!
  Initialize CD device.
 */
static bool
init_win32 (void *p_user_data)
{
  _img_private_t *p_env = p_user_data;
  bool b_ret;
  if (p_env->gen.init) {
    cdio_error ("init called more than once");
    return false;
  }
  
  p_env->gen.init           = true;
  p_env->gen.toc_init       = false;
  p_env->gen.b_cdtext_error = false;
  p_env->gen.fd             = open (p_env->gen.source_name, O_RDONLY, 0);

  /* Initializations */
  p_env->h_device_handle = NULL;
  p_env->i_sid           = 0;
  p_env->hASPI           = 0;
  p_env->lpSendCommand   = 0;
  p_env->b_aspi_init     = false;
  p_env->b_ioctl_init    = false;


  switch (p_env->access_mode) {
  case _AM_IOCTL:
  case _AM_MMC_RDWR:
  case _AM_MMC_RDWR_EXCL:
    b_ret = init_win32ioctl(p_env);
    break;
  case _AM_ASPI:
    b_ret = init_aspi(p_env);
    break;
  default:
    return 0;
  }

  /* It looks like get_media_changed_mmc will always
     return 1 (media changed) on the first call. So 
     we call it here to clear that flag. We may have
     to rethink this if there's a problem doing this
     extra work down the line. */
  get_media_changed_mmc(p_user_data);
  return b_ret;
}