Esempio n. 1
0
        public static void Main()
        {
            File.WriteAllText("steam_appid.txt", "630");

            Steamworks.Load(true);

            ISteamClient006 steamclient = Steamworks.CreateInterface <ISteamClient006>();

            int pipe = steamclient.CreateSteamPipe();
            int user = steamclient.ConnectToGlobalUser(pipe); // steamclient.CreateLocalUser(ref pipe); // steamclient.ConnectToGlobalUser(pipe);

            ISteamUser004 steamuser = steamclient.GetISteamUser <ISteamUser004>(user, pipe);


            ISteam003 steam003 = Steamworks.CreateSteamInterface <ISteam003>();

            StringBuilder version = new StringBuilder();

            version.EnsureCapacity(256);

            steam003.GetVersion(version);

            TSteamError   error = new TSteamError();
            uint          sz    = 0;
            StringBuilder email = new StringBuilder();

            email.EnsureCapacity(256);

            steam003.GetCurrentEmailAddress(email, ref sz, ref error);

            CSteamID steamid = steamuser.GetSteamID();

            ISteamFriends003 friends  = steamclient.GetISteamFriends <ISteamFriends003>(user, pipe);
            ISteamFriends002 friends2 = steamclient.GetISteamFriends <ISteamFriends002>(user, pipe);

            int num = friends.GetFriendCount(EFriendFlags.k_EFriendFlagAll);

            for (int i = 0; i < num; i++)
            {
                CSteamID id   = friends.GetFriendByIndex(i, EFriendFlags.k_EFriendFlagAll);
                string   name = friends.GetFriendPersonaName(id);

                if (name == "Stan")
                {
                    byte[] buff = Encoding.ASCII.GetBytes("Oidy.");
                    friends2.SendMsgToFriend(id, EChatEntryType.k_EChatEntryTypeChatMsg, buff);
                }

                Debug.WriteLine(name);
            }
        }
Esempio n. 2
0
        private int LoadSteam()
        {
            if (Steamworks.Load(true))
            {
                Console.WriteLine("Ok, Steam Works!");
            }
            else
            {
                MessageBox.Show("Failed, Steam Works!");
                Console.WriteLine("Failed, Steam Works!");

                return(-1);
            }

            steam006 = Steamworks.CreateSteamInterface <ISteam006>();

            steamclient     = Steamworks.CreateInterface <ISteamClient012>();
            pipe            = steamclient.CreateSteamPipe();
            user            = steamclient.ConnectToGlobalUser(pipe);
            steamuser       = steamclient.GetISteamUser <ISteamUser016>(user, pipe);
            steamfriends013 = steamclient.GetISteamFriends <ISteamFriends013>(user, pipe);
            steamfriends002 = steamclient.GetISteamFriends <ISteamFriends002>(user, pipe);
            CSteamID steamID = steamuser.GetSteamID();

            CurrentState = steamfriends002.GetFriendPersonaState(steamID);

            string ConvertTo64 = steamID.ConvertToUint64().ToString();

            txtBox_steamID.Text = ConvertTo64;
            steamid             = steamID;
            if (steam006 == null)
            {
                Console.WriteLine("steam006 is null !");
                return(-1);
            }
            if (steamclient == null)
            {
                Console.WriteLine("steamclient is null !");
                return(-1);
            }


            return(0);
        }
Esempio n. 3
0
        public bool GetInterface()
        {
            steamFriends = Steamworks.CastInterface<ISteamFriends002> ( steamClient.GetISteamFriends ( user, pipe, "SteamFriends002" ) );

            if ( steamFriends == null )
                return false;

            clientFriends = Steamworks.CastInterface<IClientFriends> ( clientEngine.GetIClientFriends ( user, pipe, "CLIENTFRIENDS_INTERFACE_VERSION001" ) );

            if ( clientFriends == null )
                return false;

            // Virtual Table
            VTable vTable = new VTable ( clientFriends.Interface );

            getChatMsg = vTable.GetFunc<NativeGetChatRoomEntry> ( 99 );
            getChatName = vTable.GetFunc<NativeGetChatRoomName> ( 117 );
            sendChatMsg = vTable.GetFunc<NativeSendChatMsg> ( 98 );

            CallbackDispatcher.SpawnDispatchThread ( pipe );

            return true;
        }
