예제 #1
0
 public static bool IsInstalledInGacDiff(Assembly asm)
 {
     var ai = new ASSEMBLY_INFO
     {
         cbAssemblyInfo = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(ASSEMBLY_INFO)),
         dwAssemblyFlags = 0,
         uliAssemblySizeInKB = 0,
         pszCurrentAssemblyPathBuf = new string('\0', 8192),
         cchBuf = 8192,
     };
     var hresult = (uint)Gac.QueryAssemblyInfo((uint)QUERYASMINFO_FLAG.QUERYASMINFO_FLAG_VALIDATE, asm.GetName().Name, ref ai);
     if (hresult != 0 && hresult != 0x8007007a) return false; // &ASSEMBLYINFO_FLAG__INSTALLED(==1) != 0; //0x80070002 - no file, 0x8007007a - buffer too small, 0x80131047 is a FUSION_E_INVALID_NAME
     return !IsInstalledInGac(asm);
 }