Exemple #1
0
        public static long LoadModule(IntPtr sessionCookie, string moduleFilePath, ISymUnmanagedSourceServerModule sourceServerModule)
        {
            if (moduleFilePath == null) throw new ArgumentNullException("moduleFilePath");
            if (sourceServerModule == null) throw new ArgumentNullException("sourceServerModule");

            long moduleCookie = ((long)moduleFilePath.ToLower().GetHashCode()) << 30;

            if (SrcSrvIsModuleLoaded(sessionCookie, moduleCookie))
            {
                // Already loaded.
                //
                return moduleCookie;
            }

            IntPtr data;
            uint dataByteCount;

            if (sourceServerModule.GetSourceServerData(out dataByteCount, out data) < 0)
            {
                // VS2005 fails on .pdb files produced by Phoenix compiler.
                // https://connect.microsoft.com/Phoenix/
                //
                return 0L;
            }

            try
            {
                return SrcSrvLoadModule(sessionCookie, Path.GetFileName(moduleFilePath),
                    moduleCookie, data, dataByteCount) ? moduleCookie : 0L;
            }
            finally
            {
                Marshal.FreeCoTaskMem(data);
            }
        }
Exemple #2
0
        public static long LoadModule(IntPtr sessionCookie, string moduleFilePath, ISymUnmanagedSourceServerModule sourceServerModule)
        {
            if (moduleFilePath == null)
            {
                throw new ArgumentNullException("moduleFilePath");
            }
            if (sourceServerModule == null)
            {
                throw new ArgumentNullException("sourceServerModule");
            }

            long moduleCookie = ((long)moduleFilePath.ToLower().GetHashCode()) << 30;

            if (SrcSrvIsModuleLoaded(sessionCookie, moduleCookie))
            {
                // Already loaded.
                //
                return(moduleCookie);
            }

            IntPtr data;
            uint   dataByteCount;

            if (sourceServerModule.GetSourceServerData(out dataByteCount, out data) < 0)
            {
                // VS2005 fails on .pdb files produced by Phoenix compiler.
                // https://connect.microsoft.com/Phoenix/
                //
                return(0L);
            }

            try
            {
                return(SrcSrvLoadModule(sessionCookie, Path.GetFileName(moduleFilePath),
                                        moduleCookie, data, dataByteCount) ? moduleCookie : 0L);
            }
            finally
            {
                Marshal.FreeCoTaskMem(data);
            }
        }