Esempio n. 4
0
        public bool GetInterface()
        {
            steamFriends = Steamworks.CastInterface<ISteamFriends002>( steamClient.GetISteamFriends( user, pipe, "SteamFriends002" ) );

            if ( steamFriends == null )
                return false;

            clientFriends = Steamworks.CastInterface<IClientFriends>( clientEngine.GetIClientFriends( user, pipe, "CLIENTFRIENDS_INTERFACE_VERSION001" ) );

            if ( clientFriends == null )
                return false;

            VTable vTable = new VTable( clientFriends.Interface );

            getChatMsg = vTable.GetFunc<NativeGetChatRoomEntry>( 99 );
            getChatName = vTable.GetFunc<NativeGetChatRoomName>( 117 );

            groupChatEnabled = true;
            groupStatusMsg = "Enabled with vtable offsets. (Dangerous)";

            CallbackDispatcher.SpawnDispatchThread( pipe );

            return true;
        }
Esempio n. 5
0
        public bool GetInterface()
        {
            steamFriends = Steamworks.CastInterface<ISteamFriends002>( steamClient.GetISteamFriends( user, pipe, "SteamFriends002" ) );

            if ( steamFriends == null )
                return false;

            clientFriends = Steamworks.CastInterface<IClientFriends>( clientEngine.GetIClientFriends( user, pipe, "CLIENTFRIENDS_INTERFACE_VERSION001" ) );

            if ( clientFriends == null )
                return false;

            VTable vTable = new VTable( clientFriends.Interface );

            getChatMsg = vTable.GetFunc<NativeGetChatRoomEntry>( 99 );
            getChatName = vTable.GetFunc<NativeGetChatRoomName>( 117 );

            groupChatEnabled = true;
            groupStatusMsg = "Enabled with vtable offsets. (Dangerous)";

            CallbackDispatcher.SpawnDispatchThread( pipe );

            return true;
        }
