Ejemplo n.º 1
0
PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
{
  nsCString temp;
  file->GetNativeLeafName(temp);
  /*
   * Don't load the VDP fake plugin, to avoid tripping a bad bug in OS X
   * 10.5.3 (see bug 436575).
   */
  if (!strcmp(temp.get(), "VerifiedDownloadPlugin.plugin")) {
    NS_WARNING("Preventing load of VerifiedDownloadPlugin.plugin (see bug 436575)");
    return PR_FALSE;
  }
  // If we're running on OS X Lion (10.7) or later, don't load the Java Embedding
  // Plugin (any version).  If/when Steven Michaud releases a version of the JEP that
  // works on Lion, we'll need to revise this code.  See bug 670655.
  if (OnLionOrLater() && !strcmp(temp.get(), "MRJPlugin.plugin")) {
    NS_WARNING("Preventing load of Java Embedding Plugin (MRJPlugin.plugin) on OS X Lion (see bug 670655)");
    return PR_FALSE;
  }

  CFURLRef pluginURL = NULL;
  if (NS_FAILED(toCFURLRef(file, pluginURL)))
    return PR_FALSE;
  
  PRBool isPluginFile = PR_FALSE;
  
  CFBundleRef pluginBundle = CFBundleCreate(kCFAllocatorDefault, pluginURL);
  if (pluginBundle) {
    UInt32 packageType, packageCreator;
    CFBundleGetPackageInfo(pluginBundle, &packageType, &packageCreator);
    if (packageType == 'BRPL' || packageType == 'IEPL' || packageType == 'NSPL') {
      CFURLRef executableURL = CFBundleCopyExecutableURL(pluginBundle);
      if (executableURL) {
        isPluginFile = IsLoadablePlugin(executableURL);
        ::CFRelease(executableURL);
      }
    }
    ::CFRelease(pluginBundle);
  }
  else {
    LSItemInfoRecord info;
    if (LSCopyItemInfoForURL(pluginURL, kLSRequestTypeCreator, &info) == noErr) {
      if ((info.filetype == 'shlb' && info.creator == 'MOSS') ||
          info.filetype == 'NSPL' ||
          info.filetype == 'BRPL' ||
          info.filetype == 'IEPL') {
        isPluginFile = IsLoadablePlugin(pluginURL);
      }
    }
  }
  
  ::CFRelease(pluginURL);
  return isPluginFile;
}
Ejemplo n.º 2
0
PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
{
  CFURLRef pluginURL = NULL;
  if (NS_FAILED(toCFURLRef(file, pluginURL)))
    return PR_FALSE;
  
  PRBool isPluginFile = PR_FALSE;
  
  CFBundleRef pluginBundle = CFBundleCreate(kCFAllocatorDefault, pluginURL);
  if (pluginBundle) {
    UInt32 packageType, packageCreator;
    CFBundleGetPackageInfo(pluginBundle, &packageType, &packageCreator);
    if (packageType == 'BRPL' || packageType == 'IEPL' || packageType == 'NSPL') {
      CFURLRef executableURL = CFBundleCopyExecutableURL(pluginBundle);
      if (executableURL) {
        isPluginFile = IsLoadablePlugin(executableURL);
        CFRelease(executableURL);
      }
    }
  
    // some safari plugins that we can't use don't have resource forks 
    short refNum;
    if (isPluginFile) {
      refNum = OpenPluginResourceFork(file);
      if (refNum < 0) {
        isPluginFile = PR_FALSE;
      } else {
        ::CloseResFile(refNum); 
      }
    }
  
    CFRelease(pluginBundle);
  }
  else {
    LSItemInfoRecord info;
    if (LSCopyItemInfoForURL(pluginURL, kLSRequestTypeCreator, &info) == noErr) {
      if ((info.filetype == 'shlb' && info.creator == 'MOSS') ||
          info.filetype == 'NSPL' ||
          info.filetype == 'BRPL' ||
          info.filetype == 'IEPL') {
        isPluginFile = IsLoadablePlugin(pluginURL);
      }
    }
  }
  
  CFRelease(pluginURL);
  return isPluginFile;
}
Ejemplo n.º 3
0
bool wd_apple_is_invisible(char *path) {
	CFStringRef			string;
	CFURLRef			url;
	LSItemInfoRecord	itemInfoRecord;
	
	/* create CFURL from path */
	string	= CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8);
	url		= CFURLCreateWithFileSystemPath(NULL, string, kCFURLPOSIXPathStyle, false);
	
	/* get LS info */
	LSCopyItemInfoForURL(url, kLSRequestBasicFlagsOnly, &itemInfoRecord);
	
	CFRelease(string);
	CFRelease(url);

	return itemInfoRecord.flags & kLSItemInfoIsInvisible;
}
Ejemplo n.º 4
0
static PyObject *Launch_LSCopyItemInfoForURL(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSStatus _err;
    CFURLRef inURL;
    LSRequestedInfo inWhichInfo;
    LSItemInfoRecord outItemInfo;
    if (!PyArg_ParseTuple(_args, "O&l",
                          CFURLRefObj_Convert, &inURL,
                          &inWhichInfo))
        return NULL;
    _err = LSCopyItemInfoForURL(inURL,
                                inWhichInfo,
                                &outItemInfo);
    if (_err != noErr) return PyMac_Error(_err);
    _res = Py_BuildValue("O&",
                         LSItemInfoRecord_New, &outItemInfo);
    return _res;
}