コード例 #1
0
        public void GetVersionInfo(ulong addr, out VersionInfo version)
        {
            StringBuilder filename = new StringBuilder(1024);

            GetModuleFileNameExA(_process, addr.AsIntPtr(), filename, filename.Capacity);

            if (DataTarget.PlatformFunctions.GetFileVersion(filename.ToString(), out int major, out int minor, out int revision, out int patch))
            {
                version = new VersionInfo(major, minor, revision, patch);
            }
コード例 #2
0
ファイル: LegacyRuntime.cs プロジェクト: timhe/clrmd
        internal override IDomainLocalModuleData GetDomainLocalModuleById(ulong appDomain, ulong id)
        {
            byte[] inout = GetByteArrayForStruct <LegacyDomainLocalModuleData>();

            int i = WriteValueToBuffer(appDomain, inout, 0);

            WriteValueToBuffer(id.AsIntPtr(), inout, i);

            if (Request(DacRequests.DOMAINLOCALMODULEFROMAPPDOMAIN_DATA, null, inout))
            {
                return(ConvertStruct <IDomainLocalModuleData, LegacyDomainLocalModuleData>(inout));
            }

            return(null);
        }
コード例 #3
0
        public bool GetVersionInfo(ulong addr, out VersionInfo version)
        {
            StringBuilder fileName = new StringBuilder(1024);
            uint          res      = GetModuleFileNameEx(_process, addr.AsIntPtr(), fileName, fileName.Capacity);

            DebugOnly.Assert(res != 0);

            if (DataTarget.PlatformFunctions.GetFileVersion(fileName.ToString(), out int major, out int minor, out int revision, out int patch))
            {
                version = new VersionInfo(major, minor, revision, patch, true);
                return(true);
            }

            version = default;
            return(false);
        }
コード例 #4
0
        public override int Read(ulong address, Span <byte> buffer)
        {
            DebugOnly.Assert(!buffer.IsEmpty);
            try
            {
                fixed(byte *ptr = buffer)
                {
                    int res = ReadProcessMemory(_process, address.AsIntPtr(), ptr, new IntPtr(buffer.Length), out IntPtr read);

                    return((int)read);
                }
            }
            catch (OverflowException)
            {
                return(0);
            }
        }
コード例 #5
0
        public bool Read(ulong address, Span <byte> buffer, out int bytesRead)
        {
            DebugOnly.Assert(!buffer.IsEmpty);
            try
            {
                fixed(byte *ptr = buffer)
                {
                    int res = ReadProcessMemory(_process, address.AsIntPtr(), ptr, new IntPtr(buffer.Length), out IntPtr read);

                    bytesRead = (int)read;
                    return(res != 0);
                }
            }
            catch
            {
                bytesRead = 0;
                return(false);
            }
        }