Esempio n. 6
0
        public Steam()
        {
            _log = LogManager.GetLogger(this);

            _log.Info("Steam initializing...");

            if (!Steamworks.Load())
            {
                _log.Error("Failed to load Steamworks.");
                throw new SteamException("Failed to load Steamworks");
            }

            _log.Debug("Creating SteamClient012 interface...");

            SteamClient012 = Steamworks.CreateInterface <ISteamClient012>();

            if (SteamClient012 == null)
            {
                _log.Error("Failed to create SteamClient012 interface");
                throw new SteamException("Failed to create SteamClient012 interface");
            }

            _log.Debug("Creating steam pipe and connecting to global user...");

            _pipe = SteamClient012.CreateSteamPipe();

            if (_pipe == 0)
            {
                _log.Error("Failed to create Steam pipe");
                throw new SteamException("Failed to create Steam pipe");
            }

            _user = SteamClient012.ConnectToGlobalUser(_pipe);

            if (_user == 0)
            {
                _log.Error("Failed to connect user");
                throw new SteamException("Failed to connect to global user");
            }

            _log.Debug("Getting SteamUtils005 interface...");

            SteamUtils005 = SteamClient012.GetISteamUtils <ISteamUtils005>(_pipe);

            if (SteamUtils005 == null)
            {
                _log.Error("Failed to obtain Steam utils");
                throw new SteamException("Failed to obtain Steam utils");
            }

            _log.Debug("Getting SteamUser016 interface...");

            SteamUser016 = SteamClient012.GetISteamUser <ISteamUser016>(_user, _pipe);

            if (SteamUser016 == null)
            {
                _log.Error("Failed to obtain Steam user interface");
                throw new SteamException("Failed to obtain Steam user interface");
            }

            _log.Debug("Getting SteamFriends002 interface...");

            SteamFriends002 = SteamClient012.GetISteamFriends <ISteamFriends002>(_user, _pipe);

            if (SteamFriends002 == null)
            {
                _log.Error("Failed to obtain Steam friends (002)");
                throw new SteamException("Failed to obtain Steam friends (002)");
            }

            _log.Debug("Getting SteamFriends014 interface...");

            SteamFriends014 = SteamClient012.GetISteamFriends <ISteamFriends014>(_user, _pipe);

            if (SteamFriends014 == null)
            {
                _log.Error("Failed to obtain Steam friends (013)");
                throw new SteamException("Failed to obtain Steam friends (013)");
            }

            SteamApps001 = SteamClient012.GetISteamApps <ISteamApps001>(_user, _pipe);

            if (SteamApps001 == null)
            {
                _log.Error("Failed to obtain SteamApps006");
                throw new SteamException("Failed to obtain SteamApps006");
            }

            SteamApps006 = SteamClient012.GetISteamApps <ISteamApps006>(_user, _pipe);

            if (SteamApps006 == null)
            {
                _log.Error("Failed to obtain Steam apps (006)");
                throw new SteamException("Failed to obtain Steam apps (006)");
            }

            SteamInstallPath = Steamworks.GetInstallPath();
            SteamConfigPath  = Path.Combine(SteamInstallPath, "config", "config.vdf");

            _log.DebugFormat("Steam installed at {0}, config at {1}", SteamInstallPath, SteamConfigPath);

            // Set up callbacks
            _log.Debug("Setting up Steam callbacks...");
            _personaStateChange        = new Callback <PersonaStateChange_t>(HandlePersonaStateChange);
            _friendProfileInfoResponse = new Callback <FriendProfileInfoResponse_t>(HandleFriendProfileInfoResponse);
            _friendAdded         = new Callback <FriendAdded_t>(HandleFriendAdded);
            _friendChatMessage   = new Callback <FriendChatMsg_t>(HandleFriendChatMessage);
            _appEventStateChange = new Callback <AppEventStateChange_t>(HandleAppEventStateChange);

            LocalUser = new LocalUser(this);
            Friends   = new Friends(this);
            Apps      = new Apps(this);

            // Spawn dispatch thread
            CallbackDispatcher.SpawnDispatchThread(_pipe);
        }
        public bool GetInterface()
        {
            steamFriends = Steamworks.CastInterface<ISteamFriends002>(steamClient.GetISteamFriends(user, pipe, steamFriendsEngineVersion));

            if (steamFriends == null)
                return false;

            Program.logToWindow("Got ISteamFriends002 interface");

            clientFriends = Steamworks.CastInterface<IClientFriends>(clientEngine.GetIClientFriends(user, pipe, clientFriendsEngineVersion));

            if (clientFriends == null)
                return false;

            Program.logToWindow("Got IClientFriends interface");

            VTable vTable = new VTable(clientFriends.Interface);

            getChatMsg = vTable.GetFunc<NativeGetChatRoomEntry>(99);
            getChatName = vTable.GetFunc<NativeGetChatRoomName>(117);
            sendChatMsg = vTable.GetFunc<NativeSendChatMsg>(98);

            groupChatEnabled = true;
            groupStatusMsg = "Enabled with vTable offsets";

            CallbackDispatcher.SpawnDispatchThread(pipe);

            Program.logToWindow("Found steam interface. Listing current clans:");

            int numClans = steamFriends.GetClanCount();
            for (int i = 0; i < numClans; i++)
            {
                ulong clanId = steamFriends.GetClanByIndex(i);
                Program.logToWindow("Clan Num: " + i + " ID: " + clanId + " Name: " + steamFriends.GetClanName(clanId));
            }

            return true;
        }
