Exemple #1
0
 internal static extern int CreateAssemblyEnum(
         out IAssemblyEnum ppEnum,
         IntPtr pUnkReserved,
         IAssemblyName pName,
         AssemblyCacheFlags flags,
         IntPtr pvReserved);
Exemple #2
0
 internal static extern int GetCachePath(AssemblyCacheFlags cacheFlags, StringBuilder cachePath, ref int pcchPath);
Exemple #3
0
 internal static extern int CreateAssemblyEnum(
     out IAssemblyEnum ppEnum,
     IntPtr pUnkReserved,
     IAssemblyName pName,
     AssemblyCacheFlags flags,
     IntPtr pvReserved);
Exemple #4
0
 public extern static void GetCachePath([In] AssemblyCacheFlags dwCacheFlags, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzCachePath, [In] ref uint pcchPath);
Exemple #5
0
 static extern void CreateAssemblyEnum(out IAssemblyEnum pEnum, IntPtr pUnkReserved, IAssemblyName pName,
                                       AssemblyCacheFlags dwFlags, IntPtr pvReserved);
Exemple #6
0
        internal static IEnumerable<string> GetGacPaths()
        {
            if (_gacPaths != null) return _gacPaths;

            List<string> gacPaths = new List<string>();

            AssemblyCacheFlags[] flags = new AssemblyCacheFlags[] {
                AssemblyCacheFlags.ROOT,
                AssemblyCacheFlags.ROOT_EX
            };

            foreach (AssemblyCacheFlags flag in flags)
            {
                int gacPathLength = 0;

                // Request the size of buffer for the path.
                int hresult = GetCachePath(flag, null, ref gacPathLength);

                //
                // When gacPathLength is set to 0 and passed to this method, the return value
                // is an error which indicates INSUFFICIENT_BUFFER, so the code here doesn't
                // check that return value, but just check whether the returned desired buffer
                // length is valid or not.
                //
                if (gacPathLength > 0)
                {
                    // Allocate the right size for that buffer.
                    StringBuilder gacPath = new StringBuilder(gacPathLength);

                    // Get the real path string to the buffer.
                    hresult = GetCachePath(flag, gacPath, ref gacPathLength);

                    if (hresult >= 0)
                    {
                        gacPaths.Add(gacPath.ToString());
                    }
                }
            }
            if (gacPaths.Count > 0)
            {
                _gacPaths = gacPaths;
            }
            return _gacPaths;
        }
Exemple #7
0
 internal static extern int GetCachePath(AssemblyCacheFlags cacheFlags, StringBuilder cachePath, ref int pcchPath);
Exemple #8
0
 private static extern void GetCachePath(AssemblyCacheFlags dwCacheFlags, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzCachePath,
                                         ref uint pcchPath);