home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Theme / 8GadgetPack / 8GadgetPackSetup.msi / Gadgets.7z / Gadgets / GPU_Meter.gadget / library.js < prev    next >
Text File  |  2011-04-05  |  3KB  |  64 lines

  1. var dllCLSID="{5b55a44a-d008-49aa-9234-86fb7709bc0a}";
  2. var Classname="GPUStatusReader.GPUMonitor";
  3. var LibPath="file:///"+System.Gadget.path.replace(new RegExp("\\\\","g"),"/")+"/GPUStatusReader.dll";
  4. var LibName="GPUStatusReader";
  5. var oShell=new ActiveXObject("WScript.Shell");
  6. var regRoot;
  7.  
  8. function RegisterLibrary(){
  9.  var classRoot = regRoot + "\\Software\\Classes\\" + Classname + "\\";
  10.  var clsidRoot = regRoot + "\\Software\\Classes\\CLSID\\" + dllCLSID + "\\";
  11.  try{
  12.   oShell.RegWrite(classRoot,Classname,"REG_SZ");
  13.   oShell.RegWrite(classRoot + "CLSID\\",dllCLSID,"REG_SZ");
  14.   oShell.RegWrite(clsidRoot,Classname,"REG_SZ");
  15.   oShell.RegWrite(clsidRoot + "InprocServer32\\","mscoree.dll","REG_SZ");
  16.   oShell.RegWrite(clsidRoot + "InprocServer32\\ThreadingModel","Both","REG_SZ");
  17.   oShell.RegWrite(clsidRoot + "InprocServer32\\Class",Classname,"REG_SZ");
  18.   oShell.RegWrite(clsidRoot + "InprocServer32\\Assembly",LibName+", Version=1.0.2588.9125, Culture=neutral, PublicKeyToken=null","REG_SZ");
  19.   oShell.RegWrite(clsidRoot + "InprocServer32\\RuntimeVersion","v2.0.50727","REG_SZ");
  20.   oShell.RegWrite(clsidRoot + "InprocServer32\\CodeBase",LibPath,"REG_SZ");
  21.   oShell.RegWrite(clsidRoot + "InprocServer32\\1.0.2588.9125\\Class",Classname,"REG_SZ");
  22.   oShell.RegWrite(clsidRoot + "InprocServer32\\1.0.2588.9125\\Assembly",LibName+", Version=1.0.2588.9125, Culture=neutral, PublicKeyToken=null","REG_SZ");
  23.   oShell.RegWrite(clsidRoot + "InprocServer32\\1.0.2588.9125\\RuntimeVersion","v2.0.50727","REG_SZ");
  24.   oShell.RegWrite(clsidRoot + "InprocServer32\\1.0.2588.9125\\CodeBase",LibPath,"REG_SZ");
  25.   oShell.RegWrite(clsidRoot + "ProgId\\",Classname,"REG_SZ");
  26.   oShell.RegWrite(clsidRoot + "ProgId\\Implemented Categories\\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}\\","","REG_SZ");
  27.  }
  28.  catch(err){}
  29. }
  30.  
  31. function UnregisterLibrary(){
  32.  var classRoot = regRoot + "\\Software\\Classes\\" + Classname + "\\";
  33.  var clsidRoot = regRoot + "\\Software\\Classes\\CLSID\\" + dllCLSID + "\\";
  34.  try{
  35.   oShell.RegDelete(clsidRoot+"ProgId\\Implemented Categories\\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}\\");
  36.   oShell.RegDelete(clsidRoot+"ProgId\\Implemented Categories\\");
  37.   oShell.RegDelete(clsidRoot+"ProgId\\");
  38.   oShell.RegDelete(clsidRoot+"InprocServer32\\1.0.2588.9125\\");
  39.   oShell.RegDelete(clsidRoot+"InprocServer32\\");
  40.   oShell.RegDelete(clsidRoot);
  41.   oShell.RegDelete(classRoot+"CLSID\\");
  42.   oShell.RegDelete(classRoot);
  43.  }
  44.  catch(err){}
  45. }
  46.  
  47. function ActivateLibrary(root){
  48.  regRoot=root;
  49.  try{
  50.   RegisterLibrary();
  51.   return new ActiveXObject(Classname);
  52.  }
  53.  catch(err){
  54.   UnregisterLibrary();
  55.   return null;
  56.  }
  57. }
  58.  
  59. function CreateObjectFromDLL(){
  60.  var Object;
  61.  Object = ActivateLibrary("HKCU");
  62.  if (Object == null) Object = ActivateLibrary("HKLM");
  63.  return Object;
  64. }