Esempio n. 8
0
        public bool GetInterface()
        {
            steamFriends = Steamworks.CastInterface<ISteamFriends002>( steamClient.GetISteamFriends( user, pipe, "SteamFriends002" ) );

            if ( steamFriends == null )
                return false;

            clientFriends = Steamworks.CastInterface<IClientFriends>( clientEngine.GetIClientFriends( user, pipe, "CLIENTFRIENDS_INTERFACE_VERSION001" ) );

            if ( clientFriends == null )
                return false;

            VTScan vtScan = new VTScan( clientFriends.Interface );

            if ( vtScan.Init() )
            {

                /*
                .text:3809F73D 6A 00                                   push    0
                .text:3809F73F 68 62 D4 46 38                          push    offset unk_3846D462
                .text:3809F744 68 95 03 00 00                          push    394h
                .text:3809F749 68 40 E7 3C 38                          push    offset aEBuild_slav_20 ; "e:\\build_slave\\steam_rel_client_win32\\b"...
                .text:3809F74E 6A 00                                   push    0
                .text:3809F750 68 90 E7 3C 38                          push    offset asc_383CE790 ; "Assertion Failed: bufRet.GetUint8() == "...
                .text:3809F755 FF 15 44 E5 37 38                       call    ds:AssertMsgImplementation
                */
                var results = vtScan.DoScan<NativeGetChatRoomEntry>(
                    "\x6A\x00\x68\x62\xD4\x46\x38\x68\x83\x03\x00\x00\x68\x40\xE7\x3C\x38\x6A\x00\x68\x90\xE7\x3C\x38\xFF\x15\x44\xE5\x37\x38",
                    "xxx????xxxxxx????xxx????xx????"
                );

                bool foundFirst = false;

                if ( results.Count == 0 )
                {
                    groupStatusMsg = "Error: Unable to scan for GetChatRoomEntry";
                }
                else
                {
                    if ( results.Count > 1 )
                    {
                        groupStatusMsg = "Error: Scan for GetChatRoomEntry gave multiple results!";
                    }
                    else
                    {
                        getChatMsg = results[ 0 ].Delegate;
                        foundFirst = true;
                    }
                }

                /*
                .text:380A06A4 6A 00                                   push    0
                .text:380A06A6 68 69 D4 46 38                          push    offset unk_3846D469
                .text:380A06AB 68 AB 03 00 00                          push    3AAh
                .text:380A06B0 68 40 E7 3C 38                          push    offset aEBuild_slav_20 ; "e:\\build_slave\\steam_rel_client_win32\\b"...
                .text:380A06B5 6A 00                                   push    0
                .text:380A06B7 68 90 E7 3C 38                          push    offset asc_383CE790 ; "Assertion Failed: bufRet.GetUint8() == "...
                .text:380A06BC FF 15 44 E5 37 38                       call    ds:AssertMsgImplementation
                */

                var results2 = vtScan.DoScan<NativeGetChatRoomName>(
                    "\x6A\x00\x68\x69\xD4\x46\x38\x68\x99\x03\x00\x00\x68\x40\xE7\x3C\x38\x6A\x00\x68\x90\xE7\x3C\x38\xFF\x15\x44\xE5\x37\x38",
                    "xxx????xxxxxx????xxx????xx????"
                );

                if ( results2.Count == 0 )
                {
                    groupStatusMsg = "Error: Unable to scan for GetChatRoomName";
                }
                else
                {
                    if ( results2.Count > 1 )
                    {
                        groupStatusMsg = "Error: Scan for GetChatRoomName gave multiple results!";
                    }
                    else
                    {
                        getChatName = results2[ 0 ].Delegate;
                        groupChatEnabled = foundFirst && true;
                    }
                }
            }
            else
            {
                groupStatusMsg = "Error: Unable to initialize scan!";
            }

            CallbackDispatcher.SpawnDispatchThread( pipe );

            return true;
        }
