コード例 #1
0
ファイル: Util.cs プロジェクト: Sofunny17/GTANetwork
        public static unsafe IntPtr FindPattern(string bytes, string mask)
        {
            var patternPtr = Marshal.StringToHGlobalAnsi(bytes);
            var maskPtr    = Marshal.StringToHGlobalAnsi(bytes);

            IntPtr output;

            try
            {
                output =
                    new IntPtr(
                        unchecked (
                            (long)
                            MemoryAccess.FindPattern(
                                (sbyte *)patternPtr.ToPointer(),
                                (sbyte *)patternPtr.ToPointer()
                                )));
            }
            finally
            {
                Marshal.FreeHGlobal(patternPtr);
                Marshal.FreeHGlobal(maskPtr);
            }

            return(output);
        }