示例#1
0
        public static void Main()
        {
            bool basicCheck    = SteamApiValidator.IsValidSteamApiDll();
            bool?advancedCheck = null;

            if (SteamApiValidator.IsSteamClientUsed())
            {
                advancedCheck = SteamApiValidator.IsValidSteamClientDll();
            }

            var    dirInfo  = new DirectoryInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            string gameName = dirInfo.Name;

            dirInfo = dirInfo.Root;

            if (basicCheck && advancedCheck == true || advancedCheck == null)
            {
                Console.WriteLine("No SteamClient DLL bundled! Great!");
                Console.WriteLine($"Steam API/Client has passed first phase. Running {gameName}.");
            }
            else
            {
                if (!basicCheck)
                {
                    Console.WriteLine("Steam API DLL has been tampered and missing the certificate.");
                }

                if (!advancedCheck == false)
                {
                    Console.WriteLine("Steam client DLL has been tampered.");
                }

                Console.WriteLine("Due to Steam DRM tampering, game will not begin.");
                Console.WriteLine("Press enter to quit.");
                Console.ReadLine();
                Environment.Exit(1);
            }

            Console.WriteLine($"Thank you for support {gameName}! Loading...");

            string assemblyDataPath = Path.Combine(dirInfo.FullName, gameName + "_Data", "Managed", "Assembly-CSharp.dll");

            Directory.SetCurrentDirectory(dirInfo.FullName);
            IntPtr hPrevInstance = IntPtr.Zero;

            NativeMethods.SetDllDirectory(dirInfo.FullName);
            string niceArgs = string.Join(" ", new[] { Assembly.GetExecutingAssembly().CodeBase }.Concat(Environment.GetCommandLineArgs()));

            if (GetChecksum(assemblyDataPath) == ASSEMBLY_SHA)
            {
                niceArgs += " --disable-achievements";
            }

            var dllModule = NativeMethods.LoadLibrary(Path.Combine(dirInfo.FullName + "UnityPlayer.dll"));

            // TODO: Hop in appdomain and be cautious.

            NativeMethods.UnityMain(Process.GetCurrentProcess().Handle, IntPtr.Zero, ref niceArgs, 1);
        }
示例#2
0
        // Token: 0x0600033E RID: 830 RVA: 0x0000CBD0 File Offset: 0x0000ADD0
        public static bool IsValidSteamClientDll()
        {
            IntPtr moduleHandle = SteamApiValidator.GetModuleHandle(Environment.Is64BitProcess ? "steamclient64.dll" : "steamclient.dll");

            if (moduleHandle != IntPtr.Zero)
            {
                StringBuilder stringBuilder = new StringBuilder(32767);
                if (SteamApiValidator.GetModuleFileName(moduleHandle, stringBuilder, 32767) > 0U)
                {
                    return(SteamApiValidator.CheckIfValveSigned(stringBuilder.ToString()));
                }
            }
            return(false);
        }
示例#3
0
        // Token: 0x0600033D RID: 829 RVA: 0x0000CB50 File Offset: 0x0000AD50
        public static bool IsValidSteamApiDll()
        {
            string text   = Environment.Is64BitProcess ? "steam_api64.dll" : "steam_api.dll";
            IntPtr intPtr = SteamApiValidator.GetModuleHandle(text);

            if (intPtr == IntPtr.Zero)
            {
                intPtr = SteamApiValidator.LoadLibrary(text);
            }
            if (intPtr == IntPtr.Zero)
            {
                return(false);
            }
            if (intPtr != IntPtr.Zero)
            {
                StringBuilder stringBuilder = new StringBuilder(32767);
                if (SteamApiValidator.GetModuleFileName(intPtr, stringBuilder, 32767) > 0U)
                {
                    return(SteamApiValidator.CheckIfValveSigned(stringBuilder.ToString()));
                }
            }
            return(false);
        }