Esempio n. 9
0
        private int LoadSteam()
        {
            if (Steamworks.Load(true))
            {
                Console.WriteLine("Ok, Steam Works!");
            }
            else
            {
                MessageBox.Show("Failed, Steam Works!");
                Console.WriteLine("Failed, Steam Works!");

                return(-1);
            }

            steam006 = Steamworks.CreateSteamInterface <ISteam006>();
            TSteamError steamError = new TSteamError();

            version = new StringBuilder();
            steam006.ClearError(ref steamError);

            steamclient  = Steamworks.CreateInterface <ISteamClient012>();
            clientengine = Steamworks.CreateInterface <IClientEngine>();
            pipe         = steamclient.CreateSteamPipe();
            user         = steamclient.ConnectToGlobalUser(pipe);
            steamuser    = steamclient.GetISteamUser <ISteamUser016>(user, pipe);

            steamutils      = steamclient.GetISteamUtils <ISteamUtils005>(pipe);
            userstats002    = steamclient.GetISteamUserStats <ISteamUserStats002>(user, pipe);
            userstats010    = steamclient.GetISteamUserStats <ISteamUserStats010>(user, pipe);
            steamfriends013 = steamclient.GetISteamFriends <ISteamFriends013>(user, pipe);
            steamfriends002 = steamclient.GetISteamFriends <ISteamFriends002>(user, pipe);
            clientuser      = clientengine.GetIClientUser <IClientUser>(user, pipe);
            clientfriends   = clientengine.GetIClientFriends <IClientFriends>(user, pipe);

            Console.WriteLine("\nSteam2 tests:");


            if (steam006 == null)
            {
                Console.WriteLine("steam006 is null !");
                return(-1);
            }


            Console.Write("GetVersion: ");


            if (steam006.GetVersion(version, (uint)version.Capacity) != 0)
            {
                Console.WriteLine("Ok (" + version.ToString() + "), Version!");
            }
            else
            {
                Console.WriteLine("Failed, Get Version!");
                return(-1);
            }

            Console.WriteLine("\nSteam3 tests:");


            if (steamclient == null)
            {
                Console.WriteLine("steamclient is null !");
                return(-1);
            }


            if (clientengine == null)
            {
                Console.WriteLine("clientengine is null !");
                return(-1);
            }


            if (pipe == 0)
            {
                Console.WriteLine("Failed to create a pipe");
                return(-1);
            }


            if (user == 0 || user == -1)
            {
                Console.WriteLine("Failed to connect to global user");
                return(-1);
            }


            if (steamuser == null)
            {
                Console.WriteLine("steamuser is null !");
                return(-1);
            }

            if (steamutils == null)
            {
                Console.WriteLine("steamutils is null !");
                return(-1);
            }

            if (userstats002 == null)
            {
                Console.WriteLine("userstats002 is null !");
                return(-1);
            }

            if (userstats010 == null)
            {
                Console.WriteLine("userstats010 is null !");
                return(-1);
            }

            if (steamfriends013 == null)
            {
                Console.WriteLine("steamfriends013 is null !");
                return(-1);
            }

            if (clientuser == null)
            {
                Console.WriteLine("clientuser is null !");
                return(-1);
            }

            if (clientfriends == null)
            {
                Console.WriteLine("clientfriends is null !");
                return(-1);
            }

            if (steamfriends002 == null)
            {
                Console.WriteLine("steamfriends002 is nulll!");
                return(-1);
            }

            Console.Write("RequestCurrentStats: ");
            if (userstats002.RequestCurrentStats(steamutils.GetAppID()))
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed");
                return(-1);
            }


            return(0);
        }
Esempio n. 10
0
        /// <summary>
        /// Initialize steam stuff
        /// </summary>
        private void Init()
        {
            // load library
            if (!Steamworks.Load())
            {
                Error("Unable to load steam library");
            }

            // load client
            if (m_SteamClient == null)
            {
                m_SteamClient = Steamworks.CreateInterface <ISteamClient010>();

                if (m_SteamClient == null)
                {
                    Error("Unable to create steam client interface");
                }
            }

            // load tube
            if (m_Pipe == 0)
            {
                m_Pipe = m_SteamClient.CreateSteamPipe();

                if (m_Pipe == 0)
                {
                    Error("Unable to create tube");
                }
            }

            // load user
            if (m_User == 0)
            {
                m_User = m_SteamClient.ConnectToGlobalUser(m_Pipe);

                if (m_User == 0)
                {
                    Error("Unable to connect to user");
                }
            }

            // load steam user
            if (m_SteamUser == null)
            {
                m_SteamUser = m_SteamClient.GetISteamUser <ISteamUser016>(m_User, m_Pipe);

                if (m_SteamUser == null)
                {
                    Error("Unable to create steam user interface");
                }
            }

            // load steam friends
            if (m_SteamFriends == null)
            {
                m_SteamFriends = m_SteamClient.GetISteamFriends <ISteamFriends009>(m_User, m_Pipe);

                if (m_SteamFriends == null)
                {
                    Error("Unable to create steam friends interface");
                }
            }

            // load steam friends 002
            if (m_SteamFriends002 == null)
            {
                m_SteamFriends002 = m_SteamClient.GetISteamFriends <ISteamFriends002>(m_User, m_Pipe);

                if (m_SteamFriends002 == null)
                {
                    Error("Unable to create steam friends (002) interface");
                }
            }


            // load steam apps
            if (m_SteamApps == null)
            {
                m_SteamApps = m_SteamClient.GetISteamApps <ISteamApps004>(m_User, m_Pipe);

                if (m_SteamApps == null)
                {
                    Error("Unable to create steam apps interface");
                }
            }

            // load steam utils
            if (m_SteamUtils == null)
            {
                m_SteamUtils = m_SteamClient.GetISteamUtils <ISteamUtils005>(m_Pipe);

                if (m_SteamUtils == null)
                {
                    Error("Unable to create steam utils interface");
                }
            }
        }
Esempio n. 11
0
        public bool GetInterface()
        {
            steamFriends = Steamworks.CastInterface <ISteamFriends002>(steamClient.GetISteamFriends(user, pipe, "SteamFriends002"));

            if (steamFriends == null)
            {
                return(false);
            }

            clientFriends = Steamworks.CastInterface <IClientFriends>(clientEngine.GetIClientFriends(user, pipe, "CLIENTFRIENDS_INTERFACE_VERSION001"));

            if (clientFriends == null)
            {
                return(false);
            }

            VTScan vtScan = new VTScan(clientFriends.Interface);

            if (vtScan.Init())
            {
                /*
                 * .text:3809F73D 6A 00                                   push    0
                 * .text:3809F73F 68 62 D4 46 38                          push    offset unk_3846D462
                 * .text:3809F744 68 95 03 00 00                          push    394h
                 * .text:3809F749 68 40 E7 3C 38                          push    offset aEBuild_slav_20 ; "e:\\build_slave\\steam_rel_client_win32\\b"...
                 * .text:3809F74E 6A 00                                   push    0
                 * .text:3809F750 68 90 E7 3C 38                          push    offset asc_383CE790 ; "Assertion Failed: bufRet.GetUint8() == "...
                 * .text:3809F755 FF 15 44 E5 37 38                       call    ds:AssertMsgImplementation
                 */
                var results = vtScan.DoScan <NativeGetChatRoomEntry>(
                    "\x6A\x00\x68\x62\xD4\x46\x38\x68\x83\x03\x00\x00\x68\x40\xE7\x3C\x38\x6A\x00\x68\x90\xE7\x3C\x38\xFF\x15\x44\xE5\x37\x38",
                    "xxx????xxxxxx????xxx????xx????"
                    );

                bool foundFirst = false;

                if (results.Count == 0)
                {
                    groupStatusMsg = "Error: Unable to scan for GetChatRoomEntry";
                }
                else
                {
                    if (results.Count > 1)
                    {
                        groupStatusMsg = "Error: Scan for GetChatRoomEntry gave multiple results!";
                    }
                    else
                    {
                        getChatMsg = results[0].Delegate;
                        foundFirst = true;
                    }
                }

                /*
                 * .text:380A06A4 6A 00                                   push    0
                 * .text:380A06A6 68 69 D4 46 38                          push    offset unk_3846D469
                 * .text:380A06AB 68 AB 03 00 00                          push    3AAh
                 * .text:380A06B0 68 40 E7 3C 38                          push    offset aEBuild_slav_20 ; "e:\\build_slave\\steam_rel_client_win32\\b"...
                 * .text:380A06B5 6A 00                                   push    0
                 * .text:380A06B7 68 90 E7 3C 38                          push    offset asc_383CE790 ; "Assertion Failed: bufRet.GetUint8() == "...
                 * .text:380A06BC FF 15 44 E5 37 38                       call    ds:AssertMsgImplementation
                 */

                var results2 = vtScan.DoScan <NativeGetChatRoomName>(
                    "\x6A\x00\x68\x69\xD4\x46\x38\x68\x99\x03\x00\x00\x68\x40\xE7\x3C\x38\x6A\x00\x68\x90\xE7\x3C\x38\xFF\x15\x44\xE5\x37\x38",
                    "xxx????xxxxxx????xxx????xx????"
                    );

                if (results2.Count == 0)
                {
                    groupStatusMsg = "Error: Unable to scan for GetChatRoomName";
                }
                else
                {
                    if (results2.Count > 1)
                    {
                        groupStatusMsg = "Error: Scan for GetChatRoomName gave multiple results!";
                    }
                    else
                    {
                        getChatName      = results2[0].Delegate;
                        groupChatEnabled = foundFirst && true;
                    }
                }
            }
            else
            {
                groupStatusMsg = "Error: Unable to initialize scan!";
            }

            CallbackDispatcher.SpawnDispatchThread(pipe);

            return(true